@netlify/agent-runner-cli 1.159.2 → 1.159.4

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/bin.js CHANGED
@@ -24,7 +24,7 @@ ${y}`,I="",x="",R=Math.min(g,a);XU(h)&&(I+=Vie(h,T,a),S=S.slice(h.length),R-=h.l
24
24
  ${y}${I}
25
25
  ${v}`),m.pop(),`{${I}}`}case"number":return isFinite(h)?String(h):e?e(h):"null";case"boolean":return h===!0?"true":"false";case"undefined":return;case"bigint":if(n)return String(h);default:return e?e(h):void 0}}function d(p,h,m){switch(typeof h){case"string":return Cl(h);case"object":{if(h===null)return"null";if(typeof h.toJSON=="function"){if(h=h.toJSON(p),typeof h!="object")return d(p,h,m);if(h===null)return"null"}if(m.indexOf(h)!==-1)return r;let _="",y=h.length!==void 0;if(y&&Array.isArray(h)){if(h.length===0)return"[]";if(o<m.length+1)return'"[Array]"';m.push(h);let I=Math.min(h.length,a),x=0;for(;x<I-1;x++){let O=d(String(x),h[x],m);_+=O!==void 0?O:"null",_+=","}let R=d(String(x),h[x],m);if(_+=R!==void 0?R:"null",h.length-1>a){let O=h.length-a-1;_+=`,"... ${Wd(O)} not stringified"`}return m.pop(),`[${_}]`}let v=Object.keys(h),S=v.length;if(S===0)return"{}";if(o<m.length+1)return'"[Object]"';let g="",T=Math.min(S,a);y&&XU(h)&&(_+=Vie(h,",",a),v=v.slice(h.length),T-=h.length,g=","),i&&(v=ZU(v,s)),m.push(h);for(let I=0;I<T;I++){let x=v[I],R=d(x,h[x],m);R!==void 0&&(_+=`${g}${Cl(x)}:${R}`,g=",")}if(S>a){let I=S-a;_+=`${g}"...":"${Wd(I)} not stringified"`}return m.pop(),`{${_}}`}case"number":return isFinite(h)?String(h):e?e(h):"null";case"boolean":return h===!0?"true":"false";case"undefined":return;case"bigint":if(n)return String(h);default:return e?e(h):void 0}}function f(p,h,m){if(arguments.length>1){let _="";if(typeof m=="number"?_=" ".repeat(Math.min(m,10)):typeof m=="string"&&(_=m.slice(0,10)),h!=null){if(typeof h=="function")return c("",{"":p},[],h,_,"");if(Array.isArray(h))return l("",p,[],YYe(h),_,"")}if(_.length!==0)return u("",p,[],_,"")}return d("",p,[])}return f}});var Zie=E((rYt,Jie)=>{"use strict";var tF=Symbol.for("pino.metadata"),{DEFAULT_LEVELS:Kie}=QA(),JYe=Kie.info;function ZYe(t,e){t=t||[],e=e||{dedupe:!1};let r=Object.create(Kie);r.silent=1/0,e.levels&&typeof e.levels=="object"&&Object.keys(e.levels).forEach(d=>{r[d]=e.levels[d]});let n={write:i,add:a,remove:c,emit:s,flushSync:o,end:l,minLevel:0,lastId:0,streams:[],clone:u,[tF]:!0,streamLevels:r};return Array.isArray(t)?t.forEach(a,n):a.call(n,t),t=null,n;function i(d){let f,p=this.lastLevel,{streams:h}=this,m=0,_;for(let y=XYe(h.length,e.dedupe);eKe(y,h.length,e.dedupe);y=QYe(y,e.dedupe))if(f=h[y],f.level<=p){if(m!==0&&m!==f.level)break;if(_=f.stream,_[tF]){let{lastTime:v,lastMsg:S,lastObj:g,lastLogger:T}=this;_.lastLevel=p,_.lastTime=v,_.lastMsg=S,_.lastObj=g,_.lastLogger=T}_.write(d),e.dedupe&&(m=f.level)}else if(!e.dedupe)break}function s(...d){for(let{stream:f}of this.streams)typeof f.emit=="function"&&f.emit(...d)}function o(){for(let{stream:d}of this.streams)typeof d.flushSync=="function"&&d.flushSync()}function a(d){if(!d)return n;let f=typeof d.write=="function"||d.stream,p=d.write?d:d.stream;if(!f)throw Error("stream object needs to implement either StreamEntry or DestinationStream interface");let{streams:h,streamLevels:m}=this,_;typeof d.levelVal=="number"?_=d.levelVal:typeof d.level=="string"?_=m[d.level]:typeof d.level=="number"?_=d.level:_=JYe;let y={stream:p,level:_,levelVal:void 0,id:++n.lastId};return h.unshift(y),h.sort(Yie),this.minLevel=h[0].level,n}function c(d){let{streams:f}=this,p=f.findIndex(h=>h.id===d);return p>=0&&(f.splice(p,1),f.sort(Yie),this.minLevel=f.length>0?f[0].level:-1),n}function l(){for(let{stream:d}of this.streams)typeof d.flushSync=="function"&&d.flushSync(),d.end()}function u(d){let f=new Array(this.streams.length);for(let p=0;p<f.length;p++)f[p]={level:d,stream:this.streams[p].stream};return{write:i,add:a,remove:c,minLevel:d,streams:f,clone:u,emit:s,flushSync:o,[tF]:!0}}}function Yie(t,e){return t.level-e.level}function XYe(t,e){return e?t-1:0}function QYe(t,e){return e?t-1:t+1}function eKe(t,e,r){return r?t>=0:t<e}Jie.exports=ZYe});var dse=E((nYt,os)=>{"use strict";var tKe=W("os"),sse=vU(),rKe=bU(),nKe=AU(),ose=Lne(),iKe=zie(),ase=Ch(),{configure:sKe}=Wie(),{assertDefaultLevelFound:oKe,mappings:cse,genLsCache:aKe,genLevelComparison:cKe,assertLevelComparison:lKe}=HU(),{DEFAULT_LEVELS:lse,SORTING_ORDER:uKe}=QA(),{createArgsNormalizer:dKe,asChindings:fKe,buildSafeSonicBoom:Xie,buildFormatters:pKe,stringify:rF,normalizeDestFileDescriptor:Qie,noop:hKe}=XA(),{version:mKe}=GU(),{chindingsSym:ese,redactFmtSym:gKe,serializersSym:tse,timeSym:_Ke,timeSliceIndexSym:yKe,streamSym:SKe,stringifySym:rse,stringifySafeSym:nF,stringifiersSym:nse,setLevelSym:EKe,endSym:vKe,formatOptsSym:bKe,messageKeySym:TKe,errorKeySym:wKe,nestedKeySym:AKe,mixinSym:RKe,levelCompSym:xKe,useOnlyCustomLevelsSym:IKe,formattersSym:ise,hooksSym:OKe,nestedKeyStrSym:PKe,mixinMergeStrategySym:CKe,msgPrefixSym:NKe}=ase,{epochTime:use,nullTime:kKe}=ose,{pid:$Ke}=process,LKe=tKe.hostname(),DKe=sse.err,MKe={level:"info",levelComparison:uKe.ASC,levels:lse,messageKey:"msg",errorKey:"err",nestedKey:null,enabled:!0,base:{pid:$Ke,hostname:LKe},serializers:Object.assign(Object.create(null),{err:DKe}),formatters:Object.assign(Object.create(null),{bindings(t){return t},level(t,e){return{level:e}}}),hooks:{logMethod:void 0,streamWrite:void 0},timestamp:use,name:void 0,redact:null,customLevels:null,useOnlyCustomLevels:!1,depthLimit:5,edgeLimit:100},UKe=dKe(MKe),FKe=Object.assign(Object.create(null),sse);function iF(...t){let e={},{opts:r,stream:n}=UKe(e,rKe(),...t);r.level&&typeof r.level=="string"&&lse[r.level.toLowerCase()]!==void 0&&(r.level=r.level.toLowerCase());let{redact:i,crlf:s,serializers:o,timestamp:a,messageKey:c,errorKey:l,nestedKey:u,base:d,name:f,level:p,customLevels:h,levelComparison:m,mixin:_,mixinMergeStrategy:y,useOnlyCustomLevels:v,formatters:S,hooks:g,depthLimit:T,edgeLimit:I,onChild:x,msgPrefix:R}=r,O=sKe({maximumDepth:T,maximumBreadth:I}),A=pKe(S.level,S.bindings,S.log),b=rF.bind({[nF]:O}),L=i?nKe(i,b):{},C=i?{stringify:L[gKe]}:{stringify:b},w="}"+(s?`\r
26
26
  `:`
27
- `),P=fKe.bind(null,{[ese]:"",[tse]:o,[nse]:L,[rse]:rF,[nF]:O,[ise]:A}),N="";d!==null&&(f===void 0?N=P(d):N=P(Object.assign({},d,{name:f})));let j=a instanceof Function?a:a?use:kKe,V=j().indexOf(":")+1;if(v&&!h)throw Error("customLevels is required if useOnlyCustomLevels is set true");if(_&&typeof _!="function")throw Error(`Unknown mixin type "${typeof _}" - expected "function"`);if(R&&typeof R!="string")throw Error(`Unknown msgPrefix type "${typeof R}" - expected "string"`);oKe(p,h,v);let de=cse(h,v);typeof n.emit=="function"&&n.emit("message",{code:"PINO_CONFIG",config:{levels:de,messageKey:c,errorKey:l}}),lKe(m);let Te=cKe(m);return Object.assign(e,{levels:de,[xKe]:Te,[IKe]:v,[SKe]:n,[_Ke]:j,[yKe]:V,[rse]:rF,[nF]:O,[nse]:L,[vKe]:w,[bKe]:C,[TKe]:c,[wKe]:l,[AKe]:u,[PKe]:u?`,${JSON.stringify(u)}:{`:"",[tse]:o,[RKe]:_,[CKe]:y,[ese]:N,[ise]:A,[OKe]:g,silent:hKe,onChild:x,[NKe]:R}),Object.setPrototypeOf(e,iKe()),aKe(e),e[EKe](p),e}os.exports=iF;os.exports.destination=(t=process.stdout.fd)=>typeof t=="object"?(t.dest=Qie(t.dest||process.stdout.fd),Xie(t)):Xie({dest:Qie(t),minLength:0});os.exports.transport=FU();os.exports.multistream=Zie();os.exports.levels=cse();os.exports.stdSerializers=FKe;os.exports.stdTimeFunctions=Object.assign({},ose);os.exports.symbols=ase;os.exports.version=mKe;os.exports.default=iF;os.exports.pino=iF});var hse=E((iYt,pse)=>{"use strict";var rR=dse(),{serializersSym:fse}=rR.symbols,{FST_ERR_LOG_INVALID_DESTINATION:jKe}=Ur();function qKe(t){if(t.stream&&t.file)throw new jKe;t.file&&(t.stream=rR.destination(t.file),delete t.file);let e=t.logger,r=t.genReqId,n=null;return e?(t.logger=void 0,t.genReqId=void 0,e[fse]&&(t.serializers=Object.assign({},t.serializers,e[fse])),n=e.child({},t),t.logger=e,t.genReqId=r):n=rR(t,t.stream),n}var BKe={req:function(e){return{method:e.method,url:e.url,version:e.headers&&e.headers["accept-version"],host:e.host,remoteAddress:e.ip,remotePort:e.socket?e.socket.remotePort:void 0}},err:rR.stdSerializers.err,res:function(e){return{statusCode:e.statusCode}}};pse.exports={serializers:BKe,createPinoLogger:qKe}});var hE=E((sYt,gse)=>{"use strict";var{FST_ERR_LOG_LOGGER_AND_LOGGER_INSTANCE_PROVIDED:zKe,FST_ERR_LOG_INVALID_LOGGER_CONFIG:VKe,FST_ERR_LOG_INVALID_LOGGER_INSTANCE:HKe,FST_ERR_LOG_INVALID_LOGGER:GKe}=Ur();function WKe(t,e,r,n,i){let s={[t.requestIdLogLabel]:n},o=t.childLoggerFactory.call(t.server,e,s,i||{},r);return t.childLoggerFactory!==mse&&nR(o,!0),o}function mse(t,e,r){return t.child(e,r)}function nR(t,e){let r=["info","error","debug","fatal","warn","trace","child"],n=t?r.filter(i=>!t[i]||typeof t[i]!="function"):r;if(n.length){if(n.length===r.length&&!e)return!1;throw GKe(n.join(","))}else return!0}function YKe(t){if(t.logger&&t.loggerInstance)throw new zKe;if(!t.loggerInstance&&!t.logger){let o=tne();return o.child=()=>o,{logger:o,hasLogger:!1}}let{createPinoLogger:e,serializers:r}=hse();if(nR(t.loggerInstance))return{logger:e({logger:t.loggerInstance,serializers:Object.assign({},r,t.loggerInstance.serializers)}),hasLogger:!0};if(nR(t.logger))throw VKe();if(t.loggerInstance)throw HKe();let n={};return Object.prototype.toString.call(t.logger)==="[object Object]"&&Reflect.ownKeys(t.logger).forEach(s=>{Object.defineProperty(n,s,{value:t.logger[s],writable:!0,enumerable:!0,configurable:!0})}),n.level=n.level||"info",n.serializers=Object.assign({},r,n.serializers),t.logger=n,{logger:e(t.logger),hasLogger:!0}}function KKe(){let t=process.hrtime();return t[0]*1e3+t[1]/1e6}gse.exports={createChildLogger:WKe,defaultChildLoggerFactory:mse,createLogger:YKe,validateLogger:nR,now:KKe}});var iR=E((oYt,_se)=>{"use strict";_se.exports=JKe;function $h(t){return t instanceof Buffer?Buffer.from(t):new t.constructor(t.buffer.slice(),t.byteOffset,t.length)}function JKe(t){if(t=t||{},t.circles)return ZKe(t);let e=new Map;if(e.set(Date,o=>new Date(o)),e.set(Map,(o,a)=>new Map(n(Array.from(o),a))),e.set(Set,(o,a)=>new Set(n(Array.from(o),a))),t.constructorHandlers)for(let o of t.constructorHandlers)e.set(o[0],o[1]);let r=null;return t.proto?s:i;function n(o,a){let c=Object.keys(o),l=new Array(c.length);for(let u=0;u<c.length;u++){let d=c[u],f=o[d];typeof f!="object"||f===null?l[d]=f:f.constructor!==Object&&(r=e.get(f.constructor))?l[d]=r(f,a):ArrayBuffer.isView(f)?l[d]=$h(f):l[d]=a(f)}return l}function i(o){if(typeof o!="object"||o===null)return o;if(Array.isArray(o))return n(o,i);if(o.constructor!==Object&&(r=e.get(o.constructor)))return r(o,i);let a={};for(let c in o){if(Object.hasOwnProperty.call(o,c)===!1)continue;let l=o[c];typeof l!="object"||l===null?a[c]=l:l.constructor!==Object&&(r=e.get(l.constructor))?a[c]=r(l,i):ArrayBuffer.isView(l)?a[c]=$h(l):a[c]=i(l)}return a}function s(o){if(typeof o!="object"||o===null)return o;if(Array.isArray(o))return n(o,s);if(o.constructor!==Object&&(r=e.get(o.constructor)))return r(o,s);let a={};for(let c in o){let l=o[c];typeof l!="object"||l===null?a[c]=l:l.constructor!==Object&&(r=e.get(l.constructor))?a[c]=r(l,s):ArrayBuffer.isView(l)?a[c]=$h(l):a[c]=s(l)}return a}}function ZKe(t){let e=[],r=[],n=new Map;if(n.set(Date,c=>new Date(c)),n.set(Map,(c,l)=>new Map(s(Array.from(c),l))),n.set(Set,(c,l)=>new Set(s(Array.from(c),l))),t.constructorHandlers)for(let c of t.constructorHandlers)n.set(c[0],c[1]);let i=null;return t.proto?a:o;function s(c,l){let u=Object.keys(c),d=new Array(u.length);for(let f=0;f<u.length;f++){let p=u[f],h=c[p];if(typeof h!="object"||h===null)d[p]=h;else if(h.constructor!==Object&&(i=n.get(h.constructor)))d[p]=i(h,l);else if(ArrayBuffer.isView(h))d[p]=$h(h);else{let m=e.indexOf(h);m!==-1?d[p]=r[m]:d[p]=l(h)}}return d}function o(c){if(typeof c!="object"||c===null)return c;if(Array.isArray(c))return s(c,o);if(c.constructor!==Object&&(i=n.get(c.constructor)))return i(c,o);let l={};e.push(c),r.push(l);for(let u in c){if(Object.hasOwnProperty.call(c,u)===!1)continue;let d=c[u];if(typeof d!="object"||d===null)l[u]=d;else if(d.constructor!==Object&&(i=n.get(d.constructor)))l[u]=i(d,o);else if(ArrayBuffer.isView(d))l[u]=$h(d);else{let f=e.indexOf(d);f!==-1?l[u]=r[f]:l[u]=o(d)}}return e.pop(),r.pop(),l}function a(c){if(typeof c!="object"||c===null)return c;if(Array.isArray(c))return s(c,a);if(c.constructor!==Object&&(i=n.get(c.constructor)))return i(c,a);let l={};e.push(c),r.push(l);for(let u in c){let d=c[u];if(typeof d!="object"||d===null)l[u]=d;else if(d.constructor!==Object&&(i=n.get(d.constructor)))l[u]=i(d,a);else if(ArrayBuffer.isView(d))l[u]=$h(d);else{let f=e.indexOf(d);f!==-1?l[u]=r[f]:l[u]=a(d)}}return e.pop(),r.pop(),l}}});var mE=E((aYt,bse)=>{"use strict";var XKe=iR()({circles:!1,proto:!0}),{kSchemaVisited:yse,kSchemaResponse:QKe}=Ar(),sF=Symbol.for("fluent-schema-object"),{FST_ERR_SCH_MISSING_ID:e5e,FST_ERR_SCH_ALREADY_PRESENT:t5e,FST_ERR_SCH_DUPLICATE:r5e,FST_ERR_SCH_CONTENT_MISSING_SCHEMA:Sse}=Ur(),vse=["params","body","querystring","query","headers"];function sR(t){this.store=t||{}}sR.prototype.add=function(t){let e=XKe(t.isFluentSchema||t.isFluentJSONSchema||t[sF]?t.valueOf():t),r=e.$id;if(!r)throw new e5e;if(this.store[r])throw new t5e(r);this.store[r]=e};sR.prototype.getSchemas=function(){return Object.assign({},this.store)};sR.prototype.getSchema=function(t){return this.store[t]};function Ese(t){return typeof t=="object"&&Object.getPrototypeOf(t)!==Object.prototype}function n5e(t,e){if(t[yse])return t;if(t.query){if(t.querystring)throw new r5e("querystring");t.querystring=t.query}i5e(t);for(let r of vse){let n=t[r];if(n&&!Ese(n)&&r==="body"&&n.content){let i=n.content,s=Object.keys(i);for(let o=0;o<s.length;o++){let a=s[o];if(!i[a].schema)throw new Sse(a)}continue}}if(t.response){let r=Object.keys(t.response);for(let n of r){if(Ese(t.response[n]))continue;let i=t.response[n].content;if(i){let s=Object.keys(i);for(let o=0;o<s.length;o++){let a=s[o];if(!i[a].schema)throw new Sse(a)}}}}return t[yse]=!0,t}function i5e(t){for(let e of vse)t[e]&&(t[e].isFluentSchema||t[e][sF])&&(t[e]=t[e].valueOf());if(t.response){let e=Object.keys(t.response);for(let r of e)(t.response[r].isFluentSchema||t.response[r][sF])&&(t.response[r]=t.response[r].valueOf())}}function s5e(t,e,r){let n=t[QKe];if(!n)return!1;if(n[e]){if(n[e].constructor===Object&&r){let s=r.split(";",1)[0];return n[e][s]?n[e][s]:n[e]["*/*"]?n[e]["*/*"]:!1}return n[e]}let i=(e+"")[0]+"xx";if(n[i]){if(n[i].constructor===Object&&r){let s=r.split(";",1)[0];return n[i][s]?n[i][s]:n[i]["*/*"]?n[i]["*/*"]:!1}return n[i]}if(n.default){if(n.default.constructor===Object&&r){let s=r.split(";",1)[0];return n.default[s]?n.default[s]:n.default["*/*"]?n.default["*/*"]:!1}return n.default}return!1}bse.exports={buildSchemas(t){return new sR(t)},getSchemaSerializer:s5e,normalizeSchema:n5e}});var oR=E((cYt,wse)=>{"use strict";var o5e=/[\u0000-\u001f\u0022\u005c\ud800-\udfff]/;wse.exports=class Tse{constructor(e){switch(e&&e.rounding){case"floor":this.parseInteger=Math.floor;break;case"ceil":this.parseInteger=Math.ceil;break;case"round":this.parseInteger=Math.round;break;default:this.parseInteger=Math.trunc;break}this._options=e}asInteger(e){if(Number.isInteger(e))return""+e;if(typeof e=="bigint")return e.toString();let r=this.parseInteger(e);if(r===1/0||r===-1/0||r!==r)throw new Error(`The value "${e}" cannot be converted to an integer.`);return""+r}asNumber(e){let r=Number(e);if(r!==r)throw new Error(`The value "${e}" cannot be converted to a number.`);return r===1/0||r===-1/0?"null":""+r}asBoolean(e){return e&&"true"||"false"}asDateTime(e){if(e===null)return'""';if(e instanceof Date)return'"'+e.toISOString()+'"';if(typeof e=="string")return'"'+e+'"';throw new Error(`The value "${e}" cannot be converted to a date-time.`)}asDate(e){if(e===null)return'""';if(e instanceof Date)return'"'+new Date(e.getTime()-e.getTimezoneOffset()*6e4).toISOString().slice(0,10)+'"';if(typeof e=="string")return'"'+e+'"';throw new Error(`The value "${e}" cannot be converted to a date.`)}asTime(e){if(e===null)return'""';if(e instanceof Date)return'"'+new Date(e.getTime()-e.getTimezoneOffset()*6e4).toISOString().slice(11,19)+'"';if(typeof e=="string")return'"'+e+'"';throw new Error(`The value "${e}" cannot be converted to a time.`)}asString(e){let r=e.length;if(r===0)return'""';if(r<42){let n="",i=-1,s=255;for(let o=0;o<r;o++)if(s=e.charCodeAt(o),s===34||s===92)i===-1&&(i=0),n+=e.slice(i,o)+"\\",i=o;else if(s<32||s>=55296&&s<=57343)return JSON.stringify(e);return i===-1&&'"'+e+'"'||'"'+n+e.slice(i)+'"'}else return r<5e3&&o5e.test(e)===!1?'"'+e+'"':JSON.stringify(e)}asUnsafeString(e){return'"'+e+'"'}getState(){return this._options}static restoreFromState(e){return new Tse(e)}}});var Rse=E((lYt,Ase)=>{"use strict";var a5e=oR(),c5e={mode:"standalone"},l5e=a5e.restoreFromState(c5e),u5e=null;Ase.exports=(function(e,r){let{asString:n,asNumber:i,asBoolean:s,asDateTime:o,asDate:a,asTime:c,asUnsafeString:l}=r,u=r.asInteger.bind(r),d="{",f="}",p="[",h="]",m=",",_=":",y='"',v=d+f,S=p+h,g=y+y,T="null";function I(R){let O=R&&typeof R.toJSON=="function"?R.toJSON():R;if(O===null)return v;let A,b=d,L=!1;return A=O.statusCode,A!==void 0&&(!L&&(L=!0)||(b+=m),b+='"statusCode":',b+=i(A)),A=O.code,A!==void 0&&(!L&&(L=!0)||(b+=m),b+='"code":',typeof A!="string"?A===null?b+=g:A instanceof Date?b+=y+A.toISOString()+y:A instanceof RegExp?b+=n(A.source):b+=n(A.toString()):b+=n(A)),A=O.error,A!==void 0&&(!L&&(L=!0)||(b+=m),b+='"error":',typeof A!="string"?A===null?b+=g:A instanceof Date?b+=y+A.toISOString()+y:A instanceof RegExp?b+=n(A.source):b+=n(A.toString()):b+=n(A)),A=O.message,A!==void 0&&(!L&&(L=!0)||(b+=m),b+='"message":',typeof A!="string"?A===null?b+=g:A instanceof Date?b+=y+A.toISOString()+y:A instanceof RegExp?b+=n(A.source):b+=n(A.toString()):b+=n(A)),b+f}return I})(u5e,l5e)});var gE=E((uYt,Pse)=>{"use strict";var xse=W("http").STATUS_CODES,d5e=iU(),{setErrorStatusCode:f5e}=kA(),{kReplyHeaders:Kd,kReplyNextErrorHandler:aR,kReplyIsRunningOnErrorHook:p5e,kRouteContext:Ose,kDisableRequestLogging:cR}=Ar(),{FST_ERR_REP_INVALID_PAYLOAD_TYPE:h5e,FST_ERR_FAILED_ERROR_SERIALIZATION:m5e}=Ur(),{getSchemaSerializer:g5e}=mE(),oF=Rse(),_5e={func:S5e,toJSON(){return this.func.name.toString()+"()"}};function y5e(t,e,r){t[p5e]=!1;let n=t[Ose];if(t[aR]===!1){Ise(e,t,function(o,a){try{o.raw.writeHead(o.raw.statusCode,o[Kd])}catch(c){o.log[cR]||o.log.warn({req:o.request,res:o,err:c},c?.message),o.raw.writeHead(o.raw.statusCode)}o.raw.end(a)});return}let i=t[aR]||n.errorHandler;t[aR]=Object.getPrototypeOf(i),delete t[Kd]["content-type"],delete t[Kd]["content-length"];let s=i.func;if(!s){t[aR]=!1,Ise(e,t,r);return}try{let o=s(e,t.request,t);o!==void 0&&(o!==null&&typeof o.then=="function"?d5e(o,t):t.send(o))}catch(o){t.send(o)}}function S5e(t,e,r){v5e(t,r),f5e(r,t),r.statusCode<500?r.log[cR]||r.log.info({res:r,err:t},t?.message):r.log[cR]||r.log.error({req:e,res:r,err:t},t?.message),r.send(t)}function Ise(t,e,r){let n=e.raw,i=e.statusCode;e[Kd]["content-type"]=e[Kd]["content-type"]??"application/json; charset=utf-8";let s;try{let o=g5e(e[Ose],i,e[Kd]["content-type"]);o===!1?s=oF({error:xse[i+""],code:t.code,message:t.message,statusCode:i}):s=o(Object.create(t,{error:{value:xse[i+""]},message:{value:t.message},statusCode:{value:i}}))}catch(o){e.log[cR]||e.log.error({err:o,statusCode:n.statusCode},"The serializer for the given status code failed"),e.code(500),s=oF(new m5e(o.message,t.message))}typeof s!="string"&&!Buffer.isBuffer(s)&&(s=oF(new h5e(typeof s))),e[Kd]["content-length"]=""+Buffer.byteLength(s),r(e,s)}function E5e(t=_5e,e){if(!e)return t;let r=Object.create(t);return r.func=e,r}function v5e(t,e){let r=e.raw,n=r.statusCode;n=n>=400?n:500,t!=null&&(t.headers!==void 0&&e.headers(t.headers),t.status>=400?n=t.status:t.statusCode>=400&&(n=t.statusCode)),r.statusCode=n}Pse.exports={buildErrorHandler:E5e,handleError:y5e}});var SE=E((dYt,$se)=>{"use strict";var{kReply:aF,kRequest:cF,kState:b5e,kHasBeenDecorated:T5e}=Ar(),{FST_ERR_DEC_ALREADY_PRESENT:Cse,FST_ERR_DEC_MISSING_DEPENDENCY:w5e,FST_ERR_DEC_AFTER_START:A5e,FST_ERR_DEC_REFERENCE_TYPE:R5e,FST_ERR_DEC_DEPENDENCY_INVALID_TYPE:x5e,FST_ERR_DEC_UNDECLARED:I5e}=Ur();function O5e(t,e,r,n){if(Object.hasOwn(t,e))throw new Cse(e);lF(t,e,n),r&&(typeof r.getter=="function"||typeof r.setter=="function")?Object.defineProperty(t,e,{get:r.getter,set:r.setter}):t[e]=r}function P5e(t){if(!_E(this,t))throw new I5e(t,"instance");return typeof this[t]=="function"?this[t].bind(this):this[t]}function Nse(t,e,r,n){let i=t.prototype;if(Object.hasOwn(i,e)||yE(t,e))throw new Cse(e);t[T5e]=!0,lF(t,e,n),r&&(typeof r.getter=="function"||typeof r.setter=="function")?Object.defineProperty(i,e,{get:r.getter,set:r.setter}):typeof r=="function"?i[e]=r:t.props.push({key:e,value:r})}function kse(t,e){if(typeof e=="object"&&e&&!(typeof e.getter=="function"||typeof e.setter=="function"))throw new R5e(t,typeof e)}function C5e(t,e,r){return uF(this,t),O5e(this,t,e,r),this}function _E(t,e){return e?e in t||t.prototype&&e in t.prototype||yE(t,e):t in this}function yE(t,e){return t.props?t.props.find(({key:r})=>r===e):!1}function N5e(t){return t&&yE(this[cF],t)?!0:_E(this[cF].prototype,t)}function k5e(t){return t&&yE(this[aF],t)?!0:_E(this[aF].prototype,t)}function lF(t,e,r){if(r!=null){if(!Array.isArray(r))throw new x5e(e);for(let n=0;n!==r.length;++n)if(!_E(t,r[n]))throw new w5e(r[n])}}function $5e(t,e,r){return uF(this,t),kse(t,e),Nse(this[aF],t,e,r),this}function L5e(t,e,r){return uF(this,t),kse(t,e),Nse(this[cF],t,e,r),this}function uF(t,e){if(t[b5e].started)throw new A5e(e)}$se.exports={add:C5e,exist:_E,existRequest:N5e,existReply:k5e,dependencies:lF,decorateReply:$5e,decorateRequest:L5e,getInstanceDecorator:P5e,hasKey:yE}});var _R=E((fYt,gR)=>{"use strict";var lR=W("stream").finished,{kFourOhFourContext:Lse,kReplyErrorHandlerCalled:Bse,kReplyHijacked:mF,kReplyStartTime:vE,kReplyEndTime:gF,kReplySerializer:Za,kReplySerializerDefault:uR,kReplyIsError:dR,kReplyHeaders:It,kReplyTrailers:Fr,kReplyHasStatusCode:_F,kReplyIsRunningOnErrorHook:yF,kReplyNextErrorHandler:D5e,kDisableRequestLogging:zse,kSchemaResponse:fR,kReplyCacheSerializeFns:Nl,kSchemaController:dF,kOptions:M5e,kRouteContext:ct,kTimeoutTimer:pR,kOnAbort:Lh,kRequestSignal:Vse}=Ar(),{onSendHookRunner:Hse,onResponseHookRunner:U5e,preHandlerHookRunner:F5e,preSerializationHookRunner:j5e}=Ol(),Dse=dU()[Symbol.for("internals")],q5e=hE(),hF=q5e.now,{handleError:Mse}=gE(),{getSchemaSerializer:B5e}=mE(),fF={JSON:"application/json; charset=utf-8",PLAIN:"text/plain; charset=utf-8",OCTET:"application/octet-stream"},{FST_ERR_REP_INVALID_PAYLOAD_TYPE:z5e,FST_ERR_REP_RESPONSE_BODY_CONSUMED:V5e,FST_ERR_REP_READABLE_STREAM_LOCKED:H5e,FST_ERR_REP_ALREADY_SENT:G5e,FST_ERR_SEND_INSIDE_ONERR:W5e,FST_ERR_BAD_STATUS_CODE:Y5e,FST_ERR_BAD_TRAILER_NAME:K5e,FST_ERR_BAD_TRAILER_VALUE:J5e,FST_ERR_MISSING_SERIALIZATION_FN:Z5e,FST_ERR_MISSING_CONTENTTYPE_SERIALIZATION_FN:X5e,FST_ERR_DEC_UNDECLARED:Q5e}=Ur(),Use=SE(),Gse=Object.prototype.toString;function Ot(t,e,r){this.raw=t,this[Za]=null,this[Bse]=!1,this[dR]=!1,this[yF]=!1,this.request=e,this[It]={},this[Fr]=null,this[_F]=!1,this[vE]=void 0,this.log=r}Ot.props=[];Object.defineProperties(Ot.prototype,{[ct]:{get(){return this.request[ct]}},elapsedTime:{get(){return this[vE]===void 0?0:(this[gF]||hF())-this[vE]}},server:{get(){return this.request[ct].server}},sent:{enumerable:!0,get(){return(this[mF]||this.raw.writableEnded)===!0}},statusCode:{get(){return this.raw.statusCode},set(t){this.code(t)}},routeOptions:{get(){return this.request.routeOptions}}});Ot.prototype.writeEarlyHints=function(t,e){return this.raw.writeEarlyHints(t,e),this};Ot.prototype.hijack=function(){return this[mF]=!0,this.request[Vse]&&(clearTimeout(this.request[pR]),this.request[pR]=null,this.request[Lh]&&(this.request.raw.removeListener("close",this.request[Lh]),this.request[Lh]=null)),this};Ot.prototype.send=function(t){if(this[yF])throw new W5e;if(this.sent===!0)return this.log.warn({err:new G5e(this.request.url,this.request.method)}),this;if(this[dR]||t instanceof Error)return this[dR]=!1,Dh(this,t,Jd),this;if(t===void 0)return Jd(this,t),this;let e=this.getHeader("content-type"),r=e!==void 0;if(t!==null){if(typeof t.pipe=="function"||typeof t.getReader=="function"||Gse.call(t)==="[object Response]")return Jd(this,t),this;if(t.buffer instanceof ArrayBuffer){r||(this[It]["content-type"]=fF.OCTET);let n=Buffer.isBuffer(t)?t:Buffer.from(t.buffer,t.byteOffset,t.byteLength);return Jd(this,n),this}if(!r&&typeof t=="string")return this[It]["content-type"]=fF.PLAIN,Jd(this,t),this}if(this[Za]!==null){if(typeof t!="string")return Fse(this,t),this;t=this[Za](t)}else if(!r||e.indexOf("json")!==-1){if(!r)this[It]["content-type"]=fF.JSON;else if(e.indexOf("charset")===-1){let n=e.trim();n.endsWith(";")?this[It]["content-type"]=`${n} charset=utf-8`:this[It]["content-type"]=`${n}; charset=utf-8`}if(typeof t!="string")return Fse(this,t),this}return Jd(this,t),this};Ot.prototype.getHeader=function(t){t=t.toLowerCase();let e=this[It][t];return e!==void 0?e:this.raw.getHeader(t)};Ot.prototype.getHeaders=function(){return{...this.raw.getHeaders(),...this[It]}};Ot.prototype.hasHeader=function(t){return t=t.toLowerCase(),this[It][t]!==void 0||this.raw.hasHeader(t)};Ot.prototype.removeHeader=function(t){return delete this[It][t.toLowerCase()],this};Ot.prototype.header=function(t,e=""){return t=t.toLowerCase(),this[It][t]&&t==="set-cookie"?(typeof this[It][t]=="string"&&(this[It][t]=[this[It][t]]),Array.isArray(e)?Array.prototype.push.apply(this[It][t],e):this[It][t].push(e)):this[It][t]=e,this};Ot.prototype.headers=function(t){let e=Object.keys(t);for(let r=0;r!==e.length;++r){let n=e[r];this.header(n,t[n])}return this};var e8e=new Set(["transfer-encoding","content-length","host","cache-control","max-forwards","te","authorization","set-cookie","content-encoding","content-type","content-range","trailer"]);Ot.prototype.trailer=function(t,e){if(t=t.toLowerCase(),e8e.has(t))throw new K5e(t);if(typeof e!="function")throw new J5e(t,typeof e);return this[Fr]===null&&(this[Fr]={}),this[Fr][t]=e,this};Ot.prototype.hasTrailer=function(t){return this[Fr]?.[t.toLowerCase()]!==void 0};Ot.prototype.removeTrailer=function(t){return this[Fr]===null?this:(this[Fr][t.toLowerCase()]=void 0,this)};Ot.prototype.code=function(t){let e=+t;if(!(e>=100&&e<=599))throw new Y5e(t||String(t));return this.raw.statusCode=e,this[_F]=!0,this};Ot.prototype.status=Ot.prototype.code;Ot.prototype.getSerializationFunction=function(t,e){let r;return typeof t=="string"||typeof t=="number"?typeof e=="string"?r=this[ct][fR]?.[t]?.[e]:r=this[ct][fR]?.[t]:typeof t=="object"&&(r=this[ct][Nl]?.get(t)),r};Ot.prototype.compileSerializationSchema=function(t,e=null,r=null){let{request:n}=this,{method:i,url:s}=n;if(this[ct][Nl]?.has(t))return this[ct][Nl].get(t);let a=(this[ct].serializerCompiler||this.server[dF].serializerCompiler||this.server[dF].setupSerializer(this.server[M5e])||this.server[dF].serializerCompiler)({schema:t,method:i,url:s,httpStatus:e,contentType:r});return this[ct][Nl]==null&&(this[ct][Nl]=new WeakMap),this[ct][Nl].set(t,a),a};Ot.prototype.serializeInput=function(t,e,r,n){let i=r,s;if(r=typeof e=="string"||typeof e=="number"?e:r,n=r&&i!==r?i:n,r!=null){if(n!=null?s=this[ct][fR]?.[r]?.[n]:s=this[ct][fR]?.[r],s==null)throw n?new X5e(r,n):new Z5e(r)}else this[ct][Nl]?.has(e)?s=this[ct][Nl].get(e):s=this.compileSerializationSchema(e,r,n);return s(t)};Ot.prototype.serialize=function(t){return this[Za]!==null?this[Za](t):this[ct]&&this[ct][uR]?this[ct][uR](t,this.raw.statusCode):Yse(this[ct],t,this.raw.statusCode)};Ot.prototype.serializer=function(t){return this[Za]=t,this};Ot.prototype.type=function(t){return this[It]["content-type"]=t,this};Ot.prototype.redirect=function(t,e){return e||(e=this[_F]?this.raw.statusCode:302),this.header("location",t).code(e).send()};Ot.prototype.callNotFound=function(){return c8e(this),this};Ot.prototype.then=function(t,e){if(this.sent){t();return}lR(this.raw,r=>{r&&r.code!=="ERR_STREAM_PREMATURE_CLOSE"?e?e(r):this.log&&this.log.warn("unhandled rejection on reply.then"):t()})};Ot.prototype.getDecorator=function(t){if(!Use.hasKey(this,t)&&!Use.exist(this,t))throw new Q5e(t,"reply");let e=this[t];return typeof e=="function"?e.bind(this):e};function Fse(t,e){t[ct].preSerialization!==null?j5e(t[ct].preSerialization,t.request,t,e,jse):jse(null,void 0,t,e)}function jse(t,e,r,n){if(t!=null){Dh(r,t);return}try{r[Za]!==null?n=r[Za](n):r[ct]&&r[ct][uR]?n=r[ct][uR](n,r.raw.statusCode):n=Yse(r[ct],n,r.raw.statusCode,r[It]["content-type"])}catch(i){t8e(i,r),Dh(r,i);return}Jd(r,n)}function t8e(t,e){t.serialization=e[ct].config}function Jd(t,e){t[ct].onSend!==null?Hse(t[ct].onSend,t.request,t,e,r8e):Wse(t,e)}function r8e(t,e,r,n){t!=null?Dh(r,t):Wse(r,n)}function pF(t,e){let r=t.raw;try{r.writeHead(e,t[It])}catch(n){throw n.code==="ERR_HTTP_HEADERS_SENT"&&t.log.warn(`Reply was already sent, did you forget to "return reply" in the "${t.request.raw.url}" (${t.request.raw.method}) route?`),n}}function Wse(t,e){let r=t.raw,n=t.request;if(t[Fr]!==null){let s=Object.keys(t[Fr]),o="";for(let a of s)typeof t[Fr][a]=="function"&&(o+=" ",o+=a);t.header("Transfer-Encoding","chunked"),t.header("Trailer",o.trim())}if(Gse.call(e)==="[object Response]"){if(typeof e.status=="number"&&t.code(e.status),typeof e.headers=="object"&&typeof e.headers.forEach=="function")for(let[s,o]of e.headers)t.header(s,o);if(e.body!==null&&e.bodyUsed)throw new V5e;e=e.body}let i=r.statusCode;if(e==null){i>=200&&i!==204&&i!==304&&n.method!=="HEAD"&&t[Fr]===null&&(t[It]["content-length"]="0"),pF(t,i),EE(e,r,t);return}if(i>=100&&i<200||i===204){t.removeHeader("content-type"),t.removeHeader("content-length"),pF(t,i),EE(void 0,r,t),typeof e.resume=="function"&&(e.on("error",mR),e.resume());return}if(typeof e.pipe=="function"){i8e(e,r,t);return}if(typeof e.getReader=="function"){n8e(e,r,t);return}if(typeof e!="string"&&!Buffer.isBuffer(e))throw new z5e(typeof e);if(t[Fr]===null){let s=t[It]["content-length"];(!s||n.raw.method!=="HEAD"&&Number(s)!==Buffer.byteLength(e))&&(t[It]["content-length"]=""+Buffer.byteLength(e))}pF(t,i),r.write(e),EE(e,r,t)}function hR(t,e,r){e.code==="ERR_STREAM_PREMATURE_CLOSE"?t[zse]||t.info({res:r},"stream closed prematurely"):t.warn({err:e},"response terminated with an error with headers already sent")}function n8e(t,e,r){if(t.locked)throw new H5e;let n=!0,i=!1,s=!1,o=t.getReader();if(lR(e,function(u){n&&(u!=null&&e.headersSent&&!i&&(i=!0,hR(r.log,u,e)),o.cancel().catch(mR))}),e.headersSent)r.log.warn("response will send, but you shouldn't use res.writeHead in stream mode");else for(let u in r[It])e.setHeader(u,r[It][u]);function a(u){if(u.done){n=!1,EE(null,e,r);return}if(e.destroyed){n=!1,o.cancel().catch(mR);return}if(e.write(u.value)===!1){s=!0,e.once("drain",c);return}o.read().then(a,l)}function c(){!s||!n||e.destroyed||(s=!1,o.read().then(a,l))}function l(u){n=!1,e.headersSent||r.request.raw.aborted===!0?(i||(i=!0,hR(r.log,u,r)),e.destroy()):Dh(r,u)}o.read().then(a,l)}function i8e(t,e,r){let n=!0,i=!1;if(s8e(t,e,r),lR(t,{readable:!0,writable:!1},function(s){n=!1,s!=null&&(e.headersSent||r.request.raw.aborted===!0?(i||(i=!0,hR(r.log,s,r)),e.destroy()):Dh(r,s))}),lR(e,function(s){n&&(s!=null&&e.headersSent&&!i&&(i=!0,hR(r.log,s,e)),typeof t.destroy=="function"?t.destroy():typeof t.close=="function"?t.close(mR):typeof t.abort=="function"?t.abort():r.log.warn("stream payload does not end properly"))}),e.headersSent)r.log.warn("response will send, but you shouldn't use res.writeHead in stream mode");else for(let s in r[It])e.setHeader(s,r[It][s]);t.pipe(e)}function EE(t,e,r){if(r[Fr]===null){e.end(null,null,null);return}let n=Object.keys(r[Fr]),i={},s=0,o=!0;function a(){s===0&&(e.addTrailers(i),e.end(null,null,null))}for(let c of n){let l=function(d,f){s++,d?r.log.debug(d):i[c]=f,process.nextTick(a)};if(typeof r[Fr][c]!="function")continue;o=!1,s--;let u=r[Fr][c](r,t,l);typeof u=="object"&&typeof u.then=="function"&&u.then(d=>l(null,d),l)}o&&e.end(null,null,null)}function s8e(t,e,r){r[Fr]!==null&&t.on("end",()=>EE(null,e,r))}function Dh(t,e,r){t[ct].onError!==null&&!t[D5e]?(t[yF]=!0,Hse(t[ct].onError,t.request,t,e,()=>Mse(t,e,r))):Mse(t,e,r)}function o8e(t){t[vE]=hF();let e=r=>{t[gF]=hF(),t.raw.removeListener("finish",e),t.raw.removeListener("error",e);let n=t[ct];t.request[Vse]&&(clearTimeout(t.request[pR]),t.request[pR]=null,t.request[Lh]&&(t.request.raw.removeListener("close",t.request[Lh]),t.request[Lh]=null)),n&&n.onResponse!==null?U5e(n.onResponse,t.request,t,qse):qse(r,t.request,t)};t.raw.on("finish",e),t.raw.on("error",e)}function qse(t,e,r){if(r.log[zse])return;let n=r.elapsedTime;if(t!=null){r.log.error({res:r,err:t,responseTime:n},"request errored");return}r.log.info({res:r,responseTime:n},"request completed")}function a8e(t){let e=t.props.slice();function r(n,i,s){this.raw=n,this[dR]=!1,this[Bse]=!1,this[mF]=!1,this[Za]=null,this.request=i,this[It]={},this[Fr]=null,this[vE]=void 0,this[gF]=void 0,this.log=s;let o;for(let a=0;a<e.length;a++)o=e[a],this[o.key]=o.value}return Object.setPrototypeOf(r.prototype,t.prototype),Object.setPrototypeOf(r,t),r.parent=t,r.props=e,r}function c8e(t){if(t[ct][Lse]===null){t.log.warn("Trying to send a NotFound error inside a 404 handler. Sending basic 404 response."),t.code(404).send("404 Not Found");return}t.request[ct]=t[ct][Lse],t[ct].preHandler!==null?F5e(t[ct].preHandler,t.request,t,Dse.preHandlerCallback):Dse.preHandlerCallback(null,t.request,t)}function Yse(t,e,r,n){let i=B5e(t,r,n);return i?i(e):JSON.stringify(e)}function mR(){}gR.exports=Ot;gR.exports.buildReply=a8e;gR.exports.setupResponseListeners=o8e});var Kse=E((pYt,yR)=>{"use strict";function SF(t){if(!t)throw new TypeError("argument req is required");let e=t.headers["x-forwarded-for"],r=t.socket.remoteAddress;if(!e||typeof e!="string")return[r];if(e.indexOf(",")===-1){let n=e.trim();return n.length?[r,n]:[r]}else return l8e(e,r)}function l8e(t,e){let r=[e],n=t.length,i=n,s,o;for(o=n-1;o>=0;--o)s=t[o],s===" "?i===n&&(i=n=o):s===","?(i!==n&&r.push(t.slice(i,n)),i=n=o):i=o;return i!==n&&r.push(t.substring(i,n)),r}yR.exports=SF;yR.exports.default=SF;yR.exports.forwarded=SF});var Zse=E((Jse,SR)=>{"use strict";(function(t){"use strict";let e="(0?\\d+|0x[a-f0-9]+)",r={fourOctet:new RegExp(`^${e}\\.${e}\\.${e}\\.${e}$`,"i"),threeOctet:new RegExp(`^${e}\\.${e}\\.${e}$`,"i"),twoOctet:new RegExp(`^${e}\\.${e}$`,"i"),longValue:new RegExp(`^${e}$`,"i")},n=new RegExp("^0[0-7]+$","i"),i=new RegExp("^0x[a-f0-9]+$","i"),s="%[0-9a-z]{1,}",o="(?:[0-9a-f]+::?)+",a={zoneIndex:new RegExp(s,"i"),native:new RegExp(`^(::)?(${o})?([0-9a-f]+)?(::)?(${s})?$`,"i"),deprecatedTransitional:new RegExp(`^(?:::)(${e}\\.${e}\\.${e}\\.${e}(${s})?)$`,"i"),transitional:new RegExp(`^((?:${o})|(?:::)(?:${o})?)${e}\\.${e}\\.${e}\\.${e}(${s})?$`,"i")};function c(p,h){if(p.indexOf("::")!==p.lastIndexOf("::"))return null;let m=0,_=-1,y=(p.match(a.zoneIndex)||[])[0],v,S;for(y&&(y=y.substring(1),p=p.replace(/%.+$/,""));(_=p.indexOf(":",_+1))>=0;)m++;if(p.substr(0,2)==="::"&&m--,p.substr(-2,2)==="::"&&m--,m>h)return null;for(S=h-m,v=":";S--;)v+="0:";return p=p.replace("::",v),p[0]===":"&&(p=p.slice(1)),p[p.length-1]===":"&&(p=p.slice(0,-1)),h=(function(){let g=p.split(":"),T=[];for(let I=0;I<g.length;I++)T.push(parseInt(g[I],16));return T})(),{parts:h,zoneId:y}}function l(p,h,m,_){if(p.length!==h.length)throw new Error("ipaddr: cannot match CIDR for objects with different lengths");let y=0,v;for(;_>0;){if(v=m-_,v<0&&(v=0),p[y]>>v!==h[y]>>v)return!1;_-=m,y+=1}return!0}function u(p){if(i.test(p))return parseInt(p,16);if(p[0]==="0"&&!isNaN(parseInt(p[1],10))){if(n.test(p))return parseInt(p,8);throw new Error(`ipaddr: cannot parse ${p} as octal`)}return parseInt(p,10)}function d(p,h){for(;p.length<h;)p=`0${p}`;return p}let f={};f.IPv4=(function(){function p(h){if(h.length!==4)throw new Error("ipaddr: ipv4 octet count should be 4");let m,_;for(m=0;m<h.length;m++)if(_=h[m],!(0<=_&&_<=255))throw new Error("ipaddr: ipv4 octet should fit in 8 bits");this.octets=h}return p.prototype.SpecialRanges={unspecified:[[new p([0,0,0,0]),8]],broadcast:[[new p([255,255,255,255]),32]],multicast:[[new p([224,0,0,0]),4]],linkLocal:[[new p([169,254,0,0]),16]],loopback:[[new p([127,0,0,0]),8]],carrierGradeNat:[[new p([100,64,0,0]),10]],private:[[new p([10,0,0,0]),8],[new p([172,16,0,0]),12],[new p([192,168,0,0]),16]],reserved:[[new p([192,0,0,0]),24],[new p([192,0,2,0]),24],[new p([192,88,99,0]),24],[new p([198,18,0,0]),15],[new p([198,51,100,0]),24],[new p([203,0,113,0]),24],[new p([240,0,0,0]),4]],as112:[[new p([192,175,48,0]),24],[new p([192,31,196,0]),24]],amt:[[new p([192,52,193,0]),24]]},p.prototype.kind=function(){return"ipv4"},p.prototype.match=function(h,m){let _;if(m===void 0&&(_=h,h=_[0],m=_[1]),h.kind()!=="ipv4")throw new Error("ipaddr: cannot match ipv4 address with non-ipv4 one");return l(this.octets,h.octets,8,m)},p.prototype.prefixLengthFromSubnetMask=function(){let h=0,m=!1,_={0:8,128:7,192:6,224:5,240:4,248:3,252:2,254:1,255:0},y,v,S;for(y=3;y>=0;y-=1)if(v=this.octets[y],v in _){if(S=_[v],m&&S!==0)return null;S!==8&&(m=!0),h+=S}else return null;return 32-h},p.prototype.range=function(){return f.subnetMatch(this,this.SpecialRanges)},p.prototype.toByteArray=function(){return this.octets.slice(0)},p.prototype.toIPv4MappedAddress=function(){return f.IPv6.parse(`::ffff:${this.toString()}`)},p.prototype.toNormalizedString=function(){return this.toString()},p.prototype.toString=function(){return this.octets.join(".")},p})(),f.IPv4.broadcastAddressFromCIDR=function(p){try{let h=this.parseCIDR(p),m=h[0].toByteArray(),_=this.subnetMaskFromPrefixLength(h[1]).toByteArray(),y=[],v=0;for(;v<4;)y.push(parseInt(m[v],10)|parseInt(_[v],10)^255),v++;return new this(y)}catch{throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},f.IPv4.isIPv4=function(p){return this.parser(p)!==null},f.IPv4.isValid=function(p){try{return new this(this.parser(p)),!0}catch{return!1}},f.IPv4.isValidCIDR=function(p){try{return this.parseCIDR(p),!0}catch{return!1}},f.IPv4.isValidFourPartDecimal=function(p){return!!(f.IPv4.isValid(p)&&p.match(/^(0|[1-9]\d*)(\.(0|[1-9]\d*)){3}$/))},f.IPv4.isValidCIDRFourPartDecimal=function(p){let h=p.match(/^(.+)\/(\d+)$/);return!f.IPv4.isValidCIDR(p)||!h?!1:f.IPv4.isValidFourPartDecimal(h[1])},f.IPv4.networkAddressFromCIDR=function(p){let h,m,_,y,v;try{for(h=this.parseCIDR(p),_=h[0].toByteArray(),v=this.subnetMaskFromPrefixLength(h[1]).toByteArray(),y=[],m=0;m<4;)y.push(parseInt(_[m],10)&parseInt(v[m],10)),m++;return new this(y)}catch{throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},f.IPv4.parse=function(p){let h=this.parser(p);if(h===null)throw new Error("ipaddr: string is not formatted like an IPv4 Address");return new this(h)},f.IPv4.parseCIDR=function(p){let h;if(h=p.match(/^(.+)\/(\d+)$/)){let m=parseInt(h[2]);if(m>=0&&m<=32){let _=[this.parse(h[1]),m];return Object.defineProperty(_,"toString",{value:function(){return this.join("/")}}),_}}throw new Error("ipaddr: string is not formatted like an IPv4 CIDR range")},f.IPv4.parser=function(p){let h,m,_;if(h=p.match(r.fourOctet))return(function(){let y=h.slice(1,6),v=[];for(let S=0;S<y.length;S++)m=y[S],v.push(u(m));return v})();if(h=p.match(r.longValue)){if(_=u(h[1]),_>4294967295||_<0)throw new Error("ipaddr: address outside defined range");return(function(){let y=[],v;for(v=0;v<=24;v+=8)y.push(_>>v&255);return y})().reverse()}else return(h=p.match(r.twoOctet))?(function(){let y=h.slice(1,4),v=[];if(_=u(y[1]),_>16777215||_<0)throw new Error("ipaddr: address outside defined range");return v.push(u(y[0])),v.push(_>>16&255),v.push(_>>8&255),v.push(_&255),v})():(h=p.match(r.threeOctet))?(function(){let y=h.slice(1,5),v=[];if(_=u(y[2]),_>65535||_<0)throw new Error("ipaddr: address outside defined range");return v.push(u(y[0])),v.push(u(y[1])),v.push(_>>8&255),v.push(_&255),v})():null},f.IPv4.subnetMaskFromPrefixLength=function(p){if(p=parseInt(p),p<0||p>32)throw new Error("ipaddr: invalid IPv4 prefix length");let h=[0,0,0,0],m=0,_=Math.floor(p/8);for(;m<_;)h[m]=255,m++;return _<4&&(h[_]=Math.pow(2,p%8)-1<<8-p%8),new this(h)},f.IPv6=(function(){function p(h,m){let _,y;if(h.length===16)for(this.parts=[],_=0;_<=14;_+=2)this.parts.push(h[_]<<8|h[_+1]);else if(h.length===8)this.parts=h;else throw new Error("ipaddr: ipv6 part count should be 8 or 16");for(_=0;_<this.parts.length;_++)if(y=this.parts[_],!(0<=y&&y<=65535))throw new Error("ipaddr: ipv6 part should fit in 16 bits");m&&(this.zoneId=m)}return p.prototype.SpecialRanges={unspecified:[new p([0,0,0,0,0,0,0,0]),128],linkLocal:[new p([65152,0,0,0,0,0,0,0]),10],multicast:[new p([65280,0,0,0,0,0,0,0]),8],loopback:[new p([0,0,0,0,0,0,0,1]),128],uniqueLocal:[new p([64512,0,0,0,0,0,0,0]),7],ipv4Mapped:[new p([0,0,0,0,0,65535,0,0]),96],deprecatedSiteLocal:[new p([65216,0,0,0,0,0,0,0]),10],discard:[new p([256,0,0,0,0,0,0,0]),64],rfc6145:[new p([0,0,0,0,65535,0,0,0]),96],rfc6052:[[new p([100,65435,0,0,0,0,0,0]),96],[new p([100,65435,1,0,0,0,0,0]),48]],"6to4":[new p([8194,0,0,0,0,0,0,0]),16],teredo:[new p([8193,0,0,0,0,0,0,0]),32],benchmarking:[new p([8193,2,0,0,0,0,0,0]),48],amt:[new p([8193,3,0,0,0,0,0,0]),32],as112v6:[[new p([8193,4,274,0,0,0,0,0]),48],[new p([9760,79,32768,0,0,0,0,0]),48]],deprecatedOrchid:[new p([8193,16,0,0,0,0,0,0]),28],orchid2:[new p([8193,32,0,0,0,0,0,0]),28],droneRemoteIdProtocolEntityTags:[new p([8193,48,0,0,0,0,0,0]),28],segmentRouting:[new p([24320,0,0,0,0,0,0,0]),16],reserved:[[new p([8193,0,0,0,0,0,0,0]),23],[new p([8193,3512,0,0,0,0,0,0]),32],[new p([16383,0,0,0,0,0,0,0]),20]]},p.prototype.isIPv4MappedAddress=function(){return this.range()==="ipv4Mapped"},p.prototype.kind=function(){return"ipv6"},p.prototype.match=function(h,m){let _;if(m===void 0&&(_=h,h=_[0],m=_[1]),h.kind()!=="ipv6")throw new Error("ipaddr: cannot match ipv6 address with non-ipv6 one");return l(this.parts,h.parts,16,m)},p.prototype.prefixLengthFromSubnetMask=function(){let h=0,m=!1,_={0:16,32768:15,49152:14,57344:13,61440:12,63488:11,64512:10,65024:9,65280:8,65408:7,65472:6,65504:5,65520:4,65528:3,65532:2,65534:1,65535:0},y,v;for(let S=7;S>=0;S-=1)if(y=this.parts[S],y in _){if(v=_[y],m&&v!==0)return null;v!==16&&(m=!0),h+=v}else return null;return 128-h},p.prototype.range=function(){return f.subnetMatch(this,this.SpecialRanges)},p.prototype.toByteArray=function(){let h,m=[],_=this.parts;for(let y=0;y<_.length;y++)h=_[y],m.push(h>>8),m.push(h&255);return m},p.prototype.toFixedLengthString=function(){let h=(function(){let _=[];for(let y=0;y<this.parts.length;y++)_.push(d(this.parts[y].toString(16),4));return _}).call(this).join(":"),m="";return this.zoneId&&(m=`%${this.zoneId}`),h+m},p.prototype.toIPv4Address=function(){if(!this.isIPv4MappedAddress())throw new Error("ipaddr: trying to convert a generic ipv6 address to ipv4");let h=this.parts.slice(-2),m=h[0],_=h[1];return new f.IPv4([m>>8,m&255,_>>8,_&255])},p.prototype.toNormalizedString=function(){let h=(function(){let _=[];for(let y=0;y<this.parts.length;y++)_.push(this.parts[y].toString(16));return _}).call(this).join(":"),m="";return this.zoneId&&(m=`%${this.zoneId}`),h+m},p.prototype.toRFC5952String=function(){let h=/((^|:)(0(:|$)){2,})/g,m=this.toNormalizedString(),_=0,y=-1,v;for(;v=h.exec(m);)v[0].length>y&&(_=v.index,y=v[0].length);return y<0?m:`${m.substring(0,_)}::${m.substring(_+y)}`},p.prototype.toString=function(){return this.toRFC5952String()},p})(),f.IPv6.broadcastAddressFromCIDR=function(p){try{let h=this.parseCIDR(p),m=h[0].toByteArray(),_=this.subnetMaskFromPrefixLength(h[1]).toByteArray(),y=[],v=0;for(;v<16;)y.push(parseInt(m[v],10)|parseInt(_[v],10)^255),v++;return new this(y)}catch(h){throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${h})`)}},f.IPv6.isIPv6=function(p){return this.parser(p)!==null},f.IPv6.isValid=function(p){if(typeof p=="string"&&p.indexOf(":")===-1)return!1;try{let h=this.parser(p);return new this(h.parts,h.zoneId),!0}catch{return!1}},f.IPv6.isValidCIDR=function(p){if(typeof p=="string"&&p.indexOf(":")===-1)return!1;try{return this.parseCIDR(p),!0}catch{return!1}},f.IPv6.networkAddressFromCIDR=function(p){let h,m,_,y,v;try{for(h=this.parseCIDR(p),_=h[0].toByteArray(),v=this.subnetMaskFromPrefixLength(h[1]).toByteArray(),y=[],m=0;m<16;)y.push(parseInt(_[m],10)&parseInt(v[m],10)),m++;return new this(y)}catch(S){throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${S})`)}},f.IPv6.parse=function(p){let h=this.parser(p);if(h.parts===null)throw new Error("ipaddr: string is not formatted like an IPv6 Address");return new this(h.parts,h.zoneId)},f.IPv6.parseCIDR=function(p){let h,m,_;if((m=p.match(/^(.+)\/(\d+)$/))&&(h=parseInt(m[2]),h>=0&&h<=128))return _=[this.parse(m[1]),h],Object.defineProperty(_,"toString",{value:function(){return this.join("/")}}),_;throw new Error("ipaddr: string is not formatted like an IPv6 CIDR range")},f.IPv6.parser=function(p){let h,m,_,y,v,S;if(_=p.match(a.deprecatedTransitional))return this.parser(`::ffff:${_[1]}`);if(a.native.test(p))return c(p,8);if((_=p.match(a.transitional))&&(S=_[6]||"",h=_[1],_[1].endsWith("::")||(h=h.slice(0,-1)),h=c(h+S,6),h.parts)){for(v=[parseInt(_[2]),parseInt(_[3]),parseInt(_[4]),parseInt(_[5])],m=0;m<v.length;m++)if(y=v[m],!(0<=y&&y<=255))return null;return h.parts.push(v[0]<<8|v[1]),h.parts.push(v[2]<<8|v[3]),{parts:h.parts,zoneId:h.zoneId}}return null},f.IPv6.subnetMaskFromPrefixLength=function(p){if(p=parseInt(p),p<0||p>128)throw new Error("ipaddr: invalid IPv6 prefix length");let h=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],m=0,_=Math.floor(p/8);for(;m<_;)h[m]=255,m++;return _<16&&(h[_]=Math.pow(2,p%8)-1<<8-p%8),new this(h)},f.fromByteArray=function(p){let h=p.length;if(h===4)return new f.IPv4(p);if(h===16)return new f.IPv6(p);throw new Error("ipaddr: the binary input is neither an IPv6 nor IPv4 address")},f.isValid=function(p){return f.IPv6.isValid(p)||f.IPv4.isValid(p)},f.isValidCIDR=function(p){return f.IPv6.isValidCIDR(p)||f.IPv4.isValidCIDR(p)},f.parse=function(p){if(f.IPv6.isValid(p))return f.IPv6.parse(p);if(f.IPv4.isValid(p))return f.IPv4.parse(p);throw new Error("ipaddr: the address has neither IPv6 nor IPv4 format")},f.parseCIDR=function(p){try{return f.IPv6.parseCIDR(p)}catch{try{return f.IPv4.parseCIDR(p)}catch{throw new Error("ipaddr: the address has neither IPv6 nor IPv4 CIDR format")}}},f.process=function(p){let h=this.parse(p);return h.kind()==="ipv6"&&h.isIPv4MappedAddress()?h.toIPv4Address():h},f.subnetMatch=function(p,h,m){let _,y,v,S;m==null&&(m="unicast");for(y in h)if(Object.prototype.hasOwnProperty.call(h,y)){for(v=h[y],v[0]&&!(v[0]instanceof Array)&&(v=[v]),_=0;_<v.length;_++)if(S=v[_],p.kind()===S[0].kind()&&p.match.apply(p,S))return y}return m},typeof SR<"u"&&SR.exports?SR.exports=f:t.ipaddr=f})(Jse)});var roe=E((hYt,Mh)=>{"use strict";Mh.exports=EF;Mh.exports.default=EF;Mh.exports.proxyaddr=EF;Mh.exports.all=eoe;Mh.exports.compile=toe;var u8e=Kse(),Qse=Zse(),d8e=/^\d+$/u,ER=Qse.isValid,vR=Qse.parse,Xse={linklocal:["169.254.0.0/16","fe80::/10"],loopback:["127.0.0.1/8","::1/128"],uniquelocal:["10.0.0.0/8","172.16.0.0/12","192.168.0.0/16","fc00::/7"]};function eoe(t,e){let r=u8e(t);if(!e)return r;typeof e!="function"&&(e=toe(e));for(let n=0;n<r.length-1;n++)e(r[n],n)||(r.length=n+1);return r}function toe(t){if(!t)throw new TypeError("argument is required");let e;if(typeof t=="string")e=[t];else if(Array.isArray(t))e=t.slice();else throw new TypeError("unsupported trust argument");for(let r=0;r<e.length;r++)t=e[r],Object.hasOwn(Xse,t)&&(t=Xse[t],e.splice.apply(e,[r,1].concat(t)),r+=t.length-1);return p8e(f8e(e))}function f8e(t){let e=new Array(t.length);for(let r=0;r<t.length;r++)e[r]=h8e(t[r]);return e}function p8e(t){let e=t.length;return e===0?g8e:e===1?y8e(t[0]):_8e(t)}function h8e(t){let e=t.lastIndexOf("/"),r=e!==-1?t.substring(0,e):t;if(!ER(r))throw new TypeError("invalid IP address: "+r);let n=vR(r);e===-1&&n.kind()==="ipv6"&&n.isIPv4MappedAddress()&&(n=n.toIPv4Address());let i=n.kind()==="ipv6"?128:32,s=e!==-1?t.substring(e+1,t.length):null;if(s===null?s=i:d8e.test(s)?s=parseInt(s,10):n.kind()==="ipv4"&&ER(s)?s=m8e(s):s=null,s<=0||s>i)throw new TypeError("invalid range on address: "+t);return[n,s]}function m8e(t){let e=vR(t);return e.kind()==="ipv4"?e.prefixLengthFromSubnetMask():null}function EF(t,e){if(!t)throw new TypeError("req argument is required");if(!e)throw new TypeError("trust argument is required");let r=eoe(t,e);return r[r.length-1]}function g8e(){return!1}function _8e(t){return function(r){if(!ER(r))return!1;let n=vR(r),i,s=n.kind();for(let o=0;o<t.length;o++){let a=t[o],c=a[0],l=c.kind(),u=a[1],d=n;if(s!==l){let f=l==="ipv4";if(f&&!n.isIPv4MappedAddress())continue;i||(i=f?n.toIPv4Address():n.toIPv4MappedAddress()),d=i}if(d.match(c,u))return!0}return!1}}function y8e(t){let e=t[0],r=e.kind(),n=r==="ipv4",i=t[1];return function(o){if(!ER(o))return!1;let a=vR(o);if(a.kind()!==r){if(n&&!a.isIPv4MappedAddress())return!1;a=n?a.toIPv4Address():a.toIPv4MappedAddress()}return a.match(e,i)}}});var TR=E((mYt,wF)=>{"use strict";var bR=roe(),{kHasBeenDecorated:S8e,kSchemaBody:E8e,kSchemaHeaders:v8e,kSchemaParams:b8e,kSchemaQuerystring:noe,kSchemaController:vF,kOptions:T8e,kRequestCacheValidateFns:kl,kRouteContext:Tn,kRequestOriginalUrl:bF,kRequestSignal:ioe,kOnAbort:w8e}=Ar(),{FST_ERR_REQ_INVALID_VALIDATION_INVOCATION:A8e,FST_ERR_DEC_UNDECLARED:R8e}=Ur(),soe=SE(),ooe={body:E8e,headers:v8e,params:b8e,querystring:noe,query:noe};function TF(t,e,r,n,i,s){this.id=t,this[Tn]=s,this.params=e,this.raw=r,this.query=n,this.log=i,this.body=void 0}TF.props=[];function x8e(t){if(typeof t=="function")return t;if(t===!0)return function(){return!0};if(typeof t=="number")return function(e,r){return r<t};if(typeof t=="string"){let e=t.split(",").map(r=>r.trim());return bR.compile(e)}return bR.compile(t)}function I8e(t,e){return e?O8e(t,e):loe(t)}function loe(t){let e=t.props.slice();function r(n,i,s,o,a,c){this.id=n,this[Tn]=c,this.params=i,this.raw=s,this.query=o,this.log=a,this.body=void 0;let l;for(let u=0;u<e.length;u++)l=e[u],this[l.key]=l.value}return Object.setPrototypeOf(r.prototype,t.prototype),Object.setPrototypeOf(r,t),r.props=e,r.parent=t,r}function aoe(t){let e=t.lastIndexOf(",");return e===-1?t.trim():t.slice(e+1).trim()}function O8e(t,e){let r=loe(t),n=x8e(e);return r[S8e]=!0,Object.defineProperties(r.prototype,{ip:{get(){let i=bR.all(this.raw,n);return i[i.length-1]}},ips:{get(){return bR.all(this.raw,n)}},host:{get(){let i=this.raw.socket?.remoteAddress;return this.headers["x-forwarded-host"]&&i!==null&&n(i,0)?aoe(this.headers["x-forwarded-host"]):this.headers.host??this.headers[":authority"]??""}},protocol:{get(){let i=this.raw.socket?.remoteAddress;if(this.headers["x-forwarded-proto"]&&i!==null&&n(i,0))return aoe(this.headers["x-forwarded-proto"]);if(this.socket)return this.socket.encrypted?"https":"http"}}}),r}function coe(t,e){if(!soe.hasKey(t,e)&&!soe.exist(t,e))throw new R8e(e,"request")}Object.defineProperties(TF.prototype,{server:{get(){return this[Tn].server}},url:{get(){return this.raw.url}},originalUrl:{get(){return this[bF]||(this[bF]=this.raw.originalUrl||this.raw.url),this[bF]}},method:{get(){return this.raw.method}},routeOptions:{get(){let t=this[Tn],e=t._parserOptions.limit,r=t.server.initialConfig.bodyLimit,n=t.server.hasConstraintStrategy("version")?this.raw.headers["accept-version"]:void 0;return{method:t.config?.method,url:t.config?.url,bodyLimit:e||r,handlerTimeout:t.handlerTimeout,attachValidation:t.attachValidation,logLevel:t.logLevel,exposeHeadRoute:t.exposeHeadRoute,prefixTrailingSlash:t.prefixTrailingSlash,handler:t.handler,config:t.config,schema:t.schema,version:n}}},is404:{get(){return this[Tn].config?.url===void 0}},socket:{get(){return this.raw.socket}},signal:{get(){let t=this[ioe];if(t)return t.signal;t=new AbortController,this[ioe]=t;let e=()=>{t.signal.aborted||t.abort()};return this.raw.on("close",e),this[w8e]=e,t.signal}},ip:{get(){if(this.socket)return this.socket.remoteAddress}},host:{get(){return this.raw.headers.host??this.raw.headers[":authority"]??""}},hostname:{get(){return this.host[0]==="["?this.host.slice(0,this.host.indexOf("]")+1):this.host.split(":",1)[0]}},port:{get(){let t=/(?<port>:\d+)$/,e=this.headers.host??this.headers[":authority"]??"",r=t.exec(e);return r===null||r[1]===void 0?null:parseInt(r.groups.port.slice(1),10)}},protocol:{get(){if(this.socket)return this.socket.encrypted?"https":"http"}},headers:{get(){return this.additionalHeaders?Object.assign({},this.raw.headers,this.additionalHeaders):this.raw.headers},set(t){this.additionalHeaders=t}},getValidationFunction:{value:function(t){if(typeof t=="string"){let e=ooe[t];return this[Tn][e]}else if(typeof t=="object")return this[Tn][kl]?.get(t)}},compileValidationSchema:{value:function(t,e=null){let{method:r,url:n}=this;if(this[Tn][kl]?.has(t))return this[Tn][kl].get(t);let s=(this[Tn].validatorCompiler||this.server[vF].validatorCompiler||this.server[vF].setupValidator(this.server[T8e])||this.server[vF].validatorCompiler)({schema:t,method:r,url:n,httpPart:e});return this[Tn][kl]==null&&(this[Tn][kl]=new WeakMap),this[Tn][kl].set(t,s),s}},validateInput:{value:function(t,e,r){r=typeof e=="string"?e:r;let n=r!=null&&typeof r=="string"&&ooe[r],i;if(n&&(i=this[Tn][n]),i==null&&(e==null||typeof e!="object"||Array.isArray(e)))throw new A8e(r);return i==null&&(this[Tn][kl]?.has(e)?i=this[Tn][kl].get(e):i=this.compileValidationSchema(e,r)),i(t)}},getDecorator:{value:function(t){coe(this,t);let e=this[t];return typeof e=="function"?e.bind(this):e}},setDecorator:{value:function(t,e){coe(this,t),this[t]=e}}});wF.exports=TF;wF.exports.buildRequest=I8e});var wR=E((gYt,uoe)=>{"use strict";var{kFourOhFourContext:P8e,kReplySerializerDefault:C8e,kSchemaErrorFormatter:N8e,kErrorHandler:k8e,kChildLoggerFactory:$8e,kOptions:L8e,kReply:D8e,kRequest:M8e,kBodyLimit:U8e,kLogLevel:F8e,kContentTypeParser:j8e,kRouteByFastify:q8e,kRequestCacheValidateFns:B8e,kReplyCacheSerializeFns:z8e,kHandlerTimeout:V8e}=Ar();function H8e({schema:t,handler:e,config:r,requestIdLogLabel:n,childLoggerFactory:i,errorHandler:s,bodyLimit:o,logLevel:a,logSerializers:c,attachValidation:l,validatorCompiler:u,serializerCompiler:d,replySerializer:f,schemaErrorFormatter:p,exposeHeadRoute:h,prefixTrailingSlash:m,server:_,isFastify:y,handlerTimeout:v}){this.schema=t,this.handler=e,this.Reply=_[D8e],this.Request=_[M8e],this.contentTypeParser=_[j8e],this.onRequest=null,this.onSend=null,this.onError=null,this.onTimeout=null,this.preHandler=null,this.onResponse=null,this.preSerialization=null,this.onRequestAbort=null,this.config=r,this.errorHandler=s||_[k8e],this.requestIdLogLabel=n||_[L8e].requestIdLogLabel,this.childLoggerFactory=i||_[$8e],this._middie=null,this._parserOptions={limit:o||_[U8e]},this.exposeHeadRoute=h,this.prefixTrailingSlash=m,this.logLevel=a||_[F8e],this.logSerializers=c,this[P8e]=null,this.attachValidation=l,this[C8e]=f,this.schemaErrorFormatter=p||_[N8e]||G8e,this[q8e]=y,this[B8e]=null,this[z8e]=null,this.validatorCompiler=u||null,this.serializerCompiler=d||null,this.handlerTimeout=v||_[V8e]||0,this.server=_}function G8e(t,e){let r="";for(let i=0;i!==t.length;++i){let s=t[i];r+=e+(s.instancePath||"")+" "+s.message+", "}return new Error(r.slice(0,-2))}uoe.exports=H8e});var foe=E(jo=>{"use strict";var AF=class{constructor(e=1e3,r=0){if(isNaN(e)||e<0)throw new Error("Invalid max value");if(isNaN(r)||r<0)throw new Error("Invalid ttl value");this.first=null,this.items=new Map,this.last=null,this.max=e,this.ttl=r}get size(){return this.items.size}clear(){this.items=new Map,this.first=null,this.last=null}delete(e){if(this.items.has(e)){let r=this.items.get(e);this.items.delete(e),r.prev!==null&&(r.prev.next=r.next),r.next!==null&&(r.next.prev=r.prev),this.first===r&&(this.first=r.next),this.last===r&&(this.last=r.prev)}}deleteMany(e){for(var r=0;r<e.length;r++)this.delete(e[r])}evict(){if(this.size>0){let e=this.first;this.items.delete(e.key),this.size===0?(this.first=null,this.last=null):(this.first=e.next,this.first.prev=null)}}expiresAt(e){if(this.items.has(e))return this.items.get(e).expiry}get(e){if(this.items.has(e)){let r=this.items.get(e);if(this.ttl>0&&r.expiry<=Date.now()){this.delete(e);return}return r.value}}getMany(e){let r=[];for(var n=0;n<e.length;n++)r.push(this.get(e[n]));return r}keys(){return this.items.keys()}set(e,r){if(this.items.has(e)){let i=this.items.get(e);i.value=r,i.expiry=this.ttl>0?Date.now()+this.ttl:this.ttl;return}this.max>0&&this.size===this.max&&this.evict();let n={expiry:this.ttl>0?Date.now()+this.ttl:this.ttl,key:e,prev:this.last,next:null,value:r};this.items.set(e,n),this.size===1?this.first=n:this.last.next=n,this.last=n}},AR=class{constructor(e=1e3,r=0){if(isNaN(e)||e<0)throw new Error("Invalid max value");if(isNaN(r)||r<0)throw new Error("Invalid ttl value");this.first=null,this.items=Object.create(null),this.last=null,this.size=0,this.max=e,this.ttl=r}clear(){this.items=Object.create(null),this.first=null,this.last=null,this.size=0}delete(e){if(Object.prototype.hasOwnProperty.call(this.items,e)){let r=this.items[e];delete this.items[e],this.size--,r.prev!==null&&(r.prev.next=r.next),r.next!==null&&(r.next.prev=r.prev),this.first===r&&(this.first=r.next),this.last===r&&(this.last=r.prev)}}deleteMany(e){for(var r=0;r<e.length;r++)this.delete(e[r])}evict(){if(this.size>0){let e=this.first;delete this.items[e.key],--this.size===0?(this.first=null,this.last=null):(this.first=e.next,this.first.prev=null)}}expiresAt(e){if(Object.prototype.hasOwnProperty.call(this.items,e))return this.items[e].expiry}get(e){if(Object.prototype.hasOwnProperty.call(this.items,e)){let r=this.items[e];if(this.ttl>0&&r.expiry<=Date.now()){this.delete(e);return}return r.value}}getMany(e){let r=[];for(var n=0;n<e.length;n++)r.push(this.get(e[n]));return r}keys(){return Object.keys(this.items)}set(e,r){if(Object.prototype.hasOwnProperty.call(this.items,e)){let i=this.items[e];i.value=r,i.expiry=this.ttl>0?Date.now()+this.ttl:this.ttl;return}this.max>0&&this.size===this.max&&this.evict();let n={expiry:this.ttl>0?Date.now()+this.ttl:this.ttl,key:e,prev:this.last,next:null,value:r};this.items[e]=n,++this.size===1?this.first=n:this.last.next=n,this.last=n}},RR=class{constructor(){this.records={}}initForCache(e,r){this.records[e]={[r]:{cacheSize:0,hits:0,falsyHits:0,emptyHits:0,misses:0,expirations:0,evictions:0,invalidateOne:0,invalidateAll:0,sets:0}}}resetForCache(e){for(let r of Object.keys(this.records[e]))this.records[e][r]={cacheSize:0,hits:0,falsyHits:0,emptyHits:0,misses:0,expirations:0,evictions:0,invalidateOne:0,invalidateAll:0,sets:0}}getStatistics(){return this.records}},RF=class{constructor(e=1e3,r=0){if(isNaN(e)||e<0)throw new Error("Invalid max value");if(isNaN(r)||r<0)throw new Error("Invalid ttl value");this.first=null,this.items=new Map,this.last=null,this.max=e,this.ttl=r}get size(){return this.items.size}bumpLru(e){if(this.last===e)return;let r=this.last,n=e.next,i=e.prev;this.first===e&&(this.first=n),e.next=null,e.prev=r,r.next=e,i!==null&&(i.next=n),n!==null&&(n.prev=i),this.last=e}clear(){this.items=new Map,this.first=null,this.last=null}delete(e){if(this.items.has(e)){let r=this.items.get(e);this.items.delete(e),r.prev!==null&&(r.prev.next=r.next),r.next!==null&&(r.next.prev=r.prev),this.first===r&&(this.first=r.next),this.last===r&&(this.last=r.prev)}}deleteMany(e){for(var r=0;r<e.length;r++)this.delete(e[r])}evict(){if(this.size>0){let e=this.first;this.items.delete(e.key),this.size===0?(this.first=null,this.last=null):(this.first=e.next,this.first.prev=null)}}expiresAt(e){if(this.items.has(e))return this.items.get(e).expiry}get(e){if(this.items.has(e)){let r=this.items.get(e);if(this.ttl>0&&r.expiry<=Date.now()){this.delete(e);return}return this.bumpLru(r),r.value}}getMany(e){let r=[];for(var n=0;n<e.length;n++)r.push(this.get(e[n]));return r}keys(){return this.items.keys()}set(e,r){if(this.items.has(e)){let i=this.items.get(e);i.value=r,i.expiry=this.ttl>0?Date.now()+this.ttl:this.ttl,this.last!==i&&this.bumpLru(i);return}this.max>0&&this.size===this.max&&this.evict();let n={expiry:this.ttl>0?Date.now()+this.ttl:this.ttl,key:e,prev:this.last,next:null,value:r};this.items.set(e,n),this.size===1?this.first=n:this.last.next=n,this.last=n}},bE=class{constructor(e=1e3,r=0){if(isNaN(e)||e<0)throw new Error("Invalid max value");if(isNaN(r)||r<0)throw new Error("Invalid ttl value");this.first=null,this.items=Object.create(null),this.last=null,this.size=0,this.max=e,this.ttl=r}bumpLru(e){if(this.last===e)return;let r=this.last,n=e.next,i=e.prev;this.first===e&&(this.first=n),e.next=null,e.prev=r,r.next=e,i!==null&&(i.next=n),n!==null&&(n.prev=i),this.last=e}clear(){this.items=Object.create(null),this.first=null,this.last=null,this.size=0}delete(e){if(Object.prototype.hasOwnProperty.call(this.items,e)){let r=this.items[e];delete this.items[e],this.size--,r.prev!==null&&(r.prev.next=r.next),r.next!==null&&(r.next.prev=r.prev),this.first===r&&(this.first=r.next),this.last===r&&(this.last=r.prev)}}deleteMany(e){for(var r=0;r<e.length;r++)this.delete(e[r])}evict(){if(this.size>0){let e=this.first;delete this.items[e.key],--this.size===0?(this.first=null,this.last=null):(this.first=e.next,this.first.prev=null)}}expiresAt(e){if(Object.prototype.hasOwnProperty.call(this.items,e))return this.items[e].expiry}get(e){if(Object.prototype.hasOwnProperty.call(this.items,e)){let r=this.items[e];if(this.ttl>0&&r.expiry<=Date.now()){this.delete(e);return}return this.bumpLru(r),r.value}}getMany(e){let r=[];for(var n=0;n<e.length;n++)r.push(this.get(e[n]));return r}keys(){return Object.keys(this.items)}set(e,r){if(Object.prototype.hasOwnProperty.call(this.items,e)){let i=this.items[e];i.value=r,i.expiry=this.ttl>0?Date.now()+this.ttl:this.ttl,this.last!==i&&this.bumpLru(i);return}this.max>0&&this.size===this.max&&this.evict();let n={expiry:this.ttl>0?Date.now()+this.ttl:this.ttl,key:e,prev:this.last,next:null,value:r};this.items[e]=n,++this.size===1?this.first=n:this.last.next=n,this.last=n}};function doe(t){return`${t.getFullYear()}-${(t.getMonth()+1).toString().padStart(2,"0")}-${t.getDate().toString().padStart(2,"0")}`}var xF=class{constructor(e,r,n){this.cacheId=e,this.statisticTtlInHours=r,this.collectionStart=new Date,this.currentTimeStamp=doe(this.collectionStart),this.records=n||new RR,this.records.initForCache(this.cacheId,this.currentTimeStamp)}get currentRecord(){return this.records.records[this.cacheId][this.currentTimeStamp]||(this.records.records[this.cacheId][this.currentTimeStamp]={cacheSize:0,hits:0,falsyHits:0,emptyHits:0,misses:0,expirations:0,evictions:0,sets:0,invalidateOne:0,invalidateAll:0}),this.records.records[this.cacheId][this.currentTimeStamp]}hoursPassed(){return(Date.now()-this.collectionStart)/1e3/60/60}addHit(){this.archiveIfNeeded(),this.currentRecord.hits++}addFalsyHit(){this.archiveIfNeeded(),this.currentRecord.falsyHits++}addEmptyHit(){this.archiveIfNeeded(),this.currentRecord.emptyHits++}addMiss(){this.archiveIfNeeded(),this.currentRecord.misses++}addEviction(){this.archiveIfNeeded(),this.currentRecord.evictions++}setCacheSize(e){this.archiveIfNeeded(),this.currentRecord.cacheSize=e}addExpiration(){this.archiveIfNeeded(),this.currentRecord.expirations++}addSet(){this.archiveIfNeeded(),this.currentRecord.sets++}addInvalidateOne(){this.archiveIfNeeded(),this.currentRecord.invalidateOne++}addInvalidateAll(){this.archiveIfNeeded(),this.currentRecord.invalidateAll++}getStatistics(){return this.records.getStatistics()}archiveIfNeeded(){this.hoursPassed()>=this.statisticTtlInHours&&(this.collectionStart=new Date,this.currentTimeStamp=doe(this.collectionStart),this.records.initForCache(this.cacheId,this.currentTimeStamp))}},xR=class extends bE{constructor(e,r,n,i,s){if(super(e||1e3,r||0),!n)throw new Error("Cache id is mandatory");this.hitStatistics=new xF(n,s!==void 0?s:24,i)}getStatistics(){return this.hitStatistics.getStatistics()}set(e,r){super.set(e,r),this.hitStatistics.addSet(),this.hitStatistics.setCacheSize(this.size)}evict(){super.evict(),this.hitStatistics.addEviction(),this.hitStatistics.setCacheSize(this.size)}delete(e,r=!1){super.delete(e),r||this.hitStatistics.addInvalidateOne(),this.hitStatistics.setCacheSize(this.size)}clear(){super.clear(),this.hitStatistics.addInvalidateAll(),this.hitStatistics.setCacheSize(this.size)}get(e){if(Object.prototype.hasOwnProperty.call(this.items,e)){let r=this.items[e];if(this.ttl>0&&r.expiry<=Date.now()){this.delete(e,!0),this.hitStatistics.addExpiration();return}return this.bumpLru(r),r.value||this.hitStatistics.addFalsyHit(),(r.value===void 0||r.value===null||r.value==="")&&this.hitStatistics.addEmptyHit(),this.hitStatistics.addHit(),r.value}this.hitStatistics.addMiss()}};jo.Fifo=AR;jo.FifoMap=AF;jo.FifoObject=AR;jo.HitStatisticsRecord=RR;jo.Lru=bE;jo.LruHitStatistics=xR;jo.LruMap=RF;jo.LruObject=bE;jo.LruObjectHitStatistics=xR});var _oe=E((yYt,Uh)=>{"use strict";var W8e=typeof Buffer<"u",poe=/"(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])"\s*:/,hoe=/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/;function moe(t,e,r){r==null&&e!==null&&typeof e=="object"&&(r=e,e=void 0),W8e&&Buffer.isBuffer(t)&&(t=t.toString()),t&&t.charCodeAt(0)===65279&&(t=t.slice(1));let n=JSON.parse(t,e);if(n===null||typeof n!="object")return n;let i=r&&r.protoAction||"error",s=r&&r.constructorAction||"error";if(i==="ignore"&&s==="ignore")return n;if(i!=="ignore"&&s!=="ignore"){if(poe.test(t)===!1&&hoe.test(t)===!1)return n}else if(i!=="ignore"&&s==="ignore"){if(poe.test(t)===!1)return n}else if(hoe.test(t)===!1)return n;return goe(n,{protoAction:i,constructorAction:s,safe:r&&r.safe})}function goe(t,{protoAction:e="error",constructorAction:r="error",safe:n}={}){let i=[t];for(;i.length;){let s=i;i=[];for(let o of s){if(e!=="ignore"&&Object.prototype.hasOwnProperty.call(o,"__proto__")){if(n===!0)return null;if(e==="error")throw new SyntaxError("Object contains forbidden prototype property");delete o.__proto__}if(r!=="ignore"&&Object.prototype.hasOwnProperty.call(o,"constructor")&&o.constructor!==null&&typeof o.constructor=="object"&&Object.prototype.hasOwnProperty.call(o.constructor,"prototype")){if(n===!0)return null;if(r==="error")throw new SyntaxError("Object contains forbidden prototype property");delete o.constructor}for(let a in o){let c=o[a];c&&typeof c=="object"&&i.push(c)}}}return t}function IF(t,e,r){let{stackTraceLimit:n}=Error;Error.stackTraceLimit=0;try{return moe(t,e,r)}finally{Error.stackTraceLimit=n}}function Y8e(t,e){let{stackTraceLimit:r}=Error;Error.stackTraceLimit=0;try{return moe(t,e,{safe:!0})}catch{return}finally{Error.stackTraceLimit=r}}Uh.exports=IF;Uh.exports.default=IF;Uh.exports.parse=IF;Uh.exports.safeParse=Y8e;Uh.exports.scan=goe});var kF=E((SYt,AE)=>{"use strict";var{AsyncResource:K8e}=W("async_hooks"),{FifoMap:Eoe}=foe(),{parse:J8e}=_oe(),wE=nU(),{kDefaultJsonParse:TE,kContentTypeParser:Fh,kBodyLimit:Z8e,kRequestPayloadStream:voe,kState:PF,kTestInternals:X8e,kReplyIsError:yoe,kRouteContext:Q8e}=Ar(),{FST_ERR_CTP_INVALID_TYPE:IR,FST_ERR_CTP_EMPTY_TYPE:e9e,FST_ERR_CTP_ALREADY_PRESENT:t9e,FST_ERR_CTP_INVALID_HANDLER:r9e,FST_ERR_CTP_INVALID_PARSE_TYPE:n9e,FST_ERR_CTP_BODY_TOO_LARGE:Soe,FST_ERR_CTP_INVALID_MEDIA_TYPE:i9e,FST_ERR_CTP_INVALID_CONTENT_LENGTH:s9e,FST_ERR_CTP_EMPTY_JSON_BODY:o9e,FST_ERR_CTP_INSTANCE_ALREADY_STARTED:CF,FST_ERR_CTP_INVALID_JSON_BODY:a9e}=Ur(),{FSTSEC001:c9e}=xh();function Xa(t,e,r){this[TE]=Toe(e,r),this.customParsers=new Map,this.customParsers.set("application/json",new OF(!0,!1,t,this[TE])),this.customParsers.set("text/plain",new OF(!0,!1,t,NF)),this.parserList=["application/json","text/plain"],this.parserRegExpList=[],this.cache=new Eoe(100)}Xa.prototype.add=function(t,e,r){let n=typeof t=="string";if(n){if(t=t.trim().toLowerCase(),t.length===0)throw new e9e}else if(!(t instanceof RegExp))throw new IR;if(typeof r!="function")throw new r9e;if(this.existingParser(t))throw new t9e(t);if(e.parseAs!==void 0&&e.parseAs!=="string"&&e.parseAs!=="buffer")throw new n9e(e.parseAs);let i=new OF(e.parseAs==="string",e.parseAs==="buffer",e.bodyLimit,r);if(t==="*")this.customParsers.set("",i);else if(n){let s=new wE(t);if(s.isValid===!1)throw new IR;let o=s.toString();this.parserList.unshift(o),this.customParsers.set(o,i)}else h9e(t),this.parserRegExpList.unshift(t),this.customParsers.set(t.toString(),i)};Xa.prototype.hasParser=function(t){if(typeof t=="string")t=new wE(t).toString();else{if(!(t instanceof RegExp))throw new IR;t=t.toString()}return this.customParsers.has(t)};Xa.prototype.existingParser=function(t){if(typeof t=="string"){let e=new wE(t).toString();if(t==="application/json"&&this.customParsers.has(t))return this.customParsers.get(e).fn!==this[TE];if(t==="text/plain"&&this.customParsers.has(t))return this.customParsers.get(e).fn!==NF}return this.hasParser(t)};Xa.prototype.getParser=function(t){typeof t=="string"&&(t=new wE(t));let e=t.toString(),r=this.cache.get(e);if(r!==void 0)return r;if(r=this.customParsers.get(e),r!==void 0)return this.cache.set(e,r),r;if(r=this.customParsers.get(t.mediaType),r!==void 0)return r;for(let n=0;n!==this.parserRegExpList.length;++n){let i=this.parserRegExpList[n];if(i.test(e))return r=this.customParsers.get(i.toString()),this.cache.set(e,r),r}return this.customParsers.get("")};Xa.prototype.removeAll=function(){this.customParsers=new Map,this.parserRegExpList=[],this.parserList=[],this.cache=new Eoe(100)};Xa.prototype.remove=function(t){let e;if(typeof t=="string")t=new wE(t).toString(),e=this.parserList;else{if(!(t instanceof RegExp))throw new IR;t=t.toString(),e=this.parserRegExpList}let r=this.customParsers.delete(t),n=e.findIndex(i=>i.toString()===t);return n>-1&&e.splice(n,1),r||n>-1};Xa.prototype.run=function(t,e,r,n){let i=this.getParser(t);if(i===void 0){if(r.is404===!0){e(r,n);return}n[yoe]=!0,n.send(new i9e);return}let s=new K8e("content-type-parser:run",r),o=s.bind(c);if(i.asString===!0||i.asBuffer===!0){boe(r,n,n[Q8e]._parserOptions,i,o);return}let a=i.fn(r,r[voe],o);a&&typeof a.then=="function"&&a.then(l=>{o(null,l)},o);function c(l,u){if(s.emitDestroy(),l!=null){n.header("connection","close"),n[yoe]=!0,n.send(l);return}r.body=u,e(r,n)}};function boe(t,e,r,n,i){let s=n.asString===!0,o=r.limit===null?n.bodyLimit:r.limit,a=Number(t.headers["content-length"]);if(a>o){i(new Soe,void 0);return}let c=0,l=s?"":[],u=t[voe]||t.raw;s&&u.setEncoding("utf8"),u.on("data",d),u.on("end",f),u.on("error",f),u.resume();function d(p){c+=s?Buffer.byteLength(p):p.length;let{receivedEncodedLength:h=0}=u;if(c>o||h>o){u.removeListener("data",d),u.removeListener("end",f),u.removeListener("error",f),i(new Soe,void 0);return}s?l+=p:l.push(p)}function f(p){if(u.removeListener("data",d),u.removeListener("end",f),u.removeListener("error",f),p!=null){typeof p.statusCode=="number"&&p.statusCode>=400||(p.statusCode=400),i(p,void 0);return}if(!Number.isNaN(a)&&(u.receivedEncodedLength||c)!==a){i(new s9e,void 0);return}s||(l=Buffer.concat(l));let h=n.fn(t,l,i);h&&typeof h.then=="function"&&h.then(m=>{i(null,m)},i)}}function Toe(t,e){let r={protoAction:t,constructorAction:e};return n;function n(i,s,o){if(s.length===0){o(new o9e,void 0);return}try{o(null,J8e(s,r))}catch{o(new a9e,void 0)}}}function NF(t,e,r){r(null,e)}function OF(t,e,r,n){this.asString=t,this.asBuffer=e,this.bodyLimit=r,this.fn=n}function l9e(t){let e=new Xa;return e[TE]=t[TE],e.customParsers=new Map(t.customParsers.entries()),e.parserList=t.parserList.slice(),e.parserRegExpList=t.parserRegExpList.slice(),e}function u9e(t,e,r){if(this[PF].started)throw new CF("addContentTypeParser");return typeof e=="function"&&(r=e,e={}),e||(e={}),e.bodyLimit||(e.bodyLimit=this[Z8e]),Array.isArray(t)?t.forEach(n=>this[Fh].add(n,e,r)):this[Fh].add(t,e,r),this}function d9e(t){return this[Fh].hasParser(t)}function f9e(t){if(this[PF].started)throw new CF("removeContentTypeParser");if(Array.isArray(t))for(let e of t)this[Fh].remove(e);else this[Fh].remove(t)}function p9e(){if(this[PF].started)throw new CF("removeAllContentTypeParsers");this[Fh].removeAll()}function h9e(t){t.source[0]!=="^"&&t.source.includes(";?")===!1&&c9e(t.source)}AE.exports=Xa;AE.exports.helpers={buildContentTypeParser:l9e,addContentTypeParser:u9e,hasContentTypeParser:d9e,removeContentTypeParser:f9e,removeAllContentTypeParsers:p9e};AE.exports.defaultParsers={getDefaultJsonParser:Toe,defaultTextParser:NF};AE.exports[X8e]={rawBody:boe}});var jh=E(yt=>{"use strict";Object.defineProperty(yt,"__esModule",{value:!0});yt.regexpCode=yt.getEsmExportName=yt.getProperty=yt.safeStringify=yt.stringify=yt.strConcat=yt.addCodeArg=yt.str=yt._=yt.nil=yt._Code=yt.Name=yt.IDENTIFIER=yt._CodeOrName=void 0;var RE=class{};yt._CodeOrName=RE;yt.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var Zd=class extends RE{constructor(e){if(super(),!yt.IDENTIFIER.test(e))throw new Error("CodeGen: name must be a valid identifier");this.str=e}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};yt.Name=Zd;var as=class extends RE{constructor(e){super(),this._items=typeof e=="string"?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let e=this._items[0];return e===""||e==='""'}get str(){var e;return(e=this._str)!==null&&e!==void 0?e:this._str=this._items.reduce((r,n)=>`${r}${n}`,"")}get names(){var e;return(e=this._names)!==null&&e!==void 0?e:this._names=this._items.reduce((r,n)=>(n instanceof Zd&&(r[n.str]=(r[n.str]||0)+1),r),{})}};yt._Code=as;yt.nil=new as("");function woe(t,...e){let r=[t[0]],n=0;for(;n<e.length;)LF(r,e[n]),r.push(t[++n]);return new as(r)}yt._=woe;var $F=new as("+");function Aoe(t,...e){let r=[xE(t[0])],n=0;for(;n<e.length;)r.push($F),LF(r,e[n]),r.push($F,xE(t[++n]));return m9e(r),new as(r)}yt.str=Aoe;function LF(t,e){e instanceof as?t.push(...e._items):e instanceof Zd?t.push(e):t.push(y9e(e))}yt.addCodeArg=LF;function m9e(t){let e=1;for(;e<t.length-1;){if(t[e]===$F){let r=g9e(t[e-1],t[e+1]);if(r!==void 0){t.splice(e-1,3,r);continue}t[e++]="+"}e++}}function g9e(t,e){if(e==='""')return t;if(t==='""')return e;if(typeof t=="string")return e instanceof Zd||t[t.length-1]!=='"'?void 0:typeof e!="string"?`${t.slice(0,-1)}${e}"`:e[0]==='"'?t.slice(0,-1)+e.slice(1):void 0;if(typeof e=="string"&&e[0]==='"'&&!(t instanceof Zd))return`"${t}${e.slice(1)}`}function _9e(t,e){return e.emptyStr()?t:t.emptyStr()?e:Aoe`${t}${e}`}yt.strConcat=_9e;function y9e(t){return typeof t=="number"||typeof t=="boolean"||t===null?t:xE(Array.isArray(t)?t.join(","):t)}function S9e(t){return new as(xE(t))}yt.stringify=S9e;function xE(t){return JSON.stringify(t).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}yt.safeStringify=xE;function E9e(t){return typeof t=="string"&&yt.IDENTIFIER.test(t)?new as(`.${t}`):woe`[${t}]`}yt.getProperty=E9e;function v9e(t){if(typeof t=="string"&&yt.IDENTIFIER.test(t))return new as(`${t}`);throw new Error(`CodeGen: invalid export name: ${t}, use explicit $id name mapping`)}yt.getEsmExportName=v9e;function b9e(t){return new as(t.toString())}yt.regexpCode=b9e});var NR=E(ui=>{"use strict";Object.defineProperty(ui,"__esModule",{value:!0});ui.ValueScope=ui.ValueScopeName=ui.Scope=ui.varKinds=ui.UsedValueState=void 0;var li=jh(),DF=class extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}},OR;(function(t){t[t.Started=0]="Started",t[t.Completed=1]="Completed"})(OR||(ui.UsedValueState=OR={}));ui.varKinds={const:new li.Name("const"),let:new li.Name("let"),var:new li.Name("var")};var PR=class{constructor({prefixes:e,parent:r}={}){this._names={},this._prefixes=e,this._parent=r}toName(e){return e instanceof li.Name?e:this.name(e)}name(e){return new li.Name(this._newName(e))}_newName(e){let r=this._names[e]||this._nameGroup(e);return`${e}${r.index++}`}_nameGroup(e){var r,n;if(!((n=(r=this._parent)===null||r===void 0?void 0:r._prefixes)===null||n===void 0)&&n.has(e)||this._prefixes&&!this._prefixes.has(e))throw new Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}};ui.Scope=PR;var CR=class extends li.Name{constructor(e,r){super(r),this.prefix=e}setValue(e,{property:r,itemIndex:n}){this.value=e,this.scopePath=(0,li._)`.${new li.Name(r)}[${n}]`}};ui.ValueScopeName=CR;var T9e=(0,li._)`\n`,MF=class extends PR{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?T9e:li.nil}}get(){return this._scope}name(e){return new CR(e,this._newName(e))}value(e,r){var n;if(r.ref===void 0)throw new Error("CodeGen: ref must be passed in value");let i=this.toName(e),{prefix:s}=i,o=(n=r.key)!==null&&n!==void 0?n:r.ref,a=this._values[s];if(a){let u=a.get(o);if(u)return u}else a=this._values[s]=new Map;a.set(o,i);let c=this._scope[s]||(this._scope[s]=[]),l=c.length;return c[l]=r.ref,i.setValue(r,{property:s,itemIndex:l}),i}getValue(e,r){let n=this._values[e];if(n)return n.get(r)}scopeRefs(e,r=this._values){return this._reduceValues(r,n=>{if(n.scopePath===void 0)throw new Error(`CodeGen: name "${n}" has no value`);return(0,li._)`${e}${n.scopePath}`})}scopeCode(e=this._values,r,n){return this._reduceValues(e,i=>{if(i.value===void 0)throw new Error(`CodeGen: name "${i}" has no value`);return i.value.code},r,n)}_reduceValues(e,r,n={},i){let s=li.nil;for(let o in e){let a=e[o];if(!a)continue;let c=n[o]=n[o]||new Map;a.forEach(l=>{if(c.has(l))return;c.set(l,OR.Started);let u=r(l);if(u){let d=this.opts.es5?ui.varKinds.var:ui.varKinds.const;s=(0,li._)`${s}${d} ${l} = ${u};${this.opts._n}`}else if(u=i?.(l))s=(0,li._)`${s}${u}${this.opts._n}`;else throw new DF(l);c.set(l,OR.Completed)})}return s}};ui.ValueScope=MF});var Fe=E(rt=>{"use strict";Object.defineProperty(rt,"__esModule",{value:!0});rt.or=rt.and=rt.not=rt.CodeGen=rt.operators=rt.varKinds=rt.ValueScopeName=rt.ValueScope=rt.Scope=rt.Name=rt.regexpCode=rt.stringify=rt.getProperty=rt.nil=rt.strConcat=rt.str=rt._=void 0;var ft=jh(),Ws=NR(),$l=jh();Object.defineProperty(rt,"_",{enumerable:!0,get:function(){return $l._}});Object.defineProperty(rt,"str",{enumerable:!0,get:function(){return $l.str}});Object.defineProperty(rt,"strConcat",{enumerable:!0,get:function(){return $l.strConcat}});Object.defineProperty(rt,"nil",{enumerable:!0,get:function(){return $l.nil}});Object.defineProperty(rt,"getProperty",{enumerable:!0,get:function(){return $l.getProperty}});Object.defineProperty(rt,"stringify",{enumerable:!0,get:function(){return $l.stringify}});Object.defineProperty(rt,"regexpCode",{enumerable:!0,get:function(){return $l.regexpCode}});Object.defineProperty(rt,"Name",{enumerable:!0,get:function(){return $l.Name}});var DR=NR();Object.defineProperty(rt,"Scope",{enumerable:!0,get:function(){return DR.Scope}});Object.defineProperty(rt,"ValueScope",{enumerable:!0,get:function(){return DR.ValueScope}});Object.defineProperty(rt,"ValueScopeName",{enumerable:!0,get:function(){return DR.ValueScopeName}});Object.defineProperty(rt,"varKinds",{enumerable:!0,get:function(){return DR.varKinds}});rt.operators={GT:new ft._Code(">"),GTE:new ft._Code(">="),LT:new ft._Code("<"),LTE:new ft._Code("<="),EQ:new ft._Code("==="),NEQ:new ft._Code("!=="),NOT:new ft._Code("!"),OR:new ft._Code("||"),AND:new ft._Code("&&"),ADD:new ft._Code("+")};var Qa=class{optimizeNodes(){return this}optimizeNames(e,r){return this}},UF=class extends Qa{constructor(e,r,n){super(),this.varKind=e,this.name=r,this.rhs=n}render({es5:e,_n:r}){let n=e?Ws.varKinds.var:this.varKind,i=this.rhs===void 0?"":` = ${this.rhs}`;return`${n} ${this.name}${i};`+r}optimizeNames(e,r){if(e[this.name.str])return this.rhs&&(this.rhs=Bh(this.rhs,e,r)),this}get names(){return this.rhs instanceof ft._CodeOrName?this.rhs.names:{}}},kR=class extends Qa{constructor(e,r,n){super(),this.lhs=e,this.rhs=r,this.sideEffects=n}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,r){if(!(this.lhs instanceof ft.Name&&!e[this.lhs.str]&&!this.sideEffects))return this.rhs=Bh(this.rhs,e,r),this}get names(){let e=this.lhs instanceof ft.Name?{}:{...this.lhs.names};return LR(e,this.rhs)}},FF=class extends kR{constructor(e,r,n,i){super(e,n,i),this.op=r}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}},jF=class extends Qa{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}},qF=class extends Qa{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}},BF=class extends Qa{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}},zF=class extends Qa{constructor(e){super(),this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,r){return this.code=Bh(this.code,e,r),this}get names(){return this.code instanceof ft._CodeOrName?this.code.names:{}}},IE=class extends Qa{constructor(e=[]){super(),this.nodes=e}render(e){return this.nodes.reduce((r,n)=>r+n.render(e),"")}optimizeNodes(){let{nodes:e}=this,r=e.length;for(;r--;){let n=e[r].optimizeNodes();Array.isArray(n)?e.splice(r,1,...n):n?e[r]=n:e.splice(r,1)}return e.length>0?this:void 0}optimizeNames(e,r){let{nodes:n}=this,i=n.length;for(;i--;){let s=n[i];s.optimizeNames(e,r)||(w9e(e,s.names),n.splice(i,1))}return n.length>0?this:void 0}get names(){return this.nodes.reduce((e,r)=>ef(e,r.names),{})}},ec=class extends IE{render(e){return"{"+e._n+super.render(e)+"}"+e._n}},VF=class extends IE{},qh=class extends ec{};qh.kind="else";var Xd=class t extends ec{constructor(e,r){super(r),this.condition=e}render(e){let r=`if(${this.condition})`+super.render(e);return this.else&&(r+="else "+this.else.render(e)),r}optimizeNodes(){super.optimizeNodes();let e=this.condition;if(e===!0)return this.nodes;let r=this.else;if(r){let n=r.optimizeNodes();r=this.else=Array.isArray(n)?new qh(n):n}if(r)return e===!1?r instanceof t?r:r.nodes:this.nodes.length?this:new t(Roe(e),r instanceof t?[r]:r.nodes);if(!(e===!1||!this.nodes.length))return this}optimizeNames(e,r){var n;if(this.else=(n=this.else)===null||n===void 0?void 0:n.optimizeNames(e,r),!!(super.optimizeNames(e,r)||this.else))return this.condition=Bh(this.condition,e,r),this}get names(){let e=super.names;return LR(e,this.condition),this.else&&ef(e,this.else.names),e}};Xd.kind="if";var Qd=class extends ec{};Qd.kind="for";var HF=class extends Qd{constructor(e){super(),this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,r){if(super.optimizeNames(e,r))return this.iteration=Bh(this.iteration,e,r),this}get names(){return ef(super.names,this.iteration.names)}},GF=class extends Qd{constructor(e,r,n,i){super(),this.varKind=e,this.name=r,this.from=n,this.to=i}render(e){let r=e.es5?Ws.varKinds.var:this.varKind,{name:n,from:i,to:s}=this;return`for(${r} ${n}=${i}; ${n}<${s}; ${n}++)`+super.render(e)}get names(){let e=LR(super.names,this.from);return LR(e,this.to)}},$R=class extends Qd{constructor(e,r,n,i){super(),this.loop=e,this.varKind=r,this.name=n,this.iterable=i}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,r){if(super.optimizeNames(e,r))return this.iterable=Bh(this.iterable,e,r),this}get names(){return ef(super.names,this.iterable.names)}},OE=class extends ec{constructor(e,r,n){super(),this.name=e,this.args=r,this.async=n}render(e){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(e)}};OE.kind="func";var PE=class extends IE{render(e){return"return "+super.render(e)}};PE.kind="return";var WF=class extends ec{render(e){let r="try"+super.render(e);return this.catch&&(r+=this.catch.render(e)),this.finally&&(r+=this.finally.render(e)),r}optimizeNodes(){var e,r;return super.optimizeNodes(),(e=this.catch)===null||e===void 0||e.optimizeNodes(),(r=this.finally)===null||r===void 0||r.optimizeNodes(),this}optimizeNames(e,r){var n,i;return super.optimizeNames(e,r),(n=this.catch)===null||n===void 0||n.optimizeNames(e,r),(i=this.finally)===null||i===void 0||i.optimizeNames(e,r),this}get names(){let e=super.names;return this.catch&&ef(e,this.catch.names),this.finally&&ef(e,this.finally.names),e}},CE=class extends ec{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}};CE.kind="catch";var NE=class extends ec{render(e){return"finally"+super.render(e)}};NE.kind="finally";var YF=class{constructor(e,r={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...r,_n:r.lines?`
27
+ `),P=fKe.bind(null,{[ese]:"",[tse]:o,[nse]:L,[rse]:rF,[nF]:O,[ise]:A}),N="";d!==null&&(f===void 0?N=P(d):N=P(Object.assign({},d,{name:f})));let F=a instanceof Function?a:a?use:kKe,V=F().indexOf(":")+1;if(v&&!h)throw Error("customLevels is required if useOnlyCustomLevels is set true");if(_&&typeof _!="function")throw Error(`Unknown mixin type "${typeof _}" - expected "function"`);if(R&&typeof R!="string")throw Error(`Unknown msgPrefix type "${typeof R}" - expected "string"`);oKe(p,h,v);let de=cse(h,v);typeof n.emit=="function"&&n.emit("message",{code:"PINO_CONFIG",config:{levels:de,messageKey:c,errorKey:l}}),lKe(m);let Te=cKe(m);return Object.assign(e,{levels:de,[xKe]:Te,[IKe]:v,[SKe]:n,[_Ke]:F,[yKe]:V,[rse]:rF,[nF]:O,[nse]:L,[vKe]:w,[bKe]:C,[TKe]:c,[wKe]:l,[AKe]:u,[PKe]:u?`,${JSON.stringify(u)}:{`:"",[tse]:o,[RKe]:_,[CKe]:y,[ese]:N,[ise]:A,[OKe]:g,silent:hKe,onChild:x,[NKe]:R}),Object.setPrototypeOf(e,iKe()),aKe(e),e[EKe](p),e}os.exports=iF;os.exports.destination=(t=process.stdout.fd)=>typeof t=="object"?(t.dest=Qie(t.dest||process.stdout.fd),Xie(t)):Xie({dest:Qie(t),minLength:0});os.exports.transport=FU();os.exports.multistream=Zie();os.exports.levels=cse();os.exports.stdSerializers=FKe;os.exports.stdTimeFunctions=Object.assign({},ose);os.exports.symbols=ase;os.exports.version=mKe;os.exports.default=iF;os.exports.pino=iF});var hse=E((iYt,pse)=>{"use strict";var rR=dse(),{serializersSym:fse}=rR.symbols,{FST_ERR_LOG_INVALID_DESTINATION:jKe}=Ur();function qKe(t){if(t.stream&&t.file)throw new jKe;t.file&&(t.stream=rR.destination(t.file),delete t.file);let e=t.logger,r=t.genReqId,n=null;return e?(t.logger=void 0,t.genReqId=void 0,e[fse]&&(t.serializers=Object.assign({},t.serializers,e[fse])),n=e.child({},t),t.logger=e,t.genReqId=r):n=rR(t,t.stream),n}var BKe={req:function(e){return{method:e.method,url:e.url,version:e.headers&&e.headers["accept-version"],host:e.host,remoteAddress:e.ip,remotePort:e.socket?e.socket.remotePort:void 0}},err:rR.stdSerializers.err,res:function(e){return{statusCode:e.statusCode}}};pse.exports={serializers:BKe,createPinoLogger:qKe}});var hE=E((sYt,gse)=>{"use strict";var{FST_ERR_LOG_LOGGER_AND_LOGGER_INSTANCE_PROVIDED:zKe,FST_ERR_LOG_INVALID_LOGGER_CONFIG:VKe,FST_ERR_LOG_INVALID_LOGGER_INSTANCE:HKe,FST_ERR_LOG_INVALID_LOGGER:GKe}=Ur();function WKe(t,e,r,n,i){let s={[t.requestIdLogLabel]:n},o=t.childLoggerFactory.call(t.server,e,s,i||{},r);return t.childLoggerFactory!==mse&&nR(o,!0),o}function mse(t,e,r){return t.child(e,r)}function nR(t,e){let r=["info","error","debug","fatal","warn","trace","child"],n=t?r.filter(i=>!t[i]||typeof t[i]!="function"):r;if(n.length){if(n.length===r.length&&!e)return!1;throw GKe(n.join(","))}else return!0}function YKe(t){if(t.logger&&t.loggerInstance)throw new zKe;if(!t.loggerInstance&&!t.logger){let o=tne();return o.child=()=>o,{logger:o,hasLogger:!1}}let{createPinoLogger:e,serializers:r}=hse();if(nR(t.loggerInstance))return{logger:e({logger:t.loggerInstance,serializers:Object.assign({},r,t.loggerInstance.serializers)}),hasLogger:!0};if(nR(t.logger))throw VKe();if(t.loggerInstance)throw HKe();let n={};return Object.prototype.toString.call(t.logger)==="[object Object]"&&Reflect.ownKeys(t.logger).forEach(s=>{Object.defineProperty(n,s,{value:t.logger[s],writable:!0,enumerable:!0,configurable:!0})}),n.level=n.level||"info",n.serializers=Object.assign({},r,n.serializers),t.logger=n,{logger:e(t.logger),hasLogger:!0}}function KKe(){let t=process.hrtime();return t[0]*1e3+t[1]/1e6}gse.exports={createChildLogger:WKe,defaultChildLoggerFactory:mse,createLogger:YKe,validateLogger:nR,now:KKe}});var iR=E((oYt,_se)=>{"use strict";_se.exports=JKe;function $h(t){return t instanceof Buffer?Buffer.from(t):new t.constructor(t.buffer.slice(),t.byteOffset,t.length)}function JKe(t){if(t=t||{},t.circles)return ZKe(t);let e=new Map;if(e.set(Date,o=>new Date(o)),e.set(Map,(o,a)=>new Map(n(Array.from(o),a))),e.set(Set,(o,a)=>new Set(n(Array.from(o),a))),t.constructorHandlers)for(let o of t.constructorHandlers)e.set(o[0],o[1]);let r=null;return t.proto?s:i;function n(o,a){let c=Object.keys(o),l=new Array(c.length);for(let u=0;u<c.length;u++){let d=c[u],f=o[d];typeof f!="object"||f===null?l[d]=f:f.constructor!==Object&&(r=e.get(f.constructor))?l[d]=r(f,a):ArrayBuffer.isView(f)?l[d]=$h(f):l[d]=a(f)}return l}function i(o){if(typeof o!="object"||o===null)return o;if(Array.isArray(o))return n(o,i);if(o.constructor!==Object&&(r=e.get(o.constructor)))return r(o,i);let a={};for(let c in o){if(Object.hasOwnProperty.call(o,c)===!1)continue;let l=o[c];typeof l!="object"||l===null?a[c]=l:l.constructor!==Object&&(r=e.get(l.constructor))?a[c]=r(l,i):ArrayBuffer.isView(l)?a[c]=$h(l):a[c]=i(l)}return a}function s(o){if(typeof o!="object"||o===null)return o;if(Array.isArray(o))return n(o,s);if(o.constructor!==Object&&(r=e.get(o.constructor)))return r(o,s);let a={};for(let c in o){let l=o[c];typeof l!="object"||l===null?a[c]=l:l.constructor!==Object&&(r=e.get(l.constructor))?a[c]=r(l,s):ArrayBuffer.isView(l)?a[c]=$h(l):a[c]=s(l)}return a}}function ZKe(t){let e=[],r=[],n=new Map;if(n.set(Date,c=>new Date(c)),n.set(Map,(c,l)=>new Map(s(Array.from(c),l))),n.set(Set,(c,l)=>new Set(s(Array.from(c),l))),t.constructorHandlers)for(let c of t.constructorHandlers)n.set(c[0],c[1]);let i=null;return t.proto?a:o;function s(c,l){let u=Object.keys(c),d=new Array(u.length);for(let f=0;f<u.length;f++){let p=u[f],h=c[p];if(typeof h!="object"||h===null)d[p]=h;else if(h.constructor!==Object&&(i=n.get(h.constructor)))d[p]=i(h,l);else if(ArrayBuffer.isView(h))d[p]=$h(h);else{let m=e.indexOf(h);m!==-1?d[p]=r[m]:d[p]=l(h)}}return d}function o(c){if(typeof c!="object"||c===null)return c;if(Array.isArray(c))return s(c,o);if(c.constructor!==Object&&(i=n.get(c.constructor)))return i(c,o);let l={};e.push(c),r.push(l);for(let u in c){if(Object.hasOwnProperty.call(c,u)===!1)continue;let d=c[u];if(typeof d!="object"||d===null)l[u]=d;else if(d.constructor!==Object&&(i=n.get(d.constructor)))l[u]=i(d,o);else if(ArrayBuffer.isView(d))l[u]=$h(d);else{let f=e.indexOf(d);f!==-1?l[u]=r[f]:l[u]=o(d)}}return e.pop(),r.pop(),l}function a(c){if(typeof c!="object"||c===null)return c;if(Array.isArray(c))return s(c,a);if(c.constructor!==Object&&(i=n.get(c.constructor)))return i(c,a);let l={};e.push(c),r.push(l);for(let u in c){let d=c[u];if(typeof d!="object"||d===null)l[u]=d;else if(d.constructor!==Object&&(i=n.get(d.constructor)))l[u]=i(d,a);else if(ArrayBuffer.isView(d))l[u]=$h(d);else{let f=e.indexOf(d);f!==-1?l[u]=r[f]:l[u]=a(d)}}return e.pop(),r.pop(),l}}});var mE=E((aYt,bse)=>{"use strict";var XKe=iR()({circles:!1,proto:!0}),{kSchemaVisited:yse,kSchemaResponse:QKe}=Ar(),sF=Symbol.for("fluent-schema-object"),{FST_ERR_SCH_MISSING_ID:e5e,FST_ERR_SCH_ALREADY_PRESENT:t5e,FST_ERR_SCH_DUPLICATE:r5e,FST_ERR_SCH_CONTENT_MISSING_SCHEMA:Sse}=Ur(),vse=["params","body","querystring","query","headers"];function sR(t){this.store=t||{}}sR.prototype.add=function(t){let e=XKe(t.isFluentSchema||t.isFluentJSONSchema||t[sF]?t.valueOf():t),r=e.$id;if(!r)throw new e5e;if(this.store[r])throw new t5e(r);this.store[r]=e};sR.prototype.getSchemas=function(){return Object.assign({},this.store)};sR.prototype.getSchema=function(t){return this.store[t]};function Ese(t){return typeof t=="object"&&Object.getPrototypeOf(t)!==Object.prototype}function n5e(t,e){if(t[yse])return t;if(t.query){if(t.querystring)throw new r5e("querystring");t.querystring=t.query}i5e(t);for(let r of vse){let n=t[r];if(n&&!Ese(n)&&r==="body"&&n.content){let i=n.content,s=Object.keys(i);for(let o=0;o<s.length;o++){let a=s[o];if(!i[a].schema)throw new Sse(a)}continue}}if(t.response){let r=Object.keys(t.response);for(let n of r){if(Ese(t.response[n]))continue;let i=t.response[n].content;if(i){let s=Object.keys(i);for(let o=0;o<s.length;o++){let a=s[o];if(!i[a].schema)throw new Sse(a)}}}}return t[yse]=!0,t}function i5e(t){for(let e of vse)t[e]&&(t[e].isFluentSchema||t[e][sF])&&(t[e]=t[e].valueOf());if(t.response){let e=Object.keys(t.response);for(let r of e)(t.response[r].isFluentSchema||t.response[r][sF])&&(t.response[r]=t.response[r].valueOf())}}function s5e(t,e,r){let n=t[QKe];if(!n)return!1;if(n[e]){if(n[e].constructor===Object&&r){let s=r.split(";",1)[0];return n[e][s]?n[e][s]:n[e]["*/*"]?n[e]["*/*"]:!1}return n[e]}let i=(e+"")[0]+"xx";if(n[i]){if(n[i].constructor===Object&&r){let s=r.split(";",1)[0];return n[i][s]?n[i][s]:n[i]["*/*"]?n[i]["*/*"]:!1}return n[i]}if(n.default){if(n.default.constructor===Object&&r){let s=r.split(";",1)[0];return n.default[s]?n.default[s]:n.default["*/*"]?n.default["*/*"]:!1}return n.default}return!1}bse.exports={buildSchemas(t){return new sR(t)},getSchemaSerializer:s5e,normalizeSchema:n5e}});var oR=E((cYt,wse)=>{"use strict";var o5e=/[\u0000-\u001f\u0022\u005c\ud800-\udfff]/;wse.exports=class Tse{constructor(e){switch(e&&e.rounding){case"floor":this.parseInteger=Math.floor;break;case"ceil":this.parseInteger=Math.ceil;break;case"round":this.parseInteger=Math.round;break;default:this.parseInteger=Math.trunc;break}this._options=e}asInteger(e){if(Number.isInteger(e))return""+e;if(typeof e=="bigint")return e.toString();let r=this.parseInteger(e);if(r===1/0||r===-1/0||r!==r)throw new Error(`The value "${e}" cannot be converted to an integer.`);return""+r}asNumber(e){let r=Number(e);if(r!==r)throw new Error(`The value "${e}" cannot be converted to a number.`);return r===1/0||r===-1/0?"null":""+r}asBoolean(e){return e&&"true"||"false"}asDateTime(e){if(e===null)return'""';if(e instanceof Date)return'"'+e.toISOString()+'"';if(typeof e=="string")return'"'+e+'"';throw new Error(`The value "${e}" cannot be converted to a date-time.`)}asDate(e){if(e===null)return'""';if(e instanceof Date)return'"'+new Date(e.getTime()-e.getTimezoneOffset()*6e4).toISOString().slice(0,10)+'"';if(typeof e=="string")return'"'+e+'"';throw new Error(`The value "${e}" cannot be converted to a date.`)}asTime(e){if(e===null)return'""';if(e instanceof Date)return'"'+new Date(e.getTime()-e.getTimezoneOffset()*6e4).toISOString().slice(11,19)+'"';if(typeof e=="string")return'"'+e+'"';throw new Error(`The value "${e}" cannot be converted to a time.`)}asString(e){let r=e.length;if(r===0)return'""';if(r<42){let n="",i=-1,s=255;for(let o=0;o<r;o++)if(s=e.charCodeAt(o),s===34||s===92)i===-1&&(i=0),n+=e.slice(i,o)+"\\",i=o;else if(s<32||s>=55296&&s<=57343)return JSON.stringify(e);return i===-1&&'"'+e+'"'||'"'+n+e.slice(i)+'"'}else return r<5e3&&o5e.test(e)===!1?'"'+e+'"':JSON.stringify(e)}asUnsafeString(e){return'"'+e+'"'}getState(){return this._options}static restoreFromState(e){return new Tse(e)}}});var Rse=E((lYt,Ase)=>{"use strict";var a5e=oR(),c5e={mode:"standalone"},l5e=a5e.restoreFromState(c5e),u5e=null;Ase.exports=(function(e,r){let{asString:n,asNumber:i,asBoolean:s,asDateTime:o,asDate:a,asTime:c,asUnsafeString:l}=r,u=r.asInteger.bind(r),d="{",f="}",p="[",h="]",m=",",_=":",y='"',v=d+f,S=p+h,g=y+y,T="null";function I(R){let O=R&&typeof R.toJSON=="function"?R.toJSON():R;if(O===null)return v;let A,b=d,L=!1;return A=O.statusCode,A!==void 0&&(!L&&(L=!0)||(b+=m),b+='"statusCode":',b+=i(A)),A=O.code,A!==void 0&&(!L&&(L=!0)||(b+=m),b+='"code":',typeof A!="string"?A===null?b+=g:A instanceof Date?b+=y+A.toISOString()+y:A instanceof RegExp?b+=n(A.source):b+=n(A.toString()):b+=n(A)),A=O.error,A!==void 0&&(!L&&(L=!0)||(b+=m),b+='"error":',typeof A!="string"?A===null?b+=g:A instanceof Date?b+=y+A.toISOString()+y:A instanceof RegExp?b+=n(A.source):b+=n(A.toString()):b+=n(A)),A=O.message,A!==void 0&&(!L&&(L=!0)||(b+=m),b+='"message":',typeof A!="string"?A===null?b+=g:A instanceof Date?b+=y+A.toISOString()+y:A instanceof RegExp?b+=n(A.source):b+=n(A.toString()):b+=n(A)),b+f}return I})(u5e,l5e)});var gE=E((uYt,Pse)=>{"use strict";var xse=W("http").STATUS_CODES,d5e=iU(),{setErrorStatusCode:f5e}=kA(),{kReplyHeaders:Kd,kReplyNextErrorHandler:aR,kReplyIsRunningOnErrorHook:p5e,kRouteContext:Ose,kDisableRequestLogging:cR}=Ar(),{FST_ERR_REP_INVALID_PAYLOAD_TYPE:h5e,FST_ERR_FAILED_ERROR_SERIALIZATION:m5e}=Ur(),{getSchemaSerializer:g5e}=mE(),oF=Rse(),_5e={func:S5e,toJSON(){return this.func.name.toString()+"()"}};function y5e(t,e,r){t[p5e]=!1;let n=t[Ose];if(t[aR]===!1){Ise(e,t,function(o,a){try{o.raw.writeHead(o.raw.statusCode,o[Kd])}catch(c){o.log[cR]||o.log.warn({req:o.request,res:o,err:c},c?.message),o.raw.writeHead(o.raw.statusCode)}o.raw.end(a)});return}let i=t[aR]||n.errorHandler;t[aR]=Object.getPrototypeOf(i),delete t[Kd]["content-type"],delete t[Kd]["content-length"];let s=i.func;if(!s){t[aR]=!1,Ise(e,t,r);return}try{let o=s(e,t.request,t);o!==void 0&&(o!==null&&typeof o.then=="function"?d5e(o,t):t.send(o))}catch(o){t.send(o)}}function S5e(t,e,r){v5e(t,r),f5e(r,t),r.statusCode<500?r.log[cR]||r.log.info({res:r,err:t},t?.message):r.log[cR]||r.log.error({req:e,res:r,err:t},t?.message),r.send(t)}function Ise(t,e,r){let n=e.raw,i=e.statusCode;e[Kd]["content-type"]=e[Kd]["content-type"]??"application/json; charset=utf-8";let s;try{let o=g5e(e[Ose],i,e[Kd]["content-type"]);o===!1?s=oF({error:xse[i+""],code:t.code,message:t.message,statusCode:i}):s=o(Object.create(t,{error:{value:xse[i+""]},message:{value:t.message},statusCode:{value:i}}))}catch(o){e.log[cR]||e.log.error({err:o,statusCode:n.statusCode},"The serializer for the given status code failed"),e.code(500),s=oF(new m5e(o.message,t.message))}typeof s!="string"&&!Buffer.isBuffer(s)&&(s=oF(new h5e(typeof s))),e[Kd]["content-length"]=""+Buffer.byteLength(s),r(e,s)}function E5e(t=_5e,e){if(!e)return t;let r=Object.create(t);return r.func=e,r}function v5e(t,e){let r=e.raw,n=r.statusCode;n=n>=400?n:500,t!=null&&(t.headers!==void 0&&e.headers(t.headers),t.status>=400?n=t.status:t.statusCode>=400&&(n=t.statusCode)),r.statusCode=n}Pse.exports={buildErrorHandler:E5e,handleError:y5e}});var SE=E((dYt,$se)=>{"use strict";var{kReply:aF,kRequest:cF,kState:b5e,kHasBeenDecorated:T5e}=Ar(),{FST_ERR_DEC_ALREADY_PRESENT:Cse,FST_ERR_DEC_MISSING_DEPENDENCY:w5e,FST_ERR_DEC_AFTER_START:A5e,FST_ERR_DEC_REFERENCE_TYPE:R5e,FST_ERR_DEC_DEPENDENCY_INVALID_TYPE:x5e,FST_ERR_DEC_UNDECLARED:I5e}=Ur();function O5e(t,e,r,n){if(Object.hasOwn(t,e))throw new Cse(e);lF(t,e,n),r&&(typeof r.getter=="function"||typeof r.setter=="function")?Object.defineProperty(t,e,{get:r.getter,set:r.setter}):t[e]=r}function P5e(t){if(!_E(this,t))throw new I5e(t,"instance");return typeof this[t]=="function"?this[t].bind(this):this[t]}function Nse(t,e,r,n){let i=t.prototype;if(Object.hasOwn(i,e)||yE(t,e))throw new Cse(e);t[T5e]=!0,lF(t,e,n),r&&(typeof r.getter=="function"||typeof r.setter=="function")?Object.defineProperty(i,e,{get:r.getter,set:r.setter}):typeof r=="function"?i[e]=r:t.props.push({key:e,value:r})}function kse(t,e){if(typeof e=="object"&&e&&!(typeof e.getter=="function"||typeof e.setter=="function"))throw new R5e(t,typeof e)}function C5e(t,e,r){return uF(this,t),O5e(this,t,e,r),this}function _E(t,e){return e?e in t||t.prototype&&e in t.prototype||yE(t,e):t in this}function yE(t,e){return t.props?t.props.find(({key:r})=>r===e):!1}function N5e(t){return t&&yE(this[cF],t)?!0:_E(this[cF].prototype,t)}function k5e(t){return t&&yE(this[aF],t)?!0:_E(this[aF].prototype,t)}function lF(t,e,r){if(r!=null){if(!Array.isArray(r))throw new x5e(e);for(let n=0;n!==r.length;++n)if(!_E(t,r[n]))throw new w5e(r[n])}}function $5e(t,e,r){return uF(this,t),kse(t,e),Nse(this[aF],t,e,r),this}function L5e(t,e,r){return uF(this,t),kse(t,e),Nse(this[cF],t,e,r),this}function uF(t,e){if(t[b5e].started)throw new A5e(e)}$se.exports={add:C5e,exist:_E,existRequest:N5e,existReply:k5e,dependencies:lF,decorateReply:$5e,decorateRequest:L5e,getInstanceDecorator:P5e,hasKey:yE}});var _R=E((fYt,gR)=>{"use strict";var lR=W("stream").finished,{kFourOhFourContext:Lse,kReplyErrorHandlerCalled:Bse,kReplyHijacked:mF,kReplyStartTime:vE,kReplyEndTime:gF,kReplySerializer:Za,kReplySerializerDefault:uR,kReplyIsError:dR,kReplyHeaders:It,kReplyTrailers:Fr,kReplyHasStatusCode:_F,kReplyIsRunningOnErrorHook:yF,kReplyNextErrorHandler:D5e,kDisableRequestLogging:zse,kSchemaResponse:fR,kReplyCacheSerializeFns:Nl,kSchemaController:dF,kOptions:M5e,kRouteContext:ct,kTimeoutTimer:pR,kOnAbort:Lh,kRequestSignal:Vse}=Ar(),{onSendHookRunner:Hse,onResponseHookRunner:U5e,preHandlerHookRunner:F5e,preSerializationHookRunner:j5e}=Ol(),Dse=dU()[Symbol.for("internals")],q5e=hE(),hF=q5e.now,{handleError:Mse}=gE(),{getSchemaSerializer:B5e}=mE(),fF={JSON:"application/json; charset=utf-8",PLAIN:"text/plain; charset=utf-8",OCTET:"application/octet-stream"},{FST_ERR_REP_INVALID_PAYLOAD_TYPE:z5e,FST_ERR_REP_RESPONSE_BODY_CONSUMED:V5e,FST_ERR_REP_READABLE_STREAM_LOCKED:H5e,FST_ERR_REP_ALREADY_SENT:G5e,FST_ERR_SEND_INSIDE_ONERR:W5e,FST_ERR_BAD_STATUS_CODE:Y5e,FST_ERR_BAD_TRAILER_NAME:K5e,FST_ERR_BAD_TRAILER_VALUE:J5e,FST_ERR_MISSING_SERIALIZATION_FN:Z5e,FST_ERR_MISSING_CONTENTTYPE_SERIALIZATION_FN:X5e,FST_ERR_DEC_UNDECLARED:Q5e}=Ur(),Use=SE(),Gse=Object.prototype.toString;function Ot(t,e,r){this.raw=t,this[Za]=null,this[Bse]=!1,this[dR]=!1,this[yF]=!1,this.request=e,this[It]={},this[Fr]=null,this[_F]=!1,this[vE]=void 0,this.log=r}Ot.props=[];Object.defineProperties(Ot.prototype,{[ct]:{get(){return this.request[ct]}},elapsedTime:{get(){return this[vE]===void 0?0:(this[gF]||hF())-this[vE]}},server:{get(){return this.request[ct].server}},sent:{enumerable:!0,get(){return(this[mF]||this.raw.writableEnded)===!0}},statusCode:{get(){return this.raw.statusCode},set(t){this.code(t)}},routeOptions:{get(){return this.request.routeOptions}}});Ot.prototype.writeEarlyHints=function(t,e){return this.raw.writeEarlyHints(t,e),this};Ot.prototype.hijack=function(){return this[mF]=!0,this.request[Vse]&&(clearTimeout(this.request[pR]),this.request[pR]=null,this.request[Lh]&&(this.request.raw.removeListener("close",this.request[Lh]),this.request[Lh]=null)),this};Ot.prototype.send=function(t){if(this[yF])throw new W5e;if(this.sent===!0)return this.log.warn({err:new G5e(this.request.url,this.request.method)}),this;if(this[dR]||t instanceof Error)return this[dR]=!1,Dh(this,t,Jd),this;if(t===void 0)return Jd(this,t),this;let e=this.getHeader("content-type"),r=e!==void 0;if(t!==null){if(typeof t.pipe=="function"||typeof t.getReader=="function"||Gse.call(t)==="[object Response]")return Jd(this,t),this;if(t.buffer instanceof ArrayBuffer){r||(this[It]["content-type"]=fF.OCTET);let n=Buffer.isBuffer(t)?t:Buffer.from(t.buffer,t.byteOffset,t.byteLength);return Jd(this,n),this}if(!r&&typeof t=="string")return this[It]["content-type"]=fF.PLAIN,Jd(this,t),this}if(this[Za]!==null){if(typeof t!="string")return Fse(this,t),this;t=this[Za](t)}else if(!r||e.indexOf("json")!==-1){if(!r)this[It]["content-type"]=fF.JSON;else if(e.indexOf("charset")===-1){let n=e.trim();n.endsWith(";")?this[It]["content-type"]=`${n} charset=utf-8`:this[It]["content-type"]=`${n}; charset=utf-8`}if(typeof t!="string")return Fse(this,t),this}return Jd(this,t),this};Ot.prototype.getHeader=function(t){t=t.toLowerCase();let e=this[It][t];return e!==void 0?e:this.raw.getHeader(t)};Ot.prototype.getHeaders=function(){return{...this.raw.getHeaders(),...this[It]}};Ot.prototype.hasHeader=function(t){return t=t.toLowerCase(),this[It][t]!==void 0||this.raw.hasHeader(t)};Ot.prototype.removeHeader=function(t){return delete this[It][t.toLowerCase()],this};Ot.prototype.header=function(t,e=""){return t=t.toLowerCase(),this[It][t]&&t==="set-cookie"?(typeof this[It][t]=="string"&&(this[It][t]=[this[It][t]]),Array.isArray(e)?Array.prototype.push.apply(this[It][t],e):this[It][t].push(e)):this[It][t]=e,this};Ot.prototype.headers=function(t){let e=Object.keys(t);for(let r=0;r!==e.length;++r){let n=e[r];this.header(n,t[n])}return this};var e8e=new Set(["transfer-encoding","content-length","host","cache-control","max-forwards","te","authorization","set-cookie","content-encoding","content-type","content-range","trailer"]);Ot.prototype.trailer=function(t,e){if(t=t.toLowerCase(),e8e.has(t))throw new K5e(t);if(typeof e!="function")throw new J5e(t,typeof e);return this[Fr]===null&&(this[Fr]={}),this[Fr][t]=e,this};Ot.prototype.hasTrailer=function(t){return this[Fr]?.[t.toLowerCase()]!==void 0};Ot.prototype.removeTrailer=function(t){return this[Fr]===null?this:(this[Fr][t.toLowerCase()]=void 0,this)};Ot.prototype.code=function(t){let e=+t;if(!(e>=100&&e<=599))throw new Y5e(t||String(t));return this.raw.statusCode=e,this[_F]=!0,this};Ot.prototype.status=Ot.prototype.code;Ot.prototype.getSerializationFunction=function(t,e){let r;return typeof t=="string"||typeof t=="number"?typeof e=="string"?r=this[ct][fR]?.[t]?.[e]:r=this[ct][fR]?.[t]:typeof t=="object"&&(r=this[ct][Nl]?.get(t)),r};Ot.prototype.compileSerializationSchema=function(t,e=null,r=null){let{request:n}=this,{method:i,url:s}=n;if(this[ct][Nl]?.has(t))return this[ct][Nl].get(t);let a=(this[ct].serializerCompiler||this.server[dF].serializerCompiler||this.server[dF].setupSerializer(this.server[M5e])||this.server[dF].serializerCompiler)({schema:t,method:i,url:s,httpStatus:e,contentType:r});return this[ct][Nl]==null&&(this[ct][Nl]=new WeakMap),this[ct][Nl].set(t,a),a};Ot.prototype.serializeInput=function(t,e,r,n){let i=r,s;if(r=typeof e=="string"||typeof e=="number"?e:r,n=r&&i!==r?i:n,r!=null){if(n!=null?s=this[ct][fR]?.[r]?.[n]:s=this[ct][fR]?.[r],s==null)throw n?new X5e(r,n):new Z5e(r)}else this[ct][Nl]?.has(e)?s=this[ct][Nl].get(e):s=this.compileSerializationSchema(e,r,n);return s(t)};Ot.prototype.serialize=function(t){return this[Za]!==null?this[Za](t):this[ct]&&this[ct][uR]?this[ct][uR](t,this.raw.statusCode):Yse(this[ct],t,this.raw.statusCode)};Ot.prototype.serializer=function(t){return this[Za]=t,this};Ot.prototype.type=function(t){return this[It]["content-type"]=t,this};Ot.prototype.redirect=function(t,e){return e||(e=this[_F]?this.raw.statusCode:302),this.header("location",t).code(e).send()};Ot.prototype.callNotFound=function(){return c8e(this),this};Ot.prototype.then=function(t,e){if(this.sent){t();return}lR(this.raw,r=>{r&&r.code!=="ERR_STREAM_PREMATURE_CLOSE"?e?e(r):this.log&&this.log.warn("unhandled rejection on reply.then"):t()})};Ot.prototype.getDecorator=function(t){if(!Use.hasKey(this,t)&&!Use.exist(this,t))throw new Q5e(t,"reply");let e=this[t];return typeof e=="function"?e.bind(this):e};function Fse(t,e){t[ct].preSerialization!==null?j5e(t[ct].preSerialization,t.request,t,e,jse):jse(null,void 0,t,e)}function jse(t,e,r,n){if(t!=null){Dh(r,t);return}try{r[Za]!==null?n=r[Za](n):r[ct]&&r[ct][uR]?n=r[ct][uR](n,r.raw.statusCode):n=Yse(r[ct],n,r.raw.statusCode,r[It]["content-type"])}catch(i){t8e(i,r),Dh(r,i);return}Jd(r,n)}function t8e(t,e){t.serialization=e[ct].config}function Jd(t,e){t[ct].onSend!==null?Hse(t[ct].onSend,t.request,t,e,r8e):Wse(t,e)}function r8e(t,e,r,n){t!=null?Dh(r,t):Wse(r,n)}function pF(t,e){let r=t.raw;try{r.writeHead(e,t[It])}catch(n){throw n.code==="ERR_HTTP_HEADERS_SENT"&&t.log.warn(`Reply was already sent, did you forget to "return reply" in the "${t.request.raw.url}" (${t.request.raw.method}) route?`),n}}function Wse(t,e){let r=t.raw,n=t.request;if(t[Fr]!==null){let s=Object.keys(t[Fr]),o="";for(let a of s)typeof t[Fr][a]=="function"&&(o+=" ",o+=a);t.header("Transfer-Encoding","chunked"),t.header("Trailer",o.trim())}if(Gse.call(e)==="[object Response]"){if(typeof e.status=="number"&&t.code(e.status),typeof e.headers=="object"&&typeof e.headers.forEach=="function")for(let[s,o]of e.headers)t.header(s,o);if(e.body!==null&&e.bodyUsed)throw new V5e;e=e.body}let i=r.statusCode;if(e==null){i>=200&&i!==204&&i!==304&&n.method!=="HEAD"&&t[Fr]===null&&(t[It]["content-length"]="0"),pF(t,i),EE(e,r,t);return}if(i>=100&&i<200||i===204){t.removeHeader("content-type"),t.removeHeader("content-length"),pF(t,i),EE(void 0,r,t),typeof e.resume=="function"&&(e.on("error",mR),e.resume());return}if(typeof e.pipe=="function"){i8e(e,r,t);return}if(typeof e.getReader=="function"){n8e(e,r,t);return}if(typeof e!="string"&&!Buffer.isBuffer(e))throw new z5e(typeof e);if(t[Fr]===null){let s=t[It]["content-length"];(!s||n.raw.method!=="HEAD"&&Number(s)!==Buffer.byteLength(e))&&(t[It]["content-length"]=""+Buffer.byteLength(e))}pF(t,i),r.write(e),EE(e,r,t)}function hR(t,e,r){e.code==="ERR_STREAM_PREMATURE_CLOSE"?t[zse]||t.info({res:r},"stream closed prematurely"):t.warn({err:e},"response terminated with an error with headers already sent")}function n8e(t,e,r){if(t.locked)throw new H5e;let n=!0,i=!1,s=!1,o=t.getReader();if(lR(e,function(u){n&&(u!=null&&e.headersSent&&!i&&(i=!0,hR(r.log,u,e)),o.cancel().catch(mR))}),e.headersSent)r.log.warn("response will send, but you shouldn't use res.writeHead in stream mode");else for(let u in r[It])e.setHeader(u,r[It][u]);function a(u){if(u.done){n=!1,EE(null,e,r);return}if(e.destroyed){n=!1,o.cancel().catch(mR);return}if(e.write(u.value)===!1){s=!0,e.once("drain",c);return}o.read().then(a,l)}function c(){!s||!n||e.destroyed||(s=!1,o.read().then(a,l))}function l(u){n=!1,e.headersSent||r.request.raw.aborted===!0?(i||(i=!0,hR(r.log,u,r)),e.destroy()):Dh(r,u)}o.read().then(a,l)}function i8e(t,e,r){let n=!0,i=!1;if(s8e(t,e,r),lR(t,{readable:!0,writable:!1},function(s){n=!1,s!=null&&(e.headersSent||r.request.raw.aborted===!0?(i||(i=!0,hR(r.log,s,r)),e.destroy()):Dh(r,s))}),lR(e,function(s){n&&(s!=null&&e.headersSent&&!i&&(i=!0,hR(r.log,s,e)),typeof t.destroy=="function"?t.destroy():typeof t.close=="function"?t.close(mR):typeof t.abort=="function"?t.abort():r.log.warn("stream payload does not end properly"))}),e.headersSent)r.log.warn("response will send, but you shouldn't use res.writeHead in stream mode");else for(let s in r[It])e.setHeader(s,r[It][s]);t.pipe(e)}function EE(t,e,r){if(r[Fr]===null){e.end(null,null,null);return}let n=Object.keys(r[Fr]),i={},s=0,o=!0;function a(){s===0&&(e.addTrailers(i),e.end(null,null,null))}for(let c of n){let l=function(d,f){s++,d?r.log.debug(d):i[c]=f,process.nextTick(a)};if(typeof r[Fr][c]!="function")continue;o=!1,s--;let u=r[Fr][c](r,t,l);typeof u=="object"&&typeof u.then=="function"&&u.then(d=>l(null,d),l)}o&&e.end(null,null,null)}function s8e(t,e,r){r[Fr]!==null&&t.on("end",()=>EE(null,e,r))}function Dh(t,e,r){t[ct].onError!==null&&!t[D5e]?(t[yF]=!0,Hse(t[ct].onError,t.request,t,e,()=>Mse(t,e,r))):Mse(t,e,r)}function o8e(t){t[vE]=hF();let e=r=>{t[gF]=hF(),t.raw.removeListener("finish",e),t.raw.removeListener("error",e);let n=t[ct];t.request[Vse]&&(clearTimeout(t.request[pR]),t.request[pR]=null,t.request[Lh]&&(t.request.raw.removeListener("close",t.request[Lh]),t.request[Lh]=null)),n&&n.onResponse!==null?U5e(n.onResponse,t.request,t,qse):qse(r,t.request,t)};t.raw.on("finish",e),t.raw.on("error",e)}function qse(t,e,r){if(r.log[zse])return;let n=r.elapsedTime;if(t!=null){r.log.error({res:r,err:t,responseTime:n},"request errored");return}r.log.info({res:r,responseTime:n},"request completed")}function a8e(t){let e=t.props.slice();function r(n,i,s){this.raw=n,this[dR]=!1,this[Bse]=!1,this[mF]=!1,this[Za]=null,this.request=i,this[It]={},this[Fr]=null,this[vE]=void 0,this[gF]=void 0,this.log=s;let o;for(let a=0;a<e.length;a++)o=e[a],this[o.key]=o.value}return Object.setPrototypeOf(r.prototype,t.prototype),Object.setPrototypeOf(r,t),r.parent=t,r.props=e,r}function c8e(t){if(t[ct][Lse]===null){t.log.warn("Trying to send a NotFound error inside a 404 handler. Sending basic 404 response."),t.code(404).send("404 Not Found");return}t.request[ct]=t[ct][Lse],t[ct].preHandler!==null?F5e(t[ct].preHandler,t.request,t,Dse.preHandlerCallback):Dse.preHandlerCallback(null,t.request,t)}function Yse(t,e,r,n){let i=B5e(t,r,n);return i?i(e):JSON.stringify(e)}function mR(){}gR.exports=Ot;gR.exports.buildReply=a8e;gR.exports.setupResponseListeners=o8e});var Kse=E((pYt,yR)=>{"use strict";function SF(t){if(!t)throw new TypeError("argument req is required");let e=t.headers["x-forwarded-for"],r=t.socket.remoteAddress;if(!e||typeof e!="string")return[r];if(e.indexOf(",")===-1){let n=e.trim();return n.length?[r,n]:[r]}else return l8e(e,r)}function l8e(t,e){let r=[e],n=t.length,i=n,s,o;for(o=n-1;o>=0;--o)s=t[o],s===" "?i===n&&(i=n=o):s===","?(i!==n&&r.push(t.slice(i,n)),i=n=o):i=o;return i!==n&&r.push(t.substring(i,n)),r}yR.exports=SF;yR.exports.default=SF;yR.exports.forwarded=SF});var Zse=E((Jse,SR)=>{"use strict";(function(t){"use strict";let e="(0?\\d+|0x[a-f0-9]+)",r={fourOctet:new RegExp(`^${e}\\.${e}\\.${e}\\.${e}$`,"i"),threeOctet:new RegExp(`^${e}\\.${e}\\.${e}$`,"i"),twoOctet:new RegExp(`^${e}\\.${e}$`,"i"),longValue:new RegExp(`^${e}$`,"i")},n=new RegExp("^0[0-7]+$","i"),i=new RegExp("^0x[a-f0-9]+$","i"),s="%[0-9a-z]{1,}",o="(?:[0-9a-f]+::?)+",a={zoneIndex:new RegExp(s,"i"),native:new RegExp(`^(::)?(${o})?([0-9a-f]+)?(::)?(${s})?$`,"i"),deprecatedTransitional:new RegExp(`^(?:::)(${e}\\.${e}\\.${e}\\.${e}(${s})?)$`,"i"),transitional:new RegExp(`^((?:${o})|(?:::)(?:${o})?)${e}\\.${e}\\.${e}\\.${e}(${s})?$`,"i")};function c(p,h){if(p.indexOf("::")!==p.lastIndexOf("::"))return null;let m=0,_=-1,y=(p.match(a.zoneIndex)||[])[0],v,S;for(y&&(y=y.substring(1),p=p.replace(/%.+$/,""));(_=p.indexOf(":",_+1))>=0;)m++;if(p.substr(0,2)==="::"&&m--,p.substr(-2,2)==="::"&&m--,m>h)return null;for(S=h-m,v=":";S--;)v+="0:";return p=p.replace("::",v),p[0]===":"&&(p=p.slice(1)),p[p.length-1]===":"&&(p=p.slice(0,-1)),h=(function(){let g=p.split(":"),T=[];for(let I=0;I<g.length;I++)T.push(parseInt(g[I],16));return T})(),{parts:h,zoneId:y}}function l(p,h,m,_){if(p.length!==h.length)throw new Error("ipaddr: cannot match CIDR for objects with different lengths");let y=0,v;for(;_>0;){if(v=m-_,v<0&&(v=0),p[y]>>v!==h[y]>>v)return!1;_-=m,y+=1}return!0}function u(p){if(i.test(p))return parseInt(p,16);if(p[0]==="0"&&!isNaN(parseInt(p[1],10))){if(n.test(p))return parseInt(p,8);throw new Error(`ipaddr: cannot parse ${p} as octal`)}return parseInt(p,10)}function d(p,h){for(;p.length<h;)p=`0${p}`;return p}let f={};f.IPv4=(function(){function p(h){if(h.length!==4)throw new Error("ipaddr: ipv4 octet count should be 4");let m,_;for(m=0;m<h.length;m++)if(_=h[m],!(0<=_&&_<=255))throw new Error("ipaddr: ipv4 octet should fit in 8 bits");this.octets=h}return p.prototype.SpecialRanges={unspecified:[[new p([0,0,0,0]),8]],broadcast:[[new p([255,255,255,255]),32]],multicast:[[new p([224,0,0,0]),4]],linkLocal:[[new p([169,254,0,0]),16]],loopback:[[new p([127,0,0,0]),8]],carrierGradeNat:[[new p([100,64,0,0]),10]],private:[[new p([10,0,0,0]),8],[new p([172,16,0,0]),12],[new p([192,168,0,0]),16]],reserved:[[new p([192,0,0,0]),24],[new p([192,0,2,0]),24],[new p([192,88,99,0]),24],[new p([198,18,0,0]),15],[new p([198,51,100,0]),24],[new p([203,0,113,0]),24],[new p([240,0,0,0]),4]],as112:[[new p([192,175,48,0]),24],[new p([192,31,196,0]),24]],amt:[[new p([192,52,193,0]),24]]},p.prototype.kind=function(){return"ipv4"},p.prototype.match=function(h,m){let _;if(m===void 0&&(_=h,h=_[0],m=_[1]),h.kind()!=="ipv4")throw new Error("ipaddr: cannot match ipv4 address with non-ipv4 one");return l(this.octets,h.octets,8,m)},p.prototype.prefixLengthFromSubnetMask=function(){let h=0,m=!1,_={0:8,128:7,192:6,224:5,240:4,248:3,252:2,254:1,255:0},y,v,S;for(y=3;y>=0;y-=1)if(v=this.octets[y],v in _){if(S=_[v],m&&S!==0)return null;S!==8&&(m=!0),h+=S}else return null;return 32-h},p.prototype.range=function(){return f.subnetMatch(this,this.SpecialRanges)},p.prototype.toByteArray=function(){return this.octets.slice(0)},p.prototype.toIPv4MappedAddress=function(){return f.IPv6.parse(`::ffff:${this.toString()}`)},p.prototype.toNormalizedString=function(){return this.toString()},p.prototype.toString=function(){return this.octets.join(".")},p})(),f.IPv4.broadcastAddressFromCIDR=function(p){try{let h=this.parseCIDR(p),m=h[0].toByteArray(),_=this.subnetMaskFromPrefixLength(h[1]).toByteArray(),y=[],v=0;for(;v<4;)y.push(parseInt(m[v],10)|parseInt(_[v],10)^255),v++;return new this(y)}catch{throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},f.IPv4.isIPv4=function(p){return this.parser(p)!==null},f.IPv4.isValid=function(p){try{return new this(this.parser(p)),!0}catch{return!1}},f.IPv4.isValidCIDR=function(p){try{return this.parseCIDR(p),!0}catch{return!1}},f.IPv4.isValidFourPartDecimal=function(p){return!!(f.IPv4.isValid(p)&&p.match(/^(0|[1-9]\d*)(\.(0|[1-9]\d*)){3}$/))},f.IPv4.isValidCIDRFourPartDecimal=function(p){let h=p.match(/^(.+)\/(\d+)$/);return!f.IPv4.isValidCIDR(p)||!h?!1:f.IPv4.isValidFourPartDecimal(h[1])},f.IPv4.networkAddressFromCIDR=function(p){let h,m,_,y,v;try{for(h=this.parseCIDR(p),_=h[0].toByteArray(),v=this.subnetMaskFromPrefixLength(h[1]).toByteArray(),y=[],m=0;m<4;)y.push(parseInt(_[m],10)&parseInt(v[m],10)),m++;return new this(y)}catch{throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},f.IPv4.parse=function(p){let h=this.parser(p);if(h===null)throw new Error("ipaddr: string is not formatted like an IPv4 Address");return new this(h)},f.IPv4.parseCIDR=function(p){let h;if(h=p.match(/^(.+)\/(\d+)$/)){let m=parseInt(h[2]);if(m>=0&&m<=32){let _=[this.parse(h[1]),m];return Object.defineProperty(_,"toString",{value:function(){return this.join("/")}}),_}}throw new Error("ipaddr: string is not formatted like an IPv4 CIDR range")},f.IPv4.parser=function(p){let h,m,_;if(h=p.match(r.fourOctet))return(function(){let y=h.slice(1,6),v=[];for(let S=0;S<y.length;S++)m=y[S],v.push(u(m));return v})();if(h=p.match(r.longValue)){if(_=u(h[1]),_>4294967295||_<0)throw new Error("ipaddr: address outside defined range");return(function(){let y=[],v;for(v=0;v<=24;v+=8)y.push(_>>v&255);return y})().reverse()}else return(h=p.match(r.twoOctet))?(function(){let y=h.slice(1,4),v=[];if(_=u(y[1]),_>16777215||_<0)throw new Error("ipaddr: address outside defined range");return v.push(u(y[0])),v.push(_>>16&255),v.push(_>>8&255),v.push(_&255),v})():(h=p.match(r.threeOctet))?(function(){let y=h.slice(1,5),v=[];if(_=u(y[2]),_>65535||_<0)throw new Error("ipaddr: address outside defined range");return v.push(u(y[0])),v.push(u(y[1])),v.push(_>>8&255),v.push(_&255),v})():null},f.IPv4.subnetMaskFromPrefixLength=function(p){if(p=parseInt(p),p<0||p>32)throw new Error("ipaddr: invalid IPv4 prefix length");let h=[0,0,0,0],m=0,_=Math.floor(p/8);for(;m<_;)h[m]=255,m++;return _<4&&(h[_]=Math.pow(2,p%8)-1<<8-p%8),new this(h)},f.IPv6=(function(){function p(h,m){let _,y;if(h.length===16)for(this.parts=[],_=0;_<=14;_+=2)this.parts.push(h[_]<<8|h[_+1]);else if(h.length===8)this.parts=h;else throw new Error("ipaddr: ipv6 part count should be 8 or 16");for(_=0;_<this.parts.length;_++)if(y=this.parts[_],!(0<=y&&y<=65535))throw new Error("ipaddr: ipv6 part should fit in 16 bits");m&&(this.zoneId=m)}return p.prototype.SpecialRanges={unspecified:[new p([0,0,0,0,0,0,0,0]),128],linkLocal:[new p([65152,0,0,0,0,0,0,0]),10],multicast:[new p([65280,0,0,0,0,0,0,0]),8],loopback:[new p([0,0,0,0,0,0,0,1]),128],uniqueLocal:[new p([64512,0,0,0,0,0,0,0]),7],ipv4Mapped:[new p([0,0,0,0,0,65535,0,0]),96],deprecatedSiteLocal:[new p([65216,0,0,0,0,0,0,0]),10],discard:[new p([256,0,0,0,0,0,0,0]),64],rfc6145:[new p([0,0,0,0,65535,0,0,0]),96],rfc6052:[[new p([100,65435,0,0,0,0,0,0]),96],[new p([100,65435,1,0,0,0,0,0]),48]],"6to4":[new p([8194,0,0,0,0,0,0,0]),16],teredo:[new p([8193,0,0,0,0,0,0,0]),32],benchmarking:[new p([8193,2,0,0,0,0,0,0]),48],amt:[new p([8193,3,0,0,0,0,0,0]),32],as112v6:[[new p([8193,4,274,0,0,0,0,0]),48],[new p([9760,79,32768,0,0,0,0,0]),48]],deprecatedOrchid:[new p([8193,16,0,0,0,0,0,0]),28],orchid2:[new p([8193,32,0,0,0,0,0,0]),28],droneRemoteIdProtocolEntityTags:[new p([8193,48,0,0,0,0,0,0]),28],segmentRouting:[new p([24320,0,0,0,0,0,0,0]),16],reserved:[[new p([8193,0,0,0,0,0,0,0]),23],[new p([8193,3512,0,0,0,0,0,0]),32],[new p([16383,0,0,0,0,0,0,0]),20]]},p.prototype.isIPv4MappedAddress=function(){return this.range()==="ipv4Mapped"},p.prototype.kind=function(){return"ipv6"},p.prototype.match=function(h,m){let _;if(m===void 0&&(_=h,h=_[0],m=_[1]),h.kind()!=="ipv6")throw new Error("ipaddr: cannot match ipv6 address with non-ipv6 one");return l(this.parts,h.parts,16,m)},p.prototype.prefixLengthFromSubnetMask=function(){let h=0,m=!1,_={0:16,32768:15,49152:14,57344:13,61440:12,63488:11,64512:10,65024:9,65280:8,65408:7,65472:6,65504:5,65520:4,65528:3,65532:2,65534:1,65535:0},y,v;for(let S=7;S>=0;S-=1)if(y=this.parts[S],y in _){if(v=_[y],m&&v!==0)return null;v!==16&&(m=!0),h+=v}else return null;return 128-h},p.prototype.range=function(){return f.subnetMatch(this,this.SpecialRanges)},p.prototype.toByteArray=function(){let h,m=[],_=this.parts;for(let y=0;y<_.length;y++)h=_[y],m.push(h>>8),m.push(h&255);return m},p.prototype.toFixedLengthString=function(){let h=(function(){let _=[];for(let y=0;y<this.parts.length;y++)_.push(d(this.parts[y].toString(16),4));return _}).call(this).join(":"),m="";return this.zoneId&&(m=`%${this.zoneId}`),h+m},p.prototype.toIPv4Address=function(){if(!this.isIPv4MappedAddress())throw new Error("ipaddr: trying to convert a generic ipv6 address to ipv4");let h=this.parts.slice(-2),m=h[0],_=h[1];return new f.IPv4([m>>8,m&255,_>>8,_&255])},p.prototype.toNormalizedString=function(){let h=(function(){let _=[];for(let y=0;y<this.parts.length;y++)_.push(this.parts[y].toString(16));return _}).call(this).join(":"),m="";return this.zoneId&&(m=`%${this.zoneId}`),h+m},p.prototype.toRFC5952String=function(){let h=/((^|:)(0(:|$)){2,})/g,m=this.toNormalizedString(),_=0,y=-1,v;for(;v=h.exec(m);)v[0].length>y&&(_=v.index,y=v[0].length);return y<0?m:`${m.substring(0,_)}::${m.substring(_+y)}`},p.prototype.toString=function(){return this.toRFC5952String()},p})(),f.IPv6.broadcastAddressFromCIDR=function(p){try{let h=this.parseCIDR(p),m=h[0].toByteArray(),_=this.subnetMaskFromPrefixLength(h[1]).toByteArray(),y=[],v=0;for(;v<16;)y.push(parseInt(m[v],10)|parseInt(_[v],10)^255),v++;return new this(y)}catch(h){throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${h})`)}},f.IPv6.isIPv6=function(p){return this.parser(p)!==null},f.IPv6.isValid=function(p){if(typeof p=="string"&&p.indexOf(":")===-1)return!1;try{let h=this.parser(p);return new this(h.parts,h.zoneId),!0}catch{return!1}},f.IPv6.isValidCIDR=function(p){if(typeof p=="string"&&p.indexOf(":")===-1)return!1;try{return this.parseCIDR(p),!0}catch{return!1}},f.IPv6.networkAddressFromCIDR=function(p){let h,m,_,y,v;try{for(h=this.parseCIDR(p),_=h[0].toByteArray(),v=this.subnetMaskFromPrefixLength(h[1]).toByteArray(),y=[],m=0;m<16;)y.push(parseInt(_[m],10)&parseInt(v[m],10)),m++;return new this(y)}catch(S){throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${S})`)}},f.IPv6.parse=function(p){let h=this.parser(p);if(h.parts===null)throw new Error("ipaddr: string is not formatted like an IPv6 Address");return new this(h.parts,h.zoneId)},f.IPv6.parseCIDR=function(p){let h,m,_;if((m=p.match(/^(.+)\/(\d+)$/))&&(h=parseInt(m[2]),h>=0&&h<=128))return _=[this.parse(m[1]),h],Object.defineProperty(_,"toString",{value:function(){return this.join("/")}}),_;throw new Error("ipaddr: string is not formatted like an IPv6 CIDR range")},f.IPv6.parser=function(p){let h,m,_,y,v,S;if(_=p.match(a.deprecatedTransitional))return this.parser(`::ffff:${_[1]}`);if(a.native.test(p))return c(p,8);if((_=p.match(a.transitional))&&(S=_[6]||"",h=_[1],_[1].endsWith("::")||(h=h.slice(0,-1)),h=c(h+S,6),h.parts)){for(v=[parseInt(_[2]),parseInt(_[3]),parseInt(_[4]),parseInt(_[5])],m=0;m<v.length;m++)if(y=v[m],!(0<=y&&y<=255))return null;return h.parts.push(v[0]<<8|v[1]),h.parts.push(v[2]<<8|v[3]),{parts:h.parts,zoneId:h.zoneId}}return null},f.IPv6.subnetMaskFromPrefixLength=function(p){if(p=parseInt(p),p<0||p>128)throw new Error("ipaddr: invalid IPv6 prefix length");let h=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],m=0,_=Math.floor(p/8);for(;m<_;)h[m]=255,m++;return _<16&&(h[_]=Math.pow(2,p%8)-1<<8-p%8),new this(h)},f.fromByteArray=function(p){let h=p.length;if(h===4)return new f.IPv4(p);if(h===16)return new f.IPv6(p);throw new Error("ipaddr: the binary input is neither an IPv6 nor IPv4 address")},f.isValid=function(p){return f.IPv6.isValid(p)||f.IPv4.isValid(p)},f.isValidCIDR=function(p){return f.IPv6.isValidCIDR(p)||f.IPv4.isValidCIDR(p)},f.parse=function(p){if(f.IPv6.isValid(p))return f.IPv6.parse(p);if(f.IPv4.isValid(p))return f.IPv4.parse(p);throw new Error("ipaddr: the address has neither IPv6 nor IPv4 format")},f.parseCIDR=function(p){try{return f.IPv6.parseCIDR(p)}catch{try{return f.IPv4.parseCIDR(p)}catch{throw new Error("ipaddr: the address has neither IPv6 nor IPv4 CIDR format")}}},f.process=function(p){let h=this.parse(p);return h.kind()==="ipv6"&&h.isIPv4MappedAddress()?h.toIPv4Address():h},f.subnetMatch=function(p,h,m){let _,y,v,S;m==null&&(m="unicast");for(y in h)if(Object.prototype.hasOwnProperty.call(h,y)){for(v=h[y],v[0]&&!(v[0]instanceof Array)&&(v=[v]),_=0;_<v.length;_++)if(S=v[_],p.kind()===S[0].kind()&&p.match.apply(p,S))return y}return m},typeof SR<"u"&&SR.exports?SR.exports=f:t.ipaddr=f})(Jse)});var roe=E((hYt,Mh)=>{"use strict";Mh.exports=EF;Mh.exports.default=EF;Mh.exports.proxyaddr=EF;Mh.exports.all=eoe;Mh.exports.compile=toe;var u8e=Kse(),Qse=Zse(),d8e=/^\d+$/u,ER=Qse.isValid,vR=Qse.parse,Xse={linklocal:["169.254.0.0/16","fe80::/10"],loopback:["127.0.0.1/8","::1/128"],uniquelocal:["10.0.0.0/8","172.16.0.0/12","192.168.0.0/16","fc00::/7"]};function eoe(t,e){let r=u8e(t);if(!e)return r;typeof e!="function"&&(e=toe(e));for(let n=0;n<r.length-1;n++)e(r[n],n)||(r.length=n+1);return r}function toe(t){if(!t)throw new TypeError("argument is required");let e;if(typeof t=="string")e=[t];else if(Array.isArray(t))e=t.slice();else throw new TypeError("unsupported trust argument");for(let r=0;r<e.length;r++)t=e[r],Object.hasOwn(Xse,t)&&(t=Xse[t],e.splice.apply(e,[r,1].concat(t)),r+=t.length-1);return p8e(f8e(e))}function f8e(t){let e=new Array(t.length);for(let r=0;r<t.length;r++)e[r]=h8e(t[r]);return e}function p8e(t){let e=t.length;return e===0?g8e:e===1?y8e(t[0]):_8e(t)}function h8e(t){let e=t.lastIndexOf("/"),r=e!==-1?t.substring(0,e):t;if(!ER(r))throw new TypeError("invalid IP address: "+r);let n=vR(r);e===-1&&n.kind()==="ipv6"&&n.isIPv4MappedAddress()&&(n=n.toIPv4Address());let i=n.kind()==="ipv6"?128:32,s=e!==-1?t.substring(e+1,t.length):null;if(s===null?s=i:d8e.test(s)?s=parseInt(s,10):n.kind()==="ipv4"&&ER(s)?s=m8e(s):s=null,s<=0||s>i)throw new TypeError("invalid range on address: "+t);return[n,s]}function m8e(t){let e=vR(t);return e.kind()==="ipv4"?e.prefixLengthFromSubnetMask():null}function EF(t,e){if(!t)throw new TypeError("req argument is required");if(!e)throw new TypeError("trust argument is required");let r=eoe(t,e);return r[r.length-1]}function g8e(){return!1}function _8e(t){return function(r){if(!ER(r))return!1;let n=vR(r),i,s=n.kind();for(let o=0;o<t.length;o++){let a=t[o],c=a[0],l=c.kind(),u=a[1],d=n;if(s!==l){let f=l==="ipv4";if(f&&!n.isIPv4MappedAddress())continue;i||(i=f?n.toIPv4Address():n.toIPv4MappedAddress()),d=i}if(d.match(c,u))return!0}return!1}}function y8e(t){let e=t[0],r=e.kind(),n=r==="ipv4",i=t[1];return function(o){if(!ER(o))return!1;let a=vR(o);if(a.kind()!==r){if(n&&!a.isIPv4MappedAddress())return!1;a=n?a.toIPv4Address():a.toIPv4MappedAddress()}return a.match(e,i)}}});var TR=E((mYt,wF)=>{"use strict";var bR=roe(),{kHasBeenDecorated:S8e,kSchemaBody:E8e,kSchemaHeaders:v8e,kSchemaParams:b8e,kSchemaQuerystring:noe,kSchemaController:vF,kOptions:T8e,kRequestCacheValidateFns:kl,kRouteContext:Tn,kRequestOriginalUrl:bF,kRequestSignal:ioe,kOnAbort:w8e}=Ar(),{FST_ERR_REQ_INVALID_VALIDATION_INVOCATION:A8e,FST_ERR_DEC_UNDECLARED:R8e}=Ur(),soe=SE(),ooe={body:E8e,headers:v8e,params:b8e,querystring:noe,query:noe};function TF(t,e,r,n,i,s){this.id=t,this[Tn]=s,this.params=e,this.raw=r,this.query=n,this.log=i,this.body=void 0}TF.props=[];function x8e(t){if(typeof t=="function")return t;if(t===!0)return function(){return!0};if(typeof t=="number")return function(e,r){return r<t};if(typeof t=="string"){let e=t.split(",").map(r=>r.trim());return bR.compile(e)}return bR.compile(t)}function I8e(t,e){return e?O8e(t,e):loe(t)}function loe(t){let e=t.props.slice();function r(n,i,s,o,a,c){this.id=n,this[Tn]=c,this.params=i,this.raw=s,this.query=o,this.log=a,this.body=void 0;let l;for(let u=0;u<e.length;u++)l=e[u],this[l.key]=l.value}return Object.setPrototypeOf(r.prototype,t.prototype),Object.setPrototypeOf(r,t),r.props=e,r.parent=t,r}function aoe(t){let e=t.lastIndexOf(",");return e===-1?t.trim():t.slice(e+1).trim()}function O8e(t,e){let r=loe(t),n=x8e(e);return r[S8e]=!0,Object.defineProperties(r.prototype,{ip:{get(){let i=bR.all(this.raw,n);return i[i.length-1]}},ips:{get(){return bR.all(this.raw,n)}},host:{get(){let i=this.raw.socket?.remoteAddress;return this.headers["x-forwarded-host"]&&i!==null&&n(i,0)?aoe(this.headers["x-forwarded-host"]):this.headers.host??this.headers[":authority"]??""}},protocol:{get(){let i=this.raw.socket?.remoteAddress;if(this.headers["x-forwarded-proto"]&&i!==null&&n(i,0))return aoe(this.headers["x-forwarded-proto"]);if(this.socket)return this.socket.encrypted?"https":"http"}}}),r}function coe(t,e){if(!soe.hasKey(t,e)&&!soe.exist(t,e))throw new R8e(e,"request")}Object.defineProperties(TF.prototype,{server:{get(){return this[Tn].server}},url:{get(){return this.raw.url}},originalUrl:{get(){return this[bF]||(this[bF]=this.raw.originalUrl||this.raw.url),this[bF]}},method:{get(){return this.raw.method}},routeOptions:{get(){let t=this[Tn],e=t._parserOptions.limit,r=t.server.initialConfig.bodyLimit,n=t.server.hasConstraintStrategy("version")?this.raw.headers["accept-version"]:void 0;return{method:t.config?.method,url:t.config?.url,bodyLimit:e||r,handlerTimeout:t.handlerTimeout,attachValidation:t.attachValidation,logLevel:t.logLevel,exposeHeadRoute:t.exposeHeadRoute,prefixTrailingSlash:t.prefixTrailingSlash,handler:t.handler,config:t.config,schema:t.schema,version:n}}},is404:{get(){return this[Tn].config?.url===void 0}},socket:{get(){return this.raw.socket}},signal:{get(){let t=this[ioe];if(t)return t.signal;t=new AbortController,this[ioe]=t;let e=()=>{t.signal.aborted||t.abort()};return this.raw.on("close",e),this[w8e]=e,t.signal}},ip:{get(){if(this.socket)return this.socket.remoteAddress}},host:{get(){return this.raw.headers.host??this.raw.headers[":authority"]??""}},hostname:{get(){return this.host[0]==="["?this.host.slice(0,this.host.indexOf("]")+1):this.host.split(":",1)[0]}},port:{get(){let t=/(?<port>:\d+)$/,e=this.headers.host??this.headers[":authority"]??"",r=t.exec(e);return r===null||r[1]===void 0?null:parseInt(r.groups.port.slice(1),10)}},protocol:{get(){if(this.socket)return this.socket.encrypted?"https":"http"}},headers:{get(){return this.additionalHeaders?Object.assign({},this.raw.headers,this.additionalHeaders):this.raw.headers},set(t){this.additionalHeaders=t}},getValidationFunction:{value:function(t){if(typeof t=="string"){let e=ooe[t];return this[Tn][e]}else if(typeof t=="object")return this[Tn][kl]?.get(t)}},compileValidationSchema:{value:function(t,e=null){let{method:r,url:n}=this;if(this[Tn][kl]?.has(t))return this[Tn][kl].get(t);let s=(this[Tn].validatorCompiler||this.server[vF].validatorCompiler||this.server[vF].setupValidator(this.server[T8e])||this.server[vF].validatorCompiler)({schema:t,method:r,url:n,httpPart:e});return this[Tn][kl]==null&&(this[Tn][kl]=new WeakMap),this[Tn][kl].set(t,s),s}},validateInput:{value:function(t,e,r){r=typeof e=="string"?e:r;let n=r!=null&&typeof r=="string"&&ooe[r],i;if(n&&(i=this[Tn][n]),i==null&&(e==null||typeof e!="object"||Array.isArray(e)))throw new A8e(r);return i==null&&(this[Tn][kl]?.has(e)?i=this[Tn][kl].get(e):i=this.compileValidationSchema(e,r)),i(t)}},getDecorator:{value:function(t){coe(this,t);let e=this[t];return typeof e=="function"?e.bind(this):e}},setDecorator:{value:function(t,e){coe(this,t),this[t]=e}}});wF.exports=TF;wF.exports.buildRequest=I8e});var wR=E((gYt,uoe)=>{"use strict";var{kFourOhFourContext:P8e,kReplySerializerDefault:C8e,kSchemaErrorFormatter:N8e,kErrorHandler:k8e,kChildLoggerFactory:$8e,kOptions:L8e,kReply:D8e,kRequest:M8e,kBodyLimit:U8e,kLogLevel:F8e,kContentTypeParser:j8e,kRouteByFastify:q8e,kRequestCacheValidateFns:B8e,kReplyCacheSerializeFns:z8e,kHandlerTimeout:V8e}=Ar();function H8e({schema:t,handler:e,config:r,requestIdLogLabel:n,childLoggerFactory:i,errorHandler:s,bodyLimit:o,logLevel:a,logSerializers:c,attachValidation:l,validatorCompiler:u,serializerCompiler:d,replySerializer:f,schemaErrorFormatter:p,exposeHeadRoute:h,prefixTrailingSlash:m,server:_,isFastify:y,handlerTimeout:v}){this.schema=t,this.handler=e,this.Reply=_[D8e],this.Request=_[M8e],this.contentTypeParser=_[j8e],this.onRequest=null,this.onSend=null,this.onError=null,this.onTimeout=null,this.preHandler=null,this.onResponse=null,this.preSerialization=null,this.onRequestAbort=null,this.config=r,this.errorHandler=s||_[k8e],this.requestIdLogLabel=n||_[L8e].requestIdLogLabel,this.childLoggerFactory=i||_[$8e],this._middie=null,this._parserOptions={limit:o||_[U8e]},this.exposeHeadRoute=h,this.prefixTrailingSlash=m,this.logLevel=a||_[F8e],this.logSerializers=c,this[P8e]=null,this.attachValidation=l,this[C8e]=f,this.schemaErrorFormatter=p||_[N8e]||G8e,this[q8e]=y,this[B8e]=null,this[z8e]=null,this.validatorCompiler=u||null,this.serializerCompiler=d||null,this.handlerTimeout=v||_[V8e]||0,this.server=_}function G8e(t,e){let r="";for(let i=0;i!==t.length;++i){let s=t[i];r+=e+(s.instancePath||"")+" "+s.message+", "}return new Error(r.slice(0,-2))}uoe.exports=H8e});var foe=E(jo=>{"use strict";var AF=class{constructor(e=1e3,r=0){if(isNaN(e)||e<0)throw new Error("Invalid max value");if(isNaN(r)||r<0)throw new Error("Invalid ttl value");this.first=null,this.items=new Map,this.last=null,this.max=e,this.ttl=r}get size(){return this.items.size}clear(){this.items=new Map,this.first=null,this.last=null}delete(e){if(this.items.has(e)){let r=this.items.get(e);this.items.delete(e),r.prev!==null&&(r.prev.next=r.next),r.next!==null&&(r.next.prev=r.prev),this.first===r&&(this.first=r.next),this.last===r&&(this.last=r.prev)}}deleteMany(e){for(var r=0;r<e.length;r++)this.delete(e[r])}evict(){if(this.size>0){let e=this.first;this.items.delete(e.key),this.size===0?(this.first=null,this.last=null):(this.first=e.next,this.first.prev=null)}}expiresAt(e){if(this.items.has(e))return this.items.get(e).expiry}get(e){if(this.items.has(e)){let r=this.items.get(e);if(this.ttl>0&&r.expiry<=Date.now()){this.delete(e);return}return r.value}}getMany(e){let r=[];for(var n=0;n<e.length;n++)r.push(this.get(e[n]));return r}keys(){return this.items.keys()}set(e,r){if(this.items.has(e)){let i=this.items.get(e);i.value=r,i.expiry=this.ttl>0?Date.now()+this.ttl:this.ttl;return}this.max>0&&this.size===this.max&&this.evict();let n={expiry:this.ttl>0?Date.now()+this.ttl:this.ttl,key:e,prev:this.last,next:null,value:r};this.items.set(e,n),this.size===1?this.first=n:this.last.next=n,this.last=n}},AR=class{constructor(e=1e3,r=0){if(isNaN(e)||e<0)throw new Error("Invalid max value");if(isNaN(r)||r<0)throw new Error("Invalid ttl value");this.first=null,this.items=Object.create(null),this.last=null,this.size=0,this.max=e,this.ttl=r}clear(){this.items=Object.create(null),this.first=null,this.last=null,this.size=0}delete(e){if(Object.prototype.hasOwnProperty.call(this.items,e)){let r=this.items[e];delete this.items[e],this.size--,r.prev!==null&&(r.prev.next=r.next),r.next!==null&&(r.next.prev=r.prev),this.first===r&&(this.first=r.next),this.last===r&&(this.last=r.prev)}}deleteMany(e){for(var r=0;r<e.length;r++)this.delete(e[r])}evict(){if(this.size>0){let e=this.first;delete this.items[e.key],--this.size===0?(this.first=null,this.last=null):(this.first=e.next,this.first.prev=null)}}expiresAt(e){if(Object.prototype.hasOwnProperty.call(this.items,e))return this.items[e].expiry}get(e){if(Object.prototype.hasOwnProperty.call(this.items,e)){let r=this.items[e];if(this.ttl>0&&r.expiry<=Date.now()){this.delete(e);return}return r.value}}getMany(e){let r=[];for(var n=0;n<e.length;n++)r.push(this.get(e[n]));return r}keys(){return Object.keys(this.items)}set(e,r){if(Object.prototype.hasOwnProperty.call(this.items,e)){let i=this.items[e];i.value=r,i.expiry=this.ttl>0?Date.now()+this.ttl:this.ttl;return}this.max>0&&this.size===this.max&&this.evict();let n={expiry:this.ttl>0?Date.now()+this.ttl:this.ttl,key:e,prev:this.last,next:null,value:r};this.items[e]=n,++this.size===1?this.first=n:this.last.next=n,this.last=n}},RR=class{constructor(){this.records={}}initForCache(e,r){this.records[e]={[r]:{cacheSize:0,hits:0,falsyHits:0,emptyHits:0,misses:0,expirations:0,evictions:0,invalidateOne:0,invalidateAll:0,sets:0}}}resetForCache(e){for(let r of Object.keys(this.records[e]))this.records[e][r]={cacheSize:0,hits:0,falsyHits:0,emptyHits:0,misses:0,expirations:0,evictions:0,invalidateOne:0,invalidateAll:0,sets:0}}getStatistics(){return this.records}},RF=class{constructor(e=1e3,r=0){if(isNaN(e)||e<0)throw new Error("Invalid max value");if(isNaN(r)||r<0)throw new Error("Invalid ttl value");this.first=null,this.items=new Map,this.last=null,this.max=e,this.ttl=r}get size(){return this.items.size}bumpLru(e){if(this.last===e)return;let r=this.last,n=e.next,i=e.prev;this.first===e&&(this.first=n),e.next=null,e.prev=r,r.next=e,i!==null&&(i.next=n),n!==null&&(n.prev=i),this.last=e}clear(){this.items=new Map,this.first=null,this.last=null}delete(e){if(this.items.has(e)){let r=this.items.get(e);this.items.delete(e),r.prev!==null&&(r.prev.next=r.next),r.next!==null&&(r.next.prev=r.prev),this.first===r&&(this.first=r.next),this.last===r&&(this.last=r.prev)}}deleteMany(e){for(var r=0;r<e.length;r++)this.delete(e[r])}evict(){if(this.size>0){let e=this.first;this.items.delete(e.key),this.size===0?(this.first=null,this.last=null):(this.first=e.next,this.first.prev=null)}}expiresAt(e){if(this.items.has(e))return this.items.get(e).expiry}get(e){if(this.items.has(e)){let r=this.items.get(e);if(this.ttl>0&&r.expiry<=Date.now()){this.delete(e);return}return this.bumpLru(r),r.value}}getMany(e){let r=[];for(var n=0;n<e.length;n++)r.push(this.get(e[n]));return r}keys(){return this.items.keys()}set(e,r){if(this.items.has(e)){let i=this.items.get(e);i.value=r,i.expiry=this.ttl>0?Date.now()+this.ttl:this.ttl,this.last!==i&&this.bumpLru(i);return}this.max>0&&this.size===this.max&&this.evict();let n={expiry:this.ttl>0?Date.now()+this.ttl:this.ttl,key:e,prev:this.last,next:null,value:r};this.items.set(e,n),this.size===1?this.first=n:this.last.next=n,this.last=n}},bE=class{constructor(e=1e3,r=0){if(isNaN(e)||e<0)throw new Error("Invalid max value");if(isNaN(r)||r<0)throw new Error("Invalid ttl value");this.first=null,this.items=Object.create(null),this.last=null,this.size=0,this.max=e,this.ttl=r}bumpLru(e){if(this.last===e)return;let r=this.last,n=e.next,i=e.prev;this.first===e&&(this.first=n),e.next=null,e.prev=r,r.next=e,i!==null&&(i.next=n),n!==null&&(n.prev=i),this.last=e}clear(){this.items=Object.create(null),this.first=null,this.last=null,this.size=0}delete(e){if(Object.prototype.hasOwnProperty.call(this.items,e)){let r=this.items[e];delete this.items[e],this.size--,r.prev!==null&&(r.prev.next=r.next),r.next!==null&&(r.next.prev=r.prev),this.first===r&&(this.first=r.next),this.last===r&&(this.last=r.prev)}}deleteMany(e){for(var r=0;r<e.length;r++)this.delete(e[r])}evict(){if(this.size>0){let e=this.first;delete this.items[e.key],--this.size===0?(this.first=null,this.last=null):(this.first=e.next,this.first.prev=null)}}expiresAt(e){if(Object.prototype.hasOwnProperty.call(this.items,e))return this.items[e].expiry}get(e){if(Object.prototype.hasOwnProperty.call(this.items,e)){let r=this.items[e];if(this.ttl>0&&r.expiry<=Date.now()){this.delete(e);return}return this.bumpLru(r),r.value}}getMany(e){let r=[];for(var n=0;n<e.length;n++)r.push(this.get(e[n]));return r}keys(){return Object.keys(this.items)}set(e,r){if(Object.prototype.hasOwnProperty.call(this.items,e)){let i=this.items[e];i.value=r,i.expiry=this.ttl>0?Date.now()+this.ttl:this.ttl,this.last!==i&&this.bumpLru(i);return}this.max>0&&this.size===this.max&&this.evict();let n={expiry:this.ttl>0?Date.now()+this.ttl:this.ttl,key:e,prev:this.last,next:null,value:r};this.items[e]=n,++this.size===1?this.first=n:this.last.next=n,this.last=n}};function doe(t){return`${t.getFullYear()}-${(t.getMonth()+1).toString().padStart(2,"0")}-${t.getDate().toString().padStart(2,"0")}`}var xF=class{constructor(e,r,n){this.cacheId=e,this.statisticTtlInHours=r,this.collectionStart=new Date,this.currentTimeStamp=doe(this.collectionStart),this.records=n||new RR,this.records.initForCache(this.cacheId,this.currentTimeStamp)}get currentRecord(){return this.records.records[this.cacheId][this.currentTimeStamp]||(this.records.records[this.cacheId][this.currentTimeStamp]={cacheSize:0,hits:0,falsyHits:0,emptyHits:0,misses:0,expirations:0,evictions:0,sets:0,invalidateOne:0,invalidateAll:0}),this.records.records[this.cacheId][this.currentTimeStamp]}hoursPassed(){return(Date.now()-this.collectionStart)/1e3/60/60}addHit(){this.archiveIfNeeded(),this.currentRecord.hits++}addFalsyHit(){this.archiveIfNeeded(),this.currentRecord.falsyHits++}addEmptyHit(){this.archiveIfNeeded(),this.currentRecord.emptyHits++}addMiss(){this.archiveIfNeeded(),this.currentRecord.misses++}addEviction(){this.archiveIfNeeded(),this.currentRecord.evictions++}setCacheSize(e){this.archiveIfNeeded(),this.currentRecord.cacheSize=e}addExpiration(){this.archiveIfNeeded(),this.currentRecord.expirations++}addSet(){this.archiveIfNeeded(),this.currentRecord.sets++}addInvalidateOne(){this.archiveIfNeeded(),this.currentRecord.invalidateOne++}addInvalidateAll(){this.archiveIfNeeded(),this.currentRecord.invalidateAll++}getStatistics(){return this.records.getStatistics()}archiveIfNeeded(){this.hoursPassed()>=this.statisticTtlInHours&&(this.collectionStart=new Date,this.currentTimeStamp=doe(this.collectionStart),this.records.initForCache(this.cacheId,this.currentTimeStamp))}},xR=class extends bE{constructor(e,r,n,i,s){if(super(e||1e3,r||0),!n)throw new Error("Cache id is mandatory");this.hitStatistics=new xF(n,s!==void 0?s:24,i)}getStatistics(){return this.hitStatistics.getStatistics()}set(e,r){super.set(e,r),this.hitStatistics.addSet(),this.hitStatistics.setCacheSize(this.size)}evict(){super.evict(),this.hitStatistics.addEviction(),this.hitStatistics.setCacheSize(this.size)}delete(e,r=!1){super.delete(e),r||this.hitStatistics.addInvalidateOne(),this.hitStatistics.setCacheSize(this.size)}clear(){super.clear(),this.hitStatistics.addInvalidateAll(),this.hitStatistics.setCacheSize(this.size)}get(e){if(Object.prototype.hasOwnProperty.call(this.items,e)){let r=this.items[e];if(this.ttl>0&&r.expiry<=Date.now()){this.delete(e,!0),this.hitStatistics.addExpiration();return}return this.bumpLru(r),r.value||this.hitStatistics.addFalsyHit(),(r.value===void 0||r.value===null||r.value==="")&&this.hitStatistics.addEmptyHit(),this.hitStatistics.addHit(),r.value}this.hitStatistics.addMiss()}};jo.Fifo=AR;jo.FifoMap=AF;jo.FifoObject=AR;jo.HitStatisticsRecord=RR;jo.Lru=bE;jo.LruHitStatistics=xR;jo.LruMap=RF;jo.LruObject=bE;jo.LruObjectHitStatistics=xR});var _oe=E((yYt,Uh)=>{"use strict";var W8e=typeof Buffer<"u",poe=/"(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])"\s*:/,hoe=/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/;function moe(t,e,r){r==null&&e!==null&&typeof e=="object"&&(r=e,e=void 0),W8e&&Buffer.isBuffer(t)&&(t=t.toString()),t&&t.charCodeAt(0)===65279&&(t=t.slice(1));let n=JSON.parse(t,e);if(n===null||typeof n!="object")return n;let i=r&&r.protoAction||"error",s=r&&r.constructorAction||"error";if(i==="ignore"&&s==="ignore")return n;if(i!=="ignore"&&s!=="ignore"){if(poe.test(t)===!1&&hoe.test(t)===!1)return n}else if(i!=="ignore"&&s==="ignore"){if(poe.test(t)===!1)return n}else if(hoe.test(t)===!1)return n;return goe(n,{protoAction:i,constructorAction:s,safe:r&&r.safe})}function goe(t,{protoAction:e="error",constructorAction:r="error",safe:n}={}){let i=[t];for(;i.length;){let s=i;i=[];for(let o of s){if(e!=="ignore"&&Object.prototype.hasOwnProperty.call(o,"__proto__")){if(n===!0)return null;if(e==="error")throw new SyntaxError("Object contains forbidden prototype property");delete o.__proto__}if(r!=="ignore"&&Object.prototype.hasOwnProperty.call(o,"constructor")&&o.constructor!==null&&typeof o.constructor=="object"&&Object.prototype.hasOwnProperty.call(o.constructor,"prototype")){if(n===!0)return null;if(r==="error")throw new SyntaxError("Object contains forbidden prototype property");delete o.constructor}for(let a in o){let c=o[a];c&&typeof c=="object"&&i.push(c)}}}return t}function IF(t,e,r){let{stackTraceLimit:n}=Error;Error.stackTraceLimit=0;try{return moe(t,e,r)}finally{Error.stackTraceLimit=n}}function Y8e(t,e){let{stackTraceLimit:r}=Error;Error.stackTraceLimit=0;try{return moe(t,e,{safe:!0})}catch{return}finally{Error.stackTraceLimit=r}}Uh.exports=IF;Uh.exports.default=IF;Uh.exports.parse=IF;Uh.exports.safeParse=Y8e;Uh.exports.scan=goe});var kF=E((SYt,AE)=>{"use strict";var{AsyncResource:K8e}=W("async_hooks"),{FifoMap:Eoe}=foe(),{parse:J8e}=_oe(),wE=nU(),{kDefaultJsonParse:TE,kContentTypeParser:Fh,kBodyLimit:Z8e,kRequestPayloadStream:voe,kState:PF,kTestInternals:X8e,kReplyIsError:yoe,kRouteContext:Q8e}=Ar(),{FST_ERR_CTP_INVALID_TYPE:IR,FST_ERR_CTP_EMPTY_TYPE:e9e,FST_ERR_CTP_ALREADY_PRESENT:t9e,FST_ERR_CTP_INVALID_HANDLER:r9e,FST_ERR_CTP_INVALID_PARSE_TYPE:n9e,FST_ERR_CTP_BODY_TOO_LARGE:Soe,FST_ERR_CTP_INVALID_MEDIA_TYPE:i9e,FST_ERR_CTP_INVALID_CONTENT_LENGTH:s9e,FST_ERR_CTP_EMPTY_JSON_BODY:o9e,FST_ERR_CTP_INSTANCE_ALREADY_STARTED:CF,FST_ERR_CTP_INVALID_JSON_BODY:a9e}=Ur(),{FSTSEC001:c9e}=xh();function Xa(t,e,r){this[TE]=Toe(e,r),this.customParsers=new Map,this.customParsers.set("application/json",new OF(!0,!1,t,this[TE])),this.customParsers.set("text/plain",new OF(!0,!1,t,NF)),this.parserList=["application/json","text/plain"],this.parserRegExpList=[],this.cache=new Eoe(100)}Xa.prototype.add=function(t,e,r){let n=typeof t=="string";if(n){if(t=t.trim().toLowerCase(),t.length===0)throw new e9e}else if(!(t instanceof RegExp))throw new IR;if(typeof r!="function")throw new r9e;if(this.existingParser(t))throw new t9e(t);if(e.parseAs!==void 0&&e.parseAs!=="string"&&e.parseAs!=="buffer")throw new n9e(e.parseAs);let i=new OF(e.parseAs==="string",e.parseAs==="buffer",e.bodyLimit,r);if(t==="*")this.customParsers.set("",i);else if(n){let s=new wE(t);if(s.isValid===!1)throw new IR;let o=s.toString();this.parserList.unshift(o),this.customParsers.set(o,i)}else h9e(t),this.parserRegExpList.unshift(t),this.customParsers.set(t.toString(),i)};Xa.prototype.hasParser=function(t){if(typeof t=="string")t=new wE(t).toString();else{if(!(t instanceof RegExp))throw new IR;t=t.toString()}return this.customParsers.has(t)};Xa.prototype.existingParser=function(t){if(typeof t=="string"){let e=new wE(t).toString();if(t==="application/json"&&this.customParsers.has(t))return this.customParsers.get(e).fn!==this[TE];if(t==="text/plain"&&this.customParsers.has(t))return this.customParsers.get(e).fn!==NF}return this.hasParser(t)};Xa.prototype.getParser=function(t){typeof t=="string"&&(t=new wE(t));let e=t.toString(),r=this.cache.get(e);if(r!==void 0)return r;if(r=this.customParsers.get(e),r!==void 0)return this.cache.set(e,r),r;if(r=this.customParsers.get(t.mediaType),r!==void 0)return r;for(let n=0;n!==this.parserRegExpList.length;++n){let i=this.parserRegExpList[n];if(i.test(e))return r=this.customParsers.get(i.toString()),this.cache.set(e,r),r}return this.customParsers.get("")};Xa.prototype.removeAll=function(){this.customParsers=new Map,this.parserRegExpList=[],this.parserList=[],this.cache=new Eoe(100)};Xa.prototype.remove=function(t){let e;if(typeof t=="string")t=new wE(t).toString(),e=this.parserList;else{if(!(t instanceof RegExp))throw new IR;t=t.toString(),e=this.parserRegExpList}let r=this.customParsers.delete(t),n=e.findIndex(i=>i.toString()===t);return n>-1&&e.splice(n,1),r||n>-1};Xa.prototype.run=function(t,e,r,n){let i=this.getParser(t);if(i===void 0){if(r.is404===!0){e(r,n);return}n[yoe]=!0,n.send(new i9e);return}let s=new K8e("content-type-parser:run",r),o=s.bind(c);if(i.asString===!0||i.asBuffer===!0){boe(r,n,n[Q8e]._parserOptions,i,o);return}let a=i.fn(r,r[voe],o);a&&typeof a.then=="function"&&a.then(l=>{o(null,l)},o);function c(l,u){if(s.emitDestroy(),l!=null){n.header("connection","close"),n[yoe]=!0,n.send(l);return}r.body=u,e(r,n)}};function boe(t,e,r,n,i){let s=n.asString===!0,o=r.limit===null?n.bodyLimit:r.limit,a=Number(t.headers["content-length"]);if(a>o){i(new Soe,void 0);return}let c=0,l=s?"":[],u=t[voe]||t.raw;s&&u.setEncoding("utf8"),u.on("data",d),u.on("end",f),u.on("error",f),u.resume();function d(p){c+=s?Buffer.byteLength(p):p.length;let{receivedEncodedLength:h=0}=u;if(c>o||h>o){u.removeListener("data",d),u.removeListener("end",f),u.removeListener("error",f),i(new Soe,void 0);return}s?l+=p:l.push(p)}function f(p){if(u.removeListener("data",d),u.removeListener("end",f),u.removeListener("error",f),p!=null){typeof p.statusCode=="number"&&p.statusCode>=400||(p.statusCode=400),i(p,void 0);return}if(!Number.isNaN(a)&&(u.receivedEncodedLength||c)!==a){i(new s9e,void 0);return}s||(l=Buffer.concat(l));let h=n.fn(t,l,i);h&&typeof h.then=="function"&&h.then(m=>{i(null,m)},i)}}function Toe(t,e){let r={protoAction:t,constructorAction:e};return n;function n(i,s,o){if(s.length===0){o(new o9e,void 0);return}try{o(null,J8e(s,r))}catch{o(new a9e,void 0)}}}function NF(t,e,r){r(null,e)}function OF(t,e,r,n){this.asString=t,this.asBuffer=e,this.bodyLimit=r,this.fn=n}function l9e(t){let e=new Xa;return e[TE]=t[TE],e.customParsers=new Map(t.customParsers.entries()),e.parserList=t.parserList.slice(),e.parserRegExpList=t.parserRegExpList.slice(),e}function u9e(t,e,r){if(this[PF].started)throw new CF("addContentTypeParser");return typeof e=="function"&&(r=e,e={}),e||(e={}),e.bodyLimit||(e.bodyLimit=this[Z8e]),Array.isArray(t)?t.forEach(n=>this[Fh].add(n,e,r)):this[Fh].add(t,e,r),this}function d9e(t){return this[Fh].hasParser(t)}function f9e(t){if(this[PF].started)throw new CF("removeContentTypeParser");if(Array.isArray(t))for(let e of t)this[Fh].remove(e);else this[Fh].remove(t)}function p9e(){if(this[PF].started)throw new CF("removeAllContentTypeParsers");this[Fh].removeAll()}function h9e(t){t.source[0]!=="^"&&t.source.includes(";?")===!1&&c9e(t.source)}AE.exports=Xa;AE.exports.helpers={buildContentTypeParser:l9e,addContentTypeParser:u9e,hasContentTypeParser:d9e,removeContentTypeParser:f9e,removeAllContentTypeParsers:p9e};AE.exports.defaultParsers={getDefaultJsonParser:Toe,defaultTextParser:NF};AE.exports[X8e]={rawBody:boe}});var jh=E(yt=>{"use strict";Object.defineProperty(yt,"__esModule",{value:!0});yt.regexpCode=yt.getEsmExportName=yt.getProperty=yt.safeStringify=yt.stringify=yt.strConcat=yt.addCodeArg=yt.str=yt._=yt.nil=yt._Code=yt.Name=yt.IDENTIFIER=yt._CodeOrName=void 0;var RE=class{};yt._CodeOrName=RE;yt.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var Zd=class extends RE{constructor(e){if(super(),!yt.IDENTIFIER.test(e))throw new Error("CodeGen: name must be a valid identifier");this.str=e}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};yt.Name=Zd;var as=class extends RE{constructor(e){super(),this._items=typeof e=="string"?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let e=this._items[0];return e===""||e==='""'}get str(){var e;return(e=this._str)!==null&&e!==void 0?e:this._str=this._items.reduce((r,n)=>`${r}${n}`,"")}get names(){var e;return(e=this._names)!==null&&e!==void 0?e:this._names=this._items.reduce((r,n)=>(n instanceof Zd&&(r[n.str]=(r[n.str]||0)+1),r),{})}};yt._Code=as;yt.nil=new as("");function woe(t,...e){let r=[t[0]],n=0;for(;n<e.length;)LF(r,e[n]),r.push(t[++n]);return new as(r)}yt._=woe;var $F=new as("+");function Aoe(t,...e){let r=[xE(t[0])],n=0;for(;n<e.length;)r.push($F),LF(r,e[n]),r.push($F,xE(t[++n]));return m9e(r),new as(r)}yt.str=Aoe;function LF(t,e){e instanceof as?t.push(...e._items):e instanceof Zd?t.push(e):t.push(y9e(e))}yt.addCodeArg=LF;function m9e(t){let e=1;for(;e<t.length-1;){if(t[e]===$F){let r=g9e(t[e-1],t[e+1]);if(r!==void 0){t.splice(e-1,3,r);continue}t[e++]="+"}e++}}function g9e(t,e){if(e==='""')return t;if(t==='""')return e;if(typeof t=="string")return e instanceof Zd||t[t.length-1]!=='"'?void 0:typeof e!="string"?`${t.slice(0,-1)}${e}"`:e[0]==='"'?t.slice(0,-1)+e.slice(1):void 0;if(typeof e=="string"&&e[0]==='"'&&!(t instanceof Zd))return`"${t}${e.slice(1)}`}function _9e(t,e){return e.emptyStr()?t:t.emptyStr()?e:Aoe`${t}${e}`}yt.strConcat=_9e;function y9e(t){return typeof t=="number"||typeof t=="boolean"||t===null?t:xE(Array.isArray(t)?t.join(","):t)}function S9e(t){return new as(xE(t))}yt.stringify=S9e;function xE(t){return JSON.stringify(t).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}yt.safeStringify=xE;function E9e(t){return typeof t=="string"&&yt.IDENTIFIER.test(t)?new as(`.${t}`):woe`[${t}]`}yt.getProperty=E9e;function v9e(t){if(typeof t=="string"&&yt.IDENTIFIER.test(t))return new as(`${t}`);throw new Error(`CodeGen: invalid export name: ${t}, use explicit $id name mapping`)}yt.getEsmExportName=v9e;function b9e(t){return new as(t.toString())}yt.regexpCode=b9e});var NR=E(ui=>{"use strict";Object.defineProperty(ui,"__esModule",{value:!0});ui.ValueScope=ui.ValueScopeName=ui.Scope=ui.varKinds=ui.UsedValueState=void 0;var li=jh(),DF=class extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}},OR;(function(t){t[t.Started=0]="Started",t[t.Completed=1]="Completed"})(OR||(ui.UsedValueState=OR={}));ui.varKinds={const:new li.Name("const"),let:new li.Name("let"),var:new li.Name("var")};var PR=class{constructor({prefixes:e,parent:r}={}){this._names={},this._prefixes=e,this._parent=r}toName(e){return e instanceof li.Name?e:this.name(e)}name(e){return new li.Name(this._newName(e))}_newName(e){let r=this._names[e]||this._nameGroup(e);return`${e}${r.index++}`}_nameGroup(e){var r,n;if(!((n=(r=this._parent)===null||r===void 0?void 0:r._prefixes)===null||n===void 0)&&n.has(e)||this._prefixes&&!this._prefixes.has(e))throw new Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}};ui.Scope=PR;var CR=class extends li.Name{constructor(e,r){super(r),this.prefix=e}setValue(e,{property:r,itemIndex:n}){this.value=e,this.scopePath=(0,li._)`.${new li.Name(r)}[${n}]`}};ui.ValueScopeName=CR;var T9e=(0,li._)`\n`,MF=class extends PR{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?T9e:li.nil}}get(){return this._scope}name(e){return new CR(e,this._newName(e))}value(e,r){var n;if(r.ref===void 0)throw new Error("CodeGen: ref must be passed in value");let i=this.toName(e),{prefix:s}=i,o=(n=r.key)!==null&&n!==void 0?n:r.ref,a=this._values[s];if(a){let u=a.get(o);if(u)return u}else a=this._values[s]=new Map;a.set(o,i);let c=this._scope[s]||(this._scope[s]=[]),l=c.length;return c[l]=r.ref,i.setValue(r,{property:s,itemIndex:l}),i}getValue(e,r){let n=this._values[e];if(n)return n.get(r)}scopeRefs(e,r=this._values){return this._reduceValues(r,n=>{if(n.scopePath===void 0)throw new Error(`CodeGen: name "${n}" has no value`);return(0,li._)`${e}${n.scopePath}`})}scopeCode(e=this._values,r,n){return this._reduceValues(e,i=>{if(i.value===void 0)throw new Error(`CodeGen: name "${i}" has no value`);return i.value.code},r,n)}_reduceValues(e,r,n={},i){let s=li.nil;for(let o in e){let a=e[o];if(!a)continue;let c=n[o]=n[o]||new Map;a.forEach(l=>{if(c.has(l))return;c.set(l,OR.Started);let u=r(l);if(u){let d=this.opts.es5?ui.varKinds.var:ui.varKinds.const;s=(0,li._)`${s}${d} ${l} = ${u};${this.opts._n}`}else if(u=i?.(l))s=(0,li._)`${s}${u}${this.opts._n}`;else throw new DF(l);c.set(l,OR.Completed)})}return s}};ui.ValueScope=MF});var Fe=E(rt=>{"use strict";Object.defineProperty(rt,"__esModule",{value:!0});rt.or=rt.and=rt.not=rt.CodeGen=rt.operators=rt.varKinds=rt.ValueScopeName=rt.ValueScope=rt.Scope=rt.Name=rt.regexpCode=rt.stringify=rt.getProperty=rt.nil=rt.strConcat=rt.str=rt._=void 0;var ft=jh(),Ws=NR(),$l=jh();Object.defineProperty(rt,"_",{enumerable:!0,get:function(){return $l._}});Object.defineProperty(rt,"str",{enumerable:!0,get:function(){return $l.str}});Object.defineProperty(rt,"strConcat",{enumerable:!0,get:function(){return $l.strConcat}});Object.defineProperty(rt,"nil",{enumerable:!0,get:function(){return $l.nil}});Object.defineProperty(rt,"getProperty",{enumerable:!0,get:function(){return $l.getProperty}});Object.defineProperty(rt,"stringify",{enumerable:!0,get:function(){return $l.stringify}});Object.defineProperty(rt,"regexpCode",{enumerable:!0,get:function(){return $l.regexpCode}});Object.defineProperty(rt,"Name",{enumerable:!0,get:function(){return $l.Name}});var DR=NR();Object.defineProperty(rt,"Scope",{enumerable:!0,get:function(){return DR.Scope}});Object.defineProperty(rt,"ValueScope",{enumerable:!0,get:function(){return DR.ValueScope}});Object.defineProperty(rt,"ValueScopeName",{enumerable:!0,get:function(){return DR.ValueScopeName}});Object.defineProperty(rt,"varKinds",{enumerable:!0,get:function(){return DR.varKinds}});rt.operators={GT:new ft._Code(">"),GTE:new ft._Code(">="),LT:new ft._Code("<"),LTE:new ft._Code("<="),EQ:new ft._Code("==="),NEQ:new ft._Code("!=="),NOT:new ft._Code("!"),OR:new ft._Code("||"),AND:new ft._Code("&&"),ADD:new ft._Code("+")};var Qa=class{optimizeNodes(){return this}optimizeNames(e,r){return this}},UF=class extends Qa{constructor(e,r,n){super(),this.varKind=e,this.name=r,this.rhs=n}render({es5:e,_n:r}){let n=e?Ws.varKinds.var:this.varKind,i=this.rhs===void 0?"":` = ${this.rhs}`;return`${n} ${this.name}${i};`+r}optimizeNames(e,r){if(e[this.name.str])return this.rhs&&(this.rhs=Bh(this.rhs,e,r)),this}get names(){return this.rhs instanceof ft._CodeOrName?this.rhs.names:{}}},kR=class extends Qa{constructor(e,r,n){super(),this.lhs=e,this.rhs=r,this.sideEffects=n}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,r){if(!(this.lhs instanceof ft.Name&&!e[this.lhs.str]&&!this.sideEffects))return this.rhs=Bh(this.rhs,e,r),this}get names(){let e=this.lhs instanceof ft.Name?{}:{...this.lhs.names};return LR(e,this.rhs)}},FF=class extends kR{constructor(e,r,n,i){super(e,n,i),this.op=r}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}},jF=class extends Qa{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}},qF=class extends Qa{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}},BF=class extends Qa{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}},zF=class extends Qa{constructor(e){super(),this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,r){return this.code=Bh(this.code,e,r),this}get names(){return this.code instanceof ft._CodeOrName?this.code.names:{}}},IE=class extends Qa{constructor(e=[]){super(),this.nodes=e}render(e){return this.nodes.reduce((r,n)=>r+n.render(e),"")}optimizeNodes(){let{nodes:e}=this,r=e.length;for(;r--;){let n=e[r].optimizeNodes();Array.isArray(n)?e.splice(r,1,...n):n?e[r]=n:e.splice(r,1)}return e.length>0?this:void 0}optimizeNames(e,r){let{nodes:n}=this,i=n.length;for(;i--;){let s=n[i];s.optimizeNames(e,r)||(w9e(e,s.names),n.splice(i,1))}return n.length>0?this:void 0}get names(){return this.nodes.reduce((e,r)=>ef(e,r.names),{})}},ec=class extends IE{render(e){return"{"+e._n+super.render(e)+"}"+e._n}},VF=class extends IE{},qh=class extends ec{};qh.kind="else";var Xd=class t extends ec{constructor(e,r){super(r),this.condition=e}render(e){let r=`if(${this.condition})`+super.render(e);return this.else&&(r+="else "+this.else.render(e)),r}optimizeNodes(){super.optimizeNodes();let e=this.condition;if(e===!0)return this.nodes;let r=this.else;if(r){let n=r.optimizeNodes();r=this.else=Array.isArray(n)?new qh(n):n}if(r)return e===!1?r instanceof t?r:r.nodes:this.nodes.length?this:new t(Roe(e),r instanceof t?[r]:r.nodes);if(!(e===!1||!this.nodes.length))return this}optimizeNames(e,r){var n;if(this.else=(n=this.else)===null||n===void 0?void 0:n.optimizeNames(e,r),!!(super.optimizeNames(e,r)||this.else))return this.condition=Bh(this.condition,e,r),this}get names(){let e=super.names;return LR(e,this.condition),this.else&&ef(e,this.else.names),e}};Xd.kind="if";var Qd=class extends ec{};Qd.kind="for";var HF=class extends Qd{constructor(e){super(),this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,r){if(super.optimizeNames(e,r))return this.iteration=Bh(this.iteration,e,r),this}get names(){return ef(super.names,this.iteration.names)}},GF=class extends Qd{constructor(e,r,n,i){super(),this.varKind=e,this.name=r,this.from=n,this.to=i}render(e){let r=e.es5?Ws.varKinds.var:this.varKind,{name:n,from:i,to:s}=this;return`for(${r} ${n}=${i}; ${n}<${s}; ${n}++)`+super.render(e)}get names(){let e=LR(super.names,this.from);return LR(e,this.to)}},$R=class extends Qd{constructor(e,r,n,i){super(),this.loop=e,this.varKind=r,this.name=n,this.iterable=i}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,r){if(super.optimizeNames(e,r))return this.iterable=Bh(this.iterable,e,r),this}get names(){return ef(super.names,this.iterable.names)}},OE=class extends ec{constructor(e,r,n){super(),this.name=e,this.args=r,this.async=n}render(e){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(e)}};OE.kind="func";var PE=class extends IE{render(e){return"return "+super.render(e)}};PE.kind="return";var WF=class extends ec{render(e){let r="try"+super.render(e);return this.catch&&(r+=this.catch.render(e)),this.finally&&(r+=this.finally.render(e)),r}optimizeNodes(){var e,r;return super.optimizeNodes(),(e=this.catch)===null||e===void 0||e.optimizeNodes(),(r=this.finally)===null||r===void 0||r.optimizeNodes(),this}optimizeNames(e,r){var n,i;return super.optimizeNames(e,r),(n=this.catch)===null||n===void 0||n.optimizeNames(e,r),(i=this.finally)===null||i===void 0||i.optimizeNames(e,r),this}get names(){let e=super.names;return this.catch&&ef(e,this.catch.names),this.finally&&ef(e,this.finally.names),e}},CE=class extends ec{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}};CE.kind="catch";var NE=class extends ec{render(e){return"finally"+super.render(e)}};NE.kind="finally";var YF=class{constructor(e,r={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...r,_n:r.lines?`
28
28
  `:""},this._extScope=e,this._scope=new Ws.Scope({parent:e}),this._nodes=[new VF]}toString(){return this._root.render(this.opts)}name(e){return this._scope.name(e)}scopeName(e){return this._extScope.name(e)}scopeValue(e,r){let n=this._extScope.value(e,r);return(this._values[n.prefix]||(this._values[n.prefix]=new Set)).add(n),n}getScopeValue(e,r){return this._extScope.getValue(e,r)}scopeRefs(e){return this._extScope.scopeRefs(e,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(e,r,n,i){let s=this._scope.toName(r);return n!==void 0&&i&&(this._constants[s.str]=n),this._leafNode(new UF(e,s,n)),s}const(e,r,n){return this._def(Ws.varKinds.const,e,r,n)}let(e,r,n){return this._def(Ws.varKinds.let,e,r,n)}var(e,r,n){return this._def(Ws.varKinds.var,e,r,n)}assign(e,r,n){return this._leafNode(new kR(e,r,n))}add(e,r){return this._leafNode(new FF(e,rt.operators.ADD,r))}code(e){return typeof e=="function"?e():e!==ft.nil&&this._leafNode(new zF(e)),this}object(...e){let r=["{"];for(let[n,i]of e)r.length>1&&r.push(","),r.push(n),(n!==i||this.opts.es5)&&(r.push(":"),(0,ft.addCodeArg)(r,i));return r.push("}"),new ft._Code(r)}if(e,r,n){if(this._blockNode(new Xd(e)),r&&n)this.code(r).else().code(n).endIf();else if(r)this.code(r).endIf();else if(n)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(e){return this._elseNode(new Xd(e))}else(){return this._elseNode(new qh)}endIf(){return this._endBlockNode(Xd,qh)}_for(e,r){return this._blockNode(e),r&&this.code(r).endFor(),this}for(e,r){return this._for(new HF(e),r)}forRange(e,r,n,i,s=this.opts.es5?Ws.varKinds.var:Ws.varKinds.let){let o=this._scope.toName(e);return this._for(new GF(s,o,r,n),()=>i(o))}forOf(e,r,n,i=Ws.varKinds.const){let s=this._scope.toName(e);if(this.opts.es5){let o=r instanceof ft.Name?r:this.var("_arr",r);return this.forRange("_i",0,(0,ft._)`${o}.length`,a=>{this.var(s,(0,ft._)`${o}[${a}]`),n(s)})}return this._for(new $R("of",i,s,r),()=>n(s))}forIn(e,r,n,i=this.opts.es5?Ws.varKinds.var:Ws.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,(0,ft._)`Object.keys(${r})`,n);let s=this._scope.toName(e);return this._for(new $R("in",i,s,r),()=>n(s))}endFor(){return this._endBlockNode(Qd)}label(e){return this._leafNode(new jF(e))}break(e){return this._leafNode(new qF(e))}return(e){let r=new PE;if(this._blockNode(r),this.code(e),r.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(PE)}try(e,r,n){if(!r&&!n)throw new Error('CodeGen: "try" without "catch" and "finally"');let i=new WF;if(this._blockNode(i),this.code(e),r){let s=this.name("e");this._currNode=i.catch=new CE(s),r(s)}return n&&(this._currNode=i.finally=new NE,this.code(n)),this._endBlockNode(CE,NE)}throw(e){return this._leafNode(new BF(e))}block(e,r){return this._blockStarts.push(this._nodes.length),e&&this.code(e).endBlock(r),this}endBlock(e){let r=this._blockStarts.pop();if(r===void 0)throw new Error("CodeGen: not in self-balancing block");let n=this._nodes.length-r;if(n<0||e!==void 0&&n!==e)throw new Error(`CodeGen: wrong number of nodes: ${n} vs ${e} expected`);return this._nodes.length=r,this}func(e,r=ft.nil,n,i){return this._blockNode(new OE(e,r,n)),i&&this.code(i).endFunc(),this}endFunc(){return this._endBlockNode(OE)}optimize(e=1){for(;e-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(e){return this._currNode.nodes.push(e),this}_blockNode(e){this._currNode.nodes.push(e),this._nodes.push(e)}_endBlockNode(e,r){let n=this._currNode;if(n instanceof e||r&&n instanceof r)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${r?`${e.kind}/${r.kind}`:e.kind}"`)}_elseNode(e){let r=this._currNode;if(!(r instanceof Xd))throw new Error('CodeGen: "else" without "if"');return this._currNode=r.else=e,this}get _root(){return this._nodes[0]}get _currNode(){let e=this._nodes;return e[e.length-1]}set _currNode(e){let r=this._nodes;r[r.length-1]=e}};rt.CodeGen=YF;function ef(t,e){for(let r in e)t[r]=(t[r]||0)+(e[r]||0);return t}function LR(t,e){return e instanceof ft._CodeOrName?ef(t,e.names):t}function Bh(t,e,r){if(t instanceof ft.Name)return n(t);if(!i(t))return t;return new ft._Code(t._items.reduce((s,o)=>(o instanceof ft.Name&&(o=n(o)),o instanceof ft._Code?s.push(...o._items):s.push(o),s),[]));function n(s){let o=r[s.str];return o===void 0||e[s.str]!==1?s:(delete e[s.str],o)}function i(s){return s instanceof ft._Code&&s._items.some(o=>o instanceof ft.Name&&e[o.str]===1&&r[o.str]!==void 0)}}function w9e(t,e){for(let r in e)t[r]=(t[r]||0)-(e[r]||0)}function Roe(t){return typeof t=="boolean"||typeof t=="number"||t===null?!t:(0,ft._)`!${KF(t)}`}rt.not=Roe;var A9e=xoe(rt.operators.AND);function R9e(...t){return t.reduce(A9e)}rt.and=R9e;var x9e=xoe(rt.operators.OR);function I9e(...t){return t.reduce(x9e)}rt.or=I9e;function xoe(t){return(e,r)=>e===ft.nil?r:r===ft.nil?e:(0,ft._)`${KF(e)} ${t} ${KF(r)}`}function KF(t){return t instanceof ft.Name?t:(0,ft._)`(${t})`}});var Xe=E(ot=>{"use strict";Object.defineProperty(ot,"__esModule",{value:!0});ot.checkStrictMode=ot.getErrorPath=ot.Type=ot.useFunc=ot.setEvaluated=ot.evaluatedPropsToName=ot.mergeEvaluated=ot.eachItem=ot.unescapeJsonPointer=ot.escapeJsonPointer=ot.escapeFragment=ot.unescapeFragment=ot.schemaRefOrVal=ot.schemaHasRulesButRef=ot.schemaHasRules=ot.checkUnknownRules=ot.alwaysValidSchema=ot.toHash=void 0;var Ut=Fe(),O9e=jh();function P9e(t){let e={};for(let r of t)e[r]=!0;return e}ot.toHash=P9e;function C9e(t,e){return typeof e=="boolean"?e:Object.keys(e).length===0?!0:(Poe(t,e),!Coe(e,t.self.RULES.all))}ot.alwaysValidSchema=C9e;function Poe(t,e=t.schema){let{opts:r,self:n}=t;if(!r.strictSchema||typeof e=="boolean")return;let i=n.RULES.keywords;for(let s in e)i[s]||$oe(t,`unknown keyword: "${s}"`)}ot.checkUnknownRules=Poe;function Coe(t,e){if(typeof t=="boolean")return!t;for(let r in t)if(e[r])return!0;return!1}ot.schemaHasRules=Coe;function N9e(t,e){if(typeof t=="boolean")return!t;for(let r in t)if(r!=="$ref"&&e.all[r])return!0;return!1}ot.schemaHasRulesButRef=N9e;function k9e({topSchemaRef:t,schemaPath:e},r,n,i){if(!i){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return(0,Ut._)`${r}`}return(0,Ut._)`${t}${e}${(0,Ut.getProperty)(n)}`}ot.schemaRefOrVal=k9e;function $9e(t){return Noe(decodeURIComponent(t))}ot.unescapeFragment=$9e;function L9e(t){return encodeURIComponent(ZF(t))}ot.escapeFragment=L9e;function ZF(t){return typeof t=="number"?`${t}`:t.replace(/~/g,"~0").replace(/\//g,"~1")}ot.escapeJsonPointer=ZF;function Noe(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}ot.unescapeJsonPointer=Noe;function D9e(t,e){if(Array.isArray(t))for(let r of t)e(r);else e(t)}ot.eachItem=D9e;function Ioe({mergeNames:t,mergeToName:e,mergeValues:r,resultToName:n}){return(i,s,o,a)=>{let c=o===void 0?s:o instanceof Ut.Name?(s instanceof Ut.Name?t(i,s,o):e(i,s,o),o):s instanceof Ut.Name?(e(i,o,s),s):r(s,o);return a===Ut.Name&&!(c instanceof Ut.Name)?n(i,c):c}}ot.mergeEvaluated={props:Ioe({mergeNames:(t,e,r)=>t.if((0,Ut._)`${r} !== true && ${e} !== undefined`,()=>{t.if((0,Ut._)`${e} === true`,()=>t.assign(r,!0),()=>t.assign(r,(0,Ut._)`${r} || {}`).code((0,Ut._)`Object.assign(${r}, ${e})`))}),mergeToName:(t,e,r)=>t.if((0,Ut._)`${r} !== true`,()=>{e===!0?t.assign(r,!0):(t.assign(r,(0,Ut._)`${r} || {}`),XF(t,r,e))}),mergeValues:(t,e)=>t===!0?!0:{...t,...e},resultToName:koe}),items:Ioe({mergeNames:(t,e,r)=>t.if((0,Ut._)`${r} !== true && ${e} !== undefined`,()=>t.assign(r,(0,Ut._)`${e} === true ? true : ${r} > ${e} ? ${r} : ${e}`)),mergeToName:(t,e,r)=>t.if((0,Ut._)`${r} !== true`,()=>t.assign(r,e===!0?!0:(0,Ut._)`${r} > ${e} ? ${r} : ${e}`)),mergeValues:(t,e)=>t===!0?!0:Math.max(t,e),resultToName:(t,e)=>t.var("items",e)})};function koe(t,e){if(e===!0)return t.var("props",!0);let r=t.var("props",(0,Ut._)`{}`);return e!==void 0&&XF(t,r,e),r}ot.evaluatedPropsToName=koe;function XF(t,e,r){Object.keys(r).forEach(n=>t.assign((0,Ut._)`${e}${(0,Ut.getProperty)(n)}`,!0))}ot.setEvaluated=XF;var Ooe={};function M9e(t,e){return t.scopeValue("func",{ref:e,code:Ooe[e.code]||(Ooe[e.code]=new O9e._Code(e.code))})}ot.useFunc=M9e;var JF;(function(t){t[t.Num=0]="Num",t[t.Str=1]="Str"})(JF||(ot.Type=JF={}));function U9e(t,e,r){if(t instanceof Ut.Name){let n=e===JF.Num;return r?n?(0,Ut._)`"[" + ${t} + "]"`:(0,Ut._)`"['" + ${t} + "']"`:n?(0,Ut._)`"/" + ${t}`:(0,Ut._)`"/" + ${t}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,Ut.getProperty)(t).toString():"/"+ZF(t)}ot.getErrorPath=U9e;function $oe(t,e,r=t.opts.strictSchema){if(r){if(e=`strict mode: ${e}`,r===!0)throw new Error(e);t.self.logger.warn(e)}}ot.checkStrictMode=$oe});var cs=E(QF=>{"use strict";Object.defineProperty(QF,"__esModule",{value:!0});var wn=Fe(),F9e={data:new wn.Name("data"),valCxt:new wn.Name("valCxt"),instancePath:new wn.Name("instancePath"),parentData:new wn.Name("parentData"),parentDataProperty:new wn.Name("parentDataProperty"),rootData:new wn.Name("rootData"),dynamicAnchors:new wn.Name("dynamicAnchors"),vErrors:new wn.Name("vErrors"),errors:new wn.Name("errors"),this:new wn.Name("this"),self:new wn.Name("self"),scope:new wn.Name("scope"),json:new wn.Name("json"),jsonPos:new wn.Name("jsonPos"),jsonLen:new wn.Name("jsonLen"),jsonPart:new wn.Name("jsonPart")};QF.default=F9e});var kE=E(An=>{"use strict";Object.defineProperty(An,"__esModule",{value:!0});An.extendErrors=An.resetErrorsCount=An.reportExtraError=An.reportError=An.keyword$DataError=An.keywordError=void 0;var ht=Fe(),MR=Xe(),zn=cs();An.keywordError={message:({keyword:t})=>(0,ht.str)`must pass "${t}" keyword validation`};An.keyword$DataError={message:({keyword:t,schemaType:e})=>e?(0,ht.str)`"${t}" keyword must be ${e} ($data)`:(0,ht.str)`"${t}" keyword is invalid ($data)`};function j9e(t,e=An.keywordError,r,n){let{it:i}=t,{gen:s,compositeRule:o,allErrors:a}=i,c=Moe(t,e,r);n??(o||a)?Loe(s,c):Doe(i,(0,ht._)`[${c}]`)}An.reportError=j9e;function q9e(t,e=An.keywordError,r){let{it:n}=t,{gen:i,compositeRule:s,allErrors:o}=n,a=Moe(t,e,r);Loe(i,a),s||o||Doe(n,zn.default.vErrors)}An.reportExtraError=q9e;function B9e(t,e){t.assign(zn.default.errors,e),t.if((0,ht._)`${zn.default.vErrors} !== null`,()=>t.if(e,()=>t.assign((0,ht._)`${zn.default.vErrors}.length`,e),()=>t.assign(zn.default.vErrors,null)))}An.resetErrorsCount=B9e;function z9e({gen:t,keyword:e,schemaValue:r,data:n,errsCount:i,it:s}){if(i===void 0)throw new Error("ajv implementation error");let o=t.name("err");t.forRange("i",i,zn.default.errors,a=>{t.const(o,(0,ht._)`${zn.default.vErrors}[${a}]`),t.if((0,ht._)`${o}.instancePath === undefined`,()=>t.assign((0,ht._)`${o}.instancePath`,(0,ht.strConcat)(zn.default.instancePath,s.errorPath))),t.assign((0,ht._)`${o}.schemaPath`,(0,ht.str)`${s.errSchemaPath}/${e}`),s.opts.verbose&&(t.assign((0,ht._)`${o}.schema`,r),t.assign((0,ht._)`${o}.data`,n))})}An.extendErrors=z9e;function Loe(t,e){let r=t.const("err",e);t.if((0,ht._)`${zn.default.vErrors} === null`,()=>t.assign(zn.default.vErrors,(0,ht._)`[${r}]`),(0,ht._)`${zn.default.vErrors}.push(${r})`),t.code((0,ht._)`${zn.default.errors}++`)}function Doe(t,e){let{gen:r,validateName:n,schemaEnv:i}=t;i.$async?r.throw((0,ht._)`new ${t.ValidationError}(${e})`):(r.assign((0,ht._)`${n}.errors`,e),r.return(!1))}var tf={keyword:new ht.Name("keyword"),schemaPath:new ht.Name("schemaPath"),params:new ht.Name("params"),propertyName:new ht.Name("propertyName"),message:new ht.Name("message"),schema:new ht.Name("schema"),parentSchema:new ht.Name("parentSchema")};function Moe(t,e,r){let{createErrors:n}=t.it;return n===!1?(0,ht._)`{}`:V9e(t,e,r)}function V9e(t,e,r={}){let{gen:n,it:i}=t,s=[H9e(i,r),G9e(t,r)];return W9e(t,e,s),n.object(...s)}function H9e({errorPath:t},{instancePath:e}){let r=e?(0,ht.str)`${t}${(0,MR.getErrorPath)(e,MR.Type.Str)}`:t;return[zn.default.instancePath,(0,ht.strConcat)(zn.default.instancePath,r)]}function G9e({keyword:t,it:{errSchemaPath:e}},{schemaPath:r,parentSchema:n}){let i=n?e:(0,ht.str)`${e}/${t}`;return r&&(i=(0,ht.str)`${i}${(0,MR.getErrorPath)(r,MR.Type.Str)}`),[tf.schemaPath,i]}function W9e(t,{params:e,message:r},n){let{keyword:i,data:s,schemaValue:o,it:a}=t,{opts:c,propertyName:l,topSchemaRef:u,schemaPath:d}=a;n.push([tf.keyword,i],[tf.params,typeof e=="function"?e(t):e||(0,ht._)`{}`]),c.messages&&n.push([tf.message,typeof r=="function"?r(t):r]),c.verbose&&n.push([tf.schema,o],[tf.parentSchema,(0,ht._)`${u}${d}`],[zn.default.data,s]),l&&n.push([tf.propertyName,l])}});var Foe=E(zh=>{"use strict";Object.defineProperty(zh,"__esModule",{value:!0});zh.boolOrEmptySchema=zh.topBoolOrEmptySchema=void 0;var Y9e=kE(),K9e=Fe(),J9e=cs(),Z9e={message:"boolean schema is false"};function X9e(t){let{gen:e,schema:r,validateName:n}=t;r===!1?Uoe(t,!1):typeof r=="object"&&r.$async===!0?e.return(J9e.default.data):(e.assign((0,K9e._)`${n}.errors`,null),e.return(!0))}zh.topBoolOrEmptySchema=X9e;function Q9e(t,e){let{gen:r,schema:n}=t;n===!1?(r.var(e,!1),Uoe(t)):r.var(e,!0)}zh.boolOrEmptySchema=Q9e;function Uoe(t,e){let{gen:r,data:n}=t,i={gen:r,keyword:"false schema",data:n,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:t};(0,Y9e.reportError)(i,Z9e,void 0,e)}});var ej=E(Vh=>{"use strict";Object.defineProperty(Vh,"__esModule",{value:!0});Vh.getRules=Vh.isJSONType=void 0;var eJe=["string","number","integer","boolean","null","object","array"],tJe=new Set(eJe);function rJe(t){return typeof t=="string"&&tJe.has(t)}Vh.isJSONType=rJe;function nJe(){let t={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...t,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},t.number,t.string,t.array,t.object],post:{rules:[]},all:{},keywords:{}}}Vh.getRules=nJe});var tj=E(Ll=>{"use strict";Object.defineProperty(Ll,"__esModule",{value:!0});Ll.shouldUseRule=Ll.shouldUseGroup=Ll.schemaHasRulesForType=void 0;function iJe({schema:t,self:e},r){let n=e.RULES.types[r];return n&&n!==!0&&joe(t,n)}Ll.schemaHasRulesForType=iJe;function joe(t,e){return e.rules.some(r=>qoe(t,r))}Ll.shouldUseGroup=joe;function qoe(t,e){var r;return t[e.keyword]!==void 0||((r=e.definition.implements)===null||r===void 0?void 0:r.some(n=>t[n]!==void 0))}Ll.shouldUseRule=qoe});var $E=E(Rn=>{"use strict";Object.defineProperty(Rn,"__esModule",{value:!0});Rn.reportTypeError=Rn.checkDataTypes=Rn.checkDataType=Rn.coerceAndCheckDataType=Rn.getJSONTypes=Rn.getSchemaTypes=Rn.DataType=void 0;var sJe=ej(),oJe=tj(),aJe=kE(),Qe=Fe(),Boe=Xe(),Hh;(function(t){t[t.Correct=0]="Correct",t[t.Wrong=1]="Wrong"})(Hh||(Rn.DataType=Hh={}));function cJe(t){let e=zoe(t.type);if(e.includes("null")){if(t.nullable===!1)throw new Error("type: null contradicts nullable: false")}else{if(!e.length&&t.nullable!==void 0)throw new Error('"nullable" cannot be used without "type"');t.nullable===!0&&e.push("null")}return e}Rn.getSchemaTypes=cJe;function zoe(t){let e=Array.isArray(t)?t:t?[t]:[];if(e.every(sJe.isJSONType))return e;throw new Error("type must be JSONType or JSONType[]: "+e.join(","))}Rn.getJSONTypes=zoe;function lJe(t,e){let{gen:r,data:n,opts:i}=t,s=uJe(e,i.coerceTypes),o=e.length>0&&!(s.length===0&&e.length===1&&(0,oJe.schemaHasRulesForType)(t,e[0]));if(o){let a=nj(e,n,i.strictNumbers,Hh.Wrong);r.if(a,()=>{s.length?dJe(t,e,s):ij(t)})}return o}Rn.coerceAndCheckDataType=lJe;var Voe=new Set(["string","number","integer","boolean","null"]);function uJe(t,e){return e?t.filter(r=>Voe.has(r)||e==="array"&&r==="array"):[]}function dJe(t,e,r){let{gen:n,data:i,opts:s}=t,o=n.let("dataType",(0,Qe._)`typeof ${i}`),a=n.let("coerced",(0,Qe._)`undefined`);s.coerceTypes==="array"&&n.if((0,Qe._)`${o} == 'object' && Array.isArray(${i}) && ${i}.length == 1`,()=>n.assign(i,(0,Qe._)`${i}[0]`).assign(o,(0,Qe._)`typeof ${i}`).if(nj(e,i,s.strictNumbers),()=>n.assign(a,i))),n.if((0,Qe._)`${a} !== undefined`);for(let l of r)(Voe.has(l)||l==="array"&&s.coerceTypes==="array")&&c(l);n.else(),ij(t),n.endIf(),n.if((0,Qe._)`${a} !== undefined`,()=>{n.assign(i,a),fJe(t,a)});function c(l){switch(l){case"string":n.elseIf((0,Qe._)`${o} == "number" || ${o} == "boolean"`).assign(a,(0,Qe._)`"" + ${i}`).elseIf((0,Qe._)`${i} === null`).assign(a,(0,Qe._)`""`);return;case"number":n.elseIf((0,Qe._)`${o} == "boolean" || ${i} === null
29
29
  || (${o} == "string" && ${i} && ${i} == +${i})`).assign(a,(0,Qe._)`+${i}`);return;case"integer":n.elseIf((0,Qe._)`${o} === "boolean" || ${i} === null
30
30
  || (${o} === "string" && ${i} && ${i} == +${i} && !(${i} % 1))`).assign(a,(0,Qe._)`+${i}`);return;case"boolean":n.elseIf((0,Qe._)`${i} === "false" || ${i} === 0 || ${i} === null`).assign(a,!1).elseIf((0,Qe._)`${i} === "true" || ${i} === 1`).assign(a,!0);return;case"null":n.elseIf((0,Qe._)`${i} === "" || ${i} === 0 || ${i} === false`),n.assign(a,null);return;case"array":n.elseIf((0,Qe._)`${o} === "string" || ${o} === "number"
@@ -32,7 +32,7 @@ ${v}`),m.pop(),`{${I}}`}case"number":return isFinite(h)?String(h):e?e(h):"null";
32
32
  missingProperty: ${n},
33
33
  depsCount: ${e},
34
34
  deps: ${r}}`};var H7e={keyword:"dependencies",type:"object",schemaType:"object",error:zo.error,code(t){let[e,r]=G7e(t);Ece(t,e),vce(t,r)}};function G7e({schema:t}){let e={},r={};for(let n in t){if(n==="__proto__")continue;let i=Array.isArray(t[n])?e:r;i[n]=t[n]}return[e,r]}function Ece(t,e=t.schema){let{gen:r,data:n,it:i}=t;if(Object.keys(e).length===0)return;let s=r.let("missing");for(let o in e){let a=e[o];if(a.length===0)continue;let c=(0,QE.propertyInData)(r,n,o,i.opts.ownProperties);t.setParams({property:o,depsCount:a.length,deps:a.join(", ")}),i.allErrors?r.if(c,()=>{for(let l of a)(0,QE.checkReportMissingProp)(t,l)}):(r.if((0,Qj._)`${c} && (${(0,QE.checkMissingProp)(t,a,s)})`),(0,QE.reportMissingProp)(t,s),r.else())}}zo.validatePropertyDeps=Ece;function vce(t,e=t.schema){let{gen:r,data:n,keyword:i,it:s}=t,o=r.name("valid");for(let a in e)(0,V7e.alwaysValidSchema)(s,e[a])||(r.if((0,QE.propertyInData)(r,n,a,s.opts.ownProperties),()=>{let c=t.subschema({keyword:i,schemaProp:a},o);t.mergeValidEvaluated(c,o)},()=>r.var(o,!0)),t.ok(o))}zo.validateSchemaDeps=vce;zo.default=H7e});var wce=E(eq=>{"use strict";Object.defineProperty(eq,"__esModule",{value:!0});var Tce=Fe(),W7e=Xe(),Y7e={message:"property name must be valid",params:({params:t})=>(0,Tce._)`{propertyName: ${t.propertyName}}`},K7e={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:Y7e,code(t){let{gen:e,schema:r,data:n,it:i}=t;if((0,W7e.alwaysValidSchema)(i,r))return;let s=e.name("valid");e.forIn("key",n,o=>{t.setParams({propertyName:o}),t.subschema({keyword:"propertyNames",data:o,dataTypes:["string"],propertyName:o,compositeRule:!0},s),e.if((0,Tce.not)(s),()=>{t.error(!0),i.allErrors||e.break()})}),t.ok(s)}};eq.default=K7e});var rq=E(tq=>{"use strict";Object.defineProperty(tq,"__esModule",{value:!0});var ex=sn(),Js=Fe(),J7e=cs(),tx=Xe(),Z7e={message:"must NOT have additional properties",params:({params:t})=>(0,Js._)`{additionalProperty: ${t.additionalProperty}}`},X7e={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:Z7e,code(t){let{gen:e,schema:r,parentSchema:n,data:i,errsCount:s,it:o}=t;if(!s)throw new Error("ajv implementation error");let{allErrors:a,opts:c}=o;if(o.props=!0,c.removeAdditional!=="all"&&(0,tx.alwaysValidSchema)(o,r))return;let l=(0,ex.allSchemaProperties)(n.properties),u=(0,ex.allSchemaProperties)(n.patternProperties);d(),t.ok((0,Js._)`${s} === ${J7e.default.errors}`);function d(){e.forIn("key",i,_=>{!l.length&&!u.length?h(_):e.if(f(_),()=>h(_))})}function f(_){let y;if(l.length>8){let v=(0,tx.schemaRefOrVal)(o,n.properties,"properties");y=(0,ex.isOwnProperty)(e,v,_)}else l.length?y=(0,Js.or)(...l.map(v=>(0,Js._)`${_} === ${v}`)):y=Js.nil;return u.length&&(y=(0,Js.or)(y,...u.map(v=>(0,Js._)`${(0,ex.usePattern)(t,v)}.test(${_})`))),(0,Js.not)(y)}function p(_){e.code((0,Js._)`delete ${i}[${_}]`)}function h(_){if(c.removeAdditional==="all"||c.removeAdditional&&r===!1){p(_);return}if(r===!1){t.setParams({additionalProperty:_}),t.error(),a||e.break();return}if(typeof r=="object"&&!(0,tx.alwaysValidSchema)(o,r)){let y=e.name("valid");c.removeAdditional==="failing"?(m(_,y,!1),e.if((0,Js.not)(y),()=>{t.reset(),p(_)})):(m(_,y),a||e.if((0,Js.not)(y),()=>e.break()))}}function m(_,y,v){let S={keyword:"additionalProperties",dataProp:_,dataPropType:tx.Type.Str};v===!1&&Object.assign(S,{compositeRule:!0,createErrors:!1,allErrors:!1}),t.subschema(S,y)}}};tq.default=X7e});var xce=E(iq=>{"use strict";Object.defineProperty(iq,"__esModule",{value:!0});var Q7e=Yh(),Ace=sn(),nq=Xe(),Rce=rq(),eQe={keyword:"properties",type:"object",schemaType:"object",code(t){let{gen:e,schema:r,parentSchema:n,data:i,it:s}=t;s.opts.removeAdditional==="all"&&n.additionalProperties===void 0&&Rce.default.code(new Q7e.KeywordCxt(s,Rce.default,"additionalProperties"));let o=(0,Ace.allSchemaProperties)(r);for(let d of o)s.definedProperties.add(d);s.opts.unevaluated&&o.length&&s.props!==!0&&(s.props=nq.mergeEvaluated.props(e,(0,nq.toHash)(o),s.props));let a=o.filter(d=>!(0,nq.alwaysValidSchema)(s,r[d]));if(a.length===0)return;let c=e.name("valid");for(let d of a)l(d)?u(d):(e.if((0,Ace.propertyInData)(e,i,d,s.opts.ownProperties)),u(d),s.allErrors||e.else().var(c,!0),e.endIf()),t.it.definedProperties.add(d),t.ok(c);function l(d){return s.opts.useDefaults&&!s.compositeRule&&r[d].default!==void 0}function u(d){t.subschema({keyword:"properties",schemaProp:d,dataProp:d},c)}}};iq.default=eQe});var Cce=E(sq=>{"use strict";Object.defineProperty(sq,"__esModule",{value:!0});var Ice=sn(),rx=Fe(),Oce=Xe(),Pce=Xe(),tQe={keyword:"patternProperties",type:"object",schemaType:"object",code(t){let{gen:e,schema:r,data:n,parentSchema:i,it:s}=t,{opts:o}=s,a=(0,Ice.allSchemaProperties)(r),c=a.filter(m=>(0,Oce.alwaysValidSchema)(s,r[m]));if(a.length===0||c.length===a.length&&(!s.opts.unevaluated||s.props===!0))return;let l=o.strictSchema&&!o.allowMatchingProperties&&i.properties,u=e.name("valid");s.props!==!0&&!(s.props instanceof rx.Name)&&(s.props=(0,Pce.evaluatedPropsToName)(e,s.props));let{props:d}=s;f();function f(){for(let m of a)l&&p(m),s.allErrors?h(m):(e.var(u,!0),h(m),e.if(u))}function p(m){for(let _ in l)new RegExp(m).test(_)&&(0,Oce.checkStrictMode)(s,`property ${_} matches pattern ${m} (use allowMatchingProperties)`)}function h(m){e.forIn("key",n,_=>{e.if((0,rx._)`${(0,Ice.usePattern)(t,m)}.test(${_})`,()=>{let y=c.includes(m);y||t.subschema({keyword:"patternProperties",schemaProp:m,dataProp:_,dataPropType:Pce.Type.Str},u),s.opts.unevaluated&&d!==!0?e.assign((0,rx._)`${d}[${_}]`,!0):!y&&!s.allErrors&&e.if((0,rx.not)(u),()=>e.break())})})}}};sq.default=tQe});var Nce=E(oq=>{"use strict";Object.defineProperty(oq,"__esModule",{value:!0});var rQe=Xe(),nQe={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(t){let{gen:e,schema:r,it:n}=t;if((0,rQe.alwaysValidSchema)(n,r)){t.fail();return}let i=e.name("valid");t.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},i),t.failResult(i,()=>t.reset(),()=>t.error())},error:{message:"must NOT be valid"}};oq.default=nQe});var kce=E(aq=>{"use strict";Object.defineProperty(aq,"__esModule",{value:!0});var iQe=sn(),sQe={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:iQe.validateUnion,error:{message:"must match a schema in anyOf"}};aq.default=sQe});var $ce=E(cq=>{"use strict";Object.defineProperty(cq,"__esModule",{value:!0});var nx=Fe(),oQe=Xe(),aQe={message:"must match exactly one schema in oneOf",params:({params:t})=>(0,nx._)`{passingSchemas: ${t.passing}}`},cQe={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:aQe,code(t){let{gen:e,schema:r,parentSchema:n,it:i}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");if(i.opts.discriminator&&n.discriminator)return;let s=r,o=e.let("valid",!1),a=e.let("passing",null),c=e.name("_valid");t.setParams({passing:a}),e.block(l),t.result(o,()=>t.reset(),()=>t.error(!0));function l(){s.forEach((u,d)=>{let f;(0,oQe.alwaysValidSchema)(i,u)?e.var(c,!0):f=t.subschema({keyword:"oneOf",schemaProp:d,compositeRule:!0},c),d>0&&e.if((0,nx._)`${c} && ${o}`).assign(o,!1).assign(a,(0,nx._)`[${a}, ${d}]`).else(),e.if(c,()=>{e.assign(o,!0),e.assign(a,d),f&&t.mergeEvaluated(f,nx.Name)})})}}};cq.default=cQe});var Lce=E(lq=>{"use strict";Object.defineProperty(lq,"__esModule",{value:!0});var lQe=Xe(),uQe={keyword:"allOf",schemaType:"array",code(t){let{gen:e,schema:r,it:n}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");let i=e.name("valid");r.forEach((s,o)=>{if((0,lQe.alwaysValidSchema)(n,s))return;let a=t.subschema({keyword:"allOf",schemaProp:o},i);t.ok(i),t.mergeEvaluated(a)})}};lq.default=uQe});var Uce=E(uq=>{"use strict";Object.defineProperty(uq,"__esModule",{value:!0});var ix=Fe(),Mce=Xe(),dQe={message:({params:t})=>(0,ix.str)`must match "${t.ifClause}" schema`,params:({params:t})=>(0,ix._)`{failingKeyword: ${t.ifClause}}`},fQe={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:dQe,code(t){let{gen:e,parentSchema:r,it:n}=t;r.then===void 0&&r.else===void 0&&(0,Mce.checkStrictMode)(n,'"if" without "then" and "else" is ignored');let i=Dce(n,"then"),s=Dce(n,"else");if(!i&&!s)return;let o=e.let("valid",!0),a=e.name("_valid");if(c(),t.reset(),i&&s){let u=e.let("ifClause");t.setParams({ifClause:u}),e.if(a,l("then",u),l("else",u))}else i?e.if(a,l("then")):e.if((0,ix.not)(a),l("else"));t.pass(o,()=>t.error(!0));function c(){let u=t.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},a);t.mergeEvaluated(u)}function l(u,d){return()=>{let f=t.subschema({keyword:u},a);e.assign(o,a),t.mergeValidEvaluated(f,o),d?e.assign(d,(0,ix._)`${u}`):t.setParams({ifClause:u})}}}};function Dce(t,e){let r=t.schema[e];return r!==void 0&&!(0,Mce.alwaysValidSchema)(t,r)}uq.default=fQe});var Fce=E(dq=>{"use strict";Object.defineProperty(dq,"__esModule",{value:!0});var pQe=Xe(),hQe={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:t,parentSchema:e,it:r}){e.if===void 0&&(0,pQe.checkStrictMode)(r,`"${t}" without "if" is ignored`)}};dq.default=hQe});var jce=E(fq=>{"use strict";Object.defineProperty(fq,"__esModule",{value:!0});var mQe=Yj(),gQe=gce(),_Qe=Kj(),yQe=yce(),SQe=Sce(),EQe=bce(),vQe=wce(),bQe=rq(),TQe=xce(),wQe=Cce(),AQe=Nce(),RQe=kce(),xQe=$ce(),IQe=Lce(),OQe=Uce(),PQe=Fce();function CQe(t=!1){let e=[AQe.default,RQe.default,xQe.default,IQe.default,OQe.default,PQe.default,vQe.default,bQe.default,EQe.default,TQe.default,wQe.default];return t?e.push(gQe.default,yQe.default):e.push(mQe.default,_Qe.default),e.push(SQe.default),e}fq.default=CQe});var qce=E(pq=>{"use strict";Object.defineProperty(pq,"__esModule",{value:!0});var _r=Fe(),NQe={message:({schemaCode:t})=>(0,_r.str)`must match format "${t}"`,params:({schemaCode:t})=>(0,_r._)`{format: ${t}}`},kQe={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:NQe,code(t,e){let{gen:r,data:n,$data:i,schema:s,schemaCode:o,it:a}=t,{opts:c,errSchemaPath:l,schemaEnv:u,self:d}=a;if(!c.validateFormats)return;i?f():p();function f(){let h=r.scopeValue("formats",{ref:d.formats,code:c.code.formats}),m=r.const("fDef",(0,_r._)`${h}[${o}]`),_=r.let("fType"),y=r.let("format");r.if((0,_r._)`typeof ${m} == "object" && !(${m} instanceof RegExp)`,()=>r.assign(_,(0,_r._)`${m}.type || "string"`).assign(y,(0,_r._)`${m}.validate`),()=>r.assign(_,(0,_r._)`"string"`).assign(y,m)),t.fail$data((0,_r.or)(v(),S()));function v(){return c.strictSchema===!1?_r.nil:(0,_r._)`${o} && !${y}`}function S(){let g=u.$async?(0,_r._)`(${m}.async ? await ${y}(${n}) : ${y}(${n}))`:(0,_r._)`${y}(${n})`,T=(0,_r._)`(typeof ${y} == "function" ? ${g} : ${y}.test(${n}))`;return(0,_r._)`${y} && ${y} !== true && ${_} === ${e} && !${T}`}}function p(){let h=d.formats[s];if(!h){v();return}if(h===!0)return;let[m,_,y]=S(h);m===e&&t.pass(g());function v(){if(c.strictSchema===!1){d.logger.warn(T());return}throw new Error(T());function T(){return`unknown format "${s}" ignored in schema at path "${l}"`}}function S(T){let I=T instanceof RegExp?(0,_r.regexpCode)(T):c.code.formats?(0,_r._)`${c.code.formats}${(0,_r.getProperty)(s)}`:void 0,x=r.scopeValue("formats",{key:s,ref:T,code:I});return typeof T=="object"&&!(T instanceof RegExp)?[T.type||"string",T.validate,(0,_r._)`${x}.validate`]:["string",T,x]}function g(){if(typeof h=="object"&&!(h instanceof RegExp)&&h.async){if(!u.$async)throw new Error("async format in sync schema");return(0,_r._)`await ${y}(${n})`}return typeof _=="function"?(0,_r._)`${y}(${n})`:(0,_r._)`${y}.test(${n})`}}}};pq.default=kQe});var Bce=E(hq=>{"use strict";Object.defineProperty(hq,"__esModule",{value:!0});var $Qe=qce(),LQe=[$Qe.default];hq.default=LQe});var zce=E(em=>{"use strict";Object.defineProperty(em,"__esModule",{value:!0});em.contentVocabulary=em.metadataVocabulary=void 0;em.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];em.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var Hce=E(mq=>{"use strict";Object.defineProperty(mq,"__esModule",{value:!0});var DQe=Xae(),MQe=fce(),UQe=jce(),FQe=Bce(),Vce=zce(),jQe=[DQe.default,MQe.default,(0,UQe.default)(),FQe.default,Vce.metadataVocabulary,Vce.contentVocabulary];mq.default=jQe});var gq=E(sx=>{"use strict";Object.defineProperty(sx,"__esModule",{value:!0});sx.DiscrError=void 0;var Gce;(function(t){t.Tag="tag",t.Mapping="mapping"})(Gce||(sx.DiscrError=Gce={}))});var Yce=E(yq=>{"use strict";Object.defineProperty(yq,"__esModule",{value:!0});var tm=Fe(),_q=gq(),Wce=sf(),qQe=rc(),BQe=Xe(),zQe={message:({params:{discrError:t,tagName:e}})=>t===_q.DiscrError.Tag?`tag "${e}" must be string`:`value of tag "${e}" must be in oneOf`,params:({params:{discrError:t,tag:e,tagName:r}})=>(0,tm._)`{error: ${t}, tag: ${r}, tagValue: ${e}}`},VQe={keyword:"discriminator",type:"object",schemaType:"object",error:zQe,code(t){let{gen:e,data:r,schema:n,parentSchema:i,it:s}=t,{oneOf:o}=i;if(!s.opts.discriminator)throw new Error("discriminator: requires discriminator option");let a=n.propertyName;if(typeof a!="string")throw new Error("discriminator: requires propertyName");if(n.mapping)throw new Error("discriminator: mapping is not supported");if(!o)throw new Error("discriminator: requires oneOf keyword");let c=e.let("valid",!1),l=e.const("tag",(0,tm._)`${r}${(0,tm.getProperty)(a)}`);e.if((0,tm._)`typeof ${l} == "string"`,()=>u(),()=>t.error(!1,{discrError:_q.DiscrError.Tag,tag:l,tagName:a})),t.ok(c);function u(){let p=f();e.if(!1);for(let h in p)e.elseIf((0,tm._)`${l} === ${h}`),e.assign(c,d(p[h]));e.else(),t.error(!1,{discrError:_q.DiscrError.Mapping,tag:l,tagName:a}),e.endIf()}function d(p){let h=e.name("valid"),m=t.subschema({keyword:"oneOf",schemaProp:p},h);return t.mergeEvaluated(m,tm.Name),h}function f(){var p;let h={},m=y(i),_=!0;for(let g=0;g<o.length;g++){let T=o[g];if(T?.$ref&&!(0,BQe.schemaHasRulesButRef)(T,s.self.RULES)){let x=T.$ref;if(T=Wce.resolveRef.call(s.self,s.schemaEnv.root,s.baseId,x),T instanceof Wce.SchemaEnv&&(T=T.schema),T===void 0)throw new qQe.default(s.opts.uriResolver,s.baseId,x)}let I=(p=T?.properties)===null||p===void 0?void 0:p[a];if(typeof I!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${a}"`);_=_&&(m||y(T)),v(I,g)}if(!_)throw new Error(`discriminator: "${a}" must be required`);return h;function y({required:g}){return Array.isArray(g)&&g.includes(a)}function v(g,T){if(g.const)S(g.const,T);else if(g.enum)for(let I of g.enum)S(I,T);else throw new Error(`discriminator: "properties/${a}" must have "const" or "enum"`)}function S(g,T){if(typeof g!="string"||g in h)throw new Error(`discriminator: "${a}" values must be unique strings`);h[g]=T}}}};yq.default=VQe});var Kce=E((NKt,HQe)=>{HQe.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"http://json-schema.org/draft-07/schema#",title:"Core schema meta-schema",definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},default:!0}});var ax=E((Jt,Sq)=>{"use strict";Object.defineProperty(Jt,"__esModule",{value:!0});Jt.MissingRefError=Jt.ValidationError=Jt.CodeGen=Jt.Name=Jt.nil=Jt.stringify=Jt.str=Jt._=Jt.KeywordCxt=Jt.Ajv=void 0;var GQe=Ij(),WQe=Hce(),YQe=Yce(),Jce=Kce(),KQe=["/properties"],ox="http://json-schema.org/draft-07/schema",rm=class extends GQe.default{_addVocabularies(){super._addVocabularies(),WQe.default.forEach(e=>this.addVocabulary(e)),this.opts.discriminator&&this.addKeyword(YQe.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let e=this.opts.$data?this.$dataMetaSchema(Jce,KQe):Jce;this.addMetaSchema(e,ox,!1),this.refs["http://json-schema.org/schema"]=ox}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(ox)?ox:void 0)}};Jt.Ajv=rm;Sq.exports=Jt=rm;Sq.exports.Ajv=rm;Object.defineProperty(Jt,"__esModule",{value:!0});Jt.default=rm;var JQe=Yh();Object.defineProperty(Jt,"KeywordCxt",{enumerable:!0,get:function(){return JQe.KeywordCxt}});var nm=Fe();Object.defineProperty(Jt,"_",{enumerable:!0,get:function(){return nm._}});Object.defineProperty(Jt,"str",{enumerable:!0,get:function(){return nm.str}});Object.defineProperty(Jt,"stringify",{enumerable:!0,get:function(){return nm.stringify}});Object.defineProperty(Jt,"nil",{enumerable:!0,get:function(){return nm.nil}});Object.defineProperty(Jt,"Name",{enumerable:!0,get:function(){return nm.Name}});Object.defineProperty(Jt,"CodeGen",{enumerable:!0,get:function(){return nm.CodeGen}});var ZQe=FE();Object.defineProperty(Jt,"ValidationError",{enumerable:!0,get:function(){return ZQe.default}});var XQe=rc();Object.defineProperty(Jt,"MissingRefError",{enumerable:!0,get:function(){return XQe.default}})});var nc=E(ev=>{"use strict";Object.defineProperty(ev,"__esModule",{value:!0});ev.checkMetadata=void 0;var QQe=Xe(),eet={keyword:"metadata",schemaType:"object",code(t){Zce(t);let{gen:e,schema:r,it:n}=t;if((0,QQe.alwaysValidSchema)(n,r))return;let i=e.name("valid");t.subschema({keyword:"metadata",jtdMetadata:!0},i),t.ok(i)}};function Zce({it:t,keyword:e},r){if(t.jtdMetadata!==r)throw new Error(`JTD: "${e}" cannot be used in this schema location`)}ev.checkMetadata=Zce;ev.default=eet});var cx=E(rv=>{"use strict";Object.defineProperty(rv,"__esModule",{value:!0});rv.hasRef=void 0;var Xce=sf(),tv=Fe(),tet=rc(),Qce=cs(),ele=Pj(),ret=nc(),net={keyword:"ref",schemaType:"string",code(t){(0,ret.checkMetadata)(t);let{gen:e,data:r,schema:n,parentSchema:i,it:s}=t,{schemaEnv:{root:o}}=s,a=e.name("valid");i.nullable?(e.var(a,(0,tv._)`${r} === null`),e.if((0,tv.not)(a),c)):(e.var(a,!1),c()),t.ok(a);function c(){var d;let f=(d=o.schema.definitions)===null||d===void 0?void 0:d[n];if(!f)throw new tet.default(s.opts.uriResolver,"",n,`No definition ${n}`);Eq(f)||!s.opts.inlineRefs?l(f):u(f)}function l(d){let f=Xce.compileSchema.call(s.self,new Xce.SchemaEnv({schema:d,root:o,schemaPath:`/definitions/${n}`})),p=(0,ele.getValidate)(t,f),h=e.const("_errs",Qce.default.errors);(0,ele.callRef)(t,p,f,f.$async),e.assign(a,(0,tv._)`${h} === ${Qce.default.errors}`)}function u(d){let f=e.scopeValue("schema",s.opts.code.source===!0?{ref:d,code:(0,tv.stringify)(d)}:{ref:d});t.subschema({schema:d,dataTypes:[],schemaPath:tv.nil,topSchemaRef:f,errSchemaPath:`/definitions/${n}`},a)}}};function Eq(t){for(let e in t){let r;if(e==="ref"||typeof(r=t[e])=="object"&&Eq(r))return!0}return!1}rv.hasRef=Eq;rv.default=net});var bq=E(vq=>{"use strict";Object.defineProperty(vq,"__esModule",{value:!0});var iet=/t|\s/i,set=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,oet=/^(\d\d):(\d\d):(\d\d)(?:\.\d+)?(?:z|([+-]\d\d)(?::?(\d\d))?)$/i,aet=[0,31,28,31,30,31,30,31,31,30,31,30,31];function rle(t,e){let r=t.split(iet);return r.length===2&&tle(r[0])&&cet(r[1])||e&&r.length===1&&tle(r[0])}vq.default=rle;function tle(t){let e=set.exec(t);if(!e)return!1;let r=+e[1],n=+e[2],i=+e[3];return n>=1&&n<=12&&i>=1&&(i<=aet[n]||n===2&&i===29&&(r%100===0?r%400===0:r%4===0))}function cet(t){let e=oet.exec(t);if(!e)return!1;let r=+e[1],n=+e[2],i=+e[3],s=+(e[4]||0),o=+(e[5]||0);return r<=23&&n<=59&&i<=59||r-s===23&&n-o===59&&i===60}rle.code='require("ajv/dist/runtime/timestamp").default'});var im=E(ql=>{"use strict";Object.defineProperty(ql,"__esModule",{value:!0});ql.typeErrorParams=ql.typeErrorMessage=ql.typeError=void 0;var uet=Fe();function det(t){return{message:e=>nle(e,t),params:e=>ile(e,t)}}ql.typeError=det;function nle({parentSchema:t},e){return t?.nullable?`must be ${e} or null`:`must be ${e}`}ql.typeErrorMessage=nle;function ile({parentSchema:t},e){return(0,uet._)`{type: ${e}, nullable: ${!!t?.nullable}}`}ql.typeErrorParams=ile});var Tq=E(sm=>{"use strict";Object.defineProperty(sm,"__esModule",{value:!0});sm.intRange=void 0;var $i=Fe(),fet=bq(),pet=Xe(),het=nc(),sle=im();sm.intRange={int8:[-128,127,3],uint8:[0,255,3],int16:[-32768,32767,5],uint16:[0,65535,5],int32:[-2147483648,2147483647,10],uint32:[0,4294967295,10]};var met={message:t=>(0,sle.typeErrorMessage)(t,t.schema),params:t=>(0,sle.typeErrorParams)(t,t.schema)};function get(t){let{gen:e,data:r,it:n}=t,{timestamp:i,allowDate:s}=n.opts;if(i==="date")return(0,$i._)`${r} instanceof Date `;let o=(0,pet.useFunc)(e,fet.default),a=s?(0,$i._)`, true`:$i.nil,c=(0,$i._)`typeof ${r} == "string" && ${o}(${r}${a})`;return i==="string"?c:(0,$i.or)((0,$i._)`${r} instanceof Date`,c)}var _et={keyword:"type",schemaType:"string",error:met,code(t){(0,het.checkMetadata)(t);let{data:e,schema:r,parentSchema:n,it:i}=t,s;switch(r){case"boolean":case"string":s=(0,$i._)`typeof ${e} == ${r}`;break;case"timestamp":{s=get(t);break}case"float32":case"float64":s=(0,$i._)`typeof ${e} == "number"`;break;default:{let o=r;if(s=(0,$i._)`typeof ${e} == "number" && isFinite(${e}) && !(${e} % 1)`,!i.opts.int32range&&(o==="int32"||o==="uint32"))o==="uint32"&&(s=(0,$i._)`${s} && ${e} >= 0`);else{let[a,c]=sm.intRange[o];s=(0,$i._)`${s} && ${e} >= ${a} && ${e} <= ${c}`}}}t.pass(n.nullable?(0,$i.or)((0,$i._)`${e} === null`,s):s)}};sm.default=_et});var am=E(om=>{"use strict";Object.defineProperty(om,"__esModule",{value:!0});om.checkNullableObject=om.checkNullable=void 0;var lx=Fe();function ole({gen:t,data:e,parentSchema:r},n=lx.nil){let i=t.name("valid");return r.nullable?(t.let(i,(0,lx._)`${e} === null`),n=(0,lx.not)(i)):t.let(i,!1),[i,n]}om.checkNullable=ole;function yet(t,e){let[r,n]=ole(t,e);return[r,(0,lx._)`${n} && typeof ${t.data} == "object" && !Array.isArray(${t.data})`]}om.checkNullableObject=yet});var ale=E(wq=>{"use strict";Object.defineProperty(wq,"__esModule",{value:!0});var Bl=Fe(),Eet=nc(),vet=am(),bet={message:"must be equal to one of the allowed values",params:({schemaCode:t})=>(0,Bl._)`{allowedValues: ${t}}`},Tet={keyword:"enum",schemaType:"array",error:bet,code(t){(0,Eet.checkMetadata)(t);let{gen:e,data:r,schema:n,schemaValue:i,parentSchema:s,it:o}=t;if(n.length===0)throw new Error("enum must have non-empty array");if(n.length!==new Set(n).size)throw new Error("enum items must be unique");let a,c=(0,Bl._)`typeof ${r} == "string"`;if(n.length>=o.opts.loopEnum){let u;[a,u]=(0,vet.checkNullable)(t,c),e.if(u,l)}else{if(!Array.isArray(n))throw new Error("ajv implementation error");a=(0,Bl.and)(c,(0,Bl.or)(...n.map(u=>(0,Bl._)`${r} === ${u}`))),s.nullable&&(a=(0,Bl.or)((0,Bl._)`${r} === null`,a))}t.pass(a);function l(){e.forOf("v",i,u=>e.if((0,Bl._)`${a} = ${r} === ${u}`,()=>e.break()))}}};wq.default=Tet});var lle=E(Aq=>{"use strict";Object.defineProperty(Aq,"__esModule",{value:!0});var wet=Xe(),Aet=sn(),cle=Fe(),Ret=nc(),xet=am(),Iet=im(),Oet={keyword:"elements",schemaType:"object",error:(0,Iet.typeError)("array"),code(t){(0,Ret.checkMetadata)(t);let{gen:e,data:r,schema:n,it:i}=t;if((0,wet.alwaysValidSchema)(i,n))return;let[s]=(0,xet.checkNullable)(t);e.if((0,cle.not)(s),()=>e.if((0,cle._)`Array.isArray(${r})`,()=>e.assign(s,(0,Aet.validateArray)(t)),()=>t.error())),t.ok(s)}};Aq.default=Oet});var xq=E(zl=>{"use strict";Object.defineProperty(zl,"__esModule",{value:!0});zl.validateProperties=zl.error=void 0;var Rq=sn(),ule=Xe(),ic=Fe(),Pet=nc(),Cet=am(),dle=im(),cm;(function(t){t.Additional="additional",t.Missing="missing"})(cm||(cm={}));zl.error={message:t=>{let{params:e}=t;return e.propError?e.propError===cm.Additional?"must NOT have additional properties":`must have property '${e.missingProperty}'`:(0,dle.typeErrorMessage)(t,"object")},params:t=>{let{params:e}=t;return e.propError?e.propError===cm.Additional?(0,ic._)`{error: ${e.propError}, additionalProperty: ${e.additionalProperty}}`:(0,ic._)`{error: ${e.propError}, missingProperty: ${e.missingProperty}}`:(0,dle.typeErrorParams)(t,"object")}};var Net={keyword:"properties",schemaType:"object",error:zl.error,code:fle};function fle(t){(0,Pet.checkMetadata)(t);let{gen:e,data:r,parentSchema:n,it:i}=t,{additionalProperties:s,nullable:o}=n;if(i.jtdDiscriminator&&o)throw new Error("JTD: nullable inside discriminator mapping");if(p())throw new Error("JTD: properties and optionalProperties have common members");let[a,c]=h("properties"),[l,u]=h("optionalProperties");if(c.length===0&&u.length===0&&s)return;let[d,f]=i.jtdDiscriminator===void 0?(0,Cet.checkNullableObject)(t,r):[e.let("valid",!1),!0];e.if(f,()=>e.assign(d,!0).block(()=>{m(c,"properties",!0),m(u,"optionalProperties"),s||y()})),t.pass(d);function p(){let S=n.properties,g=n.optionalProperties;if(!(S&&g))return!1;for(let T in S)if(Object.prototype.hasOwnProperty.call(g,T))return!0;return!1}function h(S){let g=n[S],T=g?(0,Rq.allSchemaProperties)(g):[];if(i.jtdDiscriminator&&T.some(x=>x===i.jtdDiscriminator))throw new Error(`JTD: discriminator tag used in ${S}`);let I=T.filter(x=>!(0,ule.alwaysValidSchema)(i,g[x]));return[T,I]}function m(S,g,T){let I=e.var("valid");for(let R of S)e.if((0,Rq.propertyInData)(e,r,R,i.opts.ownProperties),()=>_(R,g,I),()=>x(R)),t.ok(I);function x(R){T?(e.assign(I,!1),t.error(!1,{propError:cm.Missing,missingProperty:R},{schemaPath:R})):e.assign(I,!0)}}function _(S,g,T){t.subschema({keyword:g,schemaProp:S,dataProp:S},T)}function y(){e.forIn("key",r,S=>{let g=v(S,a,"properties",i.jtdDiscriminator),T=v(S,l,"optionalProperties"),I=g===!0?T:T===!0?g:(0,ic.and)(g,T);e.if(I,()=>{i.opts.removeAdditional?e.code((0,ic._)`delete ${r}[${S}]`):(t.error(!1,{propError:cm.Additional,additionalProperty:S},{instancePath:S,parentSchema:!0}),i.opts.allErrors||e.break())})})}function v(S,g,T,I){let x;if(g.length>8){let R=(0,ule.schemaRefOrVal)(i,n[T],T);x=(0,ic.not)((0,Rq.isOwnProperty)(e,R,S)),I!==void 0&&(x=(0,ic.and)(x,(0,ic._)`${S} !== ${I}`))}else if(g.length||I!==void 0){let R=I===void 0?g:[I].concat(g);x=(0,ic.and)(...R.map(O=>(0,ic._)`${S} !== ${O}`))}else x=!0;return x}}zl.validateProperties=fle;zl.default=Net});var hle=E(Iq=>{"use strict";Object.defineProperty(Iq,"__esModule",{value:!0});var ple=xq(),ket={keyword:"optionalProperties",schemaType:"object",error:ple.error,code(t){t.parentSchema.properties||(0,ple.validateProperties)(t)}};Iq.default=ket});var gle=E(Oq=>{"use strict";Object.defineProperty(Oq,"__esModule",{value:!0});var uf=Fe(),$et=nc(),Let=am(),mle=im(),ux=gq(),Det={message:t=>{let{schema:e,params:r}=t;return r.discrError?r.discrError===ux.DiscrError.Tag?`tag "${e}" must be string`:`value of tag "${e}" must be in mapping`:(0,mle.typeErrorMessage)(t,"object")},params:t=>{let{schema:e,params:r}=t;return r.discrError?(0,uf._)`{error: ${r.discrError}, tag: ${e}, tagValue: ${r.tag}}`:(0,mle.typeErrorParams)(t,"object")}},Met={keyword:"discriminator",schemaType:"string",implements:["mapping"],error:Det,code(t){(0,$et.checkMetadata)(t);let{gen:e,data:r,schema:n,parentSchema:i}=t,[s,o]=(0,Let.checkNullableObject)(t,r);e.if(o),a(),e.elseIf((0,uf.not)(s)),t.error(),e.endIf(),t.ok(s);function a(){let u=e.const("tag",(0,uf._)`${r}${(0,uf.getProperty)(n)}`);e.if((0,uf._)`${u} === undefined`),t.error(!1,{discrError:ux.DiscrError.Tag,tag:u}),e.elseIf((0,uf._)`typeof ${u} == "string"`),c(u),e.else(),t.error(!1,{discrError:ux.DiscrError.Tag,tag:u},{instancePath:n}),e.endIf()}function c(u){e.if(!1);for(let d in i.mapping)e.elseIf((0,uf._)`${u} === ${d}`),e.assign(s,l(d));e.else(),t.error(!1,{discrError:ux.DiscrError.Mapping,tag:u},{instancePath:n,schemaPath:"mapping",parentSchema:!0}),e.endIf()}function l(u){let d=e.name("valid");return t.subschema({keyword:"mapping",schemaProp:u,jtdDiscriminator:n},d),d}}};Oq.default=Met});var yle=E(Pq=>{"use strict";Object.defineProperty(Pq,"__esModule",{value:!0});var _le=Xe(),dx=Fe(),Uet=nc(),Fet=am(),jet=im(),qet={keyword:"values",schemaType:"object",error:(0,jet.typeError)("object"),code(t){(0,Uet.checkMetadata)(t);let{gen:e,data:r,schema:n,it:i}=t,[s,o]=(0,Fet.checkNullableObject)(t,r);(0,_le.alwaysValidSchema)(i,n)?e.if((0,dx.not)((0,dx.or)(o,s)),()=>t.error()):(e.if(o),e.assign(s,a()),e.elseIf((0,dx.not)(s)),t.error(),e.endIf()),t.ok(s);function a(){let c=e.name("valid");if(i.allErrors){let u=e.let("valid",!0);return l(()=>e.assign(u,!1)),u}return e.var(c,!0),l(()=>e.break()),c;function l(u){e.forIn("key",r,d=>{t.subschema({keyword:"values",dataProp:d,dataPropType:_le.Type.Str},c),e.if((0,dx.not)(c),u)})}}}};Pq.default=qet});var Sle=E(Cq=>{"use strict";Object.defineProperty(Cq,"__esModule",{value:!0});var Bet=sn(),zet={keyword:"union",schemaType:"array",trackErrors:!0,code:Bet.validateUnion,error:{message:"must match a schema in union"}};Cq.default=zet});var Ele=E(Nq=>{"use strict";Object.defineProperty(Nq,"__esModule",{value:!0});var Vet=cx(),Het=Tq(),Get=ale(),Wet=lle(),Yet=xq(),Ket=hle(),Jet=gle(),Zet=yle(),Xet=Sle(),Qet=nc(),ett=["definitions",Vet.default,Het.default,Get.default,Wet.default,Yet.default,Ket.default,Jet.default,Zet.default,Xet.default,Qet.default,{keyword:"additionalProperties",schemaType:"boolean"},{keyword:"nullable",schemaType:"boolean"}];Nq.default=ett});var wle=E(kq=>{"use strict";Object.defineProperty(kq,"__esModule",{value:!0});var sc=t=>{let e={nullable:{type:"boolean"},metadata:{optionalProperties:{union:{elements:{ref:"schema"}}},additionalProperties:!0}};return t&&(e.definitions={values:{ref:"schema"}}),e},ttt=t=>({optionalProperties:sc(t)}),rtt=t=>({properties:{ref:{type:"string"}},optionalProperties:sc(t)}),ntt=t=>({properties:{type:{enum:["boolean","timestamp","string","float32","float64","int8","uint8","int16","uint16","int32","uint32"]}},optionalProperties:sc(t)}),itt=t=>({properties:{enum:{elements:{type:"string"}}},optionalProperties:sc(t)}),stt=t=>({properties:{elements:{ref:"schema"}},optionalProperties:sc(t)}),ble=t=>({properties:{properties:{values:{ref:"schema"}}},optionalProperties:{optionalProperties:{values:{ref:"schema"}},additionalProperties:{type:"boolean"},...sc(t)}}),Tle=t=>({properties:{optionalProperties:{values:{ref:"schema"}}},optionalProperties:{additionalProperties:{type:"boolean"},...sc(t)}}),ott=t=>({properties:{discriminator:{type:"string"},mapping:{values:{metadata:{union:[ble(!1),Tle(!1)]}}}},optionalProperties:sc(t)}),att=t=>({properties:{values:{ref:"schema"}},optionalProperties:sc(t)}),vle=t=>({metadata:{union:[ttt,rtt,ntt,itt,stt,ble,Tle,ott,att].map(e=>e(t))}}),ctt={definitions:{schema:vle(!1)},...vle(!0)};kq.default=ctt});var $q=E(fx=>{"use strict";Object.defineProperty(fx,"__esModule",{value:!0});fx.jtdForms=void 0;fx.jtdForms=["elements","values","discriminator","properties","optionalProperties","enum","type","ref"]});var Rle=E(Dq=>{"use strict";Object.defineProperty(Dq,"__esModule",{value:!0});var Lq=/[\\"\u0000-\u001f\u007f-\u009f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,ltt={"\b":"\\b"," ":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"};function Ale(t){return Lq.lastIndex=0,'"'+(Lq.test(t)?t.replace(Lq,e=>{let r=ltt[e];return typeof r=="string"?r:"\\u"+("0000"+e.charCodeAt(0).toString(16)).slice(-4)}):t)+'"'}Dq.default=Ale;Ale.code='require("ajv/dist/runtime/quote").default'});var Nle=E(Uq=>{"use strict";Object.defineProperty(Uq,"__esModule",{value:!0});var utt=$q(),Ile=sf(),nt=Fe(),dtt=rc(),Ct=cs(),ftt=sn(),ptt=cx(),htt=Xe(),mtt=Rle(),gtt={elements:ytt,values:Stt,discriminator:Ett,properties:xle,optionalProperties:xle,enum:nv,type:vtt,ref:Ttt};function Ole(t,e){let r=Ile.getCompilingSchema.call(this,t);if(r)return r;let{es5:n,lines:i}=this.opts.code,{ownProperties:s}=this.opts,o=new nt.CodeGen(this.scope,{es5:n,lines:i,ownProperties:s}),a=o.scopeName("serialize"),c={self:this,gen:o,schema:t.schema,schemaEnv:t,definitions:e,data:Ct.default.data},l;try{this._compilations.add(t),t.serializeName=a,o.func(a,Ct.default.data,!1,()=>{o.let(Ct.default.json,(0,nt.str)``),iv(c),o.return(Ct.default.json)}),o.optimize(this.opts.code.optimize);let u=o.toString();l=`${o.scopeRefs(Ct.default.scope)}return ${u}`;let f=new Function(`${Ct.default.scope}`,l)(this.scope.get());this.scope.value(a,{ref:f}),t.serialize=f}catch(u){throw l&&this.logger.error("Error compiling serializer, function code:",l),delete t.serialize,delete t.serializeName,u}finally{this._compilations.delete(t)}return t}Uq.default=Ole;function iv(t){let e;for(let r of utt.jtdForms)if(r in t.schema){e=r;break}_tt(t,e?gtt[e]:Att)}function _tt(t,e){let{gen:r,schema:n,data:i}=t;if(!n.nullable)return e(t);r.if((0,nt._)`${i} === undefined || ${i} === null`,()=>r.add(Ct.default.json,(0,nt._)`"null"`),()=>e(t))}function ytt(t){let{gen:e,schema:r,data:n}=t;e.add(Ct.default.json,(0,nt.str)`[`);let i=e.let("first",!0);e.forOf("el",n,s=>{Mq(t,i),iv({...t,schema:r.elements,data:s})}),e.add(Ct.default.json,(0,nt.str)`]`)}function Stt(t){let{gen:e,schema:r,data:n}=t;e.add(Ct.default.json,(0,nt.str)`{`);let i=e.let("first",!0);e.forIn("key",n,s=>Ple(t,s,r.values,i)),e.add(Ct.default.json,(0,nt.str)`}`)}function Ple(t,e,r,n){let{gen:i,data:s}=t;Mq(t,n),nv({...t,data:e}),i.add(Ct.default.json,(0,nt.str)`:`);let o=i.const("value",(0,nt._)`${s}${(0,nt.getProperty)(e)}`);iv({...t,schema:r,data:o})}function Ett(t){let{gen:e,schema:r,data:n}=t,{discriminator:i}=r;e.add(Ct.default.json,(0,nt.str)`{${JSON.stringify(i)}:`);let s=e.const("tag",(0,nt._)`${n}${(0,nt.getProperty)(i)}`);nv({...t,data:s}),e.if(!1);for(let o in r.mapping){e.elseIf((0,nt._)`${s} === ${o}`);let a=r.mapping[o];Cle({...t,schema:a},i)}e.endIf(),e.add(Ct.default.json,(0,nt.str)`}`)}function xle(t){let{gen:e}=t;e.add(Ct.default.json,(0,nt.str)`{`),Cle(t),e.add(Ct.default.json,(0,nt.str)`}`)}function Cle(t,e){let{gen:r,schema:n,data:i}=t,{properties:s,optionalProperties:o}=n,a=f(s),c=f(o),l=p(a.concat(c)),u=!e,d;for(let y of a)u?u=!1:r.add(Ct.default.json,(0,nt.str)`,`),m(y,s[y],h(y));u&&(d=r.let("first",!0));for(let y of c){let v=h(y);r.if((0,nt.and)((0,nt._)`${v} !== undefined`,(0,ftt.isOwnProperty)(r,i,y)),()=>{Mq(t,d),m(y,o[y],v)})}n.additionalProperties&&r.forIn("key",i,y=>r.if(_(y,l),()=>Ple(t,y,{},d)));function f(y){return y?Object.keys(y):[]}function p(y){if(e&&y.push(e),new Set(y).size!==y.length)throw new Error("JTD: properties/optionalProperties/disciminator overlap");return y}function h(y){return r.const("value",(0,nt._)`${i}${(0,nt.getProperty)(y)}`)}function m(y,v,S){r.add(Ct.default.json,(0,nt.str)`${JSON.stringify(y)}:`),iv({...t,schema:v,data:S})}function _(y,v){return v.length?(0,nt.and)(...v.map(S=>(0,nt._)`${y} !== ${S}`)):!0}}function vtt(t){let{gen:e,schema:r,data:n}=t;switch(r.type){case"boolean":e.add(Ct.default.json,(0,nt._)`${n} ? "true" : "false"`);break;case"string":nv(t);break;case"timestamp":e.if((0,nt._)`${n} instanceof Date`,()=>e.add(Ct.default.json,(0,nt._)`'"' + ${n}.toISOString() + '"'`),()=>nv(t));break;default:btt(t)}}function nv({gen:t,data:e}){t.add(Ct.default.json,(0,nt._)`${(0,htt.useFunc)(t,mtt.default)}(${e})`)}function btt({gen:t,data:e,self:r}){let n=(0,nt._)`${e} === Infinity || ${e} === -Infinity || ${e} !== ${e}`;r.opts.specialNumbers===void 0||r.opts.specialNumbers==="fast"?t.add(Ct.default.json,(0,nt._)`"" + ${e}`):t.if(n,()=>t.add(Ct.default.json,(0,nt._)`null`),()=>t.add(Ct.default.json,(0,nt._)`"" + ${e}`))}function Ttt(t){let{gen:e,self:r,data:n,definitions:i,schema:s,schemaEnv:o}=t,{ref:a}=s,c=i[a];if(!c)throw new dtt.default(r.opts.uriResolver,"",a,`No definition ${a}`);if(!(0,ptt.hasRef)(c))return iv({...t,schema:c});let{root:l}=o,u=Ole.call(r,new Ile.SchemaEnv({schema:c,root:l}),i);e.add(Ct.default.json,(0,nt._)`${wtt(e,u)}(${n})`)}function wtt(t,e){return e.serialize?t.scopeValue("serialize",{ref:e.serialize}):(0,nt._)`${t.scopeValue("wrapper",{ref:e})}.serialize`}function Att({gen:t,data:e}){t.add(Ct.default.json,(0,nt._)`JSON.stringify(${e})`)}function Mq({gen:t},e){e?t.if(e,()=>t.assign(e,!1),()=>t.add(Ct.default.json,(0,nt.str)`,`)):t.add(Ct.default.json,(0,nt.str)`,`)}});var $le=E(Hl=>{"use strict";Object.defineProperty(Hl,"__esModule",{value:!0});Hl.parseJsonString=Hl.parseJsonNumber=Hl.parseJson=void 0;var Rtt=/position\s(\d+)(?: \(line \d+ column \d+\))?$/;function oc(t,e){let r;oc.message=void 0;let n;e&&(t=t.slice(e));try{return oc.position=e+t.length,JSON.parse(t)}catch(i){if(n=Rtt.exec(i.message),!n){oc.message="unexpected end";return}r=+n[1];let s=t[r];t=t.slice(0,r),oc.position=e+r;try{return JSON.parse(t)}catch{oc.message=`unexpected token ${s}`;return}}}Hl.parseJson=oc;oc.message=void 0;oc.position=0;oc.code='require("ajv/dist/runtime/parseJson").parseJson';function ac(t,e,r){let n="",i;if(ac.message=void 0,t[e]==="-"&&(n+="-",e++),t[e]==="0")n+="0",e++;else if(!s(r)){o();return}if(r)return ac.position=e,+n;if(t[e]==="."&&(n+=".",e++,!s())){o();return}if(i=t[e],(i==="e"||i==="E")&&(n+="e",e++,i=t[e],(i==="+"||i==="-")&&(n+=i,e++),!s())){o();return}return ac.position=e,+n;function s(a){let c=!1;for(;i=t[e],i>="0"&&i<="9"&&(a===void 0||a-- >0);)c=!0,n+=i,e++;return c}function o(){ac.position=e,ac.message=e<t.length?`unexpected token ${t[e]}`:"unexpected end"}}Hl.parseJsonNumber=ac;ac.message=void 0;ac.position=0;ac.code='require("ajv/dist/runtime/parseJson").parseJsonNumber';var kle={b:"\b",f:"\f",n:`
35
- `,r:"\r",t:" ",'"':'"',"/":"/","\\":"\\"},xtt=97,Itt=48;function Vl(t,e){let r="",n;for(Vl.message=void 0;n=t[e++],n!=='"';)if(n==="\\")if(n=t[e],n in kle)r+=kle[n],e++;else if(n==="u"){e++;let s=4,o=0;for(;s--;){if(o<<=4,n=t[e],n===void 0){i("unexpected end");return}if(n=n.toLowerCase(),n>="a"&&n<="f")o+=n.charCodeAt(0)-xtt+10;else if(n>="0"&&n<="9")o+=n.charCodeAt(0)-Itt;else{i(`unexpected token ${n}`);return}e++}r+=String.fromCharCode(o)}else{i(`unexpected token ${n}`);return}else if(n===void 0){i("unexpected end");return}else if(n.charCodeAt(0)>=32)r+=n;else{i(`unexpected token ${n}`);return}return Vl.position=e,r;function i(s){Vl.position=e,Vl.message=s}}Hl.parseJsonString=Vl;Vl.message=void 0;Vl.position=0;Vl.code='require("ajv/dist/runtime/parseJson").parseJsonString'});var Hle=E(Gq=>{"use strict";Object.defineProperty(Gq,"__esModule",{value:!0});var Ott=$q(),Ule=sf(),Me=Fe(),Ptt=rc(),lt=cs(),Ctt=sn(),Ntt=cx(),ktt=Tq(),qq=$le(),Fle=Xe(),$tt=bq(),Ltt={elements:Ftt,values:jtt,discriminator:Btt,properties:Lle,optionalProperties:Lle,enum:Vtt,type:ztt,ref:Htt};function jle(t,e){let r=Ule.getCompilingSchema.call(this,t);if(r)return r;let{es5:n,lines:i}=this.opts.code,{ownProperties:s}=this.opts,o=new Me.CodeGen(this.scope,{es5:n,lines:i,ownProperties:s}),a=o.scopeName("parse"),c={self:this,gen:o,schema:t.schema,schemaEnv:t,definitions:e,data:lt.default.data,parseName:a,char:o.name("c")},l;try{this._compilations.add(t),t.parseName=a,Dtt(c),o.optimize(this.opts.code.optimize);let u=o.toString();l=`${o.scopeRefs(lt.default.scope)}return ${u}`;let f=new Function(`${lt.default.scope}`,l)(this.scope.get());this.scope.value(a,{ref:f}),t.parse=f}catch(u){throw l&&this.logger.error("Error compiling parser, function code:",l),delete t.parse,delete t.parseName,u}finally{this._compilations.delete(t)}return t}Gq.default=jle;var jq=(0,Me._)`undefined`;function Dtt(t){let{gen:e,parseName:r,char:n}=t;e.func(r,(0,Me._)`${lt.default.json}, ${lt.default.jsonPos}, ${lt.default.jsonPart}`,!1,()=>{e.let(lt.default.data),e.let(n),e.assign((0,Me._)`${r}.message`,jq),e.assign((0,Me._)`${r}.position`,jq),e.assign(lt.default.jsonPos,(0,Me._)`${lt.default.jsonPos} || 0`),e.const(lt.default.jsonLen,(0,Me._)`${lt.default.json}.length`),px(t),Hq(t),e.if(lt.default.jsonPart,()=>{e.assign((0,Me._)`${r}.position`,lt.default.jsonPos),e.return(lt.default.data)}),e.if((0,Me._)`${lt.default.jsonPos} === ${lt.default.jsonLen}`,()=>e.return(lt.default.data)),lm(t)})}function px(t){let e;for(let r of Ott.jtdForms)if(r in t.schema){e=r;break}e?Utt(t,Ltt[e]):zq(t)}var Mtt=Mle(!0,Mle(!1,lm));function Utt(t,e){let{gen:r,schema:n,data:i}=t;if(!n.nullable)return e(t);sv(t,"null",e,()=>r.assign(i,null))}function Ftt(t){let{gen:e,schema:r,data:n}=t;Vo(t,"[");let i=e.let("i",0);e.assign(n,(0,Me._)`[]`),Bq(t,"]",()=>{let s=e.let("el");px({...t,schema:r.elements,data:s}),e.assign((0,Me._)`${n}[${i}++]`,s)})}function jtt(t){let{gen:e,schema:r,data:n}=t;Vo(t,"{"),e.assign(n,(0,Me._)`{}`),Bq(t,"}",()=>qtt(t,r.values))}function Bq(t,e,r){qle(t,e,r),Vo(t,e)}function qle(t,e,r){let{gen:n}=t;n.for((0,Me._)`;${lt.default.jsonPos}<${lt.default.jsonLen} && ${hx(1)}!==${e};`,()=>{r(),sv(t,",",()=>n.break(),i)});function i(){sv(t,e,()=>{},lm)}}function qtt(t,e){let{gen:r}=t,n=r.let("key");df({...t,data:n}),Vo(t,":"),zle(t,n,e)}function Btt(t){let{gen:e,data:r,schema:n}=t,{discriminator:i,mapping:s}=n;Vo(t,"{"),e.assign(r,(0,Me._)`{}`);let o=e.const("pos",lt.default.jsonPos),a=e.let("value"),c=e.let("tag");qle(t,"}",()=>{let l=e.let("key");df({...t,data:l}),Vo(t,":"),e.if((0,Me._)`${l} === ${i}`,()=>{df({...t,data:c}),e.assign((0,Me._)`${r}[${l}]`,c),e.break()},()=>zq({...t,data:a}))}),e.assign(lt.default.jsonPos,o),e.if((0,Me._)`${c} === undefined`),cc(t,(0,Me.str)`discriminator tag not found`);for(let l in s)e.elseIf((0,Me._)`${c} === ${l}`),Ble({...t,schema:s[l]},i);e.else(),cc(t,(0,Me.str)`discriminator value not in schema`),e.endIf()}function Lle(t){let{gen:e,data:r}=t;Vo(t,"{"),e.assign(r,(0,Me._)`{}`),Ble(t)}function Ble(t,e){let{gen:r,schema:n,data:i}=t,{properties:s,optionalProperties:o,additionalProperties:a}=n;if(Bq(t,"}",()=>{let c=r.let("key");if(df({...t,data:c}),Vo(t,":"),r.if(!1),Dle(t,c,s),Dle(t,c,o),e){r.elseIf((0,Me._)`${c} === ${e}`);let l=r.let("tag");df({...t,data:l})}r.else(),a?zq({...t,data:(0,Me._)`${i}[${c}]`}):cc(t,(0,Me.str)`property ${c} not allowed`),r.endIf()}),s){let c=(0,Ctt.hasPropFunc)(r),l=(0,Me.and)(...Object.keys(s).map(u=>(0,Me._)`${c}.call(${i}, ${u})`));r.if((0,Me.not)(l),()=>cc(t,(0,Me.str)`missing required properties`))}}function Dle(t,e,r={}){let{gen:n}=t;for(let i in r)n.elseIf((0,Me._)`${e} === ${i}`),zle(t,e,r[i])}function zle(t,e,r){px({...t,schema:r,data:(0,Me._)`${t.data}[${e}]`})}function ztt(t){let{gen:e,schema:r,data:n,self:i}=t;switch(r.type){case"boolean":Mtt(t);break;case"string":df(t);break;case"timestamp":{df(t);let s=(0,Fle.useFunc)(e,$tt.default),{allowDate:o,parseDate:a}=i.opts,c=o?(0,Me._)`!${s}(${n}, true)`:(0,Me._)`!${s}(${n})`,l=a?(0,Me.or)(c,(0,Me._)`(${n} = new Date(${n}), false)`,(0,Me._)`isNaN(${n}.valueOf())`):c;e.if(l,()=>cc(t,(0,Me.str)`invalid timestamp`));break}case"float32":case"float64":Fq(t);break;default:{let s=r.type;if(!i.opts.int32range&&(s==="int32"||s==="uint32"))Fq(t,16),s==="uint32"&&e.if((0,Me._)`${n} < 0`,()=>cc(t,(0,Me.str)`integer out of range`));else{let[o,a,c]=ktt.intRange[s];Fq(t,c),e.if((0,Me._)`${n} < ${o} || ${n} > ${a}`,()=>cc(t,(0,Me.str)`integer out of range`))}}}}function df(t){Vo(t,'"'),Vq(t,qq.parseJsonString)}function Vtt(t){let{gen:e,data:r,schema:n}=t,i=n.enum;Vo(t,'"'),e.if(!1);for(let s of i){let o=JSON.stringify(s).slice(1);e.elseIf((0,Me._)`${hx(o.length)} === ${o}`),e.assign(r,(0,Me.str)`${s}`),e.add(lt.default.jsonPos,o.length)}e.else(),lm(t),e.endIf()}function Fq(t,e){let{gen:r}=t;Hq(t),r.if((0,Me._)`"-0123456789".indexOf(${hx(1)}) < 0`,()=>lm(t),()=>Vq(t,qq.parseJsonNumber,e))}function Mle(t,e){return r=>{let{gen:n,data:i}=r;sv(r,`${t}`,()=>e(r),()=>n.assign(i,t))}}function Htt(t){let{gen:e,self:r,definitions:n,schema:i,schemaEnv:s}=t,{ref:o}=i,a=n[o];if(!a)throw new Ptt.default(r.opts.uriResolver,"",o,`No definition ${o}`);if(!(0,Ntt.hasRef)(a))return px({...t,schema:a});let{root:c}=s,l=jle.call(r,new Ule.SchemaEnv({schema:a,root:c}),n);Vle(t,Gtt(e,l),!0)}function Gtt(t,e){return e.parse?t.scopeValue("parse",{ref:e.parse}):(0,Me._)`${t.scopeValue("wrapper",{ref:e})}.parse`}function zq(t){Vq(t,qq.parseJson)}function Vq(t,e,r){Vle(t,(0,Fle.useFunc)(t.gen,e),r)}function Vle(t,e,r){let{gen:n,data:i}=t;n.assign(i,(0,Me._)`${e}(${lt.default.json}, ${lt.default.jsonPos}${r?(0,Me._)`, ${r}`:Me.nil})`),n.assign(lt.default.jsonPos,(0,Me._)`${e}.position`),n.if((0,Me._)`${i} === undefined`,()=>cc(t,(0,Me._)`${e}.message`))}function Vo(t,e){sv(t,e,lm)}function sv(t,e,r,n){let{gen:i}=t,s=e.length;Hq(t),i.if((0,Me._)`${hx(s)} === ${e}`,()=>{i.add(lt.default.jsonPos,s),n?.(t)},()=>r(t))}function Hq({gen:t,char:e}){t.code((0,Me._)`while((${e}=${lt.default.json}[${lt.default.jsonPos}],${e}===" "||${e}==="\\n"||${e}==="\\r"||${e}==="\\t"))${lt.default.jsonPos}++;`)}function hx(t){return t===1?(0,Me._)`${lt.default.json}[${lt.default.jsonPos}]`:(0,Me._)`${lt.default.json}.slice(${lt.default.jsonPos}, ${lt.default.jsonPos}+${t})`}function lm(t){cc(t,(0,Me._)`"unexpected token " + ${lt.default.json}[${lt.default.jsonPos}]`)}function cc({gen:t,parseName:e},r){t.assign((0,Me._)`${e}.message`,r),t.assign((0,Me._)`${e}.position`,lt.default.jsonPos),t.return(jq)}});var Kq=E((Zt,Yq)=>{"use strict";Object.defineProperty(Zt,"__esModule",{value:!0});Zt.MissingRefError=Zt.ValidationError=Zt.CodeGen=Zt.Name=Zt.nil=Zt.stringify=Zt.str=Zt._=Zt.KeywordCxt=Zt.Ajv=void 0;var Wtt=Ij(),Ytt=Ele(),Ktt=wle(),Jtt=Nle(),Ztt=Hle(),Wq="JTD-meta-schema",um=class extends Wtt.default{constructor(e={}){super({...e,jtd:!0})}_addVocabularies(){super._addVocabularies(),this.addVocabulary(Ytt.default)}_addDefaultMetaSchema(){super._addDefaultMetaSchema(),this.opts.meta&&this.addMetaSchema(Ktt.default,Wq,!1)}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(Wq)?Wq:void 0)}compileSerializer(e){let r=this._addSchema(e);return r.serialize||this._compileSerializer(r)}compileParser(e){let r=this._addSchema(e);return r.parse||this._compileParser(r)}_compileSerializer(e){if(Jtt.default.call(this,e,e.schema.definitions||{}),!e.serialize)throw new Error("ajv implementation error");return e.serialize}_compileParser(e){if(Ztt.default.call(this,e,e.schema.definitions||{}),!e.parse)throw new Error("ajv implementation error");return e.parse}};Zt.Ajv=um;Yq.exports=Zt=um;Yq.exports.Ajv=um;Object.defineProperty(Zt,"__esModule",{value:!0});Zt.default=um;var Xtt=Yh();Object.defineProperty(Zt,"KeywordCxt",{enumerable:!0,get:function(){return Xtt.KeywordCxt}});var dm=Fe();Object.defineProperty(Zt,"_",{enumerable:!0,get:function(){return dm._}});Object.defineProperty(Zt,"str",{enumerable:!0,get:function(){return dm.str}});Object.defineProperty(Zt,"stringify",{enumerable:!0,get:function(){return dm.stringify}});Object.defineProperty(Zt,"nil",{enumerable:!0,get:function(){return dm.nil}});Object.defineProperty(Zt,"Name",{enumerable:!0,get:function(){return dm.Name}});Object.defineProperty(Zt,"CodeGen",{enumerable:!0,get:function(){return dm.CodeGen}});var Qtt=FE();Object.defineProperty(Zt,"ValidationError",{enumerable:!0,get:function(){return Qtt.default}});var ert=rc();Object.defineProperty(Zt,"MissingRefError",{enumerable:!0,get:function(){return ert.default}})});var Jq=E((QKt,Gle)=>{"use strict";var trt=GR();Gle.exports=Object.freeze({coerceTypes:"array",useDefaults:!0,removeAdditional:!0,uriResolver:trt,addUsedSchema:!1,allErrors:!1})});var mx=E(Go=>{"use strict";Object.defineProperty(Go,"__esModule",{value:!0});Go.formatNames=Go.fastFormats=Go.fullFormats=void 0;function Ho(t,e){return{validate:t,compare:e}}Go.fullFormats={date:Ho(Jle,e2),time:Ho(Xq(!0),t2),"date-time":Ho(Wle(!0),Xle),"iso-time":Ho(Xq(),Zle),"iso-date-time":Ho(Wle(),Qle),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:art,"uri-reference":/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,"uri-template":/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,url:/^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/,ipv6:/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,regex:hrt,uuid:/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,"json-pointer":/^(?:\/(?:[^~/]|~0|~1)*)*$/,"json-pointer-uri-fragment":/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,"relative-json-pointer":/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,byte:crt,int32:{type:"number",validate:drt},int64:{type:"number",validate:frt},float:{type:"number",validate:Kle},double:{type:"number",validate:Kle},password:!0,binary:!0};Go.fastFormats={...Go.fullFormats,date:Ho(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,e2),time:Ho(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,t2),"date-time":Ho(/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,Xle),"iso-time":Ho(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,Zle),"iso-date-time":Ho(/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,Qle),uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i};Go.formatNames=Object.keys(Go.fullFormats);function rrt(t){return t%4===0&&(t%100!==0||t%400===0)}var nrt=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,irt=[0,31,28,31,30,31,30,31,31,30,31,30,31];function Jle(t){let e=nrt.exec(t);if(!e)return!1;let r=+e[1],n=+e[2],i=+e[3];return n>=1&&n<=12&&i>=1&&i<=(n===2&&rrt(r)?29:irt[n])}function e2(t,e){if(t&&e)return t>e?1:t<e?-1:0}var Zq=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function Xq(t){return function(r){let n=Zq.exec(r);if(!n)return!1;let i=+n[1],s=+n[2],o=+n[3],a=n[4],c=n[5]==="-"?-1:1,l=+(n[6]||0),u=+(n[7]||0);if(l>23||u>59||t&&!a)return!1;if(i<=23&&s<=59&&o<60)return!0;let d=s-u*c,f=i-l*c-(d<0?1:0);return(f===23||f===-1)&&(d===59||d===-1)&&o<61}}function t2(t,e){if(!(t&&e))return;let r=new Date("2020-01-01T"+t).valueOf(),n=new Date("2020-01-01T"+e).valueOf();if(r&&n)return r-n}function Zle(t,e){if(!(t&&e))return;let r=Zq.exec(t),n=Zq.exec(e);if(r&&n)return t=r[1]+r[2]+r[3],e=n[1]+n[2]+n[3],t>e?1:t<e?-1:0}var Qq=/t|\s/i;function Wle(t){let e=Xq(t);return function(n){let i=n.split(Qq);return i.length===2&&Jle(i[0])&&e(i[1])}}function Xle(t,e){if(!(t&&e))return;let r=new Date(t).valueOf(),n=new Date(e).valueOf();if(r&&n)return r-n}function Qle(t,e){if(!(t&&e))return;let[r,n]=t.split(Qq),[i,s]=e.split(Qq),o=e2(r,i);if(o!==void 0)return o||t2(n,s)}var srt=/\/|:/,ort=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;function art(t){return srt.test(t)&&ort.test(t)}var Yle=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function crt(t){return Yle.lastIndex=0,Yle.test(t)}var lrt=-(2**31),urt=2**31-1;function drt(t){return Number.isInteger(t)&&t<=urt&&t>=lrt}function frt(t){return Number.isInteger(t)}function Kle(){return!0}var prt=/[^\\]\\Z/;function hrt(t){if(prt.test(t))return!1;try{return new RegExp(t),!0}catch{return!1}}});var eue=E(fm=>{"use strict";Object.defineProperty(fm,"__esModule",{value:!0});fm.formatLimitDefinition=void 0;var mrt=ax(),Zs=Fe(),Gl=Zs.operators,gx={formatMaximum:{okStr:"<=",ok:Gl.LTE,fail:Gl.GT},formatMinimum:{okStr:">=",ok:Gl.GTE,fail:Gl.LT},formatExclusiveMaximum:{okStr:"<",ok:Gl.LT,fail:Gl.GTE},formatExclusiveMinimum:{okStr:">",ok:Gl.GT,fail:Gl.LTE}},grt={message:({keyword:t,schemaCode:e})=>(0,Zs.str)`should be ${gx[t].okStr} ${e}`,params:({keyword:t,schemaCode:e})=>(0,Zs._)`{comparison: ${gx[t].okStr}, limit: ${e}}`};fm.formatLimitDefinition={keyword:Object.keys(gx),type:"string",schemaType:"string",$data:!0,error:grt,code(t){let{gen:e,data:r,schemaCode:n,keyword:i,it:s}=t,{opts:o,self:a}=s;if(!o.validateFormats)return;let c=new mrt.KeywordCxt(s,a.RULES.all.format.definition,"format");c.$data?l():u();function l(){let f=e.scopeValue("formats",{ref:a.formats,code:o.code.formats}),p=e.const("fmt",(0,Zs._)`${f}[${c.schemaCode}]`);t.fail$data((0,Zs.or)((0,Zs._)`typeof ${p} != "object"`,(0,Zs._)`${p} instanceof RegExp`,(0,Zs._)`typeof ${p}.compare != "function"`,d(p)))}function u(){let f=c.schema,p=a.formats[f];if(!p||p===!0)return;if(typeof p!="object"||p instanceof RegExp||typeof p.compare!="function")throw new Error(`"${i}": format "${f}" does not define "compare" function`);let h=e.scopeValue("formats",{key:f,ref:p,code:o.code.formats?(0,Zs._)`${o.code.formats}${(0,Zs.getProperty)(f)}`:void 0});t.fail$data(d(h))}function d(f){return(0,Zs._)`${f}.compare(${r}, ${n}) ${gx[i].fail} 0`}},dependencies:["format"]};var _rt=t=>(t.addKeyword(fm.formatLimitDefinition),t);fm.default=_rt});var i2=E((ov,nue)=>{"use strict";Object.defineProperty(ov,"__esModule",{value:!0});var pm=mx(),yrt=eue(),r2=Fe(),tue=new r2.Name("fullFormats"),Srt=new r2.Name("fastFormats"),n2=(t,e={keywords:!0})=>{if(Array.isArray(e))return rue(t,e,pm.fullFormats,tue),t;let[r,n]=e.mode==="fast"?[pm.fastFormats,Srt]:[pm.fullFormats,tue],i=e.formats||pm.formatNames;return rue(t,i,r,n),e.keywords&&(0,yrt.default)(t),t};n2.get=(t,e="full")=>{let n=(e==="fast"?pm.fastFormats:pm.fullFormats)[t];if(!n)throw new Error(`Unknown format "${t}"`);return n};function rue(t,e,r,n){var i,s;(i=(s=t.opts.code).formats)!==null&&i!==void 0||(s.formats=(0,r2._)`require("ajv-formats/dist/formats").${n}`);for(let o of e)t.addFormat(o,r[o])}nue.exports=ov=n2;Object.defineProperty(ov,"__esModule",{value:!0});ov.default=n2});var oue=E((r5t,sue)=>{"use strict";var Ert=ax().default,vrt=Kq(),iue=Jq(),s2=class{constructor(e,r){r.mode==="JTD"?this.ajv=new vrt(Object.assign({},iue,r.customOptions)):this.ajv=new Ert(Object.assign({},iue,r.customOptions));let n=!0;if(r.plugins&&r.plugins.length>0)for(let s of r.plugins)Array.isArray(s)?(n=n&&s[0].name!=="formatsPlugin",s[0](this.ajv,s[1])):(n=n&&s.name!=="formatsPlugin",s(this.ajv));n&&i2()(this.ajv),r.onCreate?.(this.ajv);let i=Object.values(e);for(let s of i)this.ajv.addSchema(s)}buildValidatorFunction({schema:e}){if(e.$id){let r=this.ajv.getSchema(e.$id);if(r)return r}return this.ajv.compile(e)}};sue.exports=s2});var cue=E((n5t,aue)=>{"use strict";var brt=Kq(),Trt=Jq(),o2=class{constructor(e,r){this.ajv=new brt(Object.assign({},Trt,r))}buildSerializerFunction({schema:e}){return this.ajv.compileSerializer(e)}};aue.exports=o2});var due=E((cv,uue)=>{"use strict";Object.defineProperty(cv,"__esModule",{value:!0});var av=NR(),Xs=jh();function lue(t,e){if(!t.opts.code.source)throw new Error("moduleCode: ajv instance must have code.source option");let{_n:r}=t.scope.opts;return typeof e=="function"?i(e.source):e!==void 0?s(e,n):s(t.schemas,a=>a.meta?void 0:t.compile(a.schema));function n(a){let c=t.getSchema(a);if(!c)throw new Error(`moduleCode: no schema with id ${a}`);return c}function i(a){let c={},l=a?.validateName,u=o(c,a);return t.opts.code.esm?`"use strict";${r}export const validate = ${l};${r}export default ${l};${r}${u}`:`"use strict";${r}module.exports = ${l};${r}module.exports.default = ${l};${r}${u}`}function s(a,c){var l;let u={},d=(0,Xs._)`"use strict";`;for(let f in a){let p=c(a[f]);if(p){let h=o(u,p.source),m=t.opts.code.esm?(0,Xs._)`export const ${(0,Xs.getEsmExportName)(f)}`:(0,Xs._)`exports${(0,Xs.getProperty)(f)}`;d=(0,Xs._)`${d}${r}${m} = ${(l=p.source)===null||l===void 0?void 0:l.validateName};${r}${h}`}}return`${d}`}function o(a,c){if(!c)throw new Error('moduleCode: function does not have "source" property');if(f(c.validateName)===av.UsedValueState.Completed)return Xs.nil;p(c.validateName,av.UsedValueState.Started);let l=t.scope.scopeCode(c.scopeValues,a,d),u=new Xs._Code(`${l}${r}${c.validateCode}`);return c.evaluated?(0,Xs._)`${u}${c.validateName}.evaluated = ${c.evaluated};${r}`:u;function d(h){var m;let _=(m=h.value)===null||m===void 0?void 0:m.ref;if(h.prefix==="validate"&&typeof _=="function")return o(a,_.source);if((h.prefix==="root"||h.prefix==="wrapper")&&typeof _=="object"){let{validate:y,validateName:v}=_;if(!v)throw new Error("ajv internal error");let S=t.opts.code.es5?av.varKinds.var:av.varKinds.const,g=(0,Xs._)`${S} ${h} = {validate: ${v}};`;if(f(v)===av.UsedValueState.Started)return g;let T=o(a,y?.source);return(0,Xs._)`${g}${r}${T}`}}function f(h){var m;return(m=a[h.prefix])===null||m===void 0?void 0:m.get(h)}function p(h,m){let{prefix:_}=h;(a[_]=a[_]||new Map).set(h,m)}}}uue.exports=cv=lue;Object.defineProperty(cv,"__esModule",{value:!0});cv.default=lue});var hue=E((i5t,pue)=>{"use strict";var fue=a2(),wrt=due().default;function Art(t={readMode:!0}){if(t.readMode===!0&&!t.restoreFunction)throw new Error("You must provide a restoreFunction options when readMode ON");if(t.readMode!==!0&&!t.storeFunction)throw new Error("You must provide a storeFunction options when readMode OFF");if(t.readMode===!0)return function(){return function(n){return t.restoreFunction(n)}};let e=fue();return function(n,i={}){(!i.customOptions||!i.customOptions.code)&&(i.customOptions=Object.assign({},i.customOptions,{code:{source:!0}}));let s=e(n,i);return function(o){let a=s(o),c=wrt(s[fue.AjvReference].ajv,a);return t.storeFunction(o,c),a}}}pue.exports=Art});var a2=E((s5t,hm)=>{"use strict";var gue=Symbol.for("fastify.ajv-compiler.reference"),Rrt=oue(),xrt=cue();function c2(t){let e=new Map,r=new Map;return t&&t.jtdSerializer===!0?function(i,s){let o=mue({},s);if(r.has(o))return r.get(o);let a=new xrt(i,s),c=a.buildSerializerFunction.bind(a);return r.set(o,c),c}:function(i,s){let o=mue(i,s.customOptions);if(e.has(o))return e.get(o);let a=new Rrt(i,s),c=a.buildValidatorFunction.bind(a);return e.set(o,c),s.customOptions.code!==void 0&&(c[gue]=a),c}}function mue(t,e){let r=JSON.stringify(t),n=JSON.stringify(e);return`${r}${n}`}hm.exports=c2;hm.exports.default=c2;hm.exports.AjvCompiler=c2;hm.exports.AjvReference=gue;hm.exports.StandaloneValidator=hue()});var _x=E(Sue=>{"use strict";var _ue=Object.prototype.hasOwnProperty;function yue(t,e,r){for(r of t.keys())if(lv(r,e))return r}function lv(t,e){var r,n,i;if(t===e)return!0;if(t&&e&&(r=t.constructor)===e.constructor){if(r===Date)return t.getTime()===e.getTime();if(r===RegExp)return t.toString()===e.toString();if(r===Array){if((n=t.length)===e.length)for(;n--&&lv(t[n],e[n]););return n===-1}if(r===Set){if(t.size!==e.size)return!1;for(n of t)if(i=n,i&&typeof i=="object"&&(i=yue(e,i),!i)||!e.has(i))return!1;return!0}if(r===Map){if(t.size!==e.size)return!1;for(n of t)if(i=n[0],i&&typeof i=="object"&&(i=yue(e,i),!i)||!lv(n[1],e.get(i)))return!1;return!0}if(r===ArrayBuffer)t=new Uint8Array(t),e=new Uint8Array(e);else if(r===DataView){if((n=t.byteLength)===e.byteLength)for(;n--&&t.getInt8(n)===e.getInt8(n););return n===-1}if(ArrayBuffer.isView(t)){if((n=t.byteLength)===e.byteLength)for(;n--&&t[n]===e[n];);return n===-1}if(!r||typeof t=="object"){n=0;for(r in t)if(_ue.call(t,r)&&++n&&!_ue.call(e,r)||!(r in e)||!lv(t[r],e[r]))return!1;return Object.keys(e).length===n}}return t!==t&&e!==e}Sue.dequal=lv});var Tue=E((a5t,bue)=>{"use strict";var{dequal:Eue}=_x(),Irt=Symbol.for("json-schema-ref"),l2=class{#e;#r;#t;#n;#s;constructor(e={}){this.#e={},this.#r={},this.#t=e.insertRefSymbol??!1,this.#n=e.allowEqualDuplicates??!0,this.#s=e.cloneSchemaWithoutRefs??!1}addSchema(e,r,n=!0){n&&(e.$id!==void 0&&e.$id.charAt(0)!=="#"?r=e.$id:this.#c(e,r));let i=e.$id;i!==void 0&&typeof i=="string"&&(i.charAt(0)==="#"?this.#u(e,r,i):(this.#c(e,i),r=i));let s=e.$ref;if(s!==void 0&&typeof s=="string"){let{refSchemaId:o,refJsonPointer:a}=this.#i(s,r);this.#e[r].refs.push({schemaId:o,jsonPointer:a})}for(let o in e)typeof e[o]=="object"&&e[o]!==null&&this.addSchema(e[o],r,!1)}getSchema(e,r="#"){let n=this.#e[e];if(n===void 0)throw new Error(`Cannot resolve ref "${e}${r}". Schema with id "${e}" is not found.`);return n.anchors[r]!==void 0?n.anchors[r]:vue(n.schema,r)}hasSchema(e){return this.#e[e]!==void 0}getSchemaRefs(e){let r=this.#e[e];if(r===void 0)throw new Error(`Schema with id "${e}" is not found.`);return r.refs}getSchemaDependencies(e,r={}){let n=this.#e[e];for(let i of n.refs){let s=i.schemaId;s===e||r[s]!==void 0||(r[s]=this.getSchema(s),this.getSchemaDependencies(s,r))}return r}derefSchema(e){if(this.#r[e]!==void 0)return;let r=this.#e[e];if(r===void 0)throw new Error(`Schema with id "${e}" is not found.`);!this.#s&&r.refs.length===0&&(this.#r[e]={schema:r.schema,anchors:r.anchors});let n=[];this.#o(r.schema,e,!0,n);let i=this.getSchemaDependencies(e);for(let s in i){let o=i[s];this.#o(o,s,!0,n)}for(let s of n){let{refSchemaId:o,refJsonPointer:a}=this.#i(s.ref,s.sourceSchemaId),c=this.getDerefSchema(o,a);if(c===null)throw new Error(`Cannot resolve ref "${s.ref}". Ref "${a}" is not found in schema "${o}".`);s.targetSchema=c,s.targetSchemaId=o}for(let s of n)this.#a(s,n)}getDerefSchema(e,r="#"){let n=this.#r[e];return n===void 0&&(this.derefSchema(e),n=this.#r[e]),n.anchors[r]!==void 0?n.anchors[r]:vue(n.schema,r)}#i(e,r){let n=e.indexOf("#");return n===-1?{refSchemaId:e,refJsonPointer:"#"}:n===0?{refSchemaId:r,refJsonPointer:e}:{refSchemaId:e.slice(0,n),refJsonPointer:e.slice(n)}}#o(e,r,n,i=[]){let s=Array.isArray(e)?[...e]:{...e};n&&(e.$id!==void 0&&e.$id.charAt(0)!=="#"?r=e.$id:this.#l(s,r));let o=s.$id;o!==void 0&&typeof o=="string"&&(o.charAt(0)==="#"?this.#d(s,r,o):(this.#l(s,o),r=o)),s.$ref!==void 0&&i.push({ref:s.$ref,sourceSchemaId:r,sourceSchema:s});for(let a in s){let c=s[a];typeof c=="object"&&c!==null&&(s[a]=this.#o(c,r,!1,i))}return s}#a(e,r){let{sourceSchema:n,targetSchema:i}=e;if(n.$ref){if(this.#t&&(n[Irt]=n.$ref),delete n.$ref,i.$ref){let s=r.find(o=>o.sourceSchema===i);this.#a(s,r)}for(let s in i)if(s!=="$id"){if(n[s]!==void 0){if(Eue(n[s],i[s]))continue;throw new Error(`Cannot resolve ref "${e.ref}". Property "${s}" already exists in schema "${e.sourceSchemaId}".`)}n[s]=i[s]}e.isResolved=!0}}#c(e,r){let n=this.#e[r];if(n!==void 0){if(this.#n&&Eue(e,n.schema))return;throw new Error(`There is already another schema with id "${r}".`)}this.#e[r]={schema:e,anchors:{},refs:[]}}#u(e,r,n){let{anchors:i}=this.#e[r];if(i[n]!==void 0)throw new Error(`There is already another anchor "${n}" in schema "${r}".`);i[n]=e}#l(e,r){this.#r[r]===void 0&&(this.#r[r]={schema:e,anchors:{}})}#d(e,r,n){let{anchors:i}=this.#r[r];i[n]=e}};function vue(t,e){let r=e.split("/"),n=t;for(let i of r)if(!(i===""||i==="#")){if(typeof n!="object"||n===null)return null;n=n[i]}return n??null}bue.exports={RefResolver:l2}});var d2=E((c5t,wue)=>{"use strict";var Ort=ax(),Prt=GR(),Crt=i2(),Nrt=iR()({proto:!0}),u2=class t{constructor(e){this.ajv=new Ort({...e,strictSchema:!1,validateSchema:!1,allowUnionTypes:!0,uriResolver:Prt}),Crt(this.ajv),this.ajv.addKeyword({keyword:"fjs_type",type:"object",errors:!1,validate:(r,n)=>n&&typeof n.toJSON=="function"}),this._ajvSchemas={},this._ajvOptions=e||{}}addSchema(e,r){let n=e.$id||r;if(e.$id!==void 0&&e.$id[0]==="#"&&(n=r+e.$id),this.ajv.refs[n]===void 0&&this.ajv.schemas[n]===void 0){let i=Nrt(e);this.convertSchemaToAjvFormat(i),this.ajv.addSchema(i,n),this._ajvSchemas[n]=e}}validate(e,r){return this.ajv.validate(e,r)}convertSchemaToAjvFormat(e){if(e!==null){e.type==="string"?(e.fjs_type="string",e.type=["string","object"]):Array.isArray(e.type)&&e.type.includes("string")&&!e.type.includes("object")&&(e.fjs_type="string",e.type.push("object"));for(let r in e)typeof e[r]=="object"&&this.convertSchemaToAjvFormat(e[r])}}getState(){return{ajvOptions:this._ajvOptions,ajvSchemas:this._ajvSchemas}}static restoreFromState(e){let r=new t(e.ajvOptions);for(let[n,i]of Object.entries(e.ajvSchemas))r.ajv.addSchema(i,n);return r}};wue.exports=u2});var Rue=E((l5t,Aue)=>{"use strict";var f2=class t{constructor(e,r,n="#"){this.schema=e,this.schemaId=r,this.jsonPointer=n}getPropertyLocation(e){return new t(this.schema[e],this.schemaId,this.jsonPointer+"/"+e)}getSchemaRef(){return this.schemaId+this.jsonPointer}};Aue.exports=f2});var Cue=E((u5t,h2)=>{"use strict";h2.exports=_e;h2.exports.default=_e;var krt={$schema:"http://json-schema.org/draft-07/schema#",$id:"http://json-schema.org/draft-07/schema#",title:"Core schema meta-schema",definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},default:!0},xue={enum:["array","boolean","integer","null","number","object","string"]},Iue=/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,$rt=mx().fullFormats.uri,Oue=mx().fullFormats.regex;function ds(t,{instancePath:e="",parentData:r,parentDataProperty:n,rootData:i=t}={}){let s=null,o=0,a=o;return typeof t=="number"&&!(t%1)&&!isNaN(t)&&isFinite(t)?o===a&&typeof t=="number"&&isFinite(t)&&(t<0||isNaN(t))?(ds.errors=[{instancePath:e,schemaPath:"#/definitions/nonNegativeInteger/minimum",keyword:"minimum",params:{comparison:">=",limit:0},message:"must be >= 0"}],!1):(ds.errors=s,o===0):(ds.errors=[{instancePath:e,schemaPath:"#/definitions/nonNegativeInteger/type",keyword:"type",params:{type:"integer"},message:"must be integer"}],!1)}var p2={validate:_e};function Hn(t,{instancePath:e="",parentData:r,parentDataProperty:n,rootData:i=t}={}){let s=null,o=0;if(o===0)if(Array.isArray(t)){if(t.length<1)return Hn.errors=[{instancePath:e,schemaPath:"#/minItems",keyword:"minItems",params:{limit:1},message:"must NOT have fewer than 1 items"}],!1;{var a=!0;let c=t.length;for(let l=0;l<c;l++){let u=o;p2.validate(t[l],{instancePath:e+"/"+l,parentData:t,parentDataProperty:l,rootData:i})||(s=s===null?p2.validate.errors:s.concat(p2.validate.errors),o=s.length);var a=u===o;if(!a)break}}}else return Hn.errors=[{instancePath:e,schemaPath:"#/type",keyword:"type",params:{type:"array"},message:"must be array"}],!1;return Hn.errors=s,o===0}var Pue=KE().default;function _e(t,{instancePath:e="",parentData:r,parentDataProperty:n,rootData:i=t}={}){let s=null,o=0;if(!(t&&typeof t=="object"&&!Array.isArray(t))&&typeof t!="boolean")return _e.errors=[{instancePath:e,schemaPath:"#/type",keyword:"type",params:{type:krt.type},message:"must be object,boolean"}],!1;if(o===0&&t&&typeof t=="object"&&!Array.isArray(t)){if(t.$id!==void 0){let S=t.$id,g=o;if(o===g&&o===g)if(typeof S=="string"){if(!Iue.test(S))return _e.errors=[{instancePath:e+"/$id",schemaPath:"#/properties/%24id/format",keyword:"format",params:{format:"uri-reference"},message:'must match format "uri-reference"'}],!1}else return _e.errors=[{instancePath:e+"/$id",schemaPath:"#/properties/%24id/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var a=g===o}else var a=!0;if(a){if(t.$schema!==void 0){let S=t.$schema,g=o;if(o===g&&o===g)if(typeof S=="string"){if(!$rt(S))return _e.errors=[{instancePath:e+"/$schema",schemaPath:"#/properties/%24schema/format",keyword:"format",params:{format:"uri"},message:'must match format "uri"'}],!1}else return _e.errors=[{instancePath:e+"/$schema",schemaPath:"#/properties/%24schema/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var a=g===o}else var a=!0;if(a){if(t.$ref!==void 0){let S=t.$ref,g=o;if(o===g&&o===g)if(typeof S=="string"){if(!Iue.test(S))return _e.errors=[{instancePath:e+"/$ref",schemaPath:"#/properties/%24ref/format",keyword:"format",params:{format:"uri-reference"},message:'must match format "uri-reference"'}],!1}else return _e.errors=[{instancePath:e+"/$ref",schemaPath:"#/properties/%24ref/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var a=g===o}else var a=!0;if(a){if(t.$comment!==void 0){let S=o;if(typeof t.$comment!="string")return _e.errors=[{instancePath:e+"/$comment",schemaPath:"#/properties/%24comment/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var a=S===o}else var a=!0;if(a){if(t.title!==void 0){let S=o;if(typeof t.title!="string")return _e.errors=[{instancePath:e+"/title",schemaPath:"#/properties/title/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var a=S===o}else var a=!0;if(a){if(t.description!==void 0){let S=o;if(typeof t.description!="string")return _e.errors=[{instancePath:e+"/description",schemaPath:"#/properties/description/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var a=S===o}else var a=!0;if(a){if(t.readOnly!==void 0){let S=o;if(typeof t.readOnly!="boolean")return _e.errors=[{instancePath:e+"/readOnly",schemaPath:"#/properties/readOnly/type",keyword:"type",params:{type:"boolean"},message:"must be boolean"}],!1;var a=S===o}else var a=!0;if(a){if(t.examples!==void 0){let S=o;if(o===S&&!Array.isArray(t.examples))return _e.errors=[{instancePath:e+"/examples",schemaPath:"#/properties/examples/type",keyword:"type",params:{type:"array"},message:"must be array"}],!1;var a=S===o}else var a=!0;if(a){if(t.multipleOf!==void 0){let S=t.multipleOf,g=o;if(o===g)if(typeof S=="number"&&isFinite(S)){if(S<=0||isNaN(S))return _e.errors=[{instancePath:e+"/multipleOf",schemaPath:"#/properties/multipleOf/exclusiveMinimum",keyword:"exclusiveMinimum",params:{comparison:">",limit:0},message:"must be > 0"}],!1}else return _e.errors=[{instancePath:e+"/multipleOf",schemaPath:"#/properties/multipleOf/type",keyword:"type",params:{type:"number"},message:"must be number"}],!1;var a=g===o}else var a=!0;if(a){if(t.maximum!==void 0){let S=t.maximum,g=o;if(!(typeof S=="number"&&isFinite(S)))return _e.errors=[{instancePath:e+"/maximum",schemaPath:"#/properties/maximum/type",keyword:"type",params:{type:"number"},message:"must be number"}],!1;var a=g===o}else var a=!0;if(a){if(t.exclusiveMaximum!==void 0){let S=t.exclusiveMaximum,g=o;if(!(typeof S=="number"&&isFinite(S)))return _e.errors=[{instancePath:e+"/exclusiveMaximum",schemaPath:"#/properties/exclusiveMaximum/type",keyword:"type",params:{type:"number"},message:"must be number"}],!1;var a=g===o}else var a=!0;if(a){if(t.minimum!==void 0){let S=t.minimum,g=o;if(!(typeof S=="number"&&isFinite(S)))return _e.errors=[{instancePath:e+"/minimum",schemaPath:"#/properties/minimum/type",keyword:"type",params:{type:"number"},message:"must be number"}],!1;var a=g===o}else var a=!0;if(a){if(t.exclusiveMinimum!==void 0){let S=t.exclusiveMinimum,g=o;if(!(typeof S=="number"&&isFinite(S)))return _e.errors=[{instancePath:e+"/exclusiveMinimum",schemaPath:"#/properties/exclusiveMinimum/type",keyword:"type",params:{type:"number"},message:"must be number"}],!1;var a=g===o}else var a=!0;if(a){if(t.maxLength!==void 0){let S=t.maxLength,g=o,T=o;if(!(typeof S=="number"&&!(S%1)&&!isNaN(S)&&isFinite(S)))return _e.errors=[{instancePath:e+"/maxLength",schemaPath:"#/definitions/nonNegativeInteger/type",keyword:"type",params:{type:"integer"},message:"must be integer"}],!1;if(o===T&&typeof S=="number"&&isFinite(S)&&(S<0||isNaN(S)))return _e.errors=[{instancePath:e+"/maxLength",schemaPath:"#/definitions/nonNegativeInteger/minimum",keyword:"minimum",params:{comparison:">=",limit:0},message:"must be >= 0"}],!1;var a=g===o}else var a=!0;if(a){if(t.minLength!==void 0){let S=o;ds(t.minLength,{instancePath:e+"/minLength",parentData:t,parentDataProperty:"minLength",rootData:i})||(s=s===null?ds.errors:s.concat(ds.errors),o=s.length);var a=S===o}else var a=!0;if(a){if(t.pattern!==void 0){let S=t.pattern,g=o;if(o===g&&o===g)if(typeof S=="string"){if(!Oue(S))return _e.errors=[{instancePath:e+"/pattern",schemaPath:"#/properties/pattern/format",keyword:"format",params:{format:"regex"},message:'must match format "regex"'}],!1}else return _e.errors=[{instancePath:e+"/pattern",schemaPath:"#/properties/pattern/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var a=g===o}else var a=!0;if(a){if(t.additionalItems!==void 0){let S=o;_e(t.additionalItems,{instancePath:e+"/additionalItems",parentData:t,parentDataProperty:"additionalItems",rootData:i})||(s=s===null?_e.errors:s.concat(_e.errors),o=s.length);var a=S===o}else var a=!0;if(a){if(t.items!==void 0){let S=t.items,g=o,T=o,I=!1,x=o;_e(S,{instancePath:e+"/items",parentData:t,parentDataProperty:"items",rootData:i})||(s=s===null?_e.errors:s.concat(_e.errors),o=s.length);var c=x===o;if(I=I||c,!I){let O=o;Hn(S,{instancePath:e+"/items",parentData:t,parentDataProperty:"items",rootData:i})||(s=s===null?Hn.errors:s.concat(Hn.errors),o=s.length);var c=O===o;I=I||c}if(I)o=T,s!==null&&(T?s.length=T:s=null);else{let O={instancePath:e+"/items",schemaPath:"#/properties/items/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf"};return s===null?s=[O]:s.push(O),o++,_e.errors=s,!1}var a=g===o}else var a=!0;if(a){if(t.maxItems!==void 0){let S=t.maxItems,g=o,T=o;if(!(typeof S=="number"&&!(S%1)&&!isNaN(S)&&isFinite(S)))return _e.errors=[{instancePath:e+"/maxItems",schemaPath:"#/definitions/nonNegativeInteger/type",keyword:"type",params:{type:"integer"},message:"must be integer"}],!1;if(o===T&&typeof S=="number"&&isFinite(S)&&(S<0||isNaN(S)))return _e.errors=[{instancePath:e+"/maxItems",schemaPath:"#/definitions/nonNegativeInteger/minimum",keyword:"minimum",params:{comparison:">=",limit:0},message:"must be >= 0"}],!1;var a=g===o}else var a=!0;if(a){if(t.minItems!==void 0){let S=o;ds(t.minItems,{instancePath:e+"/minItems",parentData:t,parentDataProperty:"minItems",rootData:i})||(s=s===null?ds.errors:s.concat(ds.errors),o=s.length);var a=S===o}else var a=!0;if(a){if(t.uniqueItems!==void 0){let S=o;if(typeof t.uniqueItems!="boolean")return _e.errors=[{instancePath:e+"/uniqueItems",schemaPath:"#/properties/uniqueItems/type",keyword:"type",params:{type:"boolean"},message:"must be boolean"}],!1;var a=S===o}else var a=!0;if(a){if(t.contains!==void 0){let S=o;_e(t.contains,{instancePath:e+"/contains",parentData:t,parentDataProperty:"contains",rootData:i})||(s=s===null?_e.errors:s.concat(_e.errors),o=s.length);var a=S===o}else var a=!0;if(a){if(t.maxProperties!==void 0){let S=t.maxProperties,g=o,T=o;if(!(typeof S=="number"&&!(S%1)&&!isNaN(S)&&isFinite(S)))return _e.errors=[{instancePath:e+"/maxProperties",schemaPath:"#/definitions/nonNegativeInteger/type",keyword:"type",params:{type:"integer"},message:"must be integer"}],!1;if(o===T&&typeof S=="number"&&isFinite(S)&&(S<0||isNaN(S)))return _e.errors=[{instancePath:e+"/maxProperties",schemaPath:"#/definitions/nonNegativeInteger/minimum",keyword:"minimum",params:{comparison:">=",limit:0},message:"must be >= 0"}],!1;var a=g===o}else var a=!0;if(a){if(t.minProperties!==void 0){let S=o;ds(t.minProperties,{instancePath:e+"/minProperties",parentData:t,parentDataProperty:"minProperties",rootData:i})||(s=s===null?ds.errors:s.concat(ds.errors),o=s.length);var a=S===o}else var a=!0;if(a){if(t.required!==void 0){let S=t.required,g=o;if(o===o)if(Array.isArray(S)){var l=!0;let x=S.length;for(let R=0;R<x;R++){let O=o;if(typeof S[R]!="string")return _e.errors=[{instancePath:e+"/required/"+R,schemaPath:"#/definitions/stringArray/items/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var l=O===o;if(!l)break}if(l){let R=S.length,O;if(R>1){let A={};for(;R--;){let b=S[R];if(typeof b=="string"){if(typeof A[b]=="number"){return O=A[b],_e.errors=[{instancePath:e+"/required",schemaPath:"#/definitions/stringArray/uniqueItems",keyword:"uniqueItems",params:{i:R,j:O},message:"must NOT have duplicate items (items ## "+O+" and "+R+" are identical)"}],!1;break}A[b]=R}}}}}else return _e.errors=[{instancePath:e+"/required",schemaPath:"#/definitions/stringArray/type",keyword:"type",params:{type:"array"},message:"must be array"}],!1;var a=g===o}else var a=!0;if(a){if(t.additionalProperties!==void 0){let S=o;_e(t.additionalProperties,{instancePath:e+"/additionalProperties",parentData:t,parentDataProperty:"additionalProperties",rootData:i})||(s=s===null?_e.errors:s.concat(_e.errors),o=s.length);var a=S===o}else var a=!0;if(a){if(t.definitions!==void 0){let S=t.definitions,g=o;if(o===g)if(S&&typeof S=="object"&&!Array.isArray(S))for(let I in S){let x=o;_e(S[I],{instancePath:e+"/definitions/"+I.replace(/~/g,"~0").replace(/\//g,"~1"),parentData:S,parentDataProperty:I,rootData:i})||(s=s===null?_e.errors:s.concat(_e.errors),o=s.length);var u=x===o;if(!u)break}else return _e.errors=[{instancePath:e+"/definitions",schemaPath:"#/properties/definitions/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;var a=g===o}else var a=!0;if(a){if(t.properties!==void 0){let S=t.properties,g=o;if(o===g)if(S&&typeof S=="object"&&!Array.isArray(S))for(let I in S){let x=o;_e(S[I],{instancePath:e+"/properties/"+I.replace(/~/g,"~0").replace(/\//g,"~1"),parentData:S,parentDataProperty:I,rootData:i})||(s=s===null?_e.errors:s.concat(_e.errors),o=s.length);var d=x===o;if(!d)break}else return _e.errors=[{instancePath:e+"/properties",schemaPath:"#/properties/properties/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;var a=g===o}else var a=!0;if(a){if(t.patternProperties!==void 0){let S=t.patternProperties,g=o;if(o===g)if(S&&typeof S=="object"&&!Array.isArray(S)){for(let I in S){let x=o;if(o===x&&typeof I=="string"&&!Oue(I)){let R={instancePath:e+"/patternProperties",schemaPath:"#/properties/patternProperties/propertyNames/format",keyword:"format",params:{format:"regex"},message:'must match format "regex"',propertyName:I};s===null?s=[R]:s.push(R),o++}var f=x===o;if(!f){let R={instancePath:e+"/patternProperties",schemaPath:"#/properties/patternProperties/propertyNames",keyword:"propertyNames",params:{propertyName:I},message:"property name must be valid"};return s===null?s=[R]:s.push(R),o++,_e.errors=s,!1;break}}if(f)for(let I in S){let x=o;_e(S[I],{instancePath:e+"/patternProperties/"+I.replace(/~/g,"~0").replace(/\//g,"~1"),parentData:S,parentDataProperty:I,rootData:i})||(s=s===null?_e.errors:s.concat(_e.errors),o=s.length);var p=x===o;if(!p)break}}else return _e.errors=[{instancePath:e+"/patternProperties",schemaPath:"#/properties/patternProperties/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;var a=g===o}else var a=!0;if(a){if(t.dependencies!==void 0){let S=t.dependencies,g=o;if(o===g)if(S&&typeof S=="object"&&!Array.isArray(S))for(let I in S){let x=S[I],R=o,O=o,A=!1,b=o;_e(x,{instancePath:e+"/dependencies/"+I.replace(/~/g,"~0").replace(/\//g,"~1"),parentData:S,parentDataProperty:I,rootData:i})||(s=s===null?_e.errors:s.concat(_e.errors),o=s.length);var h=b===o;if(A=A||h,!A){let L=o;if(o===o)if(Array.isArray(x)){var m=!0;let P=x.length;for(let N=0;N<P;N++){let j=o;if(typeof x[N]!="string"){let de={instancePath:e+"/dependencies/"+I.replace(/~/g,"~0").replace(/\//g,"~1")+"/"+N,schemaPath:"#/definitions/stringArray/items/type",keyword:"type",params:{type:"string"},message:"must be string"};s===null?s=[de]:s.push(de),o++}var m=j===o;if(!m)break}if(m){let N=x.length,j;if(N>1){let V={};for(;N--;){let de=x[N];if(typeof de=="string"){if(typeof V[de]=="number"){j=V[de];let Te={instancePath:e+"/dependencies/"+I.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"#/definitions/stringArray/uniqueItems",keyword:"uniqueItems",params:{i:N,j},message:"must NOT have duplicate items (items ## "+j+" and "+N+" are identical)"};s===null?s=[Te]:s.push(Te),o++;break}V[de]=N}}}}}else{let P={instancePath:e+"/dependencies/"+I.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"#/definitions/stringArray/type",keyword:"type",params:{type:"array"},message:"must be array"};s===null?s=[P]:s.push(P),o++}var h=L===o;A=A||h}if(A)o=O,s!==null&&(O?s.length=O:s=null);else{let L={instancePath:e+"/dependencies/"+I.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"#/properties/dependencies/additionalProperties/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf"};return s===null?s=[L]:s.push(L),o++,_e.errors=s,!1}var _=R===o;if(!_)break}else return _e.errors=[{instancePath:e+"/dependencies",schemaPath:"#/properties/dependencies/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;var a=g===o}else var a=!0;if(a){if(t.propertyNames!==void 0){let S=o;_e(t.propertyNames,{instancePath:e+"/propertyNames",parentData:t,parentDataProperty:"propertyNames",rootData:i})||(s=s===null?_e.errors:s.concat(_e.errors),o=s.length);var a=S===o}else var a=!0;if(a){if(t.enum!==void 0){let S=t.enum,g=o;if(o===g)if(Array.isArray(S)){if(S.length<1)return _e.errors=[{instancePath:e+"/enum",schemaPath:"#/properties/enum/minItems",keyword:"minItems",params:{limit:1},message:"must NOT have fewer than 1 items"}],!1;{let I=S.length,x;if(I>1){e:for(;I--;)for(x=I;x--;)if(Pue(S[I],S[x])){return _e.errors=[{instancePath:e+"/enum",schemaPath:"#/properties/enum/uniqueItems",keyword:"uniqueItems",params:{i:I,j:x},message:"must NOT have duplicate items (items ## "+x+" and "+I+" are identical)"}],!1;break e}}}}else return _e.errors=[{instancePath:e+"/enum",schemaPath:"#/properties/enum/type",keyword:"type",params:{type:"array"},message:"must be array"}],!1;var a=g===o}else var a=!0;if(a){if(t.type!==void 0){let S=t.type,g=o,T=o,I=!1,x=o;if(!(S==="array"||S==="boolean"||S==="integer"||S==="null"||S==="number"||S==="object"||S==="string")){let O={instancePath:e+"/type",schemaPath:"#/definitions/simpleTypes/enum",keyword:"enum",params:{allowedValues:xue.enum},message:"must be equal to one of the allowed values"};s===null?s=[O]:s.push(O),o++}var y=x===o;if(I=I||y,!I){let O=o;if(o===O)if(Array.isArray(S))if(S.length<1){let b={instancePath:e+"/type",schemaPath:"#/properties/type/anyOf/1/minItems",keyword:"minItems",params:{limit:1},message:"must NOT have fewer than 1 items"};s===null?s=[b]:s.push(b),o++}else{var v=!0;let b=S.length;for(let L=0;L<b;L++){let C=S[L],w=o;if(!(C==="array"||C==="boolean"||C==="integer"||C==="null"||C==="number"||C==="object"||C==="string")){let N={instancePath:e+"/type/"+L,schemaPath:"#/definitions/simpleTypes/enum",keyword:"enum",params:{allowedValues:xue.enum},message:"must be equal to one of the allowed values"};s===null?s=[N]:s.push(N),o++}var v=w===o;if(!v)break}if(v){let L=S.length,C;if(L>1){e:for(;L--;)for(C=L;C--;)if(Pue(S[L],S[C])){let w={instancePath:e+"/type",schemaPath:"#/properties/type/anyOf/1/uniqueItems",keyword:"uniqueItems",params:{i:L,j:C},message:"must NOT have duplicate items (items ## "+C+" and "+L+" are identical)"};s===null?s=[w]:s.push(w),o++;break e}}}}else{let b={instancePath:e+"/type",schemaPath:"#/properties/type/anyOf/1/type",keyword:"type",params:{type:"array"},message:"must be array"};s===null?s=[b]:s.push(b),o++}var y=O===o;I=I||y}if(I)o=T,s!==null&&(T?s.length=T:s=null);else{let O={instancePath:e+"/type",schemaPath:"#/properties/type/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf"};return s===null?s=[O]:s.push(O),o++,_e.errors=s,!1}var a=g===o}else var a=!0;if(a){if(t.format!==void 0){let S=o;if(typeof t.format!="string")return _e.errors=[{instancePath:e+"/format",schemaPath:"#/properties/format/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var a=S===o}else var a=!0;if(a){if(t.contentMediaType!==void 0){let S=o;if(typeof t.contentMediaType!="string")return _e.errors=[{instancePath:e+"/contentMediaType",schemaPath:"#/properties/contentMediaType/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var a=S===o}else var a=!0;if(a){if(t.contentEncoding!==void 0){let S=o;if(typeof t.contentEncoding!="string")return _e.errors=[{instancePath:e+"/contentEncoding",schemaPath:"#/properties/contentEncoding/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var a=S===o}else var a=!0;if(a){if(t.if!==void 0){let S=o;_e(t.if,{instancePath:e+"/if",parentData:t,parentDataProperty:"if",rootData:i})||(s=s===null?_e.errors:s.concat(_e.errors),o=s.length);var a=S===o}else var a=!0;if(a){if(t.then!==void 0){let S=o;_e(t.then,{instancePath:e+"/then",parentData:t,parentDataProperty:"then",rootData:i})||(s=s===null?_e.errors:s.concat(_e.errors),o=s.length);var a=S===o}else var a=!0;if(a){if(t.else!==void 0){let S=o;_e(t.else,{instancePath:e+"/else",parentData:t,parentDataProperty:"else",rootData:i})||(s=s===null?_e.errors:s.concat(_e.errors),o=s.length);var a=S===o}else var a=!0;if(a){if(t.allOf!==void 0){let S=o;Hn(t.allOf,{instancePath:e+"/allOf",parentData:t,parentDataProperty:"allOf",rootData:i})||(s=s===null?Hn.errors:s.concat(Hn.errors),o=s.length);var a=S===o}else var a=!0;if(a){if(t.anyOf!==void 0){let S=o;Hn(t.anyOf,{instancePath:e+"/anyOf",parentData:t,parentDataProperty:"anyOf",rootData:i})||(s=s===null?Hn.errors:s.concat(Hn.errors),o=s.length);var a=S===o}else var a=!0;if(a){if(t.oneOf!==void 0){let S=o;Hn(t.oneOf,{instancePath:e+"/oneOf",parentData:t,parentDataProperty:"oneOf",rootData:i})||(s=s===null?Hn.errors:s.concat(Hn.errors),o=s.length);var a=S===o}else var a=!0;if(a)if(t.not!==void 0){let S=o;_e(t.not,{instancePath:e+"/not",parentData:t,parentDataProperty:"not",rootData:i})||(s=s===null?_e.errors:s.concat(_e.errors),o=s.length);var a=S===o}else var a=!0}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}return _e.errors=s,o===0}});var y2=E((d5t,Nue)=>{"use strict";var m2=class extends Error{constructor(e,r){super(),this.name="JsonSchemaMergeError",this.code="JSON_SCHEMA_MERGE_ERROR",this.message=`Failed to merge "${e}" keyword schemas.`,this.schemas=r}},g2=class extends Error{constructor(e,r){super(),this.name="JsonSchemaMergeError",this.code="JSON_SCHEMA_MERGE_ERROR",this.message=`Resolver for "${e}" keyword not found.`,this.schemas=r}},_2=class extends Error{constructor(e){super(),this.name="JsonSchemaMergeError",this.code="JSON_SCHEMA_MERGE_ERROR",this.message=`Invalid "onConflict" option: "${e}".`}};Nue.exports={MergeError:m2,ResolverNotFoundError:g2,InvalidOnConflictOptionError:_2}});var Lue=E((f5t,$ue)=>{"use strict";var{dequal:Lrt}=_x(),{MergeError:S2}=y2();function kue(t){let e=t[0];for(let r=1;r<t.length;r++)e=e.filter(n=>t[r].includes(n));return e}function Drt(t,e,r){let n=kue(e);if(n.length===0)throw new S2(t,e);r[t]=n}function Mrt(t,e,r){for(let i=0;i<e.length;i++)Array.isArray(e[i])||(e[i]=[e[i]]);let n=kue(e);if(n.length===0)throw new S2(t,e);n.length===1?r[t]=n[0]:r[t]=n}function Urt(t,e,r){let n=[];for(let i of e)for(let s of i)n.includes(s)||n.push(s);r[t]=n}function Frt(t,e,r){r[t]=Math.min(...e)}function jrt(t,e,r){r[t]=Math.max(...e)}function qrt(t,e,r){let n=(a,c)=>c?n(c,a%c):a,i=(a,c)=>a*c/n(a,c),s=1;for(let a of e)for(;a*s%1!==0;)s*=10;let o=e[0]*s;for(let a of e)o=i(o,a*s);r[t]=o/s}function Brt(t,e,r){let n=e[0];for(let i=1;i<e.length;i++)if(!Lrt(e[i],n))throw new S2(t,e);r[t]=n}function zrt(){}function Vrt(t,e,r){for(let n of e)if(n===!1){r[t]=!1;return}r[t]=!0}function Hrt(t,e,r){for(let n of e)if(n===!0){r[t]=!0;return}r[t]=!1}$ue.exports={arraysIntersection:Drt,hybridArraysIntersection:Mrt,arraysUnion:Urt,minNumber:Frt,maxNumber:jrt,commonMultiple:qrt,allEqual:Brt,booleanAnd:Vrt,booleanOr:Hrt,skip:zrt}});var que=E((p5t,jue)=>{"use strict";var{dequal:Grt}=_x(),rr=Lue(),Ex=y2(),Uue={$id:rr.skip,type:rr.hybridArraysIntersection,enum:rr.arraysIntersection,minLength:rr.maxNumber,maxLength:rr.minNumber,minimum:rr.maxNumber,maximum:rr.minNumber,multipleOf:rr.commonMultiple,exclusiveMinimum:rr.maxNumber,exclusiveMaximum:rr.minNumber,minItems:rr.maxNumber,maxItems:rr.minNumber,maxProperties:rr.minNumber,minProperties:rr.maxNumber,const:rr.allEqual,default:rr.allEqual,format:rr.allEqual,required:rr.arraysUnion,properties:Xrt,patternProperties:Sx,additionalProperties:yx,items:Krt,additionalItems:Jrt,definitions:Sx,$defs:Sx,nullable:rr.booleanAnd,oneOf:Due,anyOf:Due,allOf:rr.arraysUnion,not:yx,if:Qrt,then:rr.skip,else:rr.skip,dependencies:Mue,dependentRequired:Mue,dependentSchemas:Sx,propertyNames:yx,uniqueItems:rr.booleanOr,contains:yx};function yx(t,e,r,n,i){r[t]=Qs(e,i)}function Wrt(t){let e=[[]];for(let r of t){let n=[];for(let i of e)for(let s of r)n.push([...i,s]);e=n}return e}function Due(t,e,r,n,i){if(e.length===1){r[t]=e[0];return}let s=Wrt(e),o=[];for(let a of s)try{let c=Qs(a,i);c!==void 0&&o.push(c)}catch(c){if(c instanceof Ex.MergeError)continue;throw c}r[t]=o}function Yrt(t,e){let{items:r,additionalItems:n}=t;return Array.isArray(r)?e<r.length?r[e]:n:r!==void 0?r:n}function Krt(t,e,r,n,i){let s=0;for(let a of e)Array.isArray(a)&&(s=Math.max(s,a.length));if(s===0){r[t]=Qs(e,i);return}let o=[];for(let a=0;a<s;a++){let c=[];for(let l of n){let u=Yrt(l,a);u!==void 0&&c.push(u)}o[a]=Qs(c,i)}r[t]=o}function Jrt(t,e,r,n,i){let s=!1;for(let a of n)if(Array.isArray(a.items)){s=!0;break}if(!s){r[t]=Qs(e,i);return}let o=[];for(let a of n){let c=a.additionalItems;c===void 0&&!Array.isArray(a.items)&&(c=a.items),c!==void 0&&o.push(c)}r[t]=Qs(o,i)}function Zrt(t,e){let{properties:r,patternProperties:n,additionalProperties:i}=t;if(r?.[e]!==void 0)return r[e];for(let s of Object.keys(n??{}))if(new RegExp(s).test(e))return n[s];return i}function Xrt(t,e,r,n,i){let s={};for(let a of n){let c=a.properties??{};for(let l of Object.keys(c)){if(s[l]!==void 0)continue;let u=c[l];s[l]=[u];for(let d of n){if(a===d)continue;let f=Zrt(d,l);f!==void 0&&s[l].push(f)}}}let o={};for(let a of Object.keys(s)){let c=s[a];o[a]=Qs(c,i)}r[t]=o}function Sx(t,e,r,n,i){let s={};for(let a of e)for(let c of Object.keys(a))s[c]===void 0&&(s[c]=[]),s[c].push(a[c]);let o={};for(let a of Object.keys(s)){let c=s[a],l=Qs(c,i);o[a]=l}r[t]=o}function Qrt(t,e,r,n,i){for(let s=0;s<n.length;s++){let o={if:n[s].if,then:n[s].then,else:n[s].else};if(o.if!==void 0){if(r.if===void 0){r.if=o.if,o.then!==void 0&&(r.then=o.then),o.else!==void 0&&(r.else=o.else);continue}r.then!==void 0&&(r.then=Qs([r.then,o],i)),r.else!==void 0&&(r.else=Qs([r.else,o],i))}}}function Mue(t,e,r){let n={};for(let i of e)for(let s of Object.keys(i)){n[s]===void 0&&(n[s]=[]);let o=n[s];for(let a of i[s])o.includes(a)||o.push(a)}r[t]=n}function Qs(t,e){if(t.length===0)return{};if(t.length===1)return t[0];let r={},n={},i=!0;for(let s of t){if(s===!1)return!1;if(s!==!0){i=!1;for(let o of Object.keys(s))n[o]===void 0&&(n[o]=[]),n[o].push(s[o])}}if(i)return!0;for(let s of Object.keys(n)){let o=n[s];(e.resolvers[s]??e.defaultResolver)(s,o,r,t,e)}return r}function Fue(t,e,r,n,i){let s=i.onConflict??"throw";if(e.length===1||s==="first"){r[t]=e[0];return}let o=!0;for(let a=1;a<e.length;a++)if(!Grt(e[a],e[0])){o=!1;break}if(o){r[t]=e[0];return}if(s==="throw")throw new Ex.ResolverNotFoundError(t,e);if(s!=="skip")throw new Ex.InvalidOnConflictOptionError(s)}function ent(t,e={}){return e.defaultResolver===void 0&&(e.defaultResolver=Fue),e.resolvers={...Uue,...e.resolvers},Qs(t,e)}jue.exports={mergeSchemas:ent,keywordsResolvers:Uue,defaultResolver:Fue,...Ex}});var zue=E((h5t,Bue)=>{"use strict";var{mergeSchemas:tnt}=que();function rnt(t){return tnt(t,{onConflict:"skip"})}Bue.exports=rnt});var Vue=E((m5t,E2)=>{"use strict";function nnt(t,e,r,n){let i="";e.validatorSchemasIds.size>0?(i+=`const Validator = require('fast-json-stringify/lib/validator')
35
+ `,r:"\r",t:" ",'"':'"',"/":"/","\\":"\\"},xtt=97,Itt=48;function Vl(t,e){let r="",n;for(Vl.message=void 0;n=t[e++],n!=='"';)if(n==="\\")if(n=t[e],n in kle)r+=kle[n],e++;else if(n==="u"){e++;let s=4,o=0;for(;s--;){if(o<<=4,n=t[e],n===void 0){i("unexpected end");return}if(n=n.toLowerCase(),n>="a"&&n<="f")o+=n.charCodeAt(0)-xtt+10;else if(n>="0"&&n<="9")o+=n.charCodeAt(0)-Itt;else{i(`unexpected token ${n}`);return}e++}r+=String.fromCharCode(o)}else{i(`unexpected token ${n}`);return}else if(n===void 0){i("unexpected end");return}else if(n.charCodeAt(0)>=32)r+=n;else{i(`unexpected token ${n}`);return}return Vl.position=e,r;function i(s){Vl.position=e,Vl.message=s}}Hl.parseJsonString=Vl;Vl.message=void 0;Vl.position=0;Vl.code='require("ajv/dist/runtime/parseJson").parseJsonString'});var Hle=E(Gq=>{"use strict";Object.defineProperty(Gq,"__esModule",{value:!0});var Ott=$q(),Ule=sf(),Me=Fe(),Ptt=rc(),lt=cs(),Ctt=sn(),Ntt=cx(),ktt=Tq(),qq=$le(),Fle=Xe(),$tt=bq(),Ltt={elements:Ftt,values:jtt,discriminator:Btt,properties:Lle,optionalProperties:Lle,enum:Vtt,type:ztt,ref:Htt};function jle(t,e){let r=Ule.getCompilingSchema.call(this,t);if(r)return r;let{es5:n,lines:i}=this.opts.code,{ownProperties:s}=this.opts,o=new Me.CodeGen(this.scope,{es5:n,lines:i,ownProperties:s}),a=o.scopeName("parse"),c={self:this,gen:o,schema:t.schema,schemaEnv:t,definitions:e,data:lt.default.data,parseName:a,char:o.name("c")},l;try{this._compilations.add(t),t.parseName=a,Dtt(c),o.optimize(this.opts.code.optimize);let u=o.toString();l=`${o.scopeRefs(lt.default.scope)}return ${u}`;let f=new Function(`${lt.default.scope}`,l)(this.scope.get());this.scope.value(a,{ref:f}),t.parse=f}catch(u){throw l&&this.logger.error("Error compiling parser, function code:",l),delete t.parse,delete t.parseName,u}finally{this._compilations.delete(t)}return t}Gq.default=jle;var jq=(0,Me._)`undefined`;function Dtt(t){let{gen:e,parseName:r,char:n}=t;e.func(r,(0,Me._)`${lt.default.json}, ${lt.default.jsonPos}, ${lt.default.jsonPart}`,!1,()=>{e.let(lt.default.data),e.let(n),e.assign((0,Me._)`${r}.message`,jq),e.assign((0,Me._)`${r}.position`,jq),e.assign(lt.default.jsonPos,(0,Me._)`${lt.default.jsonPos} || 0`),e.const(lt.default.jsonLen,(0,Me._)`${lt.default.json}.length`),px(t),Hq(t),e.if(lt.default.jsonPart,()=>{e.assign((0,Me._)`${r}.position`,lt.default.jsonPos),e.return(lt.default.data)}),e.if((0,Me._)`${lt.default.jsonPos} === ${lt.default.jsonLen}`,()=>e.return(lt.default.data)),lm(t)})}function px(t){let e;for(let r of Ott.jtdForms)if(r in t.schema){e=r;break}e?Utt(t,Ltt[e]):zq(t)}var Mtt=Mle(!0,Mle(!1,lm));function Utt(t,e){let{gen:r,schema:n,data:i}=t;if(!n.nullable)return e(t);sv(t,"null",e,()=>r.assign(i,null))}function Ftt(t){let{gen:e,schema:r,data:n}=t;Vo(t,"[");let i=e.let("i",0);e.assign(n,(0,Me._)`[]`),Bq(t,"]",()=>{let s=e.let("el");px({...t,schema:r.elements,data:s}),e.assign((0,Me._)`${n}[${i}++]`,s)})}function jtt(t){let{gen:e,schema:r,data:n}=t;Vo(t,"{"),e.assign(n,(0,Me._)`{}`),Bq(t,"}",()=>qtt(t,r.values))}function Bq(t,e,r){qle(t,e,r),Vo(t,e)}function qle(t,e,r){let{gen:n}=t;n.for((0,Me._)`;${lt.default.jsonPos}<${lt.default.jsonLen} && ${hx(1)}!==${e};`,()=>{r(),sv(t,",",()=>n.break(),i)});function i(){sv(t,e,()=>{},lm)}}function qtt(t,e){let{gen:r}=t,n=r.let("key");df({...t,data:n}),Vo(t,":"),zle(t,n,e)}function Btt(t){let{gen:e,data:r,schema:n}=t,{discriminator:i,mapping:s}=n;Vo(t,"{"),e.assign(r,(0,Me._)`{}`);let o=e.const("pos",lt.default.jsonPos),a=e.let("value"),c=e.let("tag");qle(t,"}",()=>{let l=e.let("key");df({...t,data:l}),Vo(t,":"),e.if((0,Me._)`${l} === ${i}`,()=>{df({...t,data:c}),e.assign((0,Me._)`${r}[${l}]`,c),e.break()},()=>zq({...t,data:a}))}),e.assign(lt.default.jsonPos,o),e.if((0,Me._)`${c} === undefined`),cc(t,(0,Me.str)`discriminator tag not found`);for(let l in s)e.elseIf((0,Me._)`${c} === ${l}`),Ble({...t,schema:s[l]},i);e.else(),cc(t,(0,Me.str)`discriminator value not in schema`),e.endIf()}function Lle(t){let{gen:e,data:r}=t;Vo(t,"{"),e.assign(r,(0,Me._)`{}`),Ble(t)}function Ble(t,e){let{gen:r,schema:n,data:i}=t,{properties:s,optionalProperties:o,additionalProperties:a}=n;if(Bq(t,"}",()=>{let c=r.let("key");if(df({...t,data:c}),Vo(t,":"),r.if(!1),Dle(t,c,s),Dle(t,c,o),e){r.elseIf((0,Me._)`${c} === ${e}`);let l=r.let("tag");df({...t,data:l})}r.else(),a?zq({...t,data:(0,Me._)`${i}[${c}]`}):cc(t,(0,Me.str)`property ${c} not allowed`),r.endIf()}),s){let c=(0,Ctt.hasPropFunc)(r),l=(0,Me.and)(...Object.keys(s).map(u=>(0,Me._)`${c}.call(${i}, ${u})`));r.if((0,Me.not)(l),()=>cc(t,(0,Me.str)`missing required properties`))}}function Dle(t,e,r={}){let{gen:n}=t;for(let i in r)n.elseIf((0,Me._)`${e} === ${i}`),zle(t,e,r[i])}function zle(t,e,r){px({...t,schema:r,data:(0,Me._)`${t.data}[${e}]`})}function ztt(t){let{gen:e,schema:r,data:n,self:i}=t;switch(r.type){case"boolean":Mtt(t);break;case"string":df(t);break;case"timestamp":{df(t);let s=(0,Fle.useFunc)(e,$tt.default),{allowDate:o,parseDate:a}=i.opts,c=o?(0,Me._)`!${s}(${n}, true)`:(0,Me._)`!${s}(${n})`,l=a?(0,Me.or)(c,(0,Me._)`(${n} = new Date(${n}), false)`,(0,Me._)`isNaN(${n}.valueOf())`):c;e.if(l,()=>cc(t,(0,Me.str)`invalid timestamp`));break}case"float32":case"float64":Fq(t);break;default:{let s=r.type;if(!i.opts.int32range&&(s==="int32"||s==="uint32"))Fq(t,16),s==="uint32"&&e.if((0,Me._)`${n} < 0`,()=>cc(t,(0,Me.str)`integer out of range`));else{let[o,a,c]=ktt.intRange[s];Fq(t,c),e.if((0,Me._)`${n} < ${o} || ${n} > ${a}`,()=>cc(t,(0,Me.str)`integer out of range`))}}}}function df(t){Vo(t,'"'),Vq(t,qq.parseJsonString)}function Vtt(t){let{gen:e,data:r,schema:n}=t,i=n.enum;Vo(t,'"'),e.if(!1);for(let s of i){let o=JSON.stringify(s).slice(1);e.elseIf((0,Me._)`${hx(o.length)} === ${o}`),e.assign(r,(0,Me.str)`${s}`),e.add(lt.default.jsonPos,o.length)}e.else(),lm(t),e.endIf()}function Fq(t,e){let{gen:r}=t;Hq(t),r.if((0,Me._)`"-0123456789".indexOf(${hx(1)}) < 0`,()=>lm(t),()=>Vq(t,qq.parseJsonNumber,e))}function Mle(t,e){return r=>{let{gen:n,data:i}=r;sv(r,`${t}`,()=>e(r),()=>n.assign(i,t))}}function Htt(t){let{gen:e,self:r,definitions:n,schema:i,schemaEnv:s}=t,{ref:o}=i,a=n[o];if(!a)throw new Ptt.default(r.opts.uriResolver,"",o,`No definition ${o}`);if(!(0,Ntt.hasRef)(a))return px({...t,schema:a});let{root:c}=s,l=jle.call(r,new Ule.SchemaEnv({schema:a,root:c}),n);Vle(t,Gtt(e,l),!0)}function Gtt(t,e){return e.parse?t.scopeValue("parse",{ref:e.parse}):(0,Me._)`${t.scopeValue("wrapper",{ref:e})}.parse`}function zq(t){Vq(t,qq.parseJson)}function Vq(t,e,r){Vle(t,(0,Fle.useFunc)(t.gen,e),r)}function Vle(t,e,r){let{gen:n,data:i}=t;n.assign(i,(0,Me._)`${e}(${lt.default.json}, ${lt.default.jsonPos}${r?(0,Me._)`, ${r}`:Me.nil})`),n.assign(lt.default.jsonPos,(0,Me._)`${e}.position`),n.if((0,Me._)`${i} === undefined`,()=>cc(t,(0,Me._)`${e}.message`))}function Vo(t,e){sv(t,e,lm)}function sv(t,e,r,n){let{gen:i}=t,s=e.length;Hq(t),i.if((0,Me._)`${hx(s)} === ${e}`,()=>{i.add(lt.default.jsonPos,s),n?.(t)},()=>r(t))}function Hq({gen:t,char:e}){t.code((0,Me._)`while((${e}=${lt.default.json}[${lt.default.jsonPos}],${e}===" "||${e}==="\\n"||${e}==="\\r"||${e}==="\\t"))${lt.default.jsonPos}++;`)}function hx(t){return t===1?(0,Me._)`${lt.default.json}[${lt.default.jsonPos}]`:(0,Me._)`${lt.default.json}.slice(${lt.default.jsonPos}, ${lt.default.jsonPos}+${t})`}function lm(t){cc(t,(0,Me._)`"unexpected token " + ${lt.default.json}[${lt.default.jsonPos}]`)}function cc({gen:t,parseName:e},r){t.assign((0,Me._)`${e}.message`,r),t.assign((0,Me._)`${e}.position`,lt.default.jsonPos),t.return(jq)}});var Kq=E((Zt,Yq)=>{"use strict";Object.defineProperty(Zt,"__esModule",{value:!0});Zt.MissingRefError=Zt.ValidationError=Zt.CodeGen=Zt.Name=Zt.nil=Zt.stringify=Zt.str=Zt._=Zt.KeywordCxt=Zt.Ajv=void 0;var Wtt=Ij(),Ytt=Ele(),Ktt=wle(),Jtt=Nle(),Ztt=Hle(),Wq="JTD-meta-schema",um=class extends Wtt.default{constructor(e={}){super({...e,jtd:!0})}_addVocabularies(){super._addVocabularies(),this.addVocabulary(Ytt.default)}_addDefaultMetaSchema(){super._addDefaultMetaSchema(),this.opts.meta&&this.addMetaSchema(Ktt.default,Wq,!1)}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(Wq)?Wq:void 0)}compileSerializer(e){let r=this._addSchema(e);return r.serialize||this._compileSerializer(r)}compileParser(e){let r=this._addSchema(e);return r.parse||this._compileParser(r)}_compileSerializer(e){if(Jtt.default.call(this,e,e.schema.definitions||{}),!e.serialize)throw new Error("ajv implementation error");return e.serialize}_compileParser(e){if(Ztt.default.call(this,e,e.schema.definitions||{}),!e.parse)throw new Error("ajv implementation error");return e.parse}};Zt.Ajv=um;Yq.exports=Zt=um;Yq.exports.Ajv=um;Object.defineProperty(Zt,"__esModule",{value:!0});Zt.default=um;var Xtt=Yh();Object.defineProperty(Zt,"KeywordCxt",{enumerable:!0,get:function(){return Xtt.KeywordCxt}});var dm=Fe();Object.defineProperty(Zt,"_",{enumerable:!0,get:function(){return dm._}});Object.defineProperty(Zt,"str",{enumerable:!0,get:function(){return dm.str}});Object.defineProperty(Zt,"stringify",{enumerable:!0,get:function(){return dm.stringify}});Object.defineProperty(Zt,"nil",{enumerable:!0,get:function(){return dm.nil}});Object.defineProperty(Zt,"Name",{enumerable:!0,get:function(){return dm.Name}});Object.defineProperty(Zt,"CodeGen",{enumerable:!0,get:function(){return dm.CodeGen}});var Qtt=FE();Object.defineProperty(Zt,"ValidationError",{enumerable:!0,get:function(){return Qtt.default}});var ert=rc();Object.defineProperty(Zt,"MissingRefError",{enumerable:!0,get:function(){return ert.default}})});var Jq=E((QKt,Gle)=>{"use strict";var trt=GR();Gle.exports=Object.freeze({coerceTypes:"array",useDefaults:!0,removeAdditional:!0,uriResolver:trt,addUsedSchema:!1,allErrors:!1})});var mx=E(Go=>{"use strict";Object.defineProperty(Go,"__esModule",{value:!0});Go.formatNames=Go.fastFormats=Go.fullFormats=void 0;function Ho(t,e){return{validate:t,compare:e}}Go.fullFormats={date:Ho(Jle,e2),time:Ho(Xq(!0),t2),"date-time":Ho(Wle(!0),Xle),"iso-time":Ho(Xq(),Zle),"iso-date-time":Ho(Wle(),Qle),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:art,"uri-reference":/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,"uri-template":/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,url:/^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/,ipv6:/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,regex:hrt,uuid:/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,"json-pointer":/^(?:\/(?:[^~/]|~0|~1)*)*$/,"json-pointer-uri-fragment":/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,"relative-json-pointer":/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,byte:crt,int32:{type:"number",validate:drt},int64:{type:"number",validate:frt},float:{type:"number",validate:Kle},double:{type:"number",validate:Kle},password:!0,binary:!0};Go.fastFormats={...Go.fullFormats,date:Ho(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,e2),time:Ho(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,t2),"date-time":Ho(/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,Xle),"iso-time":Ho(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,Zle),"iso-date-time":Ho(/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,Qle),uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i};Go.formatNames=Object.keys(Go.fullFormats);function rrt(t){return t%4===0&&(t%100!==0||t%400===0)}var nrt=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,irt=[0,31,28,31,30,31,30,31,31,30,31,30,31];function Jle(t){let e=nrt.exec(t);if(!e)return!1;let r=+e[1],n=+e[2],i=+e[3];return n>=1&&n<=12&&i>=1&&i<=(n===2&&rrt(r)?29:irt[n])}function e2(t,e){if(t&&e)return t>e?1:t<e?-1:0}var Zq=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function Xq(t){return function(r){let n=Zq.exec(r);if(!n)return!1;let i=+n[1],s=+n[2],o=+n[3],a=n[4],c=n[5]==="-"?-1:1,l=+(n[6]||0),u=+(n[7]||0);if(l>23||u>59||t&&!a)return!1;if(i<=23&&s<=59&&o<60)return!0;let d=s-u*c,f=i-l*c-(d<0?1:0);return(f===23||f===-1)&&(d===59||d===-1)&&o<61}}function t2(t,e){if(!(t&&e))return;let r=new Date("2020-01-01T"+t).valueOf(),n=new Date("2020-01-01T"+e).valueOf();if(r&&n)return r-n}function Zle(t,e){if(!(t&&e))return;let r=Zq.exec(t),n=Zq.exec(e);if(r&&n)return t=r[1]+r[2]+r[3],e=n[1]+n[2]+n[3],t>e?1:t<e?-1:0}var Qq=/t|\s/i;function Wle(t){let e=Xq(t);return function(n){let i=n.split(Qq);return i.length===2&&Jle(i[0])&&e(i[1])}}function Xle(t,e){if(!(t&&e))return;let r=new Date(t).valueOf(),n=new Date(e).valueOf();if(r&&n)return r-n}function Qle(t,e){if(!(t&&e))return;let[r,n]=t.split(Qq),[i,s]=e.split(Qq),o=e2(r,i);if(o!==void 0)return o||t2(n,s)}var srt=/\/|:/,ort=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;function art(t){return srt.test(t)&&ort.test(t)}var Yle=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function crt(t){return Yle.lastIndex=0,Yle.test(t)}var lrt=-(2**31),urt=2**31-1;function drt(t){return Number.isInteger(t)&&t<=urt&&t>=lrt}function frt(t){return Number.isInteger(t)}function Kle(){return!0}var prt=/[^\\]\\Z/;function hrt(t){if(prt.test(t))return!1;try{return new RegExp(t),!0}catch{return!1}}});var eue=E(fm=>{"use strict";Object.defineProperty(fm,"__esModule",{value:!0});fm.formatLimitDefinition=void 0;var mrt=ax(),Zs=Fe(),Gl=Zs.operators,gx={formatMaximum:{okStr:"<=",ok:Gl.LTE,fail:Gl.GT},formatMinimum:{okStr:">=",ok:Gl.GTE,fail:Gl.LT},formatExclusiveMaximum:{okStr:"<",ok:Gl.LT,fail:Gl.GTE},formatExclusiveMinimum:{okStr:">",ok:Gl.GT,fail:Gl.LTE}},grt={message:({keyword:t,schemaCode:e})=>(0,Zs.str)`should be ${gx[t].okStr} ${e}`,params:({keyword:t,schemaCode:e})=>(0,Zs._)`{comparison: ${gx[t].okStr}, limit: ${e}}`};fm.formatLimitDefinition={keyword:Object.keys(gx),type:"string",schemaType:"string",$data:!0,error:grt,code(t){let{gen:e,data:r,schemaCode:n,keyword:i,it:s}=t,{opts:o,self:a}=s;if(!o.validateFormats)return;let c=new mrt.KeywordCxt(s,a.RULES.all.format.definition,"format");c.$data?l():u();function l(){let f=e.scopeValue("formats",{ref:a.formats,code:o.code.formats}),p=e.const("fmt",(0,Zs._)`${f}[${c.schemaCode}]`);t.fail$data((0,Zs.or)((0,Zs._)`typeof ${p} != "object"`,(0,Zs._)`${p} instanceof RegExp`,(0,Zs._)`typeof ${p}.compare != "function"`,d(p)))}function u(){let f=c.schema,p=a.formats[f];if(!p||p===!0)return;if(typeof p!="object"||p instanceof RegExp||typeof p.compare!="function")throw new Error(`"${i}": format "${f}" does not define "compare" function`);let h=e.scopeValue("formats",{key:f,ref:p,code:o.code.formats?(0,Zs._)`${o.code.formats}${(0,Zs.getProperty)(f)}`:void 0});t.fail$data(d(h))}function d(f){return(0,Zs._)`${f}.compare(${r}, ${n}) ${gx[i].fail} 0`}},dependencies:["format"]};var _rt=t=>(t.addKeyword(fm.formatLimitDefinition),t);fm.default=_rt});var i2=E((ov,nue)=>{"use strict";Object.defineProperty(ov,"__esModule",{value:!0});var pm=mx(),yrt=eue(),r2=Fe(),tue=new r2.Name("fullFormats"),Srt=new r2.Name("fastFormats"),n2=(t,e={keywords:!0})=>{if(Array.isArray(e))return rue(t,e,pm.fullFormats,tue),t;let[r,n]=e.mode==="fast"?[pm.fastFormats,Srt]:[pm.fullFormats,tue],i=e.formats||pm.formatNames;return rue(t,i,r,n),e.keywords&&(0,yrt.default)(t),t};n2.get=(t,e="full")=>{let n=(e==="fast"?pm.fastFormats:pm.fullFormats)[t];if(!n)throw new Error(`Unknown format "${t}"`);return n};function rue(t,e,r,n){var i,s;(i=(s=t.opts.code).formats)!==null&&i!==void 0||(s.formats=(0,r2._)`require("ajv-formats/dist/formats").${n}`);for(let o of e)t.addFormat(o,r[o])}nue.exports=ov=n2;Object.defineProperty(ov,"__esModule",{value:!0});ov.default=n2});var oue=E((r5t,sue)=>{"use strict";var Ert=ax().default,vrt=Kq(),iue=Jq(),s2=class{constructor(e,r){r.mode==="JTD"?this.ajv=new vrt(Object.assign({},iue,r.customOptions)):this.ajv=new Ert(Object.assign({},iue,r.customOptions));let n=!0;if(r.plugins&&r.plugins.length>0)for(let s of r.plugins)Array.isArray(s)?(n=n&&s[0].name!=="formatsPlugin",s[0](this.ajv,s[1])):(n=n&&s.name!=="formatsPlugin",s(this.ajv));n&&i2()(this.ajv),r.onCreate?.(this.ajv);let i=Object.values(e);for(let s of i)this.ajv.addSchema(s)}buildValidatorFunction({schema:e}){if(e.$id){let r=this.ajv.getSchema(e.$id);if(r)return r}return this.ajv.compile(e)}};sue.exports=s2});var cue=E((n5t,aue)=>{"use strict";var brt=Kq(),Trt=Jq(),o2=class{constructor(e,r){this.ajv=new brt(Object.assign({},Trt,r))}buildSerializerFunction({schema:e}){return this.ajv.compileSerializer(e)}};aue.exports=o2});var due=E((cv,uue)=>{"use strict";Object.defineProperty(cv,"__esModule",{value:!0});var av=NR(),Xs=jh();function lue(t,e){if(!t.opts.code.source)throw new Error("moduleCode: ajv instance must have code.source option");let{_n:r}=t.scope.opts;return typeof e=="function"?i(e.source):e!==void 0?s(e,n):s(t.schemas,a=>a.meta?void 0:t.compile(a.schema));function n(a){let c=t.getSchema(a);if(!c)throw new Error(`moduleCode: no schema with id ${a}`);return c}function i(a){let c={},l=a?.validateName,u=o(c,a);return t.opts.code.esm?`"use strict";${r}export const validate = ${l};${r}export default ${l};${r}${u}`:`"use strict";${r}module.exports = ${l};${r}module.exports.default = ${l};${r}${u}`}function s(a,c){var l;let u={},d=(0,Xs._)`"use strict";`;for(let f in a){let p=c(a[f]);if(p){let h=o(u,p.source),m=t.opts.code.esm?(0,Xs._)`export const ${(0,Xs.getEsmExportName)(f)}`:(0,Xs._)`exports${(0,Xs.getProperty)(f)}`;d=(0,Xs._)`${d}${r}${m} = ${(l=p.source)===null||l===void 0?void 0:l.validateName};${r}${h}`}}return`${d}`}function o(a,c){if(!c)throw new Error('moduleCode: function does not have "source" property');if(f(c.validateName)===av.UsedValueState.Completed)return Xs.nil;p(c.validateName,av.UsedValueState.Started);let l=t.scope.scopeCode(c.scopeValues,a,d),u=new Xs._Code(`${l}${r}${c.validateCode}`);return c.evaluated?(0,Xs._)`${u}${c.validateName}.evaluated = ${c.evaluated};${r}`:u;function d(h){var m;let _=(m=h.value)===null||m===void 0?void 0:m.ref;if(h.prefix==="validate"&&typeof _=="function")return o(a,_.source);if((h.prefix==="root"||h.prefix==="wrapper")&&typeof _=="object"){let{validate:y,validateName:v}=_;if(!v)throw new Error("ajv internal error");let S=t.opts.code.es5?av.varKinds.var:av.varKinds.const,g=(0,Xs._)`${S} ${h} = {validate: ${v}};`;if(f(v)===av.UsedValueState.Started)return g;let T=o(a,y?.source);return(0,Xs._)`${g}${r}${T}`}}function f(h){var m;return(m=a[h.prefix])===null||m===void 0?void 0:m.get(h)}function p(h,m){let{prefix:_}=h;(a[_]=a[_]||new Map).set(h,m)}}}uue.exports=cv=lue;Object.defineProperty(cv,"__esModule",{value:!0});cv.default=lue});var hue=E((i5t,pue)=>{"use strict";var fue=a2(),wrt=due().default;function Art(t={readMode:!0}){if(t.readMode===!0&&!t.restoreFunction)throw new Error("You must provide a restoreFunction options when readMode ON");if(t.readMode!==!0&&!t.storeFunction)throw new Error("You must provide a storeFunction options when readMode OFF");if(t.readMode===!0)return function(){return function(n){return t.restoreFunction(n)}};let e=fue();return function(n,i={}){(!i.customOptions||!i.customOptions.code)&&(i.customOptions=Object.assign({},i.customOptions,{code:{source:!0}}));let s=e(n,i);return function(o){let a=s(o),c=wrt(s[fue.AjvReference].ajv,a);return t.storeFunction(o,c),a}}}pue.exports=Art});var a2=E((s5t,hm)=>{"use strict";var gue=Symbol.for("fastify.ajv-compiler.reference"),Rrt=oue(),xrt=cue();function c2(t){let e=new Map,r=new Map;return t&&t.jtdSerializer===!0?function(i,s){let o=mue({},s);if(r.has(o))return r.get(o);let a=new xrt(i,s),c=a.buildSerializerFunction.bind(a);return r.set(o,c),c}:function(i,s){let o=mue(i,s.customOptions);if(e.has(o))return e.get(o);let a=new Rrt(i,s),c=a.buildValidatorFunction.bind(a);return e.set(o,c),s.customOptions.code!==void 0&&(c[gue]=a),c}}function mue(t,e){let r=JSON.stringify(t),n=JSON.stringify(e);return`${r}${n}`}hm.exports=c2;hm.exports.default=c2;hm.exports.AjvCompiler=c2;hm.exports.AjvReference=gue;hm.exports.StandaloneValidator=hue()});var _x=E(Sue=>{"use strict";var _ue=Object.prototype.hasOwnProperty;function yue(t,e,r){for(r of t.keys())if(lv(r,e))return r}function lv(t,e){var r,n,i;if(t===e)return!0;if(t&&e&&(r=t.constructor)===e.constructor){if(r===Date)return t.getTime()===e.getTime();if(r===RegExp)return t.toString()===e.toString();if(r===Array){if((n=t.length)===e.length)for(;n--&&lv(t[n],e[n]););return n===-1}if(r===Set){if(t.size!==e.size)return!1;for(n of t)if(i=n,i&&typeof i=="object"&&(i=yue(e,i),!i)||!e.has(i))return!1;return!0}if(r===Map){if(t.size!==e.size)return!1;for(n of t)if(i=n[0],i&&typeof i=="object"&&(i=yue(e,i),!i)||!lv(n[1],e.get(i)))return!1;return!0}if(r===ArrayBuffer)t=new Uint8Array(t),e=new Uint8Array(e);else if(r===DataView){if((n=t.byteLength)===e.byteLength)for(;n--&&t.getInt8(n)===e.getInt8(n););return n===-1}if(ArrayBuffer.isView(t)){if((n=t.byteLength)===e.byteLength)for(;n--&&t[n]===e[n];);return n===-1}if(!r||typeof t=="object"){n=0;for(r in t)if(_ue.call(t,r)&&++n&&!_ue.call(e,r)||!(r in e)||!lv(t[r],e[r]))return!1;return Object.keys(e).length===n}}return t!==t&&e!==e}Sue.dequal=lv});var Tue=E((a5t,bue)=>{"use strict";var{dequal:Eue}=_x(),Irt=Symbol.for("json-schema-ref"),l2=class{#e;#r;#t;#n;#s;constructor(e={}){this.#e={},this.#r={},this.#t=e.insertRefSymbol??!1,this.#n=e.allowEqualDuplicates??!0,this.#s=e.cloneSchemaWithoutRefs??!1}addSchema(e,r,n=!0){n&&(e.$id!==void 0&&e.$id.charAt(0)!=="#"?r=e.$id:this.#c(e,r));let i=e.$id;i!==void 0&&typeof i=="string"&&(i.charAt(0)==="#"?this.#u(e,r,i):(this.#c(e,i),r=i));let s=e.$ref;if(s!==void 0&&typeof s=="string"){let{refSchemaId:o,refJsonPointer:a}=this.#i(s,r);this.#e[r].refs.push({schemaId:o,jsonPointer:a})}for(let o in e)typeof e[o]=="object"&&e[o]!==null&&this.addSchema(e[o],r,!1)}getSchema(e,r="#"){let n=this.#e[e];if(n===void 0)throw new Error(`Cannot resolve ref "${e}${r}". Schema with id "${e}" is not found.`);return n.anchors[r]!==void 0?n.anchors[r]:vue(n.schema,r)}hasSchema(e){return this.#e[e]!==void 0}getSchemaRefs(e){let r=this.#e[e];if(r===void 0)throw new Error(`Schema with id "${e}" is not found.`);return r.refs}getSchemaDependencies(e,r={}){let n=this.#e[e];for(let i of n.refs){let s=i.schemaId;s===e||r[s]!==void 0||(r[s]=this.getSchema(s),this.getSchemaDependencies(s,r))}return r}derefSchema(e){if(this.#r[e]!==void 0)return;let r=this.#e[e];if(r===void 0)throw new Error(`Schema with id "${e}" is not found.`);!this.#s&&r.refs.length===0&&(this.#r[e]={schema:r.schema,anchors:r.anchors});let n=[];this.#o(r.schema,e,!0,n);let i=this.getSchemaDependencies(e);for(let s in i){let o=i[s];this.#o(o,s,!0,n)}for(let s of n){let{refSchemaId:o,refJsonPointer:a}=this.#i(s.ref,s.sourceSchemaId),c=this.getDerefSchema(o,a);if(c===null)throw new Error(`Cannot resolve ref "${s.ref}". Ref "${a}" is not found in schema "${o}".`);s.targetSchema=c,s.targetSchemaId=o}for(let s of n)this.#a(s,n)}getDerefSchema(e,r="#"){let n=this.#r[e];return n===void 0&&(this.derefSchema(e),n=this.#r[e]),n.anchors[r]!==void 0?n.anchors[r]:vue(n.schema,r)}#i(e,r){let n=e.indexOf("#");return n===-1?{refSchemaId:e,refJsonPointer:"#"}:n===0?{refSchemaId:r,refJsonPointer:e}:{refSchemaId:e.slice(0,n),refJsonPointer:e.slice(n)}}#o(e,r,n,i=[]){let s=Array.isArray(e)?[...e]:{...e};n&&(e.$id!==void 0&&e.$id.charAt(0)!=="#"?r=e.$id:this.#l(s,r));let o=s.$id;o!==void 0&&typeof o=="string"&&(o.charAt(0)==="#"?this.#d(s,r,o):(this.#l(s,o),r=o)),s.$ref!==void 0&&i.push({ref:s.$ref,sourceSchemaId:r,sourceSchema:s});for(let a in s){let c=s[a];typeof c=="object"&&c!==null&&(s[a]=this.#o(c,r,!1,i))}return s}#a(e,r){let{sourceSchema:n,targetSchema:i}=e;if(n.$ref){if(this.#t&&(n[Irt]=n.$ref),delete n.$ref,i.$ref){let s=r.find(o=>o.sourceSchema===i);this.#a(s,r)}for(let s in i)if(s!=="$id"){if(n[s]!==void 0){if(Eue(n[s],i[s]))continue;throw new Error(`Cannot resolve ref "${e.ref}". Property "${s}" already exists in schema "${e.sourceSchemaId}".`)}n[s]=i[s]}e.isResolved=!0}}#c(e,r){let n=this.#e[r];if(n!==void 0){if(this.#n&&Eue(e,n.schema))return;throw new Error(`There is already another schema with id "${r}".`)}this.#e[r]={schema:e,anchors:{},refs:[]}}#u(e,r,n){let{anchors:i}=this.#e[r];if(i[n]!==void 0)throw new Error(`There is already another anchor "${n}" in schema "${r}".`);i[n]=e}#l(e,r){this.#r[r]===void 0&&(this.#r[r]={schema:e,anchors:{}})}#d(e,r,n){let{anchors:i}=this.#r[r];i[n]=e}};function vue(t,e){let r=e.split("/"),n=t;for(let i of r)if(!(i===""||i==="#")){if(typeof n!="object"||n===null)return null;n=n[i]}return n??null}bue.exports={RefResolver:l2}});var d2=E((c5t,wue)=>{"use strict";var Ort=ax(),Prt=GR(),Crt=i2(),Nrt=iR()({proto:!0}),u2=class t{constructor(e){this.ajv=new Ort({...e,strictSchema:!1,validateSchema:!1,allowUnionTypes:!0,uriResolver:Prt}),Crt(this.ajv),this.ajv.addKeyword({keyword:"fjs_type",type:"object",errors:!1,validate:(r,n)=>n&&typeof n.toJSON=="function"}),this._ajvSchemas={},this._ajvOptions=e||{}}addSchema(e,r){let n=e.$id||r;if(e.$id!==void 0&&e.$id[0]==="#"&&(n=r+e.$id),this.ajv.refs[n]===void 0&&this.ajv.schemas[n]===void 0){let i=Nrt(e);this.convertSchemaToAjvFormat(i),this.ajv.addSchema(i,n),this._ajvSchemas[n]=e}}validate(e,r){return this.ajv.validate(e,r)}convertSchemaToAjvFormat(e){if(e!==null){e.type==="string"?(e.fjs_type="string",e.type=["string","object"]):Array.isArray(e.type)&&e.type.includes("string")&&!e.type.includes("object")&&(e.fjs_type="string",e.type.push("object"));for(let r in e)typeof e[r]=="object"&&this.convertSchemaToAjvFormat(e[r])}}getState(){return{ajvOptions:this._ajvOptions,ajvSchemas:this._ajvSchemas}}static restoreFromState(e){let r=new t(e.ajvOptions);for(let[n,i]of Object.entries(e.ajvSchemas))r.ajv.addSchema(i,n);return r}};wue.exports=u2});var Rue=E((l5t,Aue)=>{"use strict";var f2=class t{constructor(e,r,n="#"){this.schema=e,this.schemaId=r,this.jsonPointer=n}getPropertyLocation(e){return new t(this.schema[e],this.schemaId,this.jsonPointer+"/"+e)}getSchemaRef(){return this.schemaId+this.jsonPointer}};Aue.exports=f2});var Cue=E((u5t,h2)=>{"use strict";h2.exports=_e;h2.exports.default=_e;var krt={$schema:"http://json-schema.org/draft-07/schema#",$id:"http://json-schema.org/draft-07/schema#",title:"Core schema meta-schema",definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},default:!0},xue={enum:["array","boolean","integer","null","number","object","string"]},Iue=/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,$rt=mx().fullFormats.uri,Oue=mx().fullFormats.regex;function ds(t,{instancePath:e="",parentData:r,parentDataProperty:n,rootData:i=t}={}){let s=null,o=0,a=o;return typeof t=="number"&&!(t%1)&&!isNaN(t)&&isFinite(t)?o===a&&typeof t=="number"&&isFinite(t)&&(t<0||isNaN(t))?(ds.errors=[{instancePath:e,schemaPath:"#/definitions/nonNegativeInteger/minimum",keyword:"minimum",params:{comparison:">=",limit:0},message:"must be >= 0"}],!1):(ds.errors=s,o===0):(ds.errors=[{instancePath:e,schemaPath:"#/definitions/nonNegativeInteger/type",keyword:"type",params:{type:"integer"},message:"must be integer"}],!1)}var p2={validate:_e};function Hn(t,{instancePath:e="",parentData:r,parentDataProperty:n,rootData:i=t}={}){let s=null,o=0;if(o===0)if(Array.isArray(t)){if(t.length<1)return Hn.errors=[{instancePath:e,schemaPath:"#/minItems",keyword:"minItems",params:{limit:1},message:"must NOT have fewer than 1 items"}],!1;{var a=!0;let c=t.length;for(let l=0;l<c;l++){let u=o;p2.validate(t[l],{instancePath:e+"/"+l,parentData:t,parentDataProperty:l,rootData:i})||(s=s===null?p2.validate.errors:s.concat(p2.validate.errors),o=s.length);var a=u===o;if(!a)break}}}else return Hn.errors=[{instancePath:e,schemaPath:"#/type",keyword:"type",params:{type:"array"},message:"must be array"}],!1;return Hn.errors=s,o===0}var Pue=KE().default;function _e(t,{instancePath:e="",parentData:r,parentDataProperty:n,rootData:i=t}={}){let s=null,o=0;if(!(t&&typeof t=="object"&&!Array.isArray(t))&&typeof t!="boolean")return _e.errors=[{instancePath:e,schemaPath:"#/type",keyword:"type",params:{type:krt.type},message:"must be object,boolean"}],!1;if(o===0&&t&&typeof t=="object"&&!Array.isArray(t)){if(t.$id!==void 0){let S=t.$id,g=o;if(o===g&&o===g)if(typeof S=="string"){if(!Iue.test(S))return _e.errors=[{instancePath:e+"/$id",schemaPath:"#/properties/%24id/format",keyword:"format",params:{format:"uri-reference"},message:'must match format "uri-reference"'}],!1}else return _e.errors=[{instancePath:e+"/$id",schemaPath:"#/properties/%24id/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var a=g===o}else var a=!0;if(a){if(t.$schema!==void 0){let S=t.$schema,g=o;if(o===g&&o===g)if(typeof S=="string"){if(!$rt(S))return _e.errors=[{instancePath:e+"/$schema",schemaPath:"#/properties/%24schema/format",keyword:"format",params:{format:"uri"},message:'must match format "uri"'}],!1}else return _e.errors=[{instancePath:e+"/$schema",schemaPath:"#/properties/%24schema/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var a=g===o}else var a=!0;if(a){if(t.$ref!==void 0){let S=t.$ref,g=o;if(o===g&&o===g)if(typeof S=="string"){if(!Iue.test(S))return _e.errors=[{instancePath:e+"/$ref",schemaPath:"#/properties/%24ref/format",keyword:"format",params:{format:"uri-reference"},message:'must match format "uri-reference"'}],!1}else return _e.errors=[{instancePath:e+"/$ref",schemaPath:"#/properties/%24ref/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var a=g===o}else var a=!0;if(a){if(t.$comment!==void 0){let S=o;if(typeof t.$comment!="string")return _e.errors=[{instancePath:e+"/$comment",schemaPath:"#/properties/%24comment/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var a=S===o}else var a=!0;if(a){if(t.title!==void 0){let S=o;if(typeof t.title!="string")return _e.errors=[{instancePath:e+"/title",schemaPath:"#/properties/title/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var a=S===o}else var a=!0;if(a){if(t.description!==void 0){let S=o;if(typeof t.description!="string")return _e.errors=[{instancePath:e+"/description",schemaPath:"#/properties/description/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var a=S===o}else var a=!0;if(a){if(t.readOnly!==void 0){let S=o;if(typeof t.readOnly!="boolean")return _e.errors=[{instancePath:e+"/readOnly",schemaPath:"#/properties/readOnly/type",keyword:"type",params:{type:"boolean"},message:"must be boolean"}],!1;var a=S===o}else var a=!0;if(a){if(t.examples!==void 0){let S=o;if(o===S&&!Array.isArray(t.examples))return _e.errors=[{instancePath:e+"/examples",schemaPath:"#/properties/examples/type",keyword:"type",params:{type:"array"},message:"must be array"}],!1;var a=S===o}else var a=!0;if(a){if(t.multipleOf!==void 0){let S=t.multipleOf,g=o;if(o===g)if(typeof S=="number"&&isFinite(S)){if(S<=0||isNaN(S))return _e.errors=[{instancePath:e+"/multipleOf",schemaPath:"#/properties/multipleOf/exclusiveMinimum",keyword:"exclusiveMinimum",params:{comparison:">",limit:0},message:"must be > 0"}],!1}else return _e.errors=[{instancePath:e+"/multipleOf",schemaPath:"#/properties/multipleOf/type",keyword:"type",params:{type:"number"},message:"must be number"}],!1;var a=g===o}else var a=!0;if(a){if(t.maximum!==void 0){let S=t.maximum,g=o;if(!(typeof S=="number"&&isFinite(S)))return _e.errors=[{instancePath:e+"/maximum",schemaPath:"#/properties/maximum/type",keyword:"type",params:{type:"number"},message:"must be number"}],!1;var a=g===o}else var a=!0;if(a){if(t.exclusiveMaximum!==void 0){let S=t.exclusiveMaximum,g=o;if(!(typeof S=="number"&&isFinite(S)))return _e.errors=[{instancePath:e+"/exclusiveMaximum",schemaPath:"#/properties/exclusiveMaximum/type",keyword:"type",params:{type:"number"},message:"must be number"}],!1;var a=g===o}else var a=!0;if(a){if(t.minimum!==void 0){let S=t.minimum,g=o;if(!(typeof S=="number"&&isFinite(S)))return _e.errors=[{instancePath:e+"/minimum",schemaPath:"#/properties/minimum/type",keyword:"type",params:{type:"number"},message:"must be number"}],!1;var a=g===o}else var a=!0;if(a){if(t.exclusiveMinimum!==void 0){let S=t.exclusiveMinimum,g=o;if(!(typeof S=="number"&&isFinite(S)))return _e.errors=[{instancePath:e+"/exclusiveMinimum",schemaPath:"#/properties/exclusiveMinimum/type",keyword:"type",params:{type:"number"},message:"must be number"}],!1;var a=g===o}else var a=!0;if(a){if(t.maxLength!==void 0){let S=t.maxLength,g=o,T=o;if(!(typeof S=="number"&&!(S%1)&&!isNaN(S)&&isFinite(S)))return _e.errors=[{instancePath:e+"/maxLength",schemaPath:"#/definitions/nonNegativeInteger/type",keyword:"type",params:{type:"integer"},message:"must be integer"}],!1;if(o===T&&typeof S=="number"&&isFinite(S)&&(S<0||isNaN(S)))return _e.errors=[{instancePath:e+"/maxLength",schemaPath:"#/definitions/nonNegativeInteger/minimum",keyword:"minimum",params:{comparison:">=",limit:0},message:"must be >= 0"}],!1;var a=g===o}else var a=!0;if(a){if(t.minLength!==void 0){let S=o;ds(t.minLength,{instancePath:e+"/minLength",parentData:t,parentDataProperty:"minLength",rootData:i})||(s=s===null?ds.errors:s.concat(ds.errors),o=s.length);var a=S===o}else var a=!0;if(a){if(t.pattern!==void 0){let S=t.pattern,g=o;if(o===g&&o===g)if(typeof S=="string"){if(!Oue(S))return _e.errors=[{instancePath:e+"/pattern",schemaPath:"#/properties/pattern/format",keyword:"format",params:{format:"regex"},message:'must match format "regex"'}],!1}else return _e.errors=[{instancePath:e+"/pattern",schemaPath:"#/properties/pattern/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var a=g===o}else var a=!0;if(a){if(t.additionalItems!==void 0){let S=o;_e(t.additionalItems,{instancePath:e+"/additionalItems",parentData:t,parentDataProperty:"additionalItems",rootData:i})||(s=s===null?_e.errors:s.concat(_e.errors),o=s.length);var a=S===o}else var a=!0;if(a){if(t.items!==void 0){let S=t.items,g=o,T=o,I=!1,x=o;_e(S,{instancePath:e+"/items",parentData:t,parentDataProperty:"items",rootData:i})||(s=s===null?_e.errors:s.concat(_e.errors),o=s.length);var c=x===o;if(I=I||c,!I){let O=o;Hn(S,{instancePath:e+"/items",parentData:t,parentDataProperty:"items",rootData:i})||(s=s===null?Hn.errors:s.concat(Hn.errors),o=s.length);var c=O===o;I=I||c}if(I)o=T,s!==null&&(T?s.length=T:s=null);else{let O={instancePath:e+"/items",schemaPath:"#/properties/items/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf"};return s===null?s=[O]:s.push(O),o++,_e.errors=s,!1}var a=g===o}else var a=!0;if(a){if(t.maxItems!==void 0){let S=t.maxItems,g=o,T=o;if(!(typeof S=="number"&&!(S%1)&&!isNaN(S)&&isFinite(S)))return _e.errors=[{instancePath:e+"/maxItems",schemaPath:"#/definitions/nonNegativeInteger/type",keyword:"type",params:{type:"integer"},message:"must be integer"}],!1;if(o===T&&typeof S=="number"&&isFinite(S)&&(S<0||isNaN(S)))return _e.errors=[{instancePath:e+"/maxItems",schemaPath:"#/definitions/nonNegativeInteger/minimum",keyword:"minimum",params:{comparison:">=",limit:0},message:"must be >= 0"}],!1;var a=g===o}else var a=!0;if(a){if(t.minItems!==void 0){let S=o;ds(t.minItems,{instancePath:e+"/minItems",parentData:t,parentDataProperty:"minItems",rootData:i})||(s=s===null?ds.errors:s.concat(ds.errors),o=s.length);var a=S===o}else var a=!0;if(a){if(t.uniqueItems!==void 0){let S=o;if(typeof t.uniqueItems!="boolean")return _e.errors=[{instancePath:e+"/uniqueItems",schemaPath:"#/properties/uniqueItems/type",keyword:"type",params:{type:"boolean"},message:"must be boolean"}],!1;var a=S===o}else var a=!0;if(a){if(t.contains!==void 0){let S=o;_e(t.contains,{instancePath:e+"/contains",parentData:t,parentDataProperty:"contains",rootData:i})||(s=s===null?_e.errors:s.concat(_e.errors),o=s.length);var a=S===o}else var a=!0;if(a){if(t.maxProperties!==void 0){let S=t.maxProperties,g=o,T=o;if(!(typeof S=="number"&&!(S%1)&&!isNaN(S)&&isFinite(S)))return _e.errors=[{instancePath:e+"/maxProperties",schemaPath:"#/definitions/nonNegativeInteger/type",keyword:"type",params:{type:"integer"},message:"must be integer"}],!1;if(o===T&&typeof S=="number"&&isFinite(S)&&(S<0||isNaN(S)))return _e.errors=[{instancePath:e+"/maxProperties",schemaPath:"#/definitions/nonNegativeInteger/minimum",keyword:"minimum",params:{comparison:">=",limit:0},message:"must be >= 0"}],!1;var a=g===o}else var a=!0;if(a){if(t.minProperties!==void 0){let S=o;ds(t.minProperties,{instancePath:e+"/minProperties",parentData:t,parentDataProperty:"minProperties",rootData:i})||(s=s===null?ds.errors:s.concat(ds.errors),o=s.length);var a=S===o}else var a=!0;if(a){if(t.required!==void 0){let S=t.required,g=o;if(o===o)if(Array.isArray(S)){var l=!0;let x=S.length;for(let R=0;R<x;R++){let O=o;if(typeof S[R]!="string")return _e.errors=[{instancePath:e+"/required/"+R,schemaPath:"#/definitions/stringArray/items/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var l=O===o;if(!l)break}if(l){let R=S.length,O;if(R>1){let A={};for(;R--;){let b=S[R];if(typeof b=="string"){if(typeof A[b]=="number"){return O=A[b],_e.errors=[{instancePath:e+"/required",schemaPath:"#/definitions/stringArray/uniqueItems",keyword:"uniqueItems",params:{i:R,j:O},message:"must NOT have duplicate items (items ## "+O+" and "+R+" are identical)"}],!1;break}A[b]=R}}}}}else return _e.errors=[{instancePath:e+"/required",schemaPath:"#/definitions/stringArray/type",keyword:"type",params:{type:"array"},message:"must be array"}],!1;var a=g===o}else var a=!0;if(a){if(t.additionalProperties!==void 0){let S=o;_e(t.additionalProperties,{instancePath:e+"/additionalProperties",parentData:t,parentDataProperty:"additionalProperties",rootData:i})||(s=s===null?_e.errors:s.concat(_e.errors),o=s.length);var a=S===o}else var a=!0;if(a){if(t.definitions!==void 0){let S=t.definitions,g=o;if(o===g)if(S&&typeof S=="object"&&!Array.isArray(S))for(let I in S){let x=o;_e(S[I],{instancePath:e+"/definitions/"+I.replace(/~/g,"~0").replace(/\//g,"~1"),parentData:S,parentDataProperty:I,rootData:i})||(s=s===null?_e.errors:s.concat(_e.errors),o=s.length);var u=x===o;if(!u)break}else return _e.errors=[{instancePath:e+"/definitions",schemaPath:"#/properties/definitions/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;var a=g===o}else var a=!0;if(a){if(t.properties!==void 0){let S=t.properties,g=o;if(o===g)if(S&&typeof S=="object"&&!Array.isArray(S))for(let I in S){let x=o;_e(S[I],{instancePath:e+"/properties/"+I.replace(/~/g,"~0").replace(/\//g,"~1"),parentData:S,parentDataProperty:I,rootData:i})||(s=s===null?_e.errors:s.concat(_e.errors),o=s.length);var d=x===o;if(!d)break}else return _e.errors=[{instancePath:e+"/properties",schemaPath:"#/properties/properties/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;var a=g===o}else var a=!0;if(a){if(t.patternProperties!==void 0){let S=t.patternProperties,g=o;if(o===g)if(S&&typeof S=="object"&&!Array.isArray(S)){for(let I in S){let x=o;if(o===x&&typeof I=="string"&&!Oue(I)){let R={instancePath:e+"/patternProperties",schemaPath:"#/properties/patternProperties/propertyNames/format",keyword:"format",params:{format:"regex"},message:'must match format "regex"',propertyName:I};s===null?s=[R]:s.push(R),o++}var f=x===o;if(!f){let R={instancePath:e+"/patternProperties",schemaPath:"#/properties/patternProperties/propertyNames",keyword:"propertyNames",params:{propertyName:I},message:"property name must be valid"};return s===null?s=[R]:s.push(R),o++,_e.errors=s,!1;break}}if(f)for(let I in S){let x=o;_e(S[I],{instancePath:e+"/patternProperties/"+I.replace(/~/g,"~0").replace(/\//g,"~1"),parentData:S,parentDataProperty:I,rootData:i})||(s=s===null?_e.errors:s.concat(_e.errors),o=s.length);var p=x===o;if(!p)break}}else return _e.errors=[{instancePath:e+"/patternProperties",schemaPath:"#/properties/patternProperties/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;var a=g===o}else var a=!0;if(a){if(t.dependencies!==void 0){let S=t.dependencies,g=o;if(o===g)if(S&&typeof S=="object"&&!Array.isArray(S))for(let I in S){let x=S[I],R=o,O=o,A=!1,b=o;_e(x,{instancePath:e+"/dependencies/"+I.replace(/~/g,"~0").replace(/\//g,"~1"),parentData:S,parentDataProperty:I,rootData:i})||(s=s===null?_e.errors:s.concat(_e.errors),o=s.length);var h=b===o;if(A=A||h,!A){let L=o;if(o===o)if(Array.isArray(x)){var m=!0;let P=x.length;for(let N=0;N<P;N++){let F=o;if(typeof x[N]!="string"){let de={instancePath:e+"/dependencies/"+I.replace(/~/g,"~0").replace(/\//g,"~1")+"/"+N,schemaPath:"#/definitions/stringArray/items/type",keyword:"type",params:{type:"string"},message:"must be string"};s===null?s=[de]:s.push(de),o++}var m=F===o;if(!m)break}if(m){let N=x.length,F;if(N>1){let V={};for(;N--;){let de=x[N];if(typeof de=="string"){if(typeof V[de]=="number"){F=V[de];let Te={instancePath:e+"/dependencies/"+I.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"#/definitions/stringArray/uniqueItems",keyword:"uniqueItems",params:{i:N,j:F},message:"must NOT have duplicate items (items ## "+F+" and "+N+" are identical)"};s===null?s=[Te]:s.push(Te),o++;break}V[de]=N}}}}}else{let P={instancePath:e+"/dependencies/"+I.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"#/definitions/stringArray/type",keyword:"type",params:{type:"array"},message:"must be array"};s===null?s=[P]:s.push(P),o++}var h=L===o;A=A||h}if(A)o=O,s!==null&&(O?s.length=O:s=null);else{let L={instancePath:e+"/dependencies/"+I.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"#/properties/dependencies/additionalProperties/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf"};return s===null?s=[L]:s.push(L),o++,_e.errors=s,!1}var _=R===o;if(!_)break}else return _e.errors=[{instancePath:e+"/dependencies",schemaPath:"#/properties/dependencies/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;var a=g===o}else var a=!0;if(a){if(t.propertyNames!==void 0){let S=o;_e(t.propertyNames,{instancePath:e+"/propertyNames",parentData:t,parentDataProperty:"propertyNames",rootData:i})||(s=s===null?_e.errors:s.concat(_e.errors),o=s.length);var a=S===o}else var a=!0;if(a){if(t.enum!==void 0){let S=t.enum,g=o;if(o===g)if(Array.isArray(S)){if(S.length<1)return _e.errors=[{instancePath:e+"/enum",schemaPath:"#/properties/enum/minItems",keyword:"minItems",params:{limit:1},message:"must NOT have fewer than 1 items"}],!1;{let I=S.length,x;if(I>1){e:for(;I--;)for(x=I;x--;)if(Pue(S[I],S[x])){return _e.errors=[{instancePath:e+"/enum",schemaPath:"#/properties/enum/uniqueItems",keyword:"uniqueItems",params:{i:I,j:x},message:"must NOT have duplicate items (items ## "+x+" and "+I+" are identical)"}],!1;break e}}}}else return _e.errors=[{instancePath:e+"/enum",schemaPath:"#/properties/enum/type",keyword:"type",params:{type:"array"},message:"must be array"}],!1;var a=g===o}else var a=!0;if(a){if(t.type!==void 0){let S=t.type,g=o,T=o,I=!1,x=o;if(!(S==="array"||S==="boolean"||S==="integer"||S==="null"||S==="number"||S==="object"||S==="string")){let O={instancePath:e+"/type",schemaPath:"#/definitions/simpleTypes/enum",keyword:"enum",params:{allowedValues:xue.enum},message:"must be equal to one of the allowed values"};s===null?s=[O]:s.push(O),o++}var y=x===o;if(I=I||y,!I){let O=o;if(o===O)if(Array.isArray(S))if(S.length<1){let b={instancePath:e+"/type",schemaPath:"#/properties/type/anyOf/1/minItems",keyword:"minItems",params:{limit:1},message:"must NOT have fewer than 1 items"};s===null?s=[b]:s.push(b),o++}else{var v=!0;let b=S.length;for(let L=0;L<b;L++){let C=S[L],w=o;if(!(C==="array"||C==="boolean"||C==="integer"||C==="null"||C==="number"||C==="object"||C==="string")){let N={instancePath:e+"/type/"+L,schemaPath:"#/definitions/simpleTypes/enum",keyword:"enum",params:{allowedValues:xue.enum},message:"must be equal to one of the allowed values"};s===null?s=[N]:s.push(N),o++}var v=w===o;if(!v)break}if(v){let L=S.length,C;if(L>1){e:for(;L--;)for(C=L;C--;)if(Pue(S[L],S[C])){let w={instancePath:e+"/type",schemaPath:"#/properties/type/anyOf/1/uniqueItems",keyword:"uniqueItems",params:{i:L,j:C},message:"must NOT have duplicate items (items ## "+C+" and "+L+" are identical)"};s===null?s=[w]:s.push(w),o++;break e}}}}else{let b={instancePath:e+"/type",schemaPath:"#/properties/type/anyOf/1/type",keyword:"type",params:{type:"array"},message:"must be array"};s===null?s=[b]:s.push(b),o++}var y=O===o;I=I||y}if(I)o=T,s!==null&&(T?s.length=T:s=null);else{let O={instancePath:e+"/type",schemaPath:"#/properties/type/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf"};return s===null?s=[O]:s.push(O),o++,_e.errors=s,!1}var a=g===o}else var a=!0;if(a){if(t.format!==void 0){let S=o;if(typeof t.format!="string")return _e.errors=[{instancePath:e+"/format",schemaPath:"#/properties/format/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var a=S===o}else var a=!0;if(a){if(t.contentMediaType!==void 0){let S=o;if(typeof t.contentMediaType!="string")return _e.errors=[{instancePath:e+"/contentMediaType",schemaPath:"#/properties/contentMediaType/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var a=S===o}else var a=!0;if(a){if(t.contentEncoding!==void 0){let S=o;if(typeof t.contentEncoding!="string")return _e.errors=[{instancePath:e+"/contentEncoding",schemaPath:"#/properties/contentEncoding/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;var a=S===o}else var a=!0;if(a){if(t.if!==void 0){let S=o;_e(t.if,{instancePath:e+"/if",parentData:t,parentDataProperty:"if",rootData:i})||(s=s===null?_e.errors:s.concat(_e.errors),o=s.length);var a=S===o}else var a=!0;if(a){if(t.then!==void 0){let S=o;_e(t.then,{instancePath:e+"/then",parentData:t,parentDataProperty:"then",rootData:i})||(s=s===null?_e.errors:s.concat(_e.errors),o=s.length);var a=S===o}else var a=!0;if(a){if(t.else!==void 0){let S=o;_e(t.else,{instancePath:e+"/else",parentData:t,parentDataProperty:"else",rootData:i})||(s=s===null?_e.errors:s.concat(_e.errors),o=s.length);var a=S===o}else var a=!0;if(a){if(t.allOf!==void 0){let S=o;Hn(t.allOf,{instancePath:e+"/allOf",parentData:t,parentDataProperty:"allOf",rootData:i})||(s=s===null?Hn.errors:s.concat(Hn.errors),o=s.length);var a=S===o}else var a=!0;if(a){if(t.anyOf!==void 0){let S=o;Hn(t.anyOf,{instancePath:e+"/anyOf",parentData:t,parentDataProperty:"anyOf",rootData:i})||(s=s===null?Hn.errors:s.concat(Hn.errors),o=s.length);var a=S===o}else var a=!0;if(a){if(t.oneOf!==void 0){let S=o;Hn(t.oneOf,{instancePath:e+"/oneOf",parentData:t,parentDataProperty:"oneOf",rootData:i})||(s=s===null?Hn.errors:s.concat(Hn.errors),o=s.length);var a=S===o}else var a=!0;if(a)if(t.not!==void 0){let S=o;_e(t.not,{instancePath:e+"/not",parentData:t,parentDataProperty:"not",rootData:i})||(s=s===null?_e.errors:s.concat(_e.errors),o=s.length);var a=S===o}else var a=!0}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}return _e.errors=s,o===0}});var y2=E((d5t,Nue)=>{"use strict";var m2=class extends Error{constructor(e,r){super(),this.name="JsonSchemaMergeError",this.code="JSON_SCHEMA_MERGE_ERROR",this.message=`Failed to merge "${e}" keyword schemas.`,this.schemas=r}},g2=class extends Error{constructor(e,r){super(),this.name="JsonSchemaMergeError",this.code="JSON_SCHEMA_MERGE_ERROR",this.message=`Resolver for "${e}" keyword not found.`,this.schemas=r}},_2=class extends Error{constructor(e){super(),this.name="JsonSchemaMergeError",this.code="JSON_SCHEMA_MERGE_ERROR",this.message=`Invalid "onConflict" option: "${e}".`}};Nue.exports={MergeError:m2,ResolverNotFoundError:g2,InvalidOnConflictOptionError:_2}});var Lue=E((f5t,$ue)=>{"use strict";var{dequal:Lrt}=_x(),{MergeError:S2}=y2();function kue(t){let e=t[0];for(let r=1;r<t.length;r++)e=e.filter(n=>t[r].includes(n));return e}function Drt(t,e,r){let n=kue(e);if(n.length===0)throw new S2(t,e);r[t]=n}function Mrt(t,e,r){for(let i=0;i<e.length;i++)Array.isArray(e[i])||(e[i]=[e[i]]);let n=kue(e);if(n.length===0)throw new S2(t,e);n.length===1?r[t]=n[0]:r[t]=n}function Urt(t,e,r){let n=[];for(let i of e)for(let s of i)n.includes(s)||n.push(s);r[t]=n}function Frt(t,e,r){r[t]=Math.min(...e)}function jrt(t,e,r){r[t]=Math.max(...e)}function qrt(t,e,r){let n=(a,c)=>c?n(c,a%c):a,i=(a,c)=>a*c/n(a,c),s=1;for(let a of e)for(;a*s%1!==0;)s*=10;let o=e[0]*s;for(let a of e)o=i(o,a*s);r[t]=o/s}function Brt(t,e,r){let n=e[0];for(let i=1;i<e.length;i++)if(!Lrt(e[i],n))throw new S2(t,e);r[t]=n}function zrt(){}function Vrt(t,e,r){for(let n of e)if(n===!1){r[t]=!1;return}r[t]=!0}function Hrt(t,e,r){for(let n of e)if(n===!0){r[t]=!0;return}r[t]=!1}$ue.exports={arraysIntersection:Drt,hybridArraysIntersection:Mrt,arraysUnion:Urt,minNumber:Frt,maxNumber:jrt,commonMultiple:qrt,allEqual:Brt,booleanAnd:Vrt,booleanOr:Hrt,skip:zrt}});var que=E((p5t,jue)=>{"use strict";var{dequal:Grt}=_x(),rr=Lue(),Ex=y2(),Uue={$id:rr.skip,type:rr.hybridArraysIntersection,enum:rr.arraysIntersection,minLength:rr.maxNumber,maxLength:rr.minNumber,minimum:rr.maxNumber,maximum:rr.minNumber,multipleOf:rr.commonMultiple,exclusiveMinimum:rr.maxNumber,exclusiveMaximum:rr.minNumber,minItems:rr.maxNumber,maxItems:rr.minNumber,maxProperties:rr.minNumber,minProperties:rr.maxNumber,const:rr.allEqual,default:rr.allEqual,format:rr.allEqual,required:rr.arraysUnion,properties:Xrt,patternProperties:Sx,additionalProperties:yx,items:Krt,additionalItems:Jrt,definitions:Sx,$defs:Sx,nullable:rr.booleanAnd,oneOf:Due,anyOf:Due,allOf:rr.arraysUnion,not:yx,if:Qrt,then:rr.skip,else:rr.skip,dependencies:Mue,dependentRequired:Mue,dependentSchemas:Sx,propertyNames:yx,uniqueItems:rr.booleanOr,contains:yx};function yx(t,e,r,n,i){r[t]=Qs(e,i)}function Wrt(t){let e=[[]];for(let r of t){let n=[];for(let i of e)for(let s of r)n.push([...i,s]);e=n}return e}function Due(t,e,r,n,i){if(e.length===1){r[t]=e[0];return}let s=Wrt(e),o=[];for(let a of s)try{let c=Qs(a,i);c!==void 0&&o.push(c)}catch(c){if(c instanceof Ex.MergeError)continue;throw c}r[t]=o}function Yrt(t,e){let{items:r,additionalItems:n}=t;return Array.isArray(r)?e<r.length?r[e]:n:r!==void 0?r:n}function Krt(t,e,r,n,i){let s=0;for(let a of e)Array.isArray(a)&&(s=Math.max(s,a.length));if(s===0){r[t]=Qs(e,i);return}let o=[];for(let a=0;a<s;a++){let c=[];for(let l of n){let u=Yrt(l,a);u!==void 0&&c.push(u)}o[a]=Qs(c,i)}r[t]=o}function Jrt(t,e,r,n,i){let s=!1;for(let a of n)if(Array.isArray(a.items)){s=!0;break}if(!s){r[t]=Qs(e,i);return}let o=[];for(let a of n){let c=a.additionalItems;c===void 0&&!Array.isArray(a.items)&&(c=a.items),c!==void 0&&o.push(c)}r[t]=Qs(o,i)}function Zrt(t,e){let{properties:r,patternProperties:n,additionalProperties:i}=t;if(r?.[e]!==void 0)return r[e];for(let s of Object.keys(n??{}))if(new RegExp(s).test(e))return n[s];return i}function Xrt(t,e,r,n,i){let s={};for(let a of n){let c=a.properties??{};for(let l of Object.keys(c)){if(s[l]!==void 0)continue;let u=c[l];s[l]=[u];for(let d of n){if(a===d)continue;let f=Zrt(d,l);f!==void 0&&s[l].push(f)}}}let o={};for(let a of Object.keys(s)){let c=s[a];o[a]=Qs(c,i)}r[t]=o}function Sx(t,e,r,n,i){let s={};for(let a of e)for(let c of Object.keys(a))s[c]===void 0&&(s[c]=[]),s[c].push(a[c]);let o={};for(let a of Object.keys(s)){let c=s[a],l=Qs(c,i);o[a]=l}r[t]=o}function Qrt(t,e,r,n,i){for(let s=0;s<n.length;s++){let o={if:n[s].if,then:n[s].then,else:n[s].else};if(o.if!==void 0){if(r.if===void 0){r.if=o.if,o.then!==void 0&&(r.then=o.then),o.else!==void 0&&(r.else=o.else);continue}r.then!==void 0&&(r.then=Qs([r.then,o],i)),r.else!==void 0&&(r.else=Qs([r.else,o],i))}}}function Mue(t,e,r){let n={};for(let i of e)for(let s of Object.keys(i)){n[s]===void 0&&(n[s]=[]);let o=n[s];for(let a of i[s])o.includes(a)||o.push(a)}r[t]=n}function Qs(t,e){if(t.length===0)return{};if(t.length===1)return t[0];let r={},n={},i=!0;for(let s of t){if(s===!1)return!1;if(s!==!0){i=!1;for(let o of Object.keys(s))n[o]===void 0&&(n[o]=[]),n[o].push(s[o])}}if(i)return!0;for(let s of Object.keys(n)){let o=n[s];(e.resolvers[s]??e.defaultResolver)(s,o,r,t,e)}return r}function Fue(t,e,r,n,i){let s=i.onConflict??"throw";if(e.length===1||s==="first"){r[t]=e[0];return}let o=!0;for(let a=1;a<e.length;a++)if(!Grt(e[a],e[0])){o=!1;break}if(o){r[t]=e[0];return}if(s==="throw")throw new Ex.ResolverNotFoundError(t,e);if(s!=="skip")throw new Ex.InvalidOnConflictOptionError(s)}function ent(t,e={}){return e.defaultResolver===void 0&&(e.defaultResolver=Fue),e.resolvers={...Uue,...e.resolvers},Qs(t,e)}jue.exports={mergeSchemas:ent,keywordsResolvers:Uue,defaultResolver:Fue,...Ex}});var zue=E((h5t,Bue)=>{"use strict";var{mergeSchemas:tnt}=que();function rnt(t){return tnt(t,{onConflict:"skip"})}Bue.exports=rnt});var Vue=E((m5t,E2)=>{"use strict";function nnt(t,e,r,n){let i="";e.validatorSchemasIds.size>0?(i+=`const Validator = require('fast-json-stringify/lib/validator')
36
36
  `,i+=`const validatorState = ${JSON.stringify(n.getState())}
37
37
  `,i+=`const validator = Validator.restoreFromState(validatorState)
38
38
  `):i+=`const validator = null
@@ -357,7 +357,7 @@ ${e}`)}function Yx(t,e,r,n){if((t.isLeafNode||n.commonPrefix!==!1)&&(r=r||"(empt
357
357
  if (candidates === 0) return null;
358
358
  `)}for(let n in e.strategies){if(!Object.hasOwn(e.strategies,n))continue;e.strategies[n].mustMatchWhenDerived&&!this.constraints.includes(n)&&r.push(`if (derivedConstraints.${n} !== undefined) return null`)}r.push("return this.handlers[31 - Math.clz32(candidates)]"),this._getHandlerMatchingConstraints=new Function("derivedConstraints",r.join(`
359
359
  `))}};Qpe.exports=cB});var rhe=E(($8t,the)=>{"use strict";var jat=ehe(),eI={STATIC:0,PARAMETRIC:1,WILDCARD:2},Kx=class{constructor(){this.isLeafNode=!1,this.routes=null,this.handlerStorage=null}addRoute(e,r){this.routes===null&&(this.routes=[]),this.handlerStorage===null&&(this.handlerStorage=new jat),this.isLeafNode=!0,this.routes.push(e),this.handlerStorage.addHandler(r,e)}},Jx=class extends Kx{constructor(){super(),this.staticChildren={}}findStaticMatchingChild(e,r){let n=this.staticChildren[e.charAt(r)];return n===void 0||!n.matchPrefix(e,r)?null:n}getStaticChild(e,r=0){if(e.length===r)return this;let n=this.findStaticMatchingChild(e,r);return n?n.getStaticChild(e,r+n.prefix.length):null}createStaticChild(e){if(e.length===0)return this;let r=this.staticChildren[e.charAt(0)];if(r){let i=1;for(;i<r.prefix.length;i++)if(e.charCodeAt(i)!==r.prefix.charCodeAt(i)){r=r.split(this,i);break}return r.createStaticChild(e.slice(i))}let n=e.charAt(0);return this.staticChildren[n]=new Zx(e),this.staticChildren[n]}},Zx=class t extends Jx{constructor(e){super(),this.prefix=e,this.wildcardChild=null,this.parametricChildren=[],this.kind=eI.STATIC,this._compilePrefixMatch()}getParametricChild(e){let r=e&&e.source,n=this.parametricChildren.find(i=>(i.regex&&i.regex.source)===r);return n||null}createParametricChild(e,r,n){let i=this.getParametricChild(e);return i?(i.nodePaths.add(n),i):(i=new Xx(e,r,n),this.parametricChildren.push(i),this.parametricChildren.sort((s,o)=>s.isRegex?o.isRegex?s.staticSuffix===null?1:o.staticSuffix===null?-1:o.staticSuffix.endsWith(s.staticSuffix)?1:s.staticSuffix.endsWith(o.staticSuffix)?-1:0:-1:1),i)}getWildcardChild(){return this.wildcardChild}createWildcardChild(){return this.wildcardChild=this.getWildcardChild()||new Qx,this.wildcardChild}split(e,r){let n=this.prefix.slice(0,r),i=this.prefix.slice(r);this.prefix=i,this._compilePrefixMatch();let s=new t(n);return s.staticChildren[i.charAt(0)]=this,e.staticChildren[n.charAt(0)]=s,s}getNextNode(e,r,n,i){let s=this.findStaticMatchingChild(e,r),o=0;if(s===null){if(this.parametricChildren.length===0)return this.wildcardChild;s=this.parametricChildren[0],o=1}this.wildcardChild!==null&&n.push({paramsCount:i,brotherPathIndex:r,brotherNode:this.wildcardChild});for(let a=this.parametricChildren.length-1;a>=o;a--)n.push({paramsCount:i,brotherPathIndex:r,brotherNode:this.parametricChildren[a]});return s}_compilePrefixMatch(){if(this.prefix.length===1){this.matchPrefix=()=>!0;return}let e=[];for(let r=1;r<this.prefix.length;r++){let n=this.prefix.charCodeAt(r);e.push(`path.charCodeAt(i + ${r}) === ${n}`)}this.matchPrefix=new Function("path","i",`return ${e.join(" && ")}`)}},Xx=class extends Jx{constructor(e,r,n){super(),this.isRegex=!!e,this.regex=e||null,this.staticSuffix=r||null,this.kind=eI.PARAMETRIC,this.nodePaths=new Set([n])}getNextNode(e,r){return this.findStaticMatchingChild(e,r)}},Qx=class extends Kx{constructor(){super(),this.kind=eI.WILDCARD}getNextNode(){return null}};the.exports={StaticNode:Zx,ParametricNode:Xx,WildcardNode:Qx,NODE_TYPES:eI}});var ihe=E((L8t,nhe)=>{"use strict";var qat=W("assert");function bv(){if(!(this instanceof bv))return new bv;this.store=new Map,this.maxMajor=0,this.maxMinors={},this.maxPatches={}}bv.prototype.set=function(t,e){if(typeof t!="string")throw new TypeError("Version should be a string");let[r,n,i]=t.split(".",3);if(isNaN(r))throw new TypeError("Major version must be a numeric value");return r=Number(r),n=Number(n)||0,i=Number(i)||0,r>=this.maxMajor&&(this.maxMajor=r,this.store.set("x",e),this.store.set("*",e),this.store.set("x.x",e),this.store.set("x.x.x",e)),n>=(this.maxMinors[r]||0)&&(this.maxMinors[r]=n,this.store.set(`${r}.x`,e),this.store.set(`${r}.x.x`,e)),i>=(this.maxPatches[`${r}.${n}`]||0)&&(this.maxPatches[`${r}.${n}`]=i,this.store.set(`${r}.${n}.x`,e)),this.store.set(`${r}.${n}.${i}`,e),this};bv.prototype.get=function(t){return this.store.get(t)};nhe.exports={name:"version",mustMatchWhenDerived:!0,storage:bv,validate(t){qat(typeof t=="string","Version should be a string")}}});var ohe=E((D8t,she)=>{"use strict";var Bat=W("assert");function zat(){let t=new Map,e=[];return{get:r=>{let n=t.get(r);if(n)return n;for(let i of e)if(i.host.test(r))return i.value},set:(r,n)=>{r instanceof RegExp?e.push({host:r,value:n}):t.set(r,n)}}}she.exports={name:"host",mustMatchWhenDerived:!1,storage:zat,validate(t){Bat(typeof t=="string"||Object.prototype.toString.call(t)==="[object RegExp]","Host should be a string or a RegExp")}}});var che=E((M8t,ahe)=>{"use strict";var Vat=ihe(),Hat=ohe(),lB=W("assert"),uB=class{constructor(e){if(this.strategies={version:Vat,host:Hat},this.strategiesInUse=new Set,this.asyncStrategiesInUse=new Set,e)for(let r of Object.values(e))this.addConstraintStrategy(r)}isStrategyUsed(e){return this.strategiesInUse.has(e)||this.asyncStrategiesInUse.has(e)}hasConstraintStrategy(e){let r=this.strategies[e];return r!==void 0?r.isCustom||this.isStrategyUsed(e):!1}addConstraintStrategy(e){if(lB(typeof e.name=="string"&&e.name!=="","strategy.name is required."),lB(e.storage&&typeof e.storage=="function","strategy.storage function is required."),lB(e.deriveConstraint&&typeof e.deriveConstraint=="function","strategy.deriveConstraint function is required."),this.strategies[e.name]&&this.strategies[e.name].isCustom)throw new Error(`There already exists a custom constraint with the name ${e.name}.`);if(this.isStrategyUsed(e.name))throw new Error(`There already exists a route with ${e.name} constraint.`);e.isCustom=!0,e.isAsync=e.deriveConstraint.length===3,this.strategies[e.name]=e,e.mustMatchWhenDerived&&this.noteUsage({[e.name]:e})}deriveConstraints(e,r,n){let i=this.deriveSyncConstraints(e,r);if(n===void 0)return i;this.deriveAsyncConstraints(i,e,r,n)}deriveSyncConstraints(e,r){}noteUsage(e){if(e){let r=this.strategiesInUse.size;for(let n in e){if(!Object.hasOwn(e,n))continue;this.strategies[n].isAsync?this.asyncStrategiesInUse.add(n):this.strategiesInUse.add(n)}r!==this.strategiesInUse.size&&this._buildDeriveConstraints()}}newStoreForConstraint(e){if(!this.strategies[e])throw new Error(`No strategy registered for constraint key ${e}`);return this.strategies[e].storage()}validateConstraints(e){for(let r in e){if(!Object.hasOwn(e,r))continue;let n=e[r];if(typeof n>"u")throw new Error("Can't pass an undefined constraint value, must pass null or no key at all");let i=this.strategies[r];if(!i)throw new Error(`No strategy registered for constraint key ${r}`);i.validate&&i.validate(n)}}deriveAsyncConstraints(e,r,n,i){let s=this.asyncStrategiesInUse.size;if(s===0){i(null,e);return}e=e||{};for(let o of this.asyncStrategiesInUse)this.strategies[o].deriveConstraint(r,n,(c,l)=>{if(c!==null){i(c);return}e[o]=l,--s===0&&i(null,e)})}_buildDeriveConstraints(){if(this.strategiesInUse.size===0)return;let e=["return {"];for(let r of this.strategiesInUse){let n=this.strategies[r];n.isCustom?e.push(` ${n.name}: this.strategies.${r}.deriveConstraint(req, ctx),`):r==="version"?e.push(" version: req.headers['accept-version'],"):e.push(" host: req.headers.host || req.headers[':authority'],")}e.push("}"),this.deriveSyncConstraints=new Function("req","ctx",e.join(`
360
- `)).bind(this)}};ahe.exports=uB});var uhe=E((U8t,lhe)=>{"use strict";var Gat=["ACL","BIND","CHECKOUT","CONNECT","COPY","DELETE","GET","HEAD","LINK","LOCK","M-SEARCH","MERGE","MKACTIVITY","MKCALENDAR","MKCOL","MOVE","NOTIFY","OPTIONS","PATCH","POST","PROPFIND","PROPPATCH","PURGE","PUT","QUERY","REBIND","REPORT","SEARCH","SOURCE","SUBSCRIBE","TRACE","UNBIND","UNLINK","UNLOCK","UNSUBSCRIBE"];lhe.exports=Gat});var phe=E((F8t,fhe)=>{"use strict";function dhe(t,e){return t===50?e===53?"%":e===51?"#":e===52?"$":e===54?"&":e===66||e===98?"+":e===67||e===99?",":e===70||e===102?"/":null:t===51?e===65||e===97?":":e===66||e===98?";":e===68||e===100?"=":e===70||e===102?"?":null:t===52&&e===48?"@":null}function Wat(t,e){let r=!1,n=!1,i="";for(let o=1;o<t.length;o++){let a=t.charCodeAt(o);if(a===37){let c=t.charCodeAt(o+1),l=t.charCodeAt(o+2);dhe(c,l)===null?r=!0:(n=!0,c===50&&l===53&&(r=!0,t=t.slice(0,o+1)+"25"+t.slice(o+1),o+=2),o+=2)}else if(a===63||a===35||a===59&&e){i=t.slice(o+1),t=t.slice(0,o);break}}return{path:r?decodeURI(t):t,querystring:i,shouldDecodeParam:n}}function Yat(t){let e=t.indexOf("%");if(e===-1)return t;let r="",n=e;for(let i=e;i<t.length;i++)if(t.charCodeAt(i)===37){let s=t.charCodeAt(i+1),o=t.charCodeAt(i+2),a=dhe(s,o);r+=t.slice(n,i)+a,n=i+3}return t.slice(0,e)+r+t.slice(n)}fhe.exports={safeDecodeURI:Wat,safeDecodeURIComponent:Yat}});var hB=E((j8t,The)=>{"use strict";var yr=W("assert"),Kat=Spe(),bm=qpe(),pB=LE(),{prettyPrintTree:Jat}=Kpe(),{StaticNode:hhe,NODE_TYPES:mhe}=rhe(),Zat=che(),vm=uhe(),dB=Wx(),{safeDecodeURI:ghe,safeDecodeURIComponent:fB}=phe(),_he=/^https?:\/\/.*?\//,hf=/(\/:[^/()]*?)\?(\/?)/,yhe=/[.*+?^${}()|[\]\\]/g,She=/\/\/+/g;if(!bm(_he))throw new Error("the FULL_PATH_REGEXP is not safe, update this module");if(!bm(hf))throw new Error("the OPTIONAL_PARAM_REGEXP is not safe, update this module");if(!bm(yhe))throw new Error("the ESCAPE_REGEXP is not safe, update this module");if(!bm(She))throw new Error("the REMOVE_DUPLICATE_SLASHES_REGEXP is not safe, update this module");function Vt(t){if(!(this instanceof Vt))return new Vt(t);t=t||{},this._opts=t,t.defaultRoute?(yr(typeof t.defaultRoute=="function","The default route must be a function"),this.defaultRoute=t.defaultRoute):this.defaultRoute=null,t.onBadUrl?(yr(typeof t.onBadUrl=="function","The bad url handler must be a function"),this.onBadUrl=t.onBadUrl):this.onBadUrl=null,t.buildPrettyMeta?(yr(typeof t.buildPrettyMeta=="function","buildPrettyMeta must be a function"),this.buildPrettyMeta=t.buildPrettyMeta):this.buildPrettyMeta=Xat,t.querystringParser?(yr(typeof t.querystringParser=="function","querystringParser must be a function"),this.querystringParser=t.querystringParser):this.querystringParser=e=>e.length===0?{}:Kat.parse(e),this.caseSensitive=t.caseSensitive===void 0?!0:t.caseSensitive,this.ignoreTrailingSlash=t.ignoreTrailingSlash||!1,this.ignoreDuplicateSlashes=t.ignoreDuplicateSlashes||!1,this.maxParamLength=t.maxParamLength||100,this.onMaxParamLength=t.onMaxParamLength||null,this.allowUnsafeRegex=t.allowUnsafeRegex||!1,this.constrainer=new Zat(t.constraints),this.useSemicolonDelimiter=t.useSemicolonDelimiter||!1,this.routes=[],this.trees={}}Vt.prototype.on=function(e,r,n,i,s){typeof n=="function"&&(i!==void 0&&(s=i),i=n,n={}),yr(typeof r=="string","Path should be a string"),yr(r.length>0,"The path could not be empty"),yr(r[0]==="/"||r[0]==="*","The first character of a path should be `/` or `*`"),yr(typeof i=="function","Handler should be a function");let o=r.match(hf);if(o){yr(r.length===o.index+o[0].length,"Optional Parameter needs to be the last parameter of the path");let l=r.replace(hf,"$1$2"),u=r.replace(hf,"$2")||"/";this.on(e,l,n,i,s),this.on(e,u,n,i,s);return}let a=r;this.ignoreDuplicateSlashes&&(r=tI(r)),this.ignoreTrailingSlash&&(r=rI(r));let c=Array.isArray(e)?e:[e];for(let l of c)yr(typeof l=="string","Method should be a string"),yr(vm.includes(l),`Method '${l}' is not an http method.`),this._on(l,r,n,i,s,a)};Vt.prototype._on=function(e,r,n,i,s){let o={};n.constraints!==void 0&&(yr(typeof n.constraints=="object"&&n.constraints!==null,"Constraints should be an object"),Object.keys(n.constraints).length!==0&&(o=n.constraints)),this.constrainer.validateConstraints(o),this.constrainer.noteUsage(o),this.trees[e]===void 0&&(this.trees[e]=new hhe("/"));let a=r;if(a==="*"&&this.trees[e].prefix.length!==0){let f=this.trees[e];this.trees[e]=new hhe(""),this.trees[e].staticChildren["/"]=f}let c=this.trees[e],l=c.prefix.length,u=[];for(let f=0;f<=a.length;f++){if(a.charCodeAt(f)===58&&a.charCodeAt(f+1)===58){f++;continue}let p=a.charCodeAt(f)===58&&a.charCodeAt(f+1)!==58,h=a.charCodeAt(f)===42;if(p||h||f===a.length&&f!==l){let m=a.slice(l,f);this.caseSensitive||(m=m.toLowerCase()),m=m.replaceAll("::",":"),m=m.replaceAll("%","%25"),c=c.createStaticChild(m)}if(p){let m=!1,_=!0,y="",v=[],S=f+1;for(let g=S;;g++){let T=a.charCodeAt(g),I=T===40,x=T===45||T===46,R=T===47||g===a.length;if(I||x||R){let O=a.slice(S,g);if(u.push(O),m=m||I||x,I){let L=bhe(a,g),C=a.slice(g,L+1);this.allowUnsafeRegex||yr(bm(new RegExp(C)),`The regex '${C}' is not safe!`),v.push(vhe(C)),g=L+1,_=!0}else v.push(_?"(.*?)":`(${y}|(?:(?!${y}).)*)`),_=!1;let A=g;for(;g<a.length;g++){let L=a.charCodeAt(g);if(L===47)break;if(L===58)if(a.charCodeAt(g+1)===58)g++;else break}let b=a.slice(A,g);if(b&&(b=b.replaceAll("::",":"),b=b.replaceAll("%","%25"),v.push(y=Ehe(b))),S=g+1,R||a.charCodeAt(g)===47||g===a.length){let L=m?"()"+b:b,C=a.slice(f,g);a=a.slice(0,f+1)+L+a.slice(g),f+=L.length;let w=m?new RegExp("^"+v.join("")+"$"):null;c=c.createParametricChild(w,b||null,C),l=f+1;break}}}}else if(h&&(u.push("*"),c=c.createWildcardChild(),l=f+1,f!==a.length-1))throw new Error("Wildcard must be the last character in the route")}this.caseSensitive||(a=a.toLowerCase()),a==="*"&&(a="/*");for(let f of this.routes){let p=f.opts.constraints||{};if(f.method===e&&f.pattern===a&&pB(p,o))throw new Error(`Method '${e}' already declared for route '${a}' with constraints '${JSON.stringify(o)}'`)}let d={method:e,path:r,pattern:a,params:u,opts:n,handler:i,store:s};this.routes.push(d),c.addRoute(d,this.constrainer)};Vt.prototype.hasRoute=function(e,r,n){return this.findRoute(e,r,n)!==null};Vt.prototype.findRoute=function(e,r,n={}){if(this.trees[e]===void 0)return null;let i=r,s=this.trees[e],o=s.prefix.length,a=[];for(let c=0;c<=i.length;c++){if(i.charCodeAt(c)===58&&i.charCodeAt(c+1)===58){c++;continue}let l=i.charCodeAt(c)===58&&i.charCodeAt(c+1)!==58,u=i.charCodeAt(c)===42;if(l||u||c===i.length&&c!==o){let d=i.slice(o,c);if(this.caseSensitive||(d=d.toLowerCase()),d=d.replaceAll("::",":"),d=d.replaceAll("%","%25"),s=s.getStaticChild(d),s===null)return null}if(l){let d=!1,f=!0,p="",h=[],m=c+1;for(let _=m;;_++){let y=i.charCodeAt(_),v=y===40,S=y===45||y===46,g=y===47||_===i.length;if(v||S||g){let T=i.slice(m,_);if(a.push(T),d=d||v||S,v){let R=bhe(i,_),O=i.slice(_,R+1);this.allowUnsafeRegex||yr(bm(new RegExp(O)),`The regex '${O}' is not safe!`),h.push(vhe(O)),_=R+1,f=!1}else h.push(f?"(.*?)":`(${p}|(?:(?!${p}).)*)`),f=!1;let I=_;for(;_<i.length;_++){let R=i.charCodeAt(_);if(R===47)break;if(R===58)if(i.charCodeAt(_+1)===58)_++;else break}let x=i.slice(I,_);if(x&&(x=x.replaceAll("::",":"),x=x.replaceAll("%","%25"),h.push(p=Ehe(x))),m=_+1,g||i.charCodeAt(_)===47||_===i.length){let R=d?"()"+x:x,O=i.slice(c,_);i=i.slice(0,c+1)+R+i.slice(_),c+=R.length;let A=d?new RegExp("^"+h.join("")+"$"):null;if(s=s.getParametricChild(A,x||null,O),s===null)return null;o=c+1;break}}}}else if(u&&(a.push("*"),s=s.getWildcardChild(),o=c+1,c!==i.length-1))throw new Error("Wildcard must be the last character in the route")}this.caseSensitive||(i=i.toLowerCase());for(let c of this.routes){let l=c.opts.constraints||{};if(c.method===e&&c.pattern===i&&pB(l,n))return{handler:c.handler,store:c.store,params:c.params}}return null};Vt.prototype.hasConstraintStrategy=function(t){return this.constrainer.hasConstraintStrategy(t)};Vt.prototype.addConstraintStrategy=function(t){this.constrainer.addConstraintStrategy(t),this._rebuild(this.routes)};Vt.prototype.reset=function(){this.trees={},this.routes=[]};Vt.prototype.off=function(e,r,n){yr(typeof r=="string","Path should be a string"),yr(r.length>0,"The path could not be empty"),yr(r[0]==="/"||r[0]==="*","The first character of a path should be `/` or `*`"),yr(typeof n>"u"||typeof n=="object"&&!Array.isArray(n)&&n!==null,"Constraints should be an object or undefined.");let i=r.match(hf);if(i){yr(r.length===i.index+i[0].length,"Optional Parameter needs to be the last parameter of the path");let o=r.replace(hf,"$1$2"),a=r.replace(hf,"$2");this.off(e,o,n),this.off(e,a,n);return}this.ignoreDuplicateSlashes&&(r=tI(r)),this.ignoreTrailingSlash&&(r=rI(r));let s=Array.isArray(e)?e:[e];for(let o of s)this._off(o,r,n)};Vt.prototype._off=function(e,r,n){yr(typeof e=="string","Method should be a string"),yr(vm.includes(e),`Method '${e}' is not an http method.`);function i(c){return e!==c.method||r!==c.path}function s(c){return i(c)||!pB(n,c.opts.constraints||{})}let o=n?s:i,a=this.routes.filter(o);this._rebuild(a)};Vt.prototype.lookup=function(e,r,n,i){if(typeof n=="function"&&(i=n,n=void 0),i===void 0){let s=this.constrainer.deriveConstraints(e,n),o=this.find(e.method,e.url,s);return this.callHandler(o,e,r,n)}this.constrainer.deriveConstraints(e,n,(s,o)=>{if(s!==null){i(s);return}try{let a=this.find(e.method,e.url,o),c=this.callHandler(a,e,r,n);i(null,c)}catch(a){i(a)}})};Vt.prototype.callHandler=function(e,r,n,i){return e===null?this._defaultRoute(r,n,i):i===void 0?e.handler(r,n,e.params,e.store,e.searchParams):e.handler.call(i,r,n,e.params,e.store,e.searchParams)};Vt.prototype.find=function(e,r,n){let i=this.trees[e];if(i===void 0)return null;r.charCodeAt(0)!==47&&(r=r.replace(_he,"/")),this.ignoreDuplicateSlashes&&(r=tI(r));let s,o,a;try{s=ghe(r,this.useSemicolonDelimiter),r=s.path,o=s.querystring,a=s.shouldDecodeParam}catch{return this._onBadUrl(r)}this.ignoreTrailingSlash&&(r=rI(r));let c=r;this.caseSensitive===!1&&(r=r.toLowerCase());let l=this.maxParamLength,u=i.prefix.length,d=[],f=r.length,p=[],h=!1;for(;;){if(u===f&&i.isLeafNode){let v=i.handlerStorage.getMatchingHandler(n);if(v!==null)return{handler:v.handler,store:v.store,params:v._createParamsObject(d),searchParams:this.querystringParser(o)}}let m=i.getNextNode(r,u,p,d.length);if(m===null){if(p.length===0)return h&&this.onMaxParamLength?this._onMaxParamLength(c):null;let v=p.pop();u=v.brotherPathIndex,d.splice(v.paramsCount),m=v.brotherNode}if(i=m,i.kind===mhe.STATIC){u+=i.prefix.length;continue}if(i.kind===mhe.WILDCARD){let v=c.slice(u);a&&(v=fB(v)),d.push(v),u=f;continue}let _=c.indexOf("/",u);_===-1&&(_=f);let y=c.slice(u,_);if(a&&(y=fB(y)),i.isRegex){let v=i.regex.exec(y);if(v===null){m=null;continue}let S=!1;for(let g=1;g<v.length;g++)if(v[g].length>l){S=!0;break}if(S){h=!0,m=null;continue}for(let g=1;g<v.length;g++)d.push(v[g])}else{if(y.length>l){h=!0,m=null;continue}d.push(y)}u=_}};Vt.prototype._rebuild=function(t){this.reset();for(let e of t){let{method:r,path:n,opts:i,handler:s,store:o}=e;this._on(r,n,i,s,o)}};Vt.prototype._defaultRoute=function(t,e,r){if(this.defaultRoute!==null)return r===void 0?this.defaultRoute(t,e):this.defaultRoute.call(r,t,e);e.statusCode=404,e.end()};Vt.prototype._onBadUrl=function(t){if(this.onBadUrl===null)return null;let e=this.onBadUrl;return{handler:(r,n,i)=>e(t,r,n),params:{},store:null}};Vt.prototype._onMaxParamLength=function(t){if(this.onMaxParamLength===null)return null;let e=this.onMaxParamLength;return{handler:(r,n,i)=>e(t,r,n),params:{},store:null}};Vt.prototype.prettyPrint=function(t={}){let e=t.method;t.buildPrettyMeta=this.buildPrettyMeta.bind(this);let r=null;if(e===void 0){let{version:n,host:i,...s}=this.constrainer.strategies;s[dB.name]=dB;let o=new Vt({...this._opts,constraints:s}),a=this.routes.map(c=>{let l={...c.opts.constraints,[dB.name]:c.method};return{...c,method:"MERGED",opts:{constraints:l}}});o._rebuild(a),r=o.trees.MERGED}else r=this.trees[e];return r==null?"(empty tree)":Jat(r,t)};for(let t in vm){if(!vm.hasOwnProperty(t))continue;let e=vm[t],r=e.toLowerCase();Vt.prototype[r]=function(n,i,s){return this.on(e,n,i,s)}}Vt.prototype.all=function(t,e,r){this.on(vm,t,e,r)};Vt.sanitizeUrlPath=function(e,r){let n=ghe(e,r);return n.shouldDecodeParam?fB(n.path):n.path};Vt.removeDuplicateSlashes=tI;Vt.trimLastSlash=rI;The.exports=Vt;function Ehe(t){return t.replace(yhe,"\\$&")}function tI(t){return t.indexOf("//")!==-1?t.replace(She,"/"):t}function rI(t){return t.length>1&&t.charCodeAt(t.length-1)===47?t.slice(0,-1):t}function vhe(t){return t.charCodeAt(1)===94&&(t=t.slice(0,1)+t.slice(2)),t.charCodeAt(t.length-2)===36&&(t=t.slice(0,t.length-2)+t.slice(t.length-1)),t}function bhe(t,e){let r=1;for(;e<t.length;){if(e++,t.charCodeAt(e)===92){e++;continue}if(t.charCodeAt(e)===41?r--:t.charCodeAt(e)===40&&r++,!r)return e}throw new TypeError('Invalid regexp expression in "'+t+'"')}function Xat(t){return t?t.store?Object.assign({},t.store):{}:{}}});var Ahe=E((q8t,whe)=>{"use strict";function mB(t,e,r,n){if(r===void 0){e.header("content-length","0"),n(null,null);return}if(typeof r.resume=="function"){r.on("error",s=>{e.log.error({err:s},"Error on Stream found for HEAD route")}),r.resume(),n(null,null);return}if(typeof r.getReader=="function"){r.cancel("Stream cancelled by HEAD route").catch(s=>{e.log.error({err:s},"Error on Stream found for HEAD route")}),n(null,null);return}let i=""+Buffer.byteLength(r);e.header("content-length",i),n(null,null)}function Qat(t){return t==null?mB:Array.isArray(t)?[...t,mB]:[t,mB]}whe.exports={parseHeadOnSendHandlers:Qat}});var Hhe=E((B8t,Vhe)=>{"use strict";var ect=hB(),tct=wR(),Rhe=dU(),{onRequestAbortHookRunner:rct,lifecycleHooks:xhe,preParsingHookRunner:nct,onTimeoutHookRunner:ict,onRequestHookRunner:sct}=Ol(),{normalizeSchema:oct}=mE(),{parseHeadOnSendHandlers:act}=Ahe(),{compileSchemasForValidation:cct,compileSchemasForSerialization:lct}=aU(),{FST_ERR_SCH_VALIDATION_BUILD:uct,FST_ERR_SCH_SERIALIZATION_BUILD:dct,FST_ERR_DUPLICATED_ROUTE:fct,FST_ERR_INVALID_URL:pct,FST_ERR_HOOK_INVALID_HANDLER:Ihe,FST_ERR_ROUTE_OPTIONS_NOT_OBJ:hct,FST_ERR_ROUTE_DUPLICATED_HANDLER:mct,FST_ERR_ROUTE_HANDLER_NOT_FN:Ohe,FST_ERR_ROUTE_MISSING_HANDLER:gct,FST_ERR_ROUTE_METHOD_NOT_SUPPORTED:_ct,FST_ERR_ROUTE_METHOD_INVALID:yct,FST_ERR_ROUTE_BODY_VALIDATION_SCHEMA_NOT_SUPPORTED:Sct,FST_ERR_ROUTE_BODY_LIMIT_OPTION_NOT_INT:Ect,FST_ERR_ROUTE_HANDLER_TIMEOUT_OPTION_NOT_INT:vct,FST_ERR_HANDLER_TIMEOUT:bct,FST_ERR_HOOK_INVALID_ASYNC_HANDLER:gB}=Ur(),{kRoutePrefix:Tct,kSupportedHTTPMethods:SB,kLogLevel:wct,kLogSerializers:Phe,kHooks:Che,kSchemaController:Act,kOptions:Nhe,kReplySerializerDefault:_B,kReplyIsError:Bhe,kRequestPayloadStream:Rct,kDisableRequestLogging:khe,kSchemaErrorFormatter:xct,kErrorHandler:$he,kHasBeenDecorated:Lhe,kRequestAcceptVersion:yB,kRouteByFastify:Ict,kRouteContext:Dhe,kRequestSignal:Oct,kTimeoutTimer:Mhe,kOnAbort:Pct}=Ar(),{buildErrorHandler:Cct}=gE(),{createChildLogger:Nct}=hE(),{getGenReqId:kct}=Mx(),{FSTDEP022:$ct}=xh(),Uhe=["allowUnsafeRegex","buildPrettyMeta","caseSensitive","constraints","defaultRoute","ignoreDuplicateSlashes","ignoreTrailingSlash","maxParamLength","onBadUrl","querystringParser","useSemicolonDelimiter"];function Lct(t){let e=ect(t),r,n,i,s,o,a,c,l,u,d,f,p,h,m=!1;return{setup(R,O){r=O.avvio,n=O.fourOhFour,i=R.logger,s=O.hasLogger,o=O.setupResponseListeners,a=O.throwIfAlreadyStarted,p=R.exposeHeadRoutes,c=R.disableRequestLogging,typeof c=="function"&&(l=R.disableRequestLogging),u=R.routerOptions.ignoreTrailingSlash,d=R.routerOptions.ignoreDuplicateSlashes,f=Object.hasOwn(R,"return503OnClosing")?R.return503OnClosing:!0,h=O.keepAliveConnections},routing:e.lookup.bind(e),route:I,hasRoute:g,prepareRoute:S,routeHandler:x,closeRoutes:()=>{m=!0},printRoutes:e.prettyPrint.bind(e),addConstraintStrategy:_,hasConstraintStrategy:y,isAsyncConstraint:v,findRoute:T};function _(R){return a("Cannot add constraint strategy!"),e.addConstraintStrategy(R)}function y(R){return e.hasConstraintStrategy(R)}function v(){return e.constrainer.asyncStrategiesInUse.size>0}function S({method:R,url:O,options:A,handler:b,isFastify:L}){if(typeof O!="string")throw new pct(typeof O);if(!b&&typeof A=="function")b=A,A={};else if(b&&typeof b=="function"){if(Object.prototype.toString.call(A)!=="[object Object]")throw new hct(R,O);if(A.handler)throw typeof A.handler=="function"?new mct(R,O):new Ohe(R,O)}return A=Object.assign({},A,{method:R,url:O,path:O,handler:b||A&&A.handler}),I.call(this,{options:A,isFastify:L})}function g({options:R}){let O=R.method?.toUpperCase()??"";return e.hasRoute(O,R.url||"",R.constraints)}function T(R){let O=e.find(R.method,R.url||"",R.constraints);return O?{handler:O.handler,params:O.params,searchParams:O.searchParams}:null}function I({options:R,isFastify:O}){a("Cannot add route!");let A={...R},b=A.url||A.path||"";if(!A.handler)throw new gct(A.method,b);if(A.errorHandler!==void 0&&typeof A.errorHandler!="function")throw new Ohe(A.method,b);zhe(A.bodyLimit),Uct(A.handlerTimeout);let L=A.exposeHeadRoute??p,C=!1,w=!1;if(Array.isArray(A.method))for(let V=0;V<A.method.length;++V)A.method[V]=Fhe.call(this,A.method[V]),jhe.call(this,A.method[V],b,A.schema),C=A.method.includes("GET"),w=A.method.includes("HEAD");else A.method=Fhe.call(this,A.method),jhe.call(this,A.method,b,A.schema),C=A.method==="GET",w=A.method==="HEAD";let P=L&&C?{...R}:null,N=this[Tct];if(b==="/"&&N.length>0&&A.method!=="HEAD")switch(A.prefixTrailingSlash){case"slash":j.call(this,{path:b,isFastify:O});break;case"no-slash":j.call(this,{path:"",isFastify:O});break;default:j.call(this,{path:"",isFastify:O}),u!==!0&&(d!==!0||!N.endsWith("/"))&&j.call(this,{path:b,prefixing:!0,isFastify:O})}else b[0]==="/"&&N.endsWith("/")?j.call(this,{path:b.slice(1),isFastify:O}):j.call(this,{path:b,isFastify:O});return this;function j({path:V,prefixing:de=!1,isFastify:Te=!1}){let Ie=N+V;if(A.url=Ie,A.path=Ie,A.routePath=V,A.prefix=N,A.logLevel=A.logLevel||this[wct],(this[Phe]||A.logSerializers)&&(A.logSerializers=Object.assign(Object.create(this[Phe]),A.logSerializers)),A.attachValidation==null&&(A.attachValidation=!1),de===!1)for(let U of this[Che].onRoute)U.call(this,A);for(let U of xhe)if(A&&U in A){if(Array.isArray(A[U]))for(let ne of A[U]){if(typeof ne!="function")throw new Ihe(U,Object.prototype.toString.call(ne));if(U==="onSend"||U==="preSerialization"||U==="onError"||U==="preParsing"){if(ne.constructor.name==="AsyncFunction"&&ne.length===4)throw new gB}else if(U==="onRequestAbort"){if(ne.constructor.name==="AsyncFunction"&&ne.length!==1)throw new gB}else if(ne.constructor.name==="AsyncFunction"&&ne.length===3)throw new gB}else if(A[U]!==void 0&&typeof A[U]!="function")throw new Ihe(U,Object.prototype.toString.call(A[U]))}let $e=A.constraints||{},oe={...A.config,url:Ie,method:A.method},Ee=new tct({schema:A.schema,handler:A.handler.bind(this),config:oe,errorHandler:A.errorHandler,childLoggerFactory:A.childLoggerFactory,bodyLimit:A.bodyLimit,logLevel:A.logLevel,logSerializers:A.logSerializers,attachValidation:A.attachValidation,schemaErrorFormatter:A.schemaErrorFormatter,replySerializer:this[_B],validatorCompiler:A.validatorCompiler,serializerCompiler:A.serializerCompiler,exposeHeadRoute:L,prefixTrailingSlash:A.prefixTrailingSlash||"both",server:this,isFastify:Te,handlerTimeout:A.handlerTimeout}),k=e.findRoute("HEAD",A.url,$e)!==null;try{e.on(A.method,A.url,{constraints:$e},x,Ee)}catch(U){if(!Ee[Ict])throw U.message.includes(`Method '${A.method}' already declared for route`)?new fct(A.method,A.url):U}if(this.after((U,ne)=>{Ee.errorHandler=A.errorHandler?Cct(this[$he],A.errorHandler):this[$he],Ee._parserOptions.limit=A.bodyLimit||null,Ee.logLevel=A.logLevel,Ee.logSerializers=A.logSerializers,Ee.attachValidation=A.attachValidation,Ee[_B]=this[_B],Ee.schemaErrorFormatter=A.schemaErrorFormatter||this[xct]||Ee.schemaErrorFormatter,r.once("preReady",()=>{for(let F of xhe){let se=this[Che][F].concat(A[F]||[]).map(M=>M.bind(this));Ee[F]=se.length?se:null}for(;!Ee.Request[Lhe]&&Ee.Request.parent;)Ee.Request=Ee.Request.parent;for(;!Ee.Reply[Lhe]&&Ee.Reply.parent;)Ee.Reply=Ee.Reply.parent;if(n.setContext(this,Ee),A.schema){Ee.schema=oct(Ee.schema,this.initialConfig);let F=this[Act],se=A.schema.body||A.schema.headers||A.schema.querystring||A.schema.params;!A.validatorCompiler&&se&&F.setupValidator(this[Nhe]);try{let M=typeof A?.validatorCompiler=="function"||F.isCustomValidatorCompiler;cct(Ee,A.validatorCompiler||F.validatorCompiler,M)}catch(M){throw new uct(A.method,Ie,M.message)}A.schema.response&&!A.serializerCompiler&&F.setupSerializer(this[Nhe]);try{lct(Ee,A.serializerCompiler||F.serializerCompiler)}catch(M){throw new dct(A.method,Ie,M.message)}}}),ne(U)}),L&&C&&!w&&!k){let U=act(P.onSend);S.call(this,{method:"HEAD",url:V,options:{...P,onSend:U},isFastify:!0})}}}function x(R,O,A,b,L){let C=kct(b.server,R),w={level:b.logLevel};b.logSerializers&&(w.serializers=b.logSerializers);let P=Nct(b,i,R,C,w);if(P[khe]=l?!1:c,m===!0&&(R.httpVersionMajor!==2&&O.setHeader("Connection","close"),f)){let Ie={"Content-Type":"application/json","Content-Length":"80"};O.writeHead(503,Ie),O.end('{"error":"Service Unavailable","message":"Service Unavailable","statusCode":503}'),P.info({res:{statusCode:503}},"request aborted - refusing to accept new requests as server is closing");return}String.prototype.toLowerCase.call(R.headers.connection||"")==="keep-alive"&&h.has(R.socket)===!1&&(h.add(R.socket),R.socket.on("close",jct.bind({keepAliveConnections:h,socket:R.socket}))),R.headers[yB]!==void 0&&(R.headers["accept-version"]=R.headers[yB],R.headers[yB]=void 0);let j=new b.Request(C,A,R,L,P,b),V=new b.Reply(O,j,P),de=l?l(j):c;P[khe]=de,de===!1&&P.info({req:j},"incoming request");let Te=b.handlerTimeout;if(Te>0){let Ie=new AbortController;j[Oct]=Ie,j[Mhe]=setTimeout(()=>{if(!V.sent){let oe=new bct(Te,b.config?.url);Ie.abort(oe),V[Bhe]=!0,V.send(oe)}},Te);let $e=()=>{Ie.signal.aborted||Ie.abort(),clearTimeout(j[Mhe])};R.on("close",$e),j[Pct]=$e}(s===!0||b.onResponse!==null||Te>0)&&o(V),b.onRequest!==null?sct(b.onRequest,j,V,qhe):qhe(null,j,V),b.onRequestAbort!==null&&R.on("close",()=>{R.aborted&&rct(b.onRequestAbort,j,Dct.bind(null,V))}),b.onTimeout!==null&&(j.raw.socket._meta||j.raw.socket.on("timeout",Mct),j.raw.socket._meta={context:b,request:j,reply:V})}}function Dct(t,e){e&&t.log.error({err:e},"onRequestAborted hook failed")}function Mct(){let{context:t,request:e,reply:r}=this._meta;ict(t.onTimeout,e,r,qct)}function Fhe(t){if(typeof t!="string")throw new yct;if(t=t.toUpperCase(),!this[SB].bodyless.has(t)&&!this[SB].bodywith.has(t))throw new _ct(t);return t}function jhe(t,e,r){if(this[SB].bodyless.has(t)&&r?.body)throw new Sct(t,e)}function zhe(t){if(t!==void 0&&(!Number.isInteger(t)||t<=0))throw new Ect(t)}function Uct(t){if(t!==void 0&&(!Number.isInteger(t)||t<=0))throw new vct(t)}function qhe(t,e,r){if(r.sent!==!0){if(t!=null){r[Bhe]=!0,r.send(t);return}e[Rct]=e.raw,e[Dhe].preParsing!==null?nct(e[Dhe].preParsing,e,r,Rhe.bind(e.server)):Rhe.call(e.server,null,e,r)}}function Fct(t,e){let r=t.routerOptions==null?Object.create(null):Object.assign(Object.create(null),t.routerOptions),n=Uhe.filter(i=>Object.hasOwn(t,i));n.length>0&&$ct(n.join(", "));for(let i of Uhe)Object.hasOwn(r,i)||(r[i]=t[i]??e[i]);return r}function jct(){this.keepAliveConnections.delete(this.socket)}function qct(){}Vhe.exports={buildRouting:Lct,validateBodyLimitOption:zhe,buildRouterOptions:Fct}});var Xhe=E((z8t,Zhe)=>{"use strict";var Bct=hB(),Ghe=_R(),Whe=TR(),zct=wR(),{kRoutePrefix:Vct,kCanSetNotFoundHandler:Tv,kFourOhFourLevelInstance:wv,kFourOhFourContext:Jo,kHooks:Hct,kErrorHandler:Yhe}=Ar(),{lifecycleHooks:Gct}=Ol(),{buildErrorHandler:Wct}=gE(),{FST_ERR_NOT_FOUND:Yct}=Ur(),{createChildLogger:Khe}=hE(),{getGenReqId:Jhe}=Mx();function Kct(t){let{logger:e,disableRequestLogging:r}=t,n=Bct({onBadUrl:a(),defaultRoute:d}),i=null;return{router:n,setNotFoundHandler:l,setContext:c,arrange404:s};function s(f){f[wv]=f,f[Tv]=!0,n.onBadUrl=n.onBadUrl.bind(f),n.defaultRoute=n.defaultRoute.bind(f)}function o(f,p){let{url:h,method:m}=f.raw,_=`Route ${m}:${h} not found`;(typeof r=="function"?r(f.raw):r)||f.log.info(_),p.code(404).send({message:_,error:"Not Found",statusCode:404})}function a(){return function(p,h,m){let _=this[wv][Jo],y=Jhe(_.server,h),v=Khe(_,e,h,y),S=new Whe(y,null,h,null,v,_),g=new Ghe(m,S,v);i(S,g)}}function c(f,p){let h=Object.assign({},f[Jo]);h.onSend=p.onSend,p[Jo]=h}function l(f,p,h,m){this[Tv]===void 0&&(this[Tv]=!0),this[Jo]===void 0&&(this[Jo]=null);let _=this,y=this[Vct]||"/";if(this[Tv]===!1)throw new Error(`Not found handler already set for Fastify instance with prefix: '${y}'`);typeof f=="object"&&(f.preHandler&&(Array.isArray(f.preHandler)?f.preHandler=f.preHandler.map(v=>v.bind(_)):f.preHandler=f.preHandler.bind(_)),f.preValidation&&(Array.isArray(f.preValidation)?f.preValidation=f.preValidation.map(v=>v.bind(_)):f.preValidation=f.preValidation.bind(_))),typeof f=="function"&&(p=f,f=void 0),f=f||{},p?(this[wv][Tv]=!1,p=p.bind(this),i=p):(p=o,i=o),this.after((v,S)=>{u.call(this,y,f,p,h,m),S(v)})}function u(f,p,h,m,_){let y=new zct({schema:p.schema,handler:h,config:p.config||{},server:this});if(m.once("preReady",()=>{let v=this[Jo];for(let S of Gct){let g=this[Hct][S].concat(p[S]||[]).map(T=>T.bind(this));v[S]=g.length?g:null}v.errorHandler=p.errorHandler?Wct(this[Yhe],p.errorHandler):this[Yhe]}),this[Jo]!==null&&f==="/"){Object.assign(this[Jo],y);return}this[wv][Jo]=y,n.all(f+(f.endsWith("/")?"*":"/*"),_,y),n.all(f,_,y)}function d(f,p){let h=this[wv][Jo],m=Jhe(h.server,f),_=Khe(h,e,f,m);_.info({req:f},"incoming request");let y=new Whe(m,null,f,null,_,h),v=new Ghe(p,y,_);y.log.warn("the default handler for 404 did not catch this, this is likely a fastify bug, please report it"),y.log.warn(n.prettyPrint()),v.code(404).send(new Yct)}}Zhe.exports=Kct});var Qhe=E((V8t,nI)=>{"use strict";nI.exports=dt;nI.exports.default=dt;var Jct={type:"object",additionalProperties:!1,properties:{connectionTimeout:{type:"integer",default:0},keepAliveTimeout:{type:"integer",default:72e3},forceCloseConnections:{oneOf:[{type:"string",pattern:"idle"},{type:"boolean"}]},maxRequestsPerSocket:{type:"integer",default:0,nullable:!0},requestTimeout:{type:"integer",default:0},handlerTimeout:{type:"integer",default:0},bodyLimit:{type:"integer",default:1048576},caseSensitive:{type:"boolean",default:!0},allowUnsafeRegex:{type:"boolean",default:!1},http2:{type:"boolean"},https:{if:{not:{oneOf:[{type:"boolean"},{type:"null"},{type:"object",additionalProperties:!1,required:["allowHTTP1"],properties:{allowHTTP1:{type:"boolean"}}}]}},then:{setDefaultValue:!0}},ignoreTrailingSlash:{type:"boolean",default:!1},ignoreDuplicateSlashes:{type:"boolean",default:!1},disableRequestLogging:{default:!1},maxParamLength:{type:"integer",default:100},onProtoPoisoning:{type:"string",default:"error"},onConstructorPoisoning:{type:"string",default:"error"},pluginTimeout:{type:"integer",default:1e4},requestIdHeader:{anyOf:[{type:"boolean"},{type:"string"}],default:!1},requestIdLogLabel:{type:"string",default:"reqId"},http2SessionTimeout:{type:"integer",default:72e3},exposeHeadRoutes:{type:"boolean",default:!0},useSemicolonDelimiter:{type:"boolean",default:!1},routerOptions:{type:"object",additionalProperties:!0,properties:{ignoreTrailingSlash:{type:"boolean",default:!1},ignoreDuplicateSlashes:{type:"boolean",default:!1},maxParamLength:{type:"integer",default:100},allowUnsafeRegex:{type:"boolean",default:!1},useSemicolonDelimiter:{type:"boolean",default:!1}}},constraints:{type:"object",additionalProperties:{type:"object",required:["name","storage","validate","deriveConstraint"],additionalProperties:!0,properties:{name:{type:"string"},storage:{},validate:{},deriveConstraint:{}}}}}},Zct=Object.prototype.hasOwnProperty,Xct=new RegExp("idle","u");function dt(t,{instancePath:e="",parentData:r,parentDataProperty:n,rootData:i=t}={}){let s=null,o=0;if(o===0)if(t&&typeof t=="object"&&!Array.isArray(t)){t.connectionTimeout===void 0&&(t.connectionTimeout=0),t.keepAliveTimeout===void 0&&(t.keepAliveTimeout=72e3),t.maxRequestsPerSocket===void 0&&(t.maxRequestsPerSocket=0),t.requestTimeout===void 0&&(t.requestTimeout=0),t.handlerTimeout===void 0&&(t.handlerTimeout=0),t.bodyLimit===void 0&&(t.bodyLimit=1048576),t.caseSensitive===void 0&&(t.caseSensitive=!0),t.allowUnsafeRegex===void 0&&(t.allowUnsafeRegex=!1),t.ignoreTrailingSlash===void 0&&(t.ignoreTrailingSlash=!1),t.ignoreDuplicateSlashes===void 0&&(t.ignoreDuplicateSlashes=!1),t.disableRequestLogging===void 0&&(t.disableRequestLogging=!1),t.maxParamLength===void 0&&(t.maxParamLength=100),t.onProtoPoisoning===void 0&&(t.onProtoPoisoning="error"),t.onConstructorPoisoning===void 0&&(t.onConstructorPoisoning="error"),t.pluginTimeout===void 0&&(t.pluginTimeout=1e4),t.requestIdHeader===void 0&&(t.requestIdHeader=!1),t.requestIdLogLabel===void 0&&(t.requestIdLogLabel="reqId"),t.http2SessionTimeout===void 0&&(t.http2SessionTimeout=72e3),t.exposeHeadRoutes===void 0&&(t.exposeHeadRoutes=!0),t.useSemicolonDelimiter===void 0&&(t.useSemicolonDelimiter=!1);let m=o;for(let _ in t)Zct.call(Jct.properties,_)||delete t[_];if(m===o){let _=t.connectionTimeout,y=o;if(!(typeof _=="number"&&!(_%1)&&!isNaN(_)&&isFinite(_))){let v=typeof _,S;if(S===void 0)if(v==="boolean"||_===null||v==="string"&&_&&_==+_&&!(_%1))S=+_;else return dt.errors=[{instancePath:e+"/connectionTimeout",schemaPath:"#/properties/connectionTimeout/type",keyword:"type",params:{type:"integer"},message:"must be integer"}],!1;S!==void 0&&(_=S,t!==void 0&&(t.connectionTimeout=S))}var a=y===o;if(a){let v=t.keepAliveTimeout,S=o;if(!(typeof v=="number"&&!(v%1)&&!isNaN(v)&&isFinite(v))){let T=typeof v,I;if(I===void 0)if(T==="boolean"||v===null||T==="string"&&v&&v==+v&&!(v%1))I=+v;else return dt.errors=[{instancePath:e+"/keepAliveTimeout",schemaPath:"#/properties/keepAliveTimeout/type",keyword:"type",params:{type:"integer"},message:"must be integer"}],!1;I!==void 0&&(v=I,t!==void 0&&(t.keepAliveTimeout=I))}var a=S===o;if(a){if(t.forceCloseConnections!==void 0){let T=t.forceCloseConnections,I=o,x=o,R=!1,O=null,A=o;if(typeof T!="string"){let C=typeof T,w;if(w===void 0)if(C=="number"||C=="boolean")w=""+T;else if(T===null)w="";else{let P={instancePath:e+"/forceCloseConnections",schemaPath:"#/properties/forceCloseConnections/oneOf/0/type",keyword:"type",params:{type:"string"},message:"must be string"};s===null?s=[P]:s.push(P),o++}w!==void 0&&(T=w,t!==void 0&&(t.forceCloseConnections=w))}if(o===A&&typeof T=="string"&&!Xct.test(T)){let C={instancePath:e+"/forceCloseConnections",schemaPath:"#/properties/forceCloseConnections/oneOf/0/pattern",keyword:"pattern",params:{pattern:"idle"},message:'must match pattern "idle"'};s===null?s=[C]:s.push(C),o++}var c=A===o;c&&(R=!0,O=0);let b=o;if(typeof T!="boolean"){let C;if(C===void 0)if(T==="false"||T===0||T===null)C=!1;else if(T==="true"||T===1)C=!0;else{let w={instancePath:e+"/forceCloseConnections",schemaPath:"#/properties/forceCloseConnections/oneOf/1/type",keyword:"type",params:{type:"boolean"},message:"must be boolean"};s===null?s=[w]:s.push(w),o++}C!==void 0&&(T=C,t!==void 0&&(t.forceCloseConnections=C))}var c=b===o;if(c&&R?(R=!1,O=[O,1]):c&&(R=!0,O=1),R)o=x,s!==null&&(x?s.length=x:s=null);else{let C={instancePath:e+"/forceCloseConnections",schemaPath:"#/properties/forceCloseConnections/oneOf",keyword:"oneOf",params:{passingSchemas:O},message:"must match exactly one schema in oneOf"};return s===null?s=[C]:s.push(C),o++,dt.errors=s,!1}var a=I===o}else var a=!0;if(a){let T=t.maxRequestsPerSocket,I=o;if(!(typeof T=="number"&&!(T%1)&&!isNaN(T)&&isFinite(T))&&T!==null){let R=typeof T,O;if(O===void 0)if(R==="boolean"||T===null||R==="string"&&T&&T==+T&&!(T%1))O=+T;else if(T===""||T===0||T===!1)O=null;else return dt.errors=[{instancePath:e+"/maxRequestsPerSocket",schemaPath:"#/properties/maxRequestsPerSocket/type",keyword:"type",params:{type:"integer"},message:"must be integer"}],!1;O!==void 0&&(T=O,t!==void 0&&(t.maxRequestsPerSocket=O))}var a=I===o;if(a){let R=t.requestTimeout,O=o;if(!(typeof R=="number"&&!(R%1)&&!isNaN(R)&&isFinite(R))){let b=typeof R,L;if(L===void 0)if(b==="boolean"||R===null||b==="string"&&R&&R==+R&&!(R%1))L=+R;else return dt.errors=[{instancePath:e+"/requestTimeout",schemaPath:"#/properties/requestTimeout/type",keyword:"type",params:{type:"integer"},message:"must be integer"}],!1;L!==void 0&&(R=L,t!==void 0&&(t.requestTimeout=L))}var a=O===o;if(a){let b=t.handlerTimeout,L=o;if(!(typeof b=="number"&&!(b%1)&&!isNaN(b)&&isFinite(b))){let w=typeof b,P;if(P===void 0)if(w==="boolean"||b===null||w==="string"&&b&&b==+b&&!(b%1))P=+b;else return dt.errors=[{instancePath:e+"/handlerTimeout",schemaPath:"#/properties/handlerTimeout/type",keyword:"type",params:{type:"integer"},message:"must be integer"}],!1;P!==void 0&&(b=P,t!==void 0&&(t.handlerTimeout=P))}var a=L===o;if(a){let w=t.bodyLimit,P=o;if(!(typeof w=="number"&&!(w%1)&&!isNaN(w)&&isFinite(w))){let j=typeof w,V;if(V===void 0)if(j==="boolean"||w===null||j==="string"&&w&&w==+w&&!(w%1))V=+w;else return dt.errors=[{instancePath:e+"/bodyLimit",schemaPath:"#/properties/bodyLimit/type",keyword:"type",params:{type:"integer"},message:"must be integer"}],!1;V!==void 0&&(w=V,t!==void 0&&(t.bodyLimit=V))}var a=P===o;if(a){let j=t.caseSensitive,V=o;if(typeof j!="boolean"){let Te;if(Te===void 0)if(j==="false"||j===0||j===null)Te=!1;else if(j==="true"||j===1)Te=!0;else return dt.errors=[{instancePath:e+"/caseSensitive",schemaPath:"#/properties/caseSensitive/type",keyword:"type",params:{type:"boolean"},message:"must be boolean"}],!1;Te!==void 0&&(j=Te,t!==void 0&&(t.caseSensitive=Te))}var a=V===o;if(a){let Te=t.allowUnsafeRegex,Ie=o;if(typeof Te!="boolean"){let oe;if(oe===void 0)if(Te==="false"||Te===0||Te===null)oe=!1;else if(Te==="true"||Te===1)oe=!0;else return dt.errors=[{instancePath:e+"/allowUnsafeRegex",schemaPath:"#/properties/allowUnsafeRegex/type",keyword:"type",params:{type:"boolean"},message:"must be boolean"}],!1;oe!==void 0&&(Te=oe,t!==void 0&&(t.allowUnsafeRegex=oe))}var a=Ie===o;if(a){if(t.http2!==void 0){let oe=t.http2,Ee=o;if(typeof oe!="boolean"){let k;if(k===void 0)if(oe==="false"||oe===0||oe===null)k=!1;else if(oe==="true"||oe===1)k=!0;else return dt.errors=[{instancePath:e+"/http2",schemaPath:"#/properties/http2/type",keyword:"type",params:{type:"boolean"},message:"must be boolean"}],!1;k!==void 0&&(oe=k,t!==void 0&&(t.http2=k))}var a=Ee===o}else var a=!0;if(a){if(t.https!==void 0){let oe=t.https,Ee=o,he=o,k=!0,U=o,ne=o,F=o,se=o,M=!1,D=null,B=o;if(typeof oe!="boolean"){let z;if(z===void 0)if(oe==="false"||oe===0||oe===null)z=!1;else if(oe==="true"||oe===1)z=!0;else{let K={};s===null?s=[K]:s.push(K),o++}z!==void 0&&(oe=z,t!==void 0&&(t.https=z))}var l=B===o;l&&(M=!0,D=0);let J=o;if(oe!==null){let z;if(z===void 0)if(oe===""||oe===0||oe===!1)z=null;else{let K={};s===null?s=[K]:s.push(K),o++}z!==void 0&&(oe=z,t!==void 0&&(t.https=z))}var l=J===o;if(l&&M)M=!1,D=[D,1];else{l&&(M=!0,D=1);let z=o;if(o===z)if(oe&&typeof oe=="object"&&!Array.isArray(oe)){let re;if(oe.allowHTTP1===void 0&&(re="allowHTTP1")){let Oe={};s===null?s=[Oe]:s.push(Oe),o++}else{let Oe=o;for(let ut in oe)ut!=="allowHTTP1"&&delete oe[ut];if(Oe===o&&oe.allowHTTP1!==void 0){let ut=oe.allowHTTP1;if(typeof ut!="boolean"){let ze;if(ze===void 0)if(ut==="false"||ut===0||ut===null)ze=!1;else if(ut==="true"||ut===1)ze=!0;else{let Qr={};s===null?s=[Qr]:s.push(Qr),o++}ze!==void 0&&(ut=ze,oe!==void 0&&(oe.allowHTTP1=ze))}}}}else{let re={};s===null?s=[re]:s.push(re),o++}var l=z===o;l&&M?(M=!1,D=[D,2]):l&&(M=!0,D=2)}if(M)o=se,s!==null&&(se?s.length=se:s=null);else{let z={};s===null?s=[z]:s.push(z),o++}var u=F===o;if(u){let z={};s===null?s=[z]:s.push(z),o++}else o=ne,s!==null&&(ne?s.length=ne:s=null);var d=U===o;if(o=he,s!==null&&(he?s.length=he:s=null),d){let z=o;t.https=!0;var d=z===o;k=d}if(!k){let z={instancePath:e+"/https",schemaPath:"#/properties/https/if",keyword:"if",params:{failingKeyword:"then"},message:'must match "then" schema'};return s===null?s=[z]:s.push(z),o++,dt.errors=s,!1}var a=Ee===o}else var a=!0;if(a){let oe=t.ignoreTrailingSlash,Ee=o;if(typeof oe!="boolean"){let k;if(k===void 0)if(oe==="false"||oe===0||oe===null)k=!1;else if(oe==="true"||oe===1)k=!0;else return dt.errors=[{instancePath:e+"/ignoreTrailingSlash",schemaPath:"#/properties/ignoreTrailingSlash/type",keyword:"type",params:{type:"boolean"},message:"must be boolean"}],!1;k!==void 0&&(oe=k,t!==void 0&&(t.ignoreTrailingSlash=k))}var a=Ee===o;if(a){let k=t.ignoreDuplicateSlashes,U=o;if(typeof k!="boolean"){let F;if(F===void 0)if(k==="false"||k===0||k===null)F=!1;else if(k==="true"||k===1)F=!0;else return dt.errors=[{instancePath:e+"/ignoreDuplicateSlashes",schemaPath:"#/properties/ignoreDuplicateSlashes/type",keyword:"type",params:{type:"boolean"},message:"must be boolean"}],!1;F!==void 0&&(k=F,t!==void 0&&(t.ignoreDuplicateSlashes=F))}var a=U===o;if(a){let F=t.maxParamLength,se=o;if(!(typeof F=="number"&&!(F%1)&&!isNaN(F)&&isFinite(F))){let D=typeof F,B;if(B===void 0)if(D==="boolean"||F===null||D==="string"&&F&&F==+F&&!(F%1))B=+F;else return dt.errors=[{instancePath:e+"/maxParamLength",schemaPath:"#/properties/maxParamLength/type",keyword:"type",params:{type:"integer"},message:"must be integer"}],!1;B!==void 0&&(F=B,t!==void 0&&(t.maxParamLength=B))}var a=se===o;if(a){let D=t.onProtoPoisoning,B=o;if(typeof D!="string"){let H=typeof D,z;if(z===void 0)if(H=="number"||H=="boolean")z=""+D;else if(D===null)z="";else return dt.errors=[{instancePath:e+"/onProtoPoisoning",schemaPath:"#/properties/onProtoPoisoning/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;z!==void 0&&(D=z,t!==void 0&&(t.onProtoPoisoning=z))}var a=B===o;if(a){let H=t.onConstructorPoisoning,z=o;if(typeof H!="string"){let re=typeof H,Oe;if(Oe===void 0)if(re=="number"||re=="boolean")Oe=""+H;else if(H===null)Oe="";else return dt.errors=[{instancePath:e+"/onConstructorPoisoning",schemaPath:"#/properties/onConstructorPoisoning/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;Oe!==void 0&&(H=Oe,t!==void 0&&(t.onConstructorPoisoning=Oe))}var a=z===o;if(a){let re=t.pluginTimeout,Oe=o;if(!(typeof re=="number"&&!(re%1)&&!isNaN(re)&&isFinite(re))){let ze=typeof re,Qr;if(Qr===void 0)if(ze==="boolean"||re===null||ze==="string"&&re&&re==+re&&!(re%1))Qr=+re;else return dt.errors=[{instancePath:e+"/pluginTimeout",schemaPath:"#/properties/pluginTimeout/type",keyword:"type",params:{type:"integer"},message:"must be integer"}],!1;Qr!==void 0&&(re=Qr,t!==void 0&&(t.pluginTimeout=Qr))}var a=Oe===o;if(a){let ze=t.requestIdHeader,Qr=o,qs=o,Ni=!1,Ha=o;if(typeof ze!="boolean"){let at;if(at===void 0)if(ze==="false"||ze===0||ze===null)at=!1;else if(ze==="true"||ze===1)at=!0;else{let Mt={instancePath:e+"/requestIdHeader",schemaPath:"#/properties/requestIdHeader/anyOf/0/type",keyword:"type",params:{type:"boolean"},message:"must be boolean"};s===null?s=[Mt]:s.push(Mt),o++}at!==void 0&&(ze=at,t!==void 0&&(t.requestIdHeader=at))}var f=Ha===o;if(Ni=Ni||f,!Ni){let at=o;if(typeof ze!="string"){let Bs=typeof ze,zt;if(zt===void 0)if(Bs=="number"||Bs=="boolean")zt=""+ze;else if(ze===null)zt="";else{let ve={instancePath:e+"/requestIdHeader",schemaPath:"#/properties/requestIdHeader/anyOf/1/type",keyword:"type",params:{type:"string"},message:"must be string"};s===null?s=[ve]:s.push(ve),o++}zt!==void 0&&(ze=zt,t!==void 0&&(t.requestIdHeader=zt))}var f=at===o;Ni=Ni||f}if(Ni)o=qs,s!==null&&(qs?s.length=qs:s=null);else{let at={instancePath:e+"/requestIdHeader",schemaPath:"#/properties/requestIdHeader/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf"};return s===null?s=[at]:s.push(at),o++,dt.errors=s,!1}var a=Qr===o;if(a){let at=t.requestIdLogLabel,Mt=o;if(typeof at!="string"){let zt=typeof at,ve;if(ve===void 0)if(zt=="number"||zt=="boolean")ve=""+at;else if(at===null)ve="";else return dt.errors=[{instancePath:e+"/requestIdLogLabel",schemaPath:"#/properties/requestIdLogLabel/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;ve!==void 0&&(at=ve,t!==void 0&&(t.requestIdLogLabel=ve))}var a=Mt===o;if(a){let zt=t.http2SessionTimeout,ve=o;if(!(typeof zt=="number"&&!(zt%1)&&!isNaN(zt)&&isFinite(zt))){let xt=typeof zt,ur;if(ur===void 0)if(xt==="boolean"||zt===null||xt==="string"&&zt&&zt==+zt&&!(zt%1))ur=+zt;else return dt.errors=[{instancePath:e+"/http2SessionTimeout",schemaPath:"#/properties/http2SessionTimeout/type",keyword:"type",params:{type:"integer"},message:"must be integer"}],!1;ur!==void 0&&(zt=ur,t!==void 0&&(t.http2SessionTimeout=ur))}var a=ve===o;if(a){let xt=t.exposeHeadRoutes,ur=o;if(typeof xt!="boolean"){let bn;if(bn===void 0)if(xt==="false"||xt===0||xt===null)bn=!1;else if(xt==="true"||xt===1)bn=!0;else return dt.errors=[{instancePath:e+"/exposeHeadRoutes",schemaPath:"#/properties/exposeHeadRoutes/type",keyword:"type",params:{type:"boolean"},message:"must be boolean"}],!1;bn!==void 0&&(xt=bn,t!==void 0&&(t.exposeHeadRoutes=bn))}var a=ur===o;if(a){let bn=t.useSemicolonDelimiter,P1=o;if(typeof bn!="boolean"){let Ze;if(Ze===void 0)if(bn==="false"||bn===0||bn===null)Ze=!1;else if(bn==="true"||bn===1)Ze=!0;else return dt.errors=[{instancePath:e+"/useSemicolonDelimiter",schemaPath:"#/properties/useSemicolonDelimiter/type",keyword:"type",params:{type:"boolean"},message:"must be boolean"}],!1;Ze!==void 0&&(bn=Ze,t!==void 0&&(t.useSemicolonDelimiter=Ze))}var a=P1===o;if(a){if(t.routerOptions!==void 0){let Ze=t.routerOptions,JS=o;if(o===JS)if(Ze&&typeof Ze=="object"&&!Array.isArray(Ze)){Ze.ignoreTrailingSlash===void 0&&(Ze.ignoreTrailingSlash=!1),Ze.ignoreDuplicateSlashes===void 0&&(Ze.ignoreDuplicateSlashes=!1),Ze.maxParamLength===void 0&&(Ze.maxParamLength=100),Ze.allowUnsafeRegex===void 0&&(Ze.allowUnsafeRegex=!1),Ze.useSemicolonDelimiter===void 0&&(Ze.useSemicolonDelimiter=!1);let is=Ze.ignoreTrailingSlash,ki=o;if(typeof is!="boolean"){let en;if(en===void 0)if(is==="false"||is===0||is===null)en=!1;else if(is==="true"||is===1)en=!0;else return dt.errors=[{instancePath:e+"/routerOptions/ignoreTrailingSlash",schemaPath:"#/properties/routerOptions/properties/ignoreTrailingSlash/type",keyword:"type",params:{type:"boolean"},message:"must be boolean"}],!1;en!==void 0&&(is=en,Ze!==void 0&&(Ze.ignoreTrailingSlash=en))}var p=ki===o;if(p){let en=Ze.ignoreDuplicateSlashes,Tl=o;if(typeof en!="boolean"){let dr;if(dr===void 0)if(en==="false"||en===0||en===null)dr=!1;else if(en==="true"||en===1)dr=!0;else return dt.errors=[{instancePath:e+"/routerOptions/ignoreDuplicateSlashes",schemaPath:"#/properties/routerOptions/properties/ignoreDuplicateSlashes/type",keyword:"type",params:{type:"boolean"},message:"must be boolean"}],!1;dr!==void 0&&(en=dr,Ze!==void 0&&(Ze.ignoreDuplicateSlashes=dr))}var p=Tl===o;if(p){let dr=Ze.maxParamLength,wl=o;if(!(typeof dr=="number"&&!(dr%1)&&!isNaN(dr)&&isFinite(dr))){let $o=typeof dr,Ud;if(Ud===void 0)if($o==="boolean"||dr===null||$o==="string"&&dr&&dr==+dr&&!(dr%1))Ud=+dr;else return dt.errors=[{instancePath:e+"/routerOptions/maxParamLength",schemaPath:"#/properties/routerOptions/properties/maxParamLength/type",keyword:"type",params:{type:"integer"},message:"must be integer"}],!1;Ud!==void 0&&(dr=Ud,Ze!==void 0&&(Ze.maxParamLength=Ud))}var p=wl===o;if(p){let $o=Ze.allowUnsafeRegex,Ud=o;if(typeof $o!="boolean"){let ai;if(ai===void 0)if($o==="false"||$o===0||$o===null)ai=!1;else if($o==="true"||$o===1)ai=!0;else return dt.errors=[{instancePath:e+"/routerOptions/allowUnsafeRegex",schemaPath:"#/properties/routerOptions/properties/allowUnsafeRegex/type",keyword:"type",params:{type:"boolean"},message:"must be boolean"}],!1;ai!==void 0&&($o=ai,Ze!==void 0&&(Ze.allowUnsafeRegex=ai))}var p=Ud===o;if(p){let ai=Ze.useSemicolonDelimiter,wHe=o;if(typeof ai!="boolean"){let vh;if(vh===void 0)if(ai==="false"||ai===0||ai===null)vh=!1;else if(ai==="true"||ai===1)vh=!0;else return dt.errors=[{instancePath:e+"/routerOptions/useSemicolonDelimiter",schemaPath:"#/properties/routerOptions/properties/useSemicolonDelimiter/type",keyword:"type",params:{type:"boolean"},message:"must be boolean"}],!1;vh!==void 0&&(ai=vh,Ze!==void 0&&(Ze.useSemicolonDelimiter=vh))}var p=wHe===o}}}}}else return dt.errors=[{instancePath:e+"/routerOptions",schemaPath:"#/properties/routerOptions/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;var a=JS===o}else var a=!0;if(a)if(t.constraints!==void 0){let Ze=t.constraints,JS=o;if(o===JS)if(Ze&&typeof Ze=="object"&&!Array.isArray(Ze))for(let is in Ze){let ki=Ze[is],en=o;if(o===en)if(ki&&typeof ki=="object"&&!Array.isArray(ki)){let Tl;if(ki.name===void 0&&(Tl="name")||ki.storage===void 0&&(Tl="storage")||ki.validate===void 0&&(Tl="validate")||ki.deriveConstraint===void 0&&(Tl="deriveConstraint"))return dt.errors=[{instancePath:e+"/constraints/"+is.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"#/properties/constraints/additionalProperties/required",keyword:"required",params:{missingProperty:Tl},message:"must have required property '"+Tl+"'"}],!1;if(ki.name!==void 0){let ZS=ki.name;if(typeof ZS!="string"){let dr=typeof ZS,wl;if(wl===void 0)if(dr=="number"||dr=="boolean")wl=""+ZS;else if(ZS===null)wl="";else return dt.errors=[{instancePath:e+"/constraints/"+is.replace(/~/g,"~0").replace(/\//g,"~1")+"/name",schemaPath:"#/properties/constraints/additionalProperties/properties/name/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;wl!==void 0&&(ZS=wl,ki!==void 0&&(ki.name=wl))}}}else return dt.errors=[{instancePath:e+"/constraints/"+is.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"#/properties/constraints/additionalProperties/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;var h=en===o;if(!h)break}else return dt.errors=[{instancePath:e+"/constraints",schemaPath:"#/properties/constraints/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;var a=JS===o}else var a=!0}}}}}}}}}}}}}}}}}}}}}}}}else return dt.errors=[{instancePath:e,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;return dt.errors=s,o===0}nI.exports.defaultInitOptions={connectionTimeout:0,keepAliveTimeout:72e3,maxRequestsPerSocket:0,requestTimeout:0,handlerTimeout:0,bodyLimit:1048576,caseSensitive:!0,allowUnsafeRegex:!1,disableRequestLogging:!1,ignoreTrailingSlash:!1,ignoreDuplicateSlashes:!1,maxParamLength:100,onProtoPoisoning:"error",onConstructorPoisoning:"error",pluginTimeout:1e4,requestIdHeader:!1,requestIdLogLabel:"reqId",http2SessionTimeout:72e3,exposeHeadRoutes:!0,useSemicolonDelimiter:!1,allowErrorHandlerOverride:!0,routerOptions:{ignoreTrailingSlash:!1,ignoreDuplicateSlashes:!1,maxParamLength:100,allowUnsafeRegex:!1,useSemicolonDelimiter:!1}}});var eme=E((H8t,sI)=>{"use strict";var iI=Qhe(),Qct=iR()({circles:!0,proto:!1}),{FST_ERR_INIT_OPTS_INVALID:elt}=Ur();function tlt(t){let e=Qct(t);if(!iI(e)){let r=new elt(JSON.stringify(iI.errors.map(n=>n.message)));throw r.errors=iI.errors,r}return EB(e)}function EB(t){let e=Object.getOwnPropertyNames(t);for(let r of e){let n=t[r];ArrayBuffer.isView(n)&&!(n instanceof DataView)||(t[r]=n&&typeof n=="object"?EB(n):n)}return Object.freeze(t)}sI.exports=tlt;sI.exports.defaultInitOptions=iI.defaultInitOptions;sI.exports.utils={deepFreezeObject:EB}});var lme=E((G8t,cme)=>{"use strict";var{kAvvioBoot:rlt,kChildren:tme,kRoutePrefix:rme,kLogLevel:nme,kLogSerializers:vB,kHooks:bB,kSchemaController:Tm,kContentTypeParser:ime,kReply:sme,kRequest:ome,kFourOhFour:nlt,kPluginNameChain:ame,kErrorHandlerAlreadySet:ilt}=Ar(),slt=_R(),olt=TR(),alt=A2(),clt=kF(),{buildHooks:llt}=Ol(),Av=Z2();cme.exports=function(e,r,n){let i=Av.registerPlugin.call(e,r),s=Av.getPluginName(r)||Av.getFuncPreview(r);if(i)return e[ame].push(s),e;let o=Object.create(e);e[tme].push(o),o.ready=e[rlt].bind(o),o[tme]=[],o[sme]=slt.buildReply(o[sme]),o[ome]=olt.buildRequest(o[ome]),o[ime]=clt.helpers.buildContentTypeParser(o[ime]),o[bB]=llt(o[bB]),o[rme]=ult(o[rme],n.prefix),o[nme]=n.logLevel||o[nme],o[Tm]=alt.buildSchemaController(e[Tm]),o.getSchema=o[Tm].getSchema.bind(o[Tm]),o.getSchemas=o[Tm].getSchemas.bind(o[Tm]),o[Av.kRegisteredPlugins]=Object.create(o[Av.kRegisteredPlugins]),o[ame]=[s],o[ilt]=!1,(o[vB]||n.logSerializers)&&(o[vB]=Object.assign(Object.create(o[vB]),n.logSerializers)),n.prefix&&o[nlt].arrange404(o);for(let a of o[bB].onRegister)a.call(e,o,n);return o};function ult(t,e){return e?(t.endsWith("/")&&e[0]==="/"?e=e.slice(1):e[0]!=="/"&&(e="/"+e),t+e):t}});var hme=E(Zo=>{"use strict";Object.defineProperty(Zo,"__esModule",{value:!0});Zo.parseCookie=fme;Zo.parse=fme;Zo.stringifyCookie=glt;Zo.stringifySetCookie=oI;Zo.serialize=oI;Zo.parseSetCookie=_lt;Zo.stringifySetCookie=oI;Zo.serialize=oI;var ume=/^[\u0021-\u003A\u003C\u003E-\u007E]+$/,dme=/^[\u0021-\u003A\u003C-\u007E]*$/,dlt=/^([.]?[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)([.][a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)*$/i,flt=/^[\u0020-\u003A\u003D-\u007E]*$/,plt=/^-?\d+$/,hlt=Object.prototype.toString,mlt=(()=>{let t=function(){};return t.prototype=Object.create(null),t})();function fme(t,e){let r=new mlt,n=t.length;if(n<2)return r;let i=e?.decode||pme,s=0;do{let o=wB(t,s,n);if(o===-1)break;let a=TB(t,s,n);if(o>a){s=t.lastIndexOf(";",o-1)+1;continue}let c=Kl(t,s,o);r[c]===void 0&&(r[c]=i(Kl(t,o+1,a))),s=a+1}while(s<n);return r}function glt(t,e){let r=e?.encode||encodeURIComponent,n=[];for(let i of Object.keys(t)){let s=t[i];if(s===void 0)continue;if(!ume.test(i))throw new TypeError(`cookie name is invalid: ${i}`);let o=r(s);if(!dme.test(o))throw new TypeError(`cookie val is invalid: ${s}`);n.push(`${i}=${o}`)}return n.join("; ")}function oI(t,e,r){let n=typeof t=="object"?t:{...r,name:t,value:String(e)},s=(typeof e=="object"?e:r)?.encode||encodeURIComponent;if(!ume.test(n.name))throw new TypeError(`argument name is invalid: ${n.name}`);let o=n.value?s(n.value):"";if(!dme.test(o))throw new TypeError(`argument val is invalid: ${n.value}`);let a=n.name+"="+o;if(n.maxAge!==void 0){if(!Number.isInteger(n.maxAge))throw new TypeError(`option maxAge is invalid: ${n.maxAge}`);a+="; Max-Age="+n.maxAge}if(n.domain){if(!dlt.test(n.domain))throw new TypeError(`option domain is invalid: ${n.domain}`);a+="; Domain="+n.domain}if(n.path){if(!flt.test(n.path))throw new TypeError(`option path is invalid: ${n.path}`);a+="; Path="+n.path}if(n.expires){if(!ylt(n.expires)||!Number.isFinite(n.expires.valueOf()))throw new TypeError(`option expires is invalid: ${n.expires}`);a+="; Expires="+n.expires.toUTCString()}if(n.httpOnly&&(a+="; HttpOnly"),n.secure&&(a+="; Secure"),n.partitioned&&(a+="; Partitioned"),n.priority)switch(typeof n.priority=="string"?n.priority.toLowerCase():void 0){case"low":a+="; Priority=Low";break;case"medium":a+="; Priority=Medium";break;case"high":a+="; Priority=High";break;default:throw new TypeError(`option priority is invalid: ${n.priority}`)}if(n.sameSite)switch(typeof n.sameSite=="string"?n.sameSite.toLowerCase():n.sameSite){case!0:case"strict":a+="; SameSite=Strict";break;case"lax":a+="; SameSite=Lax";break;case"none":a+="; SameSite=None";break;default:throw new TypeError(`option sameSite is invalid: ${n.sameSite}`)}return a}function _lt(t,e){let r=e?.decode||pme,n=t.length,i=TB(t,0,n),s=wB(t,0,i),o=s===-1?{name:"",value:r(Kl(t,0,i))}:{name:Kl(t,0,s),value:r(Kl(t,s+1,i))},a=i+1;for(;a<n;){let c=TB(t,a,n),l=wB(t,a,c),u=l===-1?Kl(t,a,c):Kl(t,a,l),d=l===-1?void 0:Kl(t,l+1,c);switch(u.toLowerCase()){case"httponly":o.httpOnly=!0;break;case"secure":o.secure=!0;break;case"partitioned":o.partitioned=!0;break;case"domain":o.domain=d;break;case"path":o.path=d;break;case"max-age":d&&plt.test(d)&&(o.maxAge=Number(d));break;case"expires":if(!d)break;let f=new Date(d);Number.isFinite(f.valueOf())&&(o.expires=f);break;case"priority":if(!d)break;let p=d.toLowerCase();(p==="low"||p==="medium"||p==="high")&&(o.priority=p);break;case"samesite":if(!d)break;let h=d.toLowerCase();(h==="lax"||h==="strict"||h==="none")&&(o.sameSite=h);break}a=c+1}return o}function TB(t,e,r){let n=t.indexOf(";",e);return n===-1?r:n}function wB(t,e,r){let n=t.indexOf("=",e);return n<r?n:-1}function Kl(t,e,r){let n=e,i=r;do{let s=t.charCodeAt(n);if(s!==32&&s!==9)break}while(++n<i);for(;i>n;){let s=t.charCodeAt(i-1);if(s!==32&&s!==9)break;i--}return t.slice(n,i)}function pme(t){if(t.indexOf("%")===-1)return t;try{return decodeURIComponent(t)}catch{return t}}function ylt(t){return hlt.call(t)==="[object Date]"}});var gme=E((Y8t,aI)=>{"use strict";var{format:AB}=W("util");function Slt(t){return mme({...t,name:"DeprecationWarning"})}function mme({name:t,code:e,message:r,unlimited:n=!1}={}){if(!t)throw new Error("Warning name must not be empty");if(!e)throw new Error("Warning code must not be empty");if(!r)throw new Error("Warning message must not be empty");if(typeof n!="boolean")throw new Error("Warning opts.unlimited must be a boolean");e=e.toUpperCase();let i={[t]:function(o,a,c){s.emitted===!0&&s.unlimited!==!0||(s.emitted=!0,process.emitWarning(s.format(o,a,c),s.name,s.code))}};n&&(i={[t]:function(o,a,c){s.emitted=!0,process.emitWarning(s.format(o,a,c),s.name,s.code)}});let s=i[t];return s.emitted=!1,s.message=r,s.unlimited=n,s.code=e,s.format=function(o,a,c){let l;return o&&a&&c?l=AB(r,o,a,c):o&&a?l=AB(r,o,a):o?l=AB(r,o):l=r,l},s}var RB={createWarning:mme,createDeprecation:Slt};aI.exports=RB;aI.exports.default=RB;aI.exports.processWarning=RB});var Sme=E((K8t,yme)=>{"use strict";var{URL:_me}=W("url"),xB="http://localhost";yme.exports=function(e,r){(typeof e=="string"||Object.prototype.toString.call(e)==="[object String]")&&e.startsWith("//")&&(e=xB+e);let n=typeof e=="object"?Object.assign(new _me(xB),e):new _me(e,xB);if(typeof r=="string"){r=new URLSearchParams(r);for(let i of r.keys()){n.searchParams.delete(i);for(let s of r.getAll(i))n.searchParams.append(i,s)}}else{let i=Object.assign({},e.query,r);for(let s in i){let o=i[s];if(Array.isArray(o)){n.searchParams.delete(s);for(let a of o)n.searchParams.append(s,a)}else n.searchParams.set(s,o)}}return n}});var Eme=E((J8t,IB)=>{"use strict";var{randomUUID:Elt}=W("crypto"),{Readable:vlt}=W("stream"),wm;function blt(t){return t&&typeof t=="object"&&typeof t.append=="function"&&typeof t.delete=="function"&&typeof t.get=="function"&&typeof t.getAll=="function"&&typeof t.has=="function"&&typeof t.set=="function"&&t[Symbol.toStringTag]==="FormData"}function Tlt(t){wm=wm??new TextEncoder;let e=`----formdata-${Elt()}`,r=`--${e}\r
360
+ `)).bind(this)}};ahe.exports=uB});var uhe=E((U8t,lhe)=>{"use strict";var Gat=["ACL","BIND","CHECKOUT","CONNECT","COPY","DELETE","GET","HEAD","LINK","LOCK","M-SEARCH","MERGE","MKACTIVITY","MKCALENDAR","MKCOL","MOVE","NOTIFY","OPTIONS","PATCH","POST","PROPFIND","PROPPATCH","PURGE","PUT","QUERY","REBIND","REPORT","SEARCH","SOURCE","SUBSCRIBE","TRACE","UNBIND","UNLINK","UNLOCK","UNSUBSCRIBE"];lhe.exports=Gat});var phe=E((F8t,fhe)=>{"use strict";function dhe(t,e){return t===50?e===53?"%":e===51?"#":e===52?"$":e===54?"&":e===66||e===98?"+":e===67||e===99?",":e===70||e===102?"/":null:t===51?e===65||e===97?":":e===66||e===98?";":e===68||e===100?"=":e===70||e===102?"?":null:t===52&&e===48?"@":null}function Wat(t,e){let r=!1,n=!1,i="";for(let o=1;o<t.length;o++){let a=t.charCodeAt(o);if(a===37){let c=t.charCodeAt(o+1),l=t.charCodeAt(o+2);dhe(c,l)===null?r=!0:(n=!0,c===50&&l===53&&(r=!0,t=t.slice(0,o+1)+"25"+t.slice(o+1),o+=2),o+=2)}else if(a===63||a===35||a===59&&e){i=t.slice(o+1),t=t.slice(0,o);break}}return{path:r?decodeURI(t):t,querystring:i,shouldDecodeParam:n}}function Yat(t){let e=t.indexOf("%");if(e===-1)return t;let r="",n=e;for(let i=e;i<t.length;i++)if(t.charCodeAt(i)===37){let s=t.charCodeAt(i+1),o=t.charCodeAt(i+2),a=dhe(s,o);r+=t.slice(n,i)+a,n=i+3}return t.slice(0,e)+r+t.slice(n)}fhe.exports={safeDecodeURI:Wat,safeDecodeURIComponent:Yat}});var hB=E((j8t,The)=>{"use strict";var yr=W("assert"),Kat=Spe(),bm=qpe(),pB=LE(),{prettyPrintTree:Jat}=Kpe(),{StaticNode:hhe,NODE_TYPES:mhe}=rhe(),Zat=che(),vm=uhe(),dB=Wx(),{safeDecodeURI:ghe,safeDecodeURIComponent:fB}=phe(),_he=/^https?:\/\/.*?\//,hf=/(\/:[^/()]*?)\?(\/?)/,yhe=/[.*+?^${}()|[\]\\]/g,She=/\/\/+/g;if(!bm(_he))throw new Error("the FULL_PATH_REGEXP is not safe, update this module");if(!bm(hf))throw new Error("the OPTIONAL_PARAM_REGEXP is not safe, update this module");if(!bm(yhe))throw new Error("the ESCAPE_REGEXP is not safe, update this module");if(!bm(She))throw new Error("the REMOVE_DUPLICATE_SLASHES_REGEXP is not safe, update this module");function Vt(t){if(!(this instanceof Vt))return new Vt(t);t=t||{},this._opts=t,t.defaultRoute?(yr(typeof t.defaultRoute=="function","The default route must be a function"),this.defaultRoute=t.defaultRoute):this.defaultRoute=null,t.onBadUrl?(yr(typeof t.onBadUrl=="function","The bad url handler must be a function"),this.onBadUrl=t.onBadUrl):this.onBadUrl=null,t.buildPrettyMeta?(yr(typeof t.buildPrettyMeta=="function","buildPrettyMeta must be a function"),this.buildPrettyMeta=t.buildPrettyMeta):this.buildPrettyMeta=Xat,t.querystringParser?(yr(typeof t.querystringParser=="function","querystringParser must be a function"),this.querystringParser=t.querystringParser):this.querystringParser=e=>e.length===0?{}:Kat.parse(e),this.caseSensitive=t.caseSensitive===void 0?!0:t.caseSensitive,this.ignoreTrailingSlash=t.ignoreTrailingSlash||!1,this.ignoreDuplicateSlashes=t.ignoreDuplicateSlashes||!1,this.maxParamLength=t.maxParamLength||100,this.onMaxParamLength=t.onMaxParamLength||null,this.allowUnsafeRegex=t.allowUnsafeRegex||!1,this.constrainer=new Zat(t.constraints),this.useSemicolonDelimiter=t.useSemicolonDelimiter||!1,this.routes=[],this.trees={}}Vt.prototype.on=function(e,r,n,i,s){typeof n=="function"&&(i!==void 0&&(s=i),i=n,n={}),yr(typeof r=="string","Path should be a string"),yr(r.length>0,"The path could not be empty"),yr(r[0]==="/"||r[0]==="*","The first character of a path should be `/` or `*`"),yr(typeof i=="function","Handler should be a function");let o=r.match(hf);if(o){yr(r.length===o.index+o[0].length,"Optional Parameter needs to be the last parameter of the path");let l=r.replace(hf,"$1$2"),u=r.replace(hf,"$2")||"/";this.on(e,l,n,i,s),this.on(e,u,n,i,s);return}let a=r;this.ignoreDuplicateSlashes&&(r=tI(r)),this.ignoreTrailingSlash&&(r=rI(r));let c=Array.isArray(e)?e:[e];for(let l of c)yr(typeof l=="string","Method should be a string"),yr(vm.includes(l),`Method '${l}' is not an http method.`),this._on(l,r,n,i,s,a)};Vt.prototype._on=function(e,r,n,i,s){let o={};n.constraints!==void 0&&(yr(typeof n.constraints=="object"&&n.constraints!==null,"Constraints should be an object"),Object.keys(n.constraints).length!==0&&(o=n.constraints)),this.constrainer.validateConstraints(o),this.constrainer.noteUsage(o),this.trees[e]===void 0&&(this.trees[e]=new hhe("/"));let a=r;if(a==="*"&&this.trees[e].prefix.length!==0){let f=this.trees[e];this.trees[e]=new hhe(""),this.trees[e].staticChildren["/"]=f}let c=this.trees[e],l=c.prefix.length,u=[];for(let f=0;f<=a.length;f++){if(a.charCodeAt(f)===58&&a.charCodeAt(f+1)===58){f++;continue}let p=a.charCodeAt(f)===58&&a.charCodeAt(f+1)!==58,h=a.charCodeAt(f)===42;if(p||h||f===a.length&&f!==l){let m=a.slice(l,f);this.caseSensitive||(m=m.toLowerCase()),m=m.replaceAll("::",":"),m=m.replaceAll("%","%25"),c=c.createStaticChild(m)}if(p){let m=!1,_=!0,y="",v=[],S=f+1;for(let g=S;;g++){let T=a.charCodeAt(g),I=T===40,x=T===45||T===46,R=T===47||g===a.length;if(I||x||R){let O=a.slice(S,g);if(u.push(O),m=m||I||x,I){let L=bhe(a,g),C=a.slice(g,L+1);this.allowUnsafeRegex||yr(bm(new RegExp(C)),`The regex '${C}' is not safe!`),v.push(vhe(C)),g=L+1,_=!0}else v.push(_?"(.*?)":`(${y}|(?:(?!${y}).)*)`),_=!1;let A=g;for(;g<a.length;g++){let L=a.charCodeAt(g);if(L===47)break;if(L===58)if(a.charCodeAt(g+1)===58)g++;else break}let b=a.slice(A,g);if(b&&(b=b.replaceAll("::",":"),b=b.replaceAll("%","%25"),v.push(y=Ehe(b))),S=g+1,R||a.charCodeAt(g)===47||g===a.length){let L=m?"()"+b:b,C=a.slice(f,g);a=a.slice(0,f+1)+L+a.slice(g),f+=L.length;let w=m?new RegExp("^"+v.join("")+"$"):null;c=c.createParametricChild(w,b||null,C),l=f+1;break}}}}else if(h&&(u.push("*"),c=c.createWildcardChild(),l=f+1,f!==a.length-1))throw new Error("Wildcard must be the last character in the route")}this.caseSensitive||(a=a.toLowerCase()),a==="*"&&(a="/*");for(let f of this.routes){let p=f.opts.constraints||{};if(f.method===e&&f.pattern===a&&pB(p,o))throw new Error(`Method '${e}' already declared for route '${a}' with constraints '${JSON.stringify(o)}'`)}let d={method:e,path:r,pattern:a,params:u,opts:n,handler:i,store:s};this.routes.push(d),c.addRoute(d,this.constrainer)};Vt.prototype.hasRoute=function(e,r,n){return this.findRoute(e,r,n)!==null};Vt.prototype.findRoute=function(e,r,n={}){if(this.trees[e]===void 0)return null;let i=r,s=this.trees[e],o=s.prefix.length,a=[];for(let c=0;c<=i.length;c++){if(i.charCodeAt(c)===58&&i.charCodeAt(c+1)===58){c++;continue}let l=i.charCodeAt(c)===58&&i.charCodeAt(c+1)!==58,u=i.charCodeAt(c)===42;if(l||u||c===i.length&&c!==o){let d=i.slice(o,c);if(this.caseSensitive||(d=d.toLowerCase()),d=d.replaceAll("::",":"),d=d.replaceAll("%","%25"),s=s.getStaticChild(d),s===null)return null}if(l){let d=!1,f=!0,p="",h=[],m=c+1;for(let _=m;;_++){let y=i.charCodeAt(_),v=y===40,S=y===45||y===46,g=y===47||_===i.length;if(v||S||g){let T=i.slice(m,_);if(a.push(T),d=d||v||S,v){let R=bhe(i,_),O=i.slice(_,R+1);this.allowUnsafeRegex||yr(bm(new RegExp(O)),`The regex '${O}' is not safe!`),h.push(vhe(O)),_=R+1,f=!1}else h.push(f?"(.*?)":`(${p}|(?:(?!${p}).)*)`),f=!1;let I=_;for(;_<i.length;_++){let R=i.charCodeAt(_);if(R===47)break;if(R===58)if(i.charCodeAt(_+1)===58)_++;else break}let x=i.slice(I,_);if(x&&(x=x.replaceAll("::",":"),x=x.replaceAll("%","%25"),h.push(p=Ehe(x))),m=_+1,g||i.charCodeAt(_)===47||_===i.length){let R=d?"()"+x:x,O=i.slice(c,_);i=i.slice(0,c+1)+R+i.slice(_),c+=R.length;let A=d?new RegExp("^"+h.join("")+"$"):null;if(s=s.getParametricChild(A,x||null,O),s===null)return null;o=c+1;break}}}}else if(u&&(a.push("*"),s=s.getWildcardChild(),o=c+1,c!==i.length-1))throw new Error("Wildcard must be the last character in the route")}this.caseSensitive||(i=i.toLowerCase());for(let c of this.routes){let l=c.opts.constraints||{};if(c.method===e&&c.pattern===i&&pB(l,n))return{handler:c.handler,store:c.store,params:c.params}}return null};Vt.prototype.hasConstraintStrategy=function(t){return this.constrainer.hasConstraintStrategy(t)};Vt.prototype.addConstraintStrategy=function(t){this.constrainer.addConstraintStrategy(t),this._rebuild(this.routes)};Vt.prototype.reset=function(){this.trees={},this.routes=[]};Vt.prototype.off=function(e,r,n){yr(typeof r=="string","Path should be a string"),yr(r.length>0,"The path could not be empty"),yr(r[0]==="/"||r[0]==="*","The first character of a path should be `/` or `*`"),yr(typeof n>"u"||typeof n=="object"&&!Array.isArray(n)&&n!==null,"Constraints should be an object or undefined.");let i=r.match(hf);if(i){yr(r.length===i.index+i[0].length,"Optional Parameter needs to be the last parameter of the path");let o=r.replace(hf,"$1$2"),a=r.replace(hf,"$2");this.off(e,o,n),this.off(e,a,n);return}this.ignoreDuplicateSlashes&&(r=tI(r)),this.ignoreTrailingSlash&&(r=rI(r));let s=Array.isArray(e)?e:[e];for(let o of s)this._off(o,r,n)};Vt.prototype._off=function(e,r,n){yr(typeof e=="string","Method should be a string"),yr(vm.includes(e),`Method '${e}' is not an http method.`);function i(c){return e!==c.method||r!==c.path}function s(c){return i(c)||!pB(n,c.opts.constraints||{})}let o=n?s:i,a=this.routes.filter(o);this._rebuild(a)};Vt.prototype.lookup=function(e,r,n,i){if(typeof n=="function"&&(i=n,n=void 0),i===void 0){let s=this.constrainer.deriveConstraints(e,n),o=this.find(e.method,e.url,s);return this.callHandler(o,e,r,n)}this.constrainer.deriveConstraints(e,n,(s,o)=>{if(s!==null){i(s);return}try{let a=this.find(e.method,e.url,o),c=this.callHandler(a,e,r,n);i(null,c)}catch(a){i(a)}})};Vt.prototype.callHandler=function(e,r,n,i){return e===null?this._defaultRoute(r,n,i):i===void 0?e.handler(r,n,e.params,e.store,e.searchParams):e.handler.call(i,r,n,e.params,e.store,e.searchParams)};Vt.prototype.find=function(e,r,n){let i=this.trees[e];if(i===void 0)return null;r.charCodeAt(0)!==47&&(r=r.replace(_he,"/")),this.ignoreDuplicateSlashes&&(r=tI(r));let s,o,a;try{s=ghe(r,this.useSemicolonDelimiter),r=s.path,o=s.querystring,a=s.shouldDecodeParam}catch{return this._onBadUrl(r)}this.ignoreTrailingSlash&&(r=rI(r));let c=r;this.caseSensitive===!1&&(r=r.toLowerCase());let l=this.maxParamLength,u=i.prefix.length,d=[],f=r.length,p=[],h=!1;for(;;){if(u===f&&i.isLeafNode){let v=i.handlerStorage.getMatchingHandler(n);if(v!==null)return{handler:v.handler,store:v.store,params:v._createParamsObject(d),searchParams:this.querystringParser(o)}}let m=i.getNextNode(r,u,p,d.length);if(m===null){if(p.length===0)return h&&this.onMaxParamLength?this._onMaxParamLength(c):null;let v=p.pop();u=v.brotherPathIndex,d.splice(v.paramsCount),m=v.brotherNode}if(i=m,i.kind===mhe.STATIC){u+=i.prefix.length;continue}if(i.kind===mhe.WILDCARD){let v=c.slice(u);a&&(v=fB(v)),d.push(v),u=f;continue}let _=c.indexOf("/",u);_===-1&&(_=f);let y=c.slice(u,_);if(a&&(y=fB(y)),i.isRegex){let v=i.regex.exec(y);if(v===null){m=null;continue}let S=!1;for(let g=1;g<v.length;g++)if(v[g].length>l){S=!0;break}if(S){h=!0,m=null;continue}for(let g=1;g<v.length;g++)d.push(v[g])}else{if(y.length>l){h=!0,m=null;continue}d.push(y)}u=_}};Vt.prototype._rebuild=function(t){this.reset();for(let e of t){let{method:r,path:n,opts:i,handler:s,store:o}=e;this._on(r,n,i,s,o)}};Vt.prototype._defaultRoute=function(t,e,r){if(this.defaultRoute!==null)return r===void 0?this.defaultRoute(t,e):this.defaultRoute.call(r,t,e);e.statusCode=404,e.end()};Vt.prototype._onBadUrl=function(t){if(this.onBadUrl===null)return null;let e=this.onBadUrl;return{handler:(r,n,i)=>e(t,r,n),params:{},store:null}};Vt.prototype._onMaxParamLength=function(t){if(this.onMaxParamLength===null)return null;let e=this.onMaxParamLength;return{handler:(r,n,i)=>e(t,r,n),params:{},store:null}};Vt.prototype.prettyPrint=function(t={}){let e=t.method;t.buildPrettyMeta=this.buildPrettyMeta.bind(this);let r=null;if(e===void 0){let{version:n,host:i,...s}=this.constrainer.strategies;s[dB.name]=dB;let o=new Vt({...this._opts,constraints:s}),a=this.routes.map(c=>{let l={...c.opts.constraints,[dB.name]:c.method};return{...c,method:"MERGED",opts:{constraints:l}}});o._rebuild(a),r=o.trees.MERGED}else r=this.trees[e];return r==null?"(empty tree)":Jat(r,t)};for(let t in vm){if(!vm.hasOwnProperty(t))continue;let e=vm[t],r=e.toLowerCase();Vt.prototype[r]=function(n,i,s){return this.on(e,n,i,s)}}Vt.prototype.all=function(t,e,r){this.on(vm,t,e,r)};Vt.sanitizeUrlPath=function(e,r){let n=ghe(e,r);return n.shouldDecodeParam?fB(n.path):n.path};Vt.removeDuplicateSlashes=tI;Vt.trimLastSlash=rI;The.exports=Vt;function Ehe(t){return t.replace(yhe,"\\$&")}function tI(t){return t.indexOf("//")!==-1?t.replace(She,"/"):t}function rI(t){return t.length>1&&t.charCodeAt(t.length-1)===47?t.slice(0,-1):t}function vhe(t){return t.charCodeAt(1)===94&&(t=t.slice(0,1)+t.slice(2)),t.charCodeAt(t.length-2)===36&&(t=t.slice(0,t.length-2)+t.slice(t.length-1)),t}function bhe(t,e){let r=1;for(;e<t.length;){if(e++,t.charCodeAt(e)===92){e++;continue}if(t.charCodeAt(e)===41?r--:t.charCodeAt(e)===40&&r++,!r)return e}throw new TypeError('Invalid regexp expression in "'+t+'"')}function Xat(t){return t?t.store?Object.assign({},t.store):{}:{}}});var Ahe=E((q8t,whe)=>{"use strict";function mB(t,e,r,n){if(r===void 0){e.header("content-length","0"),n(null,null);return}if(typeof r.resume=="function"){r.on("error",s=>{e.log.error({err:s},"Error on Stream found for HEAD route")}),r.resume(),n(null,null);return}if(typeof r.getReader=="function"){r.cancel("Stream cancelled by HEAD route").catch(s=>{e.log.error({err:s},"Error on Stream found for HEAD route")}),n(null,null);return}let i=""+Buffer.byteLength(r);e.header("content-length",i),n(null,null)}function Qat(t){return t==null?mB:Array.isArray(t)?[...t,mB]:[t,mB]}whe.exports={parseHeadOnSendHandlers:Qat}});var Hhe=E((B8t,Vhe)=>{"use strict";var ect=hB(),tct=wR(),Rhe=dU(),{onRequestAbortHookRunner:rct,lifecycleHooks:xhe,preParsingHookRunner:nct,onTimeoutHookRunner:ict,onRequestHookRunner:sct}=Ol(),{normalizeSchema:oct}=mE(),{parseHeadOnSendHandlers:act}=Ahe(),{compileSchemasForValidation:cct,compileSchemasForSerialization:lct}=aU(),{FST_ERR_SCH_VALIDATION_BUILD:uct,FST_ERR_SCH_SERIALIZATION_BUILD:dct,FST_ERR_DUPLICATED_ROUTE:fct,FST_ERR_INVALID_URL:pct,FST_ERR_HOOK_INVALID_HANDLER:Ihe,FST_ERR_ROUTE_OPTIONS_NOT_OBJ:hct,FST_ERR_ROUTE_DUPLICATED_HANDLER:mct,FST_ERR_ROUTE_HANDLER_NOT_FN:Ohe,FST_ERR_ROUTE_MISSING_HANDLER:gct,FST_ERR_ROUTE_METHOD_NOT_SUPPORTED:_ct,FST_ERR_ROUTE_METHOD_INVALID:yct,FST_ERR_ROUTE_BODY_VALIDATION_SCHEMA_NOT_SUPPORTED:Sct,FST_ERR_ROUTE_BODY_LIMIT_OPTION_NOT_INT:Ect,FST_ERR_ROUTE_HANDLER_TIMEOUT_OPTION_NOT_INT:vct,FST_ERR_HANDLER_TIMEOUT:bct,FST_ERR_HOOK_INVALID_ASYNC_HANDLER:gB}=Ur(),{kRoutePrefix:Tct,kSupportedHTTPMethods:SB,kLogLevel:wct,kLogSerializers:Phe,kHooks:Che,kSchemaController:Act,kOptions:Nhe,kReplySerializerDefault:_B,kReplyIsError:Bhe,kRequestPayloadStream:Rct,kDisableRequestLogging:khe,kSchemaErrorFormatter:xct,kErrorHandler:$he,kHasBeenDecorated:Lhe,kRequestAcceptVersion:yB,kRouteByFastify:Ict,kRouteContext:Dhe,kRequestSignal:Oct,kTimeoutTimer:Mhe,kOnAbort:Pct}=Ar(),{buildErrorHandler:Cct}=gE(),{createChildLogger:Nct}=hE(),{getGenReqId:kct}=Mx(),{FSTDEP022:$ct}=xh(),Uhe=["allowUnsafeRegex","buildPrettyMeta","caseSensitive","constraints","defaultRoute","ignoreDuplicateSlashes","ignoreTrailingSlash","maxParamLength","onBadUrl","querystringParser","useSemicolonDelimiter"];function Lct(t){let e=ect(t),r,n,i,s,o,a,c,l,u,d,f,p,h,m=!1;return{setup(R,O){r=O.avvio,n=O.fourOhFour,i=R.logger,s=O.hasLogger,o=O.setupResponseListeners,a=O.throwIfAlreadyStarted,p=R.exposeHeadRoutes,c=R.disableRequestLogging,typeof c=="function"&&(l=R.disableRequestLogging),u=R.routerOptions.ignoreTrailingSlash,d=R.routerOptions.ignoreDuplicateSlashes,f=Object.hasOwn(R,"return503OnClosing")?R.return503OnClosing:!0,h=O.keepAliveConnections},routing:e.lookup.bind(e),route:I,hasRoute:g,prepareRoute:S,routeHandler:x,closeRoutes:()=>{m=!0},printRoutes:e.prettyPrint.bind(e),addConstraintStrategy:_,hasConstraintStrategy:y,isAsyncConstraint:v,findRoute:T};function _(R){return a("Cannot add constraint strategy!"),e.addConstraintStrategy(R)}function y(R){return e.hasConstraintStrategy(R)}function v(){return e.constrainer.asyncStrategiesInUse.size>0}function S({method:R,url:O,options:A,handler:b,isFastify:L}){if(typeof O!="string")throw new pct(typeof O);if(!b&&typeof A=="function")b=A,A={};else if(b&&typeof b=="function"){if(Object.prototype.toString.call(A)!=="[object Object]")throw new hct(R,O);if(A.handler)throw typeof A.handler=="function"?new mct(R,O):new Ohe(R,O)}return A=Object.assign({},A,{method:R,url:O,path:O,handler:b||A&&A.handler}),I.call(this,{options:A,isFastify:L})}function g({options:R}){let O=R.method?.toUpperCase()??"";return e.hasRoute(O,R.url||"",R.constraints)}function T(R){let O=e.find(R.method,R.url||"",R.constraints);return O?{handler:O.handler,params:O.params,searchParams:O.searchParams}:null}function I({options:R,isFastify:O}){a("Cannot add route!");let A={...R},b=A.url||A.path||"";if(!A.handler)throw new gct(A.method,b);if(A.errorHandler!==void 0&&typeof A.errorHandler!="function")throw new Ohe(A.method,b);zhe(A.bodyLimit),Uct(A.handlerTimeout);let L=A.exposeHeadRoute??p,C=!1,w=!1;if(Array.isArray(A.method))for(let V=0;V<A.method.length;++V)A.method[V]=Fhe.call(this,A.method[V]),jhe.call(this,A.method[V],b,A.schema),C=A.method.includes("GET"),w=A.method.includes("HEAD");else A.method=Fhe.call(this,A.method),jhe.call(this,A.method,b,A.schema),C=A.method==="GET",w=A.method==="HEAD";let P=L&&C?{...R}:null,N=this[Tct];if(b==="/"&&N.length>0&&A.method!=="HEAD")switch(A.prefixTrailingSlash){case"slash":F.call(this,{path:b,isFastify:O});break;case"no-slash":F.call(this,{path:"",isFastify:O});break;default:F.call(this,{path:"",isFastify:O}),u!==!0&&(d!==!0||!N.endsWith("/"))&&F.call(this,{path:b,prefixing:!0,isFastify:O})}else b[0]==="/"&&N.endsWith("/")?F.call(this,{path:b.slice(1),isFastify:O}):F.call(this,{path:b,isFastify:O});return this;function F({path:V,prefixing:de=!1,isFastify:Te=!1}){let Ie=N+V;if(A.url=Ie,A.path=Ie,A.routePath=V,A.prefix=N,A.logLevel=A.logLevel||this[wct],(this[Phe]||A.logSerializers)&&(A.logSerializers=Object.assign(Object.create(this[Phe]),A.logSerializers)),A.attachValidation==null&&(A.attachValidation=!1),de===!1)for(let U of this[Che].onRoute)U.call(this,A);for(let U of xhe)if(A&&U in A){if(Array.isArray(A[U]))for(let ne of A[U]){if(typeof ne!="function")throw new Ihe(U,Object.prototype.toString.call(ne));if(U==="onSend"||U==="preSerialization"||U==="onError"||U==="preParsing"){if(ne.constructor.name==="AsyncFunction"&&ne.length===4)throw new gB}else if(U==="onRequestAbort"){if(ne.constructor.name==="AsyncFunction"&&ne.length!==1)throw new gB}else if(ne.constructor.name==="AsyncFunction"&&ne.length===3)throw new gB}else if(A[U]!==void 0&&typeof A[U]!="function")throw new Ihe(U,Object.prototype.toString.call(A[U]))}let $e=A.constraints||{},oe={...A.config,url:Ie,method:A.method},Ee=new tct({schema:A.schema,handler:A.handler.bind(this),config:oe,errorHandler:A.errorHandler,childLoggerFactory:A.childLoggerFactory,bodyLimit:A.bodyLimit,logLevel:A.logLevel,logSerializers:A.logSerializers,attachValidation:A.attachValidation,schemaErrorFormatter:A.schemaErrorFormatter,replySerializer:this[_B],validatorCompiler:A.validatorCompiler,serializerCompiler:A.serializerCompiler,exposeHeadRoute:L,prefixTrailingSlash:A.prefixTrailingSlash||"both",server:this,isFastify:Te,handlerTimeout:A.handlerTimeout}),k=e.findRoute("HEAD",A.url,$e)!==null;try{e.on(A.method,A.url,{constraints:$e},x,Ee)}catch(U){if(!Ee[Ict])throw U.message.includes(`Method '${A.method}' already declared for route`)?new fct(A.method,A.url):U}if(this.after((U,ne)=>{Ee.errorHandler=A.errorHandler?Cct(this[$he],A.errorHandler):this[$he],Ee._parserOptions.limit=A.bodyLimit||null,Ee.logLevel=A.logLevel,Ee.logSerializers=A.logSerializers,Ee.attachValidation=A.attachValidation,Ee[_B]=this[_B],Ee.schemaErrorFormatter=A.schemaErrorFormatter||this[xct]||Ee.schemaErrorFormatter,r.once("preReady",()=>{for(let j of xhe){let se=this[Che][j].concat(A[j]||[]).map(M=>M.bind(this));Ee[j]=se.length?se:null}for(;!Ee.Request[Lhe]&&Ee.Request.parent;)Ee.Request=Ee.Request.parent;for(;!Ee.Reply[Lhe]&&Ee.Reply.parent;)Ee.Reply=Ee.Reply.parent;if(n.setContext(this,Ee),A.schema){Ee.schema=oct(Ee.schema,this.initialConfig);let j=this[Act],se=A.schema.body||A.schema.headers||A.schema.querystring||A.schema.params;!A.validatorCompiler&&se&&j.setupValidator(this[Nhe]);try{let M=typeof A?.validatorCompiler=="function"||j.isCustomValidatorCompiler;cct(Ee,A.validatorCompiler||j.validatorCompiler,M)}catch(M){throw new uct(A.method,Ie,M.message)}A.schema.response&&!A.serializerCompiler&&j.setupSerializer(this[Nhe]);try{lct(Ee,A.serializerCompiler||j.serializerCompiler)}catch(M){throw new dct(A.method,Ie,M.message)}}}),ne(U)}),L&&C&&!w&&!k){let U=act(P.onSend);S.call(this,{method:"HEAD",url:V,options:{...P,onSend:U},isFastify:!0})}}}function x(R,O,A,b,L){let C=kct(b.server,R),w={level:b.logLevel};b.logSerializers&&(w.serializers=b.logSerializers);let P=Nct(b,i,R,C,w);if(P[khe]=l?!1:c,m===!0&&(R.httpVersionMajor!==2&&O.setHeader("Connection","close"),f)){let Ie={"Content-Type":"application/json","Content-Length":"80"};O.writeHead(503,Ie),O.end('{"error":"Service Unavailable","message":"Service Unavailable","statusCode":503}'),P.info({res:{statusCode:503}},"request aborted - refusing to accept new requests as server is closing");return}String.prototype.toLowerCase.call(R.headers.connection||"")==="keep-alive"&&h.has(R.socket)===!1&&(h.add(R.socket),R.socket.on("close",jct.bind({keepAliveConnections:h,socket:R.socket}))),R.headers[yB]!==void 0&&(R.headers["accept-version"]=R.headers[yB],R.headers[yB]=void 0);let F=new b.Request(C,A,R,L,P,b),V=new b.Reply(O,F,P),de=l?l(F):c;P[khe]=de,de===!1&&P.info({req:F},"incoming request");let Te=b.handlerTimeout;if(Te>0){let Ie=new AbortController;F[Oct]=Ie,F[Mhe]=setTimeout(()=>{if(!V.sent){let oe=new bct(Te,b.config?.url);Ie.abort(oe),V[Bhe]=!0,V.send(oe)}},Te);let $e=()=>{Ie.signal.aborted||Ie.abort(),clearTimeout(F[Mhe])};R.on("close",$e),F[Pct]=$e}(s===!0||b.onResponse!==null||Te>0)&&o(V),b.onRequest!==null?sct(b.onRequest,F,V,qhe):qhe(null,F,V),b.onRequestAbort!==null&&R.on("close",()=>{R.aborted&&rct(b.onRequestAbort,F,Dct.bind(null,V))}),b.onTimeout!==null&&(F.raw.socket._meta||F.raw.socket.on("timeout",Mct),F.raw.socket._meta={context:b,request:F,reply:V})}}function Dct(t,e){e&&t.log.error({err:e},"onRequestAborted hook failed")}function Mct(){let{context:t,request:e,reply:r}=this._meta;ict(t.onTimeout,e,r,qct)}function Fhe(t){if(typeof t!="string")throw new yct;if(t=t.toUpperCase(),!this[SB].bodyless.has(t)&&!this[SB].bodywith.has(t))throw new _ct(t);return t}function jhe(t,e,r){if(this[SB].bodyless.has(t)&&r?.body)throw new Sct(t,e)}function zhe(t){if(t!==void 0&&(!Number.isInteger(t)||t<=0))throw new Ect(t)}function Uct(t){if(t!==void 0&&(!Number.isInteger(t)||t<=0))throw new vct(t)}function qhe(t,e,r){if(r.sent!==!0){if(t!=null){r[Bhe]=!0,r.send(t);return}e[Rct]=e.raw,e[Dhe].preParsing!==null?nct(e[Dhe].preParsing,e,r,Rhe.bind(e.server)):Rhe.call(e.server,null,e,r)}}function Fct(t,e){let r=t.routerOptions==null?Object.create(null):Object.assign(Object.create(null),t.routerOptions),n=Uhe.filter(i=>Object.hasOwn(t,i));n.length>0&&$ct(n.join(", "));for(let i of Uhe)Object.hasOwn(r,i)||(r[i]=t[i]??e[i]);return r}function jct(){this.keepAliveConnections.delete(this.socket)}function qct(){}Vhe.exports={buildRouting:Lct,validateBodyLimitOption:zhe,buildRouterOptions:Fct}});var Xhe=E((z8t,Zhe)=>{"use strict";var Bct=hB(),Ghe=_R(),Whe=TR(),zct=wR(),{kRoutePrefix:Vct,kCanSetNotFoundHandler:Tv,kFourOhFourLevelInstance:wv,kFourOhFourContext:Jo,kHooks:Hct,kErrorHandler:Yhe}=Ar(),{lifecycleHooks:Gct}=Ol(),{buildErrorHandler:Wct}=gE(),{FST_ERR_NOT_FOUND:Yct}=Ur(),{createChildLogger:Khe}=hE(),{getGenReqId:Jhe}=Mx();function Kct(t){let{logger:e,disableRequestLogging:r}=t,n=Bct({onBadUrl:a(),defaultRoute:d}),i=null;return{router:n,setNotFoundHandler:l,setContext:c,arrange404:s};function s(f){f[wv]=f,f[Tv]=!0,n.onBadUrl=n.onBadUrl.bind(f),n.defaultRoute=n.defaultRoute.bind(f)}function o(f,p){let{url:h,method:m}=f.raw,_=`Route ${m}:${h} not found`;(typeof r=="function"?r(f.raw):r)||f.log.info(_),p.code(404).send({message:_,error:"Not Found",statusCode:404})}function a(){return function(p,h,m){let _=this[wv][Jo],y=Jhe(_.server,h),v=Khe(_,e,h,y),S=new Whe(y,null,h,null,v,_),g=new Ghe(m,S,v);i(S,g)}}function c(f,p){let h=Object.assign({},f[Jo]);h.onSend=p.onSend,p[Jo]=h}function l(f,p,h,m){this[Tv]===void 0&&(this[Tv]=!0),this[Jo]===void 0&&(this[Jo]=null);let _=this,y=this[Vct]||"/";if(this[Tv]===!1)throw new Error(`Not found handler already set for Fastify instance with prefix: '${y}'`);typeof f=="object"&&(f.preHandler&&(Array.isArray(f.preHandler)?f.preHandler=f.preHandler.map(v=>v.bind(_)):f.preHandler=f.preHandler.bind(_)),f.preValidation&&(Array.isArray(f.preValidation)?f.preValidation=f.preValidation.map(v=>v.bind(_)):f.preValidation=f.preValidation.bind(_))),typeof f=="function"&&(p=f,f=void 0),f=f||{},p?(this[wv][Tv]=!1,p=p.bind(this),i=p):(p=o,i=o),this.after((v,S)=>{u.call(this,y,f,p,h,m),S(v)})}function u(f,p,h,m,_){let y=new zct({schema:p.schema,handler:h,config:p.config||{},server:this});if(m.once("preReady",()=>{let v=this[Jo];for(let S of Gct){let g=this[Hct][S].concat(p[S]||[]).map(T=>T.bind(this));v[S]=g.length?g:null}v.errorHandler=p.errorHandler?Wct(this[Yhe],p.errorHandler):this[Yhe]}),this[Jo]!==null&&f==="/"){Object.assign(this[Jo],y);return}this[wv][Jo]=y,n.all(f+(f.endsWith("/")?"*":"/*"),_,y),n.all(f,_,y)}function d(f,p){let h=this[wv][Jo],m=Jhe(h.server,f),_=Khe(h,e,f,m);_.info({req:f},"incoming request");let y=new Whe(m,null,f,null,_,h),v=new Ghe(p,y,_);y.log.warn("the default handler for 404 did not catch this, this is likely a fastify bug, please report it"),y.log.warn(n.prettyPrint()),v.code(404).send(new Yct)}}Zhe.exports=Kct});var Qhe=E((V8t,nI)=>{"use strict";nI.exports=dt;nI.exports.default=dt;var Jct={type:"object",additionalProperties:!1,properties:{connectionTimeout:{type:"integer",default:0},keepAliveTimeout:{type:"integer",default:72e3},forceCloseConnections:{oneOf:[{type:"string",pattern:"idle"},{type:"boolean"}]},maxRequestsPerSocket:{type:"integer",default:0,nullable:!0},requestTimeout:{type:"integer",default:0},handlerTimeout:{type:"integer",default:0},bodyLimit:{type:"integer",default:1048576},caseSensitive:{type:"boolean",default:!0},allowUnsafeRegex:{type:"boolean",default:!1},http2:{type:"boolean"},https:{if:{not:{oneOf:[{type:"boolean"},{type:"null"},{type:"object",additionalProperties:!1,required:["allowHTTP1"],properties:{allowHTTP1:{type:"boolean"}}}]}},then:{setDefaultValue:!0}},ignoreTrailingSlash:{type:"boolean",default:!1},ignoreDuplicateSlashes:{type:"boolean",default:!1},disableRequestLogging:{default:!1},maxParamLength:{type:"integer",default:100},onProtoPoisoning:{type:"string",default:"error"},onConstructorPoisoning:{type:"string",default:"error"},pluginTimeout:{type:"integer",default:1e4},requestIdHeader:{anyOf:[{type:"boolean"},{type:"string"}],default:!1},requestIdLogLabel:{type:"string",default:"reqId"},http2SessionTimeout:{type:"integer",default:72e3},exposeHeadRoutes:{type:"boolean",default:!0},useSemicolonDelimiter:{type:"boolean",default:!1},routerOptions:{type:"object",additionalProperties:!0,properties:{ignoreTrailingSlash:{type:"boolean",default:!1},ignoreDuplicateSlashes:{type:"boolean",default:!1},maxParamLength:{type:"integer",default:100},allowUnsafeRegex:{type:"boolean",default:!1},useSemicolonDelimiter:{type:"boolean",default:!1}}},constraints:{type:"object",additionalProperties:{type:"object",required:["name","storage","validate","deriveConstraint"],additionalProperties:!0,properties:{name:{type:"string"},storage:{},validate:{},deriveConstraint:{}}}}}},Zct=Object.prototype.hasOwnProperty,Xct=new RegExp("idle","u");function dt(t,{instancePath:e="",parentData:r,parentDataProperty:n,rootData:i=t}={}){let s=null,o=0;if(o===0)if(t&&typeof t=="object"&&!Array.isArray(t)){t.connectionTimeout===void 0&&(t.connectionTimeout=0),t.keepAliveTimeout===void 0&&(t.keepAliveTimeout=72e3),t.maxRequestsPerSocket===void 0&&(t.maxRequestsPerSocket=0),t.requestTimeout===void 0&&(t.requestTimeout=0),t.handlerTimeout===void 0&&(t.handlerTimeout=0),t.bodyLimit===void 0&&(t.bodyLimit=1048576),t.caseSensitive===void 0&&(t.caseSensitive=!0),t.allowUnsafeRegex===void 0&&(t.allowUnsafeRegex=!1),t.ignoreTrailingSlash===void 0&&(t.ignoreTrailingSlash=!1),t.ignoreDuplicateSlashes===void 0&&(t.ignoreDuplicateSlashes=!1),t.disableRequestLogging===void 0&&(t.disableRequestLogging=!1),t.maxParamLength===void 0&&(t.maxParamLength=100),t.onProtoPoisoning===void 0&&(t.onProtoPoisoning="error"),t.onConstructorPoisoning===void 0&&(t.onConstructorPoisoning="error"),t.pluginTimeout===void 0&&(t.pluginTimeout=1e4),t.requestIdHeader===void 0&&(t.requestIdHeader=!1),t.requestIdLogLabel===void 0&&(t.requestIdLogLabel="reqId"),t.http2SessionTimeout===void 0&&(t.http2SessionTimeout=72e3),t.exposeHeadRoutes===void 0&&(t.exposeHeadRoutes=!0),t.useSemicolonDelimiter===void 0&&(t.useSemicolonDelimiter=!1);let m=o;for(let _ in t)Zct.call(Jct.properties,_)||delete t[_];if(m===o){let _=t.connectionTimeout,y=o;if(!(typeof _=="number"&&!(_%1)&&!isNaN(_)&&isFinite(_))){let v=typeof _,S;if(S===void 0)if(v==="boolean"||_===null||v==="string"&&_&&_==+_&&!(_%1))S=+_;else return dt.errors=[{instancePath:e+"/connectionTimeout",schemaPath:"#/properties/connectionTimeout/type",keyword:"type",params:{type:"integer"},message:"must be integer"}],!1;S!==void 0&&(_=S,t!==void 0&&(t.connectionTimeout=S))}var a=y===o;if(a){let v=t.keepAliveTimeout,S=o;if(!(typeof v=="number"&&!(v%1)&&!isNaN(v)&&isFinite(v))){let T=typeof v,I;if(I===void 0)if(T==="boolean"||v===null||T==="string"&&v&&v==+v&&!(v%1))I=+v;else return dt.errors=[{instancePath:e+"/keepAliveTimeout",schemaPath:"#/properties/keepAliveTimeout/type",keyword:"type",params:{type:"integer"},message:"must be integer"}],!1;I!==void 0&&(v=I,t!==void 0&&(t.keepAliveTimeout=I))}var a=S===o;if(a){if(t.forceCloseConnections!==void 0){let T=t.forceCloseConnections,I=o,x=o,R=!1,O=null,A=o;if(typeof T!="string"){let C=typeof T,w;if(w===void 0)if(C=="number"||C=="boolean")w=""+T;else if(T===null)w="";else{let P={instancePath:e+"/forceCloseConnections",schemaPath:"#/properties/forceCloseConnections/oneOf/0/type",keyword:"type",params:{type:"string"},message:"must be string"};s===null?s=[P]:s.push(P),o++}w!==void 0&&(T=w,t!==void 0&&(t.forceCloseConnections=w))}if(o===A&&typeof T=="string"&&!Xct.test(T)){let C={instancePath:e+"/forceCloseConnections",schemaPath:"#/properties/forceCloseConnections/oneOf/0/pattern",keyword:"pattern",params:{pattern:"idle"},message:'must match pattern "idle"'};s===null?s=[C]:s.push(C),o++}var c=A===o;c&&(R=!0,O=0);let b=o;if(typeof T!="boolean"){let C;if(C===void 0)if(T==="false"||T===0||T===null)C=!1;else if(T==="true"||T===1)C=!0;else{let w={instancePath:e+"/forceCloseConnections",schemaPath:"#/properties/forceCloseConnections/oneOf/1/type",keyword:"type",params:{type:"boolean"},message:"must be boolean"};s===null?s=[w]:s.push(w),o++}C!==void 0&&(T=C,t!==void 0&&(t.forceCloseConnections=C))}var c=b===o;if(c&&R?(R=!1,O=[O,1]):c&&(R=!0,O=1),R)o=x,s!==null&&(x?s.length=x:s=null);else{let C={instancePath:e+"/forceCloseConnections",schemaPath:"#/properties/forceCloseConnections/oneOf",keyword:"oneOf",params:{passingSchemas:O},message:"must match exactly one schema in oneOf"};return s===null?s=[C]:s.push(C),o++,dt.errors=s,!1}var a=I===o}else var a=!0;if(a){let T=t.maxRequestsPerSocket,I=o;if(!(typeof T=="number"&&!(T%1)&&!isNaN(T)&&isFinite(T))&&T!==null){let R=typeof T,O;if(O===void 0)if(R==="boolean"||T===null||R==="string"&&T&&T==+T&&!(T%1))O=+T;else if(T===""||T===0||T===!1)O=null;else return dt.errors=[{instancePath:e+"/maxRequestsPerSocket",schemaPath:"#/properties/maxRequestsPerSocket/type",keyword:"type",params:{type:"integer"},message:"must be integer"}],!1;O!==void 0&&(T=O,t!==void 0&&(t.maxRequestsPerSocket=O))}var a=I===o;if(a){let R=t.requestTimeout,O=o;if(!(typeof R=="number"&&!(R%1)&&!isNaN(R)&&isFinite(R))){let b=typeof R,L;if(L===void 0)if(b==="boolean"||R===null||b==="string"&&R&&R==+R&&!(R%1))L=+R;else return dt.errors=[{instancePath:e+"/requestTimeout",schemaPath:"#/properties/requestTimeout/type",keyword:"type",params:{type:"integer"},message:"must be integer"}],!1;L!==void 0&&(R=L,t!==void 0&&(t.requestTimeout=L))}var a=O===o;if(a){let b=t.handlerTimeout,L=o;if(!(typeof b=="number"&&!(b%1)&&!isNaN(b)&&isFinite(b))){let w=typeof b,P;if(P===void 0)if(w==="boolean"||b===null||w==="string"&&b&&b==+b&&!(b%1))P=+b;else return dt.errors=[{instancePath:e+"/handlerTimeout",schemaPath:"#/properties/handlerTimeout/type",keyword:"type",params:{type:"integer"},message:"must be integer"}],!1;P!==void 0&&(b=P,t!==void 0&&(t.handlerTimeout=P))}var a=L===o;if(a){let w=t.bodyLimit,P=o;if(!(typeof w=="number"&&!(w%1)&&!isNaN(w)&&isFinite(w))){let F=typeof w,V;if(V===void 0)if(F==="boolean"||w===null||F==="string"&&w&&w==+w&&!(w%1))V=+w;else return dt.errors=[{instancePath:e+"/bodyLimit",schemaPath:"#/properties/bodyLimit/type",keyword:"type",params:{type:"integer"},message:"must be integer"}],!1;V!==void 0&&(w=V,t!==void 0&&(t.bodyLimit=V))}var a=P===o;if(a){let F=t.caseSensitive,V=o;if(typeof F!="boolean"){let Te;if(Te===void 0)if(F==="false"||F===0||F===null)Te=!1;else if(F==="true"||F===1)Te=!0;else return dt.errors=[{instancePath:e+"/caseSensitive",schemaPath:"#/properties/caseSensitive/type",keyword:"type",params:{type:"boolean"},message:"must be boolean"}],!1;Te!==void 0&&(F=Te,t!==void 0&&(t.caseSensitive=Te))}var a=V===o;if(a){let Te=t.allowUnsafeRegex,Ie=o;if(typeof Te!="boolean"){let oe;if(oe===void 0)if(Te==="false"||Te===0||Te===null)oe=!1;else if(Te==="true"||Te===1)oe=!0;else return dt.errors=[{instancePath:e+"/allowUnsafeRegex",schemaPath:"#/properties/allowUnsafeRegex/type",keyword:"type",params:{type:"boolean"},message:"must be boolean"}],!1;oe!==void 0&&(Te=oe,t!==void 0&&(t.allowUnsafeRegex=oe))}var a=Ie===o;if(a){if(t.http2!==void 0){let oe=t.http2,Ee=o;if(typeof oe!="boolean"){let k;if(k===void 0)if(oe==="false"||oe===0||oe===null)k=!1;else if(oe==="true"||oe===1)k=!0;else return dt.errors=[{instancePath:e+"/http2",schemaPath:"#/properties/http2/type",keyword:"type",params:{type:"boolean"},message:"must be boolean"}],!1;k!==void 0&&(oe=k,t!==void 0&&(t.http2=k))}var a=Ee===o}else var a=!0;if(a){if(t.https!==void 0){let oe=t.https,Ee=o,he=o,k=!0,U=o,ne=o,j=o,se=o,M=!1,D=null,B=o;if(typeof oe!="boolean"){let z;if(z===void 0)if(oe==="false"||oe===0||oe===null)z=!1;else if(oe==="true"||oe===1)z=!0;else{let K={};s===null?s=[K]:s.push(K),o++}z!==void 0&&(oe=z,t!==void 0&&(t.https=z))}var l=B===o;l&&(M=!0,D=0);let J=o;if(oe!==null){let z;if(z===void 0)if(oe===""||oe===0||oe===!1)z=null;else{let K={};s===null?s=[K]:s.push(K),o++}z!==void 0&&(oe=z,t!==void 0&&(t.https=z))}var l=J===o;if(l&&M)M=!1,D=[D,1];else{l&&(M=!0,D=1);let z=o;if(o===z)if(oe&&typeof oe=="object"&&!Array.isArray(oe)){let re;if(oe.allowHTTP1===void 0&&(re="allowHTTP1")){let Oe={};s===null?s=[Oe]:s.push(Oe),o++}else{let Oe=o;for(let ut in oe)ut!=="allowHTTP1"&&delete oe[ut];if(Oe===o&&oe.allowHTTP1!==void 0){let ut=oe.allowHTTP1;if(typeof ut!="boolean"){let ze;if(ze===void 0)if(ut==="false"||ut===0||ut===null)ze=!1;else if(ut==="true"||ut===1)ze=!0;else{let Qr={};s===null?s=[Qr]:s.push(Qr),o++}ze!==void 0&&(ut=ze,oe!==void 0&&(oe.allowHTTP1=ze))}}}}else{let re={};s===null?s=[re]:s.push(re),o++}var l=z===o;l&&M?(M=!1,D=[D,2]):l&&(M=!0,D=2)}if(M)o=se,s!==null&&(se?s.length=se:s=null);else{let z={};s===null?s=[z]:s.push(z),o++}var u=j===o;if(u){let z={};s===null?s=[z]:s.push(z),o++}else o=ne,s!==null&&(ne?s.length=ne:s=null);var d=U===o;if(o=he,s!==null&&(he?s.length=he:s=null),d){let z=o;t.https=!0;var d=z===o;k=d}if(!k){let z={instancePath:e+"/https",schemaPath:"#/properties/https/if",keyword:"if",params:{failingKeyword:"then"},message:'must match "then" schema'};return s===null?s=[z]:s.push(z),o++,dt.errors=s,!1}var a=Ee===o}else var a=!0;if(a){let oe=t.ignoreTrailingSlash,Ee=o;if(typeof oe!="boolean"){let k;if(k===void 0)if(oe==="false"||oe===0||oe===null)k=!1;else if(oe==="true"||oe===1)k=!0;else return dt.errors=[{instancePath:e+"/ignoreTrailingSlash",schemaPath:"#/properties/ignoreTrailingSlash/type",keyword:"type",params:{type:"boolean"},message:"must be boolean"}],!1;k!==void 0&&(oe=k,t!==void 0&&(t.ignoreTrailingSlash=k))}var a=Ee===o;if(a){let k=t.ignoreDuplicateSlashes,U=o;if(typeof k!="boolean"){let j;if(j===void 0)if(k==="false"||k===0||k===null)j=!1;else if(k==="true"||k===1)j=!0;else return dt.errors=[{instancePath:e+"/ignoreDuplicateSlashes",schemaPath:"#/properties/ignoreDuplicateSlashes/type",keyword:"type",params:{type:"boolean"},message:"must be boolean"}],!1;j!==void 0&&(k=j,t!==void 0&&(t.ignoreDuplicateSlashes=j))}var a=U===o;if(a){let j=t.maxParamLength,se=o;if(!(typeof j=="number"&&!(j%1)&&!isNaN(j)&&isFinite(j))){let D=typeof j,B;if(B===void 0)if(D==="boolean"||j===null||D==="string"&&j&&j==+j&&!(j%1))B=+j;else return dt.errors=[{instancePath:e+"/maxParamLength",schemaPath:"#/properties/maxParamLength/type",keyword:"type",params:{type:"integer"},message:"must be integer"}],!1;B!==void 0&&(j=B,t!==void 0&&(t.maxParamLength=B))}var a=se===o;if(a){let D=t.onProtoPoisoning,B=o;if(typeof D!="string"){let H=typeof D,z;if(z===void 0)if(H=="number"||H=="boolean")z=""+D;else if(D===null)z="";else return dt.errors=[{instancePath:e+"/onProtoPoisoning",schemaPath:"#/properties/onProtoPoisoning/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;z!==void 0&&(D=z,t!==void 0&&(t.onProtoPoisoning=z))}var a=B===o;if(a){let H=t.onConstructorPoisoning,z=o;if(typeof H!="string"){let re=typeof H,Oe;if(Oe===void 0)if(re=="number"||re=="boolean")Oe=""+H;else if(H===null)Oe="";else return dt.errors=[{instancePath:e+"/onConstructorPoisoning",schemaPath:"#/properties/onConstructorPoisoning/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;Oe!==void 0&&(H=Oe,t!==void 0&&(t.onConstructorPoisoning=Oe))}var a=z===o;if(a){let re=t.pluginTimeout,Oe=o;if(!(typeof re=="number"&&!(re%1)&&!isNaN(re)&&isFinite(re))){let ze=typeof re,Qr;if(Qr===void 0)if(ze==="boolean"||re===null||ze==="string"&&re&&re==+re&&!(re%1))Qr=+re;else return dt.errors=[{instancePath:e+"/pluginTimeout",schemaPath:"#/properties/pluginTimeout/type",keyword:"type",params:{type:"integer"},message:"must be integer"}],!1;Qr!==void 0&&(re=Qr,t!==void 0&&(t.pluginTimeout=Qr))}var a=Oe===o;if(a){let ze=t.requestIdHeader,Qr=o,qs=o,Ni=!1,Ha=o;if(typeof ze!="boolean"){let at;if(at===void 0)if(ze==="false"||ze===0||ze===null)at=!1;else if(ze==="true"||ze===1)at=!0;else{let Mt={instancePath:e+"/requestIdHeader",schemaPath:"#/properties/requestIdHeader/anyOf/0/type",keyword:"type",params:{type:"boolean"},message:"must be boolean"};s===null?s=[Mt]:s.push(Mt),o++}at!==void 0&&(ze=at,t!==void 0&&(t.requestIdHeader=at))}var f=Ha===o;if(Ni=Ni||f,!Ni){let at=o;if(typeof ze!="string"){let Bs=typeof ze,zt;if(zt===void 0)if(Bs=="number"||Bs=="boolean")zt=""+ze;else if(ze===null)zt="";else{let ve={instancePath:e+"/requestIdHeader",schemaPath:"#/properties/requestIdHeader/anyOf/1/type",keyword:"type",params:{type:"string"},message:"must be string"};s===null?s=[ve]:s.push(ve),o++}zt!==void 0&&(ze=zt,t!==void 0&&(t.requestIdHeader=zt))}var f=at===o;Ni=Ni||f}if(Ni)o=qs,s!==null&&(qs?s.length=qs:s=null);else{let at={instancePath:e+"/requestIdHeader",schemaPath:"#/properties/requestIdHeader/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf"};return s===null?s=[at]:s.push(at),o++,dt.errors=s,!1}var a=Qr===o;if(a){let at=t.requestIdLogLabel,Mt=o;if(typeof at!="string"){let zt=typeof at,ve;if(ve===void 0)if(zt=="number"||zt=="boolean")ve=""+at;else if(at===null)ve="";else return dt.errors=[{instancePath:e+"/requestIdLogLabel",schemaPath:"#/properties/requestIdLogLabel/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;ve!==void 0&&(at=ve,t!==void 0&&(t.requestIdLogLabel=ve))}var a=Mt===o;if(a){let zt=t.http2SessionTimeout,ve=o;if(!(typeof zt=="number"&&!(zt%1)&&!isNaN(zt)&&isFinite(zt))){let xt=typeof zt,ur;if(ur===void 0)if(xt==="boolean"||zt===null||xt==="string"&&zt&&zt==+zt&&!(zt%1))ur=+zt;else return dt.errors=[{instancePath:e+"/http2SessionTimeout",schemaPath:"#/properties/http2SessionTimeout/type",keyword:"type",params:{type:"integer"},message:"must be integer"}],!1;ur!==void 0&&(zt=ur,t!==void 0&&(t.http2SessionTimeout=ur))}var a=ve===o;if(a){let xt=t.exposeHeadRoutes,ur=o;if(typeof xt!="boolean"){let bn;if(bn===void 0)if(xt==="false"||xt===0||xt===null)bn=!1;else if(xt==="true"||xt===1)bn=!0;else return dt.errors=[{instancePath:e+"/exposeHeadRoutes",schemaPath:"#/properties/exposeHeadRoutes/type",keyword:"type",params:{type:"boolean"},message:"must be boolean"}],!1;bn!==void 0&&(xt=bn,t!==void 0&&(t.exposeHeadRoutes=bn))}var a=ur===o;if(a){let bn=t.useSemicolonDelimiter,P1=o;if(typeof bn!="boolean"){let Ze;if(Ze===void 0)if(bn==="false"||bn===0||bn===null)Ze=!1;else if(bn==="true"||bn===1)Ze=!0;else return dt.errors=[{instancePath:e+"/useSemicolonDelimiter",schemaPath:"#/properties/useSemicolonDelimiter/type",keyword:"type",params:{type:"boolean"},message:"must be boolean"}],!1;Ze!==void 0&&(bn=Ze,t!==void 0&&(t.useSemicolonDelimiter=Ze))}var a=P1===o;if(a){if(t.routerOptions!==void 0){let Ze=t.routerOptions,JS=o;if(o===JS)if(Ze&&typeof Ze=="object"&&!Array.isArray(Ze)){Ze.ignoreTrailingSlash===void 0&&(Ze.ignoreTrailingSlash=!1),Ze.ignoreDuplicateSlashes===void 0&&(Ze.ignoreDuplicateSlashes=!1),Ze.maxParamLength===void 0&&(Ze.maxParamLength=100),Ze.allowUnsafeRegex===void 0&&(Ze.allowUnsafeRegex=!1),Ze.useSemicolonDelimiter===void 0&&(Ze.useSemicolonDelimiter=!1);let is=Ze.ignoreTrailingSlash,ki=o;if(typeof is!="boolean"){let en;if(en===void 0)if(is==="false"||is===0||is===null)en=!1;else if(is==="true"||is===1)en=!0;else return dt.errors=[{instancePath:e+"/routerOptions/ignoreTrailingSlash",schemaPath:"#/properties/routerOptions/properties/ignoreTrailingSlash/type",keyword:"type",params:{type:"boolean"},message:"must be boolean"}],!1;en!==void 0&&(is=en,Ze!==void 0&&(Ze.ignoreTrailingSlash=en))}var p=ki===o;if(p){let en=Ze.ignoreDuplicateSlashes,Tl=o;if(typeof en!="boolean"){let dr;if(dr===void 0)if(en==="false"||en===0||en===null)dr=!1;else if(en==="true"||en===1)dr=!0;else return dt.errors=[{instancePath:e+"/routerOptions/ignoreDuplicateSlashes",schemaPath:"#/properties/routerOptions/properties/ignoreDuplicateSlashes/type",keyword:"type",params:{type:"boolean"},message:"must be boolean"}],!1;dr!==void 0&&(en=dr,Ze!==void 0&&(Ze.ignoreDuplicateSlashes=dr))}var p=Tl===o;if(p){let dr=Ze.maxParamLength,wl=o;if(!(typeof dr=="number"&&!(dr%1)&&!isNaN(dr)&&isFinite(dr))){let $o=typeof dr,Ud;if(Ud===void 0)if($o==="boolean"||dr===null||$o==="string"&&dr&&dr==+dr&&!(dr%1))Ud=+dr;else return dt.errors=[{instancePath:e+"/routerOptions/maxParamLength",schemaPath:"#/properties/routerOptions/properties/maxParamLength/type",keyword:"type",params:{type:"integer"},message:"must be integer"}],!1;Ud!==void 0&&(dr=Ud,Ze!==void 0&&(Ze.maxParamLength=Ud))}var p=wl===o;if(p){let $o=Ze.allowUnsafeRegex,Ud=o;if(typeof $o!="boolean"){let ai;if(ai===void 0)if($o==="false"||$o===0||$o===null)ai=!1;else if($o==="true"||$o===1)ai=!0;else return dt.errors=[{instancePath:e+"/routerOptions/allowUnsafeRegex",schemaPath:"#/properties/routerOptions/properties/allowUnsafeRegex/type",keyword:"type",params:{type:"boolean"},message:"must be boolean"}],!1;ai!==void 0&&($o=ai,Ze!==void 0&&(Ze.allowUnsafeRegex=ai))}var p=Ud===o;if(p){let ai=Ze.useSemicolonDelimiter,wHe=o;if(typeof ai!="boolean"){let vh;if(vh===void 0)if(ai==="false"||ai===0||ai===null)vh=!1;else if(ai==="true"||ai===1)vh=!0;else return dt.errors=[{instancePath:e+"/routerOptions/useSemicolonDelimiter",schemaPath:"#/properties/routerOptions/properties/useSemicolonDelimiter/type",keyword:"type",params:{type:"boolean"},message:"must be boolean"}],!1;vh!==void 0&&(ai=vh,Ze!==void 0&&(Ze.useSemicolonDelimiter=vh))}var p=wHe===o}}}}}else return dt.errors=[{instancePath:e+"/routerOptions",schemaPath:"#/properties/routerOptions/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;var a=JS===o}else var a=!0;if(a)if(t.constraints!==void 0){let Ze=t.constraints,JS=o;if(o===JS)if(Ze&&typeof Ze=="object"&&!Array.isArray(Ze))for(let is in Ze){let ki=Ze[is],en=o;if(o===en)if(ki&&typeof ki=="object"&&!Array.isArray(ki)){let Tl;if(ki.name===void 0&&(Tl="name")||ki.storage===void 0&&(Tl="storage")||ki.validate===void 0&&(Tl="validate")||ki.deriveConstraint===void 0&&(Tl="deriveConstraint"))return dt.errors=[{instancePath:e+"/constraints/"+is.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"#/properties/constraints/additionalProperties/required",keyword:"required",params:{missingProperty:Tl},message:"must have required property '"+Tl+"'"}],!1;if(ki.name!==void 0){let ZS=ki.name;if(typeof ZS!="string"){let dr=typeof ZS,wl;if(wl===void 0)if(dr=="number"||dr=="boolean")wl=""+ZS;else if(ZS===null)wl="";else return dt.errors=[{instancePath:e+"/constraints/"+is.replace(/~/g,"~0").replace(/\//g,"~1")+"/name",schemaPath:"#/properties/constraints/additionalProperties/properties/name/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;wl!==void 0&&(ZS=wl,ki!==void 0&&(ki.name=wl))}}}else return dt.errors=[{instancePath:e+"/constraints/"+is.replace(/~/g,"~0").replace(/\//g,"~1"),schemaPath:"#/properties/constraints/additionalProperties/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;var h=en===o;if(!h)break}else return dt.errors=[{instancePath:e+"/constraints",schemaPath:"#/properties/constraints/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;var a=JS===o}else var a=!0}}}}}}}}}}}}}}}}}}}}}}}}else return dt.errors=[{instancePath:e,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;return dt.errors=s,o===0}nI.exports.defaultInitOptions={connectionTimeout:0,keepAliveTimeout:72e3,maxRequestsPerSocket:0,requestTimeout:0,handlerTimeout:0,bodyLimit:1048576,caseSensitive:!0,allowUnsafeRegex:!1,disableRequestLogging:!1,ignoreTrailingSlash:!1,ignoreDuplicateSlashes:!1,maxParamLength:100,onProtoPoisoning:"error",onConstructorPoisoning:"error",pluginTimeout:1e4,requestIdHeader:!1,requestIdLogLabel:"reqId",http2SessionTimeout:72e3,exposeHeadRoutes:!0,useSemicolonDelimiter:!1,allowErrorHandlerOverride:!0,routerOptions:{ignoreTrailingSlash:!1,ignoreDuplicateSlashes:!1,maxParamLength:100,allowUnsafeRegex:!1,useSemicolonDelimiter:!1}}});var eme=E((H8t,sI)=>{"use strict";var iI=Qhe(),Qct=iR()({circles:!0,proto:!1}),{FST_ERR_INIT_OPTS_INVALID:elt}=Ur();function tlt(t){let e=Qct(t);if(!iI(e)){let r=new elt(JSON.stringify(iI.errors.map(n=>n.message)));throw r.errors=iI.errors,r}return EB(e)}function EB(t){let e=Object.getOwnPropertyNames(t);for(let r of e){let n=t[r];ArrayBuffer.isView(n)&&!(n instanceof DataView)||(t[r]=n&&typeof n=="object"?EB(n):n)}return Object.freeze(t)}sI.exports=tlt;sI.exports.defaultInitOptions=iI.defaultInitOptions;sI.exports.utils={deepFreezeObject:EB}});var lme=E((G8t,cme)=>{"use strict";var{kAvvioBoot:rlt,kChildren:tme,kRoutePrefix:rme,kLogLevel:nme,kLogSerializers:vB,kHooks:bB,kSchemaController:Tm,kContentTypeParser:ime,kReply:sme,kRequest:ome,kFourOhFour:nlt,kPluginNameChain:ame,kErrorHandlerAlreadySet:ilt}=Ar(),slt=_R(),olt=TR(),alt=A2(),clt=kF(),{buildHooks:llt}=Ol(),Av=Z2();cme.exports=function(e,r,n){let i=Av.registerPlugin.call(e,r),s=Av.getPluginName(r)||Av.getFuncPreview(r);if(i)return e[ame].push(s),e;let o=Object.create(e);e[tme].push(o),o.ready=e[rlt].bind(o),o[tme]=[],o[sme]=slt.buildReply(o[sme]),o[ome]=olt.buildRequest(o[ome]),o[ime]=clt.helpers.buildContentTypeParser(o[ime]),o[bB]=llt(o[bB]),o[rme]=ult(o[rme],n.prefix),o[nme]=n.logLevel||o[nme],o[Tm]=alt.buildSchemaController(e[Tm]),o.getSchema=o[Tm].getSchema.bind(o[Tm]),o.getSchemas=o[Tm].getSchemas.bind(o[Tm]),o[Av.kRegisteredPlugins]=Object.create(o[Av.kRegisteredPlugins]),o[ame]=[s],o[ilt]=!1,(o[vB]||n.logSerializers)&&(o[vB]=Object.assign(Object.create(o[vB]),n.logSerializers)),n.prefix&&o[nlt].arrange404(o);for(let a of o[bB].onRegister)a.call(e,o,n);return o};function ult(t,e){return e?(t.endsWith("/")&&e[0]==="/"?e=e.slice(1):e[0]!=="/"&&(e="/"+e),t+e):t}});var hme=E(Zo=>{"use strict";Object.defineProperty(Zo,"__esModule",{value:!0});Zo.parseCookie=fme;Zo.parse=fme;Zo.stringifyCookie=glt;Zo.stringifySetCookie=oI;Zo.serialize=oI;Zo.parseSetCookie=_lt;Zo.stringifySetCookie=oI;Zo.serialize=oI;var ume=/^[\u0021-\u003A\u003C\u003E-\u007E]+$/,dme=/^[\u0021-\u003A\u003C-\u007E]*$/,dlt=/^([.]?[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)([.][a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)*$/i,flt=/^[\u0020-\u003A\u003D-\u007E]*$/,plt=/^-?\d+$/,hlt=Object.prototype.toString,mlt=(()=>{let t=function(){};return t.prototype=Object.create(null),t})();function fme(t,e){let r=new mlt,n=t.length;if(n<2)return r;let i=e?.decode||pme,s=0;do{let o=wB(t,s,n);if(o===-1)break;let a=TB(t,s,n);if(o>a){s=t.lastIndexOf(";",o-1)+1;continue}let c=Kl(t,s,o);r[c]===void 0&&(r[c]=i(Kl(t,o+1,a))),s=a+1}while(s<n);return r}function glt(t,e){let r=e?.encode||encodeURIComponent,n=[];for(let i of Object.keys(t)){let s=t[i];if(s===void 0)continue;if(!ume.test(i))throw new TypeError(`cookie name is invalid: ${i}`);let o=r(s);if(!dme.test(o))throw new TypeError(`cookie val is invalid: ${s}`);n.push(`${i}=${o}`)}return n.join("; ")}function oI(t,e,r){let n=typeof t=="object"?t:{...r,name:t,value:String(e)},s=(typeof e=="object"?e:r)?.encode||encodeURIComponent;if(!ume.test(n.name))throw new TypeError(`argument name is invalid: ${n.name}`);let o=n.value?s(n.value):"";if(!dme.test(o))throw new TypeError(`argument val is invalid: ${n.value}`);let a=n.name+"="+o;if(n.maxAge!==void 0){if(!Number.isInteger(n.maxAge))throw new TypeError(`option maxAge is invalid: ${n.maxAge}`);a+="; Max-Age="+n.maxAge}if(n.domain){if(!dlt.test(n.domain))throw new TypeError(`option domain is invalid: ${n.domain}`);a+="; Domain="+n.domain}if(n.path){if(!flt.test(n.path))throw new TypeError(`option path is invalid: ${n.path}`);a+="; Path="+n.path}if(n.expires){if(!ylt(n.expires)||!Number.isFinite(n.expires.valueOf()))throw new TypeError(`option expires is invalid: ${n.expires}`);a+="; Expires="+n.expires.toUTCString()}if(n.httpOnly&&(a+="; HttpOnly"),n.secure&&(a+="; Secure"),n.partitioned&&(a+="; Partitioned"),n.priority)switch(typeof n.priority=="string"?n.priority.toLowerCase():void 0){case"low":a+="; Priority=Low";break;case"medium":a+="; Priority=Medium";break;case"high":a+="; Priority=High";break;default:throw new TypeError(`option priority is invalid: ${n.priority}`)}if(n.sameSite)switch(typeof n.sameSite=="string"?n.sameSite.toLowerCase():n.sameSite){case!0:case"strict":a+="; SameSite=Strict";break;case"lax":a+="; SameSite=Lax";break;case"none":a+="; SameSite=None";break;default:throw new TypeError(`option sameSite is invalid: ${n.sameSite}`)}return a}function _lt(t,e){let r=e?.decode||pme,n=t.length,i=TB(t,0,n),s=wB(t,0,i),o=s===-1?{name:"",value:r(Kl(t,0,i))}:{name:Kl(t,0,s),value:r(Kl(t,s+1,i))},a=i+1;for(;a<n;){let c=TB(t,a,n),l=wB(t,a,c),u=l===-1?Kl(t,a,c):Kl(t,a,l),d=l===-1?void 0:Kl(t,l+1,c);switch(u.toLowerCase()){case"httponly":o.httpOnly=!0;break;case"secure":o.secure=!0;break;case"partitioned":o.partitioned=!0;break;case"domain":o.domain=d;break;case"path":o.path=d;break;case"max-age":d&&plt.test(d)&&(o.maxAge=Number(d));break;case"expires":if(!d)break;let f=new Date(d);Number.isFinite(f.valueOf())&&(o.expires=f);break;case"priority":if(!d)break;let p=d.toLowerCase();(p==="low"||p==="medium"||p==="high")&&(o.priority=p);break;case"samesite":if(!d)break;let h=d.toLowerCase();(h==="lax"||h==="strict"||h==="none")&&(o.sameSite=h);break}a=c+1}return o}function TB(t,e,r){let n=t.indexOf(";",e);return n===-1?r:n}function wB(t,e,r){let n=t.indexOf("=",e);return n<r?n:-1}function Kl(t,e,r){let n=e,i=r;do{let s=t.charCodeAt(n);if(s!==32&&s!==9)break}while(++n<i);for(;i>n;){let s=t.charCodeAt(i-1);if(s!==32&&s!==9)break;i--}return t.slice(n,i)}function pme(t){if(t.indexOf("%")===-1)return t;try{return decodeURIComponent(t)}catch{return t}}function ylt(t){return hlt.call(t)==="[object Date]"}});var gme=E((Y8t,aI)=>{"use strict";var{format:AB}=W("util");function Slt(t){return mme({...t,name:"DeprecationWarning"})}function mme({name:t,code:e,message:r,unlimited:n=!1}={}){if(!t)throw new Error("Warning name must not be empty");if(!e)throw new Error("Warning code must not be empty");if(!r)throw new Error("Warning message must not be empty");if(typeof n!="boolean")throw new Error("Warning opts.unlimited must be a boolean");e=e.toUpperCase();let i={[t]:function(o,a,c){s.emitted===!0&&s.unlimited!==!0||(s.emitted=!0,process.emitWarning(s.format(o,a,c),s.name,s.code))}};n&&(i={[t]:function(o,a,c){s.emitted=!0,process.emitWarning(s.format(o,a,c),s.name,s.code)}});let s=i[t];return s.emitted=!1,s.message=r,s.unlimited=n,s.code=e,s.format=function(o,a,c){let l;return o&&a&&c?l=AB(r,o,a,c):o&&a?l=AB(r,o,a):o?l=AB(r,o):l=r,l},s}var RB={createWarning:mme,createDeprecation:Slt};aI.exports=RB;aI.exports.default=RB;aI.exports.processWarning=RB});var Sme=E((K8t,yme)=>{"use strict";var{URL:_me}=W("url"),xB="http://localhost";yme.exports=function(e,r){(typeof e=="string"||Object.prototype.toString.call(e)==="[object String]")&&e.startsWith("//")&&(e=xB+e);let n=typeof e=="object"?Object.assign(new _me(xB),e):new _me(e,xB);if(typeof r=="string"){r=new URLSearchParams(r);for(let i of r.keys()){n.searchParams.delete(i);for(let s of r.getAll(i))n.searchParams.append(i,s)}}else{let i=Object.assign({},e.query,r);for(let s in i){let o=i[s];if(Array.isArray(o)){n.searchParams.delete(s);for(let a of o)n.searchParams.append(s,a)}else n.searchParams.set(s,o)}}return n}});var Eme=E((J8t,IB)=>{"use strict";var{randomUUID:Elt}=W("crypto"),{Readable:vlt}=W("stream"),wm;function blt(t){return t&&typeof t=="object"&&typeof t.append=="function"&&typeof t.delete=="function"&&typeof t.get=="function"&&typeof t.getAll=="function"&&typeof t.has=="function"&&typeof t.set=="function"&&t[Symbol.toStringTag]==="FormData"}function Tlt(t){wm=wm??new TextEncoder;let e=`----formdata-${Elt()}`,r=`--${e}\r
361
361
  Content-Disposition: form-data`;let n=c=>c.replace(/\n/g,"%0A").replace(/\r/g,"%0D").replace(/"/g,"%22"),i=c=>c.replace(/\r?\n|\r/g,`\r
362
362
  `),s=new Uint8Array([13,10]);async function*o(){for(let[c,l]of t)if(typeof l=="string")yield wm.encode(`${r}; name="${n(i(c))}"\r
363
363
  \r
@@ -365,7 +365,7 @@ Content-Disposition: form-data`;let n=c=>c.replace(/\n/g,"%0A").replace(/\r/g,"%
365
365
  `);else{let u=`${r}; name="${n(i(c))}"`;l.name&&(u+=`; filename="${n(l.name)}"`),u+=`\r
366
366
  Content-Type: ${l.type||"application/octet-stream"}\r
367
367
  \r
368
- `,yield wm.encode(u),l.stream?yield*l.stream():yield l,yield s}yield wm.encode(`--${e}--`)}return{stream:vlt.from(o()),contentType:`multipart/form-data; boundary=${e}`}}IB.exports.isFormDataLike=blt;IB.exports.formDataToStream=Tlt});var Tme=E((Z8t,cI)=>{"use strict";var{Readable:vme,addAbortSignal:wlt}=W("stream"),PB=W("util"),Alt=hme(),Rlt=W("assert"),{createDeprecation:xlt}=gme(),Ilt=Sme(),{isFormDataLike:Olt,formDataToStream:Plt}=Eme(),{EventEmitter:Clt}=W("events"),Nlt=xlt({name:"FastifyDeprecationLightMyRequest",code:"FST_LIGHTMYREQUEST_DEP01",message:'You are accessing "request.connection", use "request.socket" instead.'});function klt(t){return t.port?t.host:t.hostname+(t.protocol==="https:"?":443":":80")}var OB=class extends Clt{constructor(e){super(),this.remoteAddress=e}};function bme(t){return new e(this);function e(r){Jl.call(r,{...t,Request:void 0}),Object.assign(this,r);for(let n of Object.keys(Jl.prototype))this.constructor.prototype[n]=Jl.prototype[n];return PB.inherits(this.constructor,t.Request),this}}function Jl(t){vme.call(this,{autoDestroy:!1});let e=Ilt(t.url||t.path,t.query);this.url=e.pathname+e.search,this.aborted=!1,this.httpVersionMajor=1,this.httpVersionMinor=1,this.httpVersion="1.1",this.method=t.method?t.method.toUpperCase():"GET",this.headers={},this.rawHeaders=[];let r=t.headers||{};for(let o in r){let a=o.toLowerCase();if((a==="user-agent"||a==="content-type")&&r[o]===void 0){this.headers[a]=void 0;continue}let c=r[o];Rlt(c!==void 0,'invalid value "undefined" for header '+o),this.headers[a]=""+c}if("user-agent"in this.headers||(this.headers["user-agent"]="lightMyRequest"),this.headers.host=this.headers.host||t.authority||klt(e),t.cookies){let{cookies:o}=t,a=Object.keys(o).map(c=>Alt.serialize(c,o[c]));this.headers.cookie&&a.unshift(this.headers.cookie),this.headers.cookie=a.join("; ")}this.socket=new OB(t.remoteAddress||"127.0.0.1"),Object.defineProperty(this,"connection",{get(){return Nlt(),this.socket},configurable:!0});let n=t.payload||t.body||null,i=n&&typeof n.resume=="function";if(Olt(n)){let o=Plt(n);n=o.stream,i=!0,this.headers["content-type"]=o.contentType,this.headers["transfer-encoding"]="chunked"}n&&typeof n!="string"&&!i&&!Buffer.isBuffer(n)&&(n=JSON.stringify(n),"content-type"in this.headers||(this.headers["content-type"]="application/json")),n&&!i&&!Object.hasOwn(this.headers,"content-length")&&(this.headers["content-length"]=(Buffer.isBuffer(n)?n.length:Buffer.byteLength(n)).toString());for(let o of Object.keys(this.headers))this.rawHeaders.push(o,this.headers[o]);this._lightMyRequest={payload:n,isDone:!1,simulate:t.simulate||{},payloadAsStream:t.payloadAsStream,signal:t.signal};let s=t.signal;s&&wlt(s,this);{let o=this._lightMyRequest.payload;o?._readableState?(this._read=$lt,o.on("error",a=>{this.destroy(a)}),o.on("end",()=>{this.push(null)})):this._read=Llt}return this}function $lt(){let t=this._lightMyRequest.payload,e=!0,r=!1,n;for(;e&&(n=t.read());)r=!0,e=this.push(n);e&&!r&&this._lightMyRequest.payload.once("readable",this._read.bind(this))}function Llt(){setImmediate(()=>{if(this._lightMyRequest.isDone){this._lightMyRequest.simulate.end!==!1&&this.push(null);return}this._lightMyRequest.isDone=!0,this._lightMyRequest.payload&&(this._lightMyRequest.simulate.split?(this.push(this._lightMyRequest.payload.slice(0,1)),this.push(this._lightMyRequest.payload.slice(1))):this.push(this._lightMyRequest.payload)),this._lightMyRequest.simulate.error&&this.emit("error",new Error("Simulated")),this._lightMyRequest.simulate.close&&this.emit("close"),this._lightMyRequest.simulate.end!==!1&&this.push(null)})}PB.inherits(Jl,vme);PB.inherits(bme,Jl);Jl.prototype.destroy=function(t){this.destroyed||this._lightMyRequest.isDone||(this.destroyed=!0,t&&(this._error=!0,process.nextTick(()=>this.emit("error",t))),process.nextTick(()=>this.emit("close")))};cI.exports=Jl;cI.exports.Request=Jl;cI.exports.CustomRequest=bme});var Ame=E((X8t,Rv)=>{"use strict";var lI={decodeValues:!0,map:!1,silent:!1};function CB(t){return typeof t!="string"||t in{}}function NB(){return Object.create(null)}function kB(t){return typeof t=="string"&&!!t.trim()}function $B(t,e){var r=t.split(";").filter(kB),n=r.shift(),i=Dlt(n),s=i.name,o=i.value;if(e=e?Object.assign({},lI,e):lI,CB(s))return null;try{o=e.decodeValues?decodeURIComponent(o):o}catch(c){console.error("set-cookie-parser: failed to decode cookie value. Set options.decodeValues=false to disable decoding.",c)}var a=NB();return a.name=s,a.value=o,r.forEach(function(c){var l=c.split("="),u=l.shift().trimLeft().toLowerCase();if(!CB(u)){var d=l.join("=");if(u==="expires")a.expires=new Date(d);else if(u==="max-age"){var f=parseInt(d,10);Number.isNaN(f)||(a.maxAge=f)}else u==="secure"?a.secure=!0:u==="httponly"?a.httpOnly=!0:u==="samesite"?a.sameSite=d:u==="partitioned"?a.partitioned=!0:u&&(a[u]=d)}}),a}function Dlt(t){var e="",r="",n=t.split("=");return n.length>1?(e=n.shift(),r=n.join("=")):r=t,{name:e,value:r}}function wme(t,e){if(e=e?Object.assign({},lI,e):lI,!t)return e.map?NB():[];if(t.headers)if(typeof t.headers.getSetCookie=="function")t=t.headers.getSetCookie();else if(t.headers["set-cookie"])t=t.headers["set-cookie"];else{var r=t.headers[Object.keys(t.headers).find(function(i){return i.toLowerCase()==="set-cookie"})];!r&&t.headers.cookie&&!e.silent&&console.warn("Warning: set-cookie-parser appears to have been called on a request object. It is designed to parse Set-Cookie headers from responses, not Cookie headers from requests. Set the option {silent: true} to suppress this warning."),t=r}if(Array.isArray(t)||(t=[t]),e.map){var n=NB();return t.filter(kB).reduce(function(i,s){var o=$B(s,e);return o&&!CB(o.name)&&(i[o.name]=o),i},n)}else return t.filter(kB).map(function(i){return $B(i,e)}).filter(Boolean)}function Mlt(t){if(Array.isArray(t))return t;if(typeof t!="string")return[];var e=[],r=0,n,i,s,o,a;function c(){for(;r<t.length&&/\s/.test(t.charAt(r));)r+=1;return r<t.length}function l(){return i=t.charAt(r),i!=="="&&i!==";"&&i!==","}for(;r<t.length;){for(n=r,a=!1;c();)if(i=t.charAt(r),i===","){for(s=r,r+=1,c(),o=r;r<t.length&&l();)r+=1;r<t.length&&t.charAt(r)==="="?(a=!0,r=o,e.push(t.substring(n,s)),n=r):r=s+1}else r+=1;(!a||r>=t.length)&&e.push(t.substring(n,t.length))}return e}Rv.exports=wme;Rv.exports.parse=wme;Rv.exports.parseString=$B;Rv.exports.splitCookiesString=Mlt});var Pme=E((Q8t,Ome)=>{"use strict";var xv=W("http"),{Writable:Ult,Readable:Rme,addAbortSignal:Flt}=W("stream"),jlt=W("util"),qlt=Ame();function Zl(t,e,r){if(xv.ServerResponse.call(this,t),t._lightMyRequest?.payloadAsStream){let a=this.emit.bind(this,"drain");this._lightMyRequest={headers:null,trailers:{},stream:new Rme({read:a})};let c=t._lightMyRequest.signal;c&&Flt(c,this._lightMyRequest.stream)}else this._lightMyRequest={headers:null,trailers:{},payloadChunks:[]};this.setHeader("foo","bar"),this.removeHeader("foo"),this.assignSocket(Blt()),this._promiseCallback=typeof r=="function";let n=!1,i=a=>{if(!n){if(n=!0,this._promiseCallback)return process.nextTick(()=>e(a));process.nextTick(()=>e(null,a))}};this._lightMyRequest.onEndSuccess=i;let s=!1,o=a=>{if(n){this._lightMyRequest.stream&&!s&&(a||(a=new Error("response destroyed before completion"),a.code="LIGHT_ECONNRESET"),this._lightMyRequest.stream.destroy(a),this._lightMyRequest.stream.on("error",()=>{}));return}if(n=!0,a||(a=new Error("response destroyed before completion"),a.code="LIGHT_ECONNRESET"),this._promiseCallback)return process.nextTick(()=>r(a));process.nextTick(()=>e(a,null))};this._lightMyRequest.stream?this.once("finish",()=>{s=!0,this._lightMyRequest.stream.push(null)}):this.once("finish",()=>{let a=xme(this);a.raw.req=t,i(a)}),this.connection.once("error",o),this.once("error",o),this.once("close",o)}jlt.inherits(Zl,xv.ServerResponse);Zl.prototype.setTimeout=function(t,e){return this.timeoutHandle=setTimeout(()=>{this.emit("timeout")},t),this.on("timeout",e),this};Zl.prototype.writeHead=function(){let t=xv.ServerResponse.prototype.writeHead.apply(this,arguments);return Ime(this),this._lightMyRequest.stream&&this._lightMyRequest.onEndSuccess(xme(this)),t};Zl.prototype.write=function(t,e,r){return this.timeoutHandle&&clearTimeout(this.timeoutHandle),xv.ServerResponse.prototype.write.call(this,t,e,r),this._lightMyRequest.stream?this._lightMyRequest.stream.push(Buffer.from(t,e)):(this._lightMyRequest.payloadChunks.push(Buffer.from(t,e)),!0)};Zl.prototype.end=function(t,e,r){t&&this.write(t,e),xv.ServerResponse.prototype.end.call(this,r),this.emit("finish"),this.destroy()};Zl.prototype.destroy=function(t){this.destroyed||(this.destroyed=!0,t&&process.nextTick(()=>this.emit("error",t)),process.nextTick(()=>this.emit("close")))};Zl.prototype.addTrailers=function(t){for(let e in t)this._lightMyRequest.trailers[e.toLowerCase().trim()]=t[e].toString().trim()};function xme(t){t._lightMyRequest.headers===null&&Ime(t),zlt(t);let e={raw:{res:t},headers:t._lightMyRequest.headers,statusCode:t.statusCode,statusMessage:t.statusMessage,trailers:{},get cookies(){return qlt.parse(this)}};if(e.trailers=t._lightMyRequest.trailers,t._lightMyRequest.payloadChunks){let r=Buffer.concat(t._lightMyRequest.payloadChunks);e.rawPayload=r,e.payload=r.toString(),e.body=e.payload,e.json=function(){return JSON.parse(e.payload)}}else e.json=function(){throw new Error("Response payload is not available with payloadAsStream: true")};return e.stream=function(){return t._lightMyRequest.stream?t._lightMyRequest.stream:Rme.from(t._lightMyRequest.payloadChunks)},e}function Blt(){return new Ult({write(t,e,r){setImmediate(r)}})}function zlt(t){let e=t._lightMyRequest.headers;for(let r of Object.keys(e)){let n=e[r];Array.isArray(n)?e[r]=n.map(i=>""+i):e[r]=""+n}}function Ime(t){t._lightMyRequest.headers=Object.assign({},t.getHeaders()),["Date","Connection","Transfer-Encoding"].forEach(e=>{let r=new RegExp("\\r\\n"+e+": ([^\\r]*)\\r\\n"),n=t._header?.match(r);n&&(t._lightMyRequest.headers[e.toLowerCase()]=n[1])})}Ome.exports=Zl});var Cme=E((e9t,LB)=>{"use strict";LB.exports=Rr;LB.exports.default=Rr;var Vlt={type:"object",properties:{url:{oneOf:[{type:"string"},{type:"object",properties:{protocol:{type:"string"},hostname:{type:"string"},pathname:{type:"string"}},additionalProperties:!0,required:["pathname"]}]},path:{oneOf:[{type:"string"},{type:"object",properties:{protocol:{type:"string"},hostname:{type:"string"},pathname:{type:"string"}},additionalProperties:!0,required:["pathname"]}]},cookies:{type:"object",additionalProperties:!0},headers:{type:"object",additionalProperties:!0},query:{anyOf:[{type:"object",additionalProperties:!0},{type:"string"}]},simulate:{type:"object",properties:{end:{type:"boolean"},split:{type:"boolean"},error:{type:"boolean"},close:{type:"boolean"}}},authority:{type:"string"},remoteAddress:{type:"string"},method:{type:"string",enum:["ACL","BIND","CHECKOUT","CONNECT","COPY","DELETE","GET","HEAD","LINK","LOCK","M-SEARCH","MERGE","MKACTIVITY","MKCALENDAR","MKCOL","MOVE","NOTIFY","OPTIONS","PATCH","POST","PROPFIND","PROPPATCH","PURGE","PUT","QUERY","REBIND","REPORT","SEARCH","SOURCE","SUBSCRIBE","TRACE","UNBIND","UNLINK","UNLOCK","UNSUBSCRIBE","acl","bind","checkout","connect","copy","delete","get","head","link","lock","m-search","merge","mkactivity","mkcalendar","mkcol","move","notify","options","patch","post","propfind","proppatch","purge","put","query","rebind","report","search","source","subscribe","trace","unbind","unlink","unlock","unsubscribe"]},validate:{type:"boolean"}},additionalProperties:!0,oneOf:[{required:["url"]},{required:["path"]}]};function Rr(t,{instancePath:e="",parentData:r,parentDataProperty:n,rootData:i=t}={}){let s=null,o=0,a=o,c=!1,l=null,u=o;if(t&&typeof t=="object"&&!Array.isArray(t)){let g;if(t.url===void 0&&(g="url")){let T={instancePath:e,schemaPath:"#/oneOf/0/required",keyword:"required",params:{missingProperty:g},message:"must have required property '"+g+"'"};s===null?s=[T]:s.push(T),o++}}var f=u===o;f&&(c=!0,l=0);let d=o;if(t&&typeof t=="object"&&!Array.isArray(t)){let g;if(t.path===void 0&&(g="path")){let T={instancePath:e,schemaPath:"#/oneOf/1/required",keyword:"required",params:{missingProperty:g},message:"must have required property '"+g+"'"};s===null?s=[T]:s.push(T),o++}}var f=d===o;if(f&&c?(c=!1,l=[l,1]):f&&(c=!0,l=1),c)o=a,s!==null&&(a?s.length=a:s=null);else{let g={instancePath:e,schemaPath:"#/oneOf",keyword:"oneOf",params:{passingSchemas:l},message:"must match exactly one schema in oneOf"};return s===null?s=[g]:s.push(g),o++,Rr.errors=s,!1}if(o===0)if(t&&typeof t=="object"&&!Array.isArray(t)){if(t.url!==void 0){let g=t.url,T=o,I=o,x=!1,R=null,O=o;if(typeof g!="string"){let b=typeof g,L;if(L===void 0)if(b=="number"||b=="boolean")L=""+g;else if(g===null)L="";else{let C={instancePath:e+"/url",schemaPath:"#/properties/url/oneOf/0/type",keyword:"type",params:{type:"string"},message:"must be string"};s===null?s=[C]:s.push(C),o++}L!==void 0&&(g=L,t!==void 0&&(t.url=L))}var h=O===o;h&&(x=!0,R=0);let A=o;if(o===A)if(g&&typeof g=="object"&&!Array.isArray(g)){let b;if(g.pathname===void 0&&(b="pathname")){let L={instancePath:e+"/url",schemaPath:"#/properties/url/oneOf/1/required",keyword:"required",params:{missingProperty:b},message:"must have required property '"+b+"'"};s===null?s=[L]:s.push(L),o++}else{if(g.protocol!==void 0){let L=g.protocol,C=o;if(typeof L!="string"){let w=typeof L,P;if(P===void 0)if(w=="number"||w=="boolean")P=""+L;else if(L===null)P="";else{let N={instancePath:e+"/url/protocol",schemaPath:"#/properties/url/oneOf/1/properties/protocol/type",keyword:"type",params:{type:"string"},message:"must be string"};s===null?s=[N]:s.push(N),o++}P!==void 0&&(L=P,g!==void 0&&(g.protocol=P))}var p=C===o}else var p=!0;if(p){if(g.hostname!==void 0){let L=g.hostname,C=o;if(typeof L!="string"){let P=typeof L,N;if(N===void 0)if(P=="number"||P=="boolean")N=""+L;else if(L===null)N="";else{let j={instancePath:e+"/url/hostname",schemaPath:"#/properties/url/oneOf/1/properties/hostname/type",keyword:"type",params:{type:"string"},message:"must be string"};s===null?s=[j]:s.push(j),o++}N!==void 0&&(L=N,g!==void 0&&(g.hostname=N))}var p=C===o}else var p=!0;if(p)if(g.pathname!==void 0){let L=g.pathname,C=o;if(typeof L!="string"){let P=typeof L,N;if(N===void 0)if(P=="number"||P=="boolean")N=""+L;else if(L===null)N="";else{let j={instancePath:e+"/url/pathname",schemaPath:"#/properties/url/oneOf/1/properties/pathname/type",keyword:"type",params:{type:"string"},message:"must be string"};s===null?s=[j]:s.push(j),o++}N!==void 0&&(L=N,g!==void 0&&(g.pathname=N))}var p=C===o}else var p=!0}}}else{let b={instancePath:e+"/url",schemaPath:"#/properties/url/oneOf/1/type",keyword:"type",params:{type:"object"},message:"must be object"};s===null?s=[b]:s.push(b),o++}var h=A===o;if(h&&x?(x=!1,R=[R,1]):h&&(x=!0,R=1),x)o=I,s!==null&&(I?s.length=I:s=null);else{let b={instancePath:e+"/url",schemaPath:"#/properties/url/oneOf",keyword:"oneOf",params:{passingSchemas:R},message:"must match exactly one schema in oneOf"};return s===null?s=[b]:s.push(b),o++,Rr.errors=s,!1}var m=T===o}else var m=!0;if(m){if(t.path!==void 0){let g=t.path,T=o,I=o,x=!1,R=null,O=o;if(typeof g!="string"){let L=typeof g,C;if(C===void 0)if(L=="number"||L=="boolean")C=""+g;else if(g===null)C="";else{let w={instancePath:e+"/path",schemaPath:"#/properties/path/oneOf/0/type",keyword:"type",params:{type:"string"},message:"must be string"};s===null?s=[w]:s.push(w),o++}C!==void 0&&(g=C,t!==void 0&&(t.path=C))}var y=O===o;y&&(x=!0,R=0);let A=o;if(o===A)if(g&&typeof g=="object"&&!Array.isArray(g)){let L;if(g.pathname===void 0&&(L="pathname")){let C={instancePath:e+"/path",schemaPath:"#/properties/path/oneOf/1/required",keyword:"required",params:{missingProperty:L},message:"must have required property '"+L+"'"};s===null?s=[C]:s.push(C),o++}else{if(g.protocol!==void 0){let C=g.protocol,w=o;if(typeof C!="string"){let P=typeof C,N;if(N===void 0)if(P=="number"||P=="boolean")N=""+C;else if(C===null)N="";else{let j={instancePath:e+"/path/protocol",schemaPath:"#/properties/path/oneOf/1/properties/protocol/type",keyword:"type",params:{type:"string"},message:"must be string"};s===null?s=[j]:s.push(j),o++}N!==void 0&&(C=N,g!==void 0&&(g.protocol=N))}var _=w===o}else var _=!0;if(_){if(g.hostname!==void 0){let C=g.hostname,w=o;if(typeof C!="string"){let N=typeof C,j;if(j===void 0)if(N=="number"||N=="boolean")j=""+C;else if(C===null)j="";else{let V={instancePath:e+"/path/hostname",schemaPath:"#/properties/path/oneOf/1/properties/hostname/type",keyword:"type",params:{type:"string"},message:"must be string"};s===null?s=[V]:s.push(V),o++}j!==void 0&&(C=j,g!==void 0&&(g.hostname=j))}var _=w===o}else var _=!0;if(_)if(g.pathname!==void 0){let C=g.pathname,w=o;if(typeof C!="string"){let N=typeof C,j;if(j===void 0)if(N=="number"||N=="boolean")j=""+C;else if(C===null)j="";else{let V={instancePath:e+"/path/pathname",schemaPath:"#/properties/path/oneOf/1/properties/pathname/type",keyword:"type",params:{type:"string"},message:"must be string"};s===null?s=[V]:s.push(V),o++}j!==void 0&&(C=j,g!==void 0&&(g.pathname=j))}var _=w===o}else var _=!0}}}else{let L={instancePath:e+"/path",schemaPath:"#/properties/path/oneOf/1/type",keyword:"type",params:{type:"object"},message:"must be object"};s===null?s=[L]:s.push(L),o++}var y=A===o;if(y&&x?(x=!1,R=[R,1]):y&&(x=!0,R=1),x)o=I,s!==null&&(I?s.length=I:s=null);else{let L={instancePath:e+"/path",schemaPath:"#/properties/path/oneOf",keyword:"oneOf",params:{passingSchemas:R},message:"must match exactly one schema in oneOf"};return s===null?s=[L]:s.push(L),o++,Rr.errors=s,!1}var m=T===o}else var m=!0;if(m){if(t.cookies!==void 0){let g=t.cookies,T=o;if(o===T&&!(g&&typeof g=="object"&&!Array.isArray(g)))return Rr.errors=[{instancePath:e+"/cookies",schemaPath:"#/properties/cookies/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;var m=T===o}else var m=!0;if(m){if(t.headers!==void 0){let g=t.headers,T=o;if(o===T&&!(g&&typeof g=="object"&&!Array.isArray(g)))return Rr.errors=[{instancePath:e+"/headers",schemaPath:"#/properties/headers/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;var m=T===o}else var m=!0;if(m){if(t.query!==void 0){let g=t.query,T=o,I=o,x=!1,R=o;if(o===R&&!(g&&typeof g=="object"&&!Array.isArray(g))){let A={instancePath:e+"/query",schemaPath:"#/properties/query/anyOf/0/type",keyword:"type",params:{type:"object"},message:"must be object"};s===null?s=[A]:s.push(A),o++}var v=R===o;if(x=x||v,!x){let A=o;if(typeof g!="string"){let L=typeof g,C;if(C===void 0)if(L=="number"||L=="boolean")C=""+g;else if(g===null)C="";else{let w={instancePath:e+"/query",schemaPath:"#/properties/query/anyOf/1/type",keyword:"type",params:{type:"string"},message:"must be string"};s===null?s=[w]:s.push(w),o++}C!==void 0&&(g=C,t!==void 0&&(t.query=C))}var v=A===o;x=x||v}if(x)o=I,s!==null&&(I?s.length=I:s=null);else{let A={instancePath:e+"/query",schemaPath:"#/properties/query/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf"};return s===null?s=[A]:s.push(A),o++,Rr.errors=s,!1}var m=T===o}else var m=!0;if(m){if(t.simulate!==void 0){let g=t.simulate,T=o;if(o===T)if(g&&typeof g=="object"&&!Array.isArray(g)){if(g.end!==void 0){let x=g.end,R=o;if(typeof x!="boolean"){let O;if(O===void 0)if(x==="false"||x===0||x===null)O=!1;else if(x==="true"||x===1)O=!0;else return Rr.errors=[{instancePath:e+"/simulate/end",schemaPath:"#/properties/simulate/properties/end/type",keyword:"type",params:{type:"boolean"},message:"must be boolean"}],!1;O!==void 0&&(x=O,g!==void 0&&(g.end=O))}var S=R===o}else var S=!0;if(S){if(g.split!==void 0){let x=g.split,R=o;if(typeof x!="boolean"){let A;if(A===void 0)if(x==="false"||x===0||x===null)A=!1;else if(x==="true"||x===1)A=!0;else return Rr.errors=[{instancePath:e+"/simulate/split",schemaPath:"#/properties/simulate/properties/split/type",keyword:"type",params:{type:"boolean"},message:"must be boolean"}],!1;A!==void 0&&(x=A,g!==void 0&&(g.split=A))}var S=R===o}else var S=!0;if(S){if(g.error!==void 0){let x=g.error,R=o;if(typeof x!="boolean"){let A;if(A===void 0)if(x==="false"||x===0||x===null)A=!1;else if(x==="true"||x===1)A=!0;else return Rr.errors=[{instancePath:e+"/simulate/error",schemaPath:"#/properties/simulate/properties/error/type",keyword:"type",params:{type:"boolean"},message:"must be boolean"}],!1;A!==void 0&&(x=A,g!==void 0&&(g.error=A))}var S=R===o}else var S=!0;if(S)if(g.close!==void 0){let x=g.close,R=o;if(typeof x!="boolean"){let A;if(A===void 0)if(x==="false"||x===0||x===null)A=!1;else if(x==="true"||x===1)A=!0;else return Rr.errors=[{instancePath:e+"/simulate/close",schemaPath:"#/properties/simulate/properties/close/type",keyword:"type",params:{type:"boolean"},message:"must be boolean"}],!1;A!==void 0&&(x=A,g!==void 0&&(g.close=A))}var S=R===o}else var S=!0}}}else return Rr.errors=[{instancePath:e+"/simulate",schemaPath:"#/properties/simulate/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;var m=T===o}else var m=!0;if(m){if(t.authority!==void 0){let g=t.authority,T=o;if(typeof g!="string"){let x=typeof g,R;if(R===void 0)if(x=="number"||x=="boolean")R=""+g;else if(g===null)R="";else return Rr.errors=[{instancePath:e+"/authority",schemaPath:"#/properties/authority/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;R!==void 0&&(g=R,t!==void 0&&(t.authority=R))}var m=T===o}else var m=!0;if(m){if(t.remoteAddress!==void 0){let g=t.remoteAddress,T=o;if(typeof g!="string"){let x=typeof g,R;if(R===void 0)if(x=="number"||x=="boolean")R=""+g;else if(g===null)R="";else return Rr.errors=[{instancePath:e+"/remoteAddress",schemaPath:"#/properties/remoteAddress/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;R!==void 0&&(g=R,t!==void 0&&(t.remoteAddress=R))}var m=T===o}else var m=!0;if(m){if(t.method!==void 0){let g=t.method,T=o;if(typeof g!="string"){let x=typeof g,R;if(R===void 0)if(x=="number"||x=="boolean")R=""+g;else if(g===null)R="";else return Rr.errors=[{instancePath:e+"/method",schemaPath:"#/properties/method/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;R!==void 0&&(g=R,t!==void 0&&(t.method=R))}if(!(g==="ACL"||g==="BIND"||g==="CHECKOUT"||g==="CONNECT"||g==="COPY"||g==="DELETE"||g==="GET"||g==="HEAD"||g==="LINK"||g==="LOCK"||g==="M-SEARCH"||g==="MERGE"||g==="MKACTIVITY"||g==="MKCALENDAR"||g==="MKCOL"||g==="MOVE"||g==="NOTIFY"||g==="OPTIONS"||g==="PATCH"||g==="POST"||g==="PROPFIND"||g==="PROPPATCH"||g==="PURGE"||g==="PUT"||g==="QUERY"||g==="REBIND"||g==="REPORT"||g==="SEARCH"||g==="SOURCE"||g==="SUBSCRIBE"||g==="TRACE"||g==="UNBIND"||g==="UNLINK"||g==="UNLOCK"||g==="UNSUBSCRIBE"||g==="acl"||g==="bind"||g==="checkout"||g==="connect"||g==="copy"||g==="delete"||g==="get"||g==="head"||g==="link"||g==="lock"||g==="m-search"||g==="merge"||g==="mkactivity"||g==="mkcalendar"||g==="mkcol"||g==="move"||g==="notify"||g==="options"||g==="patch"||g==="post"||g==="propfind"||g==="proppatch"||g==="purge"||g==="put"||g==="query"||g==="rebind"||g==="report"||g==="search"||g==="source"||g==="subscribe"||g==="trace"||g==="unbind"||g==="unlink"||g==="unlock"||g==="unsubscribe"))return Rr.errors=[{instancePath:e+"/method",schemaPath:"#/properties/method/enum",keyword:"enum",params:{allowedValues:Vlt.properties.method.enum},message:"must be equal to one of the allowed values"}],!1;var m=T===o}else var m=!0;if(m)if(t.validate!==void 0){let g=t.validate,T=o;if(typeof g!="boolean"){let x;if(x===void 0)if(g==="false"||g===0||g===null)x=!1;else if(g==="true"||g===1)x=!0;else return Rr.errors=[{instancePath:e+"/validate",schemaPath:"#/properties/validate/type",keyword:"type",params:{type:"boolean"},message:"must be boolean"}],!1;x!==void 0&&(g=x,t!==void 0&&(t.validate=x))}var m=T===o}else var m=!0}}}}}}}}}else return Rr.errors=[{instancePath:e,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;return Rr.errors=s,o===0}});var $me=E((t9t,Ov)=>{"use strict";var Hlt=W("assert"),DB=Tme(),uI=Pme(),fI="The dispatch function has already been invoked",Nme=Cme();function MB(t,e,r){return r===void 0?new Iv(t,e):dI(t,e,r)}function Glt(t,e){let r=t._lightMyRequest.payload;if(!r||r._readableState||typeof r.resume!="function")return e();let n=[];r.on("data",i=>n.push(Buffer.from(i))),r.on("end",()=>{let i=Buffer.concat(n);return t.headers["content-length"]=t.headers["content-length"]||""+i.length,delete t.headers["transfer-encoding"],t._lightMyRequest.payload=i,e()}),r.resume()}function kme(t,e,r,n){return r.once("error",function(i){this.destroyed&&n.destroy(i)}),r.once("close",function(){this.destroyed&&!this._error&&n.destroy()}),Glt(r,()=>t.call(e,r,n))}function dI(t,e,r){if(e=typeof e=="string"?{url:e}:e,e.validate!==!1&&(Hlt(typeof t=="function","dispatchFunc should be a function"),!Nme(e)))throw new Error(Nme.errors.map(o=>o.message));let n=e.server||{},i=e.Request?DB.CustomRequest:DB;if(t.request&&t.request.app===t&&(Object.setPrototypeOf(Object.getPrototypeOf(t.request),i.prototype),Object.setPrototypeOf(Object.getPrototypeOf(t.response),uI.prototype)),typeof r=="function"){let s=new i(e),o=new uI(s,r);return kme(t,n,s,o)}else return new Promise((s,o)=>{let a=new i(e),c=new uI(a,s,o);kme(t,n,a,c)})}function Iv(t,e){typeof e=="string"?this.option={url:e}:this.option=Object.assign({},e),this.dispatch=t,this._hasInvoked=!1,this._promise=null,this.option.autoStart!==!1&&process.nextTick(()=>{this._hasInvoked||this.end()})}var Wlt=["delete","get","head","options","patch","post","put","trace"];Wlt.forEach(t=>{Iv.prototype[t]=function(e){if(this._hasInvoked===!0||this._promise)throw new Error(fI);return this.option.url=e,this.option.method=t.toUpperCase(),this}});var Ylt=["body","cookies","headers","payload","query"];Ylt.forEach(t=>{Iv.prototype[t]=function(e){if(this._hasInvoked===!0||this._promise)throw new Error(fI);return this.option[t]=e,this}});Iv.prototype.end=function(t){if(this._hasInvoked===!0||this._promise)throw new Error(fI);if(this._hasInvoked=!0,typeof t=="function")dI(this.dispatch,this.option,t);else return this._promise=dI(this.dispatch,this.option),this._promise};Object.getOwnPropertyNames(Promise.prototype).forEach(t=>{t!=="constructor"&&(Iv.prototype[t]=function(...e){if(!this._promise){if(this._hasInvoked===!0)throw new Error(fI);this._hasInvoked=!0,this._promise=dI(this.dispatch,this.option)}return this._promise[t](...e)})});function Klt(t){return t instanceof DB||t instanceof uI||t?.constructor?.name==="_CustomLMRRequest"}Ov.exports=MB;Ov.exports.default=MB;Ov.exports.inject=MB;Ov.exports.isInjection=Klt});var Jme=E((r9t,$v)=>{"use strict";var Jlt="5.8.5",Zlt=pre(),gI=W("http"),Xlt=W("diagnostics_channel"),Pv,{kAvvioBoot:Cv,kChildren:UB,kServerBindings:Lme,kBodyLimit:Qlt,kSupportedHTTPMethods:mf,kRoutePrefix:Dme,kLogLevel:eut,kLogSerializers:tut,kHooks:FB,kSchemaController:Xl,kRequestAcceptVersion:rut,kReplySerializerDefault:Mme,kContentTypeParser:nut,kReply:iut,kRequest:sut,kFourOhFour:out,kState:nr,kOptions:jB,kPluginNameChain:Nv,kSchemaErrorFormatter:qB,kErrorHandler:pI,kKeepAliveConnections:BB,kChildLoggerFactory:zB,kGenReqId:VB,kErrorHandlerAlreadySet:hI,kHandlerTimeout:aut}=Ar(),{createServer:cut}=qre(),kv=_R(),mI=TR(),lut=wR(),gf=SE(),_f=kF(),Ume=A2(),{Hooks:uut,hookRunnerApplication:Fme,supportedHooks:HB}=Ol(),{createChildLogger:jme,defaultChildLoggerFactory:dut,createLogger:fut}=hE(),qme=Z2(),{getGenReqId:Bme,reqIdGenFactory:Yme}=Mx(),{buildRouting:put,validateBodyLimitOption:hut,buildRouterOptions:mut}=Hhe(),gut=Xhe(),Kme=eme(),_ut=lme(),{appendStackTrace:yut,AVVIO_ERRORS_MAP:zme,...yf}=Ur(),Sut=eU(),{defaultInitOptions:pi}=Kme,{FST_ERR_ASYNC_CONSTRAINT:Eut,FST_ERR_BAD_URL:vut,FST_ERR_OPTIONS_NOT_OBJ:but,FST_ERR_QSP_NOT_FN:Tut,FST_ERR_SCHEMA_CONTROLLER_BUCKET_OPT_NOT_FN:wut,FST_ERR_AJV_CUSTOM_OPTIONS_OPT_NOT_OBJ:Aut,FST_ERR_AJV_CUSTOM_OPTIONS_OPT_NOT_ARR:Rut,FST_ERR_INSTANCE_ALREADY_LISTENING:xut,FST_ERR_REOPENED_CLOSE_SERVER:Iut,FST_ERR_ROUTE_REWRITE_NOT_STR:Out,FST_ERR_SCHEMA_ERROR_FORMATTER_NOT_FN:Vme,FST_ERR_ERROR_HANDLER_NOT_FN:Put,FST_ERR_ERROR_HANDLER_ALREADY_SET:Cut,FST_ERR_ROUTE_METHOD_INVALID:Nut}=yf,{buildErrorHandler:Hme}=gE(),{FSTWRN004:kut}=xh(),Gme=Xlt.channel("fastify.initialization");function GB(t){let{options:e,genReqId:r,disableRequestLogging:n,hasLogger:i,initialConfig:s}=$ut(t,b,L),o=put(e.routerOptions),a=gut(e),c=oe(o,e),{server:l,listen:u,forceCloseConnections:d,serverHasCloseAllConnections:f,serverHasCloseHttp2Sessions:p,keepAliveConnections:h}=cut(e,c),m=kv.setupResponseListeners,_=Ume.buildSchemaController(null,e.schemaController),y={[nr]:{listening:!1,closing:!1,started:!1,ready:!1,booting:!1,aborted:!1,readyResolver:null},[BB]:h,[mf]:{bodyless:new Set(["GET","HEAD","TRACE"]),bodywith:new Set(["DELETE","OPTIONS","PATCH","PUT","POST"])},[jB]:e,[UB]:[],[Lme]:[],[Qlt]:e.bodyLimit,[aut]:e.handlerTimeout,[Dme]:"",[eut]:"",[tut]:null,[FB]:new uut,[Xl]:_,[qB]:null,[pI]:Hme(),[hI]:!1,[zB]:e.childLoggerFactory||dut,[Mme]:null,[nut]:new _f(e.bodyLimit,e.onProtoPoisoning||pi.onProtoPoisoning,e.onConstructorPoisoning||pi.onConstructorPoisoning),[iut]:kv.buildReply(kv),[sut]:mI.buildRequest(mI,e.trustProxy),[out]:a,[qme.kRegisteredPlugins]:[],[Nv]:["fastify"],[Cv]:null,[VB]:r,routing:c,delete:function(U,ne,F){return o.prepareRoute.call(this,{method:"DELETE",url:U,options:ne,handler:F})},get:function(U,ne,F){return o.prepareRoute.call(this,{method:"GET",url:U,options:ne,handler:F})},head:function(U,ne,F){return o.prepareRoute.call(this,{method:"HEAD",url:U,options:ne,handler:F})},trace:function(U,ne,F){return o.prepareRoute.call(this,{method:"TRACE",url:U,options:ne,handler:F})},patch:function(U,ne,F){return o.prepareRoute.call(this,{method:"PATCH",url:U,options:ne,handler:F})},post:function(U,ne,F){return o.prepareRoute.call(this,{method:"POST",url:U,options:ne,handler:F})},put:function(U,ne,F){return o.prepareRoute.call(this,{method:"PUT",url:U,options:ne,handler:F})},options:function(U,ne,F){return o.prepareRoute.call(this,{method:"OPTIONS",url:U,options:ne,handler:F})},all:function(U,ne,F){return o.prepareRoute.call(this,{method:this.supportedMethods,url:U,options:ne,handler:F})},route:function(U){return o.route.call(this,{options:U})},hasRoute:function(U){return o.hasRoute.call(this,{options:U})},findRoute:function(U){return o.findRoute(U)},log:e.logger,withTypeProvider:R,addHook:O,addSchema:A,getSchema:_.getSchema.bind(_),getSchemas:_.getSchemas.bind(_),setValidatorCompiler:P,setSerializerCompiler:j,setSchemaController:V,setReplySerializer:de,setSchemaErrorFormatter:N,setGenReqId:Ee,addContentTypeParser:_f.helpers.addContentTypeParser,hasContentTypeParser:_f.helpers.hasContentTypeParser,getDefaultJsonParser:_f.defaultParsers.getDefaultJsonParser,defaultTextParser:_f.defaultParsers.defaultTextParser,removeContentTypeParser:_f.helpers.removeContentTypeParser,removeAllContentTypeParsers:_f.helpers.removeAllContentTypeParsers,register:null,after:null,ready:null,onClose:null,close:null,printPlugins:null,hasPlugin:function(k){return this[qme.kRegisteredPlugins].includes(k)||this[Nv].includes(k)},listen:u,server:l,addresses:function(){let k=this[Lme].map(U=>U.address());return k.push(this.server.address()),k.filter(U=>U)},decorate:gf.add,hasDecorator:gf.exist,decorateReply:gf.decorateReply,decorateRequest:gf.decorateRequest,hasRequestDecorator:gf.existRequest,hasReplyDecorator:gf.existReply,getDecorator:gf.getInstanceDecorator,addHttpMethod:he,inject:I,printRoutes:$e,setNotFoundHandler:w,setErrorHandler:Te,setChildLoggerFactory:Ie,initialConfig:s,addConstraintStrategy:o.addConstraintStrategy.bind(o),hasConstraintStrategy:o.hasConstraintStrategy.bind(o)};Object.defineProperties(y,{listeningOrigin:{get(){let k=this.addresses().slice(-1).pop();if(typeof k=="string")return k;let U=k.family==="IPv6"?`[${k.address}]`:k.address;return`${this[jB].https?"https":"http"}://${U}:${k.port}`}},pluginName:{configurable:!0,get(){return this[Nv].length>1?this[Nv].join(" -> "):this[Nv][0]}},prefix:{configurable:!0,get(){return this[Dme]}},validatorCompiler:{configurable:!0,get(){return this[Xl].getValidatorCompiler()}},serializerCompiler:{configurable:!0,get(){return this[Xl].getSerializerCompiler()}},childLoggerFactory:{configurable:!0,get(){return this[zB]}},version:{configurable:!0,get(){return Jlt}},errorHandler:{configurable:!0,get(){return this[pI].func}},genReqId:{configurable:!0,get(){return this[VB]}},supportedMethods:{configurable:!1,get(){return[...this[mf].bodyless,...this[mf].bodywith]}}}),e.schemaErrorFormatter&&(Wme(e.schemaErrorFormatter),y[qB]=e.schemaErrorFormatter.bind(y));let v=Number(e.pluginTimeout),S=Zlt(y,{autostart:!1,timeout:isNaN(v)===!1?v:pi.pluginTimeout,expose:{use:"register"}});S.override=_ut,S.on("start",()=>y[nr].started=!0),y[Cv]=y.ready,y.ready=x,y.printPlugins=S.prettyPrint.bind(S),S.once("preReady",()=>{y.onClose((k,U)=>{y[nr].closing=!0,o.closeRoutes(),Fme("preClose",y[Cv],y,function(){if(y[nr].listening){if(d==="idle")k.server.closeIdleConnections();else if(f&&d)k.server.closeAllConnections();else if(d===!0)for(let ne of y[BB])ne.destroy(),y[BB].delete(ne)}p&&k.server.closeHttp2Sessions(),!e.serverFactory||y[nr].listening?k.server.close(function(ne){ne&&ne.code!=="ERR_SERVER_NOT_RUNNING"?U(null):U()}):process.nextTick(U,null)})})});let g=new lut({server:y,config:{}});return y.setNotFoundHandler(),a.arrange404(y),o.setup(e,{avvio:S,fourOhFour:a,hasLogger:i,setupResponseListeners:m,throwIfAlreadyStarted:T,keepAliveConnections:h}),l.on("clientError",e.clientErrorHandler.bind(y)),Gme.hasSubscribers&&Gme.publish({fastify:y}),"asyncDispose"in Symbol&&(y[Symbol.asyncDispose]=function(){return y.close()}),y;function T(k){if(y[nr].started)throw new xut(k)}function I(k,U){if(Pv===void 0&&(Pv=$me()),y[nr].started){if(y[nr].closing){let ne=new Iut;if(U){U(ne);return}else return Promise.reject(ne)}return Pv(c,k,U)}if(U)this.ready(ne=>{ne?U(ne,null):Pv(c,k,U)});else return Pv((ne,F)=>{this.ready(function(se){if(se){F.emit("error",se);return}c(ne,F)})},k)}function x(k){if(this[nr].readyResolver!==null){if(k!=null){this[nr].readyResolver.promise.then(()=>k(null,y),k);return}return this[nr].readyResolver.promise}if(process.nextTick(U),this[nr].readyResolver=Sut.withResolvers(),k)this[nr].readyResolver.promise.then(()=>k(null,y),k);else return this[nr].readyResolver.promise;function U(){y[Cv]((F,se)=>{F||y[nr].started||y[nr].ready||y[nr].booting?ne(F):(y[nr].booting=!0,Fme("onReady",y[Cv],y,ne)),se()})}function ne(F){if(F=F!=null&&zme[F.code]!=null?yut(F,new zme[F.code](F.message)):F,F)return y[nr].readyResolver.reject(F);y[nr].readyResolver.resolve(y),y[nr].booting=!1,y[nr].ready=!0,y[nr].readyResolver=null}}function R(){return this}function O(k,U){if(T('Cannot call "addHook"!'),U==null)throw new yf.FST_ERR_HOOK_INVALID_HANDLER(k,U);if(k==="onSend"||k==="preSerialization"||k==="onError"||k==="preParsing"){if(U.constructor.name==="AsyncFunction"&&U.length===4)throw new yf.FST_ERR_HOOK_INVALID_ASYNC_HANDLER}else if(k==="onReady"||k==="onListen"){if(U.constructor.name==="AsyncFunction"&&U.length!==0)throw new yf.FST_ERR_HOOK_INVALID_ASYNC_HANDLER}else if(k==="onRequestAbort"){if(U.constructor.name==="AsyncFunction"&&U.length!==1)throw new yf.FST_ERR_HOOK_INVALID_ASYNC_HANDLER}else if(U.constructor.name==="AsyncFunction"&&U.length===3)throw new yf.FST_ERR_HOOK_INVALID_ASYNC_HANDLER;return k==="onClose"?this.onClose(U.bind(this)):k==="onReady"||k==="onListen"||k==="onRoute"?this[FB].add(k,U):this.after((F,se)=>{try{ne.call(this,k,U),se(F)}catch(M){se(M)}}),this;function ne(F,se){this[FB].add(F,se),this[UB].forEach(M=>ne.call(M,F,se))}}function A(k){return T('Cannot call "addSchema"!'),this[Xl].add(k),this[UB].forEach(U=>U.addSchema(k)),this}function b(k,U){k.headers["accept-version"]!==void 0&&(k.headers[rut]=k.headers["accept-version"],k.headers["accept-version"]=void 0),a.router.lookup(k,U)}function L(k,U,ne){if(e.frameworkErrors){let se=Bme(g.server,U),M=jme(g,e.logger,U,se),D=new mI(se,null,U,null,M,g),B=new kv(ne,D,M);return(typeof n=="function"?n(U):n)===!1&&M.info({req:D},"incoming request"),e.frameworkErrors(new vut(k),D,B)}let F=JSON.stringify({error:"Bad Request",code:"FST_ERR_BAD_URL",message:`'${k}' is not a valid url component`,statusCode:400});ne.writeHead(400,{"Content-Type":"application/json","Content-Length":Buffer.byteLength(F)}),ne.end(F)}function C(k,U,ne){if(k!==!1)return function(se){if(se){if(e.frameworkErrors){let D=Bme(g.server,U),B=jme(g,e.logger,U,D),J=new mI(D,null,U,null,B,g),H=new kv(ne,J,B);return(typeof n=="function"?n(U):n)===!1&&B.info({req:J},"incoming request"),e.frameworkErrors(new Eut,J,H)}let M='{"error":"Internal Server Error","message":"Unexpected error from async constraint","statusCode":500}';ne.writeHead(500,{"Content-Type":"application/json","Content-Length":M.length}),ne.end(M)}}}function w(k,U){return T('Cannot call "setNotFoundHandler"!'),a.setNotFoundHandler.call(this,k,U,S,o.routeHandler),this}function P(k){return T('Cannot call "setValidatorCompiler"!'),this[Xl].setValidatorCompiler(k),this}function N(k){return T('Cannot call "setSchemaErrorFormatter"!'),Wme(k),this[qB]=k.bind(this),this}function j(k){return T('Cannot call "setSerializerCompiler"!'),this[Xl].setSerializerCompiler(k),this}function V(k){T('Cannot call "setSchemaController"!');let U=this[Xl],ne=Ume.buildSchemaController(U,Object.assign({},U.opts,k));return this[Xl]=ne,this.getSchema=ne.getSchema.bind(ne),this.getSchemas=ne.getSchemas.bind(ne),this}function de(k){return T('Cannot call "setReplySerializer"!'),this[Mme]=k,this}function Te(k){if(T('Cannot call "setErrorHandler"!'),typeof k!="function")throw new Put;if(!e.allowErrorHandlerOverride&&this[hI])throw new Cut;return this[hI]&&kut("To disable this behavior, set 'allowErrorHandlerOverride' to false or ignore this message. For more information, visit: https://fastify.dev/docs/latest/Reference/Server/#allowerrorhandleroverride"),this[hI]=!0,this[pI]=Hme(this[pI],k.bind(this)),this}function Ie(k){return T('Cannot call "setChildLoggerFactory"!'),this[zB]=k,this}function $e(k={}){return k.includeMeta=k.includeHooks?k.includeMeta?HB.concat(k.includeMeta):HB:k.includeMeta,o.printRoutes(k)}function oe(k,{rewriteUrl:U,logger:ne}){let F;return function(M,D){if(F===void 0&&(F=k.isAsyncConstraint()),U){M.originalUrl=M.url;let B=U.call(y,M);if(typeof B=="string")M.url=B;else{let J=new Out(M.url,typeof B);M.destroy(J)}}k.routing(M,D,C(F,M,D))}}function Ee(k){return T('Cannot call "setGenReqId"!'),this[VB]=Yme(this[jB].requestIdHeader,k),this}function he(k,{hasBody:U=!1}={}){if(typeof k!="string"||gI.METHODS.indexOf(k)===-1)throw new Nut;U===!0?(this[mf].bodywith.add(k),this[mf].bodyless.delete(k)):(this[mf].bodywith.delete(k),this[mf].bodyless.add(k));let ne=k.toLowerCase();return this.hasDecorator(ne)||this.decorate(ne,function(F,se,M){return o.prepareRoute.call(this,{method:k,url:F,options:se,handler:M})}),this}}function $ut(t,e,r){if(t&&typeof t!="object")throw new but;if(t=Object.assign({},t),t.querystringParser&&typeof t.querystringParser!="function"||t.routerOptions?.querystringParser&&typeof t.routerOptions.querystringParser!="function")throw new Tut(typeof(t.querystringParser??t.routerOptions.querystringParser));if(t.schemaController&&t.schemaController.bucket&&typeof t.schemaController.bucket!="function")throw new wut(typeof t.schemaController.bucket);hut(t.bodyLimit);let n=typeof t.requestIdHeader=="string"&&t.requestIdHeader.length!==0?t.requestIdHeader.toLowerCase():t.requestIdHeader===!0&&"request-id",i=Yme(n,t.genReqId),s=t.requestIdLogLabel||"reqId";t.bodyLimit=t.bodyLimit||pi.bodyLimit;let o=t.disableRequestLogging||!1,a=Object.assign({customOptions:{},plugins:[]},t.ajv);if(!a.customOptions||Object.prototype.toString.call(a.customOptions)!=="[object Object]")throw new Aut(typeof a.customOptions);if(!a.plugins||!Array.isArray(a.plugins))throw new Rut(typeof a.plugins);let{logger:c,hasLogger:l}=fut(t);t.connectionTimeout=t.connectionTimeout||pi.connectionTimeout,t.keepAliveTimeout=t.keepAliveTimeout||pi.keepAliveTimeout,t.maxRequestsPerSocket=t.maxRequestsPerSocket||pi.maxRequestsPerSocket,t.requestTimeout=t.requestTimeout||pi.requestTimeout,t.logger=c,t.requestIdHeader=n,t.requestIdLogLabel=s,t.disableRequestLogging=o,t.ajv=a,t.clientErrorHandler=t.clientErrorHandler||Dut,t.allowErrorHandlerOverride=t.allowErrorHandlerOverride??pi.allowErrorHandlerOverride;let u=Kme(t);return t.exposeHeadRoutes=u.exposeHeadRoutes,t.http2SessionTimeout=u.http2SessionTimeout,t.routerOptions=mut(t,{defaultRoute:e,onBadUrl:r,ignoreTrailingSlash:pi.ignoreTrailingSlash,ignoreDuplicateSlashes:pi.ignoreDuplicateSlashes,maxParamLength:pi.maxParamLength,allowUnsafeRegex:pi.allowUnsafeRegex,buildPrettyMeta:Lut,useSemicolonDelimiter:pi.useSemicolonDelimiter}),{options:t,genReqId:i,disableRequestLogging:o,hasLogger:l,initialConfig:u}}function Lut(t){let e={};return["errorHandler","logLevel","logSerializers"].concat(HB).forEach(n=>{e[n]=t.store[n]}),Object.assign({},e)}function Dut(t,e){if(t.code==="ECONNRESET"||e.destroyed)return;let r,n,i,s;t.code==="ERR_HTTP_REQUEST_TIMEOUT"?(n="408",i=gI.STATUS_CODES[n],r=`{"error":"${i}","message":"Client Timeout","statusCode":408}`,s="timeout"):t.code==="HPE_HEADER_OVERFLOW"?(n="431",i=gI.STATUS_CODES[n],r=`{"error":"${i}","message":"Exceeded maximum allowed HTTP header size","statusCode":431}`,s="header_overflow"):(n="400",i=gI.STATUS_CODES[n],r=`{"error":"${i}","message":"Client Error","statusCode":400}`,s="error"),this.log.trace({err:t},`client ${s}`),e.writable&&e.write(`HTTP/1.1 ${n} ${i}\r
368
+ `,yield wm.encode(u),l.stream?yield*l.stream():yield l,yield s}yield wm.encode(`--${e}--`)}return{stream:vlt.from(o()),contentType:`multipart/form-data; boundary=${e}`}}IB.exports.isFormDataLike=blt;IB.exports.formDataToStream=Tlt});var Tme=E((Z8t,cI)=>{"use strict";var{Readable:vme,addAbortSignal:wlt}=W("stream"),PB=W("util"),Alt=hme(),Rlt=W("assert"),{createDeprecation:xlt}=gme(),Ilt=Sme(),{isFormDataLike:Olt,formDataToStream:Plt}=Eme(),{EventEmitter:Clt}=W("events"),Nlt=xlt({name:"FastifyDeprecationLightMyRequest",code:"FST_LIGHTMYREQUEST_DEP01",message:'You are accessing "request.connection", use "request.socket" instead.'});function klt(t){return t.port?t.host:t.hostname+(t.protocol==="https:"?":443":":80")}var OB=class extends Clt{constructor(e){super(),this.remoteAddress=e}};function bme(t){return new e(this);function e(r){Jl.call(r,{...t,Request:void 0}),Object.assign(this,r);for(let n of Object.keys(Jl.prototype))this.constructor.prototype[n]=Jl.prototype[n];return PB.inherits(this.constructor,t.Request),this}}function Jl(t){vme.call(this,{autoDestroy:!1});let e=Ilt(t.url||t.path,t.query);this.url=e.pathname+e.search,this.aborted=!1,this.httpVersionMajor=1,this.httpVersionMinor=1,this.httpVersion="1.1",this.method=t.method?t.method.toUpperCase():"GET",this.headers={},this.rawHeaders=[];let r=t.headers||{};for(let o in r){let a=o.toLowerCase();if((a==="user-agent"||a==="content-type")&&r[o]===void 0){this.headers[a]=void 0;continue}let c=r[o];Rlt(c!==void 0,'invalid value "undefined" for header '+o),this.headers[a]=""+c}if("user-agent"in this.headers||(this.headers["user-agent"]="lightMyRequest"),this.headers.host=this.headers.host||t.authority||klt(e),t.cookies){let{cookies:o}=t,a=Object.keys(o).map(c=>Alt.serialize(c,o[c]));this.headers.cookie&&a.unshift(this.headers.cookie),this.headers.cookie=a.join("; ")}this.socket=new OB(t.remoteAddress||"127.0.0.1"),Object.defineProperty(this,"connection",{get(){return Nlt(),this.socket},configurable:!0});let n=t.payload||t.body||null,i=n&&typeof n.resume=="function";if(Olt(n)){let o=Plt(n);n=o.stream,i=!0,this.headers["content-type"]=o.contentType,this.headers["transfer-encoding"]="chunked"}n&&typeof n!="string"&&!i&&!Buffer.isBuffer(n)&&(n=JSON.stringify(n),"content-type"in this.headers||(this.headers["content-type"]="application/json")),n&&!i&&!Object.hasOwn(this.headers,"content-length")&&(this.headers["content-length"]=(Buffer.isBuffer(n)?n.length:Buffer.byteLength(n)).toString());for(let o of Object.keys(this.headers))this.rawHeaders.push(o,this.headers[o]);this._lightMyRequest={payload:n,isDone:!1,simulate:t.simulate||{},payloadAsStream:t.payloadAsStream,signal:t.signal};let s=t.signal;s&&wlt(s,this);{let o=this._lightMyRequest.payload;o?._readableState?(this._read=$lt,o.on("error",a=>{this.destroy(a)}),o.on("end",()=>{this.push(null)})):this._read=Llt}return this}function $lt(){let t=this._lightMyRequest.payload,e=!0,r=!1,n;for(;e&&(n=t.read());)r=!0,e=this.push(n);e&&!r&&this._lightMyRequest.payload.once("readable",this._read.bind(this))}function Llt(){setImmediate(()=>{if(this._lightMyRequest.isDone){this._lightMyRequest.simulate.end!==!1&&this.push(null);return}this._lightMyRequest.isDone=!0,this._lightMyRequest.payload&&(this._lightMyRequest.simulate.split?(this.push(this._lightMyRequest.payload.slice(0,1)),this.push(this._lightMyRequest.payload.slice(1))):this.push(this._lightMyRequest.payload)),this._lightMyRequest.simulate.error&&this.emit("error",new Error("Simulated")),this._lightMyRequest.simulate.close&&this.emit("close"),this._lightMyRequest.simulate.end!==!1&&this.push(null)})}PB.inherits(Jl,vme);PB.inherits(bme,Jl);Jl.prototype.destroy=function(t){this.destroyed||this._lightMyRequest.isDone||(this.destroyed=!0,t&&(this._error=!0,process.nextTick(()=>this.emit("error",t))),process.nextTick(()=>this.emit("close")))};cI.exports=Jl;cI.exports.Request=Jl;cI.exports.CustomRequest=bme});var Ame=E((X8t,Rv)=>{"use strict";var lI={decodeValues:!0,map:!1,silent:!1};function CB(t){return typeof t!="string"||t in{}}function NB(){return Object.create(null)}function kB(t){return typeof t=="string"&&!!t.trim()}function $B(t,e){var r=t.split(";").filter(kB),n=r.shift(),i=Dlt(n),s=i.name,o=i.value;if(e=e?Object.assign({},lI,e):lI,CB(s))return null;try{o=e.decodeValues?decodeURIComponent(o):o}catch(c){console.error("set-cookie-parser: failed to decode cookie value. Set options.decodeValues=false to disable decoding.",c)}var a=NB();return a.name=s,a.value=o,r.forEach(function(c){var l=c.split("="),u=l.shift().trimLeft().toLowerCase();if(!CB(u)){var d=l.join("=");if(u==="expires")a.expires=new Date(d);else if(u==="max-age"){var f=parseInt(d,10);Number.isNaN(f)||(a.maxAge=f)}else u==="secure"?a.secure=!0:u==="httponly"?a.httpOnly=!0:u==="samesite"?a.sameSite=d:u==="partitioned"?a.partitioned=!0:u&&(a[u]=d)}}),a}function Dlt(t){var e="",r="",n=t.split("=");return n.length>1?(e=n.shift(),r=n.join("=")):r=t,{name:e,value:r}}function wme(t,e){if(e=e?Object.assign({},lI,e):lI,!t)return e.map?NB():[];if(t.headers)if(typeof t.headers.getSetCookie=="function")t=t.headers.getSetCookie();else if(t.headers["set-cookie"])t=t.headers["set-cookie"];else{var r=t.headers[Object.keys(t.headers).find(function(i){return i.toLowerCase()==="set-cookie"})];!r&&t.headers.cookie&&!e.silent&&console.warn("Warning: set-cookie-parser appears to have been called on a request object. It is designed to parse Set-Cookie headers from responses, not Cookie headers from requests. Set the option {silent: true} to suppress this warning."),t=r}if(Array.isArray(t)||(t=[t]),e.map){var n=NB();return t.filter(kB).reduce(function(i,s){var o=$B(s,e);return o&&!CB(o.name)&&(i[o.name]=o),i},n)}else return t.filter(kB).map(function(i){return $B(i,e)}).filter(Boolean)}function Mlt(t){if(Array.isArray(t))return t;if(typeof t!="string")return[];var e=[],r=0,n,i,s,o,a;function c(){for(;r<t.length&&/\s/.test(t.charAt(r));)r+=1;return r<t.length}function l(){return i=t.charAt(r),i!=="="&&i!==";"&&i!==","}for(;r<t.length;){for(n=r,a=!1;c();)if(i=t.charAt(r),i===","){for(s=r,r+=1,c(),o=r;r<t.length&&l();)r+=1;r<t.length&&t.charAt(r)==="="?(a=!0,r=o,e.push(t.substring(n,s)),n=r):r=s+1}else r+=1;(!a||r>=t.length)&&e.push(t.substring(n,t.length))}return e}Rv.exports=wme;Rv.exports.parse=wme;Rv.exports.parseString=$B;Rv.exports.splitCookiesString=Mlt});var Pme=E((Q8t,Ome)=>{"use strict";var xv=W("http"),{Writable:Ult,Readable:Rme,addAbortSignal:Flt}=W("stream"),jlt=W("util"),qlt=Ame();function Zl(t,e,r){if(xv.ServerResponse.call(this,t),t._lightMyRequest?.payloadAsStream){let a=this.emit.bind(this,"drain");this._lightMyRequest={headers:null,trailers:{},stream:new Rme({read:a})};let c=t._lightMyRequest.signal;c&&Flt(c,this._lightMyRequest.stream)}else this._lightMyRequest={headers:null,trailers:{},payloadChunks:[]};this.setHeader("foo","bar"),this.removeHeader("foo"),this.assignSocket(Blt()),this._promiseCallback=typeof r=="function";let n=!1,i=a=>{if(!n){if(n=!0,this._promiseCallback)return process.nextTick(()=>e(a));process.nextTick(()=>e(null,a))}};this._lightMyRequest.onEndSuccess=i;let s=!1,o=a=>{if(n){this._lightMyRequest.stream&&!s&&(a||(a=new Error("response destroyed before completion"),a.code="LIGHT_ECONNRESET"),this._lightMyRequest.stream.destroy(a),this._lightMyRequest.stream.on("error",()=>{}));return}if(n=!0,a||(a=new Error("response destroyed before completion"),a.code="LIGHT_ECONNRESET"),this._promiseCallback)return process.nextTick(()=>r(a));process.nextTick(()=>e(a,null))};this._lightMyRequest.stream?this.once("finish",()=>{s=!0,this._lightMyRequest.stream.push(null)}):this.once("finish",()=>{let a=xme(this);a.raw.req=t,i(a)}),this.connection.once("error",o),this.once("error",o),this.once("close",o)}jlt.inherits(Zl,xv.ServerResponse);Zl.prototype.setTimeout=function(t,e){return this.timeoutHandle=setTimeout(()=>{this.emit("timeout")},t),this.on("timeout",e),this};Zl.prototype.writeHead=function(){let t=xv.ServerResponse.prototype.writeHead.apply(this,arguments);return Ime(this),this._lightMyRequest.stream&&this._lightMyRequest.onEndSuccess(xme(this)),t};Zl.prototype.write=function(t,e,r){return this.timeoutHandle&&clearTimeout(this.timeoutHandle),xv.ServerResponse.prototype.write.call(this,t,e,r),this._lightMyRequest.stream?this._lightMyRequest.stream.push(Buffer.from(t,e)):(this._lightMyRequest.payloadChunks.push(Buffer.from(t,e)),!0)};Zl.prototype.end=function(t,e,r){t&&this.write(t,e),xv.ServerResponse.prototype.end.call(this,r),this.emit("finish"),this.destroy()};Zl.prototype.destroy=function(t){this.destroyed||(this.destroyed=!0,t&&process.nextTick(()=>this.emit("error",t)),process.nextTick(()=>this.emit("close")))};Zl.prototype.addTrailers=function(t){for(let e in t)this._lightMyRequest.trailers[e.toLowerCase().trim()]=t[e].toString().trim()};function xme(t){t._lightMyRequest.headers===null&&Ime(t),zlt(t);let e={raw:{res:t},headers:t._lightMyRequest.headers,statusCode:t.statusCode,statusMessage:t.statusMessage,trailers:{},get cookies(){return qlt.parse(this)}};if(e.trailers=t._lightMyRequest.trailers,t._lightMyRequest.payloadChunks){let r=Buffer.concat(t._lightMyRequest.payloadChunks);e.rawPayload=r,e.payload=r.toString(),e.body=e.payload,e.json=function(){return JSON.parse(e.payload)}}else e.json=function(){throw new Error("Response payload is not available with payloadAsStream: true")};return e.stream=function(){return t._lightMyRequest.stream?t._lightMyRequest.stream:Rme.from(t._lightMyRequest.payloadChunks)},e}function Blt(){return new Ult({write(t,e,r){setImmediate(r)}})}function zlt(t){let e=t._lightMyRequest.headers;for(let r of Object.keys(e)){let n=e[r];Array.isArray(n)?e[r]=n.map(i=>""+i):e[r]=""+n}}function Ime(t){t._lightMyRequest.headers=Object.assign({},t.getHeaders()),["Date","Connection","Transfer-Encoding"].forEach(e=>{let r=new RegExp("\\r\\n"+e+": ([^\\r]*)\\r\\n"),n=t._header?.match(r);n&&(t._lightMyRequest.headers[e.toLowerCase()]=n[1])})}Ome.exports=Zl});var Cme=E((e9t,LB)=>{"use strict";LB.exports=Rr;LB.exports.default=Rr;var Vlt={type:"object",properties:{url:{oneOf:[{type:"string"},{type:"object",properties:{protocol:{type:"string"},hostname:{type:"string"},pathname:{type:"string"}},additionalProperties:!0,required:["pathname"]}]},path:{oneOf:[{type:"string"},{type:"object",properties:{protocol:{type:"string"},hostname:{type:"string"},pathname:{type:"string"}},additionalProperties:!0,required:["pathname"]}]},cookies:{type:"object",additionalProperties:!0},headers:{type:"object",additionalProperties:!0},query:{anyOf:[{type:"object",additionalProperties:!0},{type:"string"}]},simulate:{type:"object",properties:{end:{type:"boolean"},split:{type:"boolean"},error:{type:"boolean"},close:{type:"boolean"}}},authority:{type:"string"},remoteAddress:{type:"string"},method:{type:"string",enum:["ACL","BIND","CHECKOUT","CONNECT","COPY","DELETE","GET","HEAD","LINK","LOCK","M-SEARCH","MERGE","MKACTIVITY","MKCALENDAR","MKCOL","MOVE","NOTIFY","OPTIONS","PATCH","POST","PROPFIND","PROPPATCH","PURGE","PUT","QUERY","REBIND","REPORT","SEARCH","SOURCE","SUBSCRIBE","TRACE","UNBIND","UNLINK","UNLOCK","UNSUBSCRIBE","acl","bind","checkout","connect","copy","delete","get","head","link","lock","m-search","merge","mkactivity","mkcalendar","mkcol","move","notify","options","patch","post","propfind","proppatch","purge","put","query","rebind","report","search","source","subscribe","trace","unbind","unlink","unlock","unsubscribe"]},validate:{type:"boolean"}},additionalProperties:!0,oneOf:[{required:["url"]},{required:["path"]}]};function Rr(t,{instancePath:e="",parentData:r,parentDataProperty:n,rootData:i=t}={}){let s=null,o=0,a=o,c=!1,l=null,u=o;if(t&&typeof t=="object"&&!Array.isArray(t)){let g;if(t.url===void 0&&(g="url")){let T={instancePath:e,schemaPath:"#/oneOf/0/required",keyword:"required",params:{missingProperty:g},message:"must have required property '"+g+"'"};s===null?s=[T]:s.push(T),o++}}var f=u===o;f&&(c=!0,l=0);let d=o;if(t&&typeof t=="object"&&!Array.isArray(t)){let g;if(t.path===void 0&&(g="path")){let T={instancePath:e,schemaPath:"#/oneOf/1/required",keyword:"required",params:{missingProperty:g},message:"must have required property '"+g+"'"};s===null?s=[T]:s.push(T),o++}}var f=d===o;if(f&&c?(c=!1,l=[l,1]):f&&(c=!0,l=1),c)o=a,s!==null&&(a?s.length=a:s=null);else{let g={instancePath:e,schemaPath:"#/oneOf",keyword:"oneOf",params:{passingSchemas:l},message:"must match exactly one schema in oneOf"};return s===null?s=[g]:s.push(g),o++,Rr.errors=s,!1}if(o===0)if(t&&typeof t=="object"&&!Array.isArray(t)){if(t.url!==void 0){let g=t.url,T=o,I=o,x=!1,R=null,O=o;if(typeof g!="string"){let b=typeof g,L;if(L===void 0)if(b=="number"||b=="boolean")L=""+g;else if(g===null)L="";else{let C={instancePath:e+"/url",schemaPath:"#/properties/url/oneOf/0/type",keyword:"type",params:{type:"string"},message:"must be string"};s===null?s=[C]:s.push(C),o++}L!==void 0&&(g=L,t!==void 0&&(t.url=L))}var h=O===o;h&&(x=!0,R=0);let A=o;if(o===A)if(g&&typeof g=="object"&&!Array.isArray(g)){let b;if(g.pathname===void 0&&(b="pathname")){let L={instancePath:e+"/url",schemaPath:"#/properties/url/oneOf/1/required",keyword:"required",params:{missingProperty:b},message:"must have required property '"+b+"'"};s===null?s=[L]:s.push(L),o++}else{if(g.protocol!==void 0){let L=g.protocol,C=o;if(typeof L!="string"){let w=typeof L,P;if(P===void 0)if(w=="number"||w=="boolean")P=""+L;else if(L===null)P="";else{let N={instancePath:e+"/url/protocol",schemaPath:"#/properties/url/oneOf/1/properties/protocol/type",keyword:"type",params:{type:"string"},message:"must be string"};s===null?s=[N]:s.push(N),o++}P!==void 0&&(L=P,g!==void 0&&(g.protocol=P))}var p=C===o}else var p=!0;if(p){if(g.hostname!==void 0){let L=g.hostname,C=o;if(typeof L!="string"){let P=typeof L,N;if(N===void 0)if(P=="number"||P=="boolean")N=""+L;else if(L===null)N="";else{let F={instancePath:e+"/url/hostname",schemaPath:"#/properties/url/oneOf/1/properties/hostname/type",keyword:"type",params:{type:"string"},message:"must be string"};s===null?s=[F]:s.push(F),o++}N!==void 0&&(L=N,g!==void 0&&(g.hostname=N))}var p=C===o}else var p=!0;if(p)if(g.pathname!==void 0){let L=g.pathname,C=o;if(typeof L!="string"){let P=typeof L,N;if(N===void 0)if(P=="number"||P=="boolean")N=""+L;else if(L===null)N="";else{let F={instancePath:e+"/url/pathname",schemaPath:"#/properties/url/oneOf/1/properties/pathname/type",keyword:"type",params:{type:"string"},message:"must be string"};s===null?s=[F]:s.push(F),o++}N!==void 0&&(L=N,g!==void 0&&(g.pathname=N))}var p=C===o}else var p=!0}}}else{let b={instancePath:e+"/url",schemaPath:"#/properties/url/oneOf/1/type",keyword:"type",params:{type:"object"},message:"must be object"};s===null?s=[b]:s.push(b),o++}var h=A===o;if(h&&x?(x=!1,R=[R,1]):h&&(x=!0,R=1),x)o=I,s!==null&&(I?s.length=I:s=null);else{let b={instancePath:e+"/url",schemaPath:"#/properties/url/oneOf",keyword:"oneOf",params:{passingSchemas:R},message:"must match exactly one schema in oneOf"};return s===null?s=[b]:s.push(b),o++,Rr.errors=s,!1}var m=T===o}else var m=!0;if(m){if(t.path!==void 0){let g=t.path,T=o,I=o,x=!1,R=null,O=o;if(typeof g!="string"){let L=typeof g,C;if(C===void 0)if(L=="number"||L=="boolean")C=""+g;else if(g===null)C="";else{let w={instancePath:e+"/path",schemaPath:"#/properties/path/oneOf/0/type",keyword:"type",params:{type:"string"},message:"must be string"};s===null?s=[w]:s.push(w),o++}C!==void 0&&(g=C,t!==void 0&&(t.path=C))}var y=O===o;y&&(x=!0,R=0);let A=o;if(o===A)if(g&&typeof g=="object"&&!Array.isArray(g)){let L;if(g.pathname===void 0&&(L="pathname")){let C={instancePath:e+"/path",schemaPath:"#/properties/path/oneOf/1/required",keyword:"required",params:{missingProperty:L},message:"must have required property '"+L+"'"};s===null?s=[C]:s.push(C),o++}else{if(g.protocol!==void 0){let C=g.protocol,w=o;if(typeof C!="string"){let P=typeof C,N;if(N===void 0)if(P=="number"||P=="boolean")N=""+C;else if(C===null)N="";else{let F={instancePath:e+"/path/protocol",schemaPath:"#/properties/path/oneOf/1/properties/protocol/type",keyword:"type",params:{type:"string"},message:"must be string"};s===null?s=[F]:s.push(F),o++}N!==void 0&&(C=N,g!==void 0&&(g.protocol=N))}var _=w===o}else var _=!0;if(_){if(g.hostname!==void 0){let C=g.hostname,w=o;if(typeof C!="string"){let N=typeof C,F;if(F===void 0)if(N=="number"||N=="boolean")F=""+C;else if(C===null)F="";else{let V={instancePath:e+"/path/hostname",schemaPath:"#/properties/path/oneOf/1/properties/hostname/type",keyword:"type",params:{type:"string"},message:"must be string"};s===null?s=[V]:s.push(V),o++}F!==void 0&&(C=F,g!==void 0&&(g.hostname=F))}var _=w===o}else var _=!0;if(_)if(g.pathname!==void 0){let C=g.pathname,w=o;if(typeof C!="string"){let N=typeof C,F;if(F===void 0)if(N=="number"||N=="boolean")F=""+C;else if(C===null)F="";else{let V={instancePath:e+"/path/pathname",schemaPath:"#/properties/path/oneOf/1/properties/pathname/type",keyword:"type",params:{type:"string"},message:"must be string"};s===null?s=[V]:s.push(V),o++}F!==void 0&&(C=F,g!==void 0&&(g.pathname=F))}var _=w===o}else var _=!0}}}else{let L={instancePath:e+"/path",schemaPath:"#/properties/path/oneOf/1/type",keyword:"type",params:{type:"object"},message:"must be object"};s===null?s=[L]:s.push(L),o++}var y=A===o;if(y&&x?(x=!1,R=[R,1]):y&&(x=!0,R=1),x)o=I,s!==null&&(I?s.length=I:s=null);else{let L={instancePath:e+"/path",schemaPath:"#/properties/path/oneOf",keyword:"oneOf",params:{passingSchemas:R},message:"must match exactly one schema in oneOf"};return s===null?s=[L]:s.push(L),o++,Rr.errors=s,!1}var m=T===o}else var m=!0;if(m){if(t.cookies!==void 0){let g=t.cookies,T=o;if(o===T&&!(g&&typeof g=="object"&&!Array.isArray(g)))return Rr.errors=[{instancePath:e+"/cookies",schemaPath:"#/properties/cookies/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;var m=T===o}else var m=!0;if(m){if(t.headers!==void 0){let g=t.headers,T=o;if(o===T&&!(g&&typeof g=="object"&&!Array.isArray(g)))return Rr.errors=[{instancePath:e+"/headers",schemaPath:"#/properties/headers/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;var m=T===o}else var m=!0;if(m){if(t.query!==void 0){let g=t.query,T=o,I=o,x=!1,R=o;if(o===R&&!(g&&typeof g=="object"&&!Array.isArray(g))){let A={instancePath:e+"/query",schemaPath:"#/properties/query/anyOf/0/type",keyword:"type",params:{type:"object"},message:"must be object"};s===null?s=[A]:s.push(A),o++}var v=R===o;if(x=x||v,!x){let A=o;if(typeof g!="string"){let L=typeof g,C;if(C===void 0)if(L=="number"||L=="boolean")C=""+g;else if(g===null)C="";else{let w={instancePath:e+"/query",schemaPath:"#/properties/query/anyOf/1/type",keyword:"type",params:{type:"string"},message:"must be string"};s===null?s=[w]:s.push(w),o++}C!==void 0&&(g=C,t!==void 0&&(t.query=C))}var v=A===o;x=x||v}if(x)o=I,s!==null&&(I?s.length=I:s=null);else{let A={instancePath:e+"/query",schemaPath:"#/properties/query/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf"};return s===null?s=[A]:s.push(A),o++,Rr.errors=s,!1}var m=T===o}else var m=!0;if(m){if(t.simulate!==void 0){let g=t.simulate,T=o;if(o===T)if(g&&typeof g=="object"&&!Array.isArray(g)){if(g.end!==void 0){let x=g.end,R=o;if(typeof x!="boolean"){let O;if(O===void 0)if(x==="false"||x===0||x===null)O=!1;else if(x==="true"||x===1)O=!0;else return Rr.errors=[{instancePath:e+"/simulate/end",schemaPath:"#/properties/simulate/properties/end/type",keyword:"type",params:{type:"boolean"},message:"must be boolean"}],!1;O!==void 0&&(x=O,g!==void 0&&(g.end=O))}var S=R===o}else var S=!0;if(S){if(g.split!==void 0){let x=g.split,R=o;if(typeof x!="boolean"){let A;if(A===void 0)if(x==="false"||x===0||x===null)A=!1;else if(x==="true"||x===1)A=!0;else return Rr.errors=[{instancePath:e+"/simulate/split",schemaPath:"#/properties/simulate/properties/split/type",keyword:"type",params:{type:"boolean"},message:"must be boolean"}],!1;A!==void 0&&(x=A,g!==void 0&&(g.split=A))}var S=R===o}else var S=!0;if(S){if(g.error!==void 0){let x=g.error,R=o;if(typeof x!="boolean"){let A;if(A===void 0)if(x==="false"||x===0||x===null)A=!1;else if(x==="true"||x===1)A=!0;else return Rr.errors=[{instancePath:e+"/simulate/error",schemaPath:"#/properties/simulate/properties/error/type",keyword:"type",params:{type:"boolean"},message:"must be boolean"}],!1;A!==void 0&&(x=A,g!==void 0&&(g.error=A))}var S=R===o}else var S=!0;if(S)if(g.close!==void 0){let x=g.close,R=o;if(typeof x!="boolean"){let A;if(A===void 0)if(x==="false"||x===0||x===null)A=!1;else if(x==="true"||x===1)A=!0;else return Rr.errors=[{instancePath:e+"/simulate/close",schemaPath:"#/properties/simulate/properties/close/type",keyword:"type",params:{type:"boolean"},message:"must be boolean"}],!1;A!==void 0&&(x=A,g!==void 0&&(g.close=A))}var S=R===o}else var S=!0}}}else return Rr.errors=[{instancePath:e+"/simulate",schemaPath:"#/properties/simulate/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;var m=T===o}else var m=!0;if(m){if(t.authority!==void 0){let g=t.authority,T=o;if(typeof g!="string"){let x=typeof g,R;if(R===void 0)if(x=="number"||x=="boolean")R=""+g;else if(g===null)R="";else return Rr.errors=[{instancePath:e+"/authority",schemaPath:"#/properties/authority/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;R!==void 0&&(g=R,t!==void 0&&(t.authority=R))}var m=T===o}else var m=!0;if(m){if(t.remoteAddress!==void 0){let g=t.remoteAddress,T=o;if(typeof g!="string"){let x=typeof g,R;if(R===void 0)if(x=="number"||x=="boolean")R=""+g;else if(g===null)R="";else return Rr.errors=[{instancePath:e+"/remoteAddress",schemaPath:"#/properties/remoteAddress/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;R!==void 0&&(g=R,t!==void 0&&(t.remoteAddress=R))}var m=T===o}else var m=!0;if(m){if(t.method!==void 0){let g=t.method,T=o;if(typeof g!="string"){let x=typeof g,R;if(R===void 0)if(x=="number"||x=="boolean")R=""+g;else if(g===null)R="";else return Rr.errors=[{instancePath:e+"/method",schemaPath:"#/properties/method/type",keyword:"type",params:{type:"string"},message:"must be string"}],!1;R!==void 0&&(g=R,t!==void 0&&(t.method=R))}if(!(g==="ACL"||g==="BIND"||g==="CHECKOUT"||g==="CONNECT"||g==="COPY"||g==="DELETE"||g==="GET"||g==="HEAD"||g==="LINK"||g==="LOCK"||g==="M-SEARCH"||g==="MERGE"||g==="MKACTIVITY"||g==="MKCALENDAR"||g==="MKCOL"||g==="MOVE"||g==="NOTIFY"||g==="OPTIONS"||g==="PATCH"||g==="POST"||g==="PROPFIND"||g==="PROPPATCH"||g==="PURGE"||g==="PUT"||g==="QUERY"||g==="REBIND"||g==="REPORT"||g==="SEARCH"||g==="SOURCE"||g==="SUBSCRIBE"||g==="TRACE"||g==="UNBIND"||g==="UNLINK"||g==="UNLOCK"||g==="UNSUBSCRIBE"||g==="acl"||g==="bind"||g==="checkout"||g==="connect"||g==="copy"||g==="delete"||g==="get"||g==="head"||g==="link"||g==="lock"||g==="m-search"||g==="merge"||g==="mkactivity"||g==="mkcalendar"||g==="mkcol"||g==="move"||g==="notify"||g==="options"||g==="patch"||g==="post"||g==="propfind"||g==="proppatch"||g==="purge"||g==="put"||g==="query"||g==="rebind"||g==="report"||g==="search"||g==="source"||g==="subscribe"||g==="trace"||g==="unbind"||g==="unlink"||g==="unlock"||g==="unsubscribe"))return Rr.errors=[{instancePath:e+"/method",schemaPath:"#/properties/method/enum",keyword:"enum",params:{allowedValues:Vlt.properties.method.enum},message:"must be equal to one of the allowed values"}],!1;var m=T===o}else var m=!0;if(m)if(t.validate!==void 0){let g=t.validate,T=o;if(typeof g!="boolean"){let x;if(x===void 0)if(g==="false"||g===0||g===null)x=!1;else if(g==="true"||g===1)x=!0;else return Rr.errors=[{instancePath:e+"/validate",schemaPath:"#/properties/validate/type",keyword:"type",params:{type:"boolean"},message:"must be boolean"}],!1;x!==void 0&&(g=x,t!==void 0&&(t.validate=x))}var m=T===o}else var m=!0}}}}}}}}}else return Rr.errors=[{instancePath:e,schemaPath:"#/type",keyword:"type",params:{type:"object"},message:"must be object"}],!1;return Rr.errors=s,o===0}});var $me=E((t9t,Ov)=>{"use strict";var Hlt=W("assert"),DB=Tme(),uI=Pme(),fI="The dispatch function has already been invoked",Nme=Cme();function MB(t,e,r){return r===void 0?new Iv(t,e):dI(t,e,r)}function Glt(t,e){let r=t._lightMyRequest.payload;if(!r||r._readableState||typeof r.resume!="function")return e();let n=[];r.on("data",i=>n.push(Buffer.from(i))),r.on("end",()=>{let i=Buffer.concat(n);return t.headers["content-length"]=t.headers["content-length"]||""+i.length,delete t.headers["transfer-encoding"],t._lightMyRequest.payload=i,e()}),r.resume()}function kme(t,e,r,n){return r.once("error",function(i){this.destroyed&&n.destroy(i)}),r.once("close",function(){this.destroyed&&!this._error&&n.destroy()}),Glt(r,()=>t.call(e,r,n))}function dI(t,e,r){if(e=typeof e=="string"?{url:e}:e,e.validate!==!1&&(Hlt(typeof t=="function","dispatchFunc should be a function"),!Nme(e)))throw new Error(Nme.errors.map(o=>o.message));let n=e.server||{},i=e.Request?DB.CustomRequest:DB;if(t.request&&t.request.app===t&&(Object.setPrototypeOf(Object.getPrototypeOf(t.request),i.prototype),Object.setPrototypeOf(Object.getPrototypeOf(t.response),uI.prototype)),typeof r=="function"){let s=new i(e),o=new uI(s,r);return kme(t,n,s,o)}else return new Promise((s,o)=>{let a=new i(e),c=new uI(a,s,o);kme(t,n,a,c)})}function Iv(t,e){typeof e=="string"?this.option={url:e}:this.option=Object.assign({},e),this.dispatch=t,this._hasInvoked=!1,this._promise=null,this.option.autoStart!==!1&&process.nextTick(()=>{this._hasInvoked||this.end()})}var Wlt=["delete","get","head","options","patch","post","put","trace"];Wlt.forEach(t=>{Iv.prototype[t]=function(e){if(this._hasInvoked===!0||this._promise)throw new Error(fI);return this.option.url=e,this.option.method=t.toUpperCase(),this}});var Ylt=["body","cookies","headers","payload","query"];Ylt.forEach(t=>{Iv.prototype[t]=function(e){if(this._hasInvoked===!0||this._promise)throw new Error(fI);return this.option[t]=e,this}});Iv.prototype.end=function(t){if(this._hasInvoked===!0||this._promise)throw new Error(fI);if(this._hasInvoked=!0,typeof t=="function")dI(this.dispatch,this.option,t);else return this._promise=dI(this.dispatch,this.option),this._promise};Object.getOwnPropertyNames(Promise.prototype).forEach(t=>{t!=="constructor"&&(Iv.prototype[t]=function(...e){if(!this._promise){if(this._hasInvoked===!0)throw new Error(fI);this._hasInvoked=!0,this._promise=dI(this.dispatch,this.option)}return this._promise[t](...e)})});function Klt(t){return t instanceof DB||t instanceof uI||t?.constructor?.name==="_CustomLMRRequest"}Ov.exports=MB;Ov.exports.default=MB;Ov.exports.inject=MB;Ov.exports.isInjection=Klt});var Jme=E((r9t,$v)=>{"use strict";var Jlt="5.8.5",Zlt=pre(),gI=W("http"),Xlt=W("diagnostics_channel"),Pv,{kAvvioBoot:Cv,kChildren:UB,kServerBindings:Lme,kBodyLimit:Qlt,kSupportedHTTPMethods:mf,kRoutePrefix:Dme,kLogLevel:eut,kLogSerializers:tut,kHooks:FB,kSchemaController:Xl,kRequestAcceptVersion:rut,kReplySerializerDefault:Mme,kContentTypeParser:nut,kReply:iut,kRequest:sut,kFourOhFour:out,kState:nr,kOptions:jB,kPluginNameChain:Nv,kSchemaErrorFormatter:qB,kErrorHandler:pI,kKeepAliveConnections:BB,kChildLoggerFactory:zB,kGenReqId:VB,kErrorHandlerAlreadySet:hI,kHandlerTimeout:aut}=Ar(),{createServer:cut}=qre(),kv=_R(),mI=TR(),lut=wR(),gf=SE(),_f=kF(),Ume=A2(),{Hooks:uut,hookRunnerApplication:Fme,supportedHooks:HB}=Ol(),{createChildLogger:jme,defaultChildLoggerFactory:dut,createLogger:fut}=hE(),qme=Z2(),{getGenReqId:Bme,reqIdGenFactory:Yme}=Mx(),{buildRouting:put,validateBodyLimitOption:hut,buildRouterOptions:mut}=Hhe(),gut=Xhe(),Kme=eme(),_ut=lme(),{appendStackTrace:yut,AVVIO_ERRORS_MAP:zme,...yf}=Ur(),Sut=eU(),{defaultInitOptions:pi}=Kme,{FST_ERR_ASYNC_CONSTRAINT:Eut,FST_ERR_BAD_URL:vut,FST_ERR_OPTIONS_NOT_OBJ:but,FST_ERR_QSP_NOT_FN:Tut,FST_ERR_SCHEMA_CONTROLLER_BUCKET_OPT_NOT_FN:wut,FST_ERR_AJV_CUSTOM_OPTIONS_OPT_NOT_OBJ:Aut,FST_ERR_AJV_CUSTOM_OPTIONS_OPT_NOT_ARR:Rut,FST_ERR_INSTANCE_ALREADY_LISTENING:xut,FST_ERR_REOPENED_CLOSE_SERVER:Iut,FST_ERR_ROUTE_REWRITE_NOT_STR:Out,FST_ERR_SCHEMA_ERROR_FORMATTER_NOT_FN:Vme,FST_ERR_ERROR_HANDLER_NOT_FN:Put,FST_ERR_ERROR_HANDLER_ALREADY_SET:Cut,FST_ERR_ROUTE_METHOD_INVALID:Nut}=yf,{buildErrorHandler:Hme}=gE(),{FSTWRN004:kut}=xh(),Gme=Xlt.channel("fastify.initialization");function GB(t){let{options:e,genReqId:r,disableRequestLogging:n,hasLogger:i,initialConfig:s}=$ut(t,b,L),o=put(e.routerOptions),a=gut(e),c=oe(o,e),{server:l,listen:u,forceCloseConnections:d,serverHasCloseAllConnections:f,serverHasCloseHttp2Sessions:p,keepAliveConnections:h}=cut(e,c),m=kv.setupResponseListeners,_=Ume.buildSchemaController(null,e.schemaController),y={[nr]:{listening:!1,closing:!1,started:!1,ready:!1,booting:!1,aborted:!1,readyResolver:null},[BB]:h,[mf]:{bodyless:new Set(["GET","HEAD","TRACE"]),bodywith:new Set(["DELETE","OPTIONS","PATCH","PUT","POST"])},[jB]:e,[UB]:[],[Lme]:[],[Qlt]:e.bodyLimit,[aut]:e.handlerTimeout,[Dme]:"",[eut]:"",[tut]:null,[FB]:new uut,[Xl]:_,[qB]:null,[pI]:Hme(),[hI]:!1,[zB]:e.childLoggerFactory||dut,[Mme]:null,[nut]:new _f(e.bodyLimit,e.onProtoPoisoning||pi.onProtoPoisoning,e.onConstructorPoisoning||pi.onConstructorPoisoning),[iut]:kv.buildReply(kv),[sut]:mI.buildRequest(mI,e.trustProxy),[out]:a,[qme.kRegisteredPlugins]:[],[Nv]:["fastify"],[Cv]:null,[VB]:r,routing:c,delete:function(U,ne,j){return o.prepareRoute.call(this,{method:"DELETE",url:U,options:ne,handler:j})},get:function(U,ne,j){return o.prepareRoute.call(this,{method:"GET",url:U,options:ne,handler:j})},head:function(U,ne,j){return o.prepareRoute.call(this,{method:"HEAD",url:U,options:ne,handler:j})},trace:function(U,ne,j){return o.prepareRoute.call(this,{method:"TRACE",url:U,options:ne,handler:j})},patch:function(U,ne,j){return o.prepareRoute.call(this,{method:"PATCH",url:U,options:ne,handler:j})},post:function(U,ne,j){return o.prepareRoute.call(this,{method:"POST",url:U,options:ne,handler:j})},put:function(U,ne,j){return o.prepareRoute.call(this,{method:"PUT",url:U,options:ne,handler:j})},options:function(U,ne,j){return o.prepareRoute.call(this,{method:"OPTIONS",url:U,options:ne,handler:j})},all:function(U,ne,j){return o.prepareRoute.call(this,{method:this.supportedMethods,url:U,options:ne,handler:j})},route:function(U){return o.route.call(this,{options:U})},hasRoute:function(U){return o.hasRoute.call(this,{options:U})},findRoute:function(U){return o.findRoute(U)},log:e.logger,withTypeProvider:R,addHook:O,addSchema:A,getSchema:_.getSchema.bind(_),getSchemas:_.getSchemas.bind(_),setValidatorCompiler:P,setSerializerCompiler:F,setSchemaController:V,setReplySerializer:de,setSchemaErrorFormatter:N,setGenReqId:Ee,addContentTypeParser:_f.helpers.addContentTypeParser,hasContentTypeParser:_f.helpers.hasContentTypeParser,getDefaultJsonParser:_f.defaultParsers.getDefaultJsonParser,defaultTextParser:_f.defaultParsers.defaultTextParser,removeContentTypeParser:_f.helpers.removeContentTypeParser,removeAllContentTypeParsers:_f.helpers.removeAllContentTypeParsers,register:null,after:null,ready:null,onClose:null,close:null,printPlugins:null,hasPlugin:function(k){return this[qme.kRegisteredPlugins].includes(k)||this[Nv].includes(k)},listen:u,server:l,addresses:function(){let k=this[Lme].map(U=>U.address());return k.push(this.server.address()),k.filter(U=>U)},decorate:gf.add,hasDecorator:gf.exist,decorateReply:gf.decorateReply,decorateRequest:gf.decorateRequest,hasRequestDecorator:gf.existRequest,hasReplyDecorator:gf.existReply,getDecorator:gf.getInstanceDecorator,addHttpMethod:he,inject:I,printRoutes:$e,setNotFoundHandler:w,setErrorHandler:Te,setChildLoggerFactory:Ie,initialConfig:s,addConstraintStrategy:o.addConstraintStrategy.bind(o),hasConstraintStrategy:o.hasConstraintStrategy.bind(o)};Object.defineProperties(y,{listeningOrigin:{get(){let k=this.addresses().slice(-1).pop();if(typeof k=="string")return k;let U=k.family==="IPv6"?`[${k.address}]`:k.address;return`${this[jB].https?"https":"http"}://${U}:${k.port}`}},pluginName:{configurable:!0,get(){return this[Nv].length>1?this[Nv].join(" -> "):this[Nv][0]}},prefix:{configurable:!0,get(){return this[Dme]}},validatorCompiler:{configurable:!0,get(){return this[Xl].getValidatorCompiler()}},serializerCompiler:{configurable:!0,get(){return this[Xl].getSerializerCompiler()}},childLoggerFactory:{configurable:!0,get(){return this[zB]}},version:{configurable:!0,get(){return Jlt}},errorHandler:{configurable:!0,get(){return this[pI].func}},genReqId:{configurable:!0,get(){return this[VB]}},supportedMethods:{configurable:!1,get(){return[...this[mf].bodyless,...this[mf].bodywith]}}}),e.schemaErrorFormatter&&(Wme(e.schemaErrorFormatter),y[qB]=e.schemaErrorFormatter.bind(y));let v=Number(e.pluginTimeout),S=Zlt(y,{autostart:!1,timeout:isNaN(v)===!1?v:pi.pluginTimeout,expose:{use:"register"}});S.override=_ut,S.on("start",()=>y[nr].started=!0),y[Cv]=y.ready,y.ready=x,y.printPlugins=S.prettyPrint.bind(S),S.once("preReady",()=>{y.onClose((k,U)=>{y[nr].closing=!0,o.closeRoutes(),Fme("preClose",y[Cv],y,function(){if(y[nr].listening){if(d==="idle")k.server.closeIdleConnections();else if(f&&d)k.server.closeAllConnections();else if(d===!0)for(let ne of y[BB])ne.destroy(),y[BB].delete(ne)}p&&k.server.closeHttp2Sessions(),!e.serverFactory||y[nr].listening?k.server.close(function(ne){ne&&ne.code!=="ERR_SERVER_NOT_RUNNING"?U(null):U()}):process.nextTick(U,null)})})});let g=new lut({server:y,config:{}});return y.setNotFoundHandler(),a.arrange404(y),o.setup(e,{avvio:S,fourOhFour:a,hasLogger:i,setupResponseListeners:m,throwIfAlreadyStarted:T,keepAliveConnections:h}),l.on("clientError",e.clientErrorHandler.bind(y)),Gme.hasSubscribers&&Gme.publish({fastify:y}),"asyncDispose"in Symbol&&(y[Symbol.asyncDispose]=function(){return y.close()}),y;function T(k){if(y[nr].started)throw new xut(k)}function I(k,U){if(Pv===void 0&&(Pv=$me()),y[nr].started){if(y[nr].closing){let ne=new Iut;if(U){U(ne);return}else return Promise.reject(ne)}return Pv(c,k,U)}if(U)this.ready(ne=>{ne?U(ne,null):Pv(c,k,U)});else return Pv((ne,j)=>{this.ready(function(se){if(se){j.emit("error",se);return}c(ne,j)})},k)}function x(k){if(this[nr].readyResolver!==null){if(k!=null){this[nr].readyResolver.promise.then(()=>k(null,y),k);return}return this[nr].readyResolver.promise}if(process.nextTick(U),this[nr].readyResolver=Sut.withResolvers(),k)this[nr].readyResolver.promise.then(()=>k(null,y),k);else return this[nr].readyResolver.promise;function U(){y[Cv]((j,se)=>{j||y[nr].started||y[nr].ready||y[nr].booting?ne(j):(y[nr].booting=!0,Fme("onReady",y[Cv],y,ne)),se()})}function ne(j){if(j=j!=null&&zme[j.code]!=null?yut(j,new zme[j.code](j.message)):j,j)return y[nr].readyResolver.reject(j);y[nr].readyResolver.resolve(y),y[nr].booting=!1,y[nr].ready=!0,y[nr].readyResolver=null}}function R(){return this}function O(k,U){if(T('Cannot call "addHook"!'),U==null)throw new yf.FST_ERR_HOOK_INVALID_HANDLER(k,U);if(k==="onSend"||k==="preSerialization"||k==="onError"||k==="preParsing"){if(U.constructor.name==="AsyncFunction"&&U.length===4)throw new yf.FST_ERR_HOOK_INVALID_ASYNC_HANDLER}else if(k==="onReady"||k==="onListen"){if(U.constructor.name==="AsyncFunction"&&U.length!==0)throw new yf.FST_ERR_HOOK_INVALID_ASYNC_HANDLER}else if(k==="onRequestAbort"){if(U.constructor.name==="AsyncFunction"&&U.length!==1)throw new yf.FST_ERR_HOOK_INVALID_ASYNC_HANDLER}else if(U.constructor.name==="AsyncFunction"&&U.length===3)throw new yf.FST_ERR_HOOK_INVALID_ASYNC_HANDLER;return k==="onClose"?this.onClose(U.bind(this)):k==="onReady"||k==="onListen"||k==="onRoute"?this[FB].add(k,U):this.after((j,se)=>{try{ne.call(this,k,U),se(j)}catch(M){se(M)}}),this;function ne(j,se){this[FB].add(j,se),this[UB].forEach(M=>ne.call(M,j,se))}}function A(k){return T('Cannot call "addSchema"!'),this[Xl].add(k),this[UB].forEach(U=>U.addSchema(k)),this}function b(k,U){k.headers["accept-version"]!==void 0&&(k.headers[rut]=k.headers["accept-version"],k.headers["accept-version"]=void 0),a.router.lookup(k,U)}function L(k,U,ne){if(e.frameworkErrors){let se=Bme(g.server,U),M=jme(g,e.logger,U,se),D=new mI(se,null,U,null,M,g),B=new kv(ne,D,M);return(typeof n=="function"?n(U):n)===!1&&M.info({req:D},"incoming request"),e.frameworkErrors(new vut(k),D,B)}let j=JSON.stringify({error:"Bad Request",code:"FST_ERR_BAD_URL",message:`'${k}' is not a valid url component`,statusCode:400});ne.writeHead(400,{"Content-Type":"application/json","Content-Length":Buffer.byteLength(j)}),ne.end(j)}function C(k,U,ne){if(k!==!1)return function(se){if(se){if(e.frameworkErrors){let D=Bme(g.server,U),B=jme(g,e.logger,U,D),J=new mI(D,null,U,null,B,g),H=new kv(ne,J,B);return(typeof n=="function"?n(U):n)===!1&&B.info({req:J},"incoming request"),e.frameworkErrors(new Eut,J,H)}let M='{"error":"Internal Server Error","message":"Unexpected error from async constraint","statusCode":500}';ne.writeHead(500,{"Content-Type":"application/json","Content-Length":M.length}),ne.end(M)}}}function w(k,U){return T('Cannot call "setNotFoundHandler"!'),a.setNotFoundHandler.call(this,k,U,S,o.routeHandler),this}function P(k){return T('Cannot call "setValidatorCompiler"!'),this[Xl].setValidatorCompiler(k),this}function N(k){return T('Cannot call "setSchemaErrorFormatter"!'),Wme(k),this[qB]=k.bind(this),this}function F(k){return T('Cannot call "setSerializerCompiler"!'),this[Xl].setSerializerCompiler(k),this}function V(k){T('Cannot call "setSchemaController"!');let U=this[Xl],ne=Ume.buildSchemaController(U,Object.assign({},U.opts,k));return this[Xl]=ne,this.getSchema=ne.getSchema.bind(ne),this.getSchemas=ne.getSchemas.bind(ne),this}function de(k){return T('Cannot call "setReplySerializer"!'),this[Mme]=k,this}function Te(k){if(T('Cannot call "setErrorHandler"!'),typeof k!="function")throw new Put;if(!e.allowErrorHandlerOverride&&this[hI])throw new Cut;return this[hI]&&kut("To disable this behavior, set 'allowErrorHandlerOverride' to false or ignore this message. For more information, visit: https://fastify.dev/docs/latest/Reference/Server/#allowerrorhandleroverride"),this[hI]=!0,this[pI]=Hme(this[pI],k.bind(this)),this}function Ie(k){return T('Cannot call "setChildLoggerFactory"!'),this[zB]=k,this}function $e(k={}){return k.includeMeta=k.includeHooks?k.includeMeta?HB.concat(k.includeMeta):HB:k.includeMeta,o.printRoutes(k)}function oe(k,{rewriteUrl:U,logger:ne}){let j;return function(M,D){if(j===void 0&&(j=k.isAsyncConstraint()),U){M.originalUrl=M.url;let B=U.call(y,M);if(typeof B=="string")M.url=B;else{let J=new Out(M.url,typeof B);M.destroy(J)}}k.routing(M,D,C(j,M,D))}}function Ee(k){return T('Cannot call "setGenReqId"!'),this[VB]=Yme(this[jB].requestIdHeader,k),this}function he(k,{hasBody:U=!1}={}){if(typeof k!="string"||gI.METHODS.indexOf(k)===-1)throw new Nut;U===!0?(this[mf].bodywith.add(k),this[mf].bodyless.delete(k)):(this[mf].bodywith.delete(k),this[mf].bodyless.add(k));let ne=k.toLowerCase();return this.hasDecorator(ne)||this.decorate(ne,function(j,se,M){return o.prepareRoute.call(this,{method:k,url:j,options:se,handler:M})}),this}}function $ut(t,e,r){if(t&&typeof t!="object")throw new but;if(t=Object.assign({},t),t.querystringParser&&typeof t.querystringParser!="function"||t.routerOptions?.querystringParser&&typeof t.routerOptions.querystringParser!="function")throw new Tut(typeof(t.querystringParser??t.routerOptions.querystringParser));if(t.schemaController&&t.schemaController.bucket&&typeof t.schemaController.bucket!="function")throw new wut(typeof t.schemaController.bucket);hut(t.bodyLimit);let n=typeof t.requestIdHeader=="string"&&t.requestIdHeader.length!==0?t.requestIdHeader.toLowerCase():t.requestIdHeader===!0&&"request-id",i=Yme(n,t.genReqId),s=t.requestIdLogLabel||"reqId";t.bodyLimit=t.bodyLimit||pi.bodyLimit;let o=t.disableRequestLogging||!1,a=Object.assign({customOptions:{},plugins:[]},t.ajv);if(!a.customOptions||Object.prototype.toString.call(a.customOptions)!=="[object Object]")throw new Aut(typeof a.customOptions);if(!a.plugins||!Array.isArray(a.plugins))throw new Rut(typeof a.plugins);let{logger:c,hasLogger:l}=fut(t);t.connectionTimeout=t.connectionTimeout||pi.connectionTimeout,t.keepAliveTimeout=t.keepAliveTimeout||pi.keepAliveTimeout,t.maxRequestsPerSocket=t.maxRequestsPerSocket||pi.maxRequestsPerSocket,t.requestTimeout=t.requestTimeout||pi.requestTimeout,t.logger=c,t.requestIdHeader=n,t.requestIdLogLabel=s,t.disableRequestLogging=o,t.ajv=a,t.clientErrorHandler=t.clientErrorHandler||Dut,t.allowErrorHandlerOverride=t.allowErrorHandlerOverride??pi.allowErrorHandlerOverride;let u=Kme(t);return t.exposeHeadRoutes=u.exposeHeadRoutes,t.http2SessionTimeout=u.http2SessionTimeout,t.routerOptions=mut(t,{defaultRoute:e,onBadUrl:r,ignoreTrailingSlash:pi.ignoreTrailingSlash,ignoreDuplicateSlashes:pi.ignoreDuplicateSlashes,maxParamLength:pi.maxParamLength,allowUnsafeRegex:pi.allowUnsafeRegex,buildPrettyMeta:Lut,useSemicolonDelimiter:pi.useSemicolonDelimiter}),{options:t,genReqId:i,disableRequestLogging:o,hasLogger:l,initialConfig:u}}function Lut(t){let e={};return["errorHandler","logLevel","logSerializers"].concat(HB).forEach(n=>{e[n]=t.store[n]}),Object.assign({},e)}function Dut(t,e){if(t.code==="ECONNRESET"||e.destroyed)return;let r,n,i,s;t.code==="ERR_HTTP_REQUEST_TIMEOUT"?(n="408",i=gI.STATUS_CODES[n],r=`{"error":"${i}","message":"Client Timeout","statusCode":408}`,s="timeout"):t.code==="HPE_HEADER_OVERFLOW"?(n="431",i=gI.STATUS_CODES[n],r=`{"error":"${i}","message":"Exceeded maximum allowed HTTP header size","statusCode":431}`,s="header_overflow"):(n="400",i=gI.STATUS_CODES[n],r=`{"error":"${i}","message":"Client Error","statusCode":400}`,s="error"),this.log.trace({err:t},`client ${s}`),e.writable&&e.write(`HTTP/1.1 ${n} ${i}\r
369
369
  Content-Length: ${r.length}\r
370
370
  Content-Type: application/json\r
371
371
  \r
@@ -373,7 +373,7 @@ ${r}`),e.destroy(t)}function Wme(t){if(typeof t!="function")throw new Vme(typeof
373
373
  for call at
374
374
  ${e}`;return Object.assign(new Error(r),t,{stack:i})}var BK=class extends dRt.EventEmitter{constructor(){super()}cancel(){var e;(e=this.call)===null||e===void 0||e.cancelWithStatus(XT.Status.CANCELLED,"Cancelled on client")}getPeer(){var e,r;return(r=(e=this.call)===null||e===void 0?void 0:e.getPeer())!==null&&r!==void 0?r:"unknown"}getAuthContext(){var e,r;return(r=(e=this.call)===null||e===void 0?void 0:e.getAuthContext())!==null&&r!==void 0?r:null}};uo.ClientUnaryCallImpl=BK;var zK=class extends GK.Readable{constructor(e){super({objectMode:!0}),this.deserialize=e}cancel(){var e;(e=this.call)===null||e===void 0||e.cancelWithStatus(XT.Status.CANCELLED,"Cancelled on client")}getPeer(){var e,r;return(r=(e=this.call)===null||e===void 0?void 0:e.getPeer())!==null&&r!==void 0?r:"unknown"}getAuthContext(){var e,r;return(r=(e=this.call)===null||e===void 0?void 0:e.getAuthContext())!==null&&r!==void 0?r:null}_read(e){var r;(r=this.call)===null||r===void 0||r.startRead()}};uo.ClientReadableStreamImpl=zK;var VK=class extends GK.Writable{constructor(e){super({objectMode:!0}),this.serialize=e}cancel(){var e;(e=this.call)===null||e===void 0||e.cancelWithStatus(XT.Status.CANCELLED,"Cancelled on client")}getPeer(){var e,r;return(r=(e=this.call)===null||e===void 0?void 0:e.getPeer())!==null&&r!==void 0?r:"unknown"}getAuthContext(){var e,r;return(r=(e=this.call)===null||e===void 0?void 0:e.getAuthContext())!==null&&r!==void 0?r:null}_write(e,r,n){var i;let s={callback:n},o=Number(r);Number.isNaN(o)||(s.flags=o),(i=this.call)===null||i===void 0||i.sendMessageWithContext(s,e)}_final(e){var r;(r=this.call)===null||r===void 0||r.halfClose(),e()}};uo.ClientWritableStreamImpl=VK;var HK=class extends GK.Duplex{constructor(e,r){super({objectMode:!0}),this.serialize=e,this.deserialize=r}cancel(){var e;(e=this.call)===null||e===void 0||e.cancelWithStatus(XT.Status.CANCELLED,"Cancelled on client")}getPeer(){var e,r;return(r=(e=this.call)===null||e===void 0?void 0:e.getPeer())!==null&&r!==void 0?r:"unknown"}getAuthContext(){var e,r;return(r=(e=this.call)===null||e===void 0?void 0:e.getAuthContext())!==null&&r!==void 0?r:null}_read(e){var r;(r=this.call)===null||r===void 0||r.startRead()}_write(e,r,n){var i;let s={callback:n},o=Number(r);Number.isNaN(o)||(s.flags=o),(i=this.call)===null||i===void 0||i.sendMessageWithContext(s,e)}_final(e){var r;(r=this.call)===null||r===void 0||r.halfClose(),e()}};uo.ClientDuplexStreamImpl=HK});var fp=E(dp=>{"use strict";Object.defineProperty(dp,"__esModule",{value:!0});dp.InterceptingListenerImpl=void 0;dp.statusOrFromValue=hRt;dp.statusOrFromError=mRt;dp.isInterceptingListener=gRt;var pRt=Vr();function hRt(t){return{ok:!0,value:t}}function mRt(t){var e;return{ok:!1,error:Object.assign(Object.assign({},t),{metadata:(e=t.metadata)!==null&&e!==void 0?e:new pRt.Metadata})}}function gRt(t){return t.onReceiveMetadata!==void 0&&t.onReceiveMetadata.length===1}var WK=class{constructor(e,r){this.listener=e,this.nextListener=r,this.processingMetadata=!1,this.hasPendingMessage=!1,this.processingMessage=!1,this.pendingStatus=null}processPendingMessage(){this.hasPendingMessage&&(this.nextListener.onReceiveMessage(this.pendingMessage),this.pendingMessage=null,this.hasPendingMessage=!1)}processPendingStatus(){this.pendingStatus&&this.nextListener.onReceiveStatus(this.pendingStatus)}onReceiveMetadata(e){this.processingMetadata=!0,this.listener.onReceiveMetadata(e,r=>{this.processingMetadata=!1,this.nextListener.onReceiveMetadata(r),this.processPendingMessage(),this.processPendingStatus()})}onReceiveMessage(e){this.processingMessage=!0,this.listener.onReceiveMessage(e,r=>{this.processingMessage=!1,this.processingMetadata?(this.pendingMessage=r,this.hasPendingMessage=!0):(this.nextListener.onReceiveMessage(r),this.processPendingStatus())})}onReceiveStatus(e){this.listener.onReceiveStatus(e,r=>{this.processingMetadata||this.processingMessage?this.pendingStatus=r:this.nextListener.onReceiveStatus(r)})}};dp.InterceptingListenerImpl=WK});var e5=E(fo=>{"use strict";Object.defineProperty(fo,"__esModule",{value:!0});fo.InterceptingCall=fo.RequesterBuilder=fo.ListenerBuilder=fo.InterceptorConfigurationError=void 0;fo.getInterceptingCall=ERt;var _Rt=Vr(),pPe=fp(),hPe=st(),mPe=zk(),ew=class t extends Error{constructor(e){super(e),this.name="InterceptorConfigurationError",Error.captureStackTrace(this,t)}};fo.InterceptorConfigurationError=ew;var KK=class{constructor(){this.metadata=void 0,this.message=void 0,this.status=void 0}withOnReceiveMetadata(e){return this.metadata=e,this}withOnReceiveMessage(e){return this.message=e,this}withOnReceiveStatus(e){return this.status=e,this}build(){return{onReceiveMetadata:this.metadata,onReceiveMessage:this.message,onReceiveStatus:this.status}}};fo.ListenerBuilder=KK;var JK=class{constructor(){this.start=void 0,this.message=void 0,this.halfClose=void 0,this.cancel=void 0}withStart(e){return this.start=e,this}withSendMessage(e){return this.message=e,this}withHalfClose(e){return this.halfClose=e,this}withCancel(e){return this.cancel=e,this}build(){return{start:this.start,sendMessage:this.message,halfClose:this.halfClose,cancel:this.cancel}}};fo.RequesterBuilder=JK;var YK={onReceiveMetadata:(t,e)=>{e(t)},onReceiveMessage:(t,e)=>{e(t)},onReceiveStatus:(t,e)=>{e(t)}},QT={start:(t,e,r)=>{r(t,e)},sendMessage:(t,e)=>{e(t)},halfClose:t=>{t()},cancel:t=>{t()}},ZK=class{constructor(e,r){var n,i,s,o;this.nextCall=e,this.processingMetadata=!1,this.pendingMessageContext=null,this.processingMessage=!1,this.pendingHalfClose=!1,r?this.requester={start:(n=r.start)!==null&&n!==void 0?n:QT.start,sendMessage:(i=r.sendMessage)!==null&&i!==void 0?i:QT.sendMessage,halfClose:(s=r.halfClose)!==null&&s!==void 0?s:QT.halfClose,cancel:(o=r.cancel)!==null&&o!==void 0?o:QT.cancel}:this.requester=QT}cancelWithStatus(e,r){this.requester.cancel(()=>{this.nextCall.cancelWithStatus(e,r)})}getPeer(){return this.nextCall.getPeer()}processPendingMessage(){this.pendingMessageContext&&(this.nextCall.sendMessageWithContext(this.pendingMessageContext,this.pendingMessage),this.pendingMessageContext=null,this.pendingMessage=null)}processPendingHalfClose(){this.pendingHalfClose&&this.nextCall.halfClose()}start(e,r){var n,i,s,o,a,c;let l={onReceiveMetadata:(i=(n=r?.onReceiveMetadata)===null||n===void 0?void 0:n.bind(r))!==null&&i!==void 0?i:(u=>{}),onReceiveMessage:(o=(s=r?.onReceiveMessage)===null||s===void 0?void 0:s.bind(r))!==null&&o!==void 0?o:(u=>{}),onReceiveStatus:(c=(a=r?.onReceiveStatus)===null||a===void 0?void 0:a.bind(r))!==null&&c!==void 0?c:(u=>{})};this.processingMetadata=!0,this.requester.start(e,l,(u,d)=>{var f,p,h;this.processingMetadata=!1;let m;if((0,pPe.isInterceptingListener)(d))m=d;else{let _={onReceiveMetadata:(f=d.onReceiveMetadata)!==null&&f!==void 0?f:YK.onReceiveMetadata,onReceiveMessage:(p=d.onReceiveMessage)!==null&&p!==void 0?p:YK.onReceiveMessage,onReceiveStatus:(h=d.onReceiveStatus)!==null&&h!==void 0?h:YK.onReceiveStatus};m=new pPe.InterceptingListenerImpl(_,l)}this.nextCall.start(u,m),this.processPendingMessage(),this.processPendingHalfClose()})}sendMessageWithContext(e,r){this.processingMessage=!0,this.requester.sendMessage(r,n=>{this.processingMessage=!1,this.processingMetadata?(this.pendingMessageContext=e,this.pendingMessage=r):(this.nextCall.sendMessageWithContext(e,n),this.processPendingHalfClose())})}sendMessage(e){this.sendMessageWithContext({},e)}startRead(){this.nextCall.startRead()}halfClose(){this.requester.halfClose(()=>{this.processingMetadata||this.processingMessage?this.pendingHalfClose=!0:this.nextCall.halfClose()})}getAuthContext(){return this.nextCall.getAuthContext()}};fo.InterceptingCall=ZK;function yRt(t,e,r){var n,i;let s=(n=r.deadline)!==null&&n!==void 0?n:1/0,o=r.host,a=(i=r.parent)!==null&&i!==void 0?i:null,c=r.propagate_flags,l=r.credentials,u=t.createCall(e,s,o,a,c);return l&&u.setCredentials(l),u}var l$=class{constructor(e,r){this.call=e,this.methodDefinition=r}cancelWithStatus(e,r){this.call.cancelWithStatus(e,r)}getPeer(){return this.call.getPeer()}sendMessageWithContext(e,r){let n;try{n=this.methodDefinition.requestSerialize(r)}catch(i){this.call.cancelWithStatus(hPe.Status.INTERNAL,`Request message serialization failure: ${(0,mPe.getErrorMessage)(i)}`);return}this.call.sendMessageWithContext(e,n)}sendMessage(e){this.sendMessageWithContext({},e)}start(e,r){let n=null;this.call.start(e,{onReceiveMetadata:i=>{var s;(s=r?.onReceiveMetadata)===null||s===void 0||s.call(r,i)},onReceiveMessage:i=>{var s;let o;try{o=this.methodDefinition.responseDeserialize(i)}catch(a){n={code:hPe.Status.INTERNAL,details:`Response message parsing error: ${(0,mPe.getErrorMessage)(a)}`,metadata:new _Rt.Metadata},this.call.cancelWithStatus(n.code,n.details);return}(s=r?.onReceiveMessage)===null||s===void 0||s.call(r,o)},onReceiveStatus:i=>{var s,o;n?(s=r?.onReceiveStatus)===null||s===void 0||s.call(r,n):(o=r?.onReceiveStatus)===null||o===void 0||o.call(r,i)}})}startRead(){this.call.startRead()}halfClose(){this.call.halfClose()}getAuthContext(){return this.call.getAuthContext()}},XK=class extends l${constructor(e,r){super(e,r)}start(e,r){var n,i;let s=!1,o={onReceiveMetadata:(i=(n=r?.onReceiveMetadata)===null||n===void 0?void 0:n.bind(r))!==null&&i!==void 0?i:(a=>{}),onReceiveMessage:a=>{var c;s=!0,(c=r?.onReceiveMessage)===null||c===void 0||c.call(r,a)},onReceiveStatus:a=>{var c,l;s||(c=r?.onReceiveMessage)===null||c===void 0||c.call(r,null),(l=r?.onReceiveStatus)===null||l===void 0||l.call(r,a)}};super.start(e,o),this.call.startRead()}},QK=class extends l${};function SRt(t,e,r){let n=yRt(t,r.path,e);return r.responseStream?new QK(n,r):new XK(n,r)}function ERt(t,e,r,n){if(t.clientInterceptors.length>0&&t.clientInterceptorProviders.length>0)throw new ew("Both interceptors and interceptor_providers were passed as options to the client constructor. Only one of these is allowed.");if(t.callInterceptors.length>0&&t.callInterceptorProviders.length>0)throw new ew("Both interceptors and interceptor_providers were passed as call options. Only one of these is allowed.");let i=[];t.callInterceptors.length>0||t.callInterceptorProviders.length>0?i=[].concat(t.callInterceptors,t.callInterceptorProviders.map(a=>a(e))).filter(a=>a):i=[].concat(t.clientInterceptors,t.clientInterceptorProviders.map(a=>a(e))).filter(a=>a);let s=Object.assign({},r,{method_definition:e});return i.reduceRight((a,c)=>l=>c(l,a),a=>SRt(n,a,e))(s)}});var n5=E(d$=>{"use strict";Object.defineProperty(d$,"__esModule",{value:!0});d$.Client=void 0;var ya=fPe(),vRt=i5(),bRt=ti(),ju=st(),C_=Vr(),u$=e5(),po=Symbol(),N_=Symbol(),k_=Symbol(),Bc=Symbol();function t5(t){return typeof t=="function"}function $_(t){var e;return((e=t.stack)===null||e===void 0?void 0:e.split(`
375
375
  `).slice(1).join(`
376
- `))||"no stack trace available"}var r5=class{constructor(e,r,n={}){var i,s;if(n=Object.assign({},n),this[N_]=(i=n.interceptors)!==null&&i!==void 0?i:[],delete n.interceptors,this[k_]=(s=n.interceptor_providers)!==null&&s!==void 0?s:[],delete n.interceptor_providers,this[N_].length>0&&this[k_].length>0)throw new Error("Both interceptors and interceptor_providers were passed as options to the client constructor. Only one of these is allowed.");if(this[Bc]=n.callInvocationTransformer,delete n.callInvocationTransformer,n.channelOverride)this[po]=n.channelOverride;else if(n.channelFactoryOverride){let o=n.channelFactoryOverride;delete n.channelFactoryOverride,this[po]=o(e,r,n)}else this[po]=new vRt.ChannelImplementation(e,r,n)}close(){this[po].close()}getChannel(){return this[po]}waitForReady(e,r){let n=i=>{if(i){r(new Error("Failed to connect before the deadline"));return}let s;try{s=this[po].getConnectivityState(!0)}catch{r(new Error("The channel has been closed"));return}if(s===bRt.ConnectivityState.READY)r();else try{this[po].watchConnectivityState(s,e,n)}catch{r(new Error("The channel has been closed"))}};setImmediate(n)}checkOptionalUnaryResponseArguments(e,r,n){if(t5(e))return{metadata:new C_.Metadata,options:{},callback:e};if(t5(r))return e instanceof C_.Metadata?{metadata:e,options:{},callback:r}:{metadata:new C_.Metadata,options:e,callback:r};if(!(e instanceof C_.Metadata&&r instanceof Object&&t5(n)))throw new Error("Incorrect arguments passed");return{metadata:e,options:r,callback:n}}makeUnaryRequest(e,r,n,i,s,o,a){var c,l;let u=this.checkOptionalUnaryResponseArguments(s,o,a),d={path:e,requestStream:!1,responseStream:!1,requestSerialize:r,responseDeserialize:n},f={argument:i,metadata:u.metadata,call:new ya.ClientUnaryCallImpl,channel:this[po],methodDefinition:d,callOptions:u.options,callback:u.callback};this[Bc]&&(f=this[Bc](f));let p=f.call,h={clientInterceptors:this[N_],clientInterceptorProviders:this[k_],callInterceptors:(c=f.callOptions.interceptors)!==null&&c!==void 0?c:[],callInterceptorProviders:(l=f.callOptions.interceptor_providers)!==null&&l!==void 0?l:[]},m=(0,u$.getInterceptingCall)(h,f.methodDefinition,f.callOptions,f.channel);p.call=m;let _=null,y=!1,v=new Error;return m.start(f.metadata,{onReceiveMetadata:S=>{p.emit("metadata",S)},onReceiveMessage(S){_!==null&&m.cancelWithStatus(ju.Status.UNIMPLEMENTED,"Too many responses received"),_=S},onReceiveStatus(S){if(!y){if(y=!0,S.code===ju.Status.OK)if(_===null){let g=$_(v);f.callback((0,ya.callErrorFromStatus)({code:ju.Status.UNIMPLEMENTED,details:"No message received",metadata:S.metadata},g))}else f.callback(null,_);else{let g=$_(v);f.callback((0,ya.callErrorFromStatus)(S,g))}v=null,p.emit("status",S)}}}),m.sendMessage(i),m.halfClose(),p}makeClientStreamRequest(e,r,n,i,s,o){var a,c;let l=this.checkOptionalUnaryResponseArguments(i,s,o),u={path:e,requestStream:!0,responseStream:!1,requestSerialize:r,responseDeserialize:n},d={metadata:l.metadata,call:new ya.ClientWritableStreamImpl(r),channel:this[po],methodDefinition:u,callOptions:l.options,callback:l.callback};this[Bc]&&(d=this[Bc](d));let f=d.call,p={clientInterceptors:this[N_],clientInterceptorProviders:this[k_],callInterceptors:(a=d.callOptions.interceptors)!==null&&a!==void 0?a:[],callInterceptorProviders:(c=d.callOptions.interceptor_providers)!==null&&c!==void 0?c:[]},h=(0,u$.getInterceptingCall)(p,d.methodDefinition,d.callOptions,d.channel);f.call=h;let m=null,_=!1,y=new Error;return h.start(d.metadata,{onReceiveMetadata:v=>{f.emit("metadata",v)},onReceiveMessage(v){m!==null&&h.cancelWithStatus(ju.Status.UNIMPLEMENTED,"Too many responses received"),m=v,h.startRead()},onReceiveStatus(v){if(!_){if(_=!0,v.code===ju.Status.OK)if(m===null){let S=$_(y);d.callback((0,ya.callErrorFromStatus)({code:ju.Status.UNIMPLEMENTED,details:"No message received",metadata:v.metadata},S))}else d.callback(null,m);else{let S=$_(y);d.callback((0,ya.callErrorFromStatus)(v,S))}y=null,f.emit("status",v)}}}),f}checkMetadataAndOptions(e,r){let n,i;return e instanceof C_.Metadata?(n=e,r?i=r:i={}):(e?i=e:i={},n=new C_.Metadata),{metadata:n,options:i}}makeServerStreamRequest(e,r,n,i,s,o){var a,c;let l=this.checkMetadataAndOptions(s,o),u={path:e,requestStream:!1,responseStream:!0,requestSerialize:r,responseDeserialize:n},d={argument:i,metadata:l.metadata,call:new ya.ClientReadableStreamImpl(n),channel:this[po],methodDefinition:u,callOptions:l.options};this[Bc]&&(d=this[Bc](d));let f=d.call,p={clientInterceptors:this[N_],clientInterceptorProviders:this[k_],callInterceptors:(a=d.callOptions.interceptors)!==null&&a!==void 0?a:[],callInterceptorProviders:(c=d.callOptions.interceptor_providers)!==null&&c!==void 0?c:[]},h=(0,u$.getInterceptingCall)(p,d.methodDefinition,d.callOptions,d.channel);f.call=h;let m=!1,_=new Error;return h.start(d.metadata,{onReceiveMetadata(y){f.emit("metadata",y)},onReceiveMessage(y){f.push(y)},onReceiveStatus(y){if(!m){if(m=!0,f.push(null),y.code!==ju.Status.OK){let v=$_(_);f.emit("error",(0,ya.callErrorFromStatus)(y,v))}_=null,f.emit("status",y)}}}),h.sendMessage(i),h.halfClose(),f}makeBidiStreamRequest(e,r,n,i,s){var o,a;let c=this.checkMetadataAndOptions(i,s),l={path:e,requestStream:!0,responseStream:!0,requestSerialize:r,responseDeserialize:n},u={metadata:c.metadata,call:new ya.ClientDuplexStreamImpl(r,n),channel:this[po],methodDefinition:l,callOptions:c.options};this[Bc]&&(u=this[Bc](u));let d=u.call,f={clientInterceptors:this[N_],clientInterceptorProviders:this[k_],callInterceptors:(o=u.callOptions.interceptors)!==null&&o!==void 0?o:[],callInterceptorProviders:(a=u.callOptions.interceptor_providers)!==null&&a!==void 0?a:[]},p=(0,u$.getInterceptingCall)(f,u.methodDefinition,u.callOptions,u.channel);d.call=p;let h=!1,m=new Error;return p.start(u.metadata,{onReceiveMetadata(_){d.emit("metadata",_)},onReceiveMessage(_){d.push(_)},onReceiveStatus(_){if(!h){if(h=!0,d.push(null),_.code!==ju.Status.OK){let y=$_(m);d.emit("error",(0,ya.callErrorFromStatus)(_,y))}m=null,d.emit("status",_)}}}),d}};d$.Client=r5});var p$=E(f$=>{"use strict";Object.defineProperty(f$,"__esModule",{value:!0});f$.makeClientConstructor=gPe;f$.loadPackageDefinition=RRt;var tw=n5(),TRt={unary:tw.Client.prototype.makeUnaryRequest,server_stream:tw.Client.prototype.makeServerStreamRequest,client_stream:tw.Client.prototype.makeClientStreamRequest,bidi:tw.Client.prototype.makeBidiStreamRequest};function s5(t){return["__proto__","prototype","constructor"].includes(t)}function gPe(t,e,r){r||(r={});class n extends tw.Client{}return Object.keys(t).forEach(i=>{if(s5(i))return;let s=t[i],o;if(typeof i=="string"&&i.charAt(0)==="$")throw new Error("Method names cannot start with $");s.requestStream?s.responseStream?o="bidi":o="client_stream":s.responseStream?o="server_stream":o="unary";let a=s.requestSerialize,c=s.responseDeserialize,l=wRt(TRt[o],s.path,a,c);n.prototype[i]=l,Object.assign(n.prototype[i],s),s.originalName&&!s5(s.originalName)&&(n.prototype[s.originalName]=n.prototype[i])}),n.service=t,n.serviceName=e,n}function wRt(t,e,r,n){return function(...i){return t.call(this,e,r,n,...i)}}function ARt(t){return"format"in t}function RRt(t){let e={};for(let r in t)if(Object.prototype.hasOwnProperty.call(t,r)){let n=t[r],i=r.split(".");if(i.some(a=>s5(a)))continue;let s=i[i.length-1],o=e;for(let a of i.slice(0,-1))o[a]||(o[a]={}),o=o[a];ARt(n)?o[s]=n:o[s]=gPe(n,s,{})}return e}});var qPe=E((_wr,jPe)=>{"use strict";var xRt=1/0,IRt="[object Symbol]",ORt=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,PRt=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,m$="\\ud800-\\udfff",wPe="\\u0300-\\u036f\\ufe20-\\ufe23",APe="\\u20d0-\\u20f0",RPe="\\u2700-\\u27bf",xPe="a-z\\xdf-\\xf6\\xf8-\\xff",CRt="\\xac\\xb1\\xd7\\xf7",NRt="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",kRt="\\u2000-\\u206f",$Rt=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",IPe="A-Z\\xc0-\\xd6\\xd8-\\xde",OPe="\\ufe0e\\ufe0f",PPe=CRt+NRt+kRt+$Rt,a5="['\u2019]",LRt="["+m$+"]",_Pe="["+PPe+"]",h$="["+wPe+APe+"]",CPe="\\d+",DRt="["+RPe+"]",NPe="["+xPe+"]",kPe="[^"+m$+PPe+CPe+RPe+xPe+IPe+"]",o5="\\ud83c[\\udffb-\\udfff]",MRt="(?:"+h$+"|"+o5+")",$Pe="[^"+m$+"]",c5="(?:\\ud83c[\\udde6-\\uddff]){2}",l5="[\\ud800-\\udbff][\\udc00-\\udfff]",L_="["+IPe+"]",LPe="\\u200d",yPe="(?:"+NPe+"|"+kPe+")",URt="(?:"+L_+"|"+kPe+")",SPe="(?:"+a5+"(?:d|ll|m|re|s|t|ve))?",EPe="(?:"+a5+"(?:D|LL|M|RE|S|T|VE))?",DPe=MRt+"?",MPe="["+OPe+"]?",FRt="(?:"+LPe+"(?:"+[$Pe,c5,l5].join("|")+")"+MPe+DPe+")*",UPe=MPe+DPe+FRt,jRt="(?:"+[DRt,c5,l5].join("|")+")"+UPe,qRt="(?:"+[$Pe+h$+"?",h$,c5,l5,LRt].join("|")+")",BRt=RegExp(a5,"g"),zRt=RegExp(h$,"g"),VRt=RegExp(o5+"(?="+o5+")|"+qRt+UPe,"g"),HRt=RegExp([L_+"?"+NPe+"+"+SPe+"(?="+[_Pe,L_,"$"].join("|")+")",URt+"+"+EPe+"(?="+[_Pe,L_+yPe,"$"].join("|")+")",L_+"?"+yPe+"+"+SPe,L_+"+"+EPe,CPe,jRt].join("|"),"g"),GRt=RegExp("["+LPe+m$+wPe+APe+OPe+"]"),WRt=/[a-z][A-Z]|[A-Z]{2,}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,YRt={\u00C0:"A",\u00C1:"A",\u00C2:"A",\u00C3:"A",\u00C4:"A",\u00C5:"A",\u00E0:"a",\u00E1:"a",\u00E2:"a",\u00E3:"a",\u00E4:"a",\u00E5:"a",\u00C7:"C",\u00E7:"c",\u00D0:"D",\u00F0:"d",\u00C8:"E",\u00C9:"E",\u00CA:"E",\u00CB:"E",\u00E8:"e",\u00E9:"e",\u00EA:"e",\u00EB:"e",\u00CC:"I",\u00CD:"I",\u00CE:"I",\u00CF:"I",\u00EC:"i",\u00ED:"i",\u00EE:"i",\u00EF:"i",\u00D1:"N",\u00F1:"n",\u00D2:"O",\u00D3:"O",\u00D4:"O",\u00D5:"O",\u00D6:"O",\u00D8:"O",\u00F2:"o",\u00F3:"o",\u00F4:"o",\u00F5:"o",\u00F6:"o",\u00F8:"o",\u00D9:"U",\u00DA:"U",\u00DB:"U",\u00DC:"U",\u00F9:"u",\u00FA:"u",\u00FB:"u",\u00FC:"u",\u00DD:"Y",\u00FD:"y",\u00FF:"y",\u00C6:"Ae",\u00E6:"ae",\u00DE:"Th",\u00FE:"th",\u00DF:"ss",\u0100:"A",\u0102:"A",\u0104:"A",\u0101:"a",\u0103:"a",\u0105:"a",\u0106:"C",\u0108:"C",\u010A:"C",\u010C:"C",\u0107:"c",\u0109:"c",\u010B:"c",\u010D:"c",\u010E:"D",\u0110:"D",\u010F:"d",\u0111:"d",\u0112:"E",\u0114:"E",\u0116:"E",\u0118:"E",\u011A:"E",\u0113:"e",\u0115:"e",\u0117:"e",\u0119:"e",\u011B:"e",\u011C:"G",\u011E:"G",\u0120:"G",\u0122:"G",\u011D:"g",\u011F:"g",\u0121:"g",\u0123:"g",\u0124:"H",\u0126:"H",\u0125:"h",\u0127:"h",\u0128:"I",\u012A:"I",\u012C:"I",\u012E:"I",\u0130:"I",\u0129:"i",\u012B:"i",\u012D:"i",\u012F:"i",\u0131:"i",\u0134:"J",\u0135:"j",\u0136:"K",\u0137:"k",\u0138:"k",\u0139:"L",\u013B:"L",\u013D:"L",\u013F:"L",\u0141:"L",\u013A:"l",\u013C:"l",\u013E:"l",\u0140:"l",\u0142:"l",\u0143:"N",\u0145:"N",\u0147:"N",\u014A:"N",\u0144:"n",\u0146:"n",\u0148:"n",\u014B:"n",\u014C:"O",\u014E:"O",\u0150:"O",\u014D:"o",\u014F:"o",\u0151:"o",\u0154:"R",\u0156:"R",\u0158:"R",\u0155:"r",\u0157:"r",\u0159:"r",\u015A:"S",\u015C:"S",\u015E:"S",\u0160:"S",\u015B:"s",\u015D:"s",\u015F:"s",\u0161:"s",\u0162:"T",\u0164:"T",\u0166:"T",\u0163:"t",\u0165:"t",\u0167:"t",\u0168:"U",\u016A:"U",\u016C:"U",\u016E:"U",\u0170:"U",\u0172:"U",\u0169:"u",\u016B:"u",\u016D:"u",\u016F:"u",\u0171:"u",\u0173:"u",\u0174:"W",\u0175:"w",\u0176:"Y",\u0177:"y",\u0178:"Y",\u0179:"Z",\u017B:"Z",\u017D:"Z",\u017A:"z",\u017C:"z",\u017E:"z",\u0132:"IJ",\u0133:"ij",\u0152:"Oe",\u0153:"oe",\u0149:"'n",\u017F:"ss"},KRt=typeof global=="object"&&global&&global.Object===Object&&global,JRt=typeof self=="object"&&self&&self.Object===Object&&self,ZRt=KRt||JRt||Function("return this")();function XRt(t,e,r,n){var i=-1,s=t?t.length:0;for(n&&s&&(r=t[++i]);++i<s;)r=e(r,t[i],i,t);return r}function QRt(t){return t.split("")}function ext(t){return t.match(ORt)||[]}function txt(t){return function(e){return t?.[e]}}var rxt=txt(YRt);function FPe(t){return GRt.test(t)}function nxt(t){return WRt.test(t)}function ixt(t){return FPe(t)?sxt(t):QRt(t)}function sxt(t){return t.match(VRt)||[]}function oxt(t){return t.match(HRt)||[]}var axt=Object.prototype,cxt=axt.toString,vPe=ZRt.Symbol,bPe=vPe?vPe.prototype:void 0,TPe=bPe?bPe.toString:void 0;function lxt(t,e,r){var n=-1,i=t.length;e<0&&(e=-e>i?0:i+e),r=r>i?i:r,r<0&&(r+=i),i=e>r?0:r-e>>>0,e>>>=0;for(var s=Array(i);++n<i;)s[n]=t[n+e];return s}function uxt(t){if(typeof t=="string")return t;if(mxt(t))return TPe?TPe.call(t):"";var e=t+"";return e=="0"&&1/t==-xRt?"-0":e}function dxt(t,e,r){var n=t.length;return r=r===void 0?n:r,!e&&r>=n?t:lxt(t,e,r)}function fxt(t){return function(e){e=g$(e);var r=FPe(e)?ixt(e):void 0,n=r?r[0]:e.charAt(0),i=r?dxt(r,1).join(""):e.slice(1);return n[t]()+i}}function pxt(t){return function(e){return XRt(Ext(yxt(e).replace(BRt,"")),t,"")}}function hxt(t){return!!t&&typeof t=="object"}function mxt(t){return typeof t=="symbol"||hxt(t)&&cxt.call(t)==IRt}function g$(t){return t==null?"":uxt(t)}var gxt=pxt(function(t,e,r){return e=e.toLowerCase(),t+(r?_xt(e):e)});function _xt(t){return Sxt(g$(t).toLowerCase())}function yxt(t){return t=g$(t),t&&t.replace(PRt,rxt).replace(zRt,"")}var Sxt=fxt("toUpperCase");function Ext(t,e,r){return t=g$(t),e=r?void 0:e,e===void 0?nxt(t)?oxt(t):ext(t):t.match(e)||[]}jPe.exports=gxt});var u5=E((ywr,BPe)=>{"use strict";BPe.exports=vxt;function vxt(t,e){for(var r=new Array(arguments.length-1),n=0,i=2,s=!0;i<arguments.length;)r[n++]=arguments[i++];return new Promise(function(a,c){r[n]=function(u){if(s)if(s=!1,u)c(u);else{for(var d=new Array(arguments.length-1),f=0;f<d.length;)d[f++]=arguments[f];a.apply(null,d)}};try{t.apply(e||null,r)}catch(l){s&&(s=!1,c(l))}})}});var GPe=E(HPe=>{"use strict";var _$=HPe;_$.length=function(e){var r=e.length;if(!r)return 0;for(var n=0;--r%4>1&&e.charAt(r)==="=";)++n;return Math.ceil(e.length*3)/4-n};var D_=new Array(64),VPe=new Array(123);for(ho=0;ho<64;)VPe[D_[ho]=ho<26?ho+65:ho<52?ho+71:ho<62?ho-4:ho-59|43]=ho++;var ho;_$.encode=function(e,r,n){for(var i=null,s=[],o=0,a=0,c;r<n;){var l=e[r++];switch(a){case 0:s[o++]=D_[l>>2],c=(l&3)<<4,a=1;break;case 1:s[o++]=D_[c|l>>4],c=(l&15)<<2,a=2;break;case 2:s[o++]=D_[c|l>>6],s[o++]=D_[l&63],a=0;break}o>8191&&((i||(i=[])).push(String.fromCharCode.apply(String,s)),o=0)}return a&&(s[o++]=D_[c],s[o++]=61,a===1&&(s[o++]=61)),i?(o&&i.push(String.fromCharCode.apply(String,s.slice(0,o))),i.join("")):String.fromCharCode.apply(String,s.slice(0,o))};var zPe="invalid encoding";_$.decode=function(e,r,n){for(var i=n,s=0,o,a=0;a<e.length;){var c=e.charCodeAt(a++);if(c===61&&s>1)break;if((c=VPe[c])===void 0)throw Error(zPe);switch(s){case 0:o=c,s=1;break;case 1:r[n++]=o<<2|(c&48)>>4,o=c,s=2;break;case 2:r[n++]=(o&15)<<4|(c&60)>>2,o=c,s=3;break;case 3:r[n++]=(o&3)<<6|c,s=0;break}}if(s===1)throw Error(zPe);return n-i};_$.test=function(e){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(e)}});var YPe=E((Ewr,WPe)=>{"use strict";WPe.exports=y$;function y$(){this._listeners=Object.create(null)}y$.prototype.on=function(e,r,n){return(this._listeners[e]||(this._listeners[e]=[])).push({fn:r,ctx:n||this}),this};y$.prototype.off=function(e,r){if(e===void 0)this._listeners=Object.create(null);else if(r===void 0)this._listeners[e]=[];else{var n=this._listeners[e];if(!n)return this;for(var i=0;i<n.length;)n[i].fn===r?n.splice(i,1):++i}return this};y$.prototype.emit=function(e){var r=this._listeners[e];if(r){for(var n=[],i=1;i<arguments.length;)n.push(arguments[i++]);for(i=0;i<r.length;)r[i].fn.apply(r[i++].ctx,n)}return this}});var tCe=E((vwr,eCe)=>{"use strict";eCe.exports=KPe(KPe);function KPe(t){return typeof Float32Array<"u"?(function(){var e=new Float32Array([-0]),r=new Uint8Array(e.buffer),n=r[3]===128;function i(c,l,u){e[0]=c,l[u]=r[0],l[u+1]=r[1],l[u+2]=r[2],l[u+3]=r[3]}function s(c,l,u){e[0]=c,l[u]=r[3],l[u+1]=r[2],l[u+2]=r[1],l[u+3]=r[0]}t.writeFloatLE=n?i:s,t.writeFloatBE=n?s:i;function o(c,l){return r[0]=c[l],r[1]=c[l+1],r[2]=c[l+2],r[3]=c[l+3],e[0]}function a(c,l){return r[3]=c[l],r[2]=c[l+1],r[1]=c[l+2],r[0]=c[l+3],e[0]}t.readFloatLE=n?o:a,t.readFloatBE=n?a:o})():(function(){function e(n,i,s,o){var a=i<0?1:0;if(a&&(i=-i),i===0)n(1/i>0?0:2147483648,s,o);else if(isNaN(i))n(2143289344,s,o);else if(i>34028234663852886e22)n((a<<31|2139095040)>>>0,s,o);else if(i<11754943508222875e-54)n((a<<31|Math.round(i/1401298464324817e-60))>>>0,s,o);else{var c=Math.floor(Math.log(i)/Math.LN2),l=Math.round(i*Math.pow(2,-c)*8388608)&8388607;n((a<<31|c+127<<23|l)>>>0,s,o)}}t.writeFloatLE=e.bind(null,JPe),t.writeFloatBE=e.bind(null,ZPe);function r(n,i,s){var o=n(i,s),a=(o>>31)*2+1,c=o>>>23&255,l=o&8388607;return c===255?l?NaN:a*(1/0):c===0?a*1401298464324817e-60*l:a*Math.pow(2,c-150)*(l+8388608)}t.readFloatLE=r.bind(null,XPe),t.readFloatBE=r.bind(null,QPe)})(),typeof Float64Array<"u"?(function(){var e=new Float64Array([-0]),r=new Uint8Array(e.buffer),n=r[7]===128;function i(c,l,u){e[0]=c,l[u]=r[0],l[u+1]=r[1],l[u+2]=r[2],l[u+3]=r[3],l[u+4]=r[4],l[u+5]=r[5],l[u+6]=r[6],l[u+7]=r[7]}function s(c,l,u){e[0]=c,l[u]=r[7],l[u+1]=r[6],l[u+2]=r[5],l[u+3]=r[4],l[u+4]=r[3],l[u+5]=r[2],l[u+6]=r[1],l[u+7]=r[0]}t.writeDoubleLE=n?i:s,t.writeDoubleBE=n?s:i;function o(c,l){return r[0]=c[l],r[1]=c[l+1],r[2]=c[l+2],r[3]=c[l+3],r[4]=c[l+4],r[5]=c[l+5],r[6]=c[l+6],r[7]=c[l+7],e[0]}function a(c,l){return r[7]=c[l],r[6]=c[l+1],r[5]=c[l+2],r[4]=c[l+3],r[3]=c[l+4],r[2]=c[l+5],r[1]=c[l+6],r[0]=c[l+7],e[0]}t.readDoubleLE=n?o:a,t.readDoubleBE=n?a:o})():(function(){function e(n,i,s,o,a,c){var l=o<0?1:0;if(l&&(o=-o),o===0)n(0,a,c+i),n(1/o>0?0:2147483648,a,c+s);else if(isNaN(o))n(0,a,c+i),n(2146959360,a,c+s);else if(o>17976931348623157e292)n(0,a,c+i),n((l<<31|2146435072)>>>0,a,c+s);else{var u;if(o<22250738585072014e-324)u=o/5e-324,n(u>>>0,a,c+i),n((l<<31|u/4294967296)>>>0,a,c+s);else{var d=Math.floor(Math.log(o)/Math.LN2);d===1024&&(d=1023),u=o*Math.pow(2,-d),n(u*4503599627370496>>>0,a,c+i),n((l<<31|d+1023<<20|u*1048576&1048575)>>>0,a,c+s)}}}t.writeDoubleLE=e.bind(null,JPe,0,4),t.writeDoubleBE=e.bind(null,ZPe,4,0);function r(n,i,s,o,a){var c=n(o,a+i),l=n(o,a+s),u=(l>>31)*2+1,d=l>>>20&2047,f=4294967296*(l&1048575)+c;return d===2047?f?NaN:u*(1/0):d===0?u*5e-324*f:u*Math.pow(2,d-1075)*(f+4503599627370496)}t.readDoubleLE=r.bind(null,XPe,0,4),t.readDoubleBE=r.bind(null,QPe,4,0)})(),t}function JPe(t,e,r){e[r]=t&255,e[r+1]=t>>>8&255,e[r+2]=t>>>16&255,e[r+3]=t>>>24}function ZPe(t,e,r){e[r]=t>>>24,e[r+1]=t>>>16&255,e[r+2]=t>>>8&255,e[r+3]=t&255}function XPe(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16|t[e+3]<<24)>>>0}function QPe(t,e){return(t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3])>>>0}});var nCe=E((bwr,rCe)=>{"use strict";rCe.exports=bxt;function bxt(t){try{if(typeof W!="function")return null;var e=W(t);return e&&(e.length||Object.keys(e).length)?e:null}catch{return null}}});var sCe=E(iCe=>{"use strict";var f5=iCe,d5="\uFFFD";f5.length=function(e){for(var r=0,n=0,i=0;i<e.length;++i)n=e.charCodeAt(i),n<128?r+=1:n<2048?r+=2:(n&64512)===55296&&(e.charCodeAt(i+1)&64512)===56320?(++i,r+=4):r+=3;return r};f5.read=function(e,r,n){if(n-r<1)return"";for(var i="",s=r;s<n;){var o=e[s++];if(o<=127)i+=String.fromCharCode(o);else if(o>=192&&o<224){var a=(o&31)<<6|e[s++]&63;i+=a>=128?String.fromCharCode(a):d5}else if(o>=224&&o<240){var c=(o&15)<<12|(e[s++]&63)<<6|e[s++]&63;i+=c>=2048?String.fromCharCode(c):d5}else if(o>=240){var l=(o&7)<<18|(e[s++]&63)<<12|(e[s++]&63)<<6|e[s++]&63;l<65536||l>1114111?i+=d5:(l-=65536,i+=String.fromCharCode(55296+(l>>10)),i+=String.fromCharCode(56320+(l&1023)))}}return i};f5.write=function(e,r,n){for(var i=n,s,o,a=0;a<e.length;++a)s=e.charCodeAt(a),s<128?r[n++]=s:s<2048?(r[n++]=s>>6|192,r[n++]=s&63|128):(s&64512)===55296&&((o=e.charCodeAt(a+1))&64512)===56320?(s=65536+((s&1023)<<10)+(o&1023),++a,r[n++]=s>>18|240,r[n++]=s>>12&63|128,r[n++]=s>>6&63|128,r[n++]=s&63|128):(r[n++]=s>>12|224,r[n++]=s>>6&63|128,r[n++]=s&63|128);return n-i}});var aCe=E((Awr,oCe)=>{"use strict";oCe.exports=Txt;function Txt(t,e,r){var n=r||8192,i=n>>>1,s=null,o=n;return function(c){if(c<1||c>i)return t(c);o+c>n&&(s=t(n),o=0);var l=e.call(s,o,o+=c);return o&7&&(o=(o|7)+1),l}}});var lCe=E((Rwr,cCe)=>{"use strict";cCe.exports=Hr;var rw=mo();function Hr(t,e){this.lo=t>>>0,this.hi=e>>>0}var pp=Hr.zero=new Hr(0,0);pp.toNumber=function(){return 0};pp.zzEncode=pp.zzDecode=function(){return this};pp.length=function(){return 1};var wxt=Hr.zeroHash="\0\0\0\0\0\0\0\0";Hr.fromNumber=function(e){if(e===0)return pp;var r=e<0;r&&(e=-e);var n=e>>>0,i=(e-n)/4294967296>>>0;return r&&(i=~i>>>0,n=~n>>>0,++n>4294967295&&(n=0,++i>4294967295&&(i=0))),new Hr(n,i)};Hr.from=function(e){if(typeof e=="number")return Hr.fromNumber(e);if(rw.isString(e))if(rw.Long)e=rw.Long.fromString(e);else return Hr.fromNumber(parseInt(e,10));return e.low||e.high?new Hr(e.low>>>0,e.high>>>0):pp};Hr.prototype.toNumber=function(e){if(!e&&this.hi>>>31){var r=~this.lo+1>>>0,n=~this.hi>>>0;return r||(n=n+1>>>0),-(r+n*4294967296)}return this.lo+this.hi*4294967296};Hr.prototype.toLong=function(e){return rw.Long?new rw.Long(this.lo|0,this.hi|0,!!e):{low:this.lo|0,high:this.hi|0,unsigned:!!e}};var qu=String.prototype.charCodeAt;Hr.fromHash=function(e){return e===wxt?pp:new Hr((qu.call(e,0)|qu.call(e,1)<<8|qu.call(e,2)<<16|qu.call(e,3)<<24)>>>0,(qu.call(e,4)|qu.call(e,5)<<8|qu.call(e,6)<<16|qu.call(e,7)<<24)>>>0)};Hr.prototype.toHash=function(){return String.fromCharCode(this.lo&255,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,this.hi&255,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)};Hr.prototype.zzEncode=function(){var e=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^e)>>>0,this.lo=(this.lo<<1^e)>>>0,this};Hr.prototype.zzDecode=function(){var e=-(this.lo&1);return this.lo=((this.lo>>>1|this.hi<<31)^e)>>>0,this.hi=(this.hi>>>1^e)>>>0,this};Hr.prototype.length=function(){var e=this.lo,r=(this.lo>>>28|this.hi<<4)>>>0,n=this.hi>>>24;return n===0?r===0?e<16384?e<128?1:2:e<2097152?3:4:r<16384?r<128?5:6:r<2097152?7:8:n<128?9:10}});var h5=E((nw,p5)=>{"use strict";(function(t,e){function r(n){return n.default||n}typeof define=="function"&&define.amd?define([],function(){var n={};return e(n),r(n)}):typeof nw=="object"?(e(nw),typeof p5=="object"&&(p5.exports=r(nw))):(function(){var n={};e(n),t.Long=r(n)})()})(typeof globalThis<"u"?globalThis:typeof self<"u"?self:nw,function(t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var e=null;try{e=new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0,1,13,2,96,0,1,127,96,4,127,127,127,127,1,127,3,7,6,0,1,1,1,1,1,6,6,1,127,1,65,0,11,7,50,6,3,109,117,108,0,1,5,100,105,118,95,115,0,2,5,100,105,118,95,117,0,3,5,114,101,109,95,115,0,4,5,114,101,109,95,117,0,5,8,103,101,116,95,104,105,103,104,0,0,10,191,1,6,4,0,35,0,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,126,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,127,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,128,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,129,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,130,34,4,66,32,135,167,36,0,32,4,167,11])),{}).exports}catch{}function r(C,w,P){this.low=C|0,this.high=w|0,this.unsigned=!!P}r.prototype.__isLong__,Object.defineProperty(r.prototype,"__isLong__",{value:!0});function n(C){return(C&&C.__isLong__)===!0}function i(C){var w=Math.clz32(C&-C);return C?31-w:w}r.isLong=n;var s={},o={};function a(C,w){var P,N,j;return w?(C>>>=0,(j=0<=C&&C<256)&&(N=o[C],N)?N:(P=l(C,0,!0),j&&(o[C]=P),P)):(C|=0,(j=-128<=C&&C<128)&&(N=s[C],N)?N:(P=l(C,C<0?-1:0,!1),j&&(s[C]=P),P))}r.fromInt=a;function c(C,w){if(isNaN(C))return w?g:S;if(w){if(C<0)return g;if(C>=_)return O}else{if(C<=-y)return A;if(C+1>=y)return R}return C<0?c(-C,w).neg():l(C%m|0,C/m|0,w)}r.fromNumber=c;function l(C,w,P){return new r(C,w,P)}r.fromBits=l;var u=Math.pow;function d(C,w,P){if(C.length===0)throw Error("empty string");if(typeof w=="number"?(P=w,w=!1):w=!!w,C==="NaN"||C==="Infinity"||C==="+Infinity"||C==="-Infinity")return w?g:S;if(P=P||10,P<2||36<P)throw RangeError("radix");var N;if((N=C.indexOf("-"))>0)throw Error("interior hyphen");if(N===0)return d(C.substring(1),w,P).neg();for(var j=c(u(P,8)),V=S,de=0;de<C.length;de+=8){var Te=Math.min(8,C.length-de),Ie=parseInt(C.substring(de,de+Te),P);if(Te<8){var $e=c(u(P,Te));V=V.mul($e).add(c(Ie))}else V=V.mul(j),V=V.add(c(Ie))}return V.unsigned=w,V}r.fromString=d;function f(C,w){return typeof C=="number"?c(C,w):typeof C=="string"?d(C,w):l(C.low,C.high,typeof w=="boolean"?w:C.unsigned)}r.fromValue=f;var p=65536,h=1<<24,m=p*p,_=m*m,y=_/2,v=a(h),S=a(0);r.ZERO=S;var g=a(0,!0);r.UZERO=g;var T=a(1);r.ONE=T;var I=a(1,!0);r.UONE=I;var x=a(-1);r.NEG_ONE=x;var R=l(-1,2147483647,!1);r.MAX_VALUE=R;var O=l(-1,-1,!0);r.MAX_UNSIGNED_VALUE=O;var A=l(0,-2147483648,!1);r.MIN_VALUE=A;var b=r.prototype;b.toInt=function(){return this.unsigned?this.low>>>0:this.low},b.toNumber=function(){return this.unsigned?(this.high>>>0)*m+(this.low>>>0):this.high*m+(this.low>>>0)},b.toString=function(w){if(w=w||10,w<2||36<w)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative())if(this.eq(A)){var P=c(w),N=this.div(P),j=N.mul(P).sub(this);return N.toString(w)+j.toInt().toString(w)}else return"-"+this.neg().toString(w);for(var V=c(u(w,6),this.unsigned),de=this,Te="";;){var Ie=de.div(V),$e=de.sub(Ie.mul(V)).toInt()>>>0,oe=$e.toString(w);if(de=Ie,de.isZero())return oe+Te;for(;oe.length<6;)oe="0"+oe;Te=""+oe+Te}},b.getHighBits=function(){return this.high},b.getHighBitsUnsigned=function(){return this.high>>>0},b.getLowBits=function(){return this.low},b.getLowBitsUnsigned=function(){return this.low>>>0},b.getNumBitsAbs=function(){if(this.isNegative())return this.eq(A)?64:this.neg().getNumBitsAbs();for(var w=this.high!=0?this.high:this.low,P=31;P>0&&(w&1<<P)==0;P--);return this.high!=0?P+33:P+1},b.isSafeInteger=function(){var w=this.high>>21;return w?this.unsigned?!1:w===-1&&!(this.low===0&&this.high===-2097152):!0},b.isZero=function(){return this.high===0&&this.low===0},b.eqz=b.isZero,b.isNegative=function(){return!this.unsigned&&this.high<0},b.isPositive=function(){return this.unsigned||this.high>=0},b.isOdd=function(){return(this.low&1)===1},b.isEven=function(){return(this.low&1)===0},b.equals=function(w){return n(w)||(w=f(w)),this.unsigned!==w.unsigned&&this.high>>>31===1&&w.high>>>31===1?!1:this.high===w.high&&this.low===w.low},b.eq=b.equals,b.notEquals=function(w){return!this.eq(w)},b.neq=b.notEquals,b.ne=b.notEquals,b.lessThan=function(w){return this.comp(w)<0},b.lt=b.lessThan,b.lessThanOrEqual=function(w){return this.comp(w)<=0},b.lte=b.lessThanOrEqual,b.le=b.lessThanOrEqual,b.greaterThan=function(w){return this.comp(w)>0},b.gt=b.greaterThan,b.greaterThanOrEqual=function(w){return this.comp(w)>=0},b.gte=b.greaterThanOrEqual,b.ge=b.greaterThanOrEqual,b.compare=function(w){if(n(w)||(w=f(w)),this.eq(w))return 0;var P=this.isNegative(),N=w.isNegative();return P&&!N?-1:!P&&N?1:this.unsigned?w.high>>>0>this.high>>>0||w.high===this.high&&w.low>>>0>this.low>>>0?-1:1:this.sub(w).isNegative()?-1:1},b.comp=b.compare,b.negate=function(){return!this.unsigned&&this.eq(A)?A:this.not().add(T)},b.neg=b.negate,b.add=function(w){n(w)||(w=f(w));var P=this.high>>>16,N=this.high&65535,j=this.low>>>16,V=this.low&65535,de=w.high>>>16,Te=w.high&65535,Ie=w.low>>>16,$e=w.low&65535,oe=0,Ee=0,he=0,k=0;return k+=V+$e,he+=k>>>16,k&=65535,he+=j+Ie,Ee+=he>>>16,he&=65535,Ee+=N+Te,oe+=Ee>>>16,Ee&=65535,oe+=P+de,oe&=65535,l(he<<16|k,oe<<16|Ee,this.unsigned)},b.subtract=function(w){return n(w)||(w=f(w)),this.add(w.neg())},b.sub=b.subtract,b.multiply=function(w){if(this.isZero())return this;if(n(w)||(w=f(w)),e){var P=e.mul(this.low,this.high,w.low,w.high);return l(P,e.get_high(),this.unsigned)}if(w.isZero())return this.unsigned?g:S;if(this.eq(A))return w.isOdd()?A:S;if(w.eq(A))return this.isOdd()?A:S;if(this.isNegative())return w.isNegative()?this.neg().mul(w.neg()):this.neg().mul(w).neg();if(w.isNegative())return this.mul(w.neg()).neg();if(this.lt(v)&&w.lt(v))return c(this.toNumber()*w.toNumber(),this.unsigned);var N=this.high>>>16,j=this.high&65535,V=this.low>>>16,de=this.low&65535,Te=w.high>>>16,Ie=w.high&65535,$e=w.low>>>16,oe=w.low&65535,Ee=0,he=0,k=0,U=0;return U+=de*oe,k+=U>>>16,U&=65535,k+=V*oe,he+=k>>>16,k&=65535,k+=de*$e,he+=k>>>16,k&=65535,he+=j*oe,Ee+=he>>>16,he&=65535,he+=V*$e,Ee+=he>>>16,he&=65535,he+=de*Ie,Ee+=he>>>16,he&=65535,Ee+=N*oe+j*$e+V*Ie+de*Te,Ee&=65535,l(k<<16|U,Ee<<16|he,this.unsigned)},b.mul=b.multiply,b.divide=function(w){if(n(w)||(w=f(w)),w.isZero())throw Error("division by zero");if(e){if(!this.unsigned&&this.high===-2147483648&&w.low===-1&&w.high===-1)return this;var P=(this.unsigned?e.div_u:e.div_s)(this.low,this.high,w.low,w.high);return l(P,e.get_high(),this.unsigned)}if(this.isZero())return this.unsigned?g:S;var N,j,V;if(this.unsigned){if(w.unsigned||(w=w.toUnsigned()),w.gt(this))return g;if(w.gt(this.shru(1)))return I;V=g}else{if(this.eq(A)){if(w.eq(T)||w.eq(x))return A;if(w.eq(A))return T;var de=this.shr(1);return N=de.div(w).shl(1),N.eq(S)?w.isNegative()?T:x:(j=this.sub(w.mul(N)),V=N.add(j.div(w)),V)}else if(w.eq(A))return this.unsigned?g:S;if(this.isNegative())return w.isNegative()?this.neg().div(w.neg()):this.neg().div(w).neg();if(w.isNegative())return this.div(w.neg()).neg();V=S}for(j=this;j.gte(w);){N=Math.max(1,Math.floor(j.toNumber()/w.toNumber()));for(var Te=Math.ceil(Math.log(N)/Math.LN2),Ie=Te<=48?1:u(2,Te-48),$e=c(N),oe=$e.mul(w);oe.isNegative()||oe.gt(j);)N-=Ie,$e=c(N,this.unsigned),oe=$e.mul(w);$e.isZero()&&($e=T),V=V.add($e),j=j.sub(oe)}return V},b.div=b.divide,b.modulo=function(w){if(n(w)||(w=f(w)),e){var P=(this.unsigned?e.rem_u:e.rem_s)(this.low,this.high,w.low,w.high);return l(P,e.get_high(),this.unsigned)}return this.sub(this.div(w).mul(w))},b.mod=b.modulo,b.rem=b.modulo,b.not=function(){return l(~this.low,~this.high,this.unsigned)},b.countLeadingZeros=function(){return this.high?Math.clz32(this.high):Math.clz32(this.low)+32},b.clz=b.countLeadingZeros,b.countTrailingZeros=function(){return this.low?i(this.low):i(this.high)+32},b.ctz=b.countTrailingZeros,b.and=function(w){return n(w)||(w=f(w)),l(this.low&w.low,this.high&w.high,this.unsigned)},b.or=function(w){return n(w)||(w=f(w)),l(this.low|w.low,this.high|w.high,this.unsigned)},b.xor=function(w){return n(w)||(w=f(w)),l(this.low^w.low,this.high^w.high,this.unsigned)},b.shiftLeft=function(w){return n(w)&&(w=w.toInt()),(w&=63)===0?this:w<32?l(this.low<<w,this.high<<w|this.low>>>32-w,this.unsigned):l(0,this.low<<w-32,this.unsigned)},b.shl=b.shiftLeft,b.shiftRight=function(w){return n(w)&&(w=w.toInt()),(w&=63)===0?this:w<32?l(this.low>>>w|this.high<<32-w,this.high>>w,this.unsigned):l(this.high>>w-32,this.high>=0?0:-1,this.unsigned)},b.shr=b.shiftRight,b.shiftRightUnsigned=function(w){return n(w)&&(w=w.toInt()),(w&=63)===0?this:w<32?l(this.low>>>w|this.high<<32-w,this.high>>>w,this.unsigned):w===32?l(this.high,0,this.unsigned):l(this.high>>>w-32,0,this.unsigned)},b.shru=b.shiftRightUnsigned,b.shr_u=b.shiftRightUnsigned,b.rotateLeft=function(w){var P;return n(w)&&(w=w.toInt()),(w&=63)===0?this:w===32?l(this.high,this.low,this.unsigned):w<32?(P=32-w,l(this.low<<w|this.high>>>P,this.high<<w|this.low>>>P,this.unsigned)):(w-=32,P=32-w,l(this.high<<w|this.low>>>P,this.low<<w|this.high>>>P,this.unsigned))},b.rotl=b.rotateLeft,b.rotateRight=function(w){var P;return n(w)&&(w=w.toInt()),(w&=63)===0?this:w===32?l(this.high,this.low,this.unsigned):w<32?(P=32-w,l(this.high<<P|this.low>>>w,this.low<<P|this.high>>>w,this.unsigned)):(w-=32,P=32-w,l(this.low<<P|this.high>>>w,this.high<<P|this.low>>>w,this.unsigned))},b.rotr=b.rotateRight,b.toSigned=function(){return this.unsigned?l(this.low,this.high,!1):this},b.toUnsigned=function(){return this.unsigned?this:l(this.low,this.high,!0)},b.toBytes=function(w){return w?this.toBytesLE():this.toBytesBE()},b.toBytesLE=function(){var w=this.high,P=this.low;return[P&255,P>>>8&255,P>>>16&255,P>>>24,w&255,w>>>8&255,w>>>16&255,w>>>24]},b.toBytesBE=function(){var w=this.high,P=this.low;return[w>>>24,w>>>16&255,w>>>8&255,w&255,P>>>24,P>>>16&255,P>>>8&255,P&255]},r.fromBytes=function(w,P,N){return N?r.fromBytesLE(w,P):r.fromBytesBE(w,P)},r.fromBytesLE=function(w,P){return new r(w[0]|w[1]<<8|w[2]<<16|w[3]<<24,w[4]|w[5]<<8|w[6]<<16|w[7]<<24,P)},r.fromBytesBE=function(w,P){return new r(w[4]<<24|w[5]<<16|w[6]<<8|w[7],w[0]<<24|w[1]<<16|w[2]<<8|w[3],P)},typeof BigInt=="function"&&(r.fromBigInt=function(w,P){var N=Number(BigInt.asIntN(32,w)),j=Number(BigInt.asIntN(32,w>>BigInt(32)));return l(N,j,P)},r.fromValue=function(w,P){return typeof w=="bigint"?r.fromBigInt(w,P):f(w,P)},b.toBigInt=function(){var w=BigInt(this.low>>>0),P=BigInt(this.unsigned?this.high>>>0:this.high);return P<<BigInt(32)|w});var L=t.default=r})});var mo=E(m5=>{"use strict";var Le=m5;Le.asPromise=u5();Le.base64=GPe();Le.EventEmitter=YPe();Le.float=tCe();Le.inquire=nCe();Le.utf8=sCe();Le.pool=aCe();Le.LongBits=lCe();function uCe(t){return t==="__proto__"||t==="prototype"||t==="constructor"}Le.isUnsafeProperty=uCe;Le.isNode=!!(typeof global<"u"&&global&&global.process&&global.process.versions&&global.process.versions.node);Le.global=Le.isNode&&global||typeof window<"u"&&window||typeof self<"u"&&self||m5;Le.emptyArray=Object.freeze?Object.freeze([]):[];Le.emptyObject=Object.freeze?Object.freeze({}):{};Le.isInteger=Number.isInteger||function(e){return typeof e=="number"&&isFinite(e)&&Math.floor(e)===e};Le.isString=function(e){return typeof e=="string"||e instanceof String};Le.isObject=function(e){return e&&typeof e=="object"};Le.isset=Le.isSet=function(e,r){var n=e[r];return n!=null&&e.hasOwnProperty(r)?typeof n!="object"||(Array.isArray(n)?n.length:Object.keys(n).length)>0:!1};Le.Buffer=(function(){try{var t=Le.global.Buffer;return t.prototype.utf8Write?t:null}catch{return null}})();Le._Buffer_from=null;Le._Buffer_allocUnsafe=null;Le.newBuffer=function(e){return typeof e=="number"?Le.Buffer?Le._Buffer_allocUnsafe(e):new Le.Array(e):Le.Buffer?Le._Buffer_from(e):typeof Uint8Array>"u"?e:new Uint8Array(e)};Le.Array=typeof Uint8Array<"u"?Uint8Array:Array;Le.Long=Le.global.dcodeIO&&Le.global.dcodeIO.Long||Le.global.Long||(function(){try{var t=h5();return t&&t.isLong?t:null}catch{return null}})();Le.key2Re=/^true|false|0|1$/;Le.key32Re=/^-?(?:0|[1-9][0-9]*)$/;Le.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/;Le.longToHash=function(e){return e?Le.LongBits.from(e).toHash():Le.LongBits.zeroHash};Le.longFromHash=function(e,r){var n=Le.LongBits.fromHash(e);return Le.Long?Le.Long.fromBits(n.lo,n.hi,r):n.toNumber(!!r)};function dCe(t){var e=typeof arguments[arguments.length-1]=="boolean",r=e?arguments.length-1:arguments.length;e=e&&arguments[arguments.length-1];for(var n=1;n<r;++n){var i=arguments[n];if(i)for(var s=Object.keys(i),o=0;o<s.length;++o)!uCe(s[o])&&(t[s[o]]===void 0||!e)&&(t[s[o]]=i[s[o]])}return t}Le.merge=dCe;Le.nestingLimit=32;Le.recursionLimit=100;Le.makeProp=function(e,r){Object.defineProperty(e,r,{enumerable:!0,configurable:!0,writable:!0})};Le.lcFirst=function(e){return e.charAt(0).toLowerCase()+e.substring(1)};function fCe(t){function e(r,n){if(!(this instanceof e))return new e(r,n);Object.defineProperty(this,"message",{get:function(){return r}}),Error.captureStackTrace?Error.captureStackTrace(this,e):Object.defineProperty(this,"stack",{value:new Error().stack||""}),n&&dCe(this,n)}return e.prototype=Object.create(Error.prototype,{constructor:{value:e,writable:!0,enumerable:!1,configurable:!0},name:{get:function(){return t},set:void 0,enumerable:!1,configurable:!0},toString:{value:function(){return this.name+": "+this.message},writable:!0,enumerable:!1,configurable:!0}}),e}Le.newError=fCe;Le.ProtocolError=fCe("ProtocolError");Le.oneOfGetter=function(e){for(var r={},n=0;n<e.length;++n)r[e[n]]=1;return function(){for(var i=Object.keys(this),s=i.length-1;s>-1;--s)if(r[i[s]]===1&&this[i[s]]!==void 0&&this[i[s]]!==null)return i[s]}};Le.oneOfSetter=function(e){return function(r){for(var n=0;n<e.length;++n)e[n]!==r&&delete this[e[n]]}};Le.toJSONOptions={longs:String,enums:String,bytes:String,json:!0};Le._configure=function(){var t=Le.Buffer;if(!t){Le._Buffer_from=Le._Buffer_allocUnsafe=null;return}Le._Buffer_from=t.from!==Uint8Array.from&&t.from||function(r,n){return new t(r,n)},Le._Buffer_allocUnsafe=t.allocUnsafe||function(r){return new t(r)}}});var E$=E((Iwr,gCe)=>{"use strict";gCe.exports=St;var Ps=mo(),g5,S$=Ps.LongBits,pCe=Ps.base64,hCe=Ps.utf8;function iw(t,e,r){this.fn=t,this.len=e,this.next=void 0,this.val=r}function y5(){}function Axt(t){this.head=t.head,this.tail=t.tail,this.len=t.len,this.next=t.states}function St(){this.len=0,this.head=new iw(y5,0,0),this.tail=this.head,this.states=null}var mCe=function(){return Ps.Buffer?function(){return(St.create=function(){return new g5})()}:function(){return new St}};St.create=mCe();St.alloc=function(e){return new Ps.Array(e)};Ps.Array!==Array&&(St.alloc=Ps.pool(St.alloc,Ps.Array.prototype.subarray));St.prototype._push=function(e,r,n){return this.tail=this.tail.next=new iw(e,r,n),this.len+=r,this};function S5(t,e,r){e[r]=t&255}function Rxt(t,e,r){for(;t>127;)e[r++]=t&127|128,t>>>=7;e[r]=t}function E5(t,e){this.len=t,this.next=void 0,this.val=e}E5.prototype=Object.create(iw.prototype);E5.prototype.fn=Rxt;St.prototype.uint32=function(e){return this.len+=(this.tail=this.tail.next=new E5((e=e>>>0)<128?1:e<16384?2:e<2097152?3:e<268435456?4:5,e)).len,this};St.prototype.int32=function(e){return(e|=0)<0?this._push(v5,10,S$.fromNumber(e)):this.uint32(e)};St.prototype.sint32=function(e){return this.uint32((e<<1^e>>31)>>>0)};function v5(t,e,r){for(var n=t.lo,i=t.hi;i;)e[r++]=n&127|128,n=(n>>>7|i<<25)>>>0,i>>>=7;for(;n>127;)e[r++]=n&127|128,n=n>>>7;e[r++]=n}St.prototype.uint64=function(e){var r=S$.from(e);return this._push(v5,r.length(),r)};St.prototype.int64=St.prototype.uint64;St.prototype.sint64=function(e){var r=S$.from(e).zzEncode();return this._push(v5,r.length(),r)};St.prototype.bool=function(e){return this._push(S5,1,e?1:0)};function _5(t,e,r){e[r]=t&255,e[r+1]=t>>>8&255,e[r+2]=t>>>16&255,e[r+3]=t>>>24}St.prototype.fixed32=function(e){return this._push(_5,4,e>>>0)};St.prototype.sfixed32=St.prototype.fixed32;St.prototype.fixed64=function(e){var r=S$.from(e);return this._push(_5,4,r.lo)._push(_5,4,r.hi)};St.prototype.sfixed64=St.prototype.fixed64;St.prototype.float=function(e){return this._push(Ps.float.writeFloatLE,4,e)};St.prototype.double=function(e){return this._push(Ps.float.writeDoubleLE,8,e)};var xxt=Ps.Array.prototype.set?function(e,r,n){r.set(e,n)}:function(e,r,n){for(var i=0;i<e.length;++i)r[n+i]=e[i]};St.prototype.bytes=function(e){var r=e.length>>>0;if(!r)return this._push(S5,1,0);if(Ps.isString(e)){var n=St.alloc(r=pCe.length(e));pCe.decode(e,n,0),e=n}return this.uint32(r)._push(xxt,r,e)};St.prototype.string=function(e){var r=hCe.length(e);return r?this.uint32(r)._push(hCe.write,r,e):this._push(S5,1,0)};St.prototype.fork=function(){return this.states=new Axt(this),this.head=this.tail=new iw(y5,0,0),this.len=0,this};St.prototype.reset=function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new iw(y5,0,0),this.len=0),this};St.prototype.ldelim=function(){var e=this.head,r=this.tail,n=this.len;return this.reset().uint32(n),n&&(this.tail.next=e.next,this.tail=r,this.len+=n),this};St.prototype.finish=function(){for(var e=this.head.next,r=this.constructor.alloc(this.len),n=0;e;)e.fn(e.val,r,n),n+=e.len,e=e.next;return r};St._configure=function(t){g5=t,St.create=mCe(),g5._configure()}});var SCe=E((Owr,yCe)=>{"use strict";yCe.exports=Sa;var _Ce=E$();(Sa.prototype=Object.create(_Ce.prototype)).constructor=Sa;var Bu=mo();function Sa(){_Ce.call(this)}Sa._configure=function(){Sa.alloc=Bu._Buffer_allocUnsafe,Sa.writeBytesBuffer=Bu.Buffer&&Bu.Buffer.prototype instanceof Uint8Array&&Bu.Buffer.prototype.set.name==="set"?function(e,r,n){r.set(e,n)}:function(e,r,n){if(e.copy)e.copy(r,n,0,e.length);else for(var i=0;i<e.length;)r[n++]=e[i++]}};Sa.prototype.bytes=function(e){Bu.isString(e)&&(e=Bu._Buffer_from(e,"base64"));var r=e.length>>>0;return this.uint32(r),r&&this._push(Sa.writeBytesBuffer,r,e),this};function Ixt(t,e,r){t.length<40?Bu.utf8.write(t,e,r):e.utf8Write?e.utf8Write(t,r):e.write(t,r)}Sa.prototype.string=function(e){var r=Bu.Buffer.byteLength(e);return this.uint32(r),r&&this._push(Ixt,r,e),this};Sa._configure()});var b$=E((Pwr,wCe)=>{"use strict";wCe.exports=sr;var Cs=mo(),T5,bCe=Cs.LongBits,Oxt=Cs.utf8;function go(t,e){return RangeError("index out of range: "+t.pos+" + "+(e||1)+" > "+t.len)}function sr(t){this.buf=t,this.pos=0,this.len=t.length}var ECe=typeof Uint8Array<"u"?function(e){if(e instanceof Uint8Array||Array.isArray(e))return new sr(e);throw Error("illegal buffer")}:function(e){if(Array.isArray(e))return new sr(e);throw Error("illegal buffer")},TCe=function(){return Cs.Buffer?function(r){return(sr.create=function(i){return Cs.Buffer.isBuffer(i)?new T5(i):ECe(i)})(r)}:ECe};sr.create=TCe();sr.prototype._slice=Cs.Array.prototype.subarray||Cs.Array.prototype.slice;sr.prototype.uint32=(function(){var e=4294967295;return function(){if(e=(this.buf[this.pos]&127)>>>0,this.buf[this.pos++]<128||(e=(e|(this.buf[this.pos]&127)<<7)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&127)<<14)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&127)<<21)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&15)<<28)>>>0,this.buf[this.pos++]<128))return e;if((this.pos+=5)>this.len)throw this.pos=this.len,go(this,10);return e}})();sr.prototype.int32=function(){return this.uint32()|0};sr.prototype.sint32=function(){var e=this.uint32();return e>>>1^-(e&1)|0};function b5(){var t=new bCe(0,0),e=0;if(this.len-this.pos>4){for(;e<4;++e)if(t.lo=(t.lo|(this.buf[this.pos]&127)<<e*7)>>>0,this.buf[this.pos++]<128)return t;if(t.lo=(t.lo|(this.buf[this.pos]&127)<<28)>>>0,t.hi=(t.hi|(this.buf[this.pos]&127)>>4)>>>0,this.buf[this.pos++]<128)return t;e=0}else{for(;e<3;++e){if(this.pos>=this.len)throw go(this);if(t.lo=(t.lo|(this.buf[this.pos]&127)<<e*7)>>>0,this.buf[this.pos++]<128)return t}return t.lo=(t.lo|(this.buf[this.pos++]&127)<<e*7)>>>0,t}if(this.len-this.pos>4){for(;e<5;++e)if(t.hi=(t.hi|(this.buf[this.pos]&127)<<e*7+3)>>>0,this.buf[this.pos++]<128)return t}else for(;e<5;++e){if(this.pos>=this.len)throw go(this);if(t.hi=(t.hi|(this.buf[this.pos]&127)<<e*7+3)>>>0,this.buf[this.pos++]<128)return t}throw Error("invalid varint encoding")}sr.prototype.bool=function(){return this.uint32()!==0};function v$(t,e){return(t[e-4]|t[e-3]<<8|t[e-2]<<16|t[e-1]<<24)>>>0}sr.prototype.fixed32=function(){if(this.pos+4>this.len)throw go(this,4);return v$(this.buf,this.pos+=4)};sr.prototype.sfixed32=function(){if(this.pos+4>this.len)throw go(this,4);return v$(this.buf,this.pos+=4)|0};function vCe(){if(this.pos+8>this.len)throw go(this,8);return new bCe(v$(this.buf,this.pos+=4),v$(this.buf,this.pos+=4))}sr.prototype.float=function(){if(this.pos+4>this.len)throw go(this,4);var e=Cs.float.readFloatLE(this.buf,this.pos);return this.pos+=4,e};sr.prototype.double=function(){if(this.pos+8>this.len)throw go(this,4);var e=Cs.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,e};sr.prototype.bytes=function(){var e=this.uint32(),r=this.pos,n=this.pos+e;if(n>this.len)throw go(this,e);if(this.pos+=e,Array.isArray(this.buf))return this.buf.slice(r,n);if(r===n){var i=Cs.Buffer;return i?i.alloc(0):new this.buf.constructor(0)}return this._slice.call(this.buf,r,n)};sr.prototype.string=function(){var e=this.bytes();return Oxt.read(e,0,e.length)};sr.prototype.skip=function(e){if(typeof e=="number"){if(this.pos+e>this.len)throw go(this,e);this.pos+=e}else do if(this.pos>=this.len)throw go(this);while(this.buf[this.pos++]&128);return this};sr.recursionLimit=Cs.recursionLimit;sr.prototype.skipType=function(t,e){if(e===void 0&&(e=0),e>sr.recursionLimit)throw Error("maximum nesting depth exceeded");switch(t){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;(t=this.uint32()&7)!==4;)this.skipType(t,e+1);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+t+" at offset "+this.pos)}return this};sr._configure=function(t){T5=t,sr.create=TCe(),T5._configure();var e=Cs.Long?"toLong":"toNumber";Cs.merge(sr.prototype,{int64:function(){return b5.call(this)[e](!1)},uint64:function(){return b5.call(this)[e](!0)},sint64:function(){return b5.call(this).zzDecode()[e](!1)},fixed64:function(){return vCe.call(this)[e](!0)},sfixed64:function(){return vCe.call(this)[e](!1)}})}});var ICe=E((Cwr,xCe)=>{"use strict";xCe.exports=hp;var RCe=b$();(hp.prototype=Object.create(RCe.prototype)).constructor=hp;var ACe=mo();function hp(t){RCe.call(this,t)}hp._configure=function(){ACe.Buffer&&(hp.prototype._slice=ACe.Buffer.prototype.slice)};hp.prototype.string=function(){var e=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+e,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+e,this.len))};hp._configure()});var PCe=E((Nwr,OCe)=>{"use strict";OCe.exports=sw;var w5=mo();(sw.prototype=Object.create(w5.EventEmitter.prototype)).constructor=sw;function sw(t,e,r){if(typeof t!="function")throw TypeError("rpcImpl must be a function");w5.EventEmitter.call(this),this.rpcImpl=t,this.requestDelimited=!!e,this.responseDelimited=!!r}sw.prototype.rpcCall=function t(e,r,n,i,s){if(!i)throw TypeError("request must be specified");var o=this;if(!s)return w5.asPromise(t,o,e,r,n,i);if(!o.rpcImpl){setTimeout(function(){s(Error("already ended"))},0);return}try{return o.rpcImpl(e,r[o.requestDelimited?"encodeDelimited":"encode"](i).finish(),function(c,l){if(c)return o.emit("error",c,e),s(c);if(l===null){o.end(!0);return}if(!(l instanceof n))try{l=n[o.responseDelimited?"decodeDelimited":"decode"](l)}catch(u){return o.emit("error",u,e),s(u)}return o.emit("data",l,e),s(null,l)})}catch(a){o.emit("error",a,e),setTimeout(function(){s(a)},0);return}};sw.prototype.end=function(e){return this.rpcImpl&&(e||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}});var A5=E(CCe=>{"use strict";var Pxt=CCe;Pxt.Service=PCe()});var R5=E(($wr,NCe)=>{"use strict";NCe.exports={}});var LCe=E($Ce=>{"use strict";var wi=$Ce;wi.build="minimal";wi.Writer=E$();wi.BufferWriter=SCe();wi.Reader=b$();wi.BufferReader=ICe();wi.util=mo();wi.rpc=A5();wi.roots=R5();wi.configure=kCe;function kCe(){wi.util._configure(),wi.Writer._configure(wi.BufferWriter),wi.Reader._configure(wi.BufferReader)}kCe()});var MCe=E((Dwr,DCe)=>{"use strict";DCe.exports=x5;var Cxt=/^(?:do|if|in|for|let|new|try|var|case|else|enum|eval|false|null|this|true|void|with|break|catch|class|const|super|throw|while|yield|delete|export|import|public|return|static|switch|typeof|default|extends|finally|package|private|continue|debugger|function|arguments|interface|protected|implements|instanceof)$/;function x5(t,e){typeof t=="string"&&(e=t,t=void 0);var r=[];function n(s){if(typeof s!="string"){var o=i();if(x5.verbose&&console.log("codegen: "+o),o="return "+o,s){for(var a=Object.keys(s),c=new Array(a.length+1),l=new Array(a.length),u=0;u<a.length;)c[u]=a[u],l[u]=s[a[u++]];return c[u]=o,Function.apply(null,c).apply(null,l)}return Function(o)()}for(var d=new Array(arguments.length-1),f=0;f<d.length;)d[f]=arguments[++f];if(f=0,s=s.replace(/%([%dfijs])/g,function(h,m){var _=d[f++];switch(m){case"d":case"f":return String(Number(_));case"i":return String(Math.floor(_));case"j":return JSON.stringify(_);case"s":return String(_)}return"%"}),f!==d.length)throw Error("parameter count mismatch");return r.push(s),n}function i(s){return"function "+Nxt(s||e)+"("+(t&&t.join(",")||"")+`){
376
+ `))||"no stack trace available"}var r5=class{constructor(e,r,n={}){var i,s;if(n=Object.assign({},n),this[N_]=(i=n.interceptors)!==null&&i!==void 0?i:[],delete n.interceptors,this[k_]=(s=n.interceptor_providers)!==null&&s!==void 0?s:[],delete n.interceptor_providers,this[N_].length>0&&this[k_].length>0)throw new Error("Both interceptors and interceptor_providers were passed as options to the client constructor. Only one of these is allowed.");if(this[Bc]=n.callInvocationTransformer,delete n.callInvocationTransformer,n.channelOverride)this[po]=n.channelOverride;else if(n.channelFactoryOverride){let o=n.channelFactoryOverride;delete n.channelFactoryOverride,this[po]=o(e,r,n)}else this[po]=new vRt.ChannelImplementation(e,r,n)}close(){this[po].close()}getChannel(){return this[po]}waitForReady(e,r){let n=i=>{if(i){r(new Error("Failed to connect before the deadline"));return}let s;try{s=this[po].getConnectivityState(!0)}catch{r(new Error("The channel has been closed"));return}if(s===bRt.ConnectivityState.READY)r();else try{this[po].watchConnectivityState(s,e,n)}catch{r(new Error("The channel has been closed"))}};setImmediate(n)}checkOptionalUnaryResponseArguments(e,r,n){if(t5(e))return{metadata:new C_.Metadata,options:{},callback:e};if(t5(r))return e instanceof C_.Metadata?{metadata:e,options:{},callback:r}:{metadata:new C_.Metadata,options:e,callback:r};if(!(e instanceof C_.Metadata&&r instanceof Object&&t5(n)))throw new Error("Incorrect arguments passed");return{metadata:e,options:r,callback:n}}makeUnaryRequest(e,r,n,i,s,o,a){var c,l;let u=this.checkOptionalUnaryResponseArguments(s,o,a),d={path:e,requestStream:!1,responseStream:!1,requestSerialize:r,responseDeserialize:n},f={argument:i,metadata:u.metadata,call:new ya.ClientUnaryCallImpl,channel:this[po],methodDefinition:d,callOptions:u.options,callback:u.callback};this[Bc]&&(f=this[Bc](f));let p=f.call,h={clientInterceptors:this[N_],clientInterceptorProviders:this[k_],callInterceptors:(c=f.callOptions.interceptors)!==null&&c!==void 0?c:[],callInterceptorProviders:(l=f.callOptions.interceptor_providers)!==null&&l!==void 0?l:[]},m=(0,u$.getInterceptingCall)(h,f.methodDefinition,f.callOptions,f.channel);p.call=m;let _=null,y=!1,v=new Error;return m.start(f.metadata,{onReceiveMetadata:S=>{p.emit("metadata",S)},onReceiveMessage(S){_!==null&&m.cancelWithStatus(ju.Status.UNIMPLEMENTED,"Too many responses received"),_=S},onReceiveStatus(S){if(!y){if(y=!0,S.code===ju.Status.OK)if(_===null){let g=$_(v);f.callback((0,ya.callErrorFromStatus)({code:ju.Status.UNIMPLEMENTED,details:"No message received",metadata:S.metadata},g))}else f.callback(null,_);else{let g=$_(v);f.callback((0,ya.callErrorFromStatus)(S,g))}v=null,p.emit("status",S)}}}),m.sendMessage(i),m.halfClose(),p}makeClientStreamRequest(e,r,n,i,s,o){var a,c;let l=this.checkOptionalUnaryResponseArguments(i,s,o),u={path:e,requestStream:!0,responseStream:!1,requestSerialize:r,responseDeserialize:n},d={metadata:l.metadata,call:new ya.ClientWritableStreamImpl(r),channel:this[po],methodDefinition:u,callOptions:l.options,callback:l.callback};this[Bc]&&(d=this[Bc](d));let f=d.call,p={clientInterceptors:this[N_],clientInterceptorProviders:this[k_],callInterceptors:(a=d.callOptions.interceptors)!==null&&a!==void 0?a:[],callInterceptorProviders:(c=d.callOptions.interceptor_providers)!==null&&c!==void 0?c:[]},h=(0,u$.getInterceptingCall)(p,d.methodDefinition,d.callOptions,d.channel);f.call=h;let m=null,_=!1,y=new Error;return h.start(d.metadata,{onReceiveMetadata:v=>{f.emit("metadata",v)},onReceiveMessage(v){m!==null&&h.cancelWithStatus(ju.Status.UNIMPLEMENTED,"Too many responses received"),m=v,h.startRead()},onReceiveStatus(v){if(!_){if(_=!0,v.code===ju.Status.OK)if(m===null){let S=$_(y);d.callback((0,ya.callErrorFromStatus)({code:ju.Status.UNIMPLEMENTED,details:"No message received",metadata:v.metadata},S))}else d.callback(null,m);else{let S=$_(y);d.callback((0,ya.callErrorFromStatus)(v,S))}y=null,f.emit("status",v)}}}),f}checkMetadataAndOptions(e,r){let n,i;return e instanceof C_.Metadata?(n=e,r?i=r:i={}):(e?i=e:i={},n=new C_.Metadata),{metadata:n,options:i}}makeServerStreamRequest(e,r,n,i,s,o){var a,c;let l=this.checkMetadataAndOptions(s,o),u={path:e,requestStream:!1,responseStream:!0,requestSerialize:r,responseDeserialize:n},d={argument:i,metadata:l.metadata,call:new ya.ClientReadableStreamImpl(n),channel:this[po],methodDefinition:u,callOptions:l.options};this[Bc]&&(d=this[Bc](d));let f=d.call,p={clientInterceptors:this[N_],clientInterceptorProviders:this[k_],callInterceptors:(a=d.callOptions.interceptors)!==null&&a!==void 0?a:[],callInterceptorProviders:(c=d.callOptions.interceptor_providers)!==null&&c!==void 0?c:[]},h=(0,u$.getInterceptingCall)(p,d.methodDefinition,d.callOptions,d.channel);f.call=h;let m=!1,_=new Error;return h.start(d.metadata,{onReceiveMetadata(y){f.emit("metadata",y)},onReceiveMessage(y){f.push(y)},onReceiveStatus(y){if(!m){if(m=!0,f.push(null),y.code!==ju.Status.OK){let v=$_(_);f.emit("error",(0,ya.callErrorFromStatus)(y,v))}_=null,f.emit("status",y)}}}),h.sendMessage(i),h.halfClose(),f}makeBidiStreamRequest(e,r,n,i,s){var o,a;let c=this.checkMetadataAndOptions(i,s),l={path:e,requestStream:!0,responseStream:!0,requestSerialize:r,responseDeserialize:n},u={metadata:c.metadata,call:new ya.ClientDuplexStreamImpl(r,n),channel:this[po],methodDefinition:l,callOptions:c.options};this[Bc]&&(u=this[Bc](u));let d=u.call,f={clientInterceptors:this[N_],clientInterceptorProviders:this[k_],callInterceptors:(o=u.callOptions.interceptors)!==null&&o!==void 0?o:[],callInterceptorProviders:(a=u.callOptions.interceptor_providers)!==null&&a!==void 0?a:[]},p=(0,u$.getInterceptingCall)(f,u.methodDefinition,u.callOptions,u.channel);d.call=p;let h=!1,m=new Error;return p.start(u.metadata,{onReceiveMetadata(_){d.emit("metadata",_)},onReceiveMessage(_){d.push(_)},onReceiveStatus(_){if(!h){if(h=!0,d.push(null),_.code!==ju.Status.OK){let y=$_(m);d.emit("error",(0,ya.callErrorFromStatus)(_,y))}m=null,d.emit("status",_)}}}),d}};d$.Client=r5});var p$=E(f$=>{"use strict";Object.defineProperty(f$,"__esModule",{value:!0});f$.makeClientConstructor=gPe;f$.loadPackageDefinition=RRt;var tw=n5(),TRt={unary:tw.Client.prototype.makeUnaryRequest,server_stream:tw.Client.prototype.makeServerStreamRequest,client_stream:tw.Client.prototype.makeClientStreamRequest,bidi:tw.Client.prototype.makeBidiStreamRequest};function s5(t){return["__proto__","prototype","constructor"].includes(t)}function gPe(t,e,r){r||(r={});class n extends tw.Client{}return Object.keys(t).forEach(i=>{if(s5(i))return;let s=t[i],o;if(typeof i=="string"&&i.charAt(0)==="$")throw new Error("Method names cannot start with $");s.requestStream?s.responseStream?o="bidi":o="client_stream":s.responseStream?o="server_stream":o="unary";let a=s.requestSerialize,c=s.responseDeserialize,l=wRt(TRt[o],s.path,a,c);n.prototype[i]=l,Object.assign(n.prototype[i],s),s.originalName&&!s5(s.originalName)&&(n.prototype[s.originalName]=n.prototype[i])}),n.service=t,n.serviceName=e,n}function wRt(t,e,r,n){return function(...i){return t.call(this,e,r,n,...i)}}function ARt(t){return"format"in t}function RRt(t){let e={};for(let r in t)if(Object.prototype.hasOwnProperty.call(t,r)){let n=t[r],i=r.split(".");if(i.some(a=>s5(a)))continue;let s=i[i.length-1],o=e;for(let a of i.slice(0,-1))o[a]||(o[a]={}),o=o[a];ARt(n)?o[s]=n:o[s]=gPe(n,s,{})}return e}});var qPe=E((_wr,jPe)=>{"use strict";var xRt=1/0,IRt="[object Symbol]",ORt=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,PRt=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,m$="\\ud800-\\udfff",wPe="\\u0300-\\u036f\\ufe20-\\ufe23",APe="\\u20d0-\\u20f0",RPe="\\u2700-\\u27bf",xPe="a-z\\xdf-\\xf6\\xf8-\\xff",CRt="\\xac\\xb1\\xd7\\xf7",NRt="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",kRt="\\u2000-\\u206f",$Rt=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",IPe="A-Z\\xc0-\\xd6\\xd8-\\xde",OPe="\\ufe0e\\ufe0f",PPe=CRt+NRt+kRt+$Rt,a5="['\u2019]",LRt="["+m$+"]",_Pe="["+PPe+"]",h$="["+wPe+APe+"]",CPe="\\d+",DRt="["+RPe+"]",NPe="["+xPe+"]",kPe="[^"+m$+PPe+CPe+RPe+xPe+IPe+"]",o5="\\ud83c[\\udffb-\\udfff]",MRt="(?:"+h$+"|"+o5+")",$Pe="[^"+m$+"]",c5="(?:\\ud83c[\\udde6-\\uddff]){2}",l5="[\\ud800-\\udbff][\\udc00-\\udfff]",L_="["+IPe+"]",LPe="\\u200d",yPe="(?:"+NPe+"|"+kPe+")",URt="(?:"+L_+"|"+kPe+")",SPe="(?:"+a5+"(?:d|ll|m|re|s|t|ve))?",EPe="(?:"+a5+"(?:D|LL|M|RE|S|T|VE))?",DPe=MRt+"?",MPe="["+OPe+"]?",FRt="(?:"+LPe+"(?:"+[$Pe,c5,l5].join("|")+")"+MPe+DPe+")*",UPe=MPe+DPe+FRt,jRt="(?:"+[DRt,c5,l5].join("|")+")"+UPe,qRt="(?:"+[$Pe+h$+"?",h$,c5,l5,LRt].join("|")+")",BRt=RegExp(a5,"g"),zRt=RegExp(h$,"g"),VRt=RegExp(o5+"(?="+o5+")|"+qRt+UPe,"g"),HRt=RegExp([L_+"?"+NPe+"+"+SPe+"(?="+[_Pe,L_,"$"].join("|")+")",URt+"+"+EPe+"(?="+[_Pe,L_+yPe,"$"].join("|")+")",L_+"?"+yPe+"+"+SPe,L_+"+"+EPe,CPe,jRt].join("|"),"g"),GRt=RegExp("["+LPe+m$+wPe+APe+OPe+"]"),WRt=/[a-z][A-Z]|[A-Z]{2,}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,YRt={\u00C0:"A",\u00C1:"A",\u00C2:"A",\u00C3:"A",\u00C4:"A",\u00C5:"A",\u00E0:"a",\u00E1:"a",\u00E2:"a",\u00E3:"a",\u00E4:"a",\u00E5:"a",\u00C7:"C",\u00E7:"c",\u00D0:"D",\u00F0:"d",\u00C8:"E",\u00C9:"E",\u00CA:"E",\u00CB:"E",\u00E8:"e",\u00E9:"e",\u00EA:"e",\u00EB:"e",\u00CC:"I",\u00CD:"I",\u00CE:"I",\u00CF:"I",\u00EC:"i",\u00ED:"i",\u00EE:"i",\u00EF:"i",\u00D1:"N",\u00F1:"n",\u00D2:"O",\u00D3:"O",\u00D4:"O",\u00D5:"O",\u00D6:"O",\u00D8:"O",\u00F2:"o",\u00F3:"o",\u00F4:"o",\u00F5:"o",\u00F6:"o",\u00F8:"o",\u00D9:"U",\u00DA:"U",\u00DB:"U",\u00DC:"U",\u00F9:"u",\u00FA:"u",\u00FB:"u",\u00FC:"u",\u00DD:"Y",\u00FD:"y",\u00FF:"y",\u00C6:"Ae",\u00E6:"ae",\u00DE:"Th",\u00FE:"th",\u00DF:"ss",\u0100:"A",\u0102:"A",\u0104:"A",\u0101:"a",\u0103:"a",\u0105:"a",\u0106:"C",\u0108:"C",\u010A:"C",\u010C:"C",\u0107:"c",\u0109:"c",\u010B:"c",\u010D:"c",\u010E:"D",\u0110:"D",\u010F:"d",\u0111:"d",\u0112:"E",\u0114:"E",\u0116:"E",\u0118:"E",\u011A:"E",\u0113:"e",\u0115:"e",\u0117:"e",\u0119:"e",\u011B:"e",\u011C:"G",\u011E:"G",\u0120:"G",\u0122:"G",\u011D:"g",\u011F:"g",\u0121:"g",\u0123:"g",\u0124:"H",\u0126:"H",\u0125:"h",\u0127:"h",\u0128:"I",\u012A:"I",\u012C:"I",\u012E:"I",\u0130:"I",\u0129:"i",\u012B:"i",\u012D:"i",\u012F:"i",\u0131:"i",\u0134:"J",\u0135:"j",\u0136:"K",\u0137:"k",\u0138:"k",\u0139:"L",\u013B:"L",\u013D:"L",\u013F:"L",\u0141:"L",\u013A:"l",\u013C:"l",\u013E:"l",\u0140:"l",\u0142:"l",\u0143:"N",\u0145:"N",\u0147:"N",\u014A:"N",\u0144:"n",\u0146:"n",\u0148:"n",\u014B:"n",\u014C:"O",\u014E:"O",\u0150:"O",\u014D:"o",\u014F:"o",\u0151:"o",\u0154:"R",\u0156:"R",\u0158:"R",\u0155:"r",\u0157:"r",\u0159:"r",\u015A:"S",\u015C:"S",\u015E:"S",\u0160:"S",\u015B:"s",\u015D:"s",\u015F:"s",\u0161:"s",\u0162:"T",\u0164:"T",\u0166:"T",\u0163:"t",\u0165:"t",\u0167:"t",\u0168:"U",\u016A:"U",\u016C:"U",\u016E:"U",\u0170:"U",\u0172:"U",\u0169:"u",\u016B:"u",\u016D:"u",\u016F:"u",\u0171:"u",\u0173:"u",\u0174:"W",\u0175:"w",\u0176:"Y",\u0177:"y",\u0178:"Y",\u0179:"Z",\u017B:"Z",\u017D:"Z",\u017A:"z",\u017C:"z",\u017E:"z",\u0132:"IJ",\u0133:"ij",\u0152:"Oe",\u0153:"oe",\u0149:"'n",\u017F:"ss"},KRt=typeof global=="object"&&global&&global.Object===Object&&global,JRt=typeof self=="object"&&self&&self.Object===Object&&self,ZRt=KRt||JRt||Function("return this")();function XRt(t,e,r,n){var i=-1,s=t?t.length:0;for(n&&s&&(r=t[++i]);++i<s;)r=e(r,t[i],i,t);return r}function QRt(t){return t.split("")}function ext(t){return t.match(ORt)||[]}function txt(t){return function(e){return t?.[e]}}var rxt=txt(YRt);function FPe(t){return GRt.test(t)}function nxt(t){return WRt.test(t)}function ixt(t){return FPe(t)?sxt(t):QRt(t)}function sxt(t){return t.match(VRt)||[]}function oxt(t){return t.match(HRt)||[]}var axt=Object.prototype,cxt=axt.toString,vPe=ZRt.Symbol,bPe=vPe?vPe.prototype:void 0,TPe=bPe?bPe.toString:void 0;function lxt(t,e,r){var n=-1,i=t.length;e<0&&(e=-e>i?0:i+e),r=r>i?i:r,r<0&&(r+=i),i=e>r?0:r-e>>>0,e>>>=0;for(var s=Array(i);++n<i;)s[n]=t[n+e];return s}function uxt(t){if(typeof t=="string")return t;if(mxt(t))return TPe?TPe.call(t):"";var e=t+"";return e=="0"&&1/t==-xRt?"-0":e}function dxt(t,e,r){var n=t.length;return r=r===void 0?n:r,!e&&r>=n?t:lxt(t,e,r)}function fxt(t){return function(e){e=g$(e);var r=FPe(e)?ixt(e):void 0,n=r?r[0]:e.charAt(0),i=r?dxt(r,1).join(""):e.slice(1);return n[t]()+i}}function pxt(t){return function(e){return XRt(Ext(yxt(e).replace(BRt,"")),t,"")}}function hxt(t){return!!t&&typeof t=="object"}function mxt(t){return typeof t=="symbol"||hxt(t)&&cxt.call(t)==IRt}function g$(t){return t==null?"":uxt(t)}var gxt=pxt(function(t,e,r){return e=e.toLowerCase(),t+(r?_xt(e):e)});function _xt(t){return Sxt(g$(t).toLowerCase())}function yxt(t){return t=g$(t),t&&t.replace(PRt,rxt).replace(zRt,"")}var Sxt=fxt("toUpperCase");function Ext(t,e,r){return t=g$(t),e=r?void 0:e,e===void 0?nxt(t)?oxt(t):ext(t):t.match(e)||[]}jPe.exports=gxt});var u5=E((ywr,BPe)=>{"use strict";BPe.exports=vxt;function vxt(t,e){for(var r=new Array(arguments.length-1),n=0,i=2,s=!0;i<arguments.length;)r[n++]=arguments[i++];return new Promise(function(a,c){r[n]=function(u){if(s)if(s=!1,u)c(u);else{for(var d=new Array(arguments.length-1),f=0;f<d.length;)d[f++]=arguments[f];a.apply(null,d)}};try{t.apply(e||null,r)}catch(l){s&&(s=!1,c(l))}})}});var GPe=E(HPe=>{"use strict";var _$=HPe;_$.length=function(e){var r=e.length;if(!r)return 0;for(var n=0;--r%4>1&&e.charAt(r)==="=";)++n;return Math.ceil(e.length*3)/4-n};var D_=new Array(64),VPe=new Array(123);for(ho=0;ho<64;)VPe[D_[ho]=ho<26?ho+65:ho<52?ho+71:ho<62?ho-4:ho-59|43]=ho++;var ho;_$.encode=function(e,r,n){for(var i=null,s=[],o=0,a=0,c;r<n;){var l=e[r++];switch(a){case 0:s[o++]=D_[l>>2],c=(l&3)<<4,a=1;break;case 1:s[o++]=D_[c|l>>4],c=(l&15)<<2,a=2;break;case 2:s[o++]=D_[c|l>>6],s[o++]=D_[l&63],a=0;break}o>8191&&((i||(i=[])).push(String.fromCharCode.apply(String,s)),o=0)}return a&&(s[o++]=D_[c],s[o++]=61,a===1&&(s[o++]=61)),i?(o&&i.push(String.fromCharCode.apply(String,s.slice(0,o))),i.join("")):String.fromCharCode.apply(String,s.slice(0,o))};var zPe="invalid encoding";_$.decode=function(e,r,n){for(var i=n,s=0,o,a=0;a<e.length;){var c=e.charCodeAt(a++);if(c===61&&s>1)break;if((c=VPe[c])===void 0)throw Error(zPe);switch(s){case 0:o=c,s=1;break;case 1:r[n++]=o<<2|(c&48)>>4,o=c,s=2;break;case 2:r[n++]=(o&15)<<4|(c&60)>>2,o=c,s=3;break;case 3:r[n++]=(o&3)<<6|c,s=0;break}}if(s===1)throw Error(zPe);return n-i};_$.test=function(e){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(e)}});var YPe=E((Ewr,WPe)=>{"use strict";WPe.exports=y$;function y$(){this._listeners=Object.create(null)}y$.prototype.on=function(e,r,n){return(this._listeners[e]||(this._listeners[e]=[])).push({fn:r,ctx:n||this}),this};y$.prototype.off=function(e,r){if(e===void 0)this._listeners=Object.create(null);else if(r===void 0)this._listeners[e]=[];else{var n=this._listeners[e];if(!n)return this;for(var i=0;i<n.length;)n[i].fn===r?n.splice(i,1):++i}return this};y$.prototype.emit=function(e){var r=this._listeners[e];if(r){for(var n=[],i=1;i<arguments.length;)n.push(arguments[i++]);for(i=0;i<r.length;)r[i].fn.apply(r[i++].ctx,n)}return this}});var tCe=E((vwr,eCe)=>{"use strict";eCe.exports=KPe(KPe);function KPe(t){return typeof Float32Array<"u"?(function(){var e=new Float32Array([-0]),r=new Uint8Array(e.buffer),n=r[3]===128;function i(c,l,u){e[0]=c,l[u]=r[0],l[u+1]=r[1],l[u+2]=r[2],l[u+3]=r[3]}function s(c,l,u){e[0]=c,l[u]=r[3],l[u+1]=r[2],l[u+2]=r[1],l[u+3]=r[0]}t.writeFloatLE=n?i:s,t.writeFloatBE=n?s:i;function o(c,l){return r[0]=c[l],r[1]=c[l+1],r[2]=c[l+2],r[3]=c[l+3],e[0]}function a(c,l){return r[3]=c[l],r[2]=c[l+1],r[1]=c[l+2],r[0]=c[l+3],e[0]}t.readFloatLE=n?o:a,t.readFloatBE=n?a:o})():(function(){function e(n,i,s,o){var a=i<0?1:0;if(a&&(i=-i),i===0)n(1/i>0?0:2147483648,s,o);else if(isNaN(i))n(2143289344,s,o);else if(i>34028234663852886e22)n((a<<31|2139095040)>>>0,s,o);else if(i<11754943508222875e-54)n((a<<31|Math.round(i/1401298464324817e-60))>>>0,s,o);else{var c=Math.floor(Math.log(i)/Math.LN2),l=Math.round(i*Math.pow(2,-c)*8388608)&8388607;n((a<<31|c+127<<23|l)>>>0,s,o)}}t.writeFloatLE=e.bind(null,JPe),t.writeFloatBE=e.bind(null,ZPe);function r(n,i,s){var o=n(i,s),a=(o>>31)*2+1,c=o>>>23&255,l=o&8388607;return c===255?l?NaN:a*(1/0):c===0?a*1401298464324817e-60*l:a*Math.pow(2,c-150)*(l+8388608)}t.readFloatLE=r.bind(null,XPe),t.readFloatBE=r.bind(null,QPe)})(),typeof Float64Array<"u"?(function(){var e=new Float64Array([-0]),r=new Uint8Array(e.buffer),n=r[7]===128;function i(c,l,u){e[0]=c,l[u]=r[0],l[u+1]=r[1],l[u+2]=r[2],l[u+3]=r[3],l[u+4]=r[4],l[u+5]=r[5],l[u+6]=r[6],l[u+7]=r[7]}function s(c,l,u){e[0]=c,l[u]=r[7],l[u+1]=r[6],l[u+2]=r[5],l[u+3]=r[4],l[u+4]=r[3],l[u+5]=r[2],l[u+6]=r[1],l[u+7]=r[0]}t.writeDoubleLE=n?i:s,t.writeDoubleBE=n?s:i;function o(c,l){return r[0]=c[l],r[1]=c[l+1],r[2]=c[l+2],r[3]=c[l+3],r[4]=c[l+4],r[5]=c[l+5],r[6]=c[l+6],r[7]=c[l+7],e[0]}function a(c,l){return r[7]=c[l],r[6]=c[l+1],r[5]=c[l+2],r[4]=c[l+3],r[3]=c[l+4],r[2]=c[l+5],r[1]=c[l+6],r[0]=c[l+7],e[0]}t.readDoubleLE=n?o:a,t.readDoubleBE=n?a:o})():(function(){function e(n,i,s,o,a,c){var l=o<0?1:0;if(l&&(o=-o),o===0)n(0,a,c+i),n(1/o>0?0:2147483648,a,c+s);else if(isNaN(o))n(0,a,c+i),n(2146959360,a,c+s);else if(o>17976931348623157e292)n(0,a,c+i),n((l<<31|2146435072)>>>0,a,c+s);else{var u;if(o<22250738585072014e-324)u=o/5e-324,n(u>>>0,a,c+i),n((l<<31|u/4294967296)>>>0,a,c+s);else{var d=Math.floor(Math.log(o)/Math.LN2);d===1024&&(d=1023),u=o*Math.pow(2,-d),n(u*4503599627370496>>>0,a,c+i),n((l<<31|d+1023<<20|u*1048576&1048575)>>>0,a,c+s)}}}t.writeDoubleLE=e.bind(null,JPe,0,4),t.writeDoubleBE=e.bind(null,ZPe,4,0);function r(n,i,s,o,a){var c=n(o,a+i),l=n(o,a+s),u=(l>>31)*2+1,d=l>>>20&2047,f=4294967296*(l&1048575)+c;return d===2047?f?NaN:u*(1/0):d===0?u*5e-324*f:u*Math.pow(2,d-1075)*(f+4503599627370496)}t.readDoubleLE=r.bind(null,XPe,0,4),t.readDoubleBE=r.bind(null,QPe,4,0)})(),t}function JPe(t,e,r){e[r]=t&255,e[r+1]=t>>>8&255,e[r+2]=t>>>16&255,e[r+3]=t>>>24}function ZPe(t,e,r){e[r]=t>>>24,e[r+1]=t>>>16&255,e[r+2]=t>>>8&255,e[r+3]=t&255}function XPe(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16|t[e+3]<<24)>>>0}function QPe(t,e){return(t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3])>>>0}});var nCe=E((bwr,rCe)=>{"use strict";rCe.exports=bxt;function bxt(t){try{if(typeof W!="function")return null;var e=W(t);return e&&(e.length||Object.keys(e).length)?e:null}catch{return null}}});var sCe=E(iCe=>{"use strict";var f5=iCe,d5="\uFFFD";f5.length=function(e){for(var r=0,n=0,i=0;i<e.length;++i)n=e.charCodeAt(i),n<128?r+=1:n<2048?r+=2:(n&64512)===55296&&(e.charCodeAt(i+1)&64512)===56320?(++i,r+=4):r+=3;return r};f5.read=function(e,r,n){if(n-r<1)return"";for(var i="",s=r;s<n;){var o=e[s++];if(o<=127)i+=String.fromCharCode(o);else if(o>=192&&o<224){var a=(o&31)<<6|e[s++]&63;i+=a>=128?String.fromCharCode(a):d5}else if(o>=224&&o<240){var c=(o&15)<<12|(e[s++]&63)<<6|e[s++]&63;i+=c>=2048?String.fromCharCode(c):d5}else if(o>=240){var l=(o&7)<<18|(e[s++]&63)<<12|(e[s++]&63)<<6|e[s++]&63;l<65536||l>1114111?i+=d5:(l-=65536,i+=String.fromCharCode(55296+(l>>10)),i+=String.fromCharCode(56320+(l&1023)))}}return i};f5.write=function(e,r,n){for(var i=n,s,o,a=0;a<e.length;++a)s=e.charCodeAt(a),s<128?r[n++]=s:s<2048?(r[n++]=s>>6|192,r[n++]=s&63|128):(s&64512)===55296&&((o=e.charCodeAt(a+1))&64512)===56320?(s=65536+((s&1023)<<10)+(o&1023),++a,r[n++]=s>>18|240,r[n++]=s>>12&63|128,r[n++]=s>>6&63|128,r[n++]=s&63|128):(r[n++]=s>>12|224,r[n++]=s>>6&63|128,r[n++]=s&63|128);return n-i}});var aCe=E((Awr,oCe)=>{"use strict";oCe.exports=Txt;function Txt(t,e,r){var n=r||8192,i=n>>>1,s=null,o=n;return function(c){if(c<1||c>i)return t(c);o+c>n&&(s=t(n),o=0);var l=e.call(s,o,o+=c);return o&7&&(o=(o|7)+1),l}}});var lCe=E((Rwr,cCe)=>{"use strict";cCe.exports=Hr;var rw=mo();function Hr(t,e){this.lo=t>>>0,this.hi=e>>>0}var pp=Hr.zero=new Hr(0,0);pp.toNumber=function(){return 0};pp.zzEncode=pp.zzDecode=function(){return this};pp.length=function(){return 1};var wxt=Hr.zeroHash="\0\0\0\0\0\0\0\0";Hr.fromNumber=function(e){if(e===0)return pp;var r=e<0;r&&(e=-e);var n=e>>>0,i=(e-n)/4294967296>>>0;return r&&(i=~i>>>0,n=~n>>>0,++n>4294967295&&(n=0,++i>4294967295&&(i=0))),new Hr(n,i)};Hr.from=function(e){if(typeof e=="number")return Hr.fromNumber(e);if(rw.isString(e))if(rw.Long)e=rw.Long.fromString(e);else return Hr.fromNumber(parseInt(e,10));return e.low||e.high?new Hr(e.low>>>0,e.high>>>0):pp};Hr.prototype.toNumber=function(e){if(!e&&this.hi>>>31){var r=~this.lo+1>>>0,n=~this.hi>>>0;return r||(n=n+1>>>0),-(r+n*4294967296)}return this.lo+this.hi*4294967296};Hr.prototype.toLong=function(e){return rw.Long?new rw.Long(this.lo|0,this.hi|0,!!e):{low:this.lo|0,high:this.hi|0,unsigned:!!e}};var qu=String.prototype.charCodeAt;Hr.fromHash=function(e){return e===wxt?pp:new Hr((qu.call(e,0)|qu.call(e,1)<<8|qu.call(e,2)<<16|qu.call(e,3)<<24)>>>0,(qu.call(e,4)|qu.call(e,5)<<8|qu.call(e,6)<<16|qu.call(e,7)<<24)>>>0)};Hr.prototype.toHash=function(){return String.fromCharCode(this.lo&255,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,this.hi&255,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)};Hr.prototype.zzEncode=function(){var e=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^e)>>>0,this.lo=(this.lo<<1^e)>>>0,this};Hr.prototype.zzDecode=function(){var e=-(this.lo&1);return this.lo=((this.lo>>>1|this.hi<<31)^e)>>>0,this.hi=(this.hi>>>1^e)>>>0,this};Hr.prototype.length=function(){var e=this.lo,r=(this.lo>>>28|this.hi<<4)>>>0,n=this.hi>>>24;return n===0?r===0?e<16384?e<128?1:2:e<2097152?3:4:r<16384?r<128?5:6:r<2097152?7:8:n<128?9:10}});var h5=E((nw,p5)=>{"use strict";(function(t,e){function r(n){return n.default||n}typeof define=="function"&&define.amd?define([],function(){var n={};return e(n),r(n)}):typeof nw=="object"?(e(nw),typeof p5=="object"&&(p5.exports=r(nw))):(function(){var n={};e(n),t.Long=r(n)})()})(typeof globalThis<"u"?globalThis:typeof self<"u"?self:nw,function(t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var e=null;try{e=new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0,1,13,2,96,0,1,127,96,4,127,127,127,127,1,127,3,7,6,0,1,1,1,1,1,6,6,1,127,1,65,0,11,7,50,6,3,109,117,108,0,1,5,100,105,118,95,115,0,2,5,100,105,118,95,117,0,3,5,114,101,109,95,115,0,4,5,114,101,109,95,117,0,5,8,103,101,116,95,104,105,103,104,0,0,10,191,1,6,4,0,35,0,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,126,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,127,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,128,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,129,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,130,34,4,66,32,135,167,36,0,32,4,167,11])),{}).exports}catch{}function r(C,w,P){this.low=C|0,this.high=w|0,this.unsigned=!!P}r.prototype.__isLong__,Object.defineProperty(r.prototype,"__isLong__",{value:!0});function n(C){return(C&&C.__isLong__)===!0}function i(C){var w=Math.clz32(C&-C);return C?31-w:w}r.isLong=n;var s={},o={};function a(C,w){var P,N,F;return w?(C>>>=0,(F=0<=C&&C<256)&&(N=o[C],N)?N:(P=l(C,0,!0),F&&(o[C]=P),P)):(C|=0,(F=-128<=C&&C<128)&&(N=s[C],N)?N:(P=l(C,C<0?-1:0,!1),F&&(s[C]=P),P))}r.fromInt=a;function c(C,w){if(isNaN(C))return w?g:S;if(w){if(C<0)return g;if(C>=_)return O}else{if(C<=-y)return A;if(C+1>=y)return R}return C<0?c(-C,w).neg():l(C%m|0,C/m|0,w)}r.fromNumber=c;function l(C,w,P){return new r(C,w,P)}r.fromBits=l;var u=Math.pow;function d(C,w,P){if(C.length===0)throw Error("empty string");if(typeof w=="number"?(P=w,w=!1):w=!!w,C==="NaN"||C==="Infinity"||C==="+Infinity"||C==="-Infinity")return w?g:S;if(P=P||10,P<2||36<P)throw RangeError("radix");var N;if((N=C.indexOf("-"))>0)throw Error("interior hyphen");if(N===0)return d(C.substring(1),w,P).neg();for(var F=c(u(P,8)),V=S,de=0;de<C.length;de+=8){var Te=Math.min(8,C.length-de),Ie=parseInt(C.substring(de,de+Te),P);if(Te<8){var $e=c(u(P,Te));V=V.mul($e).add(c(Ie))}else V=V.mul(F),V=V.add(c(Ie))}return V.unsigned=w,V}r.fromString=d;function f(C,w){return typeof C=="number"?c(C,w):typeof C=="string"?d(C,w):l(C.low,C.high,typeof w=="boolean"?w:C.unsigned)}r.fromValue=f;var p=65536,h=1<<24,m=p*p,_=m*m,y=_/2,v=a(h),S=a(0);r.ZERO=S;var g=a(0,!0);r.UZERO=g;var T=a(1);r.ONE=T;var I=a(1,!0);r.UONE=I;var x=a(-1);r.NEG_ONE=x;var R=l(-1,2147483647,!1);r.MAX_VALUE=R;var O=l(-1,-1,!0);r.MAX_UNSIGNED_VALUE=O;var A=l(0,-2147483648,!1);r.MIN_VALUE=A;var b=r.prototype;b.toInt=function(){return this.unsigned?this.low>>>0:this.low},b.toNumber=function(){return this.unsigned?(this.high>>>0)*m+(this.low>>>0):this.high*m+(this.low>>>0)},b.toString=function(w){if(w=w||10,w<2||36<w)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative())if(this.eq(A)){var P=c(w),N=this.div(P),F=N.mul(P).sub(this);return N.toString(w)+F.toInt().toString(w)}else return"-"+this.neg().toString(w);for(var V=c(u(w,6),this.unsigned),de=this,Te="";;){var Ie=de.div(V),$e=de.sub(Ie.mul(V)).toInt()>>>0,oe=$e.toString(w);if(de=Ie,de.isZero())return oe+Te;for(;oe.length<6;)oe="0"+oe;Te=""+oe+Te}},b.getHighBits=function(){return this.high},b.getHighBitsUnsigned=function(){return this.high>>>0},b.getLowBits=function(){return this.low},b.getLowBitsUnsigned=function(){return this.low>>>0},b.getNumBitsAbs=function(){if(this.isNegative())return this.eq(A)?64:this.neg().getNumBitsAbs();for(var w=this.high!=0?this.high:this.low,P=31;P>0&&(w&1<<P)==0;P--);return this.high!=0?P+33:P+1},b.isSafeInteger=function(){var w=this.high>>21;return w?this.unsigned?!1:w===-1&&!(this.low===0&&this.high===-2097152):!0},b.isZero=function(){return this.high===0&&this.low===0},b.eqz=b.isZero,b.isNegative=function(){return!this.unsigned&&this.high<0},b.isPositive=function(){return this.unsigned||this.high>=0},b.isOdd=function(){return(this.low&1)===1},b.isEven=function(){return(this.low&1)===0},b.equals=function(w){return n(w)||(w=f(w)),this.unsigned!==w.unsigned&&this.high>>>31===1&&w.high>>>31===1?!1:this.high===w.high&&this.low===w.low},b.eq=b.equals,b.notEquals=function(w){return!this.eq(w)},b.neq=b.notEquals,b.ne=b.notEquals,b.lessThan=function(w){return this.comp(w)<0},b.lt=b.lessThan,b.lessThanOrEqual=function(w){return this.comp(w)<=0},b.lte=b.lessThanOrEqual,b.le=b.lessThanOrEqual,b.greaterThan=function(w){return this.comp(w)>0},b.gt=b.greaterThan,b.greaterThanOrEqual=function(w){return this.comp(w)>=0},b.gte=b.greaterThanOrEqual,b.ge=b.greaterThanOrEqual,b.compare=function(w){if(n(w)||(w=f(w)),this.eq(w))return 0;var P=this.isNegative(),N=w.isNegative();return P&&!N?-1:!P&&N?1:this.unsigned?w.high>>>0>this.high>>>0||w.high===this.high&&w.low>>>0>this.low>>>0?-1:1:this.sub(w).isNegative()?-1:1},b.comp=b.compare,b.negate=function(){return!this.unsigned&&this.eq(A)?A:this.not().add(T)},b.neg=b.negate,b.add=function(w){n(w)||(w=f(w));var P=this.high>>>16,N=this.high&65535,F=this.low>>>16,V=this.low&65535,de=w.high>>>16,Te=w.high&65535,Ie=w.low>>>16,$e=w.low&65535,oe=0,Ee=0,he=0,k=0;return k+=V+$e,he+=k>>>16,k&=65535,he+=F+Ie,Ee+=he>>>16,he&=65535,Ee+=N+Te,oe+=Ee>>>16,Ee&=65535,oe+=P+de,oe&=65535,l(he<<16|k,oe<<16|Ee,this.unsigned)},b.subtract=function(w){return n(w)||(w=f(w)),this.add(w.neg())},b.sub=b.subtract,b.multiply=function(w){if(this.isZero())return this;if(n(w)||(w=f(w)),e){var P=e.mul(this.low,this.high,w.low,w.high);return l(P,e.get_high(),this.unsigned)}if(w.isZero())return this.unsigned?g:S;if(this.eq(A))return w.isOdd()?A:S;if(w.eq(A))return this.isOdd()?A:S;if(this.isNegative())return w.isNegative()?this.neg().mul(w.neg()):this.neg().mul(w).neg();if(w.isNegative())return this.mul(w.neg()).neg();if(this.lt(v)&&w.lt(v))return c(this.toNumber()*w.toNumber(),this.unsigned);var N=this.high>>>16,F=this.high&65535,V=this.low>>>16,de=this.low&65535,Te=w.high>>>16,Ie=w.high&65535,$e=w.low>>>16,oe=w.low&65535,Ee=0,he=0,k=0,U=0;return U+=de*oe,k+=U>>>16,U&=65535,k+=V*oe,he+=k>>>16,k&=65535,k+=de*$e,he+=k>>>16,k&=65535,he+=F*oe,Ee+=he>>>16,he&=65535,he+=V*$e,Ee+=he>>>16,he&=65535,he+=de*Ie,Ee+=he>>>16,he&=65535,Ee+=N*oe+F*$e+V*Ie+de*Te,Ee&=65535,l(k<<16|U,Ee<<16|he,this.unsigned)},b.mul=b.multiply,b.divide=function(w){if(n(w)||(w=f(w)),w.isZero())throw Error("division by zero");if(e){if(!this.unsigned&&this.high===-2147483648&&w.low===-1&&w.high===-1)return this;var P=(this.unsigned?e.div_u:e.div_s)(this.low,this.high,w.low,w.high);return l(P,e.get_high(),this.unsigned)}if(this.isZero())return this.unsigned?g:S;var N,F,V;if(this.unsigned){if(w.unsigned||(w=w.toUnsigned()),w.gt(this))return g;if(w.gt(this.shru(1)))return I;V=g}else{if(this.eq(A)){if(w.eq(T)||w.eq(x))return A;if(w.eq(A))return T;var de=this.shr(1);return N=de.div(w).shl(1),N.eq(S)?w.isNegative()?T:x:(F=this.sub(w.mul(N)),V=N.add(F.div(w)),V)}else if(w.eq(A))return this.unsigned?g:S;if(this.isNegative())return w.isNegative()?this.neg().div(w.neg()):this.neg().div(w).neg();if(w.isNegative())return this.div(w.neg()).neg();V=S}for(F=this;F.gte(w);){N=Math.max(1,Math.floor(F.toNumber()/w.toNumber()));for(var Te=Math.ceil(Math.log(N)/Math.LN2),Ie=Te<=48?1:u(2,Te-48),$e=c(N),oe=$e.mul(w);oe.isNegative()||oe.gt(F);)N-=Ie,$e=c(N,this.unsigned),oe=$e.mul(w);$e.isZero()&&($e=T),V=V.add($e),F=F.sub(oe)}return V},b.div=b.divide,b.modulo=function(w){if(n(w)||(w=f(w)),e){var P=(this.unsigned?e.rem_u:e.rem_s)(this.low,this.high,w.low,w.high);return l(P,e.get_high(),this.unsigned)}return this.sub(this.div(w).mul(w))},b.mod=b.modulo,b.rem=b.modulo,b.not=function(){return l(~this.low,~this.high,this.unsigned)},b.countLeadingZeros=function(){return this.high?Math.clz32(this.high):Math.clz32(this.low)+32},b.clz=b.countLeadingZeros,b.countTrailingZeros=function(){return this.low?i(this.low):i(this.high)+32},b.ctz=b.countTrailingZeros,b.and=function(w){return n(w)||(w=f(w)),l(this.low&w.low,this.high&w.high,this.unsigned)},b.or=function(w){return n(w)||(w=f(w)),l(this.low|w.low,this.high|w.high,this.unsigned)},b.xor=function(w){return n(w)||(w=f(w)),l(this.low^w.low,this.high^w.high,this.unsigned)},b.shiftLeft=function(w){return n(w)&&(w=w.toInt()),(w&=63)===0?this:w<32?l(this.low<<w,this.high<<w|this.low>>>32-w,this.unsigned):l(0,this.low<<w-32,this.unsigned)},b.shl=b.shiftLeft,b.shiftRight=function(w){return n(w)&&(w=w.toInt()),(w&=63)===0?this:w<32?l(this.low>>>w|this.high<<32-w,this.high>>w,this.unsigned):l(this.high>>w-32,this.high>=0?0:-1,this.unsigned)},b.shr=b.shiftRight,b.shiftRightUnsigned=function(w){return n(w)&&(w=w.toInt()),(w&=63)===0?this:w<32?l(this.low>>>w|this.high<<32-w,this.high>>>w,this.unsigned):w===32?l(this.high,0,this.unsigned):l(this.high>>>w-32,0,this.unsigned)},b.shru=b.shiftRightUnsigned,b.shr_u=b.shiftRightUnsigned,b.rotateLeft=function(w){var P;return n(w)&&(w=w.toInt()),(w&=63)===0?this:w===32?l(this.high,this.low,this.unsigned):w<32?(P=32-w,l(this.low<<w|this.high>>>P,this.high<<w|this.low>>>P,this.unsigned)):(w-=32,P=32-w,l(this.high<<w|this.low>>>P,this.low<<w|this.high>>>P,this.unsigned))},b.rotl=b.rotateLeft,b.rotateRight=function(w){var P;return n(w)&&(w=w.toInt()),(w&=63)===0?this:w===32?l(this.high,this.low,this.unsigned):w<32?(P=32-w,l(this.high<<P|this.low>>>w,this.low<<P|this.high>>>w,this.unsigned)):(w-=32,P=32-w,l(this.low<<P|this.high>>>w,this.high<<P|this.low>>>w,this.unsigned))},b.rotr=b.rotateRight,b.toSigned=function(){return this.unsigned?l(this.low,this.high,!1):this},b.toUnsigned=function(){return this.unsigned?this:l(this.low,this.high,!0)},b.toBytes=function(w){return w?this.toBytesLE():this.toBytesBE()},b.toBytesLE=function(){var w=this.high,P=this.low;return[P&255,P>>>8&255,P>>>16&255,P>>>24,w&255,w>>>8&255,w>>>16&255,w>>>24]},b.toBytesBE=function(){var w=this.high,P=this.low;return[w>>>24,w>>>16&255,w>>>8&255,w&255,P>>>24,P>>>16&255,P>>>8&255,P&255]},r.fromBytes=function(w,P,N){return N?r.fromBytesLE(w,P):r.fromBytesBE(w,P)},r.fromBytesLE=function(w,P){return new r(w[0]|w[1]<<8|w[2]<<16|w[3]<<24,w[4]|w[5]<<8|w[6]<<16|w[7]<<24,P)},r.fromBytesBE=function(w,P){return new r(w[4]<<24|w[5]<<16|w[6]<<8|w[7],w[0]<<24|w[1]<<16|w[2]<<8|w[3],P)},typeof BigInt=="function"&&(r.fromBigInt=function(w,P){var N=Number(BigInt.asIntN(32,w)),F=Number(BigInt.asIntN(32,w>>BigInt(32)));return l(N,F,P)},r.fromValue=function(w,P){return typeof w=="bigint"?r.fromBigInt(w,P):f(w,P)},b.toBigInt=function(){var w=BigInt(this.low>>>0),P=BigInt(this.unsigned?this.high>>>0:this.high);return P<<BigInt(32)|w});var L=t.default=r})});var mo=E(m5=>{"use strict";var Le=m5;Le.asPromise=u5();Le.base64=GPe();Le.EventEmitter=YPe();Le.float=tCe();Le.inquire=nCe();Le.utf8=sCe();Le.pool=aCe();Le.LongBits=lCe();function uCe(t){return t==="__proto__"||t==="prototype"||t==="constructor"}Le.isUnsafeProperty=uCe;Le.isNode=!!(typeof global<"u"&&global&&global.process&&global.process.versions&&global.process.versions.node);Le.global=Le.isNode&&global||typeof window<"u"&&window||typeof self<"u"&&self||m5;Le.emptyArray=Object.freeze?Object.freeze([]):[];Le.emptyObject=Object.freeze?Object.freeze({}):{};Le.isInteger=Number.isInteger||function(e){return typeof e=="number"&&isFinite(e)&&Math.floor(e)===e};Le.isString=function(e){return typeof e=="string"||e instanceof String};Le.isObject=function(e){return e&&typeof e=="object"};Le.isset=Le.isSet=function(e,r){var n=e[r];return n!=null&&e.hasOwnProperty(r)?typeof n!="object"||(Array.isArray(n)?n.length:Object.keys(n).length)>0:!1};Le.Buffer=(function(){try{var t=Le.global.Buffer;return t.prototype.utf8Write?t:null}catch{return null}})();Le._Buffer_from=null;Le._Buffer_allocUnsafe=null;Le.newBuffer=function(e){return typeof e=="number"?Le.Buffer?Le._Buffer_allocUnsafe(e):new Le.Array(e):Le.Buffer?Le._Buffer_from(e):typeof Uint8Array>"u"?e:new Uint8Array(e)};Le.Array=typeof Uint8Array<"u"?Uint8Array:Array;Le.Long=Le.global.dcodeIO&&Le.global.dcodeIO.Long||Le.global.Long||(function(){try{var t=h5();return t&&t.isLong?t:null}catch{return null}})();Le.key2Re=/^true|false|0|1$/;Le.key32Re=/^-?(?:0|[1-9][0-9]*)$/;Le.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/;Le.longToHash=function(e){return e?Le.LongBits.from(e).toHash():Le.LongBits.zeroHash};Le.longFromHash=function(e,r){var n=Le.LongBits.fromHash(e);return Le.Long?Le.Long.fromBits(n.lo,n.hi,r):n.toNumber(!!r)};function dCe(t){var e=typeof arguments[arguments.length-1]=="boolean",r=e?arguments.length-1:arguments.length;e=e&&arguments[arguments.length-1];for(var n=1;n<r;++n){var i=arguments[n];if(i)for(var s=Object.keys(i),o=0;o<s.length;++o)!uCe(s[o])&&(t[s[o]]===void 0||!e)&&(t[s[o]]=i[s[o]])}return t}Le.merge=dCe;Le.nestingLimit=32;Le.recursionLimit=100;Le.makeProp=function(e,r){Object.defineProperty(e,r,{enumerable:!0,configurable:!0,writable:!0})};Le.lcFirst=function(e){return e.charAt(0).toLowerCase()+e.substring(1)};function fCe(t){function e(r,n){if(!(this instanceof e))return new e(r,n);Object.defineProperty(this,"message",{get:function(){return r}}),Error.captureStackTrace?Error.captureStackTrace(this,e):Object.defineProperty(this,"stack",{value:new Error().stack||""}),n&&dCe(this,n)}return e.prototype=Object.create(Error.prototype,{constructor:{value:e,writable:!0,enumerable:!1,configurable:!0},name:{get:function(){return t},set:void 0,enumerable:!1,configurable:!0},toString:{value:function(){return this.name+": "+this.message},writable:!0,enumerable:!1,configurable:!0}}),e}Le.newError=fCe;Le.ProtocolError=fCe("ProtocolError");Le.oneOfGetter=function(e){for(var r={},n=0;n<e.length;++n)r[e[n]]=1;return function(){for(var i=Object.keys(this),s=i.length-1;s>-1;--s)if(r[i[s]]===1&&this[i[s]]!==void 0&&this[i[s]]!==null)return i[s]}};Le.oneOfSetter=function(e){return function(r){for(var n=0;n<e.length;++n)e[n]!==r&&delete this[e[n]]}};Le.toJSONOptions={longs:String,enums:String,bytes:String,json:!0};Le._configure=function(){var t=Le.Buffer;if(!t){Le._Buffer_from=Le._Buffer_allocUnsafe=null;return}Le._Buffer_from=t.from!==Uint8Array.from&&t.from||function(r,n){return new t(r,n)},Le._Buffer_allocUnsafe=t.allocUnsafe||function(r){return new t(r)}}});var E$=E((Iwr,gCe)=>{"use strict";gCe.exports=St;var Ps=mo(),g5,S$=Ps.LongBits,pCe=Ps.base64,hCe=Ps.utf8;function iw(t,e,r){this.fn=t,this.len=e,this.next=void 0,this.val=r}function y5(){}function Axt(t){this.head=t.head,this.tail=t.tail,this.len=t.len,this.next=t.states}function St(){this.len=0,this.head=new iw(y5,0,0),this.tail=this.head,this.states=null}var mCe=function(){return Ps.Buffer?function(){return(St.create=function(){return new g5})()}:function(){return new St}};St.create=mCe();St.alloc=function(e){return new Ps.Array(e)};Ps.Array!==Array&&(St.alloc=Ps.pool(St.alloc,Ps.Array.prototype.subarray));St.prototype._push=function(e,r,n){return this.tail=this.tail.next=new iw(e,r,n),this.len+=r,this};function S5(t,e,r){e[r]=t&255}function Rxt(t,e,r){for(;t>127;)e[r++]=t&127|128,t>>>=7;e[r]=t}function E5(t,e){this.len=t,this.next=void 0,this.val=e}E5.prototype=Object.create(iw.prototype);E5.prototype.fn=Rxt;St.prototype.uint32=function(e){return this.len+=(this.tail=this.tail.next=new E5((e=e>>>0)<128?1:e<16384?2:e<2097152?3:e<268435456?4:5,e)).len,this};St.prototype.int32=function(e){return(e|=0)<0?this._push(v5,10,S$.fromNumber(e)):this.uint32(e)};St.prototype.sint32=function(e){return this.uint32((e<<1^e>>31)>>>0)};function v5(t,e,r){for(var n=t.lo,i=t.hi;i;)e[r++]=n&127|128,n=(n>>>7|i<<25)>>>0,i>>>=7;for(;n>127;)e[r++]=n&127|128,n=n>>>7;e[r++]=n}St.prototype.uint64=function(e){var r=S$.from(e);return this._push(v5,r.length(),r)};St.prototype.int64=St.prototype.uint64;St.prototype.sint64=function(e){var r=S$.from(e).zzEncode();return this._push(v5,r.length(),r)};St.prototype.bool=function(e){return this._push(S5,1,e?1:0)};function _5(t,e,r){e[r]=t&255,e[r+1]=t>>>8&255,e[r+2]=t>>>16&255,e[r+3]=t>>>24}St.prototype.fixed32=function(e){return this._push(_5,4,e>>>0)};St.prototype.sfixed32=St.prototype.fixed32;St.prototype.fixed64=function(e){var r=S$.from(e);return this._push(_5,4,r.lo)._push(_5,4,r.hi)};St.prototype.sfixed64=St.prototype.fixed64;St.prototype.float=function(e){return this._push(Ps.float.writeFloatLE,4,e)};St.prototype.double=function(e){return this._push(Ps.float.writeDoubleLE,8,e)};var xxt=Ps.Array.prototype.set?function(e,r,n){r.set(e,n)}:function(e,r,n){for(var i=0;i<e.length;++i)r[n+i]=e[i]};St.prototype.bytes=function(e){var r=e.length>>>0;if(!r)return this._push(S5,1,0);if(Ps.isString(e)){var n=St.alloc(r=pCe.length(e));pCe.decode(e,n,0),e=n}return this.uint32(r)._push(xxt,r,e)};St.prototype.string=function(e){var r=hCe.length(e);return r?this.uint32(r)._push(hCe.write,r,e):this._push(S5,1,0)};St.prototype.fork=function(){return this.states=new Axt(this),this.head=this.tail=new iw(y5,0,0),this.len=0,this};St.prototype.reset=function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new iw(y5,0,0),this.len=0),this};St.prototype.ldelim=function(){var e=this.head,r=this.tail,n=this.len;return this.reset().uint32(n),n&&(this.tail.next=e.next,this.tail=r,this.len+=n),this};St.prototype.finish=function(){for(var e=this.head.next,r=this.constructor.alloc(this.len),n=0;e;)e.fn(e.val,r,n),n+=e.len,e=e.next;return r};St._configure=function(t){g5=t,St.create=mCe(),g5._configure()}});var SCe=E((Owr,yCe)=>{"use strict";yCe.exports=Sa;var _Ce=E$();(Sa.prototype=Object.create(_Ce.prototype)).constructor=Sa;var Bu=mo();function Sa(){_Ce.call(this)}Sa._configure=function(){Sa.alloc=Bu._Buffer_allocUnsafe,Sa.writeBytesBuffer=Bu.Buffer&&Bu.Buffer.prototype instanceof Uint8Array&&Bu.Buffer.prototype.set.name==="set"?function(e,r,n){r.set(e,n)}:function(e,r,n){if(e.copy)e.copy(r,n,0,e.length);else for(var i=0;i<e.length;)r[n++]=e[i++]}};Sa.prototype.bytes=function(e){Bu.isString(e)&&(e=Bu._Buffer_from(e,"base64"));var r=e.length>>>0;return this.uint32(r),r&&this._push(Sa.writeBytesBuffer,r,e),this};function Ixt(t,e,r){t.length<40?Bu.utf8.write(t,e,r):e.utf8Write?e.utf8Write(t,r):e.write(t,r)}Sa.prototype.string=function(e){var r=Bu.Buffer.byteLength(e);return this.uint32(r),r&&this._push(Ixt,r,e),this};Sa._configure()});var b$=E((Pwr,wCe)=>{"use strict";wCe.exports=sr;var Cs=mo(),T5,bCe=Cs.LongBits,Oxt=Cs.utf8;function go(t,e){return RangeError("index out of range: "+t.pos+" + "+(e||1)+" > "+t.len)}function sr(t){this.buf=t,this.pos=0,this.len=t.length}var ECe=typeof Uint8Array<"u"?function(e){if(e instanceof Uint8Array||Array.isArray(e))return new sr(e);throw Error("illegal buffer")}:function(e){if(Array.isArray(e))return new sr(e);throw Error("illegal buffer")},TCe=function(){return Cs.Buffer?function(r){return(sr.create=function(i){return Cs.Buffer.isBuffer(i)?new T5(i):ECe(i)})(r)}:ECe};sr.create=TCe();sr.prototype._slice=Cs.Array.prototype.subarray||Cs.Array.prototype.slice;sr.prototype.uint32=(function(){var e=4294967295;return function(){if(e=(this.buf[this.pos]&127)>>>0,this.buf[this.pos++]<128||(e=(e|(this.buf[this.pos]&127)<<7)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&127)<<14)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&127)<<21)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&15)<<28)>>>0,this.buf[this.pos++]<128))return e;if((this.pos+=5)>this.len)throw this.pos=this.len,go(this,10);return e}})();sr.prototype.int32=function(){return this.uint32()|0};sr.prototype.sint32=function(){var e=this.uint32();return e>>>1^-(e&1)|0};function b5(){var t=new bCe(0,0),e=0;if(this.len-this.pos>4){for(;e<4;++e)if(t.lo=(t.lo|(this.buf[this.pos]&127)<<e*7)>>>0,this.buf[this.pos++]<128)return t;if(t.lo=(t.lo|(this.buf[this.pos]&127)<<28)>>>0,t.hi=(t.hi|(this.buf[this.pos]&127)>>4)>>>0,this.buf[this.pos++]<128)return t;e=0}else{for(;e<3;++e){if(this.pos>=this.len)throw go(this);if(t.lo=(t.lo|(this.buf[this.pos]&127)<<e*7)>>>0,this.buf[this.pos++]<128)return t}return t.lo=(t.lo|(this.buf[this.pos++]&127)<<e*7)>>>0,t}if(this.len-this.pos>4){for(;e<5;++e)if(t.hi=(t.hi|(this.buf[this.pos]&127)<<e*7+3)>>>0,this.buf[this.pos++]<128)return t}else for(;e<5;++e){if(this.pos>=this.len)throw go(this);if(t.hi=(t.hi|(this.buf[this.pos]&127)<<e*7+3)>>>0,this.buf[this.pos++]<128)return t}throw Error("invalid varint encoding")}sr.prototype.bool=function(){return this.uint32()!==0};function v$(t,e){return(t[e-4]|t[e-3]<<8|t[e-2]<<16|t[e-1]<<24)>>>0}sr.prototype.fixed32=function(){if(this.pos+4>this.len)throw go(this,4);return v$(this.buf,this.pos+=4)};sr.prototype.sfixed32=function(){if(this.pos+4>this.len)throw go(this,4);return v$(this.buf,this.pos+=4)|0};function vCe(){if(this.pos+8>this.len)throw go(this,8);return new bCe(v$(this.buf,this.pos+=4),v$(this.buf,this.pos+=4))}sr.prototype.float=function(){if(this.pos+4>this.len)throw go(this,4);var e=Cs.float.readFloatLE(this.buf,this.pos);return this.pos+=4,e};sr.prototype.double=function(){if(this.pos+8>this.len)throw go(this,4);var e=Cs.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,e};sr.prototype.bytes=function(){var e=this.uint32(),r=this.pos,n=this.pos+e;if(n>this.len)throw go(this,e);if(this.pos+=e,Array.isArray(this.buf))return this.buf.slice(r,n);if(r===n){var i=Cs.Buffer;return i?i.alloc(0):new this.buf.constructor(0)}return this._slice.call(this.buf,r,n)};sr.prototype.string=function(){var e=this.bytes();return Oxt.read(e,0,e.length)};sr.prototype.skip=function(e){if(typeof e=="number"){if(this.pos+e>this.len)throw go(this,e);this.pos+=e}else do if(this.pos>=this.len)throw go(this);while(this.buf[this.pos++]&128);return this};sr.recursionLimit=Cs.recursionLimit;sr.prototype.skipType=function(t,e){if(e===void 0&&(e=0),e>sr.recursionLimit)throw Error("maximum nesting depth exceeded");switch(t){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;(t=this.uint32()&7)!==4;)this.skipType(t,e+1);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+t+" at offset "+this.pos)}return this};sr._configure=function(t){T5=t,sr.create=TCe(),T5._configure();var e=Cs.Long?"toLong":"toNumber";Cs.merge(sr.prototype,{int64:function(){return b5.call(this)[e](!1)},uint64:function(){return b5.call(this)[e](!0)},sint64:function(){return b5.call(this).zzDecode()[e](!1)},fixed64:function(){return vCe.call(this)[e](!0)},sfixed64:function(){return vCe.call(this)[e](!1)}})}});var ICe=E((Cwr,xCe)=>{"use strict";xCe.exports=hp;var RCe=b$();(hp.prototype=Object.create(RCe.prototype)).constructor=hp;var ACe=mo();function hp(t){RCe.call(this,t)}hp._configure=function(){ACe.Buffer&&(hp.prototype._slice=ACe.Buffer.prototype.slice)};hp.prototype.string=function(){var e=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+e,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+e,this.len))};hp._configure()});var PCe=E((Nwr,OCe)=>{"use strict";OCe.exports=sw;var w5=mo();(sw.prototype=Object.create(w5.EventEmitter.prototype)).constructor=sw;function sw(t,e,r){if(typeof t!="function")throw TypeError("rpcImpl must be a function");w5.EventEmitter.call(this),this.rpcImpl=t,this.requestDelimited=!!e,this.responseDelimited=!!r}sw.prototype.rpcCall=function t(e,r,n,i,s){if(!i)throw TypeError("request must be specified");var o=this;if(!s)return w5.asPromise(t,o,e,r,n,i);if(!o.rpcImpl){setTimeout(function(){s(Error("already ended"))},0);return}try{return o.rpcImpl(e,r[o.requestDelimited?"encodeDelimited":"encode"](i).finish(),function(c,l){if(c)return o.emit("error",c,e),s(c);if(l===null){o.end(!0);return}if(!(l instanceof n))try{l=n[o.responseDelimited?"decodeDelimited":"decode"](l)}catch(u){return o.emit("error",u,e),s(u)}return o.emit("data",l,e),s(null,l)})}catch(a){o.emit("error",a,e),setTimeout(function(){s(a)},0);return}};sw.prototype.end=function(e){return this.rpcImpl&&(e||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}});var A5=E(CCe=>{"use strict";var Pxt=CCe;Pxt.Service=PCe()});var R5=E(($wr,NCe)=>{"use strict";NCe.exports={}});var LCe=E($Ce=>{"use strict";var wi=$Ce;wi.build="minimal";wi.Writer=E$();wi.BufferWriter=SCe();wi.Reader=b$();wi.BufferReader=ICe();wi.util=mo();wi.rpc=A5();wi.roots=R5();wi.configure=kCe;function kCe(){wi.util._configure(),wi.Writer._configure(wi.BufferWriter),wi.Reader._configure(wi.BufferReader)}kCe()});var MCe=E((Dwr,DCe)=>{"use strict";DCe.exports=x5;var Cxt=/^(?:do|if|in|for|let|new|try|var|case|else|enum|eval|false|null|this|true|void|with|break|catch|class|const|super|throw|while|yield|delete|export|import|public|return|static|switch|typeof|default|extends|finally|package|private|continue|debugger|function|arguments|interface|protected|implements|instanceof)$/;function x5(t,e){typeof t=="string"&&(e=t,t=void 0);var r=[];function n(s){if(typeof s!="string"){var o=i();if(x5.verbose&&console.log("codegen: "+o),o="return "+o,s){for(var a=Object.keys(s),c=new Array(a.length+1),l=new Array(a.length),u=0;u<a.length;)c[u]=a[u],l[u]=s[a[u++]];return c[u]=o,Function.apply(null,c).apply(null,l)}return Function(o)()}for(var d=new Array(arguments.length-1),f=0;f<d.length;)d[f]=arguments[++f];if(f=0,s=s.replace(/%([%dfijs])/g,function(h,m){var _=d[f++];switch(m){case"d":case"f":return String(Number(_));case"i":return String(Math.floor(_));case"j":return JSON.stringify(_);case"s":return String(_)}return"%"}),f!==d.length)throw Error("parameter count mismatch");return r.push(s),n}function i(s){return"function "+Nxt(s||e)+"("+(t&&t.join(",")||"")+`){
377
377
  `+r.join(`
378
378
  `)+`
379
379
  }`}return n.toString=i,n}x5.verbose=!1;function Nxt(t){return!t||(t=String(t).replace(/[^\w$]/g,""),!t)?"":(/^\d/.test(t)&&(t="_"+t),Cxt.test(t)?t+"_":t)}});var FCe=E((Mwr,UCe)=>{"use strict";var M_=null;try{M_=W("fs"),(!M_||!M_.readFile||!M_.readFileSync)&&(M_=null)}catch{}UCe.exports=M_});var qCe=E((Uwr,jCe)=>{"use strict";jCe.exports=ow;var kxt=u5(),I5=FCe();function ow(t,e,r){return typeof e=="function"?(r=e,e={}):e||(e={}),r?!e.xhr&&I5&&I5.readFile?I5.readFile(t,function(i,s){return i&&typeof XMLHttpRequest<"u"?ow.xhr(t,e,r):i?r(i):r(null,e.binary?s:s.toString("utf8"))}):ow.xhr(t,e,r):kxt(ow,this,t,e)}ow.xhr=function(e,r,n){var i=new XMLHttpRequest;i.onreadystatechange=function(){if(i.readyState===4){if(i.status!==0&&i.status!==200)return n(Error("status "+i.status));if(r.binary){var o=i.response;if(!o){o=[];for(var a=0;a<i.responseText.length;++a)o.push(i.responseText.charCodeAt(a)&255)}return n(null,typeof Uint8Array<"u"?new Uint8Array(o):o)}return n(null,i.responseText)}},r.binary&&("overrideMimeType"in i&&i.overrideMimeType("text/plain; charset=x-user-defined"),i.responseType="arraybuffer"),i.open("GET",e),i.send()}});var VCe=E(zCe=>{"use strict";var P5=zCe,BCe=P5.isAbsolute=function(e){return/^(?:\/|\w+:)/.test(e)},O5=P5.normalize=function(e){e=e.replace(/\\/g,"/").replace(/\/{2,}/g,"/");var r=e.split("/"),n=BCe(e),i="";n&&(i=r.shift()+"/");for(var s=0;s<r.length;)r[s]===".."?s>0&&r[s-1]!==".."?r.splice(--s,2):n?r.splice(s,1):++s:r[s]==="."?r.splice(s,1):++s;return i+r.join("/")};P5.resolve=function(e,r,n){return n||(r=O5(r)),BCe(r)?r:(n||(e=O5(e)),(e=e.replace(/(?:\/|^)[^/]+$/,"")).length?O5(e+"/"+r):r)}});var GCe=E(HCe=>{"use strict";var C5=HCe;C5.numberRe=/^(?![eE])[0-9]*(?:\.[0-9]*)?(?:[eE][+-]?[0-9]+)?$/;C5.typeRefRe=/^(?:\.?[a-zA-Z_][a-zA-Z_0-9]*)(?:\.[a-zA-Z_][a-zA-Z_0-9]*)*$/;C5.reservedRe=/^(?:do|if|in|for|let|new|try|var|case|else|enum|eval|false|null|this|true|void|with|break|catch|class|const|super|throw|while|yield|delete|export|import|public|return|static|switch|typeof|default|extends|finally|package|private|continue|debugger|function|arguments|interface|protected|implements|instanceof)$/});var YCe=E((qwr,WCe)=>{"use strict";var U_=null;try{U_=W("fs"),(!U_||!U_.readFile||!U_.readFileSync)&&(U_=null)}catch{}WCe.exports=U_});var j_=E((Bwr,ZCe)=>{"use strict";ZCe.exports=gt;var T$=Vu();((gt.prototype=Object.create(T$.prototype)).constructor=gt).className="Namespace";var N5=zu(),gp=Gr(),$xt=yp(),mp,F_,_p;gt.fromJSON=function(e,r,n){return n=gp.checkDepth(n),new gt(e,r.options).addJSON(r.nested,n)};function KCe(t,e){if(t&&t.length){for(var r={},n=0;n<t.length;++n)r[t[n].name]=t[n].toJSON(e);return r}}gt.arrayToJSON=KCe;gt.isReservedId=function(e,r){if(e){for(var n=0;n<e.length;++n)if(typeof e[n]!="string"&&e[n][0]<=r&&e[n][1]>r)return!0}return!1};gt.isReservedName=function(e,r){if(e){for(var n=0;n<e.length;++n)if(e[n]===r)return!0}return!1};function gt(t,e){T$.call(this,t,e),this.nested=void 0,this._nestedArray=null,this._lookupCache=Object.create(null),this._needsRecursiveFeatureResolution=!0,this._needsRecursiveResolve=!0}function JCe(t){t._nestedArray=null,t._lookupCache=Object.create(null);for(var e=t;e=e.parent;)e._lookupCache=Object.create(null);return t}Object.defineProperty(gt.prototype,"nestedArray",{get:function(){return this._nestedArray||(this._nestedArray=gp.toArray(this.nested))}});gt.prototype.toJSON=function(e){return gp.toObject(["options",this.options,"nested",KCe(this.nestedArray,e)])};gt.prototype.addJSON=function(e,r){r=gp.checkDepth(r);var n=this;if(e)for(var i=Object.keys(e),s=0,o;s<i.length;++s)o=e[i[s]],n.add((o.fields!==void 0?mp.fromJSON:o.values!==void 0?_p.fromJSON:o.methods!==void 0?F_.fromJSON:o.id!==void 0?N5.fromJSON:gt.fromJSON)(i[s],o,r+1));return this};gt.prototype.get=function(e){return this.nested&&Object.prototype.hasOwnProperty.call(this.nested,e)?this.nested[e]:null};gt.prototype.getEnum=function(e){if(this.nested&&Object.prototype.hasOwnProperty.call(this.nested,e)&&this.nested[e]instanceof _p)return this.nested[e].values;throw Error("no such enum: "+e)};gt.prototype.add=function(e){if(!(e instanceof N5&&e.extend!==void 0||e instanceof mp||e instanceof $xt||e instanceof _p||e instanceof F_||e instanceof gt))throw TypeError("object must be a valid nested object");if(e.name==="__proto__")return this;if(!this.nested)this.nested={};else{var r=this.get(e.name);if(r)if(r instanceof gt&&e instanceof gt&&!(r instanceof mp||r instanceof F_)){for(var n=r.nestedArray,i=0;i<n.length;++i)e.add(n[i]);this.remove(r),this.nested||(this.nested={}),e.setOptions(r.options,!0)}else throw Error("duplicate name '"+e.name+"' in "+this)}this.nested[e.name]=e,this instanceof mp||this instanceof F_||this instanceof _p||this instanceof N5||e._edition||(e._edition=e._defaultEdition),this._needsRecursiveFeatureResolution=!0,this._needsRecursiveResolve=!0;for(var s=this;s=s.parent;)s._needsRecursiveFeatureResolution=!0,s._needsRecursiveResolve=!0;return e.onAdd(this),JCe(this)};gt.prototype.remove=function(e){if(!(e instanceof T$))throw TypeError("object must be a ReflectionObject");if(e.parent!==this)throw Error(e+" is not a member of "+this);return delete this.nested[e.name],Object.keys(this.nested).length||(this.nested=void 0),e.onRemove(this),JCe(this)};gt.prototype.define=function(e,r){if(gp.isString(e))e=e.split(".");else if(!Array.isArray(e))throw TypeError("illegal path");if(e&&e.length&&e[0]==="")throw Error("path must be relative");if(e.length>gp.recursionLimit)throw Error("max depth exceeded");for(var n=this;e.length>0;){var i=e.shift();if(n.nested&&n.nested[i]){if(n=n.nested[i],!(n instanceof gt))throw Error("path conflicts with non-namespace objects")}else n.add(n=new gt(i))}return r&&n.addJSON(r),n};gt.prototype.resolveAll=function(){if(!this._needsRecursiveResolve)return this;this._resolveFeaturesRecursive(this._edition);var e=this.nestedArray,r=0;for(this.resolve();r<e.length;)e[r]instanceof gt?e[r++].resolveAll():e[r++].resolve();return this._needsRecursiveResolve=!1,this};gt.prototype._resolveFeaturesRecursive=function(e){return this._needsRecursiveFeatureResolution?(this._needsRecursiveFeatureResolution=!1,e=this._edition||e,T$.prototype._resolveFeaturesRecursive.call(this,e),this.nestedArray.forEach(r=>{r._resolveFeaturesRecursive(e)}),this):this};gt.prototype.lookup=function(e,r,n){if(typeof r=="boolean"?(n=r,r=void 0):r&&!Array.isArray(r)&&(r=[r]),gp.isString(e)&&e.length){if(e===".")return this.root;e=e.split(".")}else if(!e.length)return this;var i=e.join(".");if(e[0]==="")return this.root.lookup(e.slice(1),r);var s=this.root._fullyQualifiedObjects&&this.root._fullyQualifiedObjects["."+i];if(s&&(!r||r.indexOf(s.constructor)>-1)||(s=this._lookupImpl(e,i),s&&(!r||r.indexOf(s.constructor)>-1)))return s;if(n)return null;for(var o=this;o.parent;){if(s=o.parent._lookupImpl(e,i),s&&(!r||r.indexOf(s.constructor)>-1))return s;o=o.parent}return null};gt.prototype._lookupImpl=function(e,r){if(Object.prototype.hasOwnProperty.call(this._lookupCache,r))return this._lookupCache[r];var n=this.get(e[0]),i=null;if(n)e.length===1?i=n:n instanceof gt&&(e=e.slice(1),i=n._lookupImpl(e,e.join(".")));else for(var s=0;s<this.nestedArray.length;++s)if(this._nestedArray[s]instanceof gt&&(n=this._nestedArray[s]._lookupImpl(e,r))){i=n;break}return this._lookupCache[r]=i,i};gt.prototype.lookupType=function(e){var r=this.lookup(e,[mp]);if(!r)throw Error("no such type: "+e);return r};gt.prototype.lookupEnum=function(e){var r=this.lookup(e,[_p]);if(!r)throw Error("no such Enum '"+e+"' in "+this);return r};gt.prototype.lookupTypeOrEnum=function(e){var r=this.lookup(e,[mp,_p]);if(!r)throw Error("no such Type or Enum '"+e+"' in "+this);return r};gt.prototype.lookupService=function(e){var r=this.lookup(e,[F_]);if(!r)throw Error("no such Service '"+e+"' in "+this);return r};gt._configure=function(t,e,r){mp=t,F_=e,_p=r}});var w$=E((zwr,XCe)=>{"use strict";XCe.exports=zc;var k5=zu();((zc.prototype=Object.create(k5.prototype)).constructor=zc).className="MapField";var Lxt=Sp(),aw=Gr();function zc(t,e,r,n,i,s){if(k5.call(this,t,e,n,void 0,void 0,i,s),!aw.isString(r))throw TypeError("keyType must be a string");this.keyType=r,this.resolvedKeyType=null,this.map=!0}zc.fromJSON=function(e,r){return new zc(e,r.id,r.keyType,r.type,r.options,r.comment)};zc.prototype.toJSON=function(e){var r=e?!!e.keepComments:!1;return aw.toObject(["keyType",this.keyType,"type",this.type,"id",this.id,"extend",this.extend,"options",this.options,"comment",r?this.comment:void 0])};zc.prototype.resolve=function(){if(this.resolved)return this;if(Lxt.mapKey[this.keyType]===void 0)throw Error("invalid key type: "+this.keyType);return k5.prototype.resolve.call(this)};zc.d=function(e,r,n){return typeof n=="function"?n=aw.decorateType(n).name:n&&typeof n=="object"&&(n=aw.decorateEnum(n).name),function(s,o){aw.decorateType(s.constructor).add(new zc(o,e,r,n))}}});var A$=E((Vwr,QCe)=>{"use strict";QCe.exports=Ep;var $5=Vu();((Ep.prototype=Object.create($5.prototype)).constructor=Ep).className="Method";var q_=Gr();function Ep(t,e,r,n,i,s,o,a,c){if(q_.isObject(i)?(o=i,i=s=void 0):q_.isObject(s)&&(o=s,s=void 0),!(e===void 0||q_.isString(e)))throw TypeError("type must be a string");if(!q_.isString(r))throw TypeError("requestType must be a string");if(!q_.isString(n))throw TypeError("responseType must be a string");$5.call(this,t,o),this.type=e||"rpc",this.requestType=r,this.requestStream=i?!0:void 0,this.responseType=n,this.responseStream=s?!0:void 0,this.resolvedRequestType=null,this.resolvedResponseType=null,this.comment=a,this.parsedOptions=c}Ep.fromJSON=function(e,r){return new Ep(e,r.type,r.requestType,r.responseType,r.requestStream,r.responseStream,r.options,r.comment,r.parsedOptions)};Ep.prototype.toJSON=function(e){var r=e?!!e.keepComments:!1;return q_.toObject(["type",this.type!=="rpc"&&this.type||void 0,"requestType",this.requestType,"requestStream",this.requestStream,"responseType",this.responseType,"responseStream",this.responseStream,"options",this.options,"comment",r?this.comment:void 0,"parsedOptions",this.parsedOptions])};Ep.prototype.resolve=function(){return this.resolved?this:(this.resolvedRequestType=this.parent.lookupType(this.requestType),this.resolvedResponseType=this.parent.lookupType(this.responseType),$5.prototype.resolve.call(this))}});var R$=E((Hwr,tNe)=>{"use strict";tNe.exports=zi;var Vc=j_();((zi.prototype=Object.create(Vc.prototype)).constructor=zi).className="Service";var L5=A$(),B_=Gr(),Dxt=A5(),Mxt=B_.patterns.reservedRe;function zi(t,e){Vc.call(this,t,e),this.methods={},this._methodsArray=null}zi.fromJSON=function(e,r,n){n=B_.checkDepth(n);var i=new zi(e,r.options);if(r.methods)for(var s=Object.keys(r.methods),o=0;o<s.length;++o)i.add(L5.fromJSON(s[o],r.methods[s[o]]));return r.nested&&i.addJSON(r.nested,n),r.edition&&(i._edition=r.edition),i.comment=r.comment,i._defaultEdition="proto3",i};zi.prototype.toJSON=function(e){var r=Vc.prototype.toJSON.call(this,e),n=e?!!e.keepComments:!1;return B_.toObject(["edition",this._editionToJSON(),"options",r&&r.options||void 0,"methods",Vc.arrayToJSON(this.methodsArray,e)||{},"nested",r&&r.nested||void 0,"comment",n?this.comment:void 0])};Object.defineProperty(zi.prototype,"methodsArray",{get:function(){return this._methodsArray||(this._methodsArray=B_.toArray(this.methods))}});function eNe(t){return t._methodsArray=null,t}zi.prototype.get=function(e){return Object.prototype.hasOwnProperty.call(this.methods,e)?this.methods[e]:Vc.prototype.get.call(this,e)};zi.prototype.resolveAll=function(){if(!this._needsRecursiveResolve)return this;Vc.prototype.resolve.call(this);for(var e=this.methodsArray,r=0;r<e.length;++r)e[r].resolve();return this};zi.prototype._resolveFeaturesRecursive=function(e){return this._needsRecursiveFeatureResolution?(e=this._edition||e,Vc.prototype._resolveFeaturesRecursive.call(this,e),this.methodsArray.forEach(r=>{r._resolveFeaturesRecursive(e)}),this):this};zi.prototype.add=function(e){if(this.get(e.name))throw Error("duplicate name '"+e.name+"' in "+this);return e instanceof L5?e.name==="__proto__"?this:(this.methods[e.name]=e,e.parent=this,eNe(this)):Vc.prototype.add.call(this,e)};zi.prototype.remove=function(e){if(e instanceof L5){if(this.methods[e.name]!==e)throw Error(e+" is not a member of "+this);return delete this.methods[e.name],e.parent=null,eNe(this)}return Vc.prototype.remove.call(this,e)};zi.prototype.create=function(e,r,n){for(var i=new Dxt.Service(e,r,n),s=0,o;s<this.methodsArray.length;++s){var a=B_.lcFirst((o=this._methodsArray[s]).resolve().name).replace(/[^$\w_]/g,"");i[a]=B_.codegen(["r","c"],Mxt.test(a)?a+"_":a)("return this.rpcCall(m,q,s,r,c)")({m:o,q:o.resolvedRequestType.ctor,s:o.resolvedResponseType.ctor})}return i}});var x$=E((Gwr,rNe)=>{"use strict";rNe.exports=Ea;var Uxt=mo();function Ea(t){if(t)for(var e=Object.keys(t),r=0;r<e.length;++r){var n=e[r];n!=="__proto__"&&(this[n]=t[n])}}Ea.create=function(e){return this.$type.create(e)};Ea.encode=function(e,r){return this.$type.encode(e,r)};Ea.encodeDelimited=function(e,r){return this.$type.encodeDelimited(e,r)};Ea.decode=function(e){return this.$type.decode(e)};Ea.decodeDelimited=function(e){return this.$type.decodeDelimited(e)};Ea.verify=function(e){return this.$type.verify(e)};Ea.fromObject=function(e){return this.$type.fromObject(e)};Ea.toObject=function(e,r){return this.$type.toObject(e,r)};Ea.prototype.toJSON=function(){return this.$type.toObject(this,Uxt.toJSONOptions)}});var D5=E((Wwr,iNe)=>{"use strict";iNe.exports=qxt;var Fxt=_o(),Hc=Sp(),nNe=Gr();function jxt(t){return"missing required '"+t.name+"'"}function qxt(t){for(var e=nNe.codegen(["r","l","e","n"],t.name+"$decode")("if(!(r instanceof Reader))")("r=Reader.create(r)")("if(n===undefined)n=0")("if(n>Reader.recursionLimit)")('throw Error("maximum nesting depth exceeded")')("var c=l===undefined?r.len:r.pos+l,m=new this.ctor"+(t.fieldsArray.filter(function(a){return a.map}).length?",k,value":""))("while(r.pos<c){")("var t=r.uint32()")("if(t===e)")("break")("switch(t>>>3){"),r=0;r<t.fieldsArray.length;++r){var n=t._fieldsArray[r].resolve(),i=n.resolvedType instanceof Fxt?"int32":n.type,s="m"+nNe.safeProp(n.name);e("case %i: {",n.id),n.map?(e("if(%s===util.emptyObject)",s)("%s={}",s)("var c2 = r.uint32()+r.pos"),Hc.defaults[n.keyType]!==void 0?e("k=%j",Hc.defaults[n.keyType]):e("k=null"),Hc.defaults[i]!==void 0?e("value=%j",Hc.defaults[i]):e("value=null"),e("while(r.pos<c2){")("var tag2=r.uint32()")("switch(tag2>>>3){")("case 1: k=r.%s(); break",n.keyType)("case 2:"),Hc.basic[i]===void 0?e("value=types[%i].decode(r,r.uint32(),undefined,n+1)",r):e("value=r.%s()",i),e("break")("default:")("r.skipType(tag2&7,n)")("break")("}")("}"),Hc.long[n.keyType]!==void 0?e('%s[typeof k==="object"?util.longToHash(k):k]=value',s):(n.keyType==="string"&&e('if(k==="__proto__")')("util.makeProp(%s,k)",s),e("%s[k]=value",s))):n.repeated?(e("if(!(%s&&%s.length))",s,s)("%s=[]",s),Hc.packed[i]!==void 0&&e("if((t&7)===2){")("var c2=r.uint32()+r.pos")("while(r.pos<c2)")("%s.push(r.%s())",s,i)("}else"),Hc.basic[i]===void 0?e(n.delimited?"%s.push(types[%i].decode(r,undefined,((t&~7)|4),n+1))":"%s.push(types[%i].decode(r,r.uint32(),undefined,n+1))",s,r):e("%s.push(r.%s())",s,i)):Hc.basic[i]===void 0?e(n.delimited?"%s=types[%i].decode(r,undefined,((t&~7)|4),n+1)":"%s=types[%i].decode(r,r.uint32(),undefined,n+1)",s,r):e("%s=r.%s()",s,i),e("break")("}")}for(e("default:")("r.skipType(t&7,n)")("break")("}")("}"),r=0;r<t._fieldsArray.length;++r){var o=t._fieldsArray[r];o.required&&e("if(!m.hasOwnProperty(%j))",o.name)("throw util.ProtocolError(%j,{instance:m})",jxt(o))}return e("return m")}});var F5=E((Ywr,sNe)=>{"use strict";sNe.exports=Vxt;var Bxt=_o(),M5=Gr();function Ns(t,e){return t.name+": "+e+(t.repeated&&e!=="array"?"[]":t.map&&e!=="object"?"{k:"+t.keyType+"}":"")+" expected"}function U5(t,e,r,n){if(e.resolvedType)if(e.resolvedType instanceof Bxt){t("switch(%s){",n)("default:")("return%j",Ns(e,"enum value"));for(var i=Object.keys(e.resolvedType.values),s=0;s<i.length;++s)t("case %i:",e.resolvedType.values[i[s]]);t("break")("}")}else t("{")("var e=types[%i].verify(%s,n+1);",r,n)("if(e)")("return%j+e",e.name+".")("}");else switch(e.type){case"int32":case"uint32":case"sint32":case"fixed32":case"sfixed32":t("if(!util.isInteger(%s))",n)("return%j",Ns(e,"integer"));break;case"int64":case"uint64":case"sint64":case"fixed64":case"sfixed64":t("if(!util.isInteger(%s)&&!(%s&&util.isInteger(%s.low)&&util.isInteger(%s.high)))",n,n,n,n)("return%j",Ns(e,"integer|Long"));break;case"float":case"double":t('if(typeof %s!=="number")',n)("return%j",Ns(e,"number"));break;case"bool":t('if(typeof %s!=="boolean")',n)("return%j",Ns(e,"boolean"));break;case"string":t("if(!util.isString(%s))",n)("return%j",Ns(e,"string"));break;case"bytes":t('if(!(%s&&typeof %s.length==="number"||util.isString(%s)))',n,n,n)("return%j",Ns(e,"buffer"));break}return t}function zxt(t,e,r){switch(e.keyType){case"int32":case"uint32":case"sint32":case"fixed32":case"sfixed32":t("if(!util.key32Re.test(%s))",r)("return%j",Ns(e,"integer key"));break;case"int64":case"uint64":case"sint64":case"fixed64":case"sfixed64":t("if(!util.key64Re.test(%s))",r)("return%j",Ns(e,"integer|Long key"));break;case"bool":t("if(!util.key2Re.test(%s))",r)("return%j",Ns(e,"boolean key"));break}return t}function Vxt(t){var e=M5.codegen(["m","n"],t.name+"$verify")('if(typeof m!=="object"||m===null)')("return%j","object expected")("if(n===undefined)n=0")("if(n>util.recursionLimit)")("return%j","maximum nesting depth exceeded"),r=t.oneofsArray,n={};r.length&&e("var p={}");for(var i=0;i<t.fieldsArray.length;++i){var s=t._fieldsArray[i].resolve(),o="m"+M5.safeProp(s.name);if(s.optional&&e("if(%s!=null&&m.hasOwnProperty(%j)){",o,s.name),s.map)e("if(!util.isObject(%s))",o)("return%j",Ns(s,"object"))("var k=Object.keys(%s)",o)("for(var i=0;i<k.length;++i){"),zxt(e,s,"k[i]"),U5(e,s,i,o+"[k[i]]")("}");else if(s.repeated)e("if(!Array.isArray(%s))",o)("return%j",Ns(s,"array"))("for(var i=0;i<%s.length;++i){",o),U5(e,s,i,o+"[i]")("}");else{if(s.partOf){var a=M5.safeProp(s.partOf.name);n[s.partOf.name]===1&&e("if(p%s===1)",a)("return%j",s.partOf.name+": multiple values"),n[s.partOf.name]=1,e("p%s=1",a)}U5(e,s,i,o)}s.optional&&e("}")}return e("return null")}});var B5=E(aNe=>{"use strict";var oNe=aNe,cw=_o(),va=Gr();function j5(t,e,r,n){var i=!1;if(e.resolvedType)if(e.resolvedType instanceof cw){t("switch(d%s){",n);for(var s=e.resolvedType.values,o=Object.keys(s),a=0;a<o.length;++a)s[o[a]]===e.typeDefault&&!i&&(t("default:")('if(typeof(d%s)==="number"){m%s=d%s;break}',n,n,n),e.repeated||t("break"),i=!0),t("case%j:",o[a])("case %i:",s[o[a]])("m%s=%j",n,s[o[a]])("break");t("}")}else t('if(typeof d%s!=="object")',n)("throw TypeError(%j)",e.fullName+": object expected")("m%s=types[%i].fromObject(d%s,n+1)",n,r,n);else{var c=!1;switch(e.type){case"double":case"float":t("m%s=Number(d%s)",n,n);break;case"uint32":case"fixed32":t("m%s=d%s>>>0",n,n);break;case"int32":case"sint32":case"sfixed32":t("m%s=d%s|0",n,n);break;case"uint64":case"fixed64":c=!0;case"int64":case"sint64":case"sfixed64":t("if(util.Long)")("m%s=util.Long.fromValue(d%s,%j)",n,n,c)('else if(typeof d%s==="string")',n)("m%s=parseInt(d%s,10)",n,n)('else if(typeof d%s==="number")',n)("m%s=d%s",n,n)('else if(typeof d%s==="object")',n)("m%s=new util.LongBits(d%s.low>>>0,d%s.high>>>0).toNumber(%s)",n,n,n,c?"true":"");break;case"bytes":t('if(typeof d%s==="string")',n)("util.base64.decode(d%s,m%s=util.newBuffer(util.base64.length(d%s)),0)",n,n,n)("else if(d%s.length >= 0)",n)("m%s=d%s",n,n);break;case"string":t("m%s=String(d%s)",n,n);break;case"bool":t("m%s=Boolean(d%s)",n,n);break}}return t}oNe.fromObject=function(e){var r=e.fieldsArray,n=va.codegen(["d","n"],e.name+"$fromObject")("if(d instanceof this.ctor)")("return d")("if(n===undefined)n=0")("if(n>util.recursionLimit)")('throw Error("maximum nesting depth exceeded")');if(!r.length)return n("return new this.ctor");n("var m=new this.ctor");for(var i=0;i<r.length;++i){var s=r[i].resolve(),o=va.safeProp(s.name);s.map?(n("if(d%s){",o)('if(typeof d%s!=="object")',o)("throw TypeError(%j)",s.fullName+": object expected")("m%s={}",o)("for(var ks=Object.keys(d%s),i=0;i<ks.length;++i){",o),n('if(ks[i]==="__proto__")')("util.makeProp(m%s,ks[i])",o),j5(n,s,i,o+"[ks[i]]")("}")("}")):s.repeated?(n("if(d%s){",o)("if(!Array.isArray(d%s))",o)("throw TypeError(%j)",s.fullName+": array expected")("m%s=[]",o)("for(var i=0;i<d%s.length;++i){",o),j5(n,s,i,o+"[i]")("}")("}")):(s.resolvedType instanceof cw||n("if(d%s!=null){",o),j5(n,s,i,o),s.resolvedType instanceof cw||n("}"))}return n("return m")};function q5(t,e,r,n){if(e.resolvedType)e.resolvedType instanceof cw?t("d%s=o.enums===String?(types[%i].values[m%s]===undefined?m%s:types[%i].values[m%s]):m%s",n,r,n,n,r,n,n):t("d%s=types[%i].toObject(m%s,o,q+1)",n,r,n);else{var i=!1;switch(e.type){case"double":case"float":t("d%s=o.json&&!isFinite(m%s)?String(m%s):m%s",n,n,n,n);break;case"uint64":case"fixed64":i=!0;case"int64":case"sint64":case"sfixed64":t('if(typeof BigInt!=="undefined"&&o.longs===BigInt)')('d%s=typeof m%s==="number"?BigInt(m%s):util.Long.fromBits(m%s.low>>>0,m%s.high>>>0,%j).toBigInt()',n,n,n,n,n,i)('else if(typeof m%s==="number")',n)("d%s=o.longs===String?String(m%s):m%s",n,n,n)("else")("d%s=o.longs===String?util.Long.prototype.toString.call(m%s):o.longs===Number?new util.LongBits(m%s.low>>>0,m%s.high>>>0).toNumber(%s):m%s",n,n,n,n,i?"true":"",n);break;case"bytes":t("d%s=o.bytes===String?util.base64.encode(m%s,0,m%s.length):o.bytes===Array?Array.prototype.slice.call(m%s):m%s",n,n,n,n,n);break;default:t("d%s=m%s",n,n);break}}return t}oNe.toObject=function(e){var r=e.fieldsArray.slice().sort(va.compareFieldsById);if(!r.length)return va.codegen()("return {}");for(var n=va.codegen(["m","o","q"],e.name+"$toObject")("if(!o)")("o={}")("if(q===undefined)q=0")("if(q>util.recursionLimit)")('throw Error("max depth exceeded")')("var d={}"),i=[],s=[],o=[],a=0;a<r.length;++a)r[a].partOf||(r[a].resolve().repeated?i:r[a].map?s:o).push(r[a]);if(i.length){for(n("if(o.arrays||o.defaults){"),a=0;a<i.length;++a)n("d%s=[]",va.safeProp(i[a].name));n("}")}if(s.length){for(n("if(o.objects||o.defaults){"),a=0;a<s.length;++a)n("d%s={}",va.safeProp(s[a].name));n("}")}if(o.length){for(n("if(o.defaults){"),a=0;a<o.length;++a){var c=o[a],l=va.safeProp(c.name);if(c.resolvedType instanceof cw)n("d%s=o.enums===String?%j:%j",l,c.resolvedType.valuesById[c.typeDefault],c.typeDefault);else if(c.long)n("if(util.Long){")("var n=new util.Long(%i,%i,%j)",c.typeDefault.low,c.typeDefault.high,c.typeDefault.unsigned)('d%s=o.longs===String?n.toString():o.longs===Number?n.toNumber():typeof BigInt!=="undefined"&&o.longs===BigInt?n.toBigInt():n',l)("}else")('d%s=o.longs===String?%j:typeof BigInt!=="undefined"&&o.longs===BigInt?BigInt(%j):%i',l,c.typeDefault.toString(),c.typeDefault.toString(),c.typeDefault.toNumber());else if(c.bytes){var u=Array.prototype.slice.call(c.typeDefault);n("if(o.bytes===String)d%s=%j",l,String.fromCharCode.apply(String,c.typeDefault))("else{")("d%s=%j",l,u)("if(o.bytes!==Array)d%s=util.newBuffer(d%s)",l,l)("}")}else n("d%s=%j",l,c.typeDefault)}n("}")}var d=!1;for(a=0;a<r.length;++a){var c=r[a],f=e._fieldsArray.indexOf(c),l=va.safeProp(c.name);c.map?(d||(d=!0,n("var ks2")),n("if(m%s&&(ks2=Object.keys(m%s)).length){",l,l)("d%s={}",l)("for(var j=0;j<ks2.length;++j){"),n('if(ks2[j]==="__proto__")')("util.makeProp(d%s,ks2[j])",l),q5(n,c,f,l+"[ks2[j]]")("}")):c.repeated?(n("if(m%s&&m%s.length){",l,l)("d%s=[]",l)("for(var j=0;j<m%s.length;++j){",l),q5(n,c,f,l+"[j]")("}")):(n("if(m%s!=null&&m.hasOwnProperty(%j)){",l,c.name),q5(n,c,f,l),c.partOf&&n("if(o.oneofs)")("d%s=%j",va.safeProp(c.partOf.name),c.name)),n("}")}return n("return d")}});var z5=E(cNe=>{"use strict";var Hxt=cNe,Gxt=x$(),Wxt=mo();Hxt[".google.protobuf.Any"]={fromObject:function(t,e){if(t&&t["@type"]){var r=t["@type"].substring(t["@type"].lastIndexOf("/")+1),n=this.lookup(r);if(n){var i=t["@type"].charAt(0)==="."?t["@type"].slice(1):t["@type"];return i.indexOf("/")===-1&&(i="/"+i),this.create({type_url:i,value:n.encode(n.fromObject(t,e===void 0?1:e+1)).finish()})}}return this.fromObject(t,e)},toObject:function(t,e,r){if(r===void 0&&(r=0),r>Wxt.recursionLimit)throw Error("max depth exceeded");var n="type.googleapis.com/",i="",s="";if(e&&e.json&&t.type_url&&t.value){s=t.type_url.substring(t.type_url.lastIndexOf("/")+1),i=t.type_url.substring(0,t.type_url.lastIndexOf("/")+1);var o=this.lookup(s);o&&(t=o.decode(t.value,void 0,void 0,r+1))}if(!(t instanceof this.ctor)&&t instanceof Gxt){var a=t.$type.toObject(t,e,r+1),c=t.$type.fullName[0]==="."?t.$type.fullName.slice(1):t.$type.fullName;return i===""&&(i=n),s=i+c,a["@type"]=s,a}return this.toObject(t,e,r)}}});var P$=E((Zwr,uNe)=>{"use strict";uNe.exports=Bt;var ks=j_();((Bt.prototype=Object.create(ks.prototype)).constructor=Bt).className="Type";var Yxt=_o(),G5=yp(),I$=zu(),Kxt=w$(),Jxt=R$(),V5=x$(),H5=b$(),Zxt=E$(),gn=Gr(),Xxt=W5(),Qxt=D5(),eIt=F5(),lNe=B5(),tIt=z5();function Bt(t,e){t=t.replace(/\W/g,""),ks.call(this,t,e),this.fields={},this.oneofs=void 0,this.extensions=void 0,this.reserved=void 0,this.group=void 0,this._fieldsById=null,this._fieldsArray=null,this._oneofsArray=null,this._ctor=null}Object.defineProperties(Bt.prototype,{fieldsById:{get:function(){if(this._fieldsById)return this._fieldsById;this._fieldsById={};for(var t=Object.keys(this.fields),e=0;e<t.length;++e){var r=this.fields[t[e]],n=r.id;if(this._fieldsById[n])throw Error("duplicate id "+n+" in "+this);this._fieldsById[n]=r}return this._fieldsById}},fieldsArray:{get:function(){return this._fieldsArray||(this._fieldsArray=gn.toArray(this.fields))}},oneofsArray:{get:function(){return this._oneofsArray||(this._oneofsArray=gn.toArray(this.oneofs))}},ctor:{get:function(){return this._ctor||(this.ctor=Bt.generateConstructor(this)())},set:function(t){var e=t.prototype;e instanceof V5||((t.prototype=new V5).constructor=t,gn.merge(t.prototype,e)),t.$type=t.prototype.$type=this,gn.merge(t,V5,!0),this._ctor=t;for(var r=0;r<this.fieldsArray.length;++r)this._fieldsArray[r].resolve();var n={};for(r=0;r<this.oneofsArray.length;++r)n[this._oneofsArray[r].resolve().name]={get:gn.oneOfGetter(this._oneofsArray[r].oneof),set:gn.oneOfSetter(this._oneofsArray[r].oneof)};r&&Object.defineProperties(t.prototype,n)}}});Bt.generateConstructor=function(e){for(var r=gn.codegen(["p"],e.name),n=0,i;n<e.fieldsArray.length;++n)(i=e._fieldsArray[n]).map?r("this%s={}",gn.safeProp(i.name)):i.repeated&&r("this%s=[]",gn.safeProp(i.name));return r('if(p)for(var ks=Object.keys(p),i=0;i<ks.length;++i)if(p[ks[i]]!=null&&ks[i]!=="__proto__")')("this[ks[i]]=p[ks[i]]")};function O$(t){return t._fieldsById=t._fieldsArray=t._oneofsArray=null,delete t.encode,delete t.decode,delete t.verify,t}Bt.fromJSON=function(e,r,n){if(n===void 0&&(n=0),n>gn.nestingLimit)throw Error("max depth exceeded");var i=new Bt(e,r.options);i.extensions=r.extensions,i.reserved=r.reserved;for(var s=Object.keys(r.fields),o=0;o<s.length;++o)i.add((typeof r.fields[s[o]].keyType<"u"?Kxt.fromJSON:I$.fromJSON)(s[o],r.fields[s[o]]));if(r.oneofs)for(s=Object.keys(r.oneofs),o=0;o<s.length;++o)i.add(G5.fromJSON(s[o],r.oneofs[s[o]]));if(r.nested)for(s=Object.keys(r.nested),o=0;o<s.length;++o){var a=r.nested[s[o]];i.add((a.id!==void 0?I$.fromJSON:a.fields!==void 0?Bt.fromJSON:a.values!==void 0?Yxt.fromJSON:a.methods!==void 0?Jxt.fromJSON:ks.fromJSON)(s[o],a,n+1))}return r.extensions&&r.extensions.length&&(i.extensions=r.extensions),r.reserved&&r.reserved.length&&(i.reserved=r.reserved),r.group&&(i.group=!0),r.comment&&(i.comment=r.comment),r.edition&&(i._edition=r.edition),i._defaultEdition="proto3",i};Bt.prototype.toJSON=function(e){var r=ks.prototype.toJSON.call(this,e),n=e?!!e.keepComments:!1;return gn.toObject(["edition",this._editionToJSON(),"options",r&&r.options||void 0,"oneofs",ks.arrayToJSON(this.oneofsArray,e),"fields",ks.arrayToJSON(this.fieldsArray.filter(function(i){return!i.declaringField}),e)||{},"extensions",this.extensions&&this.extensions.length?this.extensions:void 0,"reserved",this.reserved&&this.reserved.length?this.reserved:void 0,"group",this.group||void 0,"nested",r&&r.nested||void 0,"comment",n?this.comment:void 0])};Bt.prototype.resolveAll=function(){if(!this._needsRecursiveResolve)return this;ks.prototype.resolveAll.call(this);var e=this.oneofsArray;for(n=0;n<e.length;)e[n++].resolve();for(var r=this.fieldsArray,n=0;n<r.length;)r[n++].resolve();return this};Bt.prototype._resolveFeaturesRecursive=function(e){return this._needsRecursiveFeatureResolution?(e=this._edition||e,ks.prototype._resolveFeaturesRecursive.call(this,e),this.oneofsArray.forEach(r=>{r._resolveFeatures(e)}),this.fieldsArray.forEach(r=>{r._resolveFeatures(e)}),this):this};Bt.prototype.get=function(e){return Object.prototype.hasOwnProperty.call(this.fields,e)?this.fields[e]:this.oneofs&&Object.prototype.hasOwnProperty.call(this.oneofs,e)?this.oneofs[e]:this.nested&&Object.prototype.hasOwnProperty.call(this.nested,e)?this.nested[e]:null};Bt.prototype.add=function(e){if(this.get(e.name))throw Error("duplicate name '"+e.name+"' in "+this);if(e instanceof I$&&e.extend===void 0){if(this._fieldsById?this._fieldsById[e.id]:this.fieldsById[e.id])throw Error("duplicate id "+e.id+" in "+this);if(this.isReservedId(e.id))throw Error("id "+e.id+" is reserved in "+this);if(this.isReservedName(e.name))throw Error("name '"+e.name+"' is reserved in "+this);return e.name==="__proto__"?this:(e.parent&&e.parent.remove(e),this.fields[e.name]=e,e.message=this,e.onAdd(this),O$(this))}return e instanceof G5?e.name==="__proto__"?this:(this.oneofs||(this.oneofs={}),this.oneofs[e.name]=e,e.onAdd(this),O$(this)):ks.prototype.add.call(this,e)};Bt.prototype.remove=function(e){if(e instanceof I$&&e.extend===void 0){if(!this.fields||this.fields[e.name]!==e)throw Error(e+" is not a member of "+this);return delete this.fields[e.name],e.parent=null,e.onRemove(this),O$(this)}if(e instanceof G5){if(!this.oneofs||this.oneofs[e.name]!==e)throw Error(e+" is not a member of "+this);return delete this.oneofs[e.name],e.parent=null,e.onRemove(this),O$(this)}return ks.prototype.remove.call(this,e)};Bt.prototype.isReservedId=function(e){return ks.isReservedId(this.reserved,e)};Bt.prototype.isReservedName=function(e){return ks.isReservedName(this.reserved,e)};Bt.prototype.create=function(e){return new this.ctor(e)};Bt.prototype.setup=function(){for(var e=this.fullName,r=[],n=0;n<this.fieldsArray.length;++n)r.push(this._fieldsArray[n].resolve().resolvedType);this.encode=Xxt(this)({Writer:Zxt,types:r,util:gn}),this.decode=Qxt(this)({Reader:H5,types:r,util:gn}),this.verify=eIt(this)({types:r,util:gn}),this.fromObject=lNe.fromObject(this)({types:r,util:gn}),this.toObject=lNe.toObject(this)({types:r,util:gn});var i=tIt[e];if(i){var s=Object.create(this);s.fromObject=this.fromObject,this.fromObject=i.fromObject.bind(s),s.toObject=this.toObject,this.toObject=i.toObject.bind(s)}return this};Bt.prototype.encode=function(e,r){return this.setup().encode.apply(this,arguments)};Bt.prototype.encodeDelimited=function(e,r){return this.encode(e,r&&r.len?r.fork():r).ldelim()};Bt.prototype.decode=function(e,r,n,i){return this.setup().decode(e,r,n,i)};Bt.prototype.decodeDelimited=function(e){return e instanceof H5||(e=H5.create(e)),this.decode(e,e.uint32())};Bt.prototype.verify=function(e,r){return this.setup().verify(e,r)};Bt.prototype.fromObject=function(e,r){return this.setup().fromObject(e,r)};Bt.prototype.toObject=function(e,r){return this.setup().toObject.apply(this,arguments)};Bt.d=function(e){return function(n){gn.decorateType(n,e)}}});var $$=E((Xwr,pNe)=>{"use strict";pNe.exports=Vi;var k$=j_();((Vi.prototype=Object.create(k$.prototype)).constructor=Vi).className="Root";var C$=zu(),Y5=_o(),rIt=yp(),ba=Gr(),K5,J5,lw;function Vi(t){k$.call(this,"",t),this.deferred=[],this.files=[],this._edition="proto2",this._fullyQualifiedObjects={}}Vi.fromJSON=function(e,r,n){return n=ba.checkDepth(n),r||(r=new Vi),e.options&&r.setOptions(e.options),r.addJSON(e.nested,n).resolveAll()};Vi.prototype.resolvePath=ba.path.resolve;Vi.prototype.fetch=ba.fetch;function fNe(){}Vi.prototype.load=function t(e,r,n){typeof r=="function"&&(n=r,r=void 0);var i=this;if(!n)return ba.asPromise(t,i,e,r);var s=n===fNe;function o(p,h){if(n){if(s)throw p;h&&h.resolveAll();var m=n;n=null,m(p,h)}}function a(p){var h=p.lastIndexOf("google/protobuf/");if(h>-1){var m=p.substring(h);if(m in lw)return m}return null}function c(p,h,m){m===void 0&&(m=0);try{if(m>ba.recursionLimit)throw Error("max depth exceeded");if(ba.isString(h)&&h.charAt(0)==="{"&&(h=JSON.parse(h)),!ba.isString(h))i.setOptions(h.options).addJSON(h.nested);else{J5.filename=p;var _=J5(h,i,r),y,v=0;if(_.imports)for(;v<_.imports.length;++v)(y=a(_.imports[v])||i.resolvePath(p,_.imports[v]))&&l(y,!1,m+1);if(_.weakImports)for(v=0;v<_.weakImports.length;++v)(y=a(_.weakImports[v])||i.resolvePath(p,_.weakImports[v]))&&l(y,!0,m+1)}}catch(S){o(S)}!s&&!u&&o(null,i)}function l(p,h,m){if(m===void 0&&(m=0),p=a(p)||p,!(i.files.indexOf(p)>-1)){if(i.files.push(p),p in lw){s?c(p,lw[p],m):(++u,setTimeout(function(){--u,c(p,lw[p],m)}));return}if(s){var _;try{_=ba.fs.readFileSync(p).toString("utf8")}catch(y){h||o(y);return}c(p,_,m)}else++u,i.fetch(p,function(y,v){if(--u,!!n){if(y){h?u||o(null,i):o(y);return}c(p,v,m)}})}}var u=0;ba.isString(e)&&(e=[e]);for(var d=0,f;d<e.length;++d)(f=i.resolvePath("",e[d]))&&l(f);return s?(i.resolveAll(),i):(u||o(null,i),i)};Vi.prototype.loadSync=function(e,r){if(!ba.isNode)throw Error("not supported");return this.load(e,r,fNe)};Vi.prototype.resolveAll=function(){if(!this._needsRecursiveResolve)return this;if(this.deferred.length)throw Error("unresolvable extensions: "+this.deferred.map(function(e){return"'extend "+e.extend+"' in "+e.parent.fullName}).join(", "));return k$.prototype.resolveAll.call(this)};var N$=/^[A-Z]/;function dNe(t,e){var r=e.parent.lookup(e.extend);if(r){var n=new C$(e.fullName,e.id,e.type,e.rule,void 0,e.options);return r.get(n.name)||(n.declaringField=e,e.extensionField=n,r.add(n)),!0}return!1}Vi.prototype._handleAdd=function(e){if(e instanceof C$)e.extend!==void 0&&!e.extensionField&&(dNe(this,e)||this.deferred.push(e));else if(e instanceof Y5)N$.test(e.name)&&(e.parent[e.name]=e.values);else if(!(e instanceof rIt)){if(e instanceof K5)for(var r=0;r<this.deferred.length;)dNe(this,this.deferred[r])?this.deferred.splice(r,1):++r;for(var n=0;n<e.nestedArray.length;++n)this._handleAdd(e._nestedArray[n]);N$.test(e.name)&&(e.parent[e.name]=e)}(e instanceof K5||e instanceof Y5||e instanceof C$)&&(this._fullyQualifiedObjects[e.fullName]=e)};Vi.prototype._handleRemove=function(e){if(e instanceof C$){if(e.extend!==void 0)if(e.extensionField)e.extensionField.parent.remove(e.extensionField),e.extensionField=null;else{var r=this.deferred.indexOf(e);r>-1&&this.deferred.splice(r,1)}}else if(e instanceof Y5)N$.test(e.name)&&delete e.parent[e.name];else if(e instanceof k$){for(var n=0;n<e.nestedArray.length;++n)this._handleRemove(e._nestedArray[n]);N$.test(e.name)&&delete e.parent[e.name]}delete this._fullyQualifiedObjects[e.fullName]};Vi._configure=function(t,e,r){K5=t,J5=e,lw=r}});var Gr=E((Qwr,gNe)=>{"use strict";var Qt=gNe.exports=mo(),hNe=R5(),Z5,X5;Qt.codegen=MCe();Qt.fetch=qCe();Qt.path=VCe();Qt.patterns=GCe();var mNe=Qt.patterns.reservedRe;Qt.fs=YCe();Qt.checkDepth=function(e){if(e===void 0&&(e=0),e>Qt.recursionLimit)throw Error("max depth exceeded");return e};Qt.toArray=function(e){if(e){for(var r=Object.keys(e),n=new Array(r.length),i=0;i<r.length;)n[i]=e[r[i++]];return n}return[]};Qt.toObject=function(e){for(var r={},n=0;n<e.length;){var i=e[n++],s=e[n++];s!==void 0&&(r[i]=s)}return r};Qt.isReserved=function(e){return mNe.test(e)};Qt.safeProp=function(e){return!/^[$\w_]+$/.test(e)||mNe.test(e)?"["+JSON.stringify(e)+"]":"."+e};Qt.ucFirst=function(e){return e.charAt(0).toUpperCase()+e.substring(1)};var nIt=/_([a-z])/g;Qt.camelCase=function(e){return e.substring(0,1)+e.substring(1).replace(nIt,function(r,n){return n.toUpperCase()})};Qt.compareFieldsById=function(e,r){return e.id-r.id};Qt.decorateType=function(e,r){if(e.$type)return r&&e.$type.name!==r&&(Qt.decorateRoot.remove(e.$type),e.$type.name=r,Qt.decorateRoot.add(e.$type)),e.$type;Z5||(Z5=P$());var n=new Z5(r||e.name);return Qt.decorateRoot.add(n),n.ctor=e,Object.defineProperty(e,"$type",{value:n,enumerable:!1}),Object.defineProperty(e.prototype,"$type",{value:n,enumerable:!1}),n};var iIt=0;Qt.decorateEnum=function(e){if(e.$type)return e.$type;X5||(X5=_o());var r=new X5("Enum"+iIt++,e);return Qt.decorateRoot.add(r),Object.defineProperty(e,"$type",{value:r,enumerable:!1}),r};Qt.setProperty=function(e,r,n,i){function s(o,a,c){var l=a.shift();if(Qt.isUnsafeProperty(l))return o;if(a.length>0)o[l]=s(o[l]||{},a,c);else{var u=o[l];if(u&&i)return o;u&&(c=[].concat(u).concat(c)),o[l]=c}return o}if(typeof e!="object")throw TypeError("dst must be an object");if(!r)throw TypeError("path must be specified");if(r=r.split("."),r.length>Qt.recursionLimit)throw Error("max depth exceeded");return s(e,r,n)};Object.defineProperty(Qt,"decorateRoot",{get:function(){return hNe.decorated||(hNe.decorated=new($$()))}})});var Sp=E(_Ne=>{"use strict";var uw=_Ne,sIt=Gr(),oIt=["double","float","int32","uint32","sint32","fixed32","sfixed32","int64","uint64","sint64","fixed64","sfixed64","bool","string","bytes"];function dw(t,e){var r=0,n=Object.create(null);for(e|=0;r<t.length;)n[oIt[r+e]]=t[r++];return n}uw.basic=dw([1,5,0,0,0,5,5,0,0,0,1,1,0,2,2]);uw.defaults=dw([0,0,0,0,0,0,0,0,0,0,0,0,!1,"",sIt.emptyArray,null]);uw.long=dw([0,0,0,1,1],7);uw.mapKey=dw([0,0,0,5,5,0,0,0,1,1,0,2],2);uw.packed=dw([1,5,0,0,0,5,5,0,0,0,1,1,0])});var zu=E((t0r,SNe)=>{"use strict";SNe.exports=Wr;var pw=Vu();((Wr.prototype=Object.create(pw.prototype)).constructor=Wr).className="Field";var yNe=_o(),Q5=Sp(),xr=Gr(),fw,aIt=/^required|optional|repeated$/;Wr.fromJSON=function(e,r){var n=new Wr(e,r.id,r.type,r.rule,r.extend,r.options,r.comment);return r.edition&&(n._edition=r.edition),n._defaultEdition="proto3",n};function Wr(t,e,r,n,i,s,o){if(xr.isObject(n)?(o=i,s=n,n=i=void 0):xr.isObject(i)&&(o=s,s=i,i=void 0),pw.call(this,t,s),!xr.isInteger(e)||e<0)throw TypeError("id must be a non-negative integer");if(!xr.isString(r))throw TypeError("type must be a string");if(n!==void 0&&!aIt.test(n=n.toString().toLowerCase()))throw TypeError("rule must be a string rule");if(i!==void 0&&!xr.isString(i))throw TypeError("extend must be a string");n==="proto3_optional"&&(n="optional"),this.rule=n&&n!=="optional"?n:void 0,this.type=r,this.id=e,this.extend=i||void 0,this.repeated=n==="repeated",this.map=!1,this.message=null,this.partOf=null,this.typeDefault=null,this.defaultValue=null,this.long=xr.Long?Q5.long[r]!==void 0:!1,this.bytes=r==="bytes",this.resolvedType=null,this.extensionField=null,this.declaringField=null,this.comment=o}Object.defineProperty(Wr.prototype,"required",{get:function(){return this._features.field_presence==="LEGACY_REQUIRED"}});Object.defineProperty(Wr.prototype,"optional",{get:function(){return!this.required}});Object.defineProperty(Wr.prototype,"delimited",{get:function(){return this.resolvedType instanceof fw&&this._features.message_encoding==="DELIMITED"}});Object.defineProperty(Wr.prototype,"packed",{get:function(){return this._features.repeated_field_encoding==="PACKED"}});Object.defineProperty(Wr.prototype,"hasPresence",{get:function(){return this.repeated||this.map?!1:this.partOf||this.declaringField||this.extensionField||this._features.field_presence!=="IMPLICIT"}});Wr.prototype.setOption=function(e,r,n){return pw.prototype.setOption.call(this,e,r,n)};Wr.prototype.toJSON=function(e){var r=e?!!e.keepComments:!1;return xr.toObject(["edition",this._editionToJSON(),"rule",this.rule!=="optional"&&this.rule||void 0,"type",this.type,"id",this.id,"extend",this.extend,"options",this.options,"comment",r?this.comment:void 0])};Wr.prototype.resolve=function(){if(this.resolved)return this;if((this.typeDefault=Q5.defaults[this.type])===void 0?(this.resolvedType=(this.declaringField?this.declaringField.parent:this.parent).lookupTypeOrEnum(this.type),this.resolvedType instanceof fw?this.typeDefault=null:this.typeDefault=this.resolvedType.values[Object.keys(this.resolvedType.values)[0]]):this.options&&this.options.proto3_optional&&(this.typeDefault=null),this.options&&this.options.default!=null&&(this.typeDefault=this.options.default,this.resolvedType instanceof yNe&&typeof this.typeDefault=="string"&&(this.typeDefault=this.resolvedType.values[this.typeDefault])),this.options&&(this.options.packed!==void 0&&this.resolvedType&&!(this.resolvedType instanceof yNe)&&delete this.options.packed,Object.keys(this.options).length||(this.options=void 0)),this.long)this.typeDefault=xr.Long.fromNumber(this.typeDefault,this.type==="uint64"||this.type==="fixed64"),Object.freeze&&Object.freeze(this.typeDefault);else if(this.bytes&&typeof this.typeDefault=="string"){var e;xr.base64.test(this.typeDefault)?xr.base64.decode(this.typeDefault,e=xr.newBuffer(xr.base64.length(this.typeDefault)),0):xr.utf8.write(this.typeDefault,e=xr.newBuffer(xr.utf8.length(this.typeDefault)),0),this.typeDefault=e}return this.map?this.defaultValue=xr.emptyObject:this.repeated?this.defaultValue=xr.emptyArray:this.defaultValue=this.typeDefault,this.parent instanceof fw&&(this.parent.ctor.prototype[this.name]=this.defaultValue),pw.prototype.resolve.call(this)};Wr.prototype._inferLegacyProtoFeatures=function(e){if(e!=="proto2"&&e!=="proto3")return{};var r={};if(this.rule==="required"&&(r.field_presence="LEGACY_REQUIRED"),this.parent&&Q5.defaults[this.type]===void 0){var n=this.parent.get(this.type.split(".").pop());n&&n instanceof fw&&n.group&&(r.message_encoding="DELIMITED")}return this.getOption("packed")===!0?r.repeated_field_encoding="PACKED":this.getOption("packed")===!1&&(r.repeated_field_encoding="EXPANDED"),r};Wr.prototype._resolveFeatures=function(e){return pw.prototype._resolveFeatures.call(this,this._edition||e)};Wr.d=function(e,r,n,i){return typeof r=="function"?r=xr.decorateType(r).name:r&&typeof r=="object"&&(r=xr.decorateEnum(r).name),function(o,a){xr.decorateType(o.constructor).add(new Wr(a,e,r,n,{default:i}))}};Wr._configure=function(e){fw=e}});var yp=E((r0r,bNe)=>{"use strict";bNe.exports=Hi;var D$=Vu();((Hi.prototype=Object.create(D$.prototype)).constructor=Hi).className="OneOf";var ENe=zu(),L$=Gr();function Hi(t,e,r,n){if(Array.isArray(e)||(r=e,e=void 0),D$.call(this,t,r),!(e===void 0||Array.isArray(e)))throw TypeError("fieldNames must be an Array");this.oneof=e||[],this.fieldsArray=[],this.comment=n}Hi.fromJSON=function(e,r){return new Hi(e,r.oneof,r.options,r.comment)};Hi.prototype.toJSON=function(e){var r=e?!!e.keepComments:!1;return L$.toObject(["options",this.options,"oneof",this.oneof,"comment",r?this.comment:void 0])};function vNe(t){if(t.parent)for(var e=0;e<t.fieldsArray.length;++e)t.fieldsArray[e].parent||t.parent.add(t.fieldsArray[e])}Hi.prototype.add=function(e){if(!(e instanceof ENe))throw TypeError("field must be a Field");return e.parent&&e.parent!==this.parent&&e.parent.remove(e),this.oneof.push(e.name),this.fieldsArray.push(e),e.partOf=this,vNe(this),this};Hi.prototype.remove=function(e){if(!(e instanceof ENe))throw TypeError("field must be a Field");var r=this.fieldsArray.indexOf(e);if(r<0)throw Error(e+" is not a member of "+this);return this.fieldsArray.splice(r,1),r=this.oneof.indexOf(e.name),r>-1&&this.oneof.splice(r,1),e.partOf=null,this};Hi.prototype.onAdd=function(e){D$.prototype.onAdd.call(this,e);for(var r=this,n=0;n<this.oneof.length;++n){var i=e.get(this.oneof[n]);i&&!i.partOf&&(i.partOf=r,r.fieldsArray.push(i))}vNe(this)};Hi.prototype.onRemove=function(e){for(var r=0,n;r<this.fieldsArray.length;++r)(n=this.fieldsArray[r]).parent&&n.parent.remove(n);D$.prototype.onRemove.call(this,e)};Object.defineProperty(Hi.prototype,"isProto3Optional",{get:function(){if(this.fieldsArray==null||this.fieldsArray.length!==1)return!1;var t=this.fieldsArray[0];return t.options!=null&&t.options.proto3_optional===!0}});Hi.d=function(){for(var e=new Array(arguments.length),r=0;r<arguments.length;)e[r]=arguments[r++];return function(i,s){L$.decorateType(i.constructor).add(new Hi(s,e)),Object.defineProperty(i,s,{get:L$.oneOfGetter(e),set:L$.oneOfSetter(e)})}}});var Vu=E((n0r,TNe)=>{"use strict";TNe.exports=_n;_n.className="ReflectionObject";var cIt=yp(),yo=Gr(),M$,lIt={enum_type:"OPEN",field_presence:"EXPLICIT",json_format:"ALLOW",message_encoding:"LENGTH_PREFIXED",repeated_field_encoding:"PACKED",utf8_validation:"VERIFY"},uIt={enum_type:"CLOSED",field_presence:"EXPLICIT",json_format:"LEGACY_BEST_EFFORT",message_encoding:"LENGTH_PREFIXED",repeated_field_encoding:"EXPANDED",utf8_validation:"NONE"},dIt={enum_type:"OPEN",field_presence:"IMPLICIT",json_format:"ALLOW",message_encoding:"LENGTH_PREFIXED",repeated_field_encoding:"PACKED",utf8_validation:"VERIFY"};function _n(t,e){if(!yo.isString(t))throw TypeError("name must be a string");if(e&&!yo.isObject(e))throw TypeError("options must be an object");this.options=e,this.parsedOptions=null,this.name=t,this._edition=null,this._defaultEdition="proto2",this._features={},this._featuresResolved=!1,this.parent=null,this.resolved=!1,this.comment=null,this.filename=null}Object.defineProperties(_n.prototype,{root:{get:function(){for(var t=this;t.parent!==null;)t=t.parent;return t}},fullName:{get:function(){for(var t=[this.name],e=this.parent;e;)t.unshift(e.name),e=e.parent;return t.join(".")}}});_n.prototype.toJSON=function(){throw Error()};_n.prototype.onAdd=function(e){this.parent&&this.parent!==e&&this.parent.remove(this),this.parent=e,this.resolved=!1;var r=e.root;r instanceof M$&&r._handleAdd(this)};_n.prototype.onRemove=function(e){var r=e.root;r instanceof M$&&r._handleRemove(this),this.parent=null,this.resolved=!1};_n.prototype.resolve=function(){return this.resolved?this:(this.root instanceof M$&&(this.resolved=!0),this)};_n.prototype._resolveFeaturesRecursive=function(e){return this._resolveFeatures(this._edition||e)};_n.prototype._resolveFeatures=function(e){if(!this._featuresResolved){var r={};if(!e)throw new Error("Unknown edition for "+this.fullName);var n=yo.merge({},this.options&&this.options.features,this._inferLegacyProtoFeatures(e));if(this._edition){if(e==="proto2")r=Object.assign({},uIt);else if(e==="proto3")r=Object.assign({},dIt);else if(e==="2023")r=Object.assign({},lIt);else throw new Error("Unknown edition: "+e);this._features=yo.merge(r,n),this._featuresResolved=!0;return}if(this.partOf instanceof cIt){var i=yo.merge({},this.partOf._features);this._features=yo.merge(i,n)}else if(!this.declaringField)if(this.parent){var s=yo.merge({},this.parent._features);this._features=yo.merge(s,n)}else throw new Error("Unable to find a parent for "+this.fullName);this.extensionField&&(this.extensionField._features=this._features),this._featuresResolved=!0}};_n.prototype._inferLegacyProtoFeatures=function(){return{}};_n.prototype.getOption=function(e){if(this.options)return this.options[e]};_n.prototype.setOption=function(e,r,n){return e==="__proto__"?this:(this.options||(this.options={}),/^features\./.test(e)?yo.setProperty(this.options,e,r,n):(!n||this.options[e]===void 0)&&(this.getOption(e)!==r&&(this.resolved=!1),this.options[e]=r),this)};_n.prototype.setParsedOption=function(e,r,n){if(e==="__proto__")return this;this.parsedOptions||(this.parsedOptions=[]);var i=this.parsedOptions;if(n){var s=i.find(function(c){return Object.prototype.hasOwnProperty.call(c,e)});if(s){var o=s[e];yo.setProperty(o,n,r)}else s={},s[e]=yo.setProperty({},n,r),i.push(s)}else{var a={};a[e]=r,i.push(a)}return this};_n.prototype.setOptions=function(e,r){if(e)for(var n=Object.keys(e),i=0;i<n.length;++i)this.setOption(n[i],e[n[i]],r);return this};_n.prototype.toString=function(){var e=this.constructor.className,r=this.fullName;return r.length?e+" "+r:e};_n.prototype._editionToJSON=function(){if(!(!this._edition||this._edition==="proto3"))return this._edition};_n._configure=function(t){M$=t}});var _o=E((i0r,ANe)=>{"use strict";ANe.exports=So;var e8=Vu();((So.prototype=Object.create(e8.prototype)).constructor=So).className="Enum";var wNe=j_(),z_=Gr();function So(t,e,r,n,i,s){if(e8.call(this,t,r),e&&typeof e!="object")throw TypeError("values must be an object");if(this.valuesById={},this.values=Object.create(this.valuesById),this.comment=n,this.comments=i||{},this.valuesOptions=s,this._valuesFeatures={},this.reserved=void 0,e)for(var o=Object.keys(e),a=0;a<o.length;++a)o[a]!=="__proto__"&&typeof e[o[a]]=="number"&&(this.valuesById[this.values[o[a]]=e[o[a]]]=o[a])}So.prototype._resolveFeatures=function(e){return e=this._edition||e,e8.prototype._resolveFeatures.call(this,e),Object.keys(this.values).forEach(r=>{var n=z_.merge({},this._features);this._valuesFeatures[r]=z_.merge(n,this.valuesOptions&&this.valuesOptions[r]&&this.valuesOptions[r].features||{})}),this};So.fromJSON=function(e,r){var n=new So(e,r.values,r.options,r.comment,r.comments);return n.reserved=r.reserved,r.edition&&(n._edition=r.edition),n._defaultEdition="proto3",n};So.prototype.toJSON=function(e){var r=e?!!e.keepComments:!1;return z_.toObject(["edition",this._editionToJSON(),"options",this.options,"valuesOptions",this.valuesOptions,"values",this.values,"reserved",this.reserved&&this.reserved.length?this.reserved:void 0,"comment",r?this.comment:void 0,"comments",r?this.comments:void 0])};So.prototype.add=function(e,r,n,i){if(!z_.isString(e))throw TypeError("name must be a string");if(!z_.isInteger(r))throw TypeError("id must be an integer");if(e==="__proto__")return this;if(this.values[e]!==void 0)throw Error("duplicate name '"+e+"' in "+this);if(this.isReservedId(r))throw Error("id "+r+" is reserved in "+this);if(this.isReservedName(e))throw Error("name '"+e+"' is reserved in "+this);if(this.valuesById[r]!==void 0){if(!(this.options&&this.options.allow_alias))throw Error("duplicate id "+r+" in "+this);this.values[e]=r}else this.valuesById[this.values[e]=r]=e;return i&&(this.valuesOptions===void 0&&(this.valuesOptions={}),this.valuesOptions[e]=i||null),this.comments[e]=n||null,this};So.prototype.remove=function(e){if(!z_.isString(e))throw TypeError("name must be a string");var r=this.values[e];if(r==null)throw Error("name '"+e+"' does not exist in "+this);return delete this.valuesById[r],delete this.values[e],delete this.comments[e],this.valuesOptions&&delete this.valuesOptions[e],this};So.prototype.isReservedId=function(e){return wNe.isReservedId(this.reserved,e)};So.prototype.isReservedName=function(e){return wNe.isReservedName(this.reserved,e)}});var W5=E((s0r,xNe)=>{"use strict";xNe.exports=pIt;var fIt=_o(),t8=Sp(),r8=Gr();function RNe(t,e,r,n){return e.delimited?t("types[%i].encode(%s,w.uint32(%i),q+1).uint32(%i)",r,n,(e.id<<3|3)>>>0,(e.id<<3|4)>>>0):t("types[%i].encode(%s,w.uint32(%i).fork(),q+1).ldelim()",r,n,(e.id<<3|2)>>>0)}function pIt(t){for(var e=r8.codegen(["m","w","q"],t.name+"$encode")("if(!w)")("w=Writer.create()")("if(q===undefined)q=0")("if(q>util.recursionLimit)")('throw Error("max depth exceeded")'),r,n,i=t.fieldsArray.slice().sort(r8.compareFieldsById),r=0;r<i.length;++r){var s=i[r].resolve(),o=t._fieldsArray.indexOf(s),a=s.resolvedType instanceof fIt?"int32":s.type,c=t8.basic[a];n="m"+r8.safeProp(s.name),s.map?(e("if(%s!=null&&Object.hasOwnProperty.call(m,%j)){",n,s.name)("for(var ks=Object.keys(%s),i=0;i<ks.length;++i){",n)("w.uint32(%i).fork().uint32(%i).%s(ks[i])",(s.id<<3|2)>>>0,8|t8.mapKey[s.keyType],s.keyType),c===void 0?e("types[%i].encode(%s[ks[i]],w.uint32(18).fork(),q+1).ldelim().ldelim()",o,n):e(".uint32(%i).%s(%s[ks[i]]).ldelim()",16|c,a,n),e("}")("}")):s.repeated?(e("if(%s!=null&&%s.length){",n,n),s.packed&&t8.packed[a]!==void 0?e("w.uint32(%i).fork()",(s.id<<3|2)>>>0)("for(var i=0;i<%s.length;++i)",n)("w.%s(%s[i])",a,n)("w.ldelim()"):(e("for(var i=0;i<%s.length;++i)",n),c===void 0?RNe(e,s,o,n+"[i]"):e("w.uint32(%i).%s(%s[i])",(s.id<<3|c)>>>0,a,n)),e("}")):(s.optional&&e("if(%s!=null&&Object.hasOwnProperty.call(m,%j))",n,s.name),c===void 0?RNe(e,s,o,n):e("w.uint32(%i).%s(%s)",(s.id<<3|c)>>>0,a,n))}return e("return w")}});var ONe=E((o0r,INe)=>{"use strict";var _t=INe.exports=LCe();_t.build="light";function hIt(t,e,r){return typeof e=="function"?(r=e,e=new _t.Root):e||(e=new _t.Root),e.load(t,r)}_t.load=hIt;function mIt(t,e){return e||(e=new _t.Root),e.loadSync(t)}_t.loadSync=mIt;_t.encoder=W5();_t.decoder=D5();_t.verifier=F5();_t.converter=B5();_t.ReflectionObject=Vu();_t.Namespace=j_();_t.Root=$$();_t.Enum=_o();_t.Type=P$();_t.Field=zu();_t.OneOf=yp();_t.MapField=w$();_t.Service=R$();_t.Method=A$();_t.Message=x$();_t.wrappers=z5();_t.types=Sp();_t.util=Gr();_t.ReflectionObject._configure(_t.Root);_t.Namespace._configure(_t.Type,_t.Service,_t.Enum);_t.Root._configure(_t.Type);_t.Field._configure(_t.Type)});var i8=E((a0r,NNe)=>{"use strict";NNe.exports=CNe;var n8=/[\s{}=;:[\],'"()<>]/g,gIt=/(?:"([^"\\]*(?:\\.[^"\\]*)*)")/g,_It=/(?:'([^'\\]*(?:\\.[^'\\]*)*)')/g,yIt=/^ *[*/]+ */,SIt=/^\s*\*?\/*/,EIt=/\n/g,vIt=/\s/,bIt=/\\(.?)/g,TIt={0:"\0",r:"\r",n:`
@@ -383,15 +383,15 @@ ${e}`;return Object.assign(new Error(r),t,{stack:i})}var BK=class extends dRt.Ev
383
383
  `;)T++;return T}function m(){if(a.length>0)return a.shift();if(c)return u();var g,T,I,x,R,O=r===0;do{if(r===n)return null;for(g=!1;vIt.test(I=d(r));)if(I===`
384
384
  `&&(O=!0,++i),++r===n)return null;if(d(r)==="/"){if(++r===n)throw l("comment");if(d(r)==="/")if(e){if(x=r,R=!1,p(r-1)){R=!0;do if(r=h(r),r===n||(r++,!O))break;while(p(r))}else r=Math.min(n,h(r)+1);R&&(f(x,r,O),O=!0),i++,g=!0}else{for(R=d(x=r+1)==="/";d(++r)!==`
385
385
  `;)if(r===n)return null;++r,R&&(f(x,r-1,O),O=!0),++i,g=!0}else if((I=d(r))==="*"){x=r+1,R=e||d(x)==="*";do{if(I===`
386
- `&&++i,++r===n)throw l("comment");T=I,I=d(r)}while(T!=="*"||I!=="/");++r,R&&(f(x,r-2,O),O=!0),g=!0}else return"/"}}while(g);var A=r;n8.lastIndex=0;var b=n8.test(d(A++));if(!b)for(;A<n&&!n8.test(d(A));)++A;var L=t.substring(r,r=A);return(L==='"'||L==="'")&&(c=L),L}function _(g){a.push(g)}function y(){if(!a.length){var g=m();if(g===null)return null;_(g)}return a[0]}function v(g,T){var I=y(),x=I===g;if(x)return m(),!0;if(!T)throw l("token '"+I+"', '"+g+"' expected");return!1}function S(g){var T=null,I;return g===void 0?(I=o[i-1],delete o[i-1],I&&(e||I.type==="*"||I.lineEmpty)&&(T=I.leading?I.text:null)):(s<g&&y(),I=o[g],delete o[g],I&&!I.lineEmpty&&(e||I.type==="/")&&(T=I.leading?null:I.text)),T}return Object.defineProperty({next:m,peek:y,push:_,skip:v,cmnt:S},"line",{get:function(){return i}})}});var UNe=E((c0r,MNe)=>{"use strict";MNe.exports=Wc;Wc.filename=null;Wc.defaults={keepCase:!1};var wIt=i8(),kNe=$$(),$Ne=P$(),LNe=zu(),AIt=w$(),DNe=yp(),RIt=_o(),xIt=R$(),IIt=A$(),OIt=Vu(),PIt=Sp(),Gc=Gr(),CIt=/^[1-9][0-9]*$/,NIt=/^-?[1-9][0-9]*$/,kIt=/^0[x][0-9a-fA-F]+$/,$It=/^-?0[x][0-9a-fA-F]+$/,LIt=/^0[0-7]+$/,DIt=/^-?0[0-7]+$/,MIt=Gc.patterns.numberRe,Ta=/^[a-zA-Z_][a-zA-Z_0-9]*$/,wa=Gc.patterns.typeRefRe;function Wc(t,e,r){e instanceof kNe||(r=e,e=new kNe),r||(r=Wc.defaults);var n=r.preferTrailingComment||!1,i=wIt(t,r.alternateCommentMode||!1),s=i.next,o=i.push,a=i.peek,c=i.skip,l=i.cmnt,u=!0,d,f,p,h="proto2",m=e,_=[],y={},v=r.keepCase?function(D){return D}:Gc.camelCase;function S(){_.forEach(D=>{D._edition=h,Object.keys(y).forEach(B=>{D.getOption(B)===void 0&&D.setOption(B,y[B],!0)})})}function g(D,B,J){var H=Wc.filename;return J||(Wc.filename=null),Error("illegal "+(B||"token")+" '"+D+"' ("+(H?H+", ":"")+"line "+i.line+")")}function T(){var D=[],B;do{if((B=s())!=='"'&&B!=="'")throw g(B);D.push(s()),c(B),B=a()}while(B==='"'||B==="'");return D.join("")}function I(D){var B=s();switch(B){case"'":case'"':return o(B),T();case"true":case"TRUE":return!0;case"false":case"FALSE":return!1}try{return R(B,!0)}catch{if(D&&wa.test(B))return B;throw g(B,"value")}}function x(D,B){var J,H;do if(B&&((J=a())==='"'||J==="'")){var z=T();if(D.push(z),h>=2023)throw g(z,"id")}else try{D.push([H=O(s()),c("to",!0)?O(s()):H])}catch(re){if(B&&wa.test(J)&&h>=2023)D.push(J);else throw re}while(c(",",!0));var K={options:void 0};K.setOption=function(re,Oe){this.options===void 0&&(this.options={}),this.options[re]=Oe},P(K,function(Oe){if(Oe==="option")oe(K,Oe),c(";");else throw g(Oe)},function(){U(K)})}function R(D,B){var J=1;switch(D.charAt(0)==="-"&&(J=-1,D=D.substring(1)),D){case"inf":case"INF":case"Inf":return J*(1/0);case"nan":case"NAN":case"Nan":case"NaN":return NaN;case"0":return 0}if(CIt.test(D))return J*parseInt(D,10);if(kIt.test(D))return J*parseInt(D,16);if(LIt.test(D))return J*parseInt(D,8);if(MIt.test(D))return J*parseFloat(D);throw g(D,"number",B)}function O(D,B){switch(D){case"max":case"MAX":case"Max":return 536870911;case"0":return 0}if(!B&&D.charAt(0)==="-")throw g(D,"id");if(NIt.test(D))return parseInt(D,10);if($It.test(D))return parseInt(D,16);if(DIt.test(D))return parseInt(D,8);throw g(D,"id")}function A(){if(d!==void 0)throw g("package");if(d=s(),!wa.test(d))throw g(d,"name");m=m.define(d),c(";")}function b(){var D=a(),B;switch(D){case"weak":B=p||(p=[]),s();break;case"public":s();default:B=f||(f=[]);break}D=T(),c(";"),B.push(D)}function L(){if(c("="),h=T(),h<2023)throw g(h,"syntax");c(";")}function C(){if(c("="),h=T(),!["2023"].includes(h))throw g(h,"edition");c(";")}function w(D,B,J){switch(J===void 0&&(J=0),B){case"option":return oe(D,B),c(";"),!0;case"message":return N(D,B,J+1),!0;case"enum":return Ie(D,B),!0;case"service":return ne(D,B,J+1),!0;case"extend":return se(D,B,J),!0}return!1}function P(D,B,J){var H=i.line;if(D&&(typeof D.comment!="string"&&(D.comment=l()),D.filename=Wc.filename),c("{",!0)){for(var z;(z=s())!=="}";)B(z);c(";",!0)}else J&&J(),c(";"),D&&(typeof D.comment!="string"||n)&&(D.comment=l(H)||D.comment)}function N(D,B,J){if(J===void 0&&(J=0),J>Gc.nestingLimit)throw Error("max depth exceeded");if(!Ta.test(B=s()))throw g(B,"type name");var H=new $Ne(B);P(H,function(K){if(!w(H,K,J))switch(K){case"map":de(H,K);break;case"required":if(h!=="proto2")throw g(K);case"repeated":j(H,K,void 0,J+1);break;case"optional":if(h==="proto3")j(H,"proto3_optional",void 0,J+1);else{if(h!=="proto2")throw g(K);j(H,"optional",void 0,J+1)}break;case"oneof":Te(H,K,J+1);break;case"extensions":x(H.extensions||(H.extensions=[]));break;case"reserved":x(H.reserved||(H.reserved=[]),!0);break;default:if(h==="proto2"||!wa.test(K))throw g(K);o(K),j(H,"optional",void 0,J+1);break}}),D.add(H),D===m&&_.push(H)}function j(D,B,J,H){var z=s();if(z==="group"){V(D,B,H);return}for(;z.endsWith(".")||a().startsWith(".");)z+=s();if(!wa.test(z))throw g(z,"type");var K=s();if(!Ta.test(K))throw g(K,"name");K=v(K),c("=");var re=new LNe(K,O(s()),z,B,J);if(P(re,function(ze){if(ze==="option")oe(re,ze),c(";");else throw g(ze)},function(){U(re)}),B==="proto3_optional"){var Oe=new DNe("_"+K);re.setOption("proto3_optional",!0),Oe.add(re),D.add(Oe)}else D.add(re);D===m&&_.push(re)}function V(D,B,J){if(J===void 0&&(J=0),J>Gc.nestingLimit)throw Error("max depth exceeded");if(h>=2023)throw g("group");var H=s();if(!Ta.test(H))throw g(H,"name");var z=Gc.lcFirst(H);H===z&&(H=Gc.ucFirst(H)),c("=");var K=O(s()),re=new $Ne(H);re.group=!0;var Oe=new LNe(z,K,H,B);Oe.filename=Wc.filename,P(re,function(ze){switch(ze){case"option":oe(re,ze),c(";");break;case"required":case"repeated":j(re,ze,void 0,J+1);break;case"optional":h==="proto3"?j(re,"proto3_optional",void 0,J+1):j(re,"optional",void 0,J+1);break;case"message":N(re,ze,J+1);break;case"enum":Ie(re,ze);break;case"reserved":x(re.reserved||(re.reserved=[]),!0);break;default:throw g(ze)}}),D.add(re).add(Oe)}function de(D){c("<");var B=s();if(PIt.mapKey[B]===void 0)throw g(B,"type");c(",");var J=s();if(!wa.test(J))throw g(J,"type");c(">");var H=s();if(!Ta.test(H))throw g(H,"name");c("=");var z=new AIt(v(H),O(s()),B,J);P(z,function(re){if(re==="option")oe(z,re),c(";");else throw g(re)},function(){U(z)}),D.add(z)}function Te(D,B,J){if(!Ta.test(B=s()))throw g(B,"name");var H=new DNe(v(B));P(H,function(K){K==="option"?(oe(H,K),c(";")):(o(K),j(H,"optional",void 0,J))}),D.add(H)}function Ie(D,B){if(!Ta.test(B=s()))throw g(B,"name");var J=new RIt(B);P(J,function(z){switch(z){case"option":oe(J,z),c(";");break;case"reserved":x(J.reserved||(J.reserved=[]),!0),J.reserved===void 0&&(J.reserved=[]);break;default:$e(J,z)}}),D.add(J),D===m&&_.push(J)}function $e(D,B){if(!Ta.test(B))throw g(B,"name");c("=");var J=O(s(),!0),H={options:void 0};H.getOption=function(z){return this.options[z]},H.setOption=function(z,K){OIt.prototype.setOption.call(H,z,K)},H.setParsedOption=function(){},P(H,function(K){if(K==="option")oe(H,K),c(";");else throw g(K)},function(){U(H)}),D.add(B,J,H.comment,H.parsedOptions||H.options)}function oe(D,B){var J,H,z=!0;for(B==="option"&&(B=s());B!=="=";){if(B==="("){var K=s();c(")"),B="("+K+")"}if(z){if(z=!1,B.includes(".")&&!B.includes("(")){var re=B.split(".");J=re[0]+".",B=re[1];continue}J=B}else H=H?H+=B:B;B=s()}var Oe=H?J.concat(H):J,ut=Ee(D,Oe);H=H&&H[0]==="."?H.slice(1):H,J=J&&J[J.length-1]==="."?J.slice(0,-1):J,k(D,J,ut,H)}function Ee(D,B,J){if(J===void 0&&(J=0),J>Gc.recursionLimit)throw Error("max depth exceeded");if(c("{",!0)){for(var H={};!c("}",!0);){if(!Ta.test(M=s()))throw g(M,"name");if(M===null)throw g(M,"end of input");var z,K=M;if(c(":",!0),a()==="{")z=Ee(D,B+"."+M,J+1);else if(a()==="["){z=[];var re;if(c("[",!0)){do re=I(!0),z.push(re);while(c(",",!0));c("]"),typeof re<"u"&&he(D,B+"."+M,re)}}else z=I(!0),he(D,B+"."+M,z);var Oe=H[K];Oe&&(z=[].concat(Oe).concat(z)),K!=="__proto__"&&(H[K]=z),c(",",!0),c(";",!0)}return H}var ut=I(!0);return he(D,B,ut),ut}function he(D,B,J){if(m===D&&/^features\./.test(B)){y[B]=J;return}D.setOption&&D.setOption(B,J)}function k(D,B,J,H){D.setParsedOption&&D.setParsedOption(B,J,H)}function U(D){if(c("[",!0)){do oe(D,"option");while(c(",",!0));c("]")}return D}function ne(D,B,J){if(J===void 0&&(J=0),J>Gc.recursionLimit)throw Error("max depth exceeded");if(!Ta.test(B=s()))throw g(B,"service name");var H=new xIt(B);P(H,function(K){if(!w(H,K,J))if(K==="rpc")F(H,K);else throw g(K)}),D.add(H),D===m&&_.push(H)}function F(D,B){var J=l(),H=B;if(!Ta.test(B=s()))throw g(B,"name");var z=B,K,re,Oe,ut;if(c("("),c("stream",!0)&&(re=!0),!wa.test(B=s())||(K=B,c(")"),c("returns"),c("("),c("stream",!0)&&(ut=!0),!wa.test(B=s())))throw g(B);Oe=B,c(")");var ze=new IIt(z,H,K,Oe,re,ut);ze.comment=J,P(ze,function(qs){if(qs==="option")oe(ze,qs),c(";");else throw g(qs)}),D.add(ze)}function se(D,B,J){if(!wa.test(B=s()))throw g(B,"reference");var H=B;P(null,function(K){switch(K){case"required":case"repeated":j(D,K,H,J+1);break;case"optional":h==="proto3"?j(D,"proto3_optional",H,J+1):j(D,"optional",H,J+1);break;default:if(h==="proto2"||!wa.test(K))throw g(K);o(K),j(D,"optional",H,J+1);break}})}for(var M;(M=s())!==null;)switch(M){case"package":if(!u)throw g(M);A();break;case"import":if(!u)throw g(M);b();break;case"syntax":if(!u)throw g(M);L();break;case"edition":if(!u)throw g(M);C();break;case"option":oe(m,M),c(";",!0);break;default:if(w(m,M,0)){u=!1;continue}throw g(M)}return S(),Wc.filename=null,{package:d,imports:f,weakImports:p,root:e}}});var qNe=E((l0r,jNe)=>{"use strict";jNe.exports=Eo;var UIt=/\/|\./;function Eo(t,e){UIt.test(t)||(t="google/protobuf/"+t+".proto",e={nested:{google:{nested:{protobuf:{nested:e}}}}}),Eo[t]=e}Eo("any",{Any:{fields:{type_url:{type:"string",id:1},value:{type:"bytes",id:2}}}});var FNe;Eo("duration",{Duration:FNe={fields:{seconds:{type:"int64",id:1},nanos:{type:"int32",id:2}}}});Eo("timestamp",{Timestamp:FNe});Eo("empty",{Empty:{fields:{}}});Eo("struct",{Struct:{fields:{fields:{keyType:"string",type:"Value",id:1}}},Value:{oneofs:{kind:{oneof:["nullValue","numberValue","stringValue","boolValue","structValue","listValue"]}},fields:{nullValue:{type:"NullValue",id:1},numberValue:{type:"double",id:2},stringValue:{type:"string",id:3},boolValue:{type:"bool",id:4},structValue:{type:"Struct",id:5},listValue:{type:"ListValue",id:6}}},NullValue:{values:{NULL_VALUE:0}},ListValue:{fields:{values:{rule:"repeated",type:"Value",id:1}}}});Eo("wrappers",{DoubleValue:{fields:{value:{type:"double",id:1}}},FloatValue:{fields:{value:{type:"float",id:1}}},Int64Value:{fields:{value:{type:"int64",id:1}}},UInt64Value:{fields:{value:{type:"uint64",id:1}}},Int32Value:{fields:{value:{type:"int32",id:1}}},UInt32Value:{fields:{value:{type:"uint32",id:1}}},BoolValue:{fields:{value:{type:"bool",id:1}}},StringValue:{fields:{value:{type:"string",id:1}}},BytesValue:{fields:{value:{type:"bytes",id:1}}}});Eo("field_mask",{FieldMask:{fields:{paths:{rule:"repeated",type:"string",id:1}}}});Eo.get=function(e){return Eo[e]||null}});var zNe=E((u0r,BNe)=>{"use strict";var Hu=BNe.exports=ONe();Hu.build="full";Hu.tokenize=i8();Hu.parse=UNe();Hu.common=qNe();Hu.Root._configure(Hu.Type,Hu.parse,Hu.common)});var U$=E((d0r,VNe)=>{"use strict";VNe.exports=zNe()});var s8=E((f0r,FIt)=>{FIt.exports={nested:{google:{nested:{protobuf:{options:{go_package:"google.golang.org/protobuf/types/descriptorpb",java_package:"com.google.protobuf",java_outer_classname:"DescriptorProtos",csharp_namespace:"Google.Protobuf.Reflection",objc_class_prefix:"GPB",cc_enable_arenas:!0,optimize_for:"SPEED"},nested:{FileDescriptorSet:{edition:"proto2",fields:{file:{rule:"repeated",type:"FileDescriptorProto",id:1}},extensions:[[536e6,536e6]]},Edition:{edition:"proto2",values:{EDITION_UNKNOWN:0,EDITION_LEGACY:900,EDITION_PROTO2:998,EDITION_PROTO3:999,EDITION_2023:1e3,EDITION_2024:1001,EDITION_1_TEST_ONLY:1,EDITION_2_TEST_ONLY:2,EDITION_99997_TEST_ONLY:99997,EDITION_99998_TEST_ONLY:99998,EDITION_99999_TEST_ONLY:99999,EDITION_MAX:2147483647}},FileDescriptorProto:{edition:"proto2",fields:{name:{type:"string",id:1},package:{type:"string",id:2},dependency:{rule:"repeated",type:"string",id:3},publicDependency:{rule:"repeated",type:"int32",id:10},weakDependency:{rule:"repeated",type:"int32",id:11},optionDependency:{rule:"repeated",type:"string",id:15},messageType:{rule:"repeated",type:"DescriptorProto",id:4},enumType:{rule:"repeated",type:"EnumDescriptorProto",id:5},service:{rule:"repeated",type:"ServiceDescriptorProto",id:6},extension:{rule:"repeated",type:"FieldDescriptorProto",id:7},options:{type:"FileOptions",id:8},sourceCodeInfo:{type:"SourceCodeInfo",id:9},syntax:{type:"string",id:12},edition:{type:"Edition",id:14}}},DescriptorProto:{edition:"proto2",fields:{name:{type:"string",id:1},field:{rule:"repeated",type:"FieldDescriptorProto",id:2},extension:{rule:"repeated",type:"FieldDescriptorProto",id:6},nestedType:{rule:"repeated",type:"DescriptorProto",id:3},enumType:{rule:"repeated",type:"EnumDescriptorProto",id:4},extensionRange:{rule:"repeated",type:"ExtensionRange",id:5},oneofDecl:{rule:"repeated",type:"OneofDescriptorProto",id:8},options:{type:"MessageOptions",id:7},reservedRange:{rule:"repeated",type:"ReservedRange",id:9},reservedName:{rule:"repeated",type:"string",id:10},visibility:{type:"SymbolVisibility",id:11}},nested:{ExtensionRange:{fields:{start:{type:"int32",id:1},end:{type:"int32",id:2},options:{type:"ExtensionRangeOptions",id:3}}},ReservedRange:{fields:{start:{type:"int32",id:1},end:{type:"int32",id:2}}}}},ExtensionRangeOptions:{edition:"proto2",fields:{uninterpretedOption:{rule:"repeated",type:"UninterpretedOption",id:999},declaration:{rule:"repeated",type:"Declaration",id:2,options:{retention:"RETENTION_SOURCE"}},features:{type:"FeatureSet",id:50},verification:{type:"VerificationState",id:3,options:{default:"UNVERIFIED",retention:"RETENTION_SOURCE"}}},extensions:[[1e3,536870911]],nested:{Declaration:{fields:{number:{type:"int32",id:1},fullName:{type:"string",id:2},type:{type:"string",id:3},reserved:{type:"bool",id:5},repeated:{type:"bool",id:6}},reserved:[[4,4]]},VerificationState:{values:{DECLARATION:0,UNVERIFIED:1}}}},FieldDescriptorProto:{edition:"proto2",fields:{name:{type:"string",id:1},number:{type:"int32",id:3},label:{type:"Label",id:4},type:{type:"Type",id:5},typeName:{type:"string",id:6},extendee:{type:"string",id:2},defaultValue:{type:"string",id:7},oneofIndex:{type:"int32",id:9},jsonName:{type:"string",id:10},options:{type:"FieldOptions",id:8},proto3Optional:{type:"bool",id:17}},nested:{Type:{values:{TYPE_DOUBLE:1,TYPE_FLOAT:2,TYPE_INT64:3,TYPE_UINT64:4,TYPE_INT32:5,TYPE_FIXED64:6,TYPE_FIXED32:7,TYPE_BOOL:8,TYPE_STRING:9,TYPE_GROUP:10,TYPE_MESSAGE:11,TYPE_BYTES:12,TYPE_UINT32:13,TYPE_ENUM:14,TYPE_SFIXED32:15,TYPE_SFIXED64:16,TYPE_SINT32:17,TYPE_SINT64:18}},Label:{values:{LABEL_OPTIONAL:1,LABEL_REPEATED:3,LABEL_REQUIRED:2}}}},OneofDescriptorProto:{edition:"proto2",fields:{name:{type:"string",id:1},options:{type:"OneofOptions",id:2}}},EnumDescriptorProto:{edition:"proto2",fields:{name:{type:"string",id:1},value:{rule:"repeated",type:"EnumValueDescriptorProto",id:2},options:{type:"EnumOptions",id:3},reservedRange:{rule:"repeated",type:"EnumReservedRange",id:4},reservedName:{rule:"repeated",type:"string",id:5},visibility:{type:"SymbolVisibility",id:6}},nested:{EnumReservedRange:{fields:{start:{type:"int32",id:1},end:{type:"int32",id:2}}}}},EnumValueDescriptorProto:{edition:"proto2",fields:{name:{type:"string",id:1},number:{type:"int32",id:2},options:{type:"EnumValueOptions",id:3}}},ServiceDescriptorProto:{edition:"proto2",fields:{name:{type:"string",id:1},method:{rule:"repeated",type:"MethodDescriptorProto",id:2},options:{type:"ServiceOptions",id:3}}},MethodDescriptorProto:{edition:"proto2",fields:{name:{type:"string",id:1},inputType:{type:"string",id:2},outputType:{type:"string",id:3},options:{type:"MethodOptions",id:4},clientStreaming:{type:"bool",id:5},serverStreaming:{type:"bool",id:6}}},FileOptions:{edition:"proto2",fields:{javaPackage:{type:"string",id:1},javaOuterClassname:{type:"string",id:8},javaMultipleFiles:{type:"bool",id:10},javaGenerateEqualsAndHash:{type:"bool",id:20,options:{deprecated:!0}},javaStringCheckUtf8:{type:"bool",id:27},optimizeFor:{type:"OptimizeMode",id:9,options:{default:"SPEED"}},goPackage:{type:"string",id:11},ccGenericServices:{type:"bool",id:16},javaGenericServices:{type:"bool",id:17},pyGenericServices:{type:"bool",id:18},deprecated:{type:"bool",id:23},ccEnableArenas:{type:"bool",id:31,options:{default:!0}},objcClassPrefix:{type:"string",id:36},csharpNamespace:{type:"string",id:37},swiftPrefix:{type:"string",id:39},phpClassPrefix:{type:"string",id:40},phpNamespace:{type:"string",id:41},phpMetadataNamespace:{type:"string",id:44},rubyPackage:{type:"string",id:45},features:{type:"FeatureSet",id:50},uninterpretedOption:{rule:"repeated",type:"UninterpretedOption",id:999}},extensions:[[1e3,536870911]],reserved:[[42,42],[38,38],"php_generic_services"],nested:{OptimizeMode:{values:{SPEED:1,CODE_SIZE:2,LITE_RUNTIME:3}}}},MessageOptions:{edition:"proto2",fields:{messageSetWireFormat:{type:"bool",id:1},noStandardDescriptorAccessor:{type:"bool",id:2},deprecated:{type:"bool",id:3},mapEntry:{type:"bool",id:7},deprecatedLegacyJsonFieldConflicts:{type:"bool",id:11,options:{deprecated:!0}},features:{type:"FeatureSet",id:12},uninterpretedOption:{rule:"repeated",type:"UninterpretedOption",id:999}},extensions:[[1e3,536870911]],reserved:[[4,4],[5,5],[6,6],[8,8],[9,9]]},FieldOptions:{edition:"proto2",fields:{ctype:{type:"CType",id:1,options:{default:"STRING"}},packed:{type:"bool",id:2},jstype:{type:"JSType",id:6,options:{default:"JS_NORMAL"}},lazy:{type:"bool",id:5},unverifiedLazy:{type:"bool",id:15},deprecated:{type:"bool",id:3},weak:{type:"bool",id:10,options:{deprecated:!0}},debugRedact:{type:"bool",id:16},retention:{type:"OptionRetention",id:17},targets:{rule:"repeated",type:"OptionTargetType",id:19},editionDefaults:{rule:"repeated",type:"EditionDefault",id:20},features:{type:"FeatureSet",id:21},featureSupport:{type:"FeatureSupport",id:22},uninterpretedOption:{rule:"repeated",type:"UninterpretedOption",id:999}},extensions:[[1e3,536870911]],reserved:[[4,4],[18,18]],nested:{CType:{values:{STRING:0,CORD:1,STRING_PIECE:2}},JSType:{values:{JS_NORMAL:0,JS_STRING:1,JS_NUMBER:2}},OptionRetention:{values:{RETENTION_UNKNOWN:0,RETENTION_RUNTIME:1,RETENTION_SOURCE:2}},OptionTargetType:{values:{TARGET_TYPE_UNKNOWN:0,TARGET_TYPE_FILE:1,TARGET_TYPE_EXTENSION_RANGE:2,TARGET_TYPE_MESSAGE:3,TARGET_TYPE_FIELD:4,TARGET_TYPE_ONEOF:5,TARGET_TYPE_ENUM:6,TARGET_TYPE_ENUM_ENTRY:7,TARGET_TYPE_SERVICE:8,TARGET_TYPE_METHOD:9}},EditionDefault:{fields:{edition:{type:"Edition",id:3},value:{type:"string",id:2}}},FeatureSupport:{fields:{editionIntroduced:{type:"Edition",id:1},editionDeprecated:{type:"Edition",id:2},deprecationWarning:{type:"string",id:3},editionRemoved:{type:"Edition",id:4}}}}},OneofOptions:{edition:"proto2",fields:{features:{type:"FeatureSet",id:1},uninterpretedOption:{rule:"repeated",type:"UninterpretedOption",id:999}},extensions:[[1e3,536870911]]},EnumOptions:{edition:"proto2",fields:{allowAlias:{type:"bool",id:2},deprecated:{type:"bool",id:3},deprecatedLegacyJsonFieldConflicts:{type:"bool",id:6,options:{deprecated:!0}},features:{type:"FeatureSet",id:7},uninterpretedOption:{rule:"repeated",type:"UninterpretedOption",id:999}},extensions:[[1e3,536870911]],reserved:[[5,5]]},EnumValueOptions:{edition:"proto2",fields:{deprecated:{type:"bool",id:1},features:{type:"FeatureSet",id:2},debugRedact:{type:"bool",id:3},featureSupport:{type:"FieldOptions.FeatureSupport",id:4},uninterpretedOption:{rule:"repeated",type:"UninterpretedOption",id:999}},extensions:[[1e3,536870911]]},ServiceOptions:{edition:"proto2",fields:{features:{type:"FeatureSet",id:34},deprecated:{type:"bool",id:33},uninterpretedOption:{rule:"repeated",type:"UninterpretedOption",id:999}},extensions:[[1e3,536870911]]},MethodOptions:{edition:"proto2",fields:{deprecated:{type:"bool",id:33},idempotencyLevel:{type:"IdempotencyLevel",id:34,options:{default:"IDEMPOTENCY_UNKNOWN"}},features:{type:"FeatureSet",id:35},uninterpretedOption:{rule:"repeated",type:"UninterpretedOption",id:999}},extensions:[[1e3,536870911]],nested:{IdempotencyLevel:{values:{IDEMPOTENCY_UNKNOWN:0,NO_SIDE_EFFECTS:1,IDEMPOTENT:2}}}},UninterpretedOption:{edition:"proto2",fields:{name:{rule:"repeated",type:"NamePart",id:2},identifierValue:{type:"string",id:3},positiveIntValue:{type:"uint64",id:4},negativeIntValue:{type:"int64",id:5},doubleValue:{type:"double",id:6},stringValue:{type:"bytes",id:7},aggregateValue:{type:"string",id:8}},nested:{NamePart:{fields:{namePart:{rule:"required",type:"string",id:1},isExtension:{rule:"required",type:"bool",id:2}}}}},FeatureSet:{edition:"proto2",fields:{fieldPresence:{type:"FieldPresence",id:1,options:{retention:"RETENTION_RUNTIME",targets:"TARGET_TYPE_FILE","feature_support.edition_introduced":"EDITION_2023","edition_defaults.edition":"EDITION_2023","edition_defaults.value":"EXPLICIT"}},enumType:{type:"EnumType",id:2,options:{retention:"RETENTION_RUNTIME",targets:"TARGET_TYPE_FILE","feature_support.edition_introduced":"EDITION_2023","edition_defaults.edition":"EDITION_PROTO3","edition_defaults.value":"OPEN"}},repeatedFieldEncoding:{type:"RepeatedFieldEncoding",id:3,options:{retention:"RETENTION_RUNTIME",targets:"TARGET_TYPE_FILE","feature_support.edition_introduced":"EDITION_2023","edition_defaults.edition":"EDITION_PROTO3","edition_defaults.value":"PACKED"}},utf8Validation:{type:"Utf8Validation",id:4,options:{retention:"RETENTION_RUNTIME",targets:"TARGET_TYPE_FILE","feature_support.edition_introduced":"EDITION_2023","edition_defaults.edition":"EDITION_PROTO3","edition_defaults.value":"VERIFY"}},messageEncoding:{type:"MessageEncoding",id:5,options:{retention:"RETENTION_RUNTIME",targets:"TARGET_TYPE_FILE","feature_support.edition_introduced":"EDITION_2023","edition_defaults.edition":"EDITION_LEGACY","edition_defaults.value":"LENGTH_PREFIXED"}},jsonFormat:{type:"JsonFormat",id:6,options:{retention:"RETENTION_RUNTIME",targets:"TARGET_TYPE_FILE","feature_support.edition_introduced":"EDITION_2023","edition_defaults.edition":"EDITION_PROTO3","edition_defaults.value":"ALLOW"}},enforceNamingStyle:{type:"EnforceNamingStyle",id:7,options:{retention:"RETENTION_SOURCE",targets:"TARGET_TYPE_METHOD","feature_support.edition_introduced":"EDITION_2024","edition_defaults.edition":"EDITION_2024","edition_defaults.value":"STYLE2024"}},defaultSymbolVisibility:{type:"VisibilityFeature.DefaultSymbolVisibility",id:8,options:{retention:"RETENTION_SOURCE",targets:"TARGET_TYPE_FILE","feature_support.edition_introduced":"EDITION_2024","edition_defaults.edition":"EDITION_2024","edition_defaults.value":"EXPORT_TOP_LEVEL"}}},extensions:[[1e3,9994],[9995,9999],[1e4,1e4]],reserved:[[999,999]],nested:{FieldPresence:{values:{FIELD_PRESENCE_UNKNOWN:0,EXPLICIT:1,IMPLICIT:2,LEGACY_REQUIRED:3}},EnumType:{values:{ENUM_TYPE_UNKNOWN:0,OPEN:1,CLOSED:2}},RepeatedFieldEncoding:{values:{REPEATED_FIELD_ENCODING_UNKNOWN:0,PACKED:1,EXPANDED:2}},Utf8Validation:{values:{UTF8_VALIDATION_UNKNOWN:0,VERIFY:2,NONE:3}},MessageEncoding:{values:{MESSAGE_ENCODING_UNKNOWN:0,LENGTH_PREFIXED:1,DELIMITED:2}},JsonFormat:{values:{JSON_FORMAT_UNKNOWN:0,ALLOW:1,LEGACY_BEST_EFFORT:2}},EnforceNamingStyle:{values:{ENFORCE_NAMING_STYLE_UNKNOWN:0,STYLE2024:1,STYLE_LEGACY:2}},VisibilityFeature:{fields:{},reserved:[[1,536870911]],nested:{DefaultSymbolVisibility:{values:{DEFAULT_SYMBOL_VISIBILITY_UNKNOWN:0,EXPORT_ALL:1,EXPORT_TOP_LEVEL:2,LOCAL_ALL:3,STRICT:4}}}}}},FeatureSetDefaults:{edition:"proto2",fields:{defaults:{rule:"repeated",type:"FeatureSetEditionDefault",id:1},minimumEdition:{type:"Edition",id:4},maximumEdition:{type:"Edition",id:5}},nested:{FeatureSetEditionDefault:{fields:{edition:{type:"Edition",id:3},overridableFeatures:{type:"FeatureSet",id:4},fixedFeatures:{type:"FeatureSet",id:5}},reserved:[[1,1],[2,2],"features"]}}},SourceCodeInfo:{edition:"proto2",fields:{location:{rule:"repeated",type:"Location",id:1}},extensions:[[536e6,536e6]],nested:{Location:{fields:{path:{rule:"repeated",type:"int32",id:1,options:{packed:!0}},span:{rule:"repeated",type:"int32",id:2,options:{packed:!0}},leadingComments:{type:"string",id:3},trailingComments:{type:"string",id:4},leadingDetachedComments:{rule:"repeated",type:"string",id:6}}}}},GeneratedCodeInfo:{edition:"proto2",fields:{annotation:{rule:"repeated",type:"Annotation",id:1}},nested:{Annotation:{fields:{path:{rule:"repeated",type:"int32",id:1,options:{packed:!0}},sourceFile:{type:"string",id:2},begin:{type:"int32",id:3},end:{type:"int32",id:4},semantic:{type:"Semantic",id:5}},nested:{Semantic:{values:{NONE:0,SET:1,ALIAS:2}}}}}},SymbolVisibility:{edition:"proto2",values:{VISIBILITY_UNSET:0,VISIBILITY_LOCAL:1,VISIBILITY_EXPORT:2}}}}}}}}});var XNe=E((tt,ZNe)=>{"use strict";var ri=U$();ZNe.exports=tt=ri.descriptor=ri.Root.fromJSON(s8()).lookup(".google.protobuf");var HNe=ri.Namespace,hw=ri.Root,Yc=ri.Enum,vo=ri.Type,Gu=ri.Field,jIt=ri.MapField,F$=ri.OneOf,mw=ri.Service,j$=ri.Method,GNe=ri.util.patterns,qIt=GNe.numberRe,q$=GNe.typeRefRe;hw.fromDescriptor=function(e){typeof e.length=="number"&&(e=tt.FileDescriptorSet.decode(e));var r=new hw;if(e.file)for(var n,i,s=0,o;s<e.file.length;++s){i=r,(n=e.file[s]).package&&n.package.length&&(i=r.define(n.package));var a=JIt(n);if(n.name&&n.name.length&&r.files.push(i.filename=n.name),n.messageType)for(o=0;o<n.messageType.length;++o)i.add(vo.fromDescriptor(n.messageType[o],a));if(n.enumType)for(o=0;o<n.enumType.length;++o)i.add(Yc.fromDescriptor(n.enumType[o],a));if(n.extension)for(o=0;o<n.extension.length;++o)i.add(Gu.fromDescriptor(n.extension[o],a));if(n.service)for(o=0;o<n.service.length;++o)i.add(mw.fromDescriptor(n.service[o],a));var c=V_(n.options,tt.FileOptions);if(c){var l=Object.keys(c);for(o=0;o<l.length;++o)i.setOption(l[o],c[l[o]])}}return r.resolveAll()};hw.prototype.toDescriptor=function(e){var r=tt.FileDescriptorSet.create();return WNe(this,r.file,e),r};function WNe(t,e,r){var n=tt.FileDescriptorProto.create({name:t.filename||(t.fullName.substring(1).replace(/\./g,"_")||"root")+".proto"});ZIt(r,n),t instanceof hw||(n.package=t.fullName.substring(1));for(var i=0,s;i<t.nestedArray.length;++i)(s=t._nestedArray[i])instanceof vo?n.messageType.push(s.toDescriptor(r)):s instanceof Yc?n.enumType.push(s.toDescriptor()):s instanceof Gu?n.extension.push(s.toDescriptor(r)):s instanceof mw?n.service.push(s.toDescriptor()):s instanceof HNe&&WNe(s,e,r);n.options=H_(t.options,tt.FileOptions),n.messageType.length+n.enumType.length+n.extension.length+n.service.length&&e.push(n)}var BIt=0;vo.fromDescriptor=function(e,r,n,i){if(i===void 0&&(i=0),i>ri.util.nestingLimit)throw Error("max depth exceeded");typeof e.length=="number"&&(e=tt.DescriptorProto.decode(e));var s=new vo(e.name.length?e.name:"Type"+BIt++,V_(e.options,tt.MessageOptions)),o;if(n||(s._edition=r),e.oneofDecl)for(o=0;o<e.oneofDecl.length;++o)s.add(F$.fromDescriptor(e.oneofDecl[o]));if(e.field)for(o=0;o<e.field.length;++o){var a=Gu.fromDescriptor(e.field[o],r,!0);s.add(a),e.field[o].hasOwnProperty("oneofIndex")&&s.oneofsArray[e.field[o].oneofIndex].add(a)}if(e.extension)for(o=0;o<e.extension.length;++o)s.add(Gu.fromDescriptor(e.extension[o],r,!0));if(e.nestedType)for(o=0;o<e.nestedType.length;++o)s.add(vo.fromDescriptor(e.nestedType[o],r,!0,i+1)),e.nestedType[o].options&&e.nestedType[o].options.mapEntry&&s.setOption("map_entry",!0);if(e.enumType)for(o=0;o<e.enumType.length;++o)s.add(Yc.fromDescriptor(e.enumType[o],r,!0));if(e.extensionRange&&e.extensionRange.length)for(s.extensions=[],o=0;o<e.extensionRange.length;++o)s.extensions.push([e.extensionRange[o].start,e.extensionRange[o].end]);if(e.reservedRange&&e.reservedRange.length||e.reservedName&&e.reservedName.length){if(s.reserved=[],e.reservedRange)for(o=0;o<e.reservedRange.length;++o)s.reserved.push([e.reservedRange[o].start,e.reservedRange[o].end]);if(e.reservedName)for(o=0;o<e.reservedName.length;++o)s.reserved.push(e.reservedName[o])}return s};vo.prototype.toDescriptor=function(e){var r=tt.DescriptorProto.create({name:this.name}),n;for(n=0;n<this.fieldsArray.length;++n){var i;if(r.field.push(i=this._fieldsArray[n].toDescriptor(e)),this._fieldsArray[n]instanceof jIt){var s=o8(this._fieldsArray[n].keyType,this._fieldsArray[n].resolvedKeyType,!1),o=o8(this._fieldsArray[n].type,this._fieldsArray[n].resolvedType,!1),a=o===11||o===14?this._fieldsArray[n].resolvedType&&JNe(this.parent,this._fieldsArray[n].resolvedType)||this._fieldsArray[n].type:void 0;r.nestedType.push(tt.DescriptorProto.create({name:i.typeName,field:[tt.FieldDescriptorProto.create({name:"key",number:1,label:1,type:s}),tt.FieldDescriptorProto.create({name:"value",number:2,label:1,type:o,typeName:a})],options:tt.MessageOptions.create({mapEntry:!0})}))}}for(n=0;n<this.oneofsArray.length;++n)r.oneofDecl.push(this._oneofsArray[n].toDescriptor());for(n=0;n<this.nestedArray.length;++n)this._nestedArray[n]instanceof Gu?r.field.push(this._nestedArray[n].toDescriptor(e)):this._nestedArray[n]instanceof vo?r.nestedType.push(this._nestedArray[n].toDescriptor(e)):this._nestedArray[n]instanceof Yc&&r.enumType.push(this._nestedArray[n].toDescriptor());if(this.extensions)for(n=0;n<this.extensions.length;++n)r.extensionRange.push(tt.DescriptorProto.ExtensionRange.create({start:this.extensions[n][0],end:this.extensions[n][1]}));if(this.reserved)for(n=0;n<this.reserved.length;++n)typeof this.reserved[n]=="string"?r.reservedName.push(this.reserved[n]):r.reservedRange.push(tt.DescriptorProto.ReservedRange.create({start:this.reserved[n][0],end:this.reserved[n][1]}));return r.options=H_(this.options,tt.MessageOptions),r};Gu.fromDescriptor=function(e,r,n){if(typeof e.length=="number"&&(e=tt.DescriptorProto.decode(e)),typeof e.number!="number")throw Error("missing field id");var i=e.typeName,s;if(i!=null&&i!==""){if(typeof i!="string"||!q$.test(i))throw Error("illegal type name: "+i);s=i}else s=WIt(e.type);var o;switch(e.label){case 1:o=void 0;break;case 2:o="required";break;case 3:o="repeated";break;default:throw Error("illegal label: "+e.label)}var a=e.extendee;if(a!=null&&a!==""){if(typeof a!="string"||!q$.test(a))throw Error("illegal type name: "+a)}else a=void 0;var c=new Gu(e.name.length?e.name:"field"+e.number,e.number,s,o,a);if(n||(c._edition=r),c.options=V_(e.options,tt.FieldOptions),e.proto3_optional&&(c.options.proto3_optional=!0),e.defaultValue&&e.defaultValue.length){var l=e.defaultValue;switch(l){case"true":case"TRUE":l=!0;break;case"false":case"FALSE":l=!1;break;default:var u=qIt.exec(l);u&&(l=parseInt(l));break}c.setOption("default",l)}return YIt(e.type)&&(r==="proto3"?e.options&&!e.options.packed&&c.setOption("packed",!1):(!r||r==="proto2")&&e.options&&e.options.packed&&c.setOption("packed",!0)),c};Gu.prototype.toDescriptor=function(e){var r=tt.FieldDescriptorProto.create({name:this.name,number:this.id});if(this.map)r.type=11,r.typeName=ri.util.ucFirst(this.name),r.label=3;else{switch(r.type=o8(this.type,this.resolve().resolvedType,this.delimited)){case 10:case 11:case 14:r.typeName=this.resolvedType?JNe(this.parent,this.resolvedType):this.type;break}this.rule==="repeated"?r.label=3:this.required&&e==="proto2"?r.label=2:r.label=1}if(r.extendee=this.extensionField?this.extensionField.parent.fullName:this.extend,this.partOf&&this.parent instanceof vo&&(r.oneofIndex=this.parent.oneofsArray.indexOf(this.partOf))<0)throw Error("missing oneof");return this.options&&(r.options=H_(this.options,tt.FieldOptions),this.options.default!=null&&(r.defaultValue=String(this.options.default)),this.options.proto3_optional&&(r.proto3_optional=!0)),e==="proto3"?this.packed||((r.options||(r.options=tt.FieldOptions.create())).packed=!1):(!e||e==="proto2")&&this.packed&&((r.options||(r.options=tt.FieldOptions.create())).packed=!0),r};var zIt=0;Yc.fromDescriptor=function(e,r,n){typeof e.length=="number"&&(e=tt.EnumDescriptorProto.decode(e));var i={};if(e.value)for(var s=0;s<e.value.length;++s){var o=e.value[s].name,a=e.value[s].number||0;i[o&&o.length?o:"NAME"+a]=a}var c=new Yc(e.name&&e.name.length?e.name:"Enum"+zIt++,i,V_(e.options,tt.EnumOptions));return n||(c._edition=r),c};Yc.prototype.toDescriptor=function(){for(var e=[],r=0,n=Object.keys(this.values);r<n.length;++r)e.push(tt.EnumValueDescriptorProto.create({name:n[r],number:this.values[n[r]]}));return tt.EnumDescriptorProto.create({name:this.name,value:e,options:H_(this.options,tt.EnumOptions)})};var VIt=0;F$.fromDescriptor=function(e){return typeof e.length=="number"&&(e=tt.OneofDescriptorProto.decode(e)),new F$(e.name&&e.name.length?e.name:"oneof"+VIt++)};F$.prototype.toDescriptor=function(){return tt.OneofDescriptorProto.create({name:this.name})};var HIt=0;mw.fromDescriptor=function(e,r,n){typeof e.length=="number"&&(e=tt.ServiceDescriptorProto.decode(e));var i=new mw(e.name&&e.name.length?e.name:"Service"+HIt++,V_(e.options,tt.ServiceOptions));if(n||(i._edition=r),e.method)for(var s=0;s<e.method.length;++s)i.add(j$.fromDescriptor(e.method[s]));return i};mw.prototype.toDescriptor=function(){for(var e=[],r=0;r<this.methodsArray.length;++r)e.push(this._methodsArray[r].toDescriptor());return tt.ServiceDescriptorProto.create({name:this.name,method:e,options:H_(this.options,tt.ServiceOptions)})};var GIt=0;j$.fromDescriptor=function(e){typeof e.length=="number"&&(e=tt.MethodDescriptorProto.decode(e));var r=e.inputType,n=e.outputType;if(r!=null&&r!==""&&(typeof r!="string"||!q$.test(r)))throw Error("illegal type name: "+r);if(n!=null&&n!==""&&(typeof n!="string"||!q$.test(n)))throw Error("illegal type name: "+n);return new j$(e.name&&e.name.length?e.name:"Method"+GIt++,"rpc",r,n,!!e.clientStreaming,!!e.serverStreaming,V_(e.options,tt.MethodOptions))};j$.prototype.toDescriptor=function(){return tt.MethodDescriptorProto.create({name:this.name,inputType:this.resolvedRequestType?this.resolvedRequestType.fullName:this.requestType,outputType:this.resolvedResponseType?this.resolvedResponseType.fullName:this.responseType,clientStreaming:this.requestStream,serverStreaming:this.responseStream,options:H_(this.options,tt.MethodOptions)})};function WIt(t){switch(t){case 1:return"double";case 2:return"float";case 3:return"int64";case 4:return"uint64";case 5:return"int32";case 6:return"fixed64";case 7:return"fixed32";case 8:return"bool";case 9:return"string";case 12:return"bytes";case 13:return"uint32";case 15:return"sfixed32";case 16:return"sfixed64";case 17:return"sint32";case 18:return"sint64"}throw Error("illegal type: "+t)}function YIt(t){switch(t){case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:case 13:case 14:case 15:case 16:case 17:case 18:return!0}return!1}function o8(t,e,r){switch(t){case"double":return 1;case"float":return 2;case"int64":return 3;case"uint64":return 4;case"int32":return 5;case"fixed64":return 6;case"fixed32":return 7;case"bool":return 8;case"string":return 9;case"bytes":return 12;case"uint32":return 13;case"sfixed32":return 15;case"sfixed64":return 16;case"sint32":return 17;case"sint64":return 18}if(e instanceof Yc)return 14;if(e instanceof vo)return r?10:11;throw Error("illegal type: "+t)}function YNe(t,e){for(var r={},n=0,i,s;n<e.fieldsArray.length;++n)if((s=(i=e._fieldsArray[n]).name)!=="uninterpretedOption"&&Object.prototype.hasOwnProperty.call(t,s)){var o=KIt(s);i.resolvedType instanceof vo?r[o]=YNe(t[s],i.resolvedType):i.resolvedType instanceof Yc?r[o]=i.resolvedType.valuesById[t[s]]:r[o]=t[s]}return r}function V_(t,e){if(t)return YNe(e.toObject(t),e)}function KNe(t,e){for(var r={},n=Object.keys(t),i=0;i<n.length;++i){var s=n[i],o=ri.util.camelCase(s);if(Object.prototype.hasOwnProperty.call(e.fields,o)){var a=e.fields[o];a.resolvedType instanceof vo?r[o]=KNe(t[s],a.resolvedType):r[o]=t[s],a.repeated&&!Array.isArray(r[o])&&(r[o]=[r[o]])}}return r}function H_(t,e){if(t)return e.fromObject(KNe(t,e))}function JNe(t,e){var r=t.fullName.split("."),n=e.fullName.split("."),i=0,s=0,o=n.length-1;if(!(t instanceof hw)&&e instanceof HNe)for(;i<r.length&&s<o&&r[i]===n[s];){var a=e.lookup(r[i++],!0);if(a!==null&&a!==e)break;++s}else for(;i<r.length&&s<o&&r[i]===n[s];++i,++s);return n.slice(s).join(".")}function KIt(t){return t.substring(0,1)+t.substring(1).replace(/([A-Z])(?=[a-z]|$)/g,function(e,r){return"_"+r.toLowerCase()})}function JIt(t){if(t.syntax==="editions"){if(t.edition===tt.Edition.EDITION_2023)return"2023";throw new Error("Unsupported edition "+t.edition)}return t.syntax==="proto3"?"proto3":"proto2"}function ZIt(t,e){if(t)if(t==="proto2"||t==="proto3")e.syntax=t;else if(e.syntax="editions",t==="2023")e.edition=tt.Edition.EDITION_2023;else throw new Error("Unsupported edition "+t)}});var QNe=E((p0r,XIt)=>{XIt.exports={nested:{google:{nested:{protobuf:{nested:{Api:{fields:{name:{type:"string",id:1},methods:{rule:"repeated",type:"Method",id:2},options:{rule:"repeated",type:"Option",id:3},version:{type:"string",id:4},sourceContext:{type:"SourceContext",id:5},mixins:{rule:"repeated",type:"Mixin",id:6},syntax:{type:"Syntax",id:7}}},Method:{fields:{name:{type:"string",id:1},requestTypeUrl:{type:"string",id:2},requestStreaming:{type:"bool",id:3},responseTypeUrl:{type:"string",id:4},responseStreaming:{type:"bool",id:5},options:{rule:"repeated",type:"Option",id:6},syntax:{type:"Syntax",id:7}}},Mixin:{fields:{name:{type:"string",id:1},root:{type:"string",id:2}}},SourceContext:{fields:{fileName:{type:"string",id:1}}},Option:{fields:{name:{type:"string",id:1},value:{type:"Any",id:2}}},Syntax:{values:{SYNTAX_PROTO2:0,SYNTAX_PROTO3:1}}}}}}}}});var eke=E((h0r,QIt)=>{QIt.exports={nested:{google:{nested:{protobuf:{nested:{SourceContext:{fields:{fileName:{type:"string",id:1}}}}}}}}}});var tke=E((m0r,eOt)=>{eOt.exports={nested:{google:{nested:{protobuf:{nested:{Type:{fields:{name:{type:"string",id:1},fields:{rule:"repeated",type:"Field",id:2},oneofs:{rule:"repeated",type:"string",id:3},options:{rule:"repeated",type:"Option",id:4},sourceContext:{type:"SourceContext",id:5},syntax:{type:"Syntax",id:6}}},Field:{fields:{kind:{type:"Kind",id:1},cardinality:{type:"Cardinality",id:2},number:{type:"int32",id:3},name:{type:"string",id:4},typeUrl:{type:"string",id:6},oneofIndex:{type:"int32",id:7},packed:{type:"bool",id:8},options:{rule:"repeated",type:"Option",id:9},jsonName:{type:"string",id:10},defaultValue:{type:"string",id:11}},nested:{Kind:{values:{TYPE_UNKNOWN:0,TYPE_DOUBLE:1,TYPE_FLOAT:2,TYPE_INT64:3,TYPE_UINT64:4,TYPE_INT32:5,TYPE_FIXED64:6,TYPE_FIXED32:7,TYPE_BOOL:8,TYPE_STRING:9,TYPE_GROUP:10,TYPE_MESSAGE:11,TYPE_BYTES:12,TYPE_UINT32:13,TYPE_ENUM:14,TYPE_SFIXED32:15,TYPE_SFIXED64:16,TYPE_SINT32:17,TYPE_SINT64:18}},Cardinality:{values:{CARDINALITY_UNKNOWN:0,CARDINALITY_OPTIONAL:1,CARDINALITY_REQUIRED:2,CARDINALITY_REPEATED:3}}}},Enum:{fields:{name:{type:"string",id:1},enumvalue:{rule:"repeated",type:"EnumValue",id:2},options:{rule:"repeated",type:"Option",id:3},sourceContext:{type:"SourceContext",id:4},syntax:{type:"Syntax",id:5}}},EnumValue:{fields:{name:{type:"string",id:1},number:{type:"int32",id:2},options:{rule:"repeated",type:"Option",id:3}}},Option:{fields:{name:{type:"string",id:1},value:{type:"Any",id:2}}},Syntax:{values:{SYNTAX_PROTO2:0,SYNTAX_PROTO3:1}},Any:{fields:{type_url:{type:"string",id:1},value:{type:"bytes",id:2}}},SourceContext:{fields:{fileName:{type:"string",id:1}}}}}}}}}});var ske=E(Wu=>{"use strict";Object.defineProperty(Wu,"__esModule",{value:!0});Wu.addCommonProtos=Wu.loadProtosWithOptionsSync=Wu.loadProtosWithOptions=void 0;var rke=W("fs"),nke=W("path"),G_=U$();function ike(t,e){let r=t.resolvePath;t.resolvePath=(n,i)=>{if(nke.isAbsolute(i))return i;for(let s of e){let o=nke.join(s,i);try{return rke.accessSync(o,rke.constants.R_OK),o}catch{continue}}return process.emitWarning(`${i} not found in any of the include paths ${e}`),r(n,i)}}async function tOt(t,e){let r=new G_.Root;if(e=e||{},e.includeDirs){if(!Array.isArray(e.includeDirs))return Promise.reject(new Error("The includeDirs option must be an array"));ike(r,e.includeDirs)}let n=await r.load(t,e);return n.resolveAll(),n}Wu.loadProtosWithOptions=tOt;function rOt(t,e){let r=new G_.Root;if(e=e||{},e.includeDirs){if(!Array.isArray(e.includeDirs))throw new Error("The includeDirs option must be an array");ike(r,e.includeDirs)}let n=r.loadSync(t,e);return n.resolveAll(),n}Wu.loadProtosWithOptionsSync=rOt;function nOt(){let t=QNe(),e=s8(),r=eke(),n=tke();G_.common("api",t.nested.google.nested.protobuf.nested),G_.common("descriptor",e.nested.google.nested.protobuf.nested),G_.common("source_context",r.nested.google.nested.protobuf.nested),G_.common("type",n.nested.google.nested.protobuf.nested)}Wu.addCommonProtos=nOt});var f8=E($r=>{"use strict";Object.defineProperty($r,"__esModule",{value:!0});$r.loadFileDescriptorSetFromObject=$r.loadFileDescriptorSetFromBuffer=$r.fromJSON=$r.loadSync=$r.load=$r.IdempotencyLevel=$r.isAnyExtension=$r.Long=void 0;var iOt=qPe(),Aa=U$(),u8=XNe(),d8=ske(),sOt=h5();$r.Long=sOt;function oOt(t){return"@type"in t&&typeof t["@type"]=="string"}$r.isAnyExtension=oOt;var oke;(function(t){t.IDEMPOTENCY_UNKNOWN="IDEMPOTENCY_UNKNOWN",t.NO_SIDE_EFFECTS="NO_SIDE_EFFECTS",t.IDEMPOTENT="IDEMPOTENT"})(oke=$r.IdempotencyLevel||($r.IdempotencyLevel={}));var ake={longs:String,enums:String,bytes:String,defaults:!0,oneofs:!0,json:!0};function aOt(t,e){return t===""?e:t+"."+e}function cOt(t){return t instanceof Aa.Service||t instanceof Aa.Type||t instanceof Aa.Enum}function lOt(t){return t instanceof Aa.Namespace||t instanceof Aa.Root}function cke(t,e){let r=aOt(e,t.name);return cOt(t)?[[r,t]]:lOt(t)&&typeof t.nested<"u"?Object.keys(t.nested).map(n=>cke(t.nested[n],r)).reduce((n,i)=>n.concat(i),[]):[]}function a8(t,e){return function(n){return t.toObject(t.decode(n),e)}}function c8(t){return function(r){if(Array.isArray(r))throw new Error(`Failed to serialize message: expected object with ${t.name} structure, got array instead`);let n=t.fromObject(r);return t.encode(n).finish()}}function uOt(t){return(t||[]).reduce((e,r)=>{for(let[n,i]of Object.entries(r))n==="uninterpreted_option"?e.uninterpreted_option.push(r.uninterpreted_option):e[n]=i;return e},{deprecated:!1,idempotency_level:oke.IDEMPOTENCY_UNKNOWN,uninterpreted_option:[]})}function dOt(t,e,r,n){let i=t.resolvedRequestType,s=t.resolvedResponseType;return{path:"/"+e+"/"+t.name,requestStream:!!t.requestStream,responseStream:!!t.responseStream,requestSerialize:c8(i),requestDeserialize:a8(i,r),responseSerialize:c8(s),responseDeserialize:a8(s,r),originalName:iOt(t.name),requestType:l8(i,r,n),responseType:l8(s,r,n),options:uOt(t.parsedOptions)}}function fOt(t,e,r,n){let i={};for(let s of t.methodsArray)i[s.name]=dOt(s,e,r,n);return i}function l8(t,e,r){let n=t.toDescriptor("proto3");return{format:"Protocol Buffer 3 DescriptorProto",type:n.$type.toObject(n,ake),fileDescriptorProtos:r,serialize:c8(t),deserialize:a8(t,e)}}function pOt(t,e){let r=t.toDescriptor("proto3");return{format:"Protocol Buffer 3 EnumDescriptorProto",type:r.$type.toObject(r,ake),fileDescriptorProtos:e}}function hOt(t,e,r,n){if(t instanceof Aa.Service)return fOt(t,e,r,n);if(t instanceof Aa.Type)return l8(t,r,n);if(t instanceof Aa.Enum)return pOt(t,n);throw new Error("Type mismatch in reflection object handling")}function B$(t,e){let r={};t.resolveAll();let i=t.toDescriptor("proto3").file.map(s=>Buffer.from(u8.FileDescriptorProto.encode(s).finish()));for(let[s,o]of cke(t,""))r[s]=hOt(o,s,e,i);return r}function lke(t,e){e=e||{};let r=Aa.Root.fromDescriptor(t);return r.resolveAll(),B$(r,e)}function mOt(t,e){return(0,d8.loadProtosWithOptions)(t,e).then(r=>B$(r,e))}$r.load=mOt;function gOt(t,e){let r=(0,d8.loadProtosWithOptionsSync)(t,e);return B$(r,e)}$r.loadSync=gOt;function _Ot(t,e){e=e||{};let r=Aa.Root.fromJSON(t);return r.resolveAll(),B$(r,e)}$r.fromJSON=_Ot;function yOt(t,e){let r=u8.FileDescriptorSet.decode(t);return lke(r,e)}$r.loadFileDescriptorSetFromBuffer=yOt;function SOt(t,e){let r=u8.FileDescriptorSet.fromObject(t);return lke(r,e)}$r.loadFileDescriptorSetFromObject=SOt;(0,d8.addCommonProtos)()});var Yu=E(Ht=>{"use strict";Object.defineProperty(Ht,"__esModule",{value:!0});Ht.registerChannelzSocket=Ht.registerChannelzServer=Ht.registerChannelzSubchannel=Ht.registerChannelzChannel=Ht.ChannelzCallTrackerStub=Ht.ChannelzCallTracker=Ht.ChannelzChildrenTrackerStub=Ht.ChannelzChildrenTracker=Ht.ChannelzTrace=Ht.ChannelzTraceStub=void 0;Ht.unregisterChannelzRef=wOt;Ht.getChannelzHandlers=_ke;Ht.getChannelzServiceDefinition=yke;Ht.setup=LOt;var V$=W("net"),vp=(uPe(),qn(lPe)),gw=ti(),_w=st(),EOt=Ti(),vOt=c$(),bOt=p$();function p8(t){return{channel_id:t.id,name:t.name}}function y8(t){return{subchannel_id:t.id,name:t.name}}function TOt(t){return{server_id:t.id}}function W$(t){return{socket_id:t.id,name:t.name}}var uke=32,S8=100,h8=class{constructor(){this.events=[],this.creationTimestamp=new Date,this.eventsLogged=0}addTrace(){}getTraceMessage(){return{creation_timestamp:Ra(this.creationTimestamp),num_events_logged:this.eventsLogged,events:[]}}};Ht.ChannelzTraceStub=h8;var m8=class{constructor(){this.events=[],this.eventsLogged=0,this.creationTimestamp=new Date}addTrace(e,r,n){let i=new Date;this.events.push({description:r,severity:e,timestamp:i,childChannel:n?.kind==="channel"?n:void 0,childSubchannel:n?.kind==="subchannel"?n:void 0}),this.events.length>=uke*2&&(this.events=this.events.slice(uke)),this.eventsLogged+=1}getTraceMessage(){return{creation_timestamp:Ra(this.creationTimestamp),num_events_logged:this.eventsLogged,events:this.events.map(e=>({description:e.description,severity:e.severity,timestamp:Ra(e.timestamp),channel_ref:e.childChannel?p8(e.childChannel):null,subchannel_ref:e.childSubchannel?y8(e.childSubchannel):null}))}}};Ht.ChannelzTrace=m8;var H$=class{constructor(){this.channelChildren=new vp.OrderedMap,this.subchannelChildren=new vp.OrderedMap,this.socketChildren=new vp.OrderedMap,this.trackerMap={channel:this.channelChildren,subchannel:this.subchannelChildren,socket:this.socketChildren}}refChild(e){let r=this.trackerMap[e.kind],n=r.find(e.id);n.equals(r.end())?r.setElement(e.id,{ref:e,count:1},n):n.pointer[1].count+=1}unrefChild(e){let r=this.trackerMap[e.kind],n=r.getElementByKey(e.id);n!==void 0&&(n.count-=1,n.count===0&&r.eraseElementByKey(e.id))}getChildLists(){return{channels:this.channelChildren,subchannels:this.subchannelChildren,sockets:this.socketChildren}}};Ht.ChannelzChildrenTracker=H$;var g8=class extends H${refChild(){}unrefChild(){}};Ht.ChannelzChildrenTrackerStub=g8;var G$=class{constructor(){this.callsStarted=0,this.callsSucceeded=0,this.callsFailed=0,this.lastCallStartedTimestamp=null}addCallStarted(){this.callsStarted+=1,this.lastCallStartedTimestamp=new Date}addCallSucceeded(){this.callsSucceeded+=1}addCallFailed(){this.callsFailed+=1}};Ht.ChannelzCallTracker=G$;var _8=class extends G${addCallStarted(){}addCallSucceeded(){}addCallFailed(){}};Ht.ChannelzCallTrackerStub=_8;var Kc={channel:new vp.OrderedMap,subchannel:new vp.OrderedMap,server:new vp.OrderedMap,socket:new vp.OrderedMap},Y$=t=>{let e=1;function r(){return e++}let n=Kc[t];return(i,s,o)=>{let a=r(),c={id:a,name:i,kind:t};return o&&n.setElement(a,{ref:c,getInfo:s}),c}};Ht.registerChannelzChannel=Y$("channel");Ht.registerChannelzSubchannel=Y$("subchannel");Ht.registerChannelzServer=Y$("server");Ht.registerChannelzSocket=Y$("socket");function wOt(t){Kc[t.kind].eraseElementByKey(t.id)}function AOt(t){let e=Number.parseInt(t,16);return[e/256|0,e%256]}function dke(t){if(t==="")return[];let e=t.split(":").map(n=>AOt(n));return[].concat(...e)}function ROt(t){return(0,V$.isIPv6)(t)&&t.toLowerCase().startsWith("::ffff:")&&(0,V$.isIPv4)(t.substring(7))}function fke(t){return Buffer.from(Uint8Array.from(t.split(".").map(e=>Number.parseInt(e))))}function xOt(t){if((0,V$.isIPv4)(t))return fke(t);if(ROt(t))return fke(t.substring(7));if((0,V$.isIPv6)(t)){let e,r,n=t.indexOf("::");n===-1?(e=t,r=""):(e=t.substring(0,n),r=t.substring(n+2));let i=Buffer.from(dke(e)),s=Buffer.from(dke(r)),o=Buffer.alloc(16-i.length-s.length,0);return Buffer.concat([i,o,s])}else return null}function hke(t){switch(t){case gw.ConnectivityState.CONNECTING:return{state:"CONNECTING"};case gw.ConnectivityState.IDLE:return{state:"IDLE"};case gw.ConnectivityState.READY:return{state:"READY"};case gw.ConnectivityState.SHUTDOWN:return{state:"SHUTDOWN"};case gw.ConnectivityState.TRANSIENT_FAILURE:return{state:"TRANSIENT_FAILURE"};default:return{state:"UNKNOWN"}}}function Ra(t){if(!t)return null;let e=t.getTime();return{seconds:e/1e3|0,nanos:e%1e3*1e6}}function mke(t){let e=t.getInfo(),r=[],n=[];return e.children.channels.forEach(i=>{r.push(p8(i[1].ref))}),e.children.subchannels.forEach(i=>{n.push(y8(i[1].ref))}),{ref:p8(t.ref),data:{target:e.target,state:hke(e.state),calls_started:e.callTracker.callsStarted,calls_succeeded:e.callTracker.callsSucceeded,calls_failed:e.callTracker.callsFailed,last_call_started_timestamp:Ra(e.callTracker.lastCallStartedTimestamp),trace:e.trace.getTraceMessage()},channel_ref:r,subchannel_ref:n}}function IOt(t,e){let r=parseInt(t.request.channel_id,10),n=Kc.channel.getElementByKey(r);if(n===void 0){e({code:_w.Status.NOT_FOUND,details:"No channel data found for id "+r});return}e(null,{channel:mke(n)})}function OOt(t,e){let r=parseInt(t.request.max_results,10)||S8,n=[],i=parseInt(t.request.start_channel_id,10),s=Kc.channel,o;for(o=s.lowerBound(i);!o.equals(s.end())&&n.length<r;o=o.next())n.push(mke(o.pointer[1]));e(null,{channel:n,end:o.equals(s.end())})}function gke(t){let e=t.getInfo(),r=[];return e.listenerChildren.sockets.forEach(n=>{r.push(W$(n[1].ref))}),{ref:TOt(t.ref),data:{calls_started:e.callTracker.callsStarted,calls_succeeded:e.callTracker.callsSucceeded,calls_failed:e.callTracker.callsFailed,last_call_started_timestamp:Ra(e.callTracker.lastCallStartedTimestamp),trace:e.trace.getTraceMessage()},listen_socket:r}}function POt(t,e){let r=parseInt(t.request.server_id,10),i=Kc.server.getElementByKey(r);if(i===void 0){e({code:_w.Status.NOT_FOUND,details:"No server data found for id "+r});return}e(null,{server:gke(i)})}function COt(t,e){let r=parseInt(t.request.max_results,10)||S8,n=parseInt(t.request.start_server_id,10),i=Kc.server,s=[],o;for(o=i.lowerBound(n);!o.equals(i.end())&&s.length<r;o=o.next())s.push(gke(o.pointer[1]));e(null,{server:s,end:o.equals(i.end())})}function NOt(t,e){let r=parseInt(t.request.subchannel_id,10),n=Kc.subchannel.getElementByKey(r);if(n===void 0){e({code:_w.Status.NOT_FOUND,details:"No subchannel data found for id "+r});return}let i=n.getInfo(),s=[];i.children.sockets.forEach(a=>{s.push(W$(a[1].ref))});let o={ref:y8(n.ref),data:{target:i.target,state:hke(i.state),calls_started:i.callTracker.callsStarted,calls_succeeded:i.callTracker.callsSucceeded,calls_failed:i.callTracker.callsFailed,last_call_started_timestamp:Ra(i.callTracker.lastCallStartedTimestamp),trace:i.trace.getTraceMessage()},socket_ref:s};e(null,{subchannel:o})}function pke(t){var e;return(0,EOt.isTcpSubchannelAddress)(t)?{address:"tcpip_address",tcpip_address:{ip_address:(e=xOt(t.host))!==null&&e!==void 0?e:void 0,port:t.port}}:{address:"uds_address",uds_address:{filename:t.path}}}function kOt(t,e){var r,n,i,s,o;let a=parseInt(t.request.socket_id,10),c=Kc.socket.getElementByKey(a);if(c===void 0){e({code:_w.Status.NOT_FOUND,details:"No socket data found for id "+a});return}let l=c.getInfo(),u=l.security?{model:"tls",tls:{cipher_suite:l.security.cipherSuiteStandardName?"standard_name":"other_name",standard_name:(r=l.security.cipherSuiteStandardName)!==null&&r!==void 0?r:void 0,other_name:(n=l.security.cipherSuiteOtherName)!==null&&n!==void 0?n:void 0,local_certificate:(i=l.security.localCertificate)!==null&&i!==void 0?i:void 0,remote_certificate:(s=l.security.remoteCertificate)!==null&&s!==void 0?s:void 0}}:null,d={ref:W$(c.ref),local:l.localAddress?pke(l.localAddress):null,remote:l.remoteAddress?pke(l.remoteAddress):null,remote_name:(o=l.remoteName)!==null&&o!==void 0?o:void 0,security:u,data:{keep_alives_sent:l.keepAlivesSent,streams_started:l.streamsStarted,streams_succeeded:l.streamsSucceeded,streams_failed:l.streamsFailed,last_local_stream_created_timestamp:Ra(l.lastLocalStreamCreatedTimestamp),last_remote_stream_created_timestamp:Ra(l.lastRemoteStreamCreatedTimestamp),messages_received:l.messagesReceived,messages_sent:l.messagesSent,last_message_received_timestamp:Ra(l.lastMessageReceivedTimestamp),last_message_sent_timestamp:Ra(l.lastMessageSentTimestamp),local_flow_control_window:l.localFlowControlWindow?{value:l.localFlowControlWindow}:null,remote_flow_control_window:l.remoteFlowControlWindow?{value:l.remoteFlowControlWindow}:null}};e(null,{socket:d})}function $Ot(t,e){let r=parseInt(t.request.server_id,10),n=Kc.server.getElementByKey(r);if(n===void 0){e({code:_w.Status.NOT_FOUND,details:"No server data found for id "+r});return}let i=parseInt(t.request.start_socket_id,10),s=parseInt(t.request.max_results,10)||S8,a=n.getInfo().sessionChildren.sockets,c=[],l;for(l=a.lowerBound(i);!l.equals(a.end())&&c.length<s;l=l.next())c.push(W$(l.pointer[1].ref));e(null,{socket_ref:c,end:l.equals(a.end())})}function _ke(){return{GetChannel:IOt,GetTopChannels:OOt,GetServer:POt,GetServers:COt,GetSubchannel:NOt,GetSocket:kOt,GetServerSockets:$Ot}}var z$=null;function yke(){if(z$)return z$;let t=f8().loadSync,e=t("channelz.proto",{keepCase:!0,longs:String,enums:String,defaults:!0,oneofs:!0,includeDirs:[`${__dirname}/../../proto`]});return z$=(0,bOt.loadPackageDefinition)(e).grpc.channelz.v1.Channelz.service,z$}function LOt(){(0,vOt.registerAdminService)(yke,_ke)}});var K$=E(E8=>{"use strict";Object.defineProperty(E8,"__esModule",{value:!0});E8.getNextCallNumber=MOt;var DOt=0;function MOt(){return DOt++}});var v8=E(J$=>{"use strict";Object.defineProperty(J$,"__esModule",{value:!0});J$.CompressionAlgorithms=void 0;var Ske;(function(t){t[t.identity=0]="identity",t[t.deflate=1]="deflate",t[t.gzip=2]="gzip"})(Ske||(J$.CompressionAlgorithms=Ske={}))});var T8=E(Z$=>{"use strict";Object.defineProperty(Z$,"__esModule",{value:!0});Z$.BaseFilter=void 0;var b8=class{async sendMetadata(e){return e}receiveMetadata(e){return e}async sendMessage(e){return e}async receiveMessage(e){return e}receiveTrailers(e){return e}};Z$.BaseFilter=b8});var I8=E(Y_=>{"use strict";Object.defineProperty(Y_,"__esModule",{value:!0});Y_.CompressionFilterFactory=Y_.CompressionFilter=void 0;var X$=W("zlib"),vke=v8(),Ku=st(),UOt=T8(),FOt=qt(),jOt=t=>typeof t=="number"&&typeof vke.CompressionAlgorithms[t]=="string",W_=class{async writeMessage(e,r){let n=e;r&&(n=await this.compressMessage(n));let i=Buffer.allocUnsafe(n.length+5);return i.writeUInt8(r?1:0,0),i.writeUInt32BE(n.length,1),n.copy(i,5),i}async readMessage(e){let r=e.readUInt8(0)===1,n=e.slice(5);return r&&(n=await this.decompressMessage(n)),n}},bp=class extends W_{async compressMessage(e){return e}async writeMessage(e,r){let n=Buffer.allocUnsafe(e.length+5);return n.writeUInt8(0,0),n.writeUInt32BE(e.length,1),e.copy(n,5),n}decompressMessage(e){return Promise.reject(new Error('Received compressed message but "grpc-encoding" header was identity'))}},w8=class extends W_{constructor(e){super(),this.maxRecvMessageLength=e}compressMessage(e){return new Promise((r,n)=>{X$.deflate(e,(i,s)=>{i?n(i):r(s)})})}decompressMessage(e){return new Promise((r,n)=>{let i=0,s=[],o=X$.createInflate();o.on("error",a=>{n({code:Ku.Status.INTERNAL,details:"Failed to decompress deflate-encoded message"})}),o.on("data",a=>{s.push(a),i+=a.byteLength,this.maxRecvMessageLength!==-1&&i>this.maxRecvMessageLength&&(o.destroy(),n({code:Ku.Status.RESOURCE_EXHAUSTED,details:`Received message that decompresses to a size larger than ${this.maxRecvMessageLength}`}))}),o.on("end",()=>{r(Buffer.concat(s))}),o.write(e),o.end()})}},A8=class extends W_{constructor(e){super(),this.maxRecvMessageLength=e}compressMessage(e){return new Promise((r,n)=>{X$.gzip(e,(i,s)=>{i?n(i):r(s)})})}decompressMessage(e){return new Promise((r,n)=>{let i=0,s=[],o=X$.createGunzip();o.on("error",a=>{n({code:Ku.Status.INTERNAL,details:"Failed to decompress gzip-encoded message"})}),o.on("data",a=>{s.push(a),i+=a.byteLength,this.maxRecvMessageLength!==-1&&i>this.maxRecvMessageLength&&(o.destroy(),n({code:Ku.Status.RESOURCE_EXHAUSTED,details:`Received message that decompresses to a size larger than ${this.maxRecvMessageLength}`}))}),o.on("end",()=>{r(Buffer.concat(s))}),o.write(e),o.end()})}},R8=class extends W_{constructor(e){super(),this.compressionName=e}compressMessage(e){return Promise.reject(new Error(`Received message compressed with unsupported compression method ${this.compressionName}`))}decompressMessage(e){return Promise.reject(new Error(`Compression method not supported: ${this.compressionName}`))}};function Eke(t,e){switch(t){case"identity":return new bp;case"deflate":return new w8(e);case"gzip":return new A8(e);default:return new R8(t)}}var Q$=class extends UOt.BaseFilter{constructor(e,r){var n,i,s;super(),this.sharedFilterConfig=r,this.sendCompression=new bp,this.receiveCompression=new bp,this.currentCompressionAlgorithm="identity";let o=e["grpc.default_compression_algorithm"];if(this.maxReceiveMessageLength=(n=e["grpc.max_receive_message_length"])!==null&&n!==void 0?n:Ku.DEFAULT_MAX_RECEIVE_MESSAGE_LENGTH,this.maxSendMessageLength=(i=e["grpc.max_send_message_length"])!==null&&i!==void 0?i:Ku.DEFAULT_MAX_SEND_MESSAGE_LENGTH,o!==void 0)if(jOt(o)){let a=vke.CompressionAlgorithms[o],c=(s=r.serverSupportedEncodingHeader)===null||s===void 0?void 0:s.split(",");(!c||c.includes(a))&&(this.currentCompressionAlgorithm=a,this.sendCompression=Eke(this.currentCompressionAlgorithm,-1))}else FOt.log(Ku.LogVerbosity.ERROR,`Invalid value provided for grpc.default_compression_algorithm option: ${o}`)}async sendMetadata(e){let r=await e;return r.set("grpc-accept-encoding","identity,deflate,gzip"),r.set("accept-encoding","identity"),this.currentCompressionAlgorithm==="identity"?r.remove("grpc-encoding"):r.set("grpc-encoding",this.currentCompressionAlgorithm),r}receiveMetadata(e){let r=e.get("grpc-encoding");if(r.length>0){let i=r[0];typeof i=="string"&&(this.receiveCompression=Eke(i,this.maxReceiveMessageLength))}e.remove("grpc-encoding");let n=e.get("grpc-accept-encoding")[0];return n&&(this.sharedFilterConfig.serverSupportedEncodingHeader=n,n.split(",").includes(this.currentCompressionAlgorithm)||(this.sendCompression=new bp,this.currentCompressionAlgorithm="identity")),e.remove("grpc-accept-encoding"),e}async sendMessage(e){var r;let n=await e;if(this.maxSendMessageLength!==-1&&n.message.length>this.maxSendMessageLength)throw{code:Ku.Status.RESOURCE_EXHAUSTED,details:`Attempted to send message with a size larger than ${this.maxSendMessageLength}`};let i;return this.sendCompression instanceof bp?i=!1:i=(((r=n.flags)!==null&&r!==void 0?r:0)&2)===0,{message:await this.sendCompression.writeMessage(n.message,i),flags:n.flags}}async receiveMessage(e){return this.receiveCompression.readMessage(await e)}};Y_.CompressionFilter=Q$;var x8=class{constructor(e,r){this.options=r,this.sharedFilterConfig={}}createFilter(){return new Q$(this.options,this.sharedFilterConfig)}};Y_.CompressionFilterFactory=x8});var yw=E(O8=>{"use strict";Object.defineProperty(O8,"__esModule",{value:!0});O8.restrictControlPlaneStatusCode=BOt;var xa=st(),qOt=[xa.Status.OK,xa.Status.INVALID_ARGUMENT,xa.Status.NOT_FOUND,xa.Status.ALREADY_EXISTS,xa.Status.FAILED_PRECONDITION,xa.Status.ABORTED,xa.Status.OUT_OF_RANGE,xa.Status.DATA_LOSS];function BOt(t,e){return qOt.includes(t)?{code:xa.Status.INTERNAL,details:`Invalid status from control plane: ${t} ${xa.Status[t]} ${e}`}:{code:t,details:e}}});var K_=E(Tp=>{"use strict";Object.defineProperty(Tp,"__esModule",{value:!0});Tp.minDeadline=zOt;Tp.getDeadlineTimeoutString=HOt;Tp.getRelativeTimeout=WOt;Tp.deadlineToString=YOt;Tp.formatDateDifference=KOt;function zOt(...t){let e=1/0;for(let r of t){let n=r instanceof Date?r.getTime():r;n<e&&(e=n)}return e}var VOt=[["m",1],["S",1e3],["M",60*1e3],["H",3600*1e3]];function HOt(t){let e=new Date().getTime();t instanceof Date&&(t=t.getTime());let r=Math.max(t-e,0);for(let[n,i]of VOt){let s=r/i;if(s<1e8)return String(Math.ceil(s))+n}throw new Error("Deadline is too far in the future")}var GOt=2147483647;function WOt(t){let e=t instanceof Date?t.getTime():t,r=new Date().getTime(),n=e-r;return n<0?0:n>GOt?1/0:n}function YOt(t){if(t instanceof Date)return t.toISOString();{let e=new Date(t);return Number.isNaN(e.getTime())?""+t:e.toISOString()}}function KOt(t,e){return((e.getTime()-t.getTime())/1e3).toFixed(3)+"s"}});var tL=E(J_=>{"use strict";Object.defineProperty(J_,"__esModule",{value:!0});J_.FilterStackFactory=J_.FilterStack=void 0;var eL=class{constructor(e){this.filters=e}sendMetadata(e){let r=e;for(let n=0;n<this.filters.length;n++)r=this.filters[n].sendMetadata(r);return r}receiveMetadata(e){let r=e;for(let n=this.filters.length-1;n>=0;n--)r=this.filters[n].receiveMetadata(r);return r}sendMessage(e){let r=e;for(let n=0;n<this.filters.length;n++)r=this.filters[n].sendMessage(r);return r}receiveMessage(e){let r=e;for(let n=this.filters.length-1;n>=0;n--)r=this.filters[n].receiveMessage(r);return r}receiveTrailers(e){let r=e;for(let n=this.filters.length-1;n>=0;n--)r=this.filters[n].receiveTrailers(r);return r}push(e){this.filters.unshift(...e)}getFilters(){return this.filters}};J_.FilterStack=eL;var P8=class t{constructor(e){this.factories=e}push(e){this.factories.unshift(...e)}clone(){return new t([...this.factories])}createFilter(){return new eL(this.factories.map(e=>e.createFilter()))}};J_.FilterStackFactory=P8});var bke=E(nL=>{"use strict";Object.defineProperty(nL,"__esModule",{value:!0});nL.SingleSubchannelChannel=void 0;var JOt=K$(),Sw=Yu(),ZOt=I8(),XOt=ti(),Ew=st(),QOt=yw(),ePt=K_(),tPt=tL(),C8=Vr(),rPt=co(),rL=ei(),N8=class{constructor(e,r,n,i,s){var o,a;this.subchannel=e,this.method=r,this.options=i,this.callNumber=s,this.childCall=null,this.pendingMessage=null,this.readPending=!1,this.halfClosePending=!1,this.pendingStatus=null,this.readFilterPending=!1,this.writeFilterPending=!1;let c=this.method.split("/"),l="";c.length>=2&&(l=c[1]);let u=(a=(o=(0,rL.splitHostPort)(this.options.host))===null||o===void 0?void 0:o.host)!==null&&a!==void 0?a:"localhost";this.serviceUrl=`https://${u}/${l}`;let d=(0,ePt.getRelativeTimeout)(i.deadline);d!==1/0&&(d<=0?this.cancelWithStatus(Ew.Status.DEADLINE_EXCEEDED,"Deadline exceeded"):setTimeout(()=>{this.cancelWithStatus(Ew.Status.DEADLINE_EXCEEDED,"Deadline exceeded")},d)),this.filterStack=n.createFilter()}cancelWithStatus(e,r){this.childCall?this.childCall.cancelWithStatus(e,r):this.pendingStatus={code:e,details:r,metadata:new C8.Metadata}}getPeer(){var e,r;return(r=(e=this.childCall)===null||e===void 0?void 0:e.getPeer())!==null&&r!==void 0?r:this.subchannel.getAddress()}async start(e,r){if(this.pendingStatus){r.onReceiveStatus(this.pendingStatus);return}if(this.subchannel.getConnectivityState()!==XOt.ConnectivityState.READY){r.onReceiveStatus({code:Ew.Status.UNAVAILABLE,details:"Subchannel not ready",metadata:new C8.Metadata});return}let n=await this.filterStack.sendMetadata(Promise.resolve(e)),i;try{i=await this.subchannel.getCallCredentials().generateMetadata({method_name:this.method,service_url:this.serviceUrl})}catch(o){let a=o,{code:c,details:l}=(0,QOt.restrictControlPlaneStatusCode)(typeof a.code=="number"?a.code:Ew.Status.UNKNOWN,`Getting metadata from plugin failed with error: ${a.message}`);r.onReceiveStatus({code:c,details:l,metadata:new C8.Metadata});return}i.merge(n);let s={onReceiveMetadata:async o=>{r.onReceiveMetadata(await this.filterStack.receiveMetadata(o))},onReceiveMessage:async o=>{this.readFilterPending=!0;let a=await this.filterStack.receiveMessage(o);this.readFilterPending=!1,r.onReceiveMessage(a),this.pendingStatus&&r.onReceiveStatus(this.pendingStatus)},onReceiveStatus:async o=>{let a=await this.filterStack.receiveTrailers(o);this.readFilterPending?this.pendingStatus=a:r.onReceiveStatus(a)}};this.childCall=this.subchannel.createCall(i,this.options.host,this.method,s),this.readPending&&this.childCall.startRead(),this.pendingMessage&&this.childCall.sendMessageWithContext(this.pendingMessage.context,this.pendingMessage.message),this.halfClosePending&&!this.writeFilterPending&&this.childCall.halfClose()}async sendMessageWithContext(e,r){this.writeFilterPending=!0;let n=await this.filterStack.sendMessage(Promise.resolve({message:r,flags:e.flags}));this.writeFilterPending=!1,this.childCall?(this.childCall.sendMessageWithContext(e,n.message),this.halfClosePending&&this.childCall.halfClose()):this.pendingMessage={context:e,message:n.message}}startRead(){this.childCall?this.childCall.startRead():this.readPending=!0}halfClose(){this.childCall&&!this.writeFilterPending?this.childCall.halfClose():this.halfClosePending=!0}getCallNumber(){return this.callNumber}setCredentials(e){throw new Error("Method not implemented.")}getAuthContext(){return this.childCall?this.childCall.getAuthContext():null}},k8=class{constructor(e,r,n){this.subchannel=e,this.target=r,this.channelzEnabled=!1,this.channelzTrace=new Sw.ChannelzTrace,this.callTracker=new Sw.ChannelzCallTracker,this.childrenTracker=new Sw.ChannelzChildrenTracker,this.channelzEnabled=n["grpc.enable_channelz"]!==0,this.channelzRef=(0,Sw.registerChannelzChannel)((0,rL.uriToString)(r),()=>({target:`${(0,rL.uriToString)(r)} (${e.getAddress()})`,state:this.subchannel.getConnectivityState(),trace:this.channelzTrace,callTracker:this.callTracker,children:this.childrenTracker.getChildLists()}),this.channelzEnabled),this.channelzEnabled&&this.childrenTracker.refChild(e.getChannelzRef()),this.filterStackFactory=new tPt.FilterStackFactory([new ZOt.CompressionFilterFactory(this,n)])}close(){this.channelzEnabled&&this.childrenTracker.unrefChild(this.subchannel.getChannelzRef()),(0,Sw.unregisterChannelzRef)(this.channelzRef)}getTarget(){return(0,rL.uriToString)(this.target)}getConnectivityState(e){throw new Error("Method not implemented.")}watchConnectivityState(e,r,n){throw new Error("Method not implemented.")}getChannelzRef(){return this.channelzRef}createCall(e,r){let n={deadline:r,host:(0,rPt.getDefaultAuthority)(this.target),flags:Ew.Propagate.DEFAULTS,parentCall:null};return new N8(this.subchannel,e,this.filterStackFactory,n,(0,JOt.getNextCallNumber)())}};nL.SingleSubchannelChannel=k8});var Tke=E(sL=>{"use strict";Object.defineProperty(sL,"__esModule",{value:!0});sL.Subchannel=void 0;var Lt=ti(),nPt=O_(),$8=qt(),iL=st(),iPt=ei(),sPt=Ti(),Ia=Yu(),oPt=bke(),aPt="subchannel",cPt=~(1<<31),L8=class{constructor(e,r,n,i,s){var o;this.channelTarget=e,this.subchannelAddress=r,this.options=n,this.connector=s,this.connectivityState=Lt.ConnectivityState.IDLE,this.transport=null,this.continueConnecting=!1,this.stateListeners=new Set,this.refcount=0,this.channelzEnabled=!0,this.dataProducers=new Map,this.subchannelChannel=null;let a={initialDelay:n["grpc.initial_reconnect_backoff_ms"],maxDelay:n["grpc.max_reconnect_backoff_ms"]};this.backoffTimeout=new nPt.BackoffTimeout(()=>{this.handleBackoffTimer()},a),this.backoffTimeout.unref(),this.subchannelAddressString=(0,sPt.subchannelAddressToString)(r),this.keepaliveTime=(o=n["grpc.keepalive_time_ms"])!==null&&o!==void 0?o:-1,n["grpc.enable_channelz"]===0?(this.channelzEnabled=!1,this.channelzTrace=new Ia.ChannelzTraceStub,this.callTracker=new Ia.ChannelzCallTrackerStub,this.childrenTracker=new Ia.ChannelzChildrenTrackerStub,this.streamTracker=new Ia.ChannelzCallTrackerStub):(this.channelzTrace=new Ia.ChannelzTrace,this.callTracker=new Ia.ChannelzCallTracker,this.childrenTracker=new Ia.ChannelzChildrenTracker,this.streamTracker=new Ia.ChannelzCallTracker),this.channelzRef=(0,Ia.registerChannelzSubchannel)(this.subchannelAddressString,()=>this.getChannelzInfo(),this.channelzEnabled),this.channelzTrace.addTrace("CT_INFO","Subchannel created"),this.trace("Subchannel constructed with options "+JSON.stringify(n,void 0,2)),this.secureConnector=i._createSecureConnector(e,n)}getChannelzInfo(){return{state:this.connectivityState,trace:this.channelzTrace,callTracker:this.callTracker,children:this.childrenTracker.getChildLists(),target:this.subchannelAddressString}}trace(e){$8.trace(iL.LogVerbosity.DEBUG,aPt,"("+this.channelzRef.id+") "+this.subchannelAddressString+" "+e)}refTrace(e){$8.trace(iL.LogVerbosity.DEBUG,"subchannel_refcount","("+this.channelzRef.id+") "+this.subchannelAddressString+" "+e)}handleBackoffTimer(){this.continueConnecting?this.transitionToState([Lt.ConnectivityState.TRANSIENT_FAILURE],Lt.ConnectivityState.CONNECTING):this.transitionToState([Lt.ConnectivityState.TRANSIENT_FAILURE],Lt.ConnectivityState.IDLE)}startBackoff(){this.backoffTimeout.runOnce()}stopBackoff(){this.backoffTimeout.stop(),this.backoffTimeout.reset()}startConnectingInternal(){let e=this.options;if(e["grpc.keepalive_time_ms"]){let r=Math.min(this.keepaliveTime,cPt);e=Object.assign(Object.assign({},e),{"grpc.keepalive_time_ms":r})}this.connector.connect(this.subchannelAddress,this.secureConnector,e).then(r=>{this.transitionToState([Lt.ConnectivityState.CONNECTING],Lt.ConnectivityState.READY)?(this.transport=r,this.channelzEnabled&&this.childrenTracker.refChild(r.getChannelzRef()),r.addDisconnectListener(n=>{this.transitionToState([Lt.ConnectivityState.READY],Lt.ConnectivityState.IDLE),n&&this.keepaliveTime>0&&(this.keepaliveTime*=2,$8.log(iL.LogVerbosity.ERROR,`Connection to ${(0,iPt.uriToString)(this.channelTarget)} at ${this.subchannelAddressString} rejected by server because of excess pings. Increasing ping interval to ${this.keepaliveTime} ms`))})):r.shutdown()},r=>{this.transitionToState([Lt.ConnectivityState.CONNECTING],Lt.ConnectivityState.TRANSIENT_FAILURE,`${r}`)})}transitionToState(e,r,n){var i,s;if(e.indexOf(this.connectivityState)===-1)return!1;n?this.trace(Lt.ConnectivityState[this.connectivityState]+" -> "+Lt.ConnectivityState[r]+' with error "'+n+'"'):this.trace(Lt.ConnectivityState[this.connectivityState]+" -> "+Lt.ConnectivityState[r]),this.channelzEnabled&&this.channelzTrace.addTrace("CT_INFO","Connectivity state change to "+Lt.ConnectivityState[r]);let o=this.connectivityState;switch(this.connectivityState=r,r){case Lt.ConnectivityState.READY:this.stopBackoff();break;case Lt.ConnectivityState.CONNECTING:this.startBackoff(),this.startConnectingInternal(),this.continueConnecting=!1;break;case Lt.ConnectivityState.TRANSIENT_FAILURE:this.channelzEnabled&&this.transport&&this.childrenTracker.unrefChild(this.transport.getChannelzRef()),(i=this.transport)===null||i===void 0||i.shutdown(),this.transport=null,this.backoffTimeout.isRunning()||process.nextTick(()=>{this.handleBackoffTimer()});break;case Lt.ConnectivityState.IDLE:this.channelzEnabled&&this.transport&&this.childrenTracker.unrefChild(this.transport.getChannelzRef()),(s=this.transport)===null||s===void 0||s.shutdown(),this.transport=null;break;default:throw new Error(`Invalid state: unknown ConnectivityState ${r}`)}for(let a of this.stateListeners)a(this,o,r,this.keepaliveTime,n);return!0}ref(){this.refTrace("refcount "+this.refcount+" -> "+(this.refcount+1)),this.refcount+=1}unref(){this.refTrace("refcount "+this.refcount+" -> "+(this.refcount-1)),this.refcount-=1,this.refcount===0&&(this.channelzTrace.addTrace("CT_INFO","Shutting down"),(0,Ia.unregisterChannelzRef)(this.channelzRef),this.secureConnector.destroy(),process.nextTick(()=>{this.transitionToState([Lt.ConnectivityState.CONNECTING,Lt.ConnectivityState.READY],Lt.ConnectivityState.IDLE)}))}unrefIfOneRef(){return this.refcount===1?(this.unref(),!0):!1}createCall(e,r,n,i){if(!this.transport)throw new Error("Cannot create call, subchannel not READY");let s;return this.channelzEnabled?(this.callTracker.addCallStarted(),this.streamTracker.addCallStarted(),s={onCallEnd:o=>{o.code===iL.Status.OK?this.callTracker.addCallSucceeded():this.callTracker.addCallFailed()}}):s={},this.transport.createCall(e,r,n,i,s)}startConnecting(){process.nextTick(()=>{this.transitionToState([Lt.ConnectivityState.IDLE],Lt.ConnectivityState.CONNECTING)||this.connectivityState===Lt.ConnectivityState.TRANSIENT_FAILURE&&(this.continueConnecting=!0)})}getConnectivityState(){return this.connectivityState}addConnectivityStateListener(e){this.stateListeners.add(e)}removeConnectivityStateListener(e){this.stateListeners.delete(e)}resetBackoff(){process.nextTick(()=>{this.backoffTimeout.reset(),this.transitionToState([Lt.ConnectivityState.TRANSIENT_FAILURE],Lt.ConnectivityState.CONNECTING)})}getAddress(){return this.subchannelAddressString}getChannelzRef(){return this.channelzRef}isHealthy(){return!0}addHealthStateWatcher(e){}removeHealthStateWatcher(e){}getRealSubchannel(){return this}realSubchannelEquals(e){return e.getRealSubchannel()===this}throttleKeepalive(e){e>this.keepaliveTime&&(this.keepaliveTime=e)}getCallCredentials(){return this.secureConnector.getCallCredentials()}getChannel(){return this.subchannelChannel||(this.subchannelChannel=new oPt.SingleSubchannelChannel(this,this.channelTarget,this.options)),this.subchannelChannel}addDataWatcher(e){throw new Error("Not implemented")}getOrCreateDataProducer(e,r){let n=this.dataProducers.get(e);if(n)return n;let i=r(this);return this.dataProducers.set(e,i),i}removeDataProducer(e){this.dataProducers.delete(e)}};sL.Subchannel=L8});var wke=E(oL=>{"use strict";var D8;Object.defineProperty(oL,"__esModule",{value:!0});oL.GRPC_NODE_USE_ALTERNATIVE_RESOLVER=void 0;oL.GRPC_NODE_USE_ALTERNATIVE_RESOLVER=((D8=process.env.GRPC_NODE_USE_ALTERNATIVE_RESOLVER)!==null&&D8!==void 0?D8:"false")==="true"});var j8=E(wp=>{"use strict";Object.defineProperty(wp,"__esModule",{value:!0});wp.DEFAULT_PORT=void 0;wp.setup=gPt;var Ake=co(),M8=W("dns"),lPt=$K(),U8=st(),Z_=fp(),uPt=Vr(),dPt=qt(),fPt=st(),Ju=ei(),Rke=W("net"),pPt=O_(),xke=wke(),hPt="dns_resolver";function Oa(t){dPt.trace(fPt.LogVerbosity.DEBUG,hPt,t)}wp.DEFAULT_PORT=443;var mPt=3e4,F8=class{constructor(e,r,n){var i,s,o;this.target=e,this.listener=r,this.pendingLookupPromise=null,this.pendingTxtPromise=null,this.latestLookupResult=null,this.latestServiceConfigResult=null,this.continueResolving=!1,this.isNextResolutionTimerRunning=!1,this.isServiceConfigEnabled=!0,this.returnedIpResult=!1,this.alternativeResolver=new M8.promises.Resolver,Oa("Resolver constructed for target "+(0,Ju.uriToString)(e)),e.authority&&this.alternativeResolver.setServers([e.authority]);let a=(0,Ju.splitHostPort)(e.path);a===null?(this.ipResult=null,this.dnsHostname=null,this.port=null):(0,Rke.isIPv4)(a.host)||(0,Rke.isIPv6)(a.host)?(this.ipResult=[{addresses:[{host:a.host,port:(i=a.port)!==null&&i!==void 0?i:wp.DEFAULT_PORT}]}],this.dnsHostname=null,this.port=null):(this.ipResult=null,this.dnsHostname=a.host,this.port=(s=a.port)!==null&&s!==void 0?s:wp.DEFAULT_PORT),this.percentage=Math.random()*100,n["grpc.service_config_disable_resolution"]===1&&(this.isServiceConfigEnabled=!1),this.defaultResolutionError={code:U8.Status.UNAVAILABLE,details:`Name resolution failed for target ${(0,Ju.uriToString)(this.target)}`,metadata:new uPt.Metadata};let c={initialDelay:n["grpc.initial_reconnect_backoff_ms"],maxDelay:n["grpc.max_reconnect_backoff_ms"]};this.backoff=new pPt.BackoffTimeout(()=>{this.continueResolving&&this.startResolutionWithBackoff()},c),this.backoff.unref(),this.minTimeBetweenResolutionsMs=(o=n["grpc.dns_min_time_between_resolutions_ms"])!==null&&o!==void 0?o:mPt,this.nextResolutionTimer=setTimeout(()=>{},0),clearTimeout(this.nextResolutionTimer)}startResolution(){if(this.ipResult!==null){this.returnedIpResult||(Oa("Returning IP address for target "+(0,Ju.uriToString)(this.target)),setImmediate(()=>{this.listener((0,Z_.statusOrFromValue)(this.ipResult),{},null,"")}),this.returnedIpResult=!0),this.backoff.stop(),this.backoff.reset(),this.stopNextResolutionTimer();return}if(this.dnsHostname===null)Oa("Failed to parse DNS address "+(0,Ju.uriToString)(this.target)),setImmediate(()=>{this.listener((0,Z_.statusOrFromError)({code:U8.Status.UNAVAILABLE,details:`Failed to parse DNS address ${(0,Ju.uriToString)(this.target)}`}),{},null,"")}),this.stopNextResolutionTimer();else{if(this.pendingLookupPromise!==null)return;Oa("Looking up DNS hostname "+this.dnsHostname),this.latestLookupResult=null;let e=this.dnsHostname;this.pendingLookupPromise=this.lookup(e),this.pendingLookupPromise.then(r=>{if(this.pendingLookupPromise===null)return;this.pendingLookupPromise=null,this.latestLookupResult=(0,Z_.statusOrFromValue)(r.map(s=>({addresses:[s]})));let n="["+r.map(s=>s.host+":"+s.port).join(",")+"]";Oa("Resolved addresses for target "+(0,Ju.uriToString)(this.target)+": "+n);let i=this.listener(this.latestLookupResult,{},this.latestServiceConfigResult,"");this.handleHealthStatus(i)},r=>{this.pendingLookupPromise!==null&&(Oa("Resolution error for target "+(0,Ju.uriToString)(this.target)+": "+r.message),this.pendingLookupPromise=null,this.stopNextResolutionTimer(),this.listener((0,Z_.statusOrFromError)(this.defaultResolutionError),{},this.latestServiceConfigResult,""))}),this.isServiceConfigEnabled&&this.pendingTxtPromise===null&&(this.pendingTxtPromise=this.resolveTxt(e),this.pendingTxtPromise.then(r=>{if(this.pendingTxtPromise===null)return;this.pendingTxtPromise=null;let n;try{n=(0,lPt.extractAndSelectServiceConfig)(r,this.percentage),n?this.latestServiceConfigResult=(0,Z_.statusOrFromValue)(n):this.latestServiceConfigResult=null}catch(i){this.latestServiceConfigResult=(0,Z_.statusOrFromError)({code:U8.Status.UNAVAILABLE,details:`Parsing service config failed with error ${i.message}`})}this.latestLookupResult!==null&&this.listener(this.latestLookupResult,{},this.latestServiceConfigResult,"")},r=>{}))}}handleHealthStatus(e){e?(this.backoff.stop(),this.backoff.reset()):this.continueResolving=!0}async lookup(e){if(xke.GRPC_NODE_USE_ALTERNATIVE_RESOLVER){Oa("Using alternative DNS resolver.");let n=await Promise.allSettled([this.alternativeResolver.resolve4(e),this.alternativeResolver.resolve6(e)]);if(n.every(i=>i.status==="rejected"))throw new Error(n[0].reason);return n.reduce((i,s)=>s.status==="fulfilled"?[...i,...s.value]:i,[]).map(i=>({host:i,port:+this.port}))}return(await M8.promises.lookup(e,{all:!0})).map(n=>({host:n.address,port:+this.port}))}async resolveTxt(e){return xke.GRPC_NODE_USE_ALTERNATIVE_RESOLVER?(Oa("Using alternative DNS resolver."),this.alternativeResolver.resolveTxt(e)):M8.promises.resolveTxt(e)}startNextResolutionTimer(){var e,r;clearTimeout(this.nextResolutionTimer),this.nextResolutionTimer=setTimeout(()=>{this.stopNextResolutionTimer(),this.continueResolving&&this.startResolutionWithBackoff()},this.minTimeBetweenResolutionsMs),(r=(e=this.nextResolutionTimer).unref)===null||r===void 0||r.call(e),this.isNextResolutionTimerRunning=!0}stopNextResolutionTimer(){clearTimeout(this.nextResolutionTimer),this.isNextResolutionTimerRunning=!1}startResolutionWithBackoff(){this.pendingLookupPromise===null&&(this.continueResolving=!1,this.backoff.runOnce(),this.startNextResolutionTimer(),this.startResolution())}updateResolution(){this.pendingLookupPromise===null&&(this.isNextResolutionTimerRunning||this.backoff.isRunning()?(this.isNextResolutionTimerRunning?Oa('resolution update delayed by "min time between resolutions" rate limit'):Oa("resolution update delayed by backoff timer until "+this.backoff.getEndTime().toISOString()),this.continueResolving=!0):this.startResolutionWithBackoff())}destroy(){this.continueResolving=!1,this.backoff.reset(),this.backoff.stop(),this.stopNextResolutionTimer(),this.pendingLookupPromise=null,this.pendingTxtPromise=null,this.latestLookupResult=null,this.latestServiceConfigResult=null,this.returnedIpResult=!1}static getDefaultAuthority(e){return e.path}};function gPt(){(0,Ake.registerResolver)("dns",F8),(0,Ake.registerDefaultScheme)("dns")}});var q8=E(Tw=>{"use strict";Object.defineProperty(Tw,"__esModule",{value:!0});Tw.parseCIDR=Pke;Tw.mapProxyName=RPt;Tw.getProxiedConnection=xPt;var vw=qt(),X_=st(),Oke=W("net"),_Pt=W("http"),yPt=qt(),Ike=Ti(),bw=ei(),SPt=W("url"),EPt=j8(),vPt="proxy";function Q_(t){yPt.trace(X_.LogVerbosity.DEBUG,vPt,t)}function bPt(){let t="",e="";if(process.env.grpc_proxy)e="grpc_proxy",t=process.env.grpc_proxy;else if(process.env.https_proxy)e="https_proxy",t=process.env.https_proxy;else if(process.env.http_proxy)e="http_proxy",t=process.env.http_proxy;else return{};let r;try{r=new SPt.URL(t)}catch{return(0,vw.log)(X_.LogVerbosity.ERROR,`cannot parse value of "${e}" env var`),{}}if(r.protocol!=="http:")return(0,vw.log)(X_.LogVerbosity.ERROR,`"${r.protocol}" scheme not supported in proxy URI`),{};let n=null;r.username&&(r.password?((0,vw.log)(X_.LogVerbosity.INFO,"userinfo found in proxy URI"),n=decodeURIComponent(`${r.username}:${r.password}`)):n=r.username);let i=r.hostname,s=r.port;s===""&&(s="80");let o={address:`${i}:${s}`};return n&&(o.creds=n),Q_("Proxy server "+o.address+" set by environment variable "+e),o}function TPt(){let t=process.env.no_grpc_proxy,e="no_grpc_proxy";return t||(t=process.env.no_proxy,e="no_proxy"),t?(Q_("No proxy server list set by environment variable "+e),t.split(",")):[]}function Pke(t){let e=t.split("/");if(e.length!==2)return null;let r=parseInt(e[1],10);return!(0,Oke.isIPv4)(e[0])||Number.isNaN(r)||r<0||r>32?null:{ip:Cke(e[0]),prefixLength:r}}function Cke(t){return t.split(".").reduce((e,r)=>(e<<8)+parseInt(r,10),0)}function wPt(t,e){let r=t.ip,n=-1<<32-t.prefixLength;return(Cke(e)&n)===(r&n)}function APt(t){for(let e of TPt()){let r=Pke(e);if((0,Oke.isIPv4)(t)&&r&&wPt(r,t))return!0;if(t.endsWith(e))return!0}return!1}function RPt(t,e){var r;let n={target:t,extraOptions:{}};if(((r=e["grpc.enable_http_proxy"])!==null&&r!==void 0?r:1)===0||t.scheme==="unix")return n;let i=bPt();if(!i.address)return n;let s=(0,bw.splitHostPort)(t.path);if(!s)return n;let o=s.host;if(APt(o))return Q_("Not using proxy for target in no_proxy list: "+(0,bw.uriToString)(t)),n;let a={"grpc.http_connect_target":(0,bw.uriToString)(t)};return i.creds&&(a["grpc.http_connect_creds"]=i.creds),{target:{scheme:"dns",path:i.address},extraOptions:a}}function xPt(t,e){var r;if(!("grpc.http_connect_target"in e))return Promise.resolve(null);let n=e["grpc.http_connect_target"],i=(0,bw.parseUri)(n);if(i===null)return Promise.resolve(null);let s=(0,bw.splitHostPort)(i.path);if(s===null)return Promise.resolve(null);let o=`${s.host}:${(r=s.port)!==null&&r!==void 0?r:EPt.DEFAULT_PORT}`,a={method:"CONNECT",path:o},c={Host:o};(0,Ike.isTcpSubchannelAddress)(t)?(a.host=t.host,a.port=t.port):a.socketPath=t.path,"grpc.http_connect_creds"in e&&(c["Proxy-Authorization"]="Basic "+Buffer.from(e["grpc.http_connect_creds"]).toString("base64")),a.headers=c;let l=(0,Ike.subchannelAddressToString)(t);return Q_("Using proxy "+l+" to connect to "+a.path),new Promise((u,d)=>{let f=_Pt.request(a);f.once("connect",(p,h,m)=>{f.removeAllListeners(),h.removeAllListeners(),p.statusCode===200?(Q_("Successfully connected to "+a.path+" through proxy "+l),m.length>0&&h.unshift(m),Q_("Successfully established a plaintext connection to "+a.path+" through proxy "+l),u(h)):((0,vw.log)(X_.LogVerbosity.ERROR,"Failed to connect to "+a.path+" through proxy "+l+" with status "+p.statusCode),d())}),f.once("error",p=>{f.removeAllListeners(),(0,vw.log)(X_.LogVerbosity.ERROR,"Failed to connect to proxy "+l+" with error "+p.message),d()}),f.end()})}});var z8=E(aL=>{"use strict";Object.defineProperty(aL,"__esModule",{value:!0});aL.StreamDecoder=void 0;var Pa;(function(t){t[t.NO_DATA=0]="NO_DATA",t[t.READING_SIZE=1]="READING_SIZE",t[t.READING_MESSAGE=2]="READING_MESSAGE"})(Pa||(Pa={}));var B8=class{constructor(e){this.maxReadMessageLength=e,this.readState=Pa.NO_DATA,this.readCompressFlag=Buffer.alloc(1),this.readPartialSize=Buffer.alloc(4),this.readSizeRemaining=4,this.readMessageSize=0,this.readPartialMessage=[],this.readMessageRemaining=0}write(e){let r=0,n,i=[];for(;r<e.length;)switch(this.readState){case Pa.NO_DATA:this.readCompressFlag=e.slice(r,r+1),r+=1,this.readState=Pa.READING_SIZE,this.readPartialSize.fill(0),this.readSizeRemaining=4,this.readMessageSize=0,this.readMessageRemaining=0,this.readPartialMessage=[];break;case Pa.READING_SIZE:if(n=Math.min(e.length-r,this.readSizeRemaining),e.copy(this.readPartialSize,4-this.readSizeRemaining,r,r+n),this.readSizeRemaining-=n,r+=n,this.readSizeRemaining===0){if(this.readMessageSize=this.readPartialSize.readUInt32BE(0),this.maxReadMessageLength!==-1&&this.readMessageSize>this.maxReadMessageLength)throw new Error(`Received message larger than max (${this.readMessageSize} vs ${this.maxReadMessageLength})`);if(this.readMessageRemaining=this.readMessageSize,this.readMessageRemaining>0)this.readState=Pa.READING_MESSAGE;else{let s=Buffer.concat([this.readCompressFlag,this.readPartialSize],5);this.readState=Pa.NO_DATA,i.push(s)}}break;case Pa.READING_MESSAGE:if(n=Math.min(e.length-r,this.readMessageRemaining),this.readPartialMessage.push(e.slice(r,r+n)),this.readMessageRemaining-=n,r+=n,this.readMessageRemaining===0){let s=[this.readCompressFlag,this.readPartialSize].concat(this.readPartialMessage),o=Buffer.concat(s,this.readMessageSize+5);this.readState=Pa.NO_DATA,i.push(o)}break;default:throw new Error("Unexpected read state")}return i}};aL.StreamDecoder=B8});var Nke=E(cL=>{"use strict";Object.defineProperty(cL,"__esModule",{value:!0});cL.Http2SubchannelCall=void 0;var Jc=W("http2"),IPt=W("os"),Dt=st(),Zc=Vr(),OPt=z8(),PPt=qt(),CPt=st(),NPt="subchannel_call";function kPt(t){for(let[e,r]of Object.entries(IPt.constants.errno))if(r===t)return e;return"Unknown system error "+t}function V8(t){let e=`Received HTTP status code ${t}`,r;switch(t){case 400:r=Dt.Status.INTERNAL;break;case 401:r=Dt.Status.UNAUTHENTICATED;break;case 403:r=Dt.Status.PERMISSION_DENIED;break;case 404:r=Dt.Status.UNIMPLEMENTED;break;case 429:case 502:case 503:case 504:r=Dt.Status.UNAVAILABLE;break;default:r=Dt.Status.UNKNOWN}return{code:r,details:e,metadata:new Zc.Metadata}}var H8=class{constructor(e,r,n,i,s){var o;this.http2Stream=e,this.callEventTracker=r,this.listener=n,this.transport=i,this.callId=s,this.isReadFilterPending=!1,this.isPushPending=!1,this.canPush=!1,this.readsClosed=!1,this.statusOutput=!1,this.unpushedReadMessages=[],this.finalStatus=null,this.internalError=null,this.serverEndedCall=!1,this.connectionDropped=!1;let a=(o=i.getOptions()["grpc.max_receive_message_length"])!==null&&o!==void 0?o:Dt.DEFAULT_MAX_RECEIVE_MESSAGE_LENGTH;this.decoder=new OPt.StreamDecoder(a),e.on("response",(c,l)=>{let u="";for(let d of Object.keys(c))u+=" "+d+": "+c[d]+`
386
+ `&&++i,++r===n)throw l("comment");T=I,I=d(r)}while(T!=="*"||I!=="/");++r,R&&(f(x,r-2,O),O=!0),g=!0}else return"/"}}while(g);var A=r;n8.lastIndex=0;var b=n8.test(d(A++));if(!b)for(;A<n&&!n8.test(d(A));)++A;var L=t.substring(r,r=A);return(L==='"'||L==="'")&&(c=L),L}function _(g){a.push(g)}function y(){if(!a.length){var g=m();if(g===null)return null;_(g)}return a[0]}function v(g,T){var I=y(),x=I===g;if(x)return m(),!0;if(!T)throw l("token '"+I+"', '"+g+"' expected");return!1}function S(g){var T=null,I;return g===void 0?(I=o[i-1],delete o[i-1],I&&(e||I.type==="*"||I.lineEmpty)&&(T=I.leading?I.text:null)):(s<g&&y(),I=o[g],delete o[g],I&&!I.lineEmpty&&(e||I.type==="/")&&(T=I.leading?null:I.text)),T}return Object.defineProperty({next:m,peek:y,push:_,skip:v,cmnt:S},"line",{get:function(){return i}})}});var UNe=E((c0r,MNe)=>{"use strict";MNe.exports=Wc;Wc.filename=null;Wc.defaults={keepCase:!1};var wIt=i8(),kNe=$$(),$Ne=P$(),LNe=zu(),AIt=w$(),DNe=yp(),RIt=_o(),xIt=R$(),IIt=A$(),OIt=Vu(),PIt=Sp(),Gc=Gr(),CIt=/^[1-9][0-9]*$/,NIt=/^-?[1-9][0-9]*$/,kIt=/^0[x][0-9a-fA-F]+$/,$It=/^-?0[x][0-9a-fA-F]+$/,LIt=/^0[0-7]+$/,DIt=/^-?0[0-7]+$/,MIt=Gc.patterns.numberRe,Ta=/^[a-zA-Z_][a-zA-Z_0-9]*$/,wa=Gc.patterns.typeRefRe;function Wc(t,e,r){e instanceof kNe||(r=e,e=new kNe),r||(r=Wc.defaults);var n=r.preferTrailingComment||!1,i=wIt(t,r.alternateCommentMode||!1),s=i.next,o=i.push,a=i.peek,c=i.skip,l=i.cmnt,u=!0,d,f,p,h="proto2",m=e,_=[],y={},v=r.keepCase?function(D){return D}:Gc.camelCase;function S(){_.forEach(D=>{D._edition=h,Object.keys(y).forEach(B=>{D.getOption(B)===void 0&&D.setOption(B,y[B],!0)})})}function g(D,B,J){var H=Wc.filename;return J||(Wc.filename=null),Error("illegal "+(B||"token")+" '"+D+"' ("+(H?H+", ":"")+"line "+i.line+")")}function T(){var D=[],B;do{if((B=s())!=='"'&&B!=="'")throw g(B);D.push(s()),c(B),B=a()}while(B==='"'||B==="'");return D.join("")}function I(D){var B=s();switch(B){case"'":case'"':return o(B),T();case"true":case"TRUE":return!0;case"false":case"FALSE":return!1}try{return R(B,!0)}catch{if(D&&wa.test(B))return B;throw g(B,"value")}}function x(D,B){var J,H;do if(B&&((J=a())==='"'||J==="'")){var z=T();if(D.push(z),h>=2023)throw g(z,"id")}else try{D.push([H=O(s()),c("to",!0)?O(s()):H])}catch(re){if(B&&wa.test(J)&&h>=2023)D.push(J);else throw re}while(c(",",!0));var K={options:void 0};K.setOption=function(re,Oe){this.options===void 0&&(this.options={}),this.options[re]=Oe},P(K,function(Oe){if(Oe==="option")oe(K,Oe),c(";");else throw g(Oe)},function(){U(K)})}function R(D,B){var J=1;switch(D.charAt(0)==="-"&&(J=-1,D=D.substring(1)),D){case"inf":case"INF":case"Inf":return J*(1/0);case"nan":case"NAN":case"Nan":case"NaN":return NaN;case"0":return 0}if(CIt.test(D))return J*parseInt(D,10);if(kIt.test(D))return J*parseInt(D,16);if(LIt.test(D))return J*parseInt(D,8);if(MIt.test(D))return J*parseFloat(D);throw g(D,"number",B)}function O(D,B){switch(D){case"max":case"MAX":case"Max":return 536870911;case"0":return 0}if(!B&&D.charAt(0)==="-")throw g(D,"id");if(NIt.test(D))return parseInt(D,10);if($It.test(D))return parseInt(D,16);if(DIt.test(D))return parseInt(D,8);throw g(D,"id")}function A(){if(d!==void 0)throw g("package");if(d=s(),!wa.test(d))throw g(d,"name");m=m.define(d),c(";")}function b(){var D=a(),B;switch(D){case"weak":B=p||(p=[]),s();break;case"public":s();default:B=f||(f=[]);break}D=T(),c(";"),B.push(D)}function L(){if(c("="),h=T(),h<2023)throw g(h,"syntax");c(";")}function C(){if(c("="),h=T(),!["2023"].includes(h))throw g(h,"edition");c(";")}function w(D,B,J){switch(J===void 0&&(J=0),B){case"option":return oe(D,B),c(";"),!0;case"message":return N(D,B,J+1),!0;case"enum":return Ie(D,B),!0;case"service":return ne(D,B,J+1),!0;case"extend":return se(D,B,J),!0}return!1}function P(D,B,J){var H=i.line;if(D&&(typeof D.comment!="string"&&(D.comment=l()),D.filename=Wc.filename),c("{",!0)){for(var z;(z=s())!=="}";)B(z);c(";",!0)}else J&&J(),c(";"),D&&(typeof D.comment!="string"||n)&&(D.comment=l(H)||D.comment)}function N(D,B,J){if(J===void 0&&(J=0),J>Gc.nestingLimit)throw Error("max depth exceeded");if(!Ta.test(B=s()))throw g(B,"type name");var H=new $Ne(B);P(H,function(K){if(!w(H,K,J))switch(K){case"map":de(H,K);break;case"required":if(h!=="proto2")throw g(K);case"repeated":F(H,K,void 0,J+1);break;case"optional":if(h==="proto3")F(H,"proto3_optional",void 0,J+1);else{if(h!=="proto2")throw g(K);F(H,"optional",void 0,J+1)}break;case"oneof":Te(H,K,J+1);break;case"extensions":x(H.extensions||(H.extensions=[]));break;case"reserved":x(H.reserved||(H.reserved=[]),!0);break;default:if(h==="proto2"||!wa.test(K))throw g(K);o(K),F(H,"optional",void 0,J+1);break}}),D.add(H),D===m&&_.push(H)}function F(D,B,J,H){var z=s();if(z==="group"){V(D,B,H);return}for(;z.endsWith(".")||a().startsWith(".");)z+=s();if(!wa.test(z))throw g(z,"type");var K=s();if(!Ta.test(K))throw g(K,"name");K=v(K),c("=");var re=new LNe(K,O(s()),z,B,J);if(P(re,function(ze){if(ze==="option")oe(re,ze),c(";");else throw g(ze)},function(){U(re)}),B==="proto3_optional"){var Oe=new DNe("_"+K);re.setOption("proto3_optional",!0),Oe.add(re),D.add(Oe)}else D.add(re);D===m&&_.push(re)}function V(D,B,J){if(J===void 0&&(J=0),J>Gc.nestingLimit)throw Error("max depth exceeded");if(h>=2023)throw g("group");var H=s();if(!Ta.test(H))throw g(H,"name");var z=Gc.lcFirst(H);H===z&&(H=Gc.ucFirst(H)),c("=");var K=O(s()),re=new $Ne(H);re.group=!0;var Oe=new LNe(z,K,H,B);Oe.filename=Wc.filename,P(re,function(ze){switch(ze){case"option":oe(re,ze),c(";");break;case"required":case"repeated":F(re,ze,void 0,J+1);break;case"optional":h==="proto3"?F(re,"proto3_optional",void 0,J+1):F(re,"optional",void 0,J+1);break;case"message":N(re,ze,J+1);break;case"enum":Ie(re,ze);break;case"reserved":x(re.reserved||(re.reserved=[]),!0);break;default:throw g(ze)}}),D.add(re).add(Oe)}function de(D){c("<");var B=s();if(PIt.mapKey[B]===void 0)throw g(B,"type");c(",");var J=s();if(!wa.test(J))throw g(J,"type");c(">");var H=s();if(!Ta.test(H))throw g(H,"name");c("=");var z=new AIt(v(H),O(s()),B,J);P(z,function(re){if(re==="option")oe(z,re),c(";");else throw g(re)},function(){U(z)}),D.add(z)}function Te(D,B,J){if(!Ta.test(B=s()))throw g(B,"name");var H=new DNe(v(B));P(H,function(K){K==="option"?(oe(H,K),c(";")):(o(K),F(H,"optional",void 0,J))}),D.add(H)}function Ie(D,B){if(!Ta.test(B=s()))throw g(B,"name");var J=new RIt(B);P(J,function(z){switch(z){case"option":oe(J,z),c(";");break;case"reserved":x(J.reserved||(J.reserved=[]),!0),J.reserved===void 0&&(J.reserved=[]);break;default:$e(J,z)}}),D.add(J),D===m&&_.push(J)}function $e(D,B){if(!Ta.test(B))throw g(B,"name");c("=");var J=O(s(),!0),H={options:void 0};H.getOption=function(z){return this.options[z]},H.setOption=function(z,K){OIt.prototype.setOption.call(H,z,K)},H.setParsedOption=function(){},P(H,function(K){if(K==="option")oe(H,K),c(";");else throw g(K)},function(){U(H)}),D.add(B,J,H.comment,H.parsedOptions||H.options)}function oe(D,B){var J,H,z=!0;for(B==="option"&&(B=s());B!=="=";){if(B==="("){var K=s();c(")"),B="("+K+")"}if(z){if(z=!1,B.includes(".")&&!B.includes("(")){var re=B.split(".");J=re[0]+".",B=re[1];continue}J=B}else H=H?H+=B:B;B=s()}var Oe=H?J.concat(H):J,ut=Ee(D,Oe);H=H&&H[0]==="."?H.slice(1):H,J=J&&J[J.length-1]==="."?J.slice(0,-1):J,k(D,J,ut,H)}function Ee(D,B,J){if(J===void 0&&(J=0),J>Gc.recursionLimit)throw Error("max depth exceeded");if(c("{",!0)){for(var H={};!c("}",!0);){if(!Ta.test(M=s()))throw g(M,"name");if(M===null)throw g(M,"end of input");var z,K=M;if(c(":",!0),a()==="{")z=Ee(D,B+"."+M,J+1);else if(a()==="["){z=[];var re;if(c("[",!0)){do re=I(!0),z.push(re);while(c(",",!0));c("]"),typeof re<"u"&&he(D,B+"."+M,re)}}else z=I(!0),he(D,B+"."+M,z);var Oe=H[K];Oe&&(z=[].concat(Oe).concat(z)),K!=="__proto__"&&(H[K]=z),c(",",!0),c(";",!0)}return H}var ut=I(!0);return he(D,B,ut),ut}function he(D,B,J){if(m===D&&/^features\./.test(B)){y[B]=J;return}D.setOption&&D.setOption(B,J)}function k(D,B,J,H){D.setParsedOption&&D.setParsedOption(B,J,H)}function U(D){if(c("[",!0)){do oe(D,"option");while(c(",",!0));c("]")}return D}function ne(D,B,J){if(J===void 0&&(J=0),J>Gc.recursionLimit)throw Error("max depth exceeded");if(!Ta.test(B=s()))throw g(B,"service name");var H=new xIt(B);P(H,function(K){if(!w(H,K,J))if(K==="rpc")j(H,K);else throw g(K)}),D.add(H),D===m&&_.push(H)}function j(D,B){var J=l(),H=B;if(!Ta.test(B=s()))throw g(B,"name");var z=B,K,re,Oe,ut;if(c("("),c("stream",!0)&&(re=!0),!wa.test(B=s())||(K=B,c(")"),c("returns"),c("("),c("stream",!0)&&(ut=!0),!wa.test(B=s())))throw g(B);Oe=B,c(")");var ze=new IIt(z,H,K,Oe,re,ut);ze.comment=J,P(ze,function(qs){if(qs==="option")oe(ze,qs),c(";");else throw g(qs)}),D.add(ze)}function se(D,B,J){if(!wa.test(B=s()))throw g(B,"reference");var H=B;P(null,function(K){switch(K){case"required":case"repeated":F(D,K,H,J+1);break;case"optional":h==="proto3"?F(D,"proto3_optional",H,J+1):F(D,"optional",H,J+1);break;default:if(h==="proto2"||!wa.test(K))throw g(K);o(K),F(D,"optional",H,J+1);break}})}for(var M;(M=s())!==null;)switch(M){case"package":if(!u)throw g(M);A();break;case"import":if(!u)throw g(M);b();break;case"syntax":if(!u)throw g(M);L();break;case"edition":if(!u)throw g(M);C();break;case"option":oe(m,M),c(";",!0);break;default:if(w(m,M,0)){u=!1;continue}throw g(M)}return S(),Wc.filename=null,{package:d,imports:f,weakImports:p,root:e}}});var qNe=E((l0r,jNe)=>{"use strict";jNe.exports=Eo;var UIt=/\/|\./;function Eo(t,e){UIt.test(t)||(t="google/protobuf/"+t+".proto",e={nested:{google:{nested:{protobuf:{nested:e}}}}}),Eo[t]=e}Eo("any",{Any:{fields:{type_url:{type:"string",id:1},value:{type:"bytes",id:2}}}});var FNe;Eo("duration",{Duration:FNe={fields:{seconds:{type:"int64",id:1},nanos:{type:"int32",id:2}}}});Eo("timestamp",{Timestamp:FNe});Eo("empty",{Empty:{fields:{}}});Eo("struct",{Struct:{fields:{fields:{keyType:"string",type:"Value",id:1}}},Value:{oneofs:{kind:{oneof:["nullValue","numberValue","stringValue","boolValue","structValue","listValue"]}},fields:{nullValue:{type:"NullValue",id:1},numberValue:{type:"double",id:2},stringValue:{type:"string",id:3},boolValue:{type:"bool",id:4},structValue:{type:"Struct",id:5},listValue:{type:"ListValue",id:6}}},NullValue:{values:{NULL_VALUE:0}},ListValue:{fields:{values:{rule:"repeated",type:"Value",id:1}}}});Eo("wrappers",{DoubleValue:{fields:{value:{type:"double",id:1}}},FloatValue:{fields:{value:{type:"float",id:1}}},Int64Value:{fields:{value:{type:"int64",id:1}}},UInt64Value:{fields:{value:{type:"uint64",id:1}}},Int32Value:{fields:{value:{type:"int32",id:1}}},UInt32Value:{fields:{value:{type:"uint32",id:1}}},BoolValue:{fields:{value:{type:"bool",id:1}}},StringValue:{fields:{value:{type:"string",id:1}}},BytesValue:{fields:{value:{type:"bytes",id:1}}}});Eo("field_mask",{FieldMask:{fields:{paths:{rule:"repeated",type:"string",id:1}}}});Eo.get=function(e){return Eo[e]||null}});var zNe=E((u0r,BNe)=>{"use strict";var Hu=BNe.exports=ONe();Hu.build="full";Hu.tokenize=i8();Hu.parse=UNe();Hu.common=qNe();Hu.Root._configure(Hu.Type,Hu.parse,Hu.common)});var U$=E((d0r,VNe)=>{"use strict";VNe.exports=zNe()});var s8=E((f0r,FIt)=>{FIt.exports={nested:{google:{nested:{protobuf:{options:{go_package:"google.golang.org/protobuf/types/descriptorpb",java_package:"com.google.protobuf",java_outer_classname:"DescriptorProtos",csharp_namespace:"Google.Protobuf.Reflection",objc_class_prefix:"GPB",cc_enable_arenas:!0,optimize_for:"SPEED"},nested:{FileDescriptorSet:{edition:"proto2",fields:{file:{rule:"repeated",type:"FileDescriptorProto",id:1}},extensions:[[536e6,536e6]]},Edition:{edition:"proto2",values:{EDITION_UNKNOWN:0,EDITION_LEGACY:900,EDITION_PROTO2:998,EDITION_PROTO3:999,EDITION_2023:1e3,EDITION_2024:1001,EDITION_1_TEST_ONLY:1,EDITION_2_TEST_ONLY:2,EDITION_99997_TEST_ONLY:99997,EDITION_99998_TEST_ONLY:99998,EDITION_99999_TEST_ONLY:99999,EDITION_MAX:2147483647}},FileDescriptorProto:{edition:"proto2",fields:{name:{type:"string",id:1},package:{type:"string",id:2},dependency:{rule:"repeated",type:"string",id:3},publicDependency:{rule:"repeated",type:"int32",id:10},weakDependency:{rule:"repeated",type:"int32",id:11},optionDependency:{rule:"repeated",type:"string",id:15},messageType:{rule:"repeated",type:"DescriptorProto",id:4},enumType:{rule:"repeated",type:"EnumDescriptorProto",id:5},service:{rule:"repeated",type:"ServiceDescriptorProto",id:6},extension:{rule:"repeated",type:"FieldDescriptorProto",id:7},options:{type:"FileOptions",id:8},sourceCodeInfo:{type:"SourceCodeInfo",id:9},syntax:{type:"string",id:12},edition:{type:"Edition",id:14}}},DescriptorProto:{edition:"proto2",fields:{name:{type:"string",id:1},field:{rule:"repeated",type:"FieldDescriptorProto",id:2},extension:{rule:"repeated",type:"FieldDescriptorProto",id:6},nestedType:{rule:"repeated",type:"DescriptorProto",id:3},enumType:{rule:"repeated",type:"EnumDescriptorProto",id:4},extensionRange:{rule:"repeated",type:"ExtensionRange",id:5},oneofDecl:{rule:"repeated",type:"OneofDescriptorProto",id:8},options:{type:"MessageOptions",id:7},reservedRange:{rule:"repeated",type:"ReservedRange",id:9},reservedName:{rule:"repeated",type:"string",id:10},visibility:{type:"SymbolVisibility",id:11}},nested:{ExtensionRange:{fields:{start:{type:"int32",id:1},end:{type:"int32",id:2},options:{type:"ExtensionRangeOptions",id:3}}},ReservedRange:{fields:{start:{type:"int32",id:1},end:{type:"int32",id:2}}}}},ExtensionRangeOptions:{edition:"proto2",fields:{uninterpretedOption:{rule:"repeated",type:"UninterpretedOption",id:999},declaration:{rule:"repeated",type:"Declaration",id:2,options:{retention:"RETENTION_SOURCE"}},features:{type:"FeatureSet",id:50},verification:{type:"VerificationState",id:3,options:{default:"UNVERIFIED",retention:"RETENTION_SOURCE"}}},extensions:[[1e3,536870911]],nested:{Declaration:{fields:{number:{type:"int32",id:1},fullName:{type:"string",id:2},type:{type:"string",id:3},reserved:{type:"bool",id:5},repeated:{type:"bool",id:6}},reserved:[[4,4]]},VerificationState:{values:{DECLARATION:0,UNVERIFIED:1}}}},FieldDescriptorProto:{edition:"proto2",fields:{name:{type:"string",id:1},number:{type:"int32",id:3},label:{type:"Label",id:4},type:{type:"Type",id:5},typeName:{type:"string",id:6},extendee:{type:"string",id:2},defaultValue:{type:"string",id:7},oneofIndex:{type:"int32",id:9},jsonName:{type:"string",id:10},options:{type:"FieldOptions",id:8},proto3Optional:{type:"bool",id:17}},nested:{Type:{values:{TYPE_DOUBLE:1,TYPE_FLOAT:2,TYPE_INT64:3,TYPE_UINT64:4,TYPE_INT32:5,TYPE_FIXED64:6,TYPE_FIXED32:7,TYPE_BOOL:8,TYPE_STRING:9,TYPE_GROUP:10,TYPE_MESSAGE:11,TYPE_BYTES:12,TYPE_UINT32:13,TYPE_ENUM:14,TYPE_SFIXED32:15,TYPE_SFIXED64:16,TYPE_SINT32:17,TYPE_SINT64:18}},Label:{values:{LABEL_OPTIONAL:1,LABEL_REPEATED:3,LABEL_REQUIRED:2}}}},OneofDescriptorProto:{edition:"proto2",fields:{name:{type:"string",id:1},options:{type:"OneofOptions",id:2}}},EnumDescriptorProto:{edition:"proto2",fields:{name:{type:"string",id:1},value:{rule:"repeated",type:"EnumValueDescriptorProto",id:2},options:{type:"EnumOptions",id:3},reservedRange:{rule:"repeated",type:"EnumReservedRange",id:4},reservedName:{rule:"repeated",type:"string",id:5},visibility:{type:"SymbolVisibility",id:6}},nested:{EnumReservedRange:{fields:{start:{type:"int32",id:1},end:{type:"int32",id:2}}}}},EnumValueDescriptorProto:{edition:"proto2",fields:{name:{type:"string",id:1},number:{type:"int32",id:2},options:{type:"EnumValueOptions",id:3}}},ServiceDescriptorProto:{edition:"proto2",fields:{name:{type:"string",id:1},method:{rule:"repeated",type:"MethodDescriptorProto",id:2},options:{type:"ServiceOptions",id:3}}},MethodDescriptorProto:{edition:"proto2",fields:{name:{type:"string",id:1},inputType:{type:"string",id:2},outputType:{type:"string",id:3},options:{type:"MethodOptions",id:4},clientStreaming:{type:"bool",id:5},serverStreaming:{type:"bool",id:6}}},FileOptions:{edition:"proto2",fields:{javaPackage:{type:"string",id:1},javaOuterClassname:{type:"string",id:8},javaMultipleFiles:{type:"bool",id:10},javaGenerateEqualsAndHash:{type:"bool",id:20,options:{deprecated:!0}},javaStringCheckUtf8:{type:"bool",id:27},optimizeFor:{type:"OptimizeMode",id:9,options:{default:"SPEED"}},goPackage:{type:"string",id:11},ccGenericServices:{type:"bool",id:16},javaGenericServices:{type:"bool",id:17},pyGenericServices:{type:"bool",id:18},deprecated:{type:"bool",id:23},ccEnableArenas:{type:"bool",id:31,options:{default:!0}},objcClassPrefix:{type:"string",id:36},csharpNamespace:{type:"string",id:37},swiftPrefix:{type:"string",id:39},phpClassPrefix:{type:"string",id:40},phpNamespace:{type:"string",id:41},phpMetadataNamespace:{type:"string",id:44},rubyPackage:{type:"string",id:45},features:{type:"FeatureSet",id:50},uninterpretedOption:{rule:"repeated",type:"UninterpretedOption",id:999}},extensions:[[1e3,536870911]],reserved:[[42,42],[38,38],"php_generic_services"],nested:{OptimizeMode:{values:{SPEED:1,CODE_SIZE:2,LITE_RUNTIME:3}}}},MessageOptions:{edition:"proto2",fields:{messageSetWireFormat:{type:"bool",id:1},noStandardDescriptorAccessor:{type:"bool",id:2},deprecated:{type:"bool",id:3},mapEntry:{type:"bool",id:7},deprecatedLegacyJsonFieldConflicts:{type:"bool",id:11,options:{deprecated:!0}},features:{type:"FeatureSet",id:12},uninterpretedOption:{rule:"repeated",type:"UninterpretedOption",id:999}},extensions:[[1e3,536870911]],reserved:[[4,4],[5,5],[6,6],[8,8],[9,9]]},FieldOptions:{edition:"proto2",fields:{ctype:{type:"CType",id:1,options:{default:"STRING"}},packed:{type:"bool",id:2},jstype:{type:"JSType",id:6,options:{default:"JS_NORMAL"}},lazy:{type:"bool",id:5},unverifiedLazy:{type:"bool",id:15},deprecated:{type:"bool",id:3},weak:{type:"bool",id:10,options:{deprecated:!0}},debugRedact:{type:"bool",id:16},retention:{type:"OptionRetention",id:17},targets:{rule:"repeated",type:"OptionTargetType",id:19},editionDefaults:{rule:"repeated",type:"EditionDefault",id:20},features:{type:"FeatureSet",id:21},featureSupport:{type:"FeatureSupport",id:22},uninterpretedOption:{rule:"repeated",type:"UninterpretedOption",id:999}},extensions:[[1e3,536870911]],reserved:[[4,4],[18,18]],nested:{CType:{values:{STRING:0,CORD:1,STRING_PIECE:2}},JSType:{values:{JS_NORMAL:0,JS_STRING:1,JS_NUMBER:2}},OptionRetention:{values:{RETENTION_UNKNOWN:0,RETENTION_RUNTIME:1,RETENTION_SOURCE:2}},OptionTargetType:{values:{TARGET_TYPE_UNKNOWN:0,TARGET_TYPE_FILE:1,TARGET_TYPE_EXTENSION_RANGE:2,TARGET_TYPE_MESSAGE:3,TARGET_TYPE_FIELD:4,TARGET_TYPE_ONEOF:5,TARGET_TYPE_ENUM:6,TARGET_TYPE_ENUM_ENTRY:7,TARGET_TYPE_SERVICE:8,TARGET_TYPE_METHOD:9}},EditionDefault:{fields:{edition:{type:"Edition",id:3},value:{type:"string",id:2}}},FeatureSupport:{fields:{editionIntroduced:{type:"Edition",id:1},editionDeprecated:{type:"Edition",id:2},deprecationWarning:{type:"string",id:3},editionRemoved:{type:"Edition",id:4}}}}},OneofOptions:{edition:"proto2",fields:{features:{type:"FeatureSet",id:1},uninterpretedOption:{rule:"repeated",type:"UninterpretedOption",id:999}},extensions:[[1e3,536870911]]},EnumOptions:{edition:"proto2",fields:{allowAlias:{type:"bool",id:2},deprecated:{type:"bool",id:3},deprecatedLegacyJsonFieldConflicts:{type:"bool",id:6,options:{deprecated:!0}},features:{type:"FeatureSet",id:7},uninterpretedOption:{rule:"repeated",type:"UninterpretedOption",id:999}},extensions:[[1e3,536870911]],reserved:[[5,5]]},EnumValueOptions:{edition:"proto2",fields:{deprecated:{type:"bool",id:1},features:{type:"FeatureSet",id:2},debugRedact:{type:"bool",id:3},featureSupport:{type:"FieldOptions.FeatureSupport",id:4},uninterpretedOption:{rule:"repeated",type:"UninterpretedOption",id:999}},extensions:[[1e3,536870911]]},ServiceOptions:{edition:"proto2",fields:{features:{type:"FeatureSet",id:34},deprecated:{type:"bool",id:33},uninterpretedOption:{rule:"repeated",type:"UninterpretedOption",id:999}},extensions:[[1e3,536870911]]},MethodOptions:{edition:"proto2",fields:{deprecated:{type:"bool",id:33},idempotencyLevel:{type:"IdempotencyLevel",id:34,options:{default:"IDEMPOTENCY_UNKNOWN"}},features:{type:"FeatureSet",id:35},uninterpretedOption:{rule:"repeated",type:"UninterpretedOption",id:999}},extensions:[[1e3,536870911]],nested:{IdempotencyLevel:{values:{IDEMPOTENCY_UNKNOWN:0,NO_SIDE_EFFECTS:1,IDEMPOTENT:2}}}},UninterpretedOption:{edition:"proto2",fields:{name:{rule:"repeated",type:"NamePart",id:2},identifierValue:{type:"string",id:3},positiveIntValue:{type:"uint64",id:4},negativeIntValue:{type:"int64",id:5},doubleValue:{type:"double",id:6},stringValue:{type:"bytes",id:7},aggregateValue:{type:"string",id:8}},nested:{NamePart:{fields:{namePart:{rule:"required",type:"string",id:1},isExtension:{rule:"required",type:"bool",id:2}}}}},FeatureSet:{edition:"proto2",fields:{fieldPresence:{type:"FieldPresence",id:1,options:{retention:"RETENTION_RUNTIME",targets:"TARGET_TYPE_FILE","feature_support.edition_introduced":"EDITION_2023","edition_defaults.edition":"EDITION_2023","edition_defaults.value":"EXPLICIT"}},enumType:{type:"EnumType",id:2,options:{retention:"RETENTION_RUNTIME",targets:"TARGET_TYPE_FILE","feature_support.edition_introduced":"EDITION_2023","edition_defaults.edition":"EDITION_PROTO3","edition_defaults.value":"OPEN"}},repeatedFieldEncoding:{type:"RepeatedFieldEncoding",id:3,options:{retention:"RETENTION_RUNTIME",targets:"TARGET_TYPE_FILE","feature_support.edition_introduced":"EDITION_2023","edition_defaults.edition":"EDITION_PROTO3","edition_defaults.value":"PACKED"}},utf8Validation:{type:"Utf8Validation",id:4,options:{retention:"RETENTION_RUNTIME",targets:"TARGET_TYPE_FILE","feature_support.edition_introduced":"EDITION_2023","edition_defaults.edition":"EDITION_PROTO3","edition_defaults.value":"VERIFY"}},messageEncoding:{type:"MessageEncoding",id:5,options:{retention:"RETENTION_RUNTIME",targets:"TARGET_TYPE_FILE","feature_support.edition_introduced":"EDITION_2023","edition_defaults.edition":"EDITION_LEGACY","edition_defaults.value":"LENGTH_PREFIXED"}},jsonFormat:{type:"JsonFormat",id:6,options:{retention:"RETENTION_RUNTIME",targets:"TARGET_TYPE_FILE","feature_support.edition_introduced":"EDITION_2023","edition_defaults.edition":"EDITION_PROTO3","edition_defaults.value":"ALLOW"}},enforceNamingStyle:{type:"EnforceNamingStyle",id:7,options:{retention:"RETENTION_SOURCE",targets:"TARGET_TYPE_METHOD","feature_support.edition_introduced":"EDITION_2024","edition_defaults.edition":"EDITION_2024","edition_defaults.value":"STYLE2024"}},defaultSymbolVisibility:{type:"VisibilityFeature.DefaultSymbolVisibility",id:8,options:{retention:"RETENTION_SOURCE",targets:"TARGET_TYPE_FILE","feature_support.edition_introduced":"EDITION_2024","edition_defaults.edition":"EDITION_2024","edition_defaults.value":"EXPORT_TOP_LEVEL"}}},extensions:[[1e3,9994],[9995,9999],[1e4,1e4]],reserved:[[999,999]],nested:{FieldPresence:{values:{FIELD_PRESENCE_UNKNOWN:0,EXPLICIT:1,IMPLICIT:2,LEGACY_REQUIRED:3}},EnumType:{values:{ENUM_TYPE_UNKNOWN:0,OPEN:1,CLOSED:2}},RepeatedFieldEncoding:{values:{REPEATED_FIELD_ENCODING_UNKNOWN:0,PACKED:1,EXPANDED:2}},Utf8Validation:{values:{UTF8_VALIDATION_UNKNOWN:0,VERIFY:2,NONE:3}},MessageEncoding:{values:{MESSAGE_ENCODING_UNKNOWN:0,LENGTH_PREFIXED:1,DELIMITED:2}},JsonFormat:{values:{JSON_FORMAT_UNKNOWN:0,ALLOW:1,LEGACY_BEST_EFFORT:2}},EnforceNamingStyle:{values:{ENFORCE_NAMING_STYLE_UNKNOWN:0,STYLE2024:1,STYLE_LEGACY:2}},VisibilityFeature:{fields:{},reserved:[[1,536870911]],nested:{DefaultSymbolVisibility:{values:{DEFAULT_SYMBOL_VISIBILITY_UNKNOWN:0,EXPORT_ALL:1,EXPORT_TOP_LEVEL:2,LOCAL_ALL:3,STRICT:4}}}}}},FeatureSetDefaults:{edition:"proto2",fields:{defaults:{rule:"repeated",type:"FeatureSetEditionDefault",id:1},minimumEdition:{type:"Edition",id:4},maximumEdition:{type:"Edition",id:5}},nested:{FeatureSetEditionDefault:{fields:{edition:{type:"Edition",id:3},overridableFeatures:{type:"FeatureSet",id:4},fixedFeatures:{type:"FeatureSet",id:5}},reserved:[[1,1],[2,2],"features"]}}},SourceCodeInfo:{edition:"proto2",fields:{location:{rule:"repeated",type:"Location",id:1}},extensions:[[536e6,536e6]],nested:{Location:{fields:{path:{rule:"repeated",type:"int32",id:1,options:{packed:!0}},span:{rule:"repeated",type:"int32",id:2,options:{packed:!0}},leadingComments:{type:"string",id:3},trailingComments:{type:"string",id:4},leadingDetachedComments:{rule:"repeated",type:"string",id:6}}}}},GeneratedCodeInfo:{edition:"proto2",fields:{annotation:{rule:"repeated",type:"Annotation",id:1}},nested:{Annotation:{fields:{path:{rule:"repeated",type:"int32",id:1,options:{packed:!0}},sourceFile:{type:"string",id:2},begin:{type:"int32",id:3},end:{type:"int32",id:4},semantic:{type:"Semantic",id:5}},nested:{Semantic:{values:{NONE:0,SET:1,ALIAS:2}}}}}},SymbolVisibility:{edition:"proto2",values:{VISIBILITY_UNSET:0,VISIBILITY_LOCAL:1,VISIBILITY_EXPORT:2}}}}}}}}});var XNe=E((tt,ZNe)=>{"use strict";var ri=U$();ZNe.exports=tt=ri.descriptor=ri.Root.fromJSON(s8()).lookup(".google.protobuf");var HNe=ri.Namespace,hw=ri.Root,Yc=ri.Enum,vo=ri.Type,Gu=ri.Field,jIt=ri.MapField,F$=ri.OneOf,mw=ri.Service,j$=ri.Method,GNe=ri.util.patterns,qIt=GNe.numberRe,q$=GNe.typeRefRe;hw.fromDescriptor=function(e){typeof e.length=="number"&&(e=tt.FileDescriptorSet.decode(e));var r=new hw;if(e.file)for(var n,i,s=0,o;s<e.file.length;++s){i=r,(n=e.file[s]).package&&n.package.length&&(i=r.define(n.package));var a=JIt(n);if(n.name&&n.name.length&&r.files.push(i.filename=n.name),n.messageType)for(o=0;o<n.messageType.length;++o)i.add(vo.fromDescriptor(n.messageType[o],a));if(n.enumType)for(o=0;o<n.enumType.length;++o)i.add(Yc.fromDescriptor(n.enumType[o],a));if(n.extension)for(o=0;o<n.extension.length;++o)i.add(Gu.fromDescriptor(n.extension[o],a));if(n.service)for(o=0;o<n.service.length;++o)i.add(mw.fromDescriptor(n.service[o],a));var c=V_(n.options,tt.FileOptions);if(c){var l=Object.keys(c);for(o=0;o<l.length;++o)i.setOption(l[o],c[l[o]])}}return r.resolveAll()};hw.prototype.toDescriptor=function(e){var r=tt.FileDescriptorSet.create();return WNe(this,r.file,e),r};function WNe(t,e,r){var n=tt.FileDescriptorProto.create({name:t.filename||(t.fullName.substring(1).replace(/\./g,"_")||"root")+".proto"});ZIt(r,n),t instanceof hw||(n.package=t.fullName.substring(1));for(var i=0,s;i<t.nestedArray.length;++i)(s=t._nestedArray[i])instanceof vo?n.messageType.push(s.toDescriptor(r)):s instanceof Yc?n.enumType.push(s.toDescriptor()):s instanceof Gu?n.extension.push(s.toDescriptor(r)):s instanceof mw?n.service.push(s.toDescriptor()):s instanceof HNe&&WNe(s,e,r);n.options=H_(t.options,tt.FileOptions),n.messageType.length+n.enumType.length+n.extension.length+n.service.length&&e.push(n)}var BIt=0;vo.fromDescriptor=function(e,r,n,i){if(i===void 0&&(i=0),i>ri.util.nestingLimit)throw Error("max depth exceeded");typeof e.length=="number"&&(e=tt.DescriptorProto.decode(e));var s=new vo(e.name.length?e.name:"Type"+BIt++,V_(e.options,tt.MessageOptions)),o;if(n||(s._edition=r),e.oneofDecl)for(o=0;o<e.oneofDecl.length;++o)s.add(F$.fromDescriptor(e.oneofDecl[o]));if(e.field)for(o=0;o<e.field.length;++o){var a=Gu.fromDescriptor(e.field[o],r,!0);s.add(a),e.field[o].hasOwnProperty("oneofIndex")&&s.oneofsArray[e.field[o].oneofIndex].add(a)}if(e.extension)for(o=0;o<e.extension.length;++o)s.add(Gu.fromDescriptor(e.extension[o],r,!0));if(e.nestedType)for(o=0;o<e.nestedType.length;++o)s.add(vo.fromDescriptor(e.nestedType[o],r,!0,i+1)),e.nestedType[o].options&&e.nestedType[o].options.mapEntry&&s.setOption("map_entry",!0);if(e.enumType)for(o=0;o<e.enumType.length;++o)s.add(Yc.fromDescriptor(e.enumType[o],r,!0));if(e.extensionRange&&e.extensionRange.length)for(s.extensions=[],o=0;o<e.extensionRange.length;++o)s.extensions.push([e.extensionRange[o].start,e.extensionRange[o].end]);if(e.reservedRange&&e.reservedRange.length||e.reservedName&&e.reservedName.length){if(s.reserved=[],e.reservedRange)for(o=0;o<e.reservedRange.length;++o)s.reserved.push([e.reservedRange[o].start,e.reservedRange[o].end]);if(e.reservedName)for(o=0;o<e.reservedName.length;++o)s.reserved.push(e.reservedName[o])}return s};vo.prototype.toDescriptor=function(e){var r=tt.DescriptorProto.create({name:this.name}),n;for(n=0;n<this.fieldsArray.length;++n){var i;if(r.field.push(i=this._fieldsArray[n].toDescriptor(e)),this._fieldsArray[n]instanceof jIt){var s=o8(this._fieldsArray[n].keyType,this._fieldsArray[n].resolvedKeyType,!1),o=o8(this._fieldsArray[n].type,this._fieldsArray[n].resolvedType,!1),a=o===11||o===14?this._fieldsArray[n].resolvedType&&JNe(this.parent,this._fieldsArray[n].resolvedType)||this._fieldsArray[n].type:void 0;r.nestedType.push(tt.DescriptorProto.create({name:i.typeName,field:[tt.FieldDescriptorProto.create({name:"key",number:1,label:1,type:s}),tt.FieldDescriptorProto.create({name:"value",number:2,label:1,type:o,typeName:a})],options:tt.MessageOptions.create({mapEntry:!0})}))}}for(n=0;n<this.oneofsArray.length;++n)r.oneofDecl.push(this._oneofsArray[n].toDescriptor());for(n=0;n<this.nestedArray.length;++n)this._nestedArray[n]instanceof Gu?r.field.push(this._nestedArray[n].toDescriptor(e)):this._nestedArray[n]instanceof vo?r.nestedType.push(this._nestedArray[n].toDescriptor(e)):this._nestedArray[n]instanceof Yc&&r.enumType.push(this._nestedArray[n].toDescriptor());if(this.extensions)for(n=0;n<this.extensions.length;++n)r.extensionRange.push(tt.DescriptorProto.ExtensionRange.create({start:this.extensions[n][0],end:this.extensions[n][1]}));if(this.reserved)for(n=0;n<this.reserved.length;++n)typeof this.reserved[n]=="string"?r.reservedName.push(this.reserved[n]):r.reservedRange.push(tt.DescriptorProto.ReservedRange.create({start:this.reserved[n][0],end:this.reserved[n][1]}));return r.options=H_(this.options,tt.MessageOptions),r};Gu.fromDescriptor=function(e,r,n){if(typeof e.length=="number"&&(e=tt.DescriptorProto.decode(e)),typeof e.number!="number")throw Error("missing field id");var i=e.typeName,s;if(i!=null&&i!==""){if(typeof i!="string"||!q$.test(i))throw Error("illegal type name: "+i);s=i}else s=WIt(e.type);var o;switch(e.label){case 1:o=void 0;break;case 2:o="required";break;case 3:o="repeated";break;default:throw Error("illegal label: "+e.label)}var a=e.extendee;if(a!=null&&a!==""){if(typeof a!="string"||!q$.test(a))throw Error("illegal type name: "+a)}else a=void 0;var c=new Gu(e.name.length?e.name:"field"+e.number,e.number,s,o,a);if(n||(c._edition=r),c.options=V_(e.options,tt.FieldOptions),e.proto3_optional&&(c.options.proto3_optional=!0),e.defaultValue&&e.defaultValue.length){var l=e.defaultValue;switch(l){case"true":case"TRUE":l=!0;break;case"false":case"FALSE":l=!1;break;default:var u=qIt.exec(l);u&&(l=parseInt(l));break}c.setOption("default",l)}return YIt(e.type)&&(r==="proto3"?e.options&&!e.options.packed&&c.setOption("packed",!1):(!r||r==="proto2")&&e.options&&e.options.packed&&c.setOption("packed",!0)),c};Gu.prototype.toDescriptor=function(e){var r=tt.FieldDescriptorProto.create({name:this.name,number:this.id});if(this.map)r.type=11,r.typeName=ri.util.ucFirst(this.name),r.label=3;else{switch(r.type=o8(this.type,this.resolve().resolvedType,this.delimited)){case 10:case 11:case 14:r.typeName=this.resolvedType?JNe(this.parent,this.resolvedType):this.type;break}this.rule==="repeated"?r.label=3:this.required&&e==="proto2"?r.label=2:r.label=1}if(r.extendee=this.extensionField?this.extensionField.parent.fullName:this.extend,this.partOf&&this.parent instanceof vo&&(r.oneofIndex=this.parent.oneofsArray.indexOf(this.partOf))<0)throw Error("missing oneof");return this.options&&(r.options=H_(this.options,tt.FieldOptions),this.options.default!=null&&(r.defaultValue=String(this.options.default)),this.options.proto3_optional&&(r.proto3_optional=!0)),e==="proto3"?this.packed||((r.options||(r.options=tt.FieldOptions.create())).packed=!1):(!e||e==="proto2")&&this.packed&&((r.options||(r.options=tt.FieldOptions.create())).packed=!0),r};var zIt=0;Yc.fromDescriptor=function(e,r,n){typeof e.length=="number"&&(e=tt.EnumDescriptorProto.decode(e));var i={};if(e.value)for(var s=0;s<e.value.length;++s){var o=e.value[s].name,a=e.value[s].number||0;i[o&&o.length?o:"NAME"+a]=a}var c=new Yc(e.name&&e.name.length?e.name:"Enum"+zIt++,i,V_(e.options,tt.EnumOptions));return n||(c._edition=r),c};Yc.prototype.toDescriptor=function(){for(var e=[],r=0,n=Object.keys(this.values);r<n.length;++r)e.push(tt.EnumValueDescriptorProto.create({name:n[r],number:this.values[n[r]]}));return tt.EnumDescriptorProto.create({name:this.name,value:e,options:H_(this.options,tt.EnumOptions)})};var VIt=0;F$.fromDescriptor=function(e){return typeof e.length=="number"&&(e=tt.OneofDescriptorProto.decode(e)),new F$(e.name&&e.name.length?e.name:"oneof"+VIt++)};F$.prototype.toDescriptor=function(){return tt.OneofDescriptorProto.create({name:this.name})};var HIt=0;mw.fromDescriptor=function(e,r,n){typeof e.length=="number"&&(e=tt.ServiceDescriptorProto.decode(e));var i=new mw(e.name&&e.name.length?e.name:"Service"+HIt++,V_(e.options,tt.ServiceOptions));if(n||(i._edition=r),e.method)for(var s=0;s<e.method.length;++s)i.add(j$.fromDescriptor(e.method[s]));return i};mw.prototype.toDescriptor=function(){for(var e=[],r=0;r<this.methodsArray.length;++r)e.push(this._methodsArray[r].toDescriptor());return tt.ServiceDescriptorProto.create({name:this.name,method:e,options:H_(this.options,tt.ServiceOptions)})};var GIt=0;j$.fromDescriptor=function(e){typeof e.length=="number"&&(e=tt.MethodDescriptorProto.decode(e));var r=e.inputType,n=e.outputType;if(r!=null&&r!==""&&(typeof r!="string"||!q$.test(r)))throw Error("illegal type name: "+r);if(n!=null&&n!==""&&(typeof n!="string"||!q$.test(n)))throw Error("illegal type name: "+n);return new j$(e.name&&e.name.length?e.name:"Method"+GIt++,"rpc",r,n,!!e.clientStreaming,!!e.serverStreaming,V_(e.options,tt.MethodOptions))};j$.prototype.toDescriptor=function(){return tt.MethodDescriptorProto.create({name:this.name,inputType:this.resolvedRequestType?this.resolvedRequestType.fullName:this.requestType,outputType:this.resolvedResponseType?this.resolvedResponseType.fullName:this.responseType,clientStreaming:this.requestStream,serverStreaming:this.responseStream,options:H_(this.options,tt.MethodOptions)})};function WIt(t){switch(t){case 1:return"double";case 2:return"float";case 3:return"int64";case 4:return"uint64";case 5:return"int32";case 6:return"fixed64";case 7:return"fixed32";case 8:return"bool";case 9:return"string";case 12:return"bytes";case 13:return"uint32";case 15:return"sfixed32";case 16:return"sfixed64";case 17:return"sint32";case 18:return"sint64"}throw Error("illegal type: "+t)}function YIt(t){switch(t){case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:case 13:case 14:case 15:case 16:case 17:case 18:return!0}return!1}function o8(t,e,r){switch(t){case"double":return 1;case"float":return 2;case"int64":return 3;case"uint64":return 4;case"int32":return 5;case"fixed64":return 6;case"fixed32":return 7;case"bool":return 8;case"string":return 9;case"bytes":return 12;case"uint32":return 13;case"sfixed32":return 15;case"sfixed64":return 16;case"sint32":return 17;case"sint64":return 18}if(e instanceof Yc)return 14;if(e instanceof vo)return r?10:11;throw Error("illegal type: "+t)}function YNe(t,e){for(var r={},n=0,i,s;n<e.fieldsArray.length;++n)if((s=(i=e._fieldsArray[n]).name)!=="uninterpretedOption"&&Object.prototype.hasOwnProperty.call(t,s)){var o=KIt(s);i.resolvedType instanceof vo?r[o]=YNe(t[s],i.resolvedType):i.resolvedType instanceof Yc?r[o]=i.resolvedType.valuesById[t[s]]:r[o]=t[s]}return r}function V_(t,e){if(t)return YNe(e.toObject(t),e)}function KNe(t,e){for(var r={},n=Object.keys(t),i=0;i<n.length;++i){var s=n[i],o=ri.util.camelCase(s);if(Object.prototype.hasOwnProperty.call(e.fields,o)){var a=e.fields[o];a.resolvedType instanceof vo?r[o]=KNe(t[s],a.resolvedType):r[o]=t[s],a.repeated&&!Array.isArray(r[o])&&(r[o]=[r[o]])}}return r}function H_(t,e){if(t)return e.fromObject(KNe(t,e))}function JNe(t,e){var r=t.fullName.split("."),n=e.fullName.split("."),i=0,s=0,o=n.length-1;if(!(t instanceof hw)&&e instanceof HNe)for(;i<r.length&&s<o&&r[i]===n[s];){var a=e.lookup(r[i++],!0);if(a!==null&&a!==e)break;++s}else for(;i<r.length&&s<o&&r[i]===n[s];++i,++s);return n.slice(s).join(".")}function KIt(t){return t.substring(0,1)+t.substring(1).replace(/([A-Z])(?=[a-z]|$)/g,function(e,r){return"_"+r.toLowerCase()})}function JIt(t){if(t.syntax==="editions"){if(t.edition===tt.Edition.EDITION_2023)return"2023";throw new Error("Unsupported edition "+t.edition)}return t.syntax==="proto3"?"proto3":"proto2"}function ZIt(t,e){if(t)if(t==="proto2"||t==="proto3")e.syntax=t;else if(e.syntax="editions",t==="2023")e.edition=tt.Edition.EDITION_2023;else throw new Error("Unsupported edition "+t)}});var QNe=E((p0r,XIt)=>{XIt.exports={nested:{google:{nested:{protobuf:{nested:{Api:{fields:{name:{type:"string",id:1},methods:{rule:"repeated",type:"Method",id:2},options:{rule:"repeated",type:"Option",id:3},version:{type:"string",id:4},sourceContext:{type:"SourceContext",id:5},mixins:{rule:"repeated",type:"Mixin",id:6},syntax:{type:"Syntax",id:7}}},Method:{fields:{name:{type:"string",id:1},requestTypeUrl:{type:"string",id:2},requestStreaming:{type:"bool",id:3},responseTypeUrl:{type:"string",id:4},responseStreaming:{type:"bool",id:5},options:{rule:"repeated",type:"Option",id:6},syntax:{type:"Syntax",id:7}}},Mixin:{fields:{name:{type:"string",id:1},root:{type:"string",id:2}}},SourceContext:{fields:{fileName:{type:"string",id:1}}},Option:{fields:{name:{type:"string",id:1},value:{type:"Any",id:2}}},Syntax:{values:{SYNTAX_PROTO2:0,SYNTAX_PROTO3:1}}}}}}}}});var eke=E((h0r,QIt)=>{QIt.exports={nested:{google:{nested:{protobuf:{nested:{SourceContext:{fields:{fileName:{type:"string",id:1}}}}}}}}}});var tke=E((m0r,eOt)=>{eOt.exports={nested:{google:{nested:{protobuf:{nested:{Type:{fields:{name:{type:"string",id:1},fields:{rule:"repeated",type:"Field",id:2},oneofs:{rule:"repeated",type:"string",id:3},options:{rule:"repeated",type:"Option",id:4},sourceContext:{type:"SourceContext",id:5},syntax:{type:"Syntax",id:6}}},Field:{fields:{kind:{type:"Kind",id:1},cardinality:{type:"Cardinality",id:2},number:{type:"int32",id:3},name:{type:"string",id:4},typeUrl:{type:"string",id:6},oneofIndex:{type:"int32",id:7},packed:{type:"bool",id:8},options:{rule:"repeated",type:"Option",id:9},jsonName:{type:"string",id:10},defaultValue:{type:"string",id:11}},nested:{Kind:{values:{TYPE_UNKNOWN:0,TYPE_DOUBLE:1,TYPE_FLOAT:2,TYPE_INT64:3,TYPE_UINT64:4,TYPE_INT32:5,TYPE_FIXED64:6,TYPE_FIXED32:7,TYPE_BOOL:8,TYPE_STRING:9,TYPE_GROUP:10,TYPE_MESSAGE:11,TYPE_BYTES:12,TYPE_UINT32:13,TYPE_ENUM:14,TYPE_SFIXED32:15,TYPE_SFIXED64:16,TYPE_SINT32:17,TYPE_SINT64:18}},Cardinality:{values:{CARDINALITY_UNKNOWN:0,CARDINALITY_OPTIONAL:1,CARDINALITY_REQUIRED:2,CARDINALITY_REPEATED:3}}}},Enum:{fields:{name:{type:"string",id:1},enumvalue:{rule:"repeated",type:"EnumValue",id:2},options:{rule:"repeated",type:"Option",id:3},sourceContext:{type:"SourceContext",id:4},syntax:{type:"Syntax",id:5}}},EnumValue:{fields:{name:{type:"string",id:1},number:{type:"int32",id:2},options:{rule:"repeated",type:"Option",id:3}}},Option:{fields:{name:{type:"string",id:1},value:{type:"Any",id:2}}},Syntax:{values:{SYNTAX_PROTO2:0,SYNTAX_PROTO3:1}},Any:{fields:{type_url:{type:"string",id:1},value:{type:"bytes",id:2}}},SourceContext:{fields:{fileName:{type:"string",id:1}}}}}}}}}});var ske=E(Wu=>{"use strict";Object.defineProperty(Wu,"__esModule",{value:!0});Wu.addCommonProtos=Wu.loadProtosWithOptionsSync=Wu.loadProtosWithOptions=void 0;var rke=W("fs"),nke=W("path"),G_=U$();function ike(t,e){let r=t.resolvePath;t.resolvePath=(n,i)=>{if(nke.isAbsolute(i))return i;for(let s of e){let o=nke.join(s,i);try{return rke.accessSync(o,rke.constants.R_OK),o}catch{continue}}return process.emitWarning(`${i} not found in any of the include paths ${e}`),r(n,i)}}async function tOt(t,e){let r=new G_.Root;if(e=e||{},e.includeDirs){if(!Array.isArray(e.includeDirs))return Promise.reject(new Error("The includeDirs option must be an array"));ike(r,e.includeDirs)}let n=await r.load(t,e);return n.resolveAll(),n}Wu.loadProtosWithOptions=tOt;function rOt(t,e){let r=new G_.Root;if(e=e||{},e.includeDirs){if(!Array.isArray(e.includeDirs))throw new Error("The includeDirs option must be an array");ike(r,e.includeDirs)}let n=r.loadSync(t,e);return n.resolveAll(),n}Wu.loadProtosWithOptionsSync=rOt;function nOt(){let t=QNe(),e=s8(),r=eke(),n=tke();G_.common("api",t.nested.google.nested.protobuf.nested),G_.common("descriptor",e.nested.google.nested.protobuf.nested),G_.common("source_context",r.nested.google.nested.protobuf.nested),G_.common("type",n.nested.google.nested.protobuf.nested)}Wu.addCommonProtos=nOt});var f8=E($r=>{"use strict";Object.defineProperty($r,"__esModule",{value:!0});$r.loadFileDescriptorSetFromObject=$r.loadFileDescriptorSetFromBuffer=$r.fromJSON=$r.loadSync=$r.load=$r.IdempotencyLevel=$r.isAnyExtension=$r.Long=void 0;var iOt=qPe(),Aa=U$(),u8=XNe(),d8=ske(),sOt=h5();$r.Long=sOt;function oOt(t){return"@type"in t&&typeof t["@type"]=="string"}$r.isAnyExtension=oOt;var oke;(function(t){t.IDEMPOTENCY_UNKNOWN="IDEMPOTENCY_UNKNOWN",t.NO_SIDE_EFFECTS="NO_SIDE_EFFECTS",t.IDEMPOTENT="IDEMPOTENT"})(oke=$r.IdempotencyLevel||($r.IdempotencyLevel={}));var ake={longs:String,enums:String,bytes:String,defaults:!0,oneofs:!0,json:!0};function aOt(t,e){return t===""?e:t+"."+e}function cOt(t){return t instanceof Aa.Service||t instanceof Aa.Type||t instanceof Aa.Enum}function lOt(t){return t instanceof Aa.Namespace||t instanceof Aa.Root}function cke(t,e){let r=aOt(e,t.name);return cOt(t)?[[r,t]]:lOt(t)&&typeof t.nested<"u"?Object.keys(t.nested).map(n=>cke(t.nested[n],r)).reduce((n,i)=>n.concat(i),[]):[]}function a8(t,e){return function(n){return t.toObject(t.decode(n),e)}}function c8(t){return function(r){if(Array.isArray(r))throw new Error(`Failed to serialize message: expected object with ${t.name} structure, got array instead`);let n=t.fromObject(r);return t.encode(n).finish()}}function uOt(t){return(t||[]).reduce((e,r)=>{for(let[n,i]of Object.entries(r))n==="uninterpreted_option"?e.uninterpreted_option.push(r.uninterpreted_option):e[n]=i;return e},{deprecated:!1,idempotency_level:oke.IDEMPOTENCY_UNKNOWN,uninterpreted_option:[]})}function dOt(t,e,r,n){let i=t.resolvedRequestType,s=t.resolvedResponseType;return{path:"/"+e+"/"+t.name,requestStream:!!t.requestStream,responseStream:!!t.responseStream,requestSerialize:c8(i),requestDeserialize:a8(i,r),responseSerialize:c8(s),responseDeserialize:a8(s,r),originalName:iOt(t.name),requestType:l8(i,r,n),responseType:l8(s,r,n),options:uOt(t.parsedOptions)}}function fOt(t,e,r,n){let i={};for(let s of t.methodsArray)i[s.name]=dOt(s,e,r,n);return i}function l8(t,e,r){let n=t.toDescriptor("proto3");return{format:"Protocol Buffer 3 DescriptorProto",type:n.$type.toObject(n,ake),fileDescriptorProtos:r,serialize:c8(t),deserialize:a8(t,e)}}function pOt(t,e){let r=t.toDescriptor("proto3");return{format:"Protocol Buffer 3 EnumDescriptorProto",type:r.$type.toObject(r,ake),fileDescriptorProtos:e}}function hOt(t,e,r,n){if(t instanceof Aa.Service)return fOt(t,e,r,n);if(t instanceof Aa.Type)return l8(t,r,n);if(t instanceof Aa.Enum)return pOt(t,n);throw new Error("Type mismatch in reflection object handling")}function B$(t,e){let r={};t.resolveAll();let i=t.toDescriptor("proto3").file.map(s=>Buffer.from(u8.FileDescriptorProto.encode(s).finish()));for(let[s,o]of cke(t,""))r[s]=hOt(o,s,e,i);return r}function lke(t,e){e=e||{};let r=Aa.Root.fromDescriptor(t);return r.resolveAll(),B$(r,e)}function mOt(t,e){return(0,d8.loadProtosWithOptions)(t,e).then(r=>B$(r,e))}$r.load=mOt;function gOt(t,e){let r=(0,d8.loadProtosWithOptionsSync)(t,e);return B$(r,e)}$r.loadSync=gOt;function _Ot(t,e){e=e||{};let r=Aa.Root.fromJSON(t);return r.resolveAll(),B$(r,e)}$r.fromJSON=_Ot;function yOt(t,e){let r=u8.FileDescriptorSet.decode(t);return lke(r,e)}$r.loadFileDescriptorSetFromBuffer=yOt;function SOt(t,e){let r=u8.FileDescriptorSet.fromObject(t);return lke(r,e)}$r.loadFileDescriptorSetFromObject=SOt;(0,d8.addCommonProtos)()});var Yu=E(Ht=>{"use strict";Object.defineProperty(Ht,"__esModule",{value:!0});Ht.registerChannelzSocket=Ht.registerChannelzServer=Ht.registerChannelzSubchannel=Ht.registerChannelzChannel=Ht.ChannelzCallTrackerStub=Ht.ChannelzCallTracker=Ht.ChannelzChildrenTrackerStub=Ht.ChannelzChildrenTracker=Ht.ChannelzTrace=Ht.ChannelzTraceStub=void 0;Ht.unregisterChannelzRef=wOt;Ht.getChannelzHandlers=_ke;Ht.getChannelzServiceDefinition=yke;Ht.setup=LOt;var V$=W("net"),vp=(uPe(),qn(lPe)),gw=ti(),_w=st(),EOt=Ti(),vOt=c$(),bOt=p$();function p8(t){return{channel_id:t.id,name:t.name}}function y8(t){return{subchannel_id:t.id,name:t.name}}function TOt(t){return{server_id:t.id}}function W$(t){return{socket_id:t.id,name:t.name}}var uke=32,S8=100,h8=class{constructor(){this.events=[],this.creationTimestamp=new Date,this.eventsLogged=0}addTrace(){}getTraceMessage(){return{creation_timestamp:Ra(this.creationTimestamp),num_events_logged:this.eventsLogged,events:[]}}};Ht.ChannelzTraceStub=h8;var m8=class{constructor(){this.events=[],this.eventsLogged=0,this.creationTimestamp=new Date}addTrace(e,r,n){let i=new Date;this.events.push({description:r,severity:e,timestamp:i,childChannel:n?.kind==="channel"?n:void 0,childSubchannel:n?.kind==="subchannel"?n:void 0}),this.events.length>=uke*2&&(this.events=this.events.slice(uke)),this.eventsLogged+=1}getTraceMessage(){return{creation_timestamp:Ra(this.creationTimestamp),num_events_logged:this.eventsLogged,events:this.events.map(e=>({description:e.description,severity:e.severity,timestamp:Ra(e.timestamp),channel_ref:e.childChannel?p8(e.childChannel):null,subchannel_ref:e.childSubchannel?y8(e.childSubchannel):null}))}}};Ht.ChannelzTrace=m8;var H$=class{constructor(){this.channelChildren=new vp.OrderedMap,this.subchannelChildren=new vp.OrderedMap,this.socketChildren=new vp.OrderedMap,this.trackerMap={channel:this.channelChildren,subchannel:this.subchannelChildren,socket:this.socketChildren}}refChild(e){let r=this.trackerMap[e.kind],n=r.find(e.id);n.equals(r.end())?r.setElement(e.id,{ref:e,count:1},n):n.pointer[1].count+=1}unrefChild(e){let r=this.trackerMap[e.kind],n=r.getElementByKey(e.id);n!==void 0&&(n.count-=1,n.count===0&&r.eraseElementByKey(e.id))}getChildLists(){return{channels:this.channelChildren,subchannels:this.subchannelChildren,sockets:this.socketChildren}}};Ht.ChannelzChildrenTracker=H$;var g8=class extends H${refChild(){}unrefChild(){}};Ht.ChannelzChildrenTrackerStub=g8;var G$=class{constructor(){this.callsStarted=0,this.callsSucceeded=0,this.callsFailed=0,this.lastCallStartedTimestamp=null}addCallStarted(){this.callsStarted+=1,this.lastCallStartedTimestamp=new Date}addCallSucceeded(){this.callsSucceeded+=1}addCallFailed(){this.callsFailed+=1}};Ht.ChannelzCallTracker=G$;var _8=class extends G${addCallStarted(){}addCallSucceeded(){}addCallFailed(){}};Ht.ChannelzCallTrackerStub=_8;var Kc={channel:new vp.OrderedMap,subchannel:new vp.OrderedMap,server:new vp.OrderedMap,socket:new vp.OrderedMap},Y$=t=>{let e=1;function r(){return e++}let n=Kc[t];return(i,s,o)=>{let a=r(),c={id:a,name:i,kind:t};return o&&n.setElement(a,{ref:c,getInfo:s}),c}};Ht.registerChannelzChannel=Y$("channel");Ht.registerChannelzSubchannel=Y$("subchannel");Ht.registerChannelzServer=Y$("server");Ht.registerChannelzSocket=Y$("socket");function wOt(t){Kc[t.kind].eraseElementByKey(t.id)}function AOt(t){let e=Number.parseInt(t,16);return[e/256|0,e%256]}function dke(t){if(t==="")return[];let e=t.split(":").map(n=>AOt(n));return[].concat(...e)}function ROt(t){return(0,V$.isIPv6)(t)&&t.toLowerCase().startsWith("::ffff:")&&(0,V$.isIPv4)(t.substring(7))}function fke(t){return Buffer.from(Uint8Array.from(t.split(".").map(e=>Number.parseInt(e))))}function xOt(t){if((0,V$.isIPv4)(t))return fke(t);if(ROt(t))return fke(t.substring(7));if((0,V$.isIPv6)(t)){let e,r,n=t.indexOf("::");n===-1?(e=t,r=""):(e=t.substring(0,n),r=t.substring(n+2));let i=Buffer.from(dke(e)),s=Buffer.from(dke(r)),o=Buffer.alloc(16-i.length-s.length,0);return Buffer.concat([i,o,s])}else return null}function hke(t){switch(t){case gw.ConnectivityState.CONNECTING:return{state:"CONNECTING"};case gw.ConnectivityState.IDLE:return{state:"IDLE"};case gw.ConnectivityState.READY:return{state:"READY"};case gw.ConnectivityState.SHUTDOWN:return{state:"SHUTDOWN"};case gw.ConnectivityState.TRANSIENT_FAILURE:return{state:"TRANSIENT_FAILURE"};default:return{state:"UNKNOWN"}}}function Ra(t){if(!t)return null;let e=t.getTime();return{seconds:e/1e3|0,nanos:e%1e3*1e6}}function mke(t){let e=t.getInfo(),r=[],n=[];return e.children.channels.forEach(i=>{r.push(p8(i[1].ref))}),e.children.subchannels.forEach(i=>{n.push(y8(i[1].ref))}),{ref:p8(t.ref),data:{target:e.target,state:hke(e.state),calls_started:e.callTracker.callsStarted,calls_succeeded:e.callTracker.callsSucceeded,calls_failed:e.callTracker.callsFailed,last_call_started_timestamp:Ra(e.callTracker.lastCallStartedTimestamp),trace:e.trace.getTraceMessage()},channel_ref:r,subchannel_ref:n}}function IOt(t,e){let r=parseInt(t.request.channel_id,10),n=Kc.channel.getElementByKey(r);if(n===void 0){e({code:_w.Status.NOT_FOUND,details:"No channel data found for id "+r});return}e(null,{channel:mke(n)})}function OOt(t,e){let r=parseInt(t.request.max_results,10)||S8,n=[],i=parseInt(t.request.start_channel_id,10),s=Kc.channel,o;for(o=s.lowerBound(i);!o.equals(s.end())&&n.length<r;o=o.next())n.push(mke(o.pointer[1]));e(null,{channel:n,end:o.equals(s.end())})}function gke(t){let e=t.getInfo(),r=[];return e.listenerChildren.sockets.forEach(n=>{r.push(W$(n[1].ref))}),{ref:TOt(t.ref),data:{calls_started:e.callTracker.callsStarted,calls_succeeded:e.callTracker.callsSucceeded,calls_failed:e.callTracker.callsFailed,last_call_started_timestamp:Ra(e.callTracker.lastCallStartedTimestamp),trace:e.trace.getTraceMessage()},listen_socket:r}}function POt(t,e){let r=parseInt(t.request.server_id,10),i=Kc.server.getElementByKey(r);if(i===void 0){e({code:_w.Status.NOT_FOUND,details:"No server data found for id "+r});return}e(null,{server:gke(i)})}function COt(t,e){let r=parseInt(t.request.max_results,10)||S8,n=parseInt(t.request.start_server_id,10),i=Kc.server,s=[],o;for(o=i.lowerBound(n);!o.equals(i.end())&&s.length<r;o=o.next())s.push(gke(o.pointer[1]));e(null,{server:s,end:o.equals(i.end())})}function NOt(t,e){let r=parseInt(t.request.subchannel_id,10),n=Kc.subchannel.getElementByKey(r);if(n===void 0){e({code:_w.Status.NOT_FOUND,details:"No subchannel data found for id "+r});return}let i=n.getInfo(),s=[];i.children.sockets.forEach(a=>{s.push(W$(a[1].ref))});let o={ref:y8(n.ref),data:{target:i.target,state:hke(i.state),calls_started:i.callTracker.callsStarted,calls_succeeded:i.callTracker.callsSucceeded,calls_failed:i.callTracker.callsFailed,last_call_started_timestamp:Ra(i.callTracker.lastCallStartedTimestamp),trace:i.trace.getTraceMessage()},socket_ref:s};e(null,{subchannel:o})}function pke(t){var e;return(0,EOt.isTcpSubchannelAddress)(t)?{address:"tcpip_address",tcpip_address:{ip_address:(e=xOt(t.host))!==null&&e!==void 0?e:void 0,port:t.port}}:{address:"uds_address",uds_address:{filename:t.path}}}function kOt(t,e){var r,n,i,s,o;let a=parseInt(t.request.socket_id,10),c=Kc.socket.getElementByKey(a);if(c===void 0){e({code:_w.Status.NOT_FOUND,details:"No socket data found for id "+a});return}let l=c.getInfo(),u=l.security?{model:"tls",tls:{cipher_suite:l.security.cipherSuiteStandardName?"standard_name":"other_name",standard_name:(r=l.security.cipherSuiteStandardName)!==null&&r!==void 0?r:void 0,other_name:(n=l.security.cipherSuiteOtherName)!==null&&n!==void 0?n:void 0,local_certificate:(i=l.security.localCertificate)!==null&&i!==void 0?i:void 0,remote_certificate:(s=l.security.remoteCertificate)!==null&&s!==void 0?s:void 0}}:null,d={ref:W$(c.ref),local:l.localAddress?pke(l.localAddress):null,remote:l.remoteAddress?pke(l.remoteAddress):null,remote_name:(o=l.remoteName)!==null&&o!==void 0?o:void 0,security:u,data:{keep_alives_sent:l.keepAlivesSent,streams_started:l.streamsStarted,streams_succeeded:l.streamsSucceeded,streams_failed:l.streamsFailed,last_local_stream_created_timestamp:Ra(l.lastLocalStreamCreatedTimestamp),last_remote_stream_created_timestamp:Ra(l.lastRemoteStreamCreatedTimestamp),messages_received:l.messagesReceived,messages_sent:l.messagesSent,last_message_received_timestamp:Ra(l.lastMessageReceivedTimestamp),last_message_sent_timestamp:Ra(l.lastMessageSentTimestamp),local_flow_control_window:l.localFlowControlWindow?{value:l.localFlowControlWindow}:null,remote_flow_control_window:l.remoteFlowControlWindow?{value:l.remoteFlowControlWindow}:null}};e(null,{socket:d})}function $Ot(t,e){let r=parseInt(t.request.server_id,10),n=Kc.server.getElementByKey(r);if(n===void 0){e({code:_w.Status.NOT_FOUND,details:"No server data found for id "+r});return}let i=parseInt(t.request.start_socket_id,10),s=parseInt(t.request.max_results,10)||S8,a=n.getInfo().sessionChildren.sockets,c=[],l;for(l=a.lowerBound(i);!l.equals(a.end())&&c.length<s;l=l.next())c.push(W$(l.pointer[1].ref));e(null,{socket_ref:c,end:l.equals(a.end())})}function _ke(){return{GetChannel:IOt,GetTopChannels:OOt,GetServer:POt,GetServers:COt,GetSubchannel:NOt,GetSocket:kOt,GetServerSockets:$Ot}}var z$=null;function yke(){if(z$)return z$;let t=f8().loadSync,e=t("channelz.proto",{keepCase:!0,longs:String,enums:String,defaults:!0,oneofs:!0,includeDirs:[`${__dirname}/../../proto`]});return z$=(0,bOt.loadPackageDefinition)(e).grpc.channelz.v1.Channelz.service,z$}function LOt(){(0,vOt.registerAdminService)(yke,_ke)}});var K$=E(E8=>{"use strict";Object.defineProperty(E8,"__esModule",{value:!0});E8.getNextCallNumber=MOt;var DOt=0;function MOt(){return DOt++}});var v8=E(J$=>{"use strict";Object.defineProperty(J$,"__esModule",{value:!0});J$.CompressionAlgorithms=void 0;var Ske;(function(t){t[t.identity=0]="identity",t[t.deflate=1]="deflate",t[t.gzip=2]="gzip"})(Ske||(J$.CompressionAlgorithms=Ske={}))});var T8=E(Z$=>{"use strict";Object.defineProperty(Z$,"__esModule",{value:!0});Z$.BaseFilter=void 0;var b8=class{async sendMetadata(e){return e}receiveMetadata(e){return e}async sendMessage(e){return e}async receiveMessage(e){return e}receiveTrailers(e){return e}};Z$.BaseFilter=b8});var I8=E(Y_=>{"use strict";Object.defineProperty(Y_,"__esModule",{value:!0});Y_.CompressionFilterFactory=Y_.CompressionFilter=void 0;var X$=W("zlib"),vke=v8(),Ku=st(),UOt=T8(),FOt=qt(),jOt=t=>typeof t=="number"&&typeof vke.CompressionAlgorithms[t]=="string",W_=class{async writeMessage(e,r){let n=e;r&&(n=await this.compressMessage(n));let i=Buffer.allocUnsafe(n.length+5);return i.writeUInt8(r?1:0,0),i.writeUInt32BE(n.length,1),n.copy(i,5),i}async readMessage(e){let r=e.readUInt8(0)===1,n=e.slice(5);return r&&(n=await this.decompressMessage(n)),n}},bp=class extends W_{async compressMessage(e){return e}async writeMessage(e,r){let n=Buffer.allocUnsafe(e.length+5);return n.writeUInt8(0,0),n.writeUInt32BE(e.length,1),e.copy(n,5),n}decompressMessage(e){return Promise.reject(new Error('Received compressed message but "grpc-encoding" header was identity'))}},w8=class extends W_{constructor(e){super(),this.maxRecvMessageLength=e}compressMessage(e){return new Promise((r,n)=>{X$.deflate(e,(i,s)=>{i?n(i):r(s)})})}decompressMessage(e){return new Promise((r,n)=>{let i=0,s=[],o=X$.createInflate();o.on("error",a=>{n({code:Ku.Status.INTERNAL,details:"Failed to decompress deflate-encoded message"})}),o.on("data",a=>{s.push(a),i+=a.byteLength,this.maxRecvMessageLength!==-1&&i>this.maxRecvMessageLength&&(o.destroy(),n({code:Ku.Status.RESOURCE_EXHAUSTED,details:`Received message that decompresses to a size larger than ${this.maxRecvMessageLength}`}))}),o.on("end",()=>{r(Buffer.concat(s))}),o.write(e),o.end()})}},A8=class extends W_{constructor(e){super(),this.maxRecvMessageLength=e}compressMessage(e){return new Promise((r,n)=>{X$.gzip(e,(i,s)=>{i?n(i):r(s)})})}decompressMessage(e){return new Promise((r,n)=>{let i=0,s=[],o=X$.createGunzip();o.on("error",a=>{n({code:Ku.Status.INTERNAL,details:"Failed to decompress gzip-encoded message"})}),o.on("data",a=>{s.push(a),i+=a.byteLength,this.maxRecvMessageLength!==-1&&i>this.maxRecvMessageLength&&(o.destroy(),n({code:Ku.Status.RESOURCE_EXHAUSTED,details:`Received message that decompresses to a size larger than ${this.maxRecvMessageLength}`}))}),o.on("end",()=>{r(Buffer.concat(s))}),o.write(e),o.end()})}},R8=class extends W_{constructor(e){super(),this.compressionName=e}compressMessage(e){return Promise.reject(new Error(`Received message compressed with unsupported compression method ${this.compressionName}`))}decompressMessage(e){return Promise.reject(new Error(`Compression method not supported: ${this.compressionName}`))}};function Eke(t,e){switch(t){case"identity":return new bp;case"deflate":return new w8(e);case"gzip":return new A8(e);default:return new R8(t)}}var Q$=class extends UOt.BaseFilter{constructor(e,r){var n,i,s;super(),this.sharedFilterConfig=r,this.sendCompression=new bp,this.receiveCompression=new bp,this.currentCompressionAlgorithm="identity";let o=e["grpc.default_compression_algorithm"];if(this.maxReceiveMessageLength=(n=e["grpc.max_receive_message_length"])!==null&&n!==void 0?n:Ku.DEFAULT_MAX_RECEIVE_MESSAGE_LENGTH,this.maxSendMessageLength=(i=e["grpc.max_send_message_length"])!==null&&i!==void 0?i:Ku.DEFAULT_MAX_SEND_MESSAGE_LENGTH,o!==void 0)if(jOt(o)){let a=vke.CompressionAlgorithms[o],c=(s=r.serverSupportedEncodingHeader)===null||s===void 0?void 0:s.split(",");(!c||c.includes(a))&&(this.currentCompressionAlgorithm=a,this.sendCompression=Eke(this.currentCompressionAlgorithm,-1))}else FOt.log(Ku.LogVerbosity.ERROR,`Invalid value provided for grpc.default_compression_algorithm option: ${o}`)}async sendMetadata(e){let r=await e;return r.set("grpc-accept-encoding","identity,deflate,gzip"),r.set("accept-encoding","identity"),this.currentCompressionAlgorithm==="identity"?r.remove("grpc-encoding"):r.set("grpc-encoding",this.currentCompressionAlgorithm),r}receiveMetadata(e){let r=e.get("grpc-encoding");if(r.length>0){let i=r[0];typeof i=="string"&&(this.receiveCompression=Eke(i,this.maxReceiveMessageLength))}e.remove("grpc-encoding");let n=e.get("grpc-accept-encoding")[0];return n&&(this.sharedFilterConfig.serverSupportedEncodingHeader=n,n.split(",").includes(this.currentCompressionAlgorithm)||(this.sendCompression=new bp,this.currentCompressionAlgorithm="identity")),e.remove("grpc-accept-encoding"),e}async sendMessage(e){var r;let n=await e;if(this.maxSendMessageLength!==-1&&n.message.length>this.maxSendMessageLength)throw{code:Ku.Status.RESOURCE_EXHAUSTED,details:`Attempted to send message with a size larger than ${this.maxSendMessageLength}`};let i;return this.sendCompression instanceof bp?i=!1:i=(((r=n.flags)!==null&&r!==void 0?r:0)&2)===0,{message:await this.sendCompression.writeMessage(n.message,i),flags:n.flags}}async receiveMessage(e){return this.receiveCompression.readMessage(await e)}};Y_.CompressionFilter=Q$;var x8=class{constructor(e,r){this.options=r,this.sharedFilterConfig={}}createFilter(){return new Q$(this.options,this.sharedFilterConfig)}};Y_.CompressionFilterFactory=x8});var yw=E(O8=>{"use strict";Object.defineProperty(O8,"__esModule",{value:!0});O8.restrictControlPlaneStatusCode=BOt;var xa=st(),qOt=[xa.Status.OK,xa.Status.INVALID_ARGUMENT,xa.Status.NOT_FOUND,xa.Status.ALREADY_EXISTS,xa.Status.FAILED_PRECONDITION,xa.Status.ABORTED,xa.Status.OUT_OF_RANGE,xa.Status.DATA_LOSS];function BOt(t,e){return qOt.includes(t)?{code:xa.Status.INTERNAL,details:`Invalid status from control plane: ${t} ${xa.Status[t]} ${e}`}:{code:t,details:e}}});var K_=E(Tp=>{"use strict";Object.defineProperty(Tp,"__esModule",{value:!0});Tp.minDeadline=zOt;Tp.getDeadlineTimeoutString=HOt;Tp.getRelativeTimeout=WOt;Tp.deadlineToString=YOt;Tp.formatDateDifference=KOt;function zOt(...t){let e=1/0;for(let r of t){let n=r instanceof Date?r.getTime():r;n<e&&(e=n)}return e}var VOt=[["m",1],["S",1e3],["M",60*1e3],["H",3600*1e3]];function HOt(t){let e=new Date().getTime();t instanceof Date&&(t=t.getTime());let r=Math.max(t-e,0);for(let[n,i]of VOt){let s=r/i;if(s<1e8)return String(Math.ceil(s))+n}throw new Error("Deadline is too far in the future")}var GOt=2147483647;function WOt(t){let e=t instanceof Date?t.getTime():t,r=new Date().getTime(),n=e-r;return n<0?0:n>GOt?1/0:n}function YOt(t){if(t instanceof Date)return t.toISOString();{let e=new Date(t);return Number.isNaN(e.getTime())?""+t:e.toISOString()}}function KOt(t,e){return((e.getTime()-t.getTime())/1e3).toFixed(3)+"s"}});var tL=E(J_=>{"use strict";Object.defineProperty(J_,"__esModule",{value:!0});J_.FilterStackFactory=J_.FilterStack=void 0;var eL=class{constructor(e){this.filters=e}sendMetadata(e){let r=e;for(let n=0;n<this.filters.length;n++)r=this.filters[n].sendMetadata(r);return r}receiveMetadata(e){let r=e;for(let n=this.filters.length-1;n>=0;n--)r=this.filters[n].receiveMetadata(r);return r}sendMessage(e){let r=e;for(let n=0;n<this.filters.length;n++)r=this.filters[n].sendMessage(r);return r}receiveMessage(e){let r=e;for(let n=this.filters.length-1;n>=0;n--)r=this.filters[n].receiveMessage(r);return r}receiveTrailers(e){let r=e;for(let n=this.filters.length-1;n>=0;n--)r=this.filters[n].receiveTrailers(r);return r}push(e){this.filters.unshift(...e)}getFilters(){return this.filters}};J_.FilterStack=eL;var P8=class t{constructor(e){this.factories=e}push(e){this.factories.unshift(...e)}clone(){return new t([...this.factories])}createFilter(){return new eL(this.factories.map(e=>e.createFilter()))}};J_.FilterStackFactory=P8});var bke=E(nL=>{"use strict";Object.defineProperty(nL,"__esModule",{value:!0});nL.SingleSubchannelChannel=void 0;var JOt=K$(),Sw=Yu(),ZOt=I8(),XOt=ti(),Ew=st(),QOt=yw(),ePt=K_(),tPt=tL(),C8=Vr(),rPt=co(),rL=ei(),N8=class{constructor(e,r,n,i,s){var o,a;this.subchannel=e,this.method=r,this.options=i,this.callNumber=s,this.childCall=null,this.pendingMessage=null,this.readPending=!1,this.halfClosePending=!1,this.pendingStatus=null,this.readFilterPending=!1,this.writeFilterPending=!1;let c=this.method.split("/"),l="";c.length>=2&&(l=c[1]);let u=(a=(o=(0,rL.splitHostPort)(this.options.host))===null||o===void 0?void 0:o.host)!==null&&a!==void 0?a:"localhost";this.serviceUrl=`https://${u}/${l}`;let d=(0,ePt.getRelativeTimeout)(i.deadline);d!==1/0&&(d<=0?this.cancelWithStatus(Ew.Status.DEADLINE_EXCEEDED,"Deadline exceeded"):setTimeout(()=>{this.cancelWithStatus(Ew.Status.DEADLINE_EXCEEDED,"Deadline exceeded")},d)),this.filterStack=n.createFilter()}cancelWithStatus(e,r){this.childCall?this.childCall.cancelWithStatus(e,r):this.pendingStatus={code:e,details:r,metadata:new C8.Metadata}}getPeer(){var e,r;return(r=(e=this.childCall)===null||e===void 0?void 0:e.getPeer())!==null&&r!==void 0?r:this.subchannel.getAddress()}async start(e,r){if(this.pendingStatus){r.onReceiveStatus(this.pendingStatus);return}if(this.subchannel.getConnectivityState()!==XOt.ConnectivityState.READY){r.onReceiveStatus({code:Ew.Status.UNAVAILABLE,details:"Subchannel not ready",metadata:new C8.Metadata});return}let n=await this.filterStack.sendMetadata(Promise.resolve(e)),i;try{i=await this.subchannel.getCallCredentials().generateMetadata({method_name:this.method,service_url:this.serviceUrl})}catch(o){let a=o,{code:c,details:l}=(0,QOt.restrictControlPlaneStatusCode)(typeof a.code=="number"?a.code:Ew.Status.UNKNOWN,`Getting metadata from plugin failed with error: ${a.message}`);r.onReceiveStatus({code:c,details:l,metadata:new C8.Metadata});return}i.merge(n);let s={onReceiveMetadata:async o=>{r.onReceiveMetadata(await this.filterStack.receiveMetadata(o))},onReceiveMessage:async o=>{this.readFilterPending=!0;let a=await this.filterStack.receiveMessage(o);this.readFilterPending=!1,r.onReceiveMessage(a),this.pendingStatus&&r.onReceiveStatus(this.pendingStatus)},onReceiveStatus:async o=>{let a=await this.filterStack.receiveTrailers(o);this.readFilterPending?this.pendingStatus=a:r.onReceiveStatus(a)}};this.childCall=this.subchannel.createCall(i,this.options.host,this.method,s),this.readPending&&this.childCall.startRead(),this.pendingMessage&&this.childCall.sendMessageWithContext(this.pendingMessage.context,this.pendingMessage.message),this.halfClosePending&&!this.writeFilterPending&&this.childCall.halfClose()}async sendMessageWithContext(e,r){this.writeFilterPending=!0;let n=await this.filterStack.sendMessage(Promise.resolve({message:r,flags:e.flags}));this.writeFilterPending=!1,this.childCall?(this.childCall.sendMessageWithContext(e,n.message),this.halfClosePending&&this.childCall.halfClose()):this.pendingMessage={context:e,message:n.message}}startRead(){this.childCall?this.childCall.startRead():this.readPending=!0}halfClose(){this.childCall&&!this.writeFilterPending?this.childCall.halfClose():this.halfClosePending=!0}getCallNumber(){return this.callNumber}setCredentials(e){throw new Error("Method not implemented.")}getAuthContext(){return this.childCall?this.childCall.getAuthContext():null}},k8=class{constructor(e,r,n){this.subchannel=e,this.target=r,this.channelzEnabled=!1,this.channelzTrace=new Sw.ChannelzTrace,this.callTracker=new Sw.ChannelzCallTracker,this.childrenTracker=new Sw.ChannelzChildrenTracker,this.channelzEnabled=n["grpc.enable_channelz"]!==0,this.channelzRef=(0,Sw.registerChannelzChannel)((0,rL.uriToString)(r),()=>({target:`${(0,rL.uriToString)(r)} (${e.getAddress()})`,state:this.subchannel.getConnectivityState(),trace:this.channelzTrace,callTracker:this.callTracker,children:this.childrenTracker.getChildLists()}),this.channelzEnabled),this.channelzEnabled&&this.childrenTracker.refChild(e.getChannelzRef()),this.filterStackFactory=new tPt.FilterStackFactory([new ZOt.CompressionFilterFactory(this,n)])}close(){this.channelzEnabled&&this.childrenTracker.unrefChild(this.subchannel.getChannelzRef()),(0,Sw.unregisterChannelzRef)(this.channelzRef)}getTarget(){return(0,rL.uriToString)(this.target)}getConnectivityState(e){throw new Error("Method not implemented.")}watchConnectivityState(e,r,n){throw new Error("Method not implemented.")}getChannelzRef(){return this.channelzRef}createCall(e,r){let n={deadline:r,host:(0,rPt.getDefaultAuthority)(this.target),flags:Ew.Propagate.DEFAULTS,parentCall:null};return new N8(this.subchannel,e,this.filterStackFactory,n,(0,JOt.getNextCallNumber)())}};nL.SingleSubchannelChannel=k8});var Tke=E(sL=>{"use strict";Object.defineProperty(sL,"__esModule",{value:!0});sL.Subchannel=void 0;var Lt=ti(),nPt=O_(),$8=qt(),iL=st(),iPt=ei(),sPt=Ti(),Ia=Yu(),oPt=bke(),aPt="subchannel",cPt=~(1<<31),L8=class{constructor(e,r,n,i,s){var o;this.channelTarget=e,this.subchannelAddress=r,this.options=n,this.connector=s,this.connectivityState=Lt.ConnectivityState.IDLE,this.transport=null,this.continueConnecting=!1,this.stateListeners=new Set,this.refcount=0,this.channelzEnabled=!0,this.dataProducers=new Map,this.subchannelChannel=null;let a={initialDelay:n["grpc.initial_reconnect_backoff_ms"],maxDelay:n["grpc.max_reconnect_backoff_ms"]};this.backoffTimeout=new nPt.BackoffTimeout(()=>{this.handleBackoffTimer()},a),this.backoffTimeout.unref(),this.subchannelAddressString=(0,sPt.subchannelAddressToString)(r),this.keepaliveTime=(o=n["grpc.keepalive_time_ms"])!==null&&o!==void 0?o:-1,n["grpc.enable_channelz"]===0?(this.channelzEnabled=!1,this.channelzTrace=new Ia.ChannelzTraceStub,this.callTracker=new Ia.ChannelzCallTrackerStub,this.childrenTracker=new Ia.ChannelzChildrenTrackerStub,this.streamTracker=new Ia.ChannelzCallTrackerStub):(this.channelzTrace=new Ia.ChannelzTrace,this.callTracker=new Ia.ChannelzCallTracker,this.childrenTracker=new Ia.ChannelzChildrenTracker,this.streamTracker=new Ia.ChannelzCallTracker),this.channelzRef=(0,Ia.registerChannelzSubchannel)(this.subchannelAddressString,()=>this.getChannelzInfo(),this.channelzEnabled),this.channelzTrace.addTrace("CT_INFO","Subchannel created"),this.trace("Subchannel constructed with options "+JSON.stringify(n,void 0,2)),this.secureConnector=i._createSecureConnector(e,n)}getChannelzInfo(){return{state:this.connectivityState,trace:this.channelzTrace,callTracker:this.callTracker,children:this.childrenTracker.getChildLists(),target:this.subchannelAddressString}}trace(e){$8.trace(iL.LogVerbosity.DEBUG,aPt,"("+this.channelzRef.id+") "+this.subchannelAddressString+" "+e)}refTrace(e){$8.trace(iL.LogVerbosity.DEBUG,"subchannel_refcount","("+this.channelzRef.id+") "+this.subchannelAddressString+" "+e)}handleBackoffTimer(){this.continueConnecting?this.transitionToState([Lt.ConnectivityState.TRANSIENT_FAILURE],Lt.ConnectivityState.CONNECTING):this.transitionToState([Lt.ConnectivityState.TRANSIENT_FAILURE],Lt.ConnectivityState.IDLE)}startBackoff(){this.backoffTimeout.runOnce()}stopBackoff(){this.backoffTimeout.stop(),this.backoffTimeout.reset()}startConnectingInternal(){let e=this.options;if(e["grpc.keepalive_time_ms"]){let r=Math.min(this.keepaliveTime,cPt);e=Object.assign(Object.assign({},e),{"grpc.keepalive_time_ms":r})}this.connector.connect(this.subchannelAddress,this.secureConnector,e).then(r=>{this.transitionToState([Lt.ConnectivityState.CONNECTING],Lt.ConnectivityState.READY)?(this.transport=r,this.channelzEnabled&&this.childrenTracker.refChild(r.getChannelzRef()),r.addDisconnectListener(n=>{this.transitionToState([Lt.ConnectivityState.READY],Lt.ConnectivityState.IDLE),n&&this.keepaliveTime>0&&(this.keepaliveTime*=2,$8.log(iL.LogVerbosity.ERROR,`Connection to ${(0,iPt.uriToString)(this.channelTarget)} at ${this.subchannelAddressString} rejected by server because of excess pings. Increasing ping interval to ${this.keepaliveTime} ms`))})):r.shutdown()},r=>{this.transitionToState([Lt.ConnectivityState.CONNECTING],Lt.ConnectivityState.TRANSIENT_FAILURE,`${r}`)})}transitionToState(e,r,n){var i,s;if(e.indexOf(this.connectivityState)===-1)return!1;n?this.trace(Lt.ConnectivityState[this.connectivityState]+" -> "+Lt.ConnectivityState[r]+' with error "'+n+'"'):this.trace(Lt.ConnectivityState[this.connectivityState]+" -> "+Lt.ConnectivityState[r]),this.channelzEnabled&&this.channelzTrace.addTrace("CT_INFO","Connectivity state change to "+Lt.ConnectivityState[r]);let o=this.connectivityState;switch(this.connectivityState=r,r){case Lt.ConnectivityState.READY:this.stopBackoff();break;case Lt.ConnectivityState.CONNECTING:this.startBackoff(),this.startConnectingInternal(),this.continueConnecting=!1;break;case Lt.ConnectivityState.TRANSIENT_FAILURE:this.channelzEnabled&&this.transport&&this.childrenTracker.unrefChild(this.transport.getChannelzRef()),(i=this.transport)===null||i===void 0||i.shutdown(),this.transport=null,this.backoffTimeout.isRunning()||process.nextTick(()=>{this.handleBackoffTimer()});break;case Lt.ConnectivityState.IDLE:this.channelzEnabled&&this.transport&&this.childrenTracker.unrefChild(this.transport.getChannelzRef()),(s=this.transport)===null||s===void 0||s.shutdown(),this.transport=null;break;default:throw new Error(`Invalid state: unknown ConnectivityState ${r}`)}for(let a of this.stateListeners)a(this,o,r,this.keepaliveTime,n);return!0}ref(){this.refTrace("refcount "+this.refcount+" -> "+(this.refcount+1)),this.refcount+=1}unref(){this.refTrace("refcount "+this.refcount+" -> "+(this.refcount-1)),this.refcount-=1,this.refcount===0&&(this.channelzTrace.addTrace("CT_INFO","Shutting down"),(0,Ia.unregisterChannelzRef)(this.channelzRef),this.secureConnector.destroy(),process.nextTick(()=>{this.transitionToState([Lt.ConnectivityState.CONNECTING,Lt.ConnectivityState.READY],Lt.ConnectivityState.IDLE)}))}unrefIfOneRef(){return this.refcount===1?(this.unref(),!0):!1}createCall(e,r,n,i){if(!this.transport)throw new Error("Cannot create call, subchannel not READY");let s;return this.channelzEnabled?(this.callTracker.addCallStarted(),this.streamTracker.addCallStarted(),s={onCallEnd:o=>{o.code===iL.Status.OK?this.callTracker.addCallSucceeded():this.callTracker.addCallFailed()}}):s={},this.transport.createCall(e,r,n,i,s)}startConnecting(){process.nextTick(()=>{this.transitionToState([Lt.ConnectivityState.IDLE],Lt.ConnectivityState.CONNECTING)||this.connectivityState===Lt.ConnectivityState.TRANSIENT_FAILURE&&(this.continueConnecting=!0)})}getConnectivityState(){return this.connectivityState}addConnectivityStateListener(e){this.stateListeners.add(e)}removeConnectivityStateListener(e){this.stateListeners.delete(e)}resetBackoff(){process.nextTick(()=>{this.backoffTimeout.reset(),this.transitionToState([Lt.ConnectivityState.TRANSIENT_FAILURE],Lt.ConnectivityState.CONNECTING)})}getAddress(){return this.subchannelAddressString}getChannelzRef(){return this.channelzRef}isHealthy(){return!0}addHealthStateWatcher(e){}removeHealthStateWatcher(e){}getRealSubchannel(){return this}realSubchannelEquals(e){return e.getRealSubchannel()===this}throttleKeepalive(e){e>this.keepaliveTime&&(this.keepaliveTime=e)}getCallCredentials(){return this.secureConnector.getCallCredentials()}getChannel(){return this.subchannelChannel||(this.subchannelChannel=new oPt.SingleSubchannelChannel(this,this.channelTarget,this.options)),this.subchannelChannel}addDataWatcher(e){throw new Error("Not implemented")}getOrCreateDataProducer(e,r){let n=this.dataProducers.get(e);if(n)return n;let i=r(this);return this.dataProducers.set(e,i),i}removeDataProducer(e){this.dataProducers.delete(e)}};sL.Subchannel=L8});var wke=E(oL=>{"use strict";var D8;Object.defineProperty(oL,"__esModule",{value:!0});oL.GRPC_NODE_USE_ALTERNATIVE_RESOLVER=void 0;oL.GRPC_NODE_USE_ALTERNATIVE_RESOLVER=((D8=process.env.GRPC_NODE_USE_ALTERNATIVE_RESOLVER)!==null&&D8!==void 0?D8:"false")==="true"});var j8=E(wp=>{"use strict";Object.defineProperty(wp,"__esModule",{value:!0});wp.DEFAULT_PORT=void 0;wp.setup=gPt;var Ake=co(),M8=W("dns"),lPt=$K(),U8=st(),Z_=fp(),uPt=Vr(),dPt=qt(),fPt=st(),Ju=ei(),Rke=W("net"),pPt=O_(),xke=wke(),hPt="dns_resolver";function Oa(t){dPt.trace(fPt.LogVerbosity.DEBUG,hPt,t)}wp.DEFAULT_PORT=443;var mPt=3e4,F8=class{constructor(e,r,n){var i,s,o;this.target=e,this.listener=r,this.pendingLookupPromise=null,this.pendingTxtPromise=null,this.latestLookupResult=null,this.latestServiceConfigResult=null,this.continueResolving=!1,this.isNextResolutionTimerRunning=!1,this.isServiceConfigEnabled=!0,this.returnedIpResult=!1,this.alternativeResolver=new M8.promises.Resolver,Oa("Resolver constructed for target "+(0,Ju.uriToString)(e)),e.authority&&this.alternativeResolver.setServers([e.authority]);let a=(0,Ju.splitHostPort)(e.path);a===null?(this.ipResult=null,this.dnsHostname=null,this.port=null):(0,Rke.isIPv4)(a.host)||(0,Rke.isIPv6)(a.host)?(this.ipResult=[{addresses:[{host:a.host,port:(i=a.port)!==null&&i!==void 0?i:wp.DEFAULT_PORT}]}],this.dnsHostname=null,this.port=null):(this.ipResult=null,this.dnsHostname=a.host,this.port=(s=a.port)!==null&&s!==void 0?s:wp.DEFAULT_PORT),this.percentage=Math.random()*100,n["grpc.service_config_disable_resolution"]===1&&(this.isServiceConfigEnabled=!1),this.defaultResolutionError={code:U8.Status.UNAVAILABLE,details:`Name resolution failed for target ${(0,Ju.uriToString)(this.target)}`,metadata:new uPt.Metadata};let c={initialDelay:n["grpc.initial_reconnect_backoff_ms"],maxDelay:n["grpc.max_reconnect_backoff_ms"]};this.backoff=new pPt.BackoffTimeout(()=>{this.continueResolving&&this.startResolutionWithBackoff()},c),this.backoff.unref(),this.minTimeBetweenResolutionsMs=(o=n["grpc.dns_min_time_between_resolutions_ms"])!==null&&o!==void 0?o:mPt,this.nextResolutionTimer=setTimeout(()=>{},0),clearTimeout(this.nextResolutionTimer)}startResolution(){if(this.ipResult!==null){this.returnedIpResult||(Oa("Returning IP address for target "+(0,Ju.uriToString)(this.target)),setImmediate(()=>{this.listener((0,Z_.statusOrFromValue)(this.ipResult),{},null,"")}),this.returnedIpResult=!0),this.backoff.stop(),this.backoff.reset(),this.stopNextResolutionTimer();return}if(this.dnsHostname===null)Oa("Failed to parse DNS address "+(0,Ju.uriToString)(this.target)),setImmediate(()=>{this.listener((0,Z_.statusOrFromError)({code:U8.Status.UNAVAILABLE,details:`Failed to parse DNS address ${(0,Ju.uriToString)(this.target)}`}),{},null,"")}),this.stopNextResolutionTimer();else{if(this.pendingLookupPromise!==null)return;Oa("Looking up DNS hostname "+this.dnsHostname),this.latestLookupResult=null;let e=this.dnsHostname;this.pendingLookupPromise=this.lookup(e),this.pendingLookupPromise.then(r=>{if(this.pendingLookupPromise===null)return;this.pendingLookupPromise=null,this.latestLookupResult=(0,Z_.statusOrFromValue)(r.map(s=>({addresses:[s]})));let n="["+r.map(s=>s.host+":"+s.port).join(",")+"]";Oa("Resolved addresses for target "+(0,Ju.uriToString)(this.target)+": "+n);let i=this.listener(this.latestLookupResult,{},this.latestServiceConfigResult,"");this.handleHealthStatus(i)},r=>{this.pendingLookupPromise!==null&&(Oa("Resolution error for target "+(0,Ju.uriToString)(this.target)+": "+r.message),this.pendingLookupPromise=null,this.stopNextResolutionTimer(),this.listener((0,Z_.statusOrFromError)(this.defaultResolutionError),{},this.latestServiceConfigResult,""))}),this.isServiceConfigEnabled&&this.pendingTxtPromise===null&&(this.pendingTxtPromise=this.resolveTxt(e),this.pendingTxtPromise.then(r=>{if(this.pendingTxtPromise===null)return;this.pendingTxtPromise=null;let n;try{n=(0,lPt.extractAndSelectServiceConfig)(r,this.percentage),n?this.latestServiceConfigResult=(0,Z_.statusOrFromValue)(n):this.latestServiceConfigResult=null}catch(i){this.latestServiceConfigResult=(0,Z_.statusOrFromError)({code:U8.Status.UNAVAILABLE,details:`Parsing service config failed with error ${i.message}`})}this.latestLookupResult!==null&&this.listener(this.latestLookupResult,{},this.latestServiceConfigResult,"")},r=>{}))}}handleHealthStatus(e){e?(this.backoff.stop(),this.backoff.reset()):this.continueResolving=!0}async lookup(e){if(xke.GRPC_NODE_USE_ALTERNATIVE_RESOLVER){Oa("Using alternative DNS resolver.");let n=await Promise.allSettled([this.alternativeResolver.resolve4(e),this.alternativeResolver.resolve6(e)]);if(n.every(i=>i.status==="rejected"))throw new Error(n[0].reason);return n.reduce((i,s)=>s.status==="fulfilled"?[...i,...s.value]:i,[]).map(i=>({host:i,port:+this.port}))}return(await M8.promises.lookup(e,{all:!0})).map(n=>({host:n.address,port:+this.port}))}async resolveTxt(e){return xke.GRPC_NODE_USE_ALTERNATIVE_RESOLVER?(Oa("Using alternative DNS resolver."),this.alternativeResolver.resolveTxt(e)):M8.promises.resolveTxt(e)}startNextResolutionTimer(){var e,r;clearTimeout(this.nextResolutionTimer),this.nextResolutionTimer=setTimeout(()=>{this.stopNextResolutionTimer(),this.continueResolving&&this.startResolutionWithBackoff()},this.minTimeBetweenResolutionsMs),(r=(e=this.nextResolutionTimer).unref)===null||r===void 0||r.call(e),this.isNextResolutionTimerRunning=!0}stopNextResolutionTimer(){clearTimeout(this.nextResolutionTimer),this.isNextResolutionTimerRunning=!1}startResolutionWithBackoff(){this.pendingLookupPromise===null&&(this.continueResolving=!1,this.backoff.runOnce(),this.startNextResolutionTimer(),this.startResolution())}updateResolution(){this.pendingLookupPromise===null&&(this.isNextResolutionTimerRunning||this.backoff.isRunning()?(this.isNextResolutionTimerRunning?Oa('resolution update delayed by "min time between resolutions" rate limit'):Oa("resolution update delayed by backoff timer until "+this.backoff.getEndTime().toISOString()),this.continueResolving=!0):this.startResolutionWithBackoff())}destroy(){this.continueResolving=!1,this.backoff.reset(),this.backoff.stop(),this.stopNextResolutionTimer(),this.pendingLookupPromise=null,this.pendingTxtPromise=null,this.latestLookupResult=null,this.latestServiceConfigResult=null,this.returnedIpResult=!1}static getDefaultAuthority(e){return e.path}};function gPt(){(0,Ake.registerResolver)("dns",F8),(0,Ake.registerDefaultScheme)("dns")}});var q8=E(Tw=>{"use strict";Object.defineProperty(Tw,"__esModule",{value:!0});Tw.parseCIDR=Pke;Tw.mapProxyName=RPt;Tw.getProxiedConnection=xPt;var vw=qt(),X_=st(),Oke=W("net"),_Pt=W("http"),yPt=qt(),Ike=Ti(),bw=ei(),SPt=W("url"),EPt=j8(),vPt="proxy";function Q_(t){yPt.trace(X_.LogVerbosity.DEBUG,vPt,t)}function bPt(){let t="",e="";if(process.env.grpc_proxy)e="grpc_proxy",t=process.env.grpc_proxy;else if(process.env.https_proxy)e="https_proxy",t=process.env.https_proxy;else if(process.env.http_proxy)e="http_proxy",t=process.env.http_proxy;else return{};let r;try{r=new SPt.URL(t)}catch{return(0,vw.log)(X_.LogVerbosity.ERROR,`cannot parse value of "${e}" env var`),{}}if(r.protocol!=="http:")return(0,vw.log)(X_.LogVerbosity.ERROR,`"${r.protocol}" scheme not supported in proxy URI`),{};let n=null;r.username&&(r.password?((0,vw.log)(X_.LogVerbosity.INFO,"userinfo found in proxy URI"),n=decodeURIComponent(`${r.username}:${r.password}`)):n=r.username);let i=r.hostname,s=r.port;s===""&&(s="80");let o={address:`${i}:${s}`};return n&&(o.creds=n),Q_("Proxy server "+o.address+" set by environment variable "+e),o}function TPt(){let t=process.env.no_grpc_proxy,e="no_grpc_proxy";return t||(t=process.env.no_proxy,e="no_proxy"),t?(Q_("No proxy server list set by environment variable "+e),t.split(",")):[]}function Pke(t){let e=t.split("/");if(e.length!==2)return null;let r=parseInt(e[1],10);return!(0,Oke.isIPv4)(e[0])||Number.isNaN(r)||r<0||r>32?null:{ip:Cke(e[0]),prefixLength:r}}function Cke(t){return t.split(".").reduce((e,r)=>(e<<8)+parseInt(r,10),0)}function wPt(t,e){let r=t.ip,n=-1<<32-t.prefixLength;return(Cke(e)&n)===(r&n)}function APt(t){for(let e of TPt()){let r=Pke(e);if((0,Oke.isIPv4)(t)&&r&&wPt(r,t))return!0;if(t.endsWith(e))return!0}return!1}function RPt(t,e){var r;let n={target:t,extraOptions:{}};if(((r=e["grpc.enable_http_proxy"])!==null&&r!==void 0?r:1)===0||t.scheme==="unix")return n;let i=bPt();if(!i.address)return n;let s=(0,bw.splitHostPort)(t.path);if(!s)return n;let o=s.host;if(APt(o))return Q_("Not using proxy for target in no_proxy list: "+(0,bw.uriToString)(t)),n;let a={"grpc.http_connect_target":(0,bw.uriToString)(t)};return i.creds&&(a["grpc.http_connect_creds"]=i.creds),{target:{scheme:"dns",path:i.address},extraOptions:a}}function xPt(t,e){var r;if(!("grpc.http_connect_target"in e))return Promise.resolve(null);let n=e["grpc.http_connect_target"],i=(0,bw.parseUri)(n);if(i===null)return Promise.resolve(null);let s=(0,bw.splitHostPort)(i.path);if(s===null)return Promise.resolve(null);let o=`${s.host}:${(r=s.port)!==null&&r!==void 0?r:EPt.DEFAULT_PORT}`,a={method:"CONNECT",path:o},c={Host:o};(0,Ike.isTcpSubchannelAddress)(t)?(a.host=t.host,a.port=t.port):a.socketPath=t.path,"grpc.http_connect_creds"in e&&(c["Proxy-Authorization"]="Basic "+Buffer.from(e["grpc.http_connect_creds"]).toString("base64")),a.headers=c;let l=(0,Ike.subchannelAddressToString)(t);return Q_("Using proxy "+l+" to connect to "+a.path),new Promise((u,d)=>{let f=_Pt.request(a);f.once("connect",(p,h,m)=>{f.removeAllListeners(),h.removeAllListeners(),p.statusCode===200?(Q_("Successfully connected to "+a.path+" through proxy "+l),m.length>0&&h.unshift(m),Q_("Successfully established a plaintext connection to "+a.path+" through proxy "+l),u(h)):((0,vw.log)(X_.LogVerbosity.ERROR,"Failed to connect to "+a.path+" through proxy "+l+" with status "+p.statusCode),d())}),f.once("error",p=>{f.removeAllListeners(),(0,vw.log)(X_.LogVerbosity.ERROR,"Failed to connect to proxy "+l+" with error "+p.message),d()}),f.end()})}});var z8=E(aL=>{"use strict";Object.defineProperty(aL,"__esModule",{value:!0});aL.StreamDecoder=void 0;var Pa;(function(t){t[t.NO_DATA=0]="NO_DATA",t[t.READING_SIZE=1]="READING_SIZE",t[t.READING_MESSAGE=2]="READING_MESSAGE"})(Pa||(Pa={}));var B8=class{constructor(e){this.maxReadMessageLength=e,this.readState=Pa.NO_DATA,this.readCompressFlag=Buffer.alloc(1),this.readPartialSize=Buffer.alloc(4),this.readSizeRemaining=4,this.readMessageSize=0,this.readPartialMessage=[],this.readMessageRemaining=0}write(e){let r=0,n,i=[];for(;r<e.length;)switch(this.readState){case Pa.NO_DATA:this.readCompressFlag=e.slice(r,r+1),r+=1,this.readState=Pa.READING_SIZE,this.readPartialSize.fill(0),this.readSizeRemaining=4,this.readMessageSize=0,this.readMessageRemaining=0,this.readPartialMessage=[];break;case Pa.READING_SIZE:if(n=Math.min(e.length-r,this.readSizeRemaining),e.copy(this.readPartialSize,4-this.readSizeRemaining,r,r+n),this.readSizeRemaining-=n,r+=n,this.readSizeRemaining===0){if(this.readMessageSize=this.readPartialSize.readUInt32BE(0),this.maxReadMessageLength!==-1&&this.readMessageSize>this.maxReadMessageLength)throw new Error(`Received message larger than max (${this.readMessageSize} vs ${this.maxReadMessageLength})`);if(this.readMessageRemaining=this.readMessageSize,this.readMessageRemaining>0)this.readState=Pa.READING_MESSAGE;else{let s=Buffer.concat([this.readCompressFlag,this.readPartialSize],5);this.readState=Pa.NO_DATA,i.push(s)}}break;case Pa.READING_MESSAGE:if(n=Math.min(e.length-r,this.readMessageRemaining),this.readPartialMessage.push(e.slice(r,r+n)),this.readMessageRemaining-=n,r+=n,this.readMessageRemaining===0){let s=[this.readCompressFlag,this.readPartialSize].concat(this.readPartialMessage),o=Buffer.concat(s,this.readMessageSize+5);this.readState=Pa.NO_DATA,i.push(o)}break;default:throw new Error("Unexpected read state")}return i}};aL.StreamDecoder=B8});var Nke=E(cL=>{"use strict";Object.defineProperty(cL,"__esModule",{value:!0});cL.Http2SubchannelCall=void 0;var Jc=W("http2"),IPt=W("os"),Dt=st(),Zc=Vr(),OPt=z8(),PPt=qt(),CPt=st(),NPt="subchannel_call";function kPt(t){for(let[e,r]of Object.entries(IPt.constants.errno))if(r===t)return e;return"Unknown system error "+t}function V8(t){let e=`Received HTTP status code ${t}`,r;switch(t){case 400:r=Dt.Status.INTERNAL;break;case 401:r=Dt.Status.UNAUTHENTICATED;break;case 403:r=Dt.Status.PERMISSION_DENIED;break;case 404:r=Dt.Status.UNIMPLEMENTED;break;case 429:case 502:case 503:case 504:r=Dt.Status.UNAVAILABLE;break;default:r=Dt.Status.UNKNOWN}return{code:r,details:e,metadata:new Zc.Metadata}}var H8=class{constructor(e,r,n,i,s){var o;this.http2Stream=e,this.callEventTracker=r,this.listener=n,this.transport=i,this.callId=s,this.isReadFilterPending=!1,this.isPushPending=!1,this.canPush=!1,this.readsClosed=!1,this.statusOutput=!1,this.unpushedReadMessages=[],this.finalStatus=null,this.internalError=null,this.serverEndedCall=!1,this.connectionDropped=!1;let a=(o=i.getOptions()["grpc.max_receive_message_length"])!==null&&o!==void 0?o:Dt.DEFAULT_MAX_RECEIVE_MESSAGE_LENGTH;this.decoder=new OPt.StreamDecoder(a),e.on("response",(c,l)=>{let u="";for(let d of Object.keys(c))u+=" "+d+": "+c[d]+`
387
387
  `;if(this.trace(`Received server headers:
388
388
  `+u),this.httpStatusCode=c[":status"],l&Jc.constants.NGHTTP2_FLAG_END_STREAM)this.handleTrailers(c);else{let d;try{d=Zc.Metadata.fromHttp2Headers(c)}catch(f){this.endCall({code:Dt.Status.UNKNOWN,details:f.message,metadata:new Zc.Metadata});return}this.listener.onReceiveMetadata(d)}}),e.on("trailers",c=>{this.handleTrailers(c)}),e.on("data",c=>{if(this.statusOutput)return;this.trace("receive HTTP/2 data frame of length "+c.length);let l;try{l=this.decoder.write(c)}catch(u){if(this.httpStatusCode!==void 0&&this.httpStatusCode!==200){let d=V8(this.httpStatusCode);this.cancelWithStatus(d.code,d.details)}else this.cancelWithStatus(Dt.Status.RESOURCE_EXHAUSTED,u.message);return}for(let u of l)this.trace("parsed message of length "+u.length),this.callEventTracker.addMessageReceived(),this.tryPush(u)}),e.on("end",()=>{this.readsClosed=!0,this.maybeOutputStatus()}),e.on("close",()=>{this.serverEndedCall=!0,process.nextTick(()=>{var c;if(this.trace("HTTP/2 stream closed with code "+e.rstCode),((c=this.finalStatus)===null||c===void 0?void 0:c.code)===Dt.Status.OK)return;let l,u="";switch(e.rstCode){case Jc.constants.NGHTTP2_NO_ERROR:if(this.finalStatus!==null)return;if(this.httpStatusCode&&this.httpStatusCode!==200){let d=V8(this.httpStatusCode);l=d.code,u=d.details}else l=Dt.Status.INTERNAL,u=`Received RST_STREAM with code ${e.rstCode} (Call ended without gRPC status)`;break;case Jc.constants.NGHTTP2_REFUSED_STREAM:l=Dt.Status.UNAVAILABLE,u="Stream refused by server";break;case Jc.constants.NGHTTP2_CANCEL:this.connectionDropped?(l=Dt.Status.UNAVAILABLE,u="Connection dropped"):(l=Dt.Status.CANCELLED,u="Call cancelled");break;case Jc.constants.NGHTTP2_ENHANCE_YOUR_CALM:l=Dt.Status.RESOURCE_EXHAUSTED,u="Bandwidth exhausted or memory limit exceeded";break;case Jc.constants.NGHTTP2_INADEQUATE_SECURITY:l=Dt.Status.PERMISSION_DENIED,u="Protocol not secure enough";break;case Jc.constants.NGHTTP2_INTERNAL_ERROR:l=Dt.Status.INTERNAL,this.internalError===null?u=`Received RST_STREAM with code ${e.rstCode} (Internal server error)`:this.internalError.code==="ECONNRESET"||this.internalError.code==="ETIMEDOUT"?(l=Dt.Status.UNAVAILABLE,u=this.internalError.message):u=`Received RST_STREAM with code ${e.rstCode} triggered by internal client error: ${this.internalError.message}`;break;default:l=Dt.Status.INTERNAL,u=`Received RST_STREAM with code ${e.rstCode}`}this.endCall({code:l,details:u,metadata:new Zc.Metadata,rstCode:e.rstCode})})}),e.on("error",c=>{c.code!=="ERR_HTTP2_STREAM_ERROR"&&(this.trace("Node error event: message="+c.message+" code="+c.code+" errno="+kPt(c.errno)+" syscall="+c.syscall),this.internalError=c),this.callEventTracker.onStreamEnd(!1)})}getDeadlineInfo(){return[`remote_addr=${this.getPeer()}`]}onDisconnect(){this.connectionDropped=!0,setImmediate(()=>{this.endCall({code:Dt.Status.UNAVAILABLE,details:"Connection dropped",metadata:new Zc.Metadata})})}outputStatus(){this.statusOutput||(this.statusOutput=!0,this.trace("ended with status: code="+this.finalStatus.code+' details="'+this.finalStatus.details+'"'),this.callEventTracker.onCallEnd(this.finalStatus),process.nextTick(()=>{this.listener.onReceiveStatus(this.finalStatus)}),this.http2Stream.resume())}trace(e){PPt.trace(CPt.LogVerbosity.DEBUG,NPt,"["+this.callId+"] "+e)}endCall(e){(this.finalStatus===null||this.finalStatus.code===Dt.Status.OK)&&(this.finalStatus=e,this.maybeOutputStatus()),this.destroyHttp2Stream()}maybeOutputStatus(){this.finalStatus!==null&&(this.finalStatus.code!==Dt.Status.OK||this.readsClosed&&this.unpushedReadMessages.length===0&&!this.isReadFilterPending&&!this.isPushPending)&&this.outputStatus()}push(e){this.trace("pushing to reader message of length "+(e instanceof Buffer?e.length:null)),this.canPush=!1,this.isPushPending=!0,process.nextTick(()=>{this.isPushPending=!1,!this.statusOutput&&(this.listener.onReceiveMessage(e),this.maybeOutputStatus())})}tryPush(e){this.canPush?(this.http2Stream.pause(),this.push(e)):(this.trace("unpushedReadMessages.push message of length "+e.length),this.unpushedReadMessages.push(e))}handleTrailers(e){this.serverEndedCall=!0,this.callEventTracker.onStreamEnd(!0);let r="";for(let o of Object.keys(e))r+=" "+o+": "+e[o]+`
389
389
  `;this.trace(`Received server trailers:
390
390
  `+r);let n;try{n=Zc.Metadata.fromHttp2Headers(e)}catch{n=new Zc.Metadata}let i=n.getMap(),s;if(typeof i["grpc-status"]=="string"){let o=Number(i["grpc-status"]);this.trace("received status code "+o+" from server"),n.remove("grpc-status");let a="";if(typeof i["grpc-message"]=="string"){try{a=decodeURI(i["grpc-message"])}catch{a=i["grpc-message"]}n.remove("grpc-message"),this.trace('received status details string "'+a+'" from server')}s={code:o,details:a,metadata:n}}else this.httpStatusCode?(s=V8(this.httpStatusCode),s.metadata=n):s={code:Dt.Status.UNKNOWN,details:"No status information received",metadata:n};this.endCall(s)}destroyHttp2Stream(){var e;if(!this.http2Stream.destroyed)if(this.serverEndedCall)this.http2Stream.end();else{let r;((e=this.finalStatus)===null||e===void 0?void 0:e.code)===Dt.Status.OK?r=Jc.constants.NGHTTP2_NO_ERROR:r=Jc.constants.NGHTTP2_CANCEL,this.trace("close http2 stream with code "+r),this.http2Stream.close(r)}}cancelWithStatus(e,r){this.trace("cancelWithStatus code: "+e+' details: "'+r+'"'),this.endCall({code:e,details:r,metadata:new Zc.Metadata})}getStatus(){return this.finalStatus}getPeer(){return this.transport.getPeerName()}getCallNumber(){return this.callId}getAuthContext(){return this.transport.getAuthContext()}startRead(){if(this.finalStatus!==null&&this.finalStatus.code!==Dt.Status.OK){this.readsClosed=!0,this.maybeOutputStatus();return}if(this.canPush=!0,this.unpushedReadMessages.length>0){let e=this.unpushedReadMessages.shift();this.push(e);return}this.http2Stream.resume()}sendMessageWithContext(e,r){this.trace("write() called with message of length "+r.length);let n=i=>{process.nextTick(()=>{var s;let o=Dt.Status.UNAVAILABLE;i?.code==="ERR_STREAM_WRITE_AFTER_END"&&(o=Dt.Status.INTERNAL),i&&this.cancelWithStatus(o,`Write error: ${i.message}`),(s=e.callback)===null||s===void 0||s.call(e)})};this.trace("sending data chunk of length "+r.length),this.callEventTracker.addMessageSent();try{this.http2Stream.write(r,n)}catch(i){this.endCall({code:Dt.Status.UNAVAILABLE,details:`Write failed with error ${i.message}`,metadata:new Zc.Metadata})}}halfClose(){this.trace("end() called"),this.trace("calling end() on HTTP/2 stream"),this.http2Stream.end()}};cL.Http2SubchannelCall=H8});var kke=E(dL=>{"use strict";Object.defineProperty(dL,"__esModule",{value:!0});dL.Http2SubchannelConnector=void 0;var Ap=W("http2"),$Pt=W("tls"),lL=Yu(),ww=st(),LPt=q8(),ey=qt(),DPt=co(),uL=Ti(),G8=ei(),MPt=W("net"),UPt=Nke(),FPt=K$(),W8="transport",jPt="transport_flowctrl",qPt=hK().version,{HTTP2_HEADER_AUTHORITY:BPt,HTTP2_HEADER_CONTENT_TYPE:zPt,HTTP2_HEADER_METHOD:VPt,HTTP2_HEADER_PATH:HPt,HTTP2_HEADER_TE:GPt,HTTP2_HEADER_USER_AGENT:WPt}=Ap.constants,YPt=2e4,KPt=Buffer.from("too_many_pings","ascii"),Y8=class{constructor(e,r,n,i){this.session=e,this.options=n,this.remoteName=i,this.keepaliveTimer=null,this.pendingSendKeepalivePing=!1,this.activeCalls=new Set,this.disconnectListeners=[],this.disconnectHandled=!1,this.channelzEnabled=!0,this.keepalivesSent=0,this.messagesSent=0,this.messagesReceived=0,this.lastMessageSentTimestamp=null,this.lastMessageReceivedTimestamp=null,this.subchannelAddressString=(0,uL.subchannelAddressToString)(r),n["grpc.enable_channelz"]===0?(this.channelzEnabled=!1,this.streamTracker=new lL.ChannelzCallTrackerStub):this.streamTracker=new lL.ChannelzCallTracker,this.channelzRef=(0,lL.registerChannelzSocket)(this.subchannelAddressString,()=>this.getChannelzInfo(),this.channelzEnabled),this.userAgent=[n["grpc.primary_user_agent"],`grpc-node-js/${qPt}`,n["grpc.secondary_user_agent"]].filter(s=>s).join(" "),"grpc.keepalive_time_ms"in n?this.keepaliveTimeMs=n["grpc.keepalive_time_ms"]:this.keepaliveTimeMs=-1,"grpc.keepalive_timeout_ms"in n?this.keepaliveTimeoutMs=n["grpc.keepalive_timeout_ms"]:this.keepaliveTimeoutMs=YPt,"grpc.keepalive_permit_without_calls"in n?this.keepaliveWithoutCalls=n["grpc.keepalive_permit_without_calls"]===1:this.keepaliveWithoutCalls=!1,e.once("close",()=>{this.trace("session closed"),this.handleDisconnect()}),e.once("goaway",(s,o,a)=>{let c=!1;s===Ap.constants.NGHTTP2_ENHANCE_YOUR_CALM&&a&&a.equals(KPt)&&(c=!0),this.trace("connection closed by GOAWAY with code "+s+" and data "+a?.toString()),this.reportDisconnectToOwner(c)}),e.once("error",s=>{this.trace("connection closed with error "+s.message),this.handleDisconnect()}),e.socket.once("close",s=>{this.trace("connection closed. hadError="+s),this.handleDisconnect()}),ey.isTracerEnabled(W8)&&(e.on("remoteSettings",s=>{this.trace("new settings received"+(this.session!==e?" on the old connection":"")+": "+JSON.stringify(s))}),e.on("localSettings",s=>{this.trace("local settings acknowledged by remote"+(this.session!==e?" on the old connection":"")+": "+JSON.stringify(s))})),this.keepaliveWithoutCalls&&this.maybeStartKeepalivePingTimer(),e.socket instanceof $Pt.TLSSocket?this.authContext={transportSecurityType:"ssl",sslPeerCertificate:e.socket.getPeerCertificate()}:this.authContext={}}getChannelzInfo(){var e,r,n;let i=this.session.socket,s=i.remoteAddress?(0,uL.stringToSubchannelAddress)(i.remoteAddress,i.remotePort):null,o=i.localAddress?(0,uL.stringToSubchannelAddress)(i.localAddress,i.localPort):null,a;if(this.session.encrypted){let l=i,u=l.getCipher(),d=l.getCertificate(),f=l.getPeerCertificate();a={cipherSuiteStandardName:(e=u.standardName)!==null&&e!==void 0?e:null,cipherSuiteOtherName:u.standardName?null:u.name,localCertificate:d&&"raw"in d?d.raw:null,remoteCertificate:f&&"raw"in f?f.raw:null}}else a=null;return{remoteAddress:s,localAddress:o,security:a,remoteName:this.remoteName,streamsStarted:this.streamTracker.callsStarted,streamsSucceeded:this.streamTracker.callsSucceeded,streamsFailed:this.streamTracker.callsFailed,messagesSent:this.messagesSent,messagesReceived:this.messagesReceived,keepAlivesSent:this.keepalivesSent,lastLocalStreamCreatedTimestamp:this.streamTracker.lastCallStartedTimestamp,lastRemoteStreamCreatedTimestamp:null,lastMessageSentTimestamp:this.lastMessageSentTimestamp,lastMessageReceivedTimestamp:this.lastMessageReceivedTimestamp,localFlowControlWindow:(r=this.session.state.localWindowSize)!==null&&r!==void 0?r:null,remoteFlowControlWindow:(n=this.session.state.remoteWindowSize)!==null&&n!==void 0?n:null}}trace(e){ey.trace(ww.LogVerbosity.DEBUG,W8,"("+this.channelzRef.id+") "+this.subchannelAddressString+" "+e)}keepaliveTrace(e){ey.trace(ww.LogVerbosity.DEBUG,"keepalive","("+this.channelzRef.id+") "+this.subchannelAddressString+" "+e)}flowControlTrace(e){ey.trace(ww.LogVerbosity.DEBUG,jPt,"("+this.channelzRef.id+") "+this.subchannelAddressString+" "+e)}internalsTrace(e){ey.trace(ww.LogVerbosity.DEBUG,"transport_internals","("+this.channelzRef.id+") "+this.subchannelAddressString+" "+e)}reportDisconnectToOwner(e){this.disconnectHandled||(this.disconnectHandled=!0,this.disconnectListeners.forEach(r=>r(e)))}handleDisconnect(){this.clearKeepaliveTimeout(),this.reportDisconnectToOwner(!1);for(let e of this.activeCalls)e.onDisconnect();setImmediate(()=>{this.session.destroy()})}addDisconnectListener(e){this.disconnectListeners.push(e)}canSendPing(){return!this.session.destroyed&&this.keepaliveTimeMs>0&&(this.keepaliveWithoutCalls||this.activeCalls.size>0)}maybeSendPing(){var e,r;if(!this.canSendPing()){this.pendingSendKeepalivePing=!0;return}if(this.keepaliveTimer){console.error("keepaliveTimeout is not null");return}this.channelzEnabled&&(this.keepalivesSent+=1),this.keepaliveTrace("Sending ping with timeout "+this.keepaliveTimeoutMs+"ms"),this.keepaliveTimer=setTimeout(()=>{this.keepaliveTimer=null,this.keepaliveTrace("Ping timeout passed without response"),this.handleDisconnect()},this.keepaliveTimeoutMs),(r=(e=this.keepaliveTimer).unref)===null||r===void 0||r.call(e);let n="";try{this.session.ping((s,o,a)=>{this.clearKeepaliveTimeout(),s?(this.keepaliveTrace("Ping failed with error "+s.message),this.handleDisconnect()):(this.keepaliveTrace("Received ping response"),this.maybeStartKeepalivePingTimer())})||(n="Ping returned false")}catch(i){n=(i instanceof Error?i.message:"")||"Unknown error"}n&&(this.keepaliveTrace("Ping send failed: "+n),this.handleDisconnect())}maybeStartKeepalivePingTimer(){var e,r;this.canSendPing()&&(this.pendingSendKeepalivePing?(this.pendingSendKeepalivePing=!1,this.maybeSendPing()):this.keepaliveTimer||(this.keepaliveTrace("Starting keepalive timer for "+this.keepaliveTimeMs+"ms"),this.keepaliveTimer=setTimeout(()=>{this.keepaliveTimer=null,this.maybeSendPing()},this.keepaliveTimeMs),(r=(e=this.keepaliveTimer).unref)===null||r===void 0||r.call(e)))}clearKeepaliveTimeout(){this.keepaliveTimer&&(clearTimeout(this.keepaliveTimer),this.keepaliveTimer=null)}removeActiveCall(e){this.activeCalls.delete(e),this.activeCalls.size===0&&this.session.unref()}addActiveCall(e){this.activeCalls.add(e),this.activeCalls.size===1&&(this.session.ref(),this.keepaliveWithoutCalls||this.maybeStartKeepalivePingTimer())}createCall(e,r,n,i,s){let o=e.toHttp2Headers();o[BPt]=r,o[WPt]=this.userAgent,o[zPt]="application/grpc",o[VPt]="POST",o[HPt]=n,o[GPt]="trailers";let a;try{a=this.session.request(o)}catch(u){throw this.handleDisconnect(),u}this.flowControlTrace("local window size: "+this.session.state.localWindowSize+" remote window size: "+this.session.state.remoteWindowSize),this.internalsTrace("session.closed="+this.session.closed+" session.destroyed="+this.session.destroyed+" session.socket.destroyed="+this.session.socket.destroyed);let c,l;return this.channelzEnabled?(this.streamTracker.addCallStarted(),c={addMessageSent:()=>{var u;this.messagesSent+=1,this.lastMessageSentTimestamp=new Date,(u=s.addMessageSent)===null||u===void 0||u.call(s)},addMessageReceived:()=>{var u;this.messagesReceived+=1,this.lastMessageReceivedTimestamp=new Date,(u=s.addMessageReceived)===null||u===void 0||u.call(s)},onCallEnd:u=>{var d;(d=s.onCallEnd)===null||d===void 0||d.call(s,u),this.removeActiveCall(l)},onStreamEnd:u=>{var d;u?this.streamTracker.addCallSucceeded():this.streamTracker.addCallFailed(),(d=s.onStreamEnd)===null||d===void 0||d.call(s,u)}}):c={addMessageSent:()=>{var u;(u=s.addMessageSent)===null||u===void 0||u.call(s)},addMessageReceived:()=>{var u;(u=s.addMessageReceived)===null||u===void 0||u.call(s)},onCallEnd:u=>{var d;(d=s.onCallEnd)===null||d===void 0||d.call(s,u),this.removeActiveCall(l)},onStreamEnd:u=>{var d;(d=s.onStreamEnd)===null||d===void 0||d.call(s,u)}},l=new UPt.Http2SubchannelCall(a,c,i,this,(0,FPt.getNextCallNumber)()),this.addActiveCall(l),l}getChannelzRef(){return this.channelzRef}getPeerName(){return this.subchannelAddressString}getOptions(){return this.options}getAuthContext(){return this.authContext}shutdown(){this.session.close(),(0,lL.unregisterChannelzRef)(this.channelzRef)}},K8=class{constructor(e){this.channelTarget=e,this.session=null,this.isShutdown=!1}trace(e){ey.trace(ww.LogVerbosity.DEBUG,W8,(0,G8.uriToString)(this.channelTarget)+" "+e)}createSession(e,r,n){return this.isShutdown?Promise.reject():e.socket.closed?Promise.reject("Connection closed before starting HTTP/2 handshake"):new Promise((i,s)=>{var o,a,c,l,u,d,f,p;let h=null,m=this.channelTarget;if("grpc.http_connect_target"in n){let A=(0,G8.parseUri)(n["grpc.http_connect_target"]);A&&(m=A,h=(0,G8.uriToString)(A))}let _=e.secure?"https":"http",y=(0,DPt.getDefaultAuthority)(m),v=()=>{var A;(A=this.session)===null||A===void 0||A.destroy(),this.session=null,setImmediate(()=>{O||(O=!0,s(`${R.trim()} (${new Date().toISOString()})`))})},S=A=>{var b;(b=this.session)===null||b===void 0||b.destroy(),R=A.message,this.trace("connection failed with error "+R),O||(O=!0,s(`${R} (${new Date().toISOString()})`))},g={createConnection:(A,b)=>e.socket,settings:{initialWindowSize:(l=(o=n["grpc-node.flow_control_window"])!==null&&o!==void 0?o:(c=(a=Ap.getDefaultSettings)===null||a===void 0?void 0:a.call(Ap))===null||c===void 0?void 0:c.initialWindowSize)!==null&&l!==void 0?l:65535},maxSendHeaderBlockLength:Number.MAX_SAFE_INTEGER,maxSessionMemory:(u=n["grpc-node.max_session_memory"])!==null&&u!==void 0?u:Number.MAX_SAFE_INTEGER},T=Ap.connect(`${_}://${y}`,g),I=(p=(f=(d=Ap.getDefaultSettings)===null||d===void 0?void 0:d.call(Ap))===null||f===void 0?void 0:f.initialWindowSize)!==null&&p!==void 0?p:65535,x=n["grpc-node.flow_control_window"];this.session=T;let R="Failed to connect",O=!1;T.unref(),T.once("remoteSettings",()=>{var A;if(x&&x>I)try{T.setLocalWindowSize(x)}catch{let L=x-((A=T.state.localWindowSize)!==null&&A!==void 0?A:I);L>0&&T.incrementWindowSize(L)}T.removeAllListeners(),e.socket.removeListener("close",v),e.socket.removeListener("error",S),i(new Y8(T,r,n,h)),this.session=null}),T.once("close",v),T.once("error",S),e.socket.once("close",v),e.socket.once("error",S)})}tcpConnect(e,r){return(0,LPt.getProxiedConnection)(e,r).then(n=>n||new Promise((i,s)=>{let o=()=>{s(new Error("Socket closed"))},a=l=>{s(l)},c=MPt.connect(e,()=>{c.removeListener("close",o),c.removeListener("error",a),i(c)});c.once("close",o),c.once("error",a)}))}async connect(e,r,n){if(this.isShutdown)return Promise.reject();let i=null,s=null,o=(0,uL.subchannelAddressToString)(e);try{return this.trace(o+" Waiting for secureConnector to be ready"),await r.waitForReady(),this.trace(o+" secureConnector is ready"),i=await this.tcpConnect(e,n),i.setNoDelay(),this.trace(o+" Established TCP connection"),s=await r.connect(i),this.trace(o+" Established secure connection"),this.createSession(s,e,n)}catch(a){throw i?.destroy(),s?.socket.destroy(),a}}shutdown(){var e;this.isShutdown=!0,(e=this.session)===null||e===void 0||e.close(),this.session=null}};dL.Http2SubchannelConnector=K8});var $ke=E(Rw=>{"use strict";Object.defineProperty(Rw,"__esModule",{value:!0});Rw.SubchannelPool=void 0;Rw.getSubchannelPool=nCt;var JPt=iPe(),ZPt=Tke(),XPt=Ti(),QPt=ei(),eCt=kke(),tCt=1e4,Aw=class{constructor(){this.pool=Object.create(null),this.cleanupTimer=null}unrefUnusedSubchannels(){let e=!0;for(let r in this.pool){let i=this.pool[r].filter(s=>!s.subchannel.unrefIfOneRef());i.length>0&&(e=!1),this.pool[r]=i}e&&this.cleanupTimer!==null&&(clearInterval(this.cleanupTimer),this.cleanupTimer=null)}ensureCleanupTask(){var e,r;this.cleanupTimer===null&&(this.cleanupTimer=setInterval(()=>{this.unrefUnusedSubchannels()},tCt),(r=(e=this.cleanupTimer).unref)===null||r===void 0||r.call(e))}getOrCreateSubchannel(e,r,n,i){this.ensureCleanupTask();let s=(0,QPt.uriToString)(e);if(s in this.pool){let a=this.pool[s];for(let c of a)if((0,XPt.subchannelAddressEqual)(r,c.subchannelAddress)&&(0,JPt.channelOptionsEqual)(n,c.channelArguments)&&i._equals(c.channelCredentials))return c.subchannel}let o=new ZPt.Subchannel(e,r,n,i,new eCt.Http2SubchannelConnector(e));return s in this.pool||(this.pool[s]=[]),this.pool[s].push({subchannelAddress:r,channelArguments:n,channelCredentials:i,subchannel:o}),o.ref(),o}};Rw.SubchannelPool=Aw;var rCt=new Aw;function nCt(t){return t?rCt:new Aw}});var Mke=E(hL=>{"use strict";Object.defineProperty(hL,"__esModule",{value:!0});hL.LoadBalancingCall=void 0;var Lke=ti(),fL=st(),Dke=K_(),pL=Vr(),xw=jc(),iCt=ei(),sCt=qt(),J8=yw(),oCt=W("http2"),aCt="load_balancing_call",Z8=class{constructor(e,r,n,i,s,o,a){var c,l;this.channel=e,this.callConfig=r,this.methodName=n,this.host=i,this.credentials=s,this.deadline=o,this.callNumber=a,this.child=null,this.readPending=!1,this.pendingMessage=null,this.pendingHalfClose=!1,this.ended=!1,this.metadata=null,this.listener=null,this.onCallEnded=null,this.childStartTime=null;let u=this.methodName.split("/"),d="";u.length>=2&&(d=u[1]);let f=(l=(c=(0,iCt.splitHostPort)(this.host))===null||c===void 0?void 0:c.host)!==null&&l!==void 0?l:"localhost";this.serviceUrl=`https://${f}/${d}`,this.startTime=new Date}getDeadlineInfo(){var e,r;let n=[];return this.childStartTime?(this.childStartTime>this.startTime&&(!((e=this.metadata)===null||e===void 0)&&e.getOptions().waitForReady&&n.push("wait_for_ready"),n.push(`LB pick: ${(0,Dke.formatDateDifference)(this.startTime,this.childStartTime)}`)),n.push(...this.child.getDeadlineInfo()),n):(!((r=this.metadata)===null||r===void 0)&&r.getOptions().waitForReady&&n.push("wait_for_ready"),n.push("Waiting for LB pick"),n)}trace(e){sCt.trace(fL.LogVerbosity.DEBUG,aCt,"["+this.callNumber+"] "+e)}outputStatus(e,r){var n,i;if(!this.ended){this.ended=!0,this.trace("ended with status: code="+e.code+' details="'+e.details+'" start time='+this.startTime.toISOString());let s=Object.assign(Object.assign({},e),{progress:r});(n=this.listener)===null||n===void 0||n.onReceiveStatus(s),(i=this.onCallEnded)===null||i===void 0||i.call(this,s.code,s.details,s.metadata)}}doPick(){var e,r;if(this.ended)return;if(!this.metadata)throw new Error("doPick called before start");this.trace("Pick called");let n=this.metadata.clone(),i=this.channel.doPick(n,this.callConfig.pickInformation),s=i.subchannel?"("+i.subchannel.getChannelzRef().id+") "+i.subchannel.getAddress():""+i.subchannel;switch(this.trace("Pick result: "+xw.PickResultType[i.pickResultType]+" subchannel: "+s+" status: "+((e=i.status)===null||e===void 0?void 0:e.code)+" "+((r=i.status)===null||r===void 0?void 0:r.details)),i.pickResultType){case xw.PickResultType.COMPLETE:this.credentials.compose(i.subchannel.getCallCredentials()).generateMetadata({method_name:this.methodName,service_url:this.serviceUrl}).then(l=>{var u;if(this.ended){this.trace("Credentials metadata generation finished after call ended");return}if(n.merge(l),n.get("authorization").length>1&&this.outputStatus({code:fL.Status.INTERNAL,details:'"authorization" metadata cannot have multiple values',metadata:new pL.Metadata},"PROCESSED"),i.subchannel.getConnectivityState()!==Lke.ConnectivityState.READY){this.trace("Picked subchannel "+s+" has state "+Lke.ConnectivityState[i.subchannel.getConnectivityState()]+" after getting credentials metadata. Retrying pick"),this.doPick();return}this.deadline!==1/0&&n.set("grpc-timeout",(0,Dke.getDeadlineTimeoutString)(this.deadline));try{this.child=i.subchannel.getRealSubchannel().createCall(n,this.host,this.methodName,{onReceiveMetadata:d=>{this.trace("Received metadata"),this.listener.onReceiveMetadata(d)},onReceiveMessage:d=>{this.trace("Received message"),this.listener.onReceiveMessage(d)},onReceiveStatus:d=>{this.trace("Received status"),d.rstCode===oCt.constants.NGHTTP2_REFUSED_STREAM?this.outputStatus(d,"REFUSED"):this.outputStatus(d,"PROCESSED")}}),this.childStartTime=new Date}catch(d){this.trace("Failed to start call on picked subchannel "+s+" with error "+d.message),this.outputStatus({code:fL.Status.INTERNAL,details:"Failed to start HTTP/2 stream with error "+d.message,metadata:new pL.Metadata},"NOT_STARTED");return}(u=i.onCallStarted)===null||u===void 0||u.call(i),this.onCallEnded=i.onCallEnded,this.trace("Created child call ["+this.child.getCallNumber()+"]"),this.readPending&&this.child.startRead(),this.pendingMessage&&this.child.sendMessageWithContext(this.pendingMessage.context,this.pendingMessage.message),this.pendingHalfClose&&this.child.halfClose()},l=>{let{code:u,details:d}=(0,J8.restrictControlPlaneStatusCode)(typeof l.code=="number"?l.code:fL.Status.UNKNOWN,`Getting metadata from plugin failed with error: ${l.message}`);this.outputStatus({code:u,details:d,metadata:new pL.Metadata},"PROCESSED")});break;case xw.PickResultType.DROP:let{code:a,details:c}=(0,J8.restrictControlPlaneStatusCode)(i.status.code,i.status.details);setImmediate(()=>{this.outputStatus({code:a,details:c,metadata:i.status.metadata},"DROP")});break;case xw.PickResultType.TRANSIENT_FAILURE:if(this.metadata.getOptions().waitForReady)this.channel.queueCallForPick(this);else{let{code:l,details:u}=(0,J8.restrictControlPlaneStatusCode)(i.status.code,i.status.details);setImmediate(()=>{this.outputStatus({code:l,details:u,metadata:i.status.metadata},"PROCESSED")})}break;case xw.PickResultType.QUEUE:this.channel.queueCallForPick(this)}}cancelWithStatus(e,r){var n;this.trace("cancelWithStatus code: "+e+' details: "'+r+'"'),(n=this.child)===null||n===void 0||n.cancelWithStatus(e,r),this.outputStatus({code:e,details:r,metadata:new pL.Metadata},"PROCESSED")}getPeer(){var e,r;return(r=(e=this.child)===null||e===void 0?void 0:e.getPeer())!==null&&r!==void 0?r:this.channel.getTarget()}start(e,r){this.trace("start called"),this.listener=r,this.metadata=e,this.doPick()}sendMessageWithContext(e,r){this.trace("write() called with message of length "+r.length),this.child?this.child.sendMessageWithContext(e,r):this.pendingMessage={context:e,message:r}}startRead(){this.trace("startRead called"),this.child?this.child.startRead():this.readPending=!0}halfClose(){this.trace("halfClose called"),this.child?this.child.halfClose():this.pendingHalfClose=!0}setCredentials(e){throw new Error("Method not implemented.")}getCallNumber(){return this.callNumber}getAuthContext(){return this.child?this.child.getAuthContext():null}};hL.LoadBalancingCall=Z8});var Fke=E(mL=>{"use strict";Object.defineProperty(mL,"__esModule",{value:!0});mL.ResolvingCall=void 0;var cCt=Wk(),Rp=st(),xp=K_(),Uke=Vr(),lCt=qt(),uCt=yw(),dCt="resolving_call",X8=class{constructor(e,r,n,i,s){this.channel=e,this.method=r,this.filterStackFactory=i,this.callNumber=s,this.child=null,this.readPending=!1,this.pendingMessage=null,this.pendingHalfClose=!1,this.ended=!1,this.readFilterPending=!1,this.writeFilterPending=!1,this.pendingChildStatus=null,this.metadata=null,this.listener=null,this.statusWatchers=[],this.deadlineTimer=setTimeout(()=>{},0),this.filterStack=null,this.deadlineStartTime=null,this.configReceivedTime=null,this.childStartTime=null,this.credentials=cCt.CallCredentials.createEmpty(),this.deadline=n.deadline,this.host=n.host,n.parentCall&&(n.flags&Rp.Propagate.CANCELLATION&&n.parentCall.on("cancelled",()=>{this.cancelWithStatus(Rp.Status.CANCELLED,"Cancelled by parent call")}),n.flags&Rp.Propagate.DEADLINE&&(this.trace("Propagating deadline from parent: "+n.parentCall.getDeadline()),this.deadline=(0,xp.minDeadline)(this.deadline,n.parentCall.getDeadline()))),this.trace("Created"),this.runDeadlineTimer()}trace(e){lCt.trace(Rp.LogVerbosity.DEBUG,dCt,"["+this.callNumber+"] "+e)}runDeadlineTimer(){clearTimeout(this.deadlineTimer),this.deadlineStartTime=new Date,this.trace("Deadline: "+(0,xp.deadlineToString)(this.deadline));let e=(0,xp.getRelativeTimeout)(this.deadline);if(e!==1/0){this.trace("Deadline will be reached in "+e+"ms");let r=()=>{if(!this.deadlineStartTime){this.cancelWithStatus(Rp.Status.DEADLINE_EXCEEDED,"Deadline exceeded");return}let n=[],i=new Date;n.push(`Deadline exceeded after ${(0,xp.formatDateDifference)(this.deadlineStartTime,i)}`),this.configReceivedTime?(this.configReceivedTime>this.deadlineStartTime&&n.push(`name resolution: ${(0,xp.formatDateDifference)(this.deadlineStartTime,this.configReceivedTime)}`),this.childStartTime?this.childStartTime>this.configReceivedTime&&n.push(`metadata filters: ${(0,xp.formatDateDifference)(this.configReceivedTime,this.childStartTime)}`):n.push("waiting for metadata filters")):n.push("waiting for name resolution"),this.child&&n.push(...this.child.getDeadlineInfo()),this.cancelWithStatus(Rp.Status.DEADLINE_EXCEEDED,n.join(","))};e<=0?process.nextTick(r):this.deadlineTimer=setTimeout(r,e)}}outputStatus(e){if(!this.ended){this.ended=!0,this.filterStack||(this.filterStack=this.filterStackFactory.createFilter()),clearTimeout(this.deadlineTimer);let r=this.filterStack.receiveTrailers(e);this.trace("ended with status: code="+r.code+' details="'+r.details+'"'),this.statusWatchers.forEach(n=>n(r)),process.nextTick(()=>{var n;(n=this.listener)===null||n===void 0||n.onReceiveStatus(r)})}}sendMessageOnChild(e,r){if(!this.child)throw new Error("sendMessageonChild called with child not populated");let n=this.child;this.writeFilterPending=!0,this.filterStack.sendMessage(Promise.resolve({message:r,flags:e.flags})).then(i=>{this.writeFilterPending=!1,n.sendMessageWithContext(e,i.message),this.pendingHalfClose&&n.halfClose()},i=>{this.cancelWithStatus(i.code,i.details)})}getConfig(){if(this.ended)return;if(!this.metadata||!this.listener)throw new Error("getConfig called before start");let e=this.channel.getConfig(this.method,this.metadata);if(e.type==="NONE"){this.channel.queueCallForConfig(this);return}else if(e.type==="ERROR"){this.metadata.getOptions().waitForReady?this.channel.queueCallForConfig(this):this.outputStatus(e.error);return}this.configReceivedTime=new Date;let r=e.config;if(r.status!==Rp.Status.OK){let{code:n,details:i}=(0,uCt.restrictControlPlaneStatusCode)(r.status,"Failed to route call to method "+this.method);this.outputStatus({code:n,details:i,metadata:new Uke.Metadata});return}if(r.methodConfig.timeout){let n=new Date;n.setSeconds(n.getSeconds()+r.methodConfig.timeout.seconds),n.setMilliseconds(n.getMilliseconds()+r.methodConfig.timeout.nanos/1e6),this.deadline=(0,xp.minDeadline)(this.deadline,n),this.runDeadlineTimer()}this.filterStackFactory.push(r.dynamicFilterFactories),this.filterStack=this.filterStackFactory.createFilter(),this.filterStack.sendMetadata(Promise.resolve(this.metadata)).then(n=>{this.child=this.channel.createRetryingCall(r,this.method,this.host,this.credentials,this.deadline),this.trace("Created child ["+this.child.getCallNumber()+"]"),this.childStartTime=new Date,this.child.start(n,{onReceiveMetadata:i=>{this.trace("Received metadata"),this.listener.onReceiveMetadata(this.filterStack.receiveMetadata(i))},onReceiveMessage:i=>{this.trace("Received message"),this.readFilterPending=!0,this.filterStack.receiveMessage(i).then(s=>{this.trace("Finished filtering received message"),this.readFilterPending=!1,this.listener.onReceiveMessage(s),this.pendingChildStatus&&this.outputStatus(this.pendingChildStatus)},s=>{this.cancelWithStatus(s.code,s.details)})},onReceiveStatus:i=>{this.trace("Received status"),this.readFilterPending?this.pendingChildStatus=i:this.outputStatus(i)}}),this.readPending&&this.child.startRead(),this.pendingMessage?this.sendMessageOnChild(this.pendingMessage.context,this.pendingMessage.message):this.pendingHalfClose&&this.child.halfClose()},n=>{this.outputStatus(n)})}reportResolverError(e){var r;!((r=this.metadata)===null||r===void 0)&&r.getOptions().waitForReady?this.channel.queueCallForConfig(this):this.outputStatus(e)}cancelWithStatus(e,r){var n;this.trace("cancelWithStatus code: "+e+' details: "'+r+'"'),(n=this.child)===null||n===void 0||n.cancelWithStatus(e,r),this.outputStatus({code:e,details:r,metadata:new Uke.Metadata})}getPeer(){var e,r;return(r=(e=this.child)===null||e===void 0?void 0:e.getPeer())!==null&&r!==void 0?r:this.channel.getTarget()}start(e,r){this.trace("start called"),this.metadata=e.clone(),this.listener=r,this.getConfig()}sendMessageWithContext(e,r){this.trace("write() called with message of length "+r.length),this.child?this.sendMessageOnChild(e,r):this.pendingMessage={context:e,message:r}}startRead(){this.trace("startRead called"),this.child?this.child.startRead():this.readPending=!0}halfClose(){this.trace("halfClose called"),this.child&&!this.writeFilterPending?this.child.halfClose():this.pendingHalfClose=!0}setCredentials(e){this.credentials=e}addStatusWatcher(e){this.statusWatchers.push(e)}getCallNumber(){return this.callNumber}getAuthContext(){return this.child?this.child.getAuthContext():null}};mL.ResolvingCall=X8});var jke=E(Zu=>{"use strict";Object.defineProperty(Zu,"__esModule",{value:!0});Zu.RetryingCall=Zu.MessageBufferTracker=Zu.RetryThrottler=void 0;var gL=st(),fCt=K_(),pCt=Vr(),hCt=qt(),mCt="retrying_call",e9=class{constructor(e,r,n){this.maxTokens=e,this.tokenRatio=r,n?this.tokens=n.tokens*(e/n.maxTokens):this.tokens=e}addCallSucceeded(){this.tokens=Math.min(this.tokens+this.tokenRatio,this.maxTokens)}addCallFailed(){this.tokens=Math.max(this.tokens-1,0)}canRetryCall(){return this.tokens>this.maxTokens/2}};Zu.RetryThrottler=e9;var t9=class{constructor(e,r){this.totalLimit=e,this.limitPerCall=r,this.totalAllocated=0,this.allocatedPerCall=new Map}allocate(e,r){var n;let i=(n=this.allocatedPerCall.get(r))!==null&&n!==void 0?n:0;return this.limitPerCall-i<e||this.totalLimit-this.totalAllocated<e?!1:(this.allocatedPerCall.set(r,i+e),this.totalAllocated+=e,!0)}free(e,r){var n;if(this.totalAllocated<e)throw new Error(`Invalid buffer allocation state: call ${r} freed ${e} > total allocated ${this.totalAllocated}`);this.totalAllocated-=e;let i=(n=this.allocatedPerCall.get(r))!==null&&n!==void 0?n:0;if(i<e)throw new Error(`Invalid buffer allocation state: call ${r} freed ${e} > allocated for call ${i}`);this.allocatedPerCall.set(r,i-e)}freeAll(e){var r;let n=(r=this.allocatedPerCall.get(e))!==null&&r!==void 0?r:0;if(this.totalAllocated<n)throw new Error(`Invalid buffer allocation state: call ${e} allocated ${n} > total allocated ${this.totalAllocated}`);this.totalAllocated-=n,this.allocatedPerCall.delete(e)}};Zu.MessageBufferTracker=t9;var Q8="grpc-previous-rpc-attempts",gCt=5,r9=class{constructor(e,r,n,i,s,o,a,c,l){var u;this.channel=e,this.callConfig=r,this.methodName=n,this.host=i,this.credentials=s,this.deadline=o,this.callNumber=a,this.bufferTracker=c,this.retryThrottler=l,this.listener=null,this.initialMetadata=null,this.underlyingCalls=[],this.writeBuffer=[],this.writeBufferOffset=0,this.readStarted=!1,this.transparentRetryUsed=!1,this.attempts=0,this.hedgingTimer=null,this.committedCallIndex=null,this.initialRetryBackoffSec=0,this.nextRetryBackoffSec=0;let d=(u=e.getOptions()["grpc-node.retry_max_attempts_limit"])!==null&&u!==void 0?u:gCt;if(e.getOptions()["grpc.enable_retries"]===0)this.state="NO_RETRY",this.maxAttempts=1;else if(r.methodConfig.retryPolicy){this.state="RETRY";let f=r.methodConfig.retryPolicy;this.nextRetryBackoffSec=this.initialRetryBackoffSec=Number(f.initialBackoff.substring(0,f.initialBackoff.length-1)),this.maxAttempts=Math.min(f.maxAttempts,d)}else r.methodConfig.hedgingPolicy?(this.state="HEDGING",this.maxAttempts=Math.min(r.methodConfig.hedgingPolicy.maxAttempts,d)):(this.state="TRANSPARENT_ONLY",this.maxAttempts=1);this.startTime=new Date}getDeadlineInfo(){if(this.underlyingCalls.length===0)return[];let e=[],r=this.underlyingCalls[this.underlyingCalls.length-1];return this.underlyingCalls.length>1&&e.push(`previous attempts: ${this.underlyingCalls.length-1}`),r.startTime>this.startTime&&e.push(`time to current attempt start: ${(0,fCt.formatDateDifference)(this.startTime,r.startTime)}`),e.push(...r.call.getDeadlineInfo()),e}getCallNumber(){return this.callNumber}trace(e){hCt.trace(gL.LogVerbosity.DEBUG,mCt,"["+this.callNumber+"] "+e)}reportStatus(e){this.trace("ended with status: code="+e.code+' details="'+e.details+'" start time='+this.startTime.toISOString()),this.bufferTracker.freeAll(this.callNumber),this.writeBufferOffset=this.writeBufferOffset+this.writeBuffer.length,this.writeBuffer=[],process.nextTick(()=>{var r;(r=this.listener)===null||r===void 0||r.onReceiveStatus({code:e.code,details:e.details,metadata:e.metadata})})}cancelWithStatus(e,r){this.trace("cancelWithStatus code: "+e+' details: "'+r+'"'),this.reportStatus({code:e,details:r,metadata:new pCt.Metadata});for(let{call:n}of this.underlyingCalls)n.cancelWithStatus(e,r)}getPeer(){return this.committedCallIndex!==null?this.underlyingCalls[this.committedCallIndex].call.getPeer():"unknown"}getBufferEntry(e){var r;return(r=this.writeBuffer[e-this.writeBufferOffset])!==null&&r!==void 0?r:{entryType:"FREED",allocated:!1}}getNextBufferIndex(){return this.writeBufferOffset+this.writeBuffer.length}clearSentMessages(){if(this.state!=="COMMITTED")return;let e;this.underlyingCalls[this.committedCallIndex].state==="COMPLETED"?e=this.getNextBufferIndex():e=this.underlyingCalls[this.committedCallIndex].nextMessageToSend;for(let r=this.writeBufferOffset;r<e;r++){let n=this.getBufferEntry(r);n.allocated&&this.bufferTracker.free(n.message.message.length,this.callNumber)}this.writeBuffer=this.writeBuffer.slice(e-this.writeBufferOffset),this.writeBufferOffset=e}commitCall(e){var r,n;if(this.state!=="COMMITTED"){this.trace("Committing call ["+this.underlyingCalls[e].call.getCallNumber()+"] at index "+e),this.state="COMMITTED",(n=(r=this.callConfig).onCommitted)===null||n===void 0||n.call(r),this.committedCallIndex=e;for(let i=0;i<this.underlyingCalls.length;i++)i!==e&&this.underlyingCalls[i].state!=="COMPLETED"&&(this.underlyingCalls[i].state="COMPLETED",this.underlyingCalls[i].call.cancelWithStatus(gL.Status.CANCELLED,"Discarded in favor of other hedged attempt"));this.clearSentMessages()}}commitCallWithMostMessages(){if(this.state==="COMMITTED")return;let e=-1,r=-1;for(let[n,i]of this.underlyingCalls.entries())i.state==="ACTIVE"&&i.nextMessageToSend>e&&(e=i.nextMessageToSend,r=n);r===-1?this.state="TRANSPARENT_ONLY":this.commitCall(r)}isStatusCodeInList(e,r){return e.some(n=>{var i;return n===r||n.toString().toLowerCase()===((i=gL.Status[r])===null||i===void 0?void 0:i.toLowerCase())})}getNextRetryJitter(){return Math.random()*(1.2-.8)+.8}getNextRetryBackoffMs(){var e;let r=(e=this.callConfig)===null||e===void 0?void 0:e.methodConfig.retryPolicy;if(!r)return 0;let i=this.getNextRetryJitter()*this.nextRetryBackoffSec*1e3,s=Number(r.maxBackoff.substring(0,r.maxBackoff.length-1));return this.nextRetryBackoffSec=Math.min(this.nextRetryBackoffSec*r.backoffMultiplier,s),i}maybeRetryCall(e,r){if(this.state!=="RETRY"){r(!1);return}if(this.attempts>=this.maxAttempts){r(!1);return}let n;if(e===null)n=this.getNextRetryBackoffMs();else if(e<0){this.state="TRANSPARENT_ONLY",r(!1);return}else n=e,this.nextRetryBackoffSec=this.initialRetryBackoffSec;setTimeout(()=>{var i,s;if(this.state!=="RETRY"){r(!1);return}!((s=(i=this.retryThrottler)===null||i===void 0?void 0:i.canRetryCall())!==null&&s!==void 0)||s?(r(!0),this.attempts+=1,this.startNewAttempt()):(this.trace("Retry attempt denied by throttling policy"),r(!1))},n)}countActiveCalls(){let e=0;for(let r of this.underlyingCalls)r?.state==="ACTIVE"&&(e+=1);return e}handleProcessedStatus(e,r,n){var i,s,o;switch(this.state){case"COMMITTED":case"NO_RETRY":case"TRANSPARENT_ONLY":this.commitCall(r),this.reportStatus(e);break;case"HEDGING":if(this.isStatusCodeInList((i=this.callConfig.methodConfig.hedgingPolicy.nonFatalStatusCodes)!==null&&i!==void 0?i:[],e.code)){(s=this.retryThrottler)===null||s===void 0||s.addCallFailed();let a;if(n===null)a=0;else if(n<0){this.state="TRANSPARENT_ONLY",this.commitCall(r),this.reportStatus(e);return}else a=n;setTimeout(()=>{this.maybeStartHedgingAttempt(),this.countActiveCalls()===0&&(this.commitCall(r),this.reportStatus(e))},a)}else this.commitCall(r),this.reportStatus(e);break;case"RETRY":this.isStatusCodeInList(this.callConfig.methodConfig.retryPolicy.retryableStatusCodes,e.code)?((o=this.retryThrottler)===null||o===void 0||o.addCallFailed(),this.maybeRetryCall(n,a=>{a||(this.commitCall(r),this.reportStatus(e))})):(this.commitCall(r),this.reportStatus(e));break}}getPushback(e){let r=e.get("grpc-retry-pushback-ms");if(r.length===0)return null;try{return parseInt(r[0])}catch{return-1}}handleChildStatus(e,r){var n;if(this.underlyingCalls[r].state==="COMPLETED")return;if(this.trace("state="+this.state+" handling status with progress "+e.progress+" from child ["+this.underlyingCalls[r].call.getCallNumber()+"] in state "+this.underlyingCalls[r].state),this.underlyingCalls[r].state="COMPLETED",e.code===gL.Status.OK){(n=this.retryThrottler)===null||n===void 0||n.addCallSucceeded(),this.commitCall(r),this.reportStatus(e);return}if(this.state==="NO_RETRY"){this.commitCall(r),this.reportStatus(e);return}if(this.state==="COMMITTED"){this.reportStatus(e);return}let i=this.getPushback(e.metadata);switch(e.progress){case"NOT_STARTED":this.startNewAttempt();break;case"REFUSED":this.transparentRetryUsed?this.handleProcessedStatus(e,r,i):(this.transparentRetryUsed=!0,this.startNewAttempt());break;case"DROP":this.commitCall(r),this.reportStatus(e);break;case"PROCESSED":this.handleProcessedStatus(e,r,i);break}}maybeStartHedgingAttempt(){this.state==="HEDGING"&&this.callConfig.methodConfig.hedgingPolicy&&(this.attempts>=this.maxAttempts||(this.attempts+=1,this.startNewAttempt(),this.maybeStartHedgingTimer()))}maybeStartHedgingTimer(){var e,r,n;if(this.hedgingTimer&&clearTimeout(this.hedgingTimer),this.state!=="HEDGING"||!this.callConfig.methodConfig.hedgingPolicy)return;let i=this.callConfig.methodConfig.hedgingPolicy;if(this.attempts>=this.maxAttempts)return;let s=(e=i.hedgingDelay)!==null&&e!==void 0?e:"0s",o=Number(s.substring(0,s.length-1));this.hedgingTimer=setTimeout(()=>{this.maybeStartHedgingAttempt()},o*1e3),(n=(r=this.hedgingTimer).unref)===null||n===void 0||n.call(r)}startNewAttempt(){let e=this.channel.createLoadBalancingCall(this.callConfig,this.methodName,this.host,this.credentials,this.deadline);this.trace("Created child call ["+e.getCallNumber()+"] for attempt "+this.attempts);let r=this.underlyingCalls.length;this.underlyingCalls.push({state:"ACTIVE",call:e,nextMessageToSend:0,startTime:new Date});let n=this.attempts-1,i=this.initialMetadata.clone();n>0&&i.set(Q8,`${n}`);let s=!1;e.start(i,{onReceiveMetadata:o=>{this.trace("Received metadata from child ["+e.getCallNumber()+"]"),this.commitCall(r),s=!0,n>0&&o.set(Q8,`${n}`),this.underlyingCalls[r].state==="ACTIVE"&&this.listener.onReceiveMetadata(o)},onReceiveMessage:o=>{this.trace("Received message from child ["+e.getCallNumber()+"]"),this.commitCall(r),this.underlyingCalls[r].state==="ACTIVE"&&this.listener.onReceiveMessage(o)},onReceiveStatus:o=>{this.trace("Received status from child ["+e.getCallNumber()+"]"),!s&&n>0&&o.metadata.set(Q8,`${n}`),this.handleChildStatus(o,r)}}),this.sendNextChildMessage(r),this.readStarted&&e.startRead()}start(e,r){this.trace("start called"),this.listener=r,this.initialMetadata=e,this.attempts+=1,this.startNewAttempt(),this.maybeStartHedgingTimer()}handleChildWriteCompleted(e,r){var n,i;(i=(n=this.getBufferEntry(r)).callback)===null||i===void 0||i.call(n),this.clearSentMessages();let s=this.underlyingCalls[e];s.nextMessageToSend+=1,this.sendNextChildMessage(e)}sendNextChildMessage(e){let r=this.underlyingCalls[e];if(r.state==="COMPLETED")return;let n=r.nextMessageToSend;if(this.getBufferEntry(n)){let i=this.getBufferEntry(n);switch(i.entryType){case"MESSAGE":r.call.sendMessageWithContext({callback:o=>{this.handleChildWriteCompleted(e,n)}},i.message.message),this.getBufferEntry(n+1).entryType==="HALF_CLOSE"&&(this.trace("Sending halfClose immediately after message to child ["+r.call.getCallNumber()+"] - optimizing for unary/final message"),r.nextMessageToSend+=1,r.call.halfClose());break;case"HALF_CLOSE":r.nextMessageToSend+=1,r.call.halfClose();break;case"FREED":break}}}sendMessageWithContext(e,r){this.trace("write() called with message of length "+r.length);let n={message:r,flags:e.flags},i=this.getNextBufferIndex(),s={entryType:"MESSAGE",message:n,allocated:this.bufferTracker.allocate(r.length,this.callNumber)};if(this.writeBuffer.push(s),s.allocated){process.nextTick(()=>{var o;(o=e.callback)===null||o===void 0||o.call(e)});for(let[o,a]of this.underlyingCalls.entries())a.state==="ACTIVE"&&a.nextMessageToSend===i&&a.call.sendMessageWithContext({callback:c=>{this.handleChildWriteCompleted(o,i)}},r)}else{if(this.commitCallWithMostMessages(),this.committedCallIndex===null)return;let o=this.underlyingCalls[this.committedCallIndex];s.callback=e.callback,o.state==="ACTIVE"&&o.nextMessageToSend===i&&o.call.sendMessageWithContext({callback:a=>{this.handleChildWriteCompleted(this.committedCallIndex,i)}},r)}}startRead(){this.trace("startRead called"),this.readStarted=!0;for(let e of this.underlyingCalls)e?.state==="ACTIVE"&&e.call.startRead()}halfClose(){this.trace("halfClose called");let e=this.getNextBufferIndex();this.writeBuffer.push({entryType:"HALF_CLOSE",allocated:!1});for(let r of this.underlyingCalls)r?.state==="ACTIVE"&&(r.nextMessageToSend===e||r.nextMessageToSend===e-1)&&(this.trace("Sending halfClose immediately to child ["+r.call.getCallNumber()+"] - all messages already sent"),r.nextMessageToSend+=1,r.call.halfClose())}setCredentials(e){throw new Error("Method not implemented.")}getMethod(){return this.methodName}getHost(){return this.host}getAuthContext(){return this.committedCallIndex!==null?this.underlyingCalls[this.committedCallIndex].call.getAuthContext():null}};Zu.RetryingCall=r9});var Iw=E(_L=>{"use strict";Object.defineProperty(_L,"__esModule",{value:!0});_L.BaseSubchannelWrapper=void 0;var n9=class{constructor(e){this.child=e,this.healthy=!0,this.healthListeners=new Set,this.refcount=0,this.dataWatchers=new Set,e.addHealthStateWatcher(r=>{this.healthy&&this.updateHealthListeners()})}updateHealthListeners(){for(let e of this.healthListeners)e(this.isHealthy())}getConnectivityState(){return this.child.getConnectivityState()}addConnectivityStateListener(e){this.child.addConnectivityStateListener(e)}removeConnectivityStateListener(e){this.child.removeConnectivityStateListener(e)}startConnecting(){this.child.startConnecting()}getAddress(){return this.child.getAddress()}throttleKeepalive(e){this.child.throttleKeepalive(e)}ref(){this.child.ref(),this.refcount+=1}unref(){this.child.unref(),this.refcount-=1,this.refcount===0&&this.destroy()}destroy(){for(let e of this.dataWatchers)e.destroy()}getChannelzRef(){return this.child.getChannelzRef()}isHealthy(){return this.healthy&&this.child.isHealthy()}addHealthStateWatcher(e){this.healthListeners.add(e)}removeHealthStateWatcher(e){this.healthListeners.delete(e)}addDataWatcher(e){e.setSubchannel(this.getRealSubchannel()),this.dataWatchers.add(e)}setHealthy(e){e!==this.healthy&&(this.healthy=e,this.child.isHealthy()&&this.updateHealthListeners())}getRealSubchannel(){return this.child.getRealSubchannel()}realSubchannelEquals(e){return this.getRealSubchannel()===e.getRealSubchannel()}getCallCredentials(){return this.child.getCallCredentials()}getChannel(){return this.child.getChannel()}};_L.BaseSubchannelWrapper=n9});var d9=E(Ip=>{"use strict";Object.defineProperty(Ip,"__esModule",{value:!0});Ip.InternalChannel=Ip.SUBCHANNEL_ARGS_EXCLUDE_KEY_PREFIX=void 0;var _Ct=I_(),yCt=nPe(),SCt=$ke(),o9=jc(),ECt=Vr(),Xu=st(),vCt=tL(),bCt=I8(),qke=co(),yL=qt(),TCt=q8(),SL=ei(),$s=ti(),Ow=Yu(),wCt=Mke(),ACt=K_(),RCt=Fke(),i9=K$(),xCt=yw(),s9=jke(),ICt=Iw(),OCt=2147483647,PCt=1e3,CCt=1800*1e3,EL=new Map,NCt=1<<24,kCt=1<<20,a9=class extends ICt.BaseSubchannelWrapper{constructor(e,r){super(e),this.channel=r,this.refCount=0,this.subchannelStateListener=(n,i,s,o)=>{r.throttleKeepalive(o)}}ref(){this.refCount===0&&(this.child.addConnectivityStateListener(this.subchannelStateListener),this.channel.addWrappedSubchannel(this)),this.child.ref(),this.refCount+=1}unref(){this.child.unref(),this.refCount-=1,this.refCount<=0&&(this.child.removeConnectivityStateListener(this.subchannelStateListener),this.channel.removeWrappedSubchannel(this))}},c9=class{pick(e){return{pickResultType:o9.PickResultType.DROP,status:{code:Xu.Status.UNAVAILABLE,details:"Channel closed before call started",metadata:new ECt.Metadata},subchannel:null,onCallStarted:null,onCallEnded:null}}};Ip.SUBCHANNEL_ARGS_EXCLUDE_KEY_PREFIX="grpc.internal.no_subchannel";var l9=class{constructor(e){this.target=e,this.trace=new Ow.ChannelzTrace,this.callTracker=new Ow.ChannelzCallTracker,this.childrenTracker=new Ow.ChannelzChildrenTracker,this.state=$s.ConnectivityState.IDLE}getChannelzInfoCallback(){return()=>({target:this.target,state:this.state,trace:this.trace,callTracker:this.callTracker,children:this.childrenTracker.getChildLists()})}},u9=class{constructor(e,r,n){var i,s,o,a,c,l;if(this.credentials=r,this.options=n,this.connectivityState=$s.ConnectivityState.IDLE,this.currentPicker=new o9.UnavailablePicker,this.configSelectionQueue=[],this.pickQueue=[],this.connectivityStateWatchers=[],this.callRefTimer=null,this.configSelector=null,this.currentResolutionError=null,this.wrappedSubchannels=new Set,this.callCount=0,this.idleTimer=null,this.channelzEnabled=!0,this.randomChannelId=Math.floor(Math.random()*Number.MAX_SAFE_INTEGER),typeof e!="string")throw new TypeError("Channel target must be a string");if(!(r instanceof _Ct.ChannelCredentials))throw new TypeError("Channel credentials must be a ChannelCredentials object");if(n&&typeof n!="object")throw new TypeError("Channel options must be an object");this.channelzInfoTracker=new l9(e);let u=(0,SL.parseUri)(e);if(u===null)throw new Error(`Could not parse target name "${e}"`);let d=(0,qke.mapUriDefaultScheme)(u);if(d===null)throw new Error(`Could not find a default scheme for target name "${e}"`);this.options["grpc.enable_channelz"]===0&&(this.channelzEnabled=!1),this.channelzRef=(0,Ow.registerChannelzChannel)(e,this.channelzInfoTracker.getChannelzInfoCallback(),this.channelzEnabled),this.channelzEnabled&&this.channelzInfoTracker.trace.addTrace("CT_INFO","Channel created"),this.options["grpc.default_authority"]?this.defaultAuthority=this.options["grpc.default_authority"]:this.defaultAuthority=(0,qke.getDefaultAuthority)(d);let f=(0,TCt.mapProxyName)(d,n);this.target=f.target,this.options=Object.assign({},this.options,f.extraOptions),this.subchannelPool=(0,SCt.getSubchannelPool)(((i=this.options["grpc.use_local_subchannel_pool"])!==null&&i!==void 0?i:0)===0),this.retryBufferTracker=new s9.MessageBufferTracker((s=this.options["grpc.retry_buffer_size"])!==null&&s!==void 0?s:NCt,(o=this.options["grpc.per_rpc_retry_buffer_size"])!==null&&o!==void 0?o:kCt),this.keepaliveTime=(a=this.options["grpc.keepalive_time_ms"])!==null&&a!==void 0?a:-1,this.idleTimeoutMs=Math.max((c=this.options["grpc.client_idle_timeout_ms"])!==null&&c!==void 0?c:CCt,PCt);let p={createSubchannel:(m,_)=>{let y={};for(let[g,T]of Object.entries(_))g.startsWith(Ip.SUBCHANNEL_ARGS_EXCLUDE_KEY_PREFIX)||(y[g]=T);let v=this.subchannelPool.getOrCreateSubchannel(this.target,m,y,this.credentials);return v.throttleKeepalive(this.keepaliveTime),this.channelzEnabled&&this.channelzInfoTracker.trace.addTrace("CT_INFO","Created subchannel or used existing subchannel",v.getChannelzRef()),new a9(v,this)},updateState:(m,_)=>{this.currentPicker=_;let y=this.pickQueue.slice();this.pickQueue=[],y.length>0&&this.callRefTimerUnref();for(let v of y)v.doPick();this.updateState(m)},requestReresolution:()=>{throw new Error("Resolving load balancer should never call requestReresolution")},addChannelzChild:m=>{this.channelzEnabled&&this.channelzInfoTracker.childrenTracker.refChild(m)},removeChannelzChild:m=>{this.channelzEnabled&&this.channelzInfoTracker.childrenTracker.unrefChild(m)}};this.resolvingLoadBalancer=new yCt.ResolvingLoadBalancer(this.target,p,this.options,(m,_)=>{var y;m.retryThrottling?EL.set(this.getTarget(),new s9.RetryThrottler(m.retryThrottling.maxTokens,m.retryThrottling.tokenRatio,EL.get(this.getTarget()))):EL.delete(this.getTarget()),this.channelzEnabled&&this.channelzInfoTracker.trace.addTrace("CT_INFO","Address resolution succeeded"),(y=this.configSelector)===null||y===void 0||y.unref(),this.configSelector=_,this.currentResolutionError=null,process.nextTick(()=>{let v=this.configSelectionQueue;this.configSelectionQueue=[],v.length>0&&this.callRefTimerUnref();for(let S of v)S.getConfig()})},m=>{this.channelzEnabled&&this.channelzInfoTracker.trace.addTrace("CT_WARNING","Address resolution failed with code "+m.code+' and details "'+m.details+'"'),this.configSelectionQueue.length>0&&this.trace("Name resolution failed with calls queued for config selection"),this.configSelector===null&&(this.currentResolutionError=Object.assign(Object.assign({},(0,xCt.restrictControlPlaneStatusCode)(m.code,m.details)),{metadata:m.metadata}));let _=this.configSelectionQueue;this.configSelectionQueue=[],_.length>0&&this.callRefTimerUnref();for(let y of _)y.reportResolverError(m)}),this.filterStackFactory=new vCt.FilterStackFactory([new bCt.CompressionFilterFactory(this,this.options)]),this.trace("Channel constructed with options "+JSON.stringify(n,void 0,2));let h=new Error;(0,yL.isTracerEnabled)("channel_stacktrace")&&(0,yL.trace)(Xu.LogVerbosity.DEBUG,"channel_stacktrace","("+this.channelzRef.id+`) Channel constructed
391
391
  `+((l=h.stack)===null||l===void 0?void 0:l.substring(h.stack.indexOf(`
392
392
  `)+1))),this.lastActivityTimestamp=new Date}trace(e,r){(0,yL.trace)(r??Xu.LogVerbosity.DEBUG,"channel","("+this.channelzRef.id+") "+(0,SL.uriToString)(this.target)+" "+e)}callRefTimerRef(){var e,r,n,i;this.callRefTimer||(this.callRefTimer=setInterval(()=>{},OCt)),!((r=(e=this.callRefTimer).hasRef)===null||r===void 0)&&r.call(e)||(this.trace("callRefTimer.ref | configSelectionQueue.length="+this.configSelectionQueue.length+" pickQueue.length="+this.pickQueue.length),(i=(n=this.callRefTimer).ref)===null||i===void 0||i.call(n))}callRefTimerUnref(){var e,r,n;(!(!((e=this.callRefTimer)===null||e===void 0)&&e.hasRef)||this.callRefTimer.hasRef())&&(this.trace("callRefTimer.unref | configSelectionQueue.length="+this.configSelectionQueue.length+" pickQueue.length="+this.pickQueue.length),(n=(r=this.callRefTimer)===null||r===void 0?void 0:r.unref)===null||n===void 0||n.call(r))}removeConnectivityStateWatcher(e){let r=this.connectivityStateWatchers.findIndex(n=>n===e);r>=0&&this.connectivityStateWatchers.splice(r,1)}updateState(e){(0,yL.trace)(Xu.LogVerbosity.DEBUG,"connectivity_state","("+this.channelzRef.id+") "+(0,SL.uriToString)(this.target)+" "+$s.ConnectivityState[this.connectivityState]+" -> "+$s.ConnectivityState[e]),this.channelzEnabled&&this.channelzInfoTracker.trace.addTrace("CT_INFO","Connectivity state change to "+$s.ConnectivityState[e]),this.connectivityState=e,this.channelzInfoTracker.state=e;let r=this.connectivityStateWatchers.slice();for(let n of r)e!==n.currentState&&(n.timer&&clearTimeout(n.timer),this.removeConnectivityStateWatcher(n),n.callback());e!==$s.ConnectivityState.TRANSIENT_FAILURE&&(this.currentResolutionError=null)}throttleKeepalive(e){if(e>this.keepaliveTime){this.keepaliveTime=e;for(let r of this.wrappedSubchannels)r.throttleKeepalive(e)}}addWrappedSubchannel(e){this.wrappedSubchannels.add(e)}removeWrappedSubchannel(e){this.wrappedSubchannels.delete(e)}doPick(e,r){return this.currentPicker.pick({metadata:e,extraPickInfo:r})}queueCallForPick(e){this.pickQueue.push(e),this.callRefTimerRef()}getConfig(e,r){return this.connectivityState!==$s.ConnectivityState.SHUTDOWN&&this.resolvingLoadBalancer.exitIdle(),this.configSelector?{type:"SUCCESS",config:this.configSelector.invoke(e,r,this.randomChannelId)}:this.currentResolutionError?{type:"ERROR",error:this.currentResolutionError}:{type:"NONE"}}queueCallForConfig(e){this.configSelectionQueue.push(e),this.callRefTimerRef()}enterIdle(){this.resolvingLoadBalancer.destroy(),this.updateState($s.ConnectivityState.IDLE),this.currentPicker=new o9.QueuePicker(this.resolvingLoadBalancer),this.idleTimer&&(clearTimeout(this.idleTimer),this.idleTimer=null),this.callRefTimer&&(clearInterval(this.callRefTimer),this.callRefTimer=null)}startIdleTimeout(e){var r,n;this.idleTimer=setTimeout(()=>{if(this.callCount>0){this.startIdleTimeout(this.idleTimeoutMs);return}let s=new Date().valueOf()-this.lastActivityTimestamp.valueOf();s>=this.idleTimeoutMs?(this.trace("Idle timer triggered after "+this.idleTimeoutMs+"ms of inactivity"),this.enterIdle()):this.startIdleTimeout(this.idleTimeoutMs-s)},e),(n=(r=this.idleTimer).unref)===null||n===void 0||n.call(r)}maybeStartIdleTimer(){this.connectivityState!==$s.ConnectivityState.SHUTDOWN&&!this.idleTimer&&this.startIdleTimeout(this.idleTimeoutMs)}onCallStart(){this.channelzEnabled&&this.channelzInfoTracker.callTracker.addCallStarted(),this.callCount+=1}onCallEnd(e){this.channelzEnabled&&(e.code===Xu.Status.OK?this.channelzInfoTracker.callTracker.addCallSucceeded():this.channelzInfoTracker.callTracker.addCallFailed()),this.callCount-=1,this.lastActivityTimestamp=new Date,this.maybeStartIdleTimer()}createLoadBalancingCall(e,r,n,i,s){let o=(0,i9.getNextCallNumber)();return this.trace("createLoadBalancingCall ["+o+'] method="'+r+'"'),new wCt.LoadBalancingCall(this,e,r,n,i,s,o)}createRetryingCall(e,r,n,i,s){let o=(0,i9.getNextCallNumber)();return this.trace("createRetryingCall ["+o+'] method="'+r+'"'),new s9.RetryingCall(this,e,r,n,i,s,o,this.retryBufferTracker,EL.get(this.getTarget()))}createResolvingCall(e,r,n,i,s){let o=(0,i9.getNextCallNumber)();this.trace("createResolvingCall ["+o+'] method="'+e+'", deadline='+(0,ACt.deadlineToString)(r));let a={deadline:r,flags:s??Xu.Propagate.DEFAULTS,host:n??this.defaultAuthority,parentCall:i},c=new RCt.ResolvingCall(this,e,a,this.filterStackFactory.clone(),o);return this.onCallStart(),c.addStatusWatcher(l=>{this.onCallEnd(l)}),c}close(){var e;this.resolvingLoadBalancer.destroy(),this.updateState($s.ConnectivityState.SHUTDOWN),this.currentPicker=new c9;for(let r of this.configSelectionQueue)r.cancelWithStatus(Xu.Status.UNAVAILABLE,"Channel closed before call started");this.configSelectionQueue=[];for(let r of this.pickQueue)r.cancelWithStatus(Xu.Status.UNAVAILABLE,"Channel closed before call started");this.pickQueue=[],this.callRefTimer&&clearInterval(this.callRefTimer),this.idleTimer&&clearTimeout(this.idleTimer),this.channelzEnabled&&(0,Ow.unregisterChannelzRef)(this.channelzRef),this.subchannelPool.unrefUnusedSubchannels(),(e=this.configSelector)===null||e===void 0||e.unref(),this.configSelector=null}getTarget(){return(0,SL.uriToString)(this.target)}getConnectivityState(e){let r=this.connectivityState;return e&&(this.resolvingLoadBalancer.exitIdle(),this.lastActivityTimestamp=new Date,this.maybeStartIdleTimer()),r}watchConnectivityState(e,r,n){if(this.connectivityState===$s.ConnectivityState.SHUTDOWN)throw new Error("Channel has been shut down");let i=null;if(r!==1/0){let o=r instanceof Date?r:new Date(r),a=new Date;if(r===-1/0||o<=a){process.nextTick(n,new Error("Deadline passed without connectivity state change"));return}i=setTimeout(()=>{this.removeConnectivityStateWatcher(s),n(new Error("Deadline passed without connectivity state change"))},o.getTime()-a.getTime())}let s={currentState:e,callback:n,timer:i};this.connectivityStateWatchers.push(s)}getChannelzRef(){return this.channelzRef}createCall(e,r,n,i,s){if(typeof e!="string")throw new TypeError("Channel#createCall: method must be a string");if(!(typeof r=="number"||r instanceof Date))throw new TypeError("Channel#createCall: deadline must be a number or Date");if(this.connectivityState===$s.ConnectivityState.SHUTDOWN)throw new Error("Channel has been shut down");return this.createResolvingCall(e,r,n,i,s)}getOptions(){return this.options}};Ip.InternalChannel=u9});var i5=E(vL=>{"use strict";Object.defineProperty(vL,"__esModule",{value:!0});vL.ChannelImplementation=void 0;var $Ct=I_(),LCt=d9(),f9=class{constructor(e,r,n){if(typeof e!="string")throw new TypeError("Channel target must be a string");if(!(r instanceof $Ct.ChannelCredentials))throw new TypeError("Channel credentials must be a ChannelCredentials object");if(n&&typeof n!="object")throw new TypeError("Channel options must be an object");this.internalChannel=new LCt.InternalChannel(e,r,n)}close(){this.internalChannel.close()}getTarget(){return this.internalChannel.getTarget()}getConnectivityState(e){return this.internalChannel.getConnectivityState(e)}watchConnectivityState(e,r,n){this.internalChannel.watchConnectivityState(e,r,n)}getChannelzRef(){return this.internalChannel.getChannelzRef()}createCall(e,r,n,i,s){if(typeof e!="string")throw new TypeError("Channel#createCall: method must be a string");if(!(typeof r=="number"||r instanceof Date))throw new TypeError("Channel#createCall: deadline must be a number or Date");return this.internalChannel.createCall(e,r,n,i,s)}};vL.ChannelImplementation=f9});var zke=E(bo=>{"use strict";Object.defineProperty(bo,"__esModule",{value:!0});bo.ServerDuplexStreamImpl=bo.ServerWritableStreamImpl=bo.ServerReadableStreamImpl=bo.ServerUnaryCallImpl=void 0;bo.serverErrorToStatus=S9;var DCt=W("events"),_9=W("stream"),y9=st(),Bke=Vr();function S9(t,e){var r;let n={code:y9.Status.UNKNOWN,details:"message"in t?t.message:"Unknown Error",metadata:(r=e??t.metadata)!==null&&r!==void 0?r:null};return"code"in t&&typeof t.code=="number"&&Number.isInteger(t.code)&&(n.code=t.code,"details"in t&&typeof t.details=="string"&&(n.details=t.details)),n}var p9=class extends DCt.EventEmitter{constructor(e,r,n,i){super(),this.path=e,this.call=r,this.metadata=n,this.request=i,this.cancelled=!1}getPeer(){return this.call.getPeer()}sendMetadata(e){this.call.sendMetadata(e)}getDeadline(){return this.call.getDeadline()}getPath(){return this.path}getHost(){return this.call.getHost()}getAuthContext(){return this.call.getAuthContext()}getMetricsRecorder(){return this.call.getMetricsRecorder()}};bo.ServerUnaryCallImpl=p9;var h9=class extends _9.Readable{constructor(e,r,n){super({objectMode:!0}),this.path=e,this.call=r,this.metadata=n,this.cancelled=!1}_read(e){this.call.startRead()}getPeer(){return this.call.getPeer()}sendMetadata(e){this.call.sendMetadata(e)}getDeadline(){return this.call.getDeadline()}getPath(){return this.path}getHost(){return this.call.getHost()}getAuthContext(){return this.call.getAuthContext()}getMetricsRecorder(){return this.call.getMetricsRecorder()}};bo.ServerReadableStreamImpl=h9;var m9=class extends _9.Writable{constructor(e,r,n,i){super({objectMode:!0}),this.path=e,this.call=r,this.metadata=n,this.request=i,this.pendingStatus={code:y9.Status.OK,details:"OK"},this.cancelled=!1,this.trailingMetadata=new Bke.Metadata,this.on("error",s=>{this.pendingStatus=S9(s),this.end()})}getPeer(){return this.call.getPeer()}sendMetadata(e){this.call.sendMetadata(e)}getDeadline(){return this.call.getDeadline()}getPath(){return this.path}getHost(){return this.call.getHost()}getAuthContext(){return this.call.getAuthContext()}getMetricsRecorder(){return this.call.getMetricsRecorder()}_write(e,r,n){this.call.sendMessage(e,n)}_final(e){var r;e(null),this.call.sendStatus(Object.assign(Object.assign({},this.pendingStatus),{metadata:(r=this.pendingStatus.metadata)!==null&&r!==void 0?r:this.trailingMetadata}))}end(e){return e&&(this.trailingMetadata=e),super.end()}};bo.ServerWritableStreamImpl=m9;var g9=class extends _9.Duplex{constructor(e,r,n){super({objectMode:!0}),this.path=e,this.call=r,this.metadata=n,this.pendingStatus={code:y9.Status.OK,details:"OK"},this.cancelled=!1,this.trailingMetadata=new Bke.Metadata,this.on("error",i=>{this.pendingStatus=S9(i),this.end()})}getPeer(){return this.call.getPeer()}sendMetadata(e){this.call.sendMetadata(e)}getDeadline(){return this.call.getDeadline()}getPath(){return this.path}getHost(){return this.call.getHost()}getAuthContext(){return this.call.getAuthContext()}getMetricsRecorder(){return this.call.getMetricsRecorder()}_read(e){this.call.startRead()}_write(e,r,n){this.call.sendMessage(e,n)}_final(e){var r;e(null),this.call.sendStatus(Object.assign(Object.assign({},this.pendingStatus),{metadata:(r=this.pendingStatus.metadata)!==null&&r!==void 0?r:this.trailingMetadata}))}end(e){return e&&(this.trailingMetadata=e),super.end()}};bo.ServerDuplexStreamImpl=g9});var bL=E(ty=>{"use strict";Object.defineProperty(ty,"__esModule",{value:!0});ty.ServerCredentials=void 0;ty.createCertificateProviderServerCredentials=MCt;ty.createServerCredentialsWithInterceptors=UCt;var E9=RK(),Op=class{constructor(e,r){this.serverConstructorOptions=e,this.watchers=new Set,this.latestContextOptions=null,this.latestContextOptions=r??null}_addWatcher(e){this.watchers.add(e)}_removeWatcher(e){this.watchers.delete(e)}getWatcherCount(){return this.watchers.size}updateSecureContextOptions(e){this.latestContextOptions=e;for(let r of this.watchers)r(this.latestContextOptions)}_isSecure(){return this.serverConstructorOptions!==null}_getSecureContextOptions(){return this.latestContextOptions}_getConstructorOptions(){return this.serverConstructorOptions}_getInterceptors(){return[]}static createInsecure(){return new v9}static createSsl(e,r,n=!1){var i;if(e!==null&&!Buffer.isBuffer(e))throw new TypeError("rootCerts must be null or a Buffer");if(!Array.isArray(r))throw new TypeError("keyCertPairs must be an array");if(typeof n!="boolean")throw new TypeError("checkClientCertificate must be a boolean");let s=[],o=[];for(let a=0;a<r.length;a++){let c=r[a];if(c===null||typeof c!="object")throw new TypeError(`keyCertPair[${a}] must be an object`);if(!Buffer.isBuffer(c.private_key))throw new TypeError(`keyCertPair[${a}].private_key must be a Buffer`);if(!Buffer.isBuffer(c.cert_chain))throw new TypeError(`keyCertPair[${a}].cert_chain must be a Buffer`);s.push(c.cert_chain),o.push(c.private_key)}return new b9({requestCert:n,ciphers:E9.CIPHER_SUITES},{ca:(i=e??(0,E9.getDefaultRootsData)())!==null&&i!==void 0?i:void 0,cert:s,key:o})}};ty.ServerCredentials=Op;var v9=class t extends Op{constructor(){super(null)}_getSettings(){return null}_equals(e){return e instanceof t}},b9=class t extends Op{constructor(e,r){super(e,r),this.options=Object.assign(Object.assign({},e),r)}_equals(e){if(this===e)return!0;if(!(e instanceof t))return!1;if(Buffer.isBuffer(this.options.ca)&&Buffer.isBuffer(e.options.ca)){if(!this.options.ca.equals(e.options.ca))return!1}else if(this.options.ca!==e.options.ca)return!1;if(Array.isArray(this.options.cert)&&Array.isArray(e.options.cert)){if(this.options.cert.length!==e.options.cert.length)return!1;for(let r=0;r<this.options.cert.length;r++){let n=this.options.cert[r],i=e.options.cert[r];if(Buffer.isBuffer(n)&&Buffer.isBuffer(i)){if(!n.equals(i))return!1}else if(n!==i)return!1}}else if(this.options.cert!==e.options.cert)return!1;if(Array.isArray(this.options.key)&&Array.isArray(e.options.key)){if(this.options.key.length!==e.options.key.length)return!1;for(let r=0;r<this.options.key.length;r++){let n=this.options.key[r],i=e.options.key[r];if(Buffer.isBuffer(n)&&Buffer.isBuffer(i)){if(!n.equals(i))return!1}else if(n!==i)return!1}}else if(this.options.key!==e.options.key)return!1;return this.options.requestCert===e.options.requestCert}},T9=class t extends Op{constructor(e,r,n){super({requestCert:r!==null,rejectUnauthorized:n,ciphers:E9.CIPHER_SUITES}),this.identityCertificateProvider=e,this.caCertificateProvider=r,this.requireClientCertificate=n,this.latestCaUpdate=null,this.latestIdentityUpdate=null,this.caCertificateUpdateListener=this.handleCaCertificateUpdate.bind(this),this.identityCertificateUpdateListener=this.handleIdentityCertitificateUpdate.bind(this)}_addWatcher(e){var r;this.getWatcherCount()===0&&((r=this.caCertificateProvider)===null||r===void 0||r.addCaCertificateListener(this.caCertificateUpdateListener),this.identityCertificateProvider.addIdentityCertificateListener(this.identityCertificateUpdateListener)),super._addWatcher(e)}_removeWatcher(e){var r;super._removeWatcher(e),this.getWatcherCount()===0&&((r=this.caCertificateProvider)===null||r===void 0||r.removeCaCertificateListener(this.caCertificateUpdateListener),this.identityCertificateProvider.removeIdentityCertificateListener(this.identityCertificateUpdateListener))}_equals(e){return this===e?!0:e instanceof t?this.caCertificateProvider===e.caCertificateProvider&&this.identityCertificateProvider===e.identityCertificateProvider&&this.requireClientCertificate===e.requireClientCertificate:!1}calculateSecureContextOptions(){var e;return this.latestIdentityUpdate===null||this.caCertificateProvider!==null&&this.latestCaUpdate===null?null:{ca:(e=this.latestCaUpdate)===null||e===void 0?void 0:e.caCertificate,cert:[this.latestIdentityUpdate.certificate],key:[this.latestIdentityUpdate.privateKey]}}finalizeUpdate(){let e=this.calculateSecureContextOptions();this.updateSecureContextOptions(e)}handleCaCertificateUpdate(e){this.latestCaUpdate=e,this.finalizeUpdate()}handleIdentityCertitificateUpdate(e){this.latestIdentityUpdate=e,this.finalizeUpdate()}};function MCt(t,e,r){return new T9(t,e,r)}var w9=class t extends Op{constructor(e,r){super({}),this.childCredentials=e,this.interceptors=r}_isSecure(){return this.childCredentials._isSecure()}_equals(e){if(!(e instanceof t)||!this.childCredentials._equals(e.childCredentials)||this.interceptors.length!==e.interceptors.length)return!1;for(let r=0;r<this.interceptors.length;r++)if(this.interceptors[r]!==e.interceptors[r])return!1;return!0}_getInterceptors(){return this.interceptors}_addWatcher(e){this.childCredentials._addWatcher(e)}_removeWatcher(e){this.childCredentials._removeWatcher(e)}_getConstructorOptions(){return this.childCredentials._getConstructorOptions()}_getSecureContextOptions(){return this.childCredentials._getSecureContextOptions()}};function UCt(t,e){return new w9(t,e)}});var Pw=E(Xc=>{"use strict";Object.defineProperty(Xc,"__esModule",{value:!0});Xc.durationMessageToDuration=FCt;Xc.msToDuration=jCt;Xc.durationToMs=qCt;Xc.isDuration=BCt;Xc.isDurationMessage=zCt;Xc.parseDuration=HCt;Xc.durationToString=GCt;function FCt(t){return{seconds:Number.parseInt(t.seconds),nanos:t.nanos}}function jCt(t){return{seconds:t/1e3|0,nanos:t%1e3*1e6|0}}function qCt(t){return t.seconds*1e3+t.nanos/1e6|0}function BCt(t){return typeof t.seconds=="number"&&typeof t.nanos=="number"}function zCt(t){return typeof t.seconds=="string"&&typeof t.nanos=="number"}var VCt=/^(\d+)(?:\.(\d+))?s$/;function HCt(t){let e=t.match(VCt);return e?{seconds:Number.parseInt(e[1],10),nanos:e[2]?Number.parseInt(e[2].padEnd(9,"0"),10):0}:null}function GCt(t){if(t.nanos===0)return`${t.seconds}s`;let e;return t.nanos%1e6===0?e=1e6:t.nanos%1e3===0?e=1e3:e=1,`${t.seconds}.${t.nanos/e}s`}});var wL=E(Gi=>{"use strict";Object.defineProperty(Gi,"__esModule",{value:!0});Gi.OrcaOobMetricsSubchannelWrapper=Gi.GRPC_METRICS_HEADER=Gi.ServerMetricRecorder=Gi.PerRequestMetricRecorder=void 0;Gi.createOrcaClient=Wke;Gi.createMetricsReader=QCt;var WCt=p$(),A9=Pw(),YCt=I_(),KCt=Iw(),Vke=st(),JCt=O_(),ZCt=ti(),Hke=null;function TL(){if(Hke)return Hke;let t=f8().loadSync,e=t("xds/service/orca/v3/orca.proto",{keepCase:!0,longs:String,enums:String,defaults:!0,oneofs:!0,includeDirs:[`${__dirname}/../../proto/xds`,`${__dirname}/../../proto/protoc-gen-validate`]});return(0,WCt.loadPackageDefinition)(e)}var R9=class{constructor(){this.message={}}recordRequestCostMetric(e,r){this.message.request_cost||(this.message.request_cost={}),this.message.request_cost[e]=r}recordUtilizationMetric(e,r){this.message.utilization||(this.message.utilization={}),this.message.utilization[e]=r}recordNamedMetric(e,r){this.message.named_metrics||(this.message.named_metrics={}),this.message.named_metrics[e]=r}recordCPUUtilizationMetric(e){this.message.cpu_utilization=e}recordMemoryUtilizationMetric(e){this.message.mem_utilization=e}recordApplicationUtilizationMetric(e){this.message.application_utilization=e}recordQpsMetric(e){this.message.rps_fractional=e}recordEpsMetric(e){this.message.eps=e}serialize(){return TL().xds.data.orca.v3.OrcaLoadReport.serialize(this.message)}};Gi.PerRequestMetricRecorder=R9;var XCt=3e4,x9=class{constructor(){this.message={},this.serviceImplementation={StreamCoreMetrics:e=>{let r=e.request.report_interval?(0,A9.durationToMs)((0,A9.durationMessageToDuration)(e.request.report_interval)):XCt,n=setInterval(()=>{e.write(this.message)},r);e.on("cancelled",()=>{clearInterval(n)})}}}putUtilizationMetric(e,r){this.message.utilization||(this.message.utilization={}),this.message.utilization[e]=r}setAllUtilizationMetrics(e){this.message.utilization=Object.assign({},e)}deleteUtilizationMetric(e){var r;(r=this.message.utilization)===null||r===void 0||delete r[e]}setCpuUtilizationMetric(e){this.message.cpu_utilization=e}deleteCpuUtilizationMetric(){delete this.message.cpu_utilization}setApplicationUtilizationMetric(e){this.message.application_utilization=e}deleteApplicationUtilizationMetric(){delete this.message.application_utilization}setQpsMetric(e){this.message.rps_fractional=e}deleteQpsMetric(){delete this.message.rps_fractional}setEpsMetric(e){this.message.eps=e}deleteEpsMetric(){delete this.message.eps}addToServer(e){let r=TL().xds.service.orca.v3.OpenRcaService.service;e.addService(r,this.serviceImplementation)}};Gi.ServerMetricRecorder=x9;function Wke(t){let e=TL().xds.service.orca.v3.OpenRcaService;return new e("unused",YCt.ChannelCredentials.createInsecure(),{channelOverride:t})}Gi.GRPC_METRICS_HEADER="endpoint-load-metrics-bin";var Gke="grpc_orca_load_report";function QCt(t,e){return(r,n,i)=>{let s=i.getOpaque(Gke);if(s)t(s);else{let o=i.get(Gi.GRPC_METRICS_HEADER);o.length>0&&(s=TL().xds.data.orca.v3.OrcaLoadReport.deserialize(o[0]),t(s),i.setOpaque(Gke,s))}e&&e(r,n,i)}}var Yke="orca_oob_metrics",I9=class{constructor(e,r){this.metricsListener=e,this.intervalMs=r,this.dataProducer=null}setSubchannel(e){let r=e.getOrCreateDataProducer(Yke,eNt);this.dataProducer=r,r.addDataWatcher(this)}destroy(){var e;(e=this.dataProducer)===null||e===void 0||e.removeDataWatcher(this)}getInterval(){return this.intervalMs}onMetricsUpdate(e){this.metricsListener(e)}},O9=class{constructor(e){this.subchannel=e,this.dataWatchers=new Set,this.orcaSupported=!0,this.metricsCall=null,this.currentInterval=1/0,this.backoffTimer=new JCt.BackoffTimeout(()=>this.updateMetricsSubscription()),this.subchannelStateListener=()=>this.updateMetricsSubscription();let r=e.getChannel();this.client=Wke(r),e.addConnectivityStateListener(this.subchannelStateListener)}addDataWatcher(e){this.dataWatchers.add(e),this.updateMetricsSubscription()}removeDataWatcher(e){var r;this.dataWatchers.delete(e),this.dataWatchers.size===0?(this.subchannel.removeDataProducer(Yke),(r=this.metricsCall)===null||r===void 0||r.cancel(),this.metricsCall=null,this.client.close(),this.subchannel.removeConnectivityStateListener(this.subchannelStateListener)):this.updateMetricsSubscription()}updateMetricsSubscription(){var e;if(this.dataWatchers.size===0||!this.orcaSupported||this.subchannel.getConnectivityState()!==ZCt.ConnectivityState.READY)return;let r=Math.min(...Array.from(this.dataWatchers).map(n=>n.getInterval()));if(!this.metricsCall||r!==this.currentInterval){(e=this.metricsCall)===null||e===void 0||e.cancel(),this.currentInterval=r;let n=this.client.streamCoreMetrics({report_interval:(0,A9.msToDuration)(r)});this.metricsCall=n,n.on("data",i=>{this.dataWatchers.forEach(s=>{s.onMetricsUpdate(i)})}),n.on("error",i=>{if(this.metricsCall=null,i.code===Vke.Status.UNIMPLEMENTED){this.orcaSupported=!1;return}i.code!==Vke.Status.CANCELLED&&this.backoffTimer.runOnce()})}}},P9=class extends KCt.BaseSubchannelWrapper{constructor(e,r,n){super(e),this.addDataWatcher(new I9(r,n))}getWrappedSubchannel(){return this.child}};Gi.OrcaOobMetricsSubchannelWrapper=P9;function eNt(t){return new O9(t)}});var M9=E(Ls=>{"use strict";Object.defineProperty(Ls,"__esModule",{value:!0});Ls.BaseServerInterceptingCall=Ls.ServerInterceptingCall=Ls.ResponderBuilder=Ls.ServerListenerBuilder=void 0;Ls.isInterceptingServerListener=nNt;Ls.getServerInterceptingCall=cNt;var xL=Vr(),ni=st(),ry=W("http2"),Kke=zk(),Jke=W("zlib"),tNt=z8(),t$e=qt(),rNt=W("tls"),Zke=wL(),r$e="server_call";function Pp(t){t$e.trace(ni.LogVerbosity.DEBUG,r$e,t)}var N9=class{constructor(){this.metadata=void 0,this.message=void 0,this.halfClose=void 0,this.cancel=void 0}withOnReceiveMetadata(e){return this.metadata=e,this}withOnReceiveMessage(e){return this.message=e,this}withOnReceiveHalfClose(e){return this.halfClose=e,this}withOnCancel(e){return this.cancel=e,this}build(){return{onReceiveMetadata:this.metadata,onReceiveMessage:this.message,onReceiveHalfClose:this.halfClose,onCancel:this.cancel}}};Ls.ServerListenerBuilder=N9;function nNt(t){return t.onReceiveMetadata!==void 0&&t.onReceiveMetadata.length===1}var k9=class{constructor(e,r){this.listener=e,this.nextListener=r,this.cancelled=!1,this.processingMetadata=!1,this.hasPendingMessage=!1,this.pendingMessage=null,this.processingMessage=!1,this.hasPendingHalfClose=!1}processPendingMessage(){this.hasPendingMessage&&(this.nextListener.onReceiveMessage(this.pendingMessage),this.pendingMessage=null,this.hasPendingMessage=!1)}processPendingHalfClose(){this.hasPendingHalfClose&&(this.nextListener.onReceiveHalfClose(),this.hasPendingHalfClose=!1)}onReceiveMetadata(e){this.cancelled||(this.processingMetadata=!0,this.listener.onReceiveMetadata(e,r=>{this.processingMetadata=!1,!this.cancelled&&(this.nextListener.onReceiveMetadata(r),this.processPendingMessage(),this.processPendingHalfClose())}))}onReceiveMessage(e){this.cancelled||(this.processingMessage=!0,this.listener.onReceiveMessage(e,r=>{this.processingMessage=!1,!this.cancelled&&(this.processingMetadata?(this.pendingMessage=r,this.hasPendingMessage=!0):(this.nextListener.onReceiveMessage(r),this.processPendingHalfClose()))}))}onReceiveHalfClose(){this.cancelled||this.listener.onReceiveHalfClose(()=>{this.cancelled||(this.processingMetadata||this.processingMessage?this.hasPendingHalfClose=!0:this.nextListener.onReceiveHalfClose())})}onCancel(){this.cancelled=!0,this.listener.onCancel(),this.nextListener.onCancel()}},$9=class{constructor(){this.start=void 0,this.metadata=void 0,this.message=void 0,this.status=void 0}withStart(e){return this.start=e,this}withSendMetadata(e){return this.metadata=e,this}withSendMessage(e){return this.message=e,this}withSendStatus(e){return this.status=e,this}build(){return{start:this.start,sendMetadata:this.metadata,sendMessage:this.message,sendStatus:this.status}}};Ls.ResponderBuilder=$9;var AL={onReceiveMetadata:(t,e)=>{e(t)},onReceiveMessage:(t,e)=>{e(t)},onReceiveHalfClose:t=>{t()},onCancel:()=>{}},RL={start:t=>{t()},sendMetadata:(t,e)=>{e(t)},sendMessage:(t,e)=>{e(t)},sendStatus:(t,e)=>{e(t)}},L9=class{constructor(e,r){var n,i,s,o;this.nextCall=e,this.processingMetadata=!1,this.sentMetadata=!1,this.processingMessage=!1,this.pendingMessage=null,this.pendingMessageCallback=null,this.pendingStatus=null,this.responder={start:(n=r?.start)!==null&&n!==void 0?n:RL.start,sendMetadata:(i=r?.sendMetadata)!==null&&i!==void 0?i:RL.sendMetadata,sendMessage:(s=r?.sendMessage)!==null&&s!==void 0?s:RL.sendMessage,sendStatus:(o=r?.sendStatus)!==null&&o!==void 0?o:RL.sendStatus}}processPendingMessage(){this.pendingMessageCallback&&(this.nextCall.sendMessage(this.pendingMessage,this.pendingMessageCallback),this.pendingMessage=null,this.pendingMessageCallback=null)}processPendingStatus(){this.pendingStatus&&(this.nextCall.sendStatus(this.pendingStatus),this.pendingStatus=null)}start(e){this.responder.start(r=>{var n,i,s,o;let a={onReceiveMetadata:(n=r?.onReceiveMetadata)!==null&&n!==void 0?n:AL.onReceiveMetadata,onReceiveMessage:(i=r?.onReceiveMessage)!==null&&i!==void 0?i:AL.onReceiveMessage,onReceiveHalfClose:(s=r?.onReceiveHalfClose)!==null&&s!==void 0?s:AL.onReceiveHalfClose,onCancel:(o=r?.onCancel)!==null&&o!==void 0?o:AL.onCancel},c=new k9(a,e);this.nextCall.start(c)})}sendMetadata(e){this.processingMetadata=!0,this.sentMetadata=!0,this.responder.sendMetadata(e,r=>{this.processingMetadata=!1,this.nextCall.sendMetadata(r),this.processPendingMessage(),this.processPendingStatus()})}sendMessage(e,r){this.processingMessage=!0,this.sentMetadata||this.sendMetadata(new xL.Metadata),this.responder.sendMessage(e,n=>{this.processingMessage=!1,this.processingMetadata?(this.pendingMessage=n,this.pendingMessageCallback=r):this.nextCall.sendMessage(n,r)})}sendStatus(e){this.responder.sendStatus(e,r=>{this.processingMetadata||this.processingMessage?this.pendingStatus=r:this.nextCall.sendStatus(r)})}startRead(){this.nextCall.startRead()}getPeer(){return this.nextCall.getPeer()}getDeadline(){return this.nextCall.getDeadline()}getHost(){return this.nextCall.getHost()}getAuthContext(){return this.nextCall.getAuthContext()}getConnectionInfo(){return this.nextCall.getConnectionInfo()}getMetricsRecorder(){return this.nextCall.getMetricsRecorder()}};Ls.ServerInterceptingCall=L9;var n$e="grpc-accept-encoding",D9="grpc-encoding",Xke="grpc-message",Qke="grpc-status",C9="grpc-timeout",iNt=/(\d{1,8})\s*([HMSmun])/,sNt={H:36e5,M:6e4,S:1e3,m:1,u:.001,n:1e-6},oNt={[n$e]:"identity,deflate,gzip",[D9]:"identity"},e$e={[ry.constants.HTTP2_HEADER_STATUS]:ry.constants.HTTP_STATUS_OK,[ry.constants.HTTP2_HEADER_CONTENT_TYPE]:"application/grpc+proto"},aNt={waitForTrailers:!0},IL=class{constructor(e,r,n,i,s){var o,a;this.stream=e,this.callEventTracker=n,this.handler=i,this.listener=null,this.deadlineTimer=null,this.deadline=1/0,this.maxSendMessageSize=ni.DEFAULT_MAX_SEND_MESSAGE_LENGTH,this.maxReceiveMessageSize=ni.DEFAULT_MAX_RECEIVE_MESSAGE_LENGTH,this.cancelled=!1,this.metadataSent=!1,this.wantTrailers=!1,this.cancelNotified=!1,this.incomingEncoding="identity",this.readQueue=[],this.isReadPending=!1,this.receivedHalfClose=!1,this.streamEnded=!1,this.metricsRecorder=new Zke.PerRequestMetricRecorder,this.stream.once("close",()=>{var f;Pp("Request to method "+((f=this.handler)===null||f===void 0?void 0:f.path)+" stream closed with rstCode "+this.stream.rstCode),this.callEventTracker&&!this.streamEnded&&(this.streamEnded=!0,this.callEventTracker.onStreamEnd(!1),this.callEventTracker.onCallEnd({code:ni.Status.CANCELLED,details:"Stream closed before sending status",metadata:null})),this.notifyOnCancel()}),this.stream.on("data",f=>{this.handleDataFrame(f)}),this.stream.pause(),this.stream.on("end",()=>{this.handleEndEvent()}),"grpc.max_send_message_length"in s&&(this.maxSendMessageSize=s["grpc.max_send_message_length"]),"grpc.max_receive_message_length"in s&&(this.maxReceiveMessageSize=s["grpc.max_receive_message_length"]),this.host=(o=r[":authority"])!==null&&o!==void 0?o:r.host,this.decoder=new tNt.StreamDecoder(this.maxReceiveMessageSize);let c=xL.Metadata.fromHttp2Headers(r);t$e.isTracerEnabled(r$e)&&Pp("Request to "+this.handler.path+" received headers "+JSON.stringify(c.toJSON()));let l=c.get(C9);l.length>0&&this.handleTimeoutHeader(l[0]);let u=c.get(D9);u.length>0&&(this.incomingEncoding=u[0]),c.remove(C9),c.remove(D9),c.remove(n$e),c.remove(ry.constants.HTTP2_HEADER_ACCEPT_ENCODING),c.remove(ry.constants.HTTP2_HEADER_TE),c.remove(ry.constants.HTTP2_HEADER_CONTENT_TYPE),this.metadata=c;let d=(a=e.session)===null||a===void 0?void 0:a.socket;this.connectionInfo={localAddress:d?.localAddress,localPort:d?.localPort,remoteAddress:d?.remoteAddress,remotePort:d?.remotePort},this.shouldSendMetrics=!!s["grpc.server_call_metric_recording"]}handleTimeoutHeader(e){let r=e.toString().match(iNt);if(r===null){let s={code:ni.Status.INTERNAL,details:`Invalid ${C9} value "${e}"`,metadata:null};process.nextTick(()=>{this.sendStatus(s)});return}let n=+r[1]*sNt[r[2]]|0,i=new Date;this.deadline=i.setMilliseconds(i.getMilliseconds()+n),this.deadlineTimer=setTimeout(()=>{let s={code:ni.Status.DEADLINE_EXCEEDED,details:"Deadline exceeded",metadata:null};this.sendStatus(s)},n)}checkCancelled(){return!this.cancelled&&(this.stream.destroyed||this.stream.closed)&&(this.notifyOnCancel(),this.cancelled=!0),this.cancelled}notifyOnCancel(){this.cancelNotified||(this.cancelNotified=!0,this.cancelled=!0,process.nextTick(()=>{var e;(e=this.listener)===null||e===void 0||e.onCancel()}),this.deadlineTimer&&clearTimeout(this.deadlineTimer),this.stream.resume())}maybeSendMetadata(){this.metadataSent||this.sendMetadata(new xL.Metadata)}serializeMessage(e){let r=this.handler.serialize(e),n=r.byteLength,i=Buffer.allocUnsafe(n+5);return i.writeUInt8(0,0),i.writeUInt32BE(n,1),r.copy(i,5),i}decompressMessage(e,r){let n=e.subarray(5);if(r==="identity")return n;if(r==="deflate"||r==="gzip"){let i;return r==="deflate"?i=Jke.createInflate():i=Jke.createGunzip(),new Promise((s,o)=>{let a=0,c=[];i.on("error",l=>{o({code:ni.Status.INTERNAL,details:"Failed to decompress message"})}),i.on("data",l=>{c.push(l),a+=l.byteLength,this.maxReceiveMessageSize!==-1&&a>this.maxReceiveMessageSize&&(i.destroy(),o({code:ni.Status.RESOURCE_EXHAUSTED,details:`Received message that decompresses to a size larger than ${this.maxReceiveMessageSize}`}))}),i.on("end",()=>{s(Buffer.concat(c))}),i.write(n),i.end()})}else return Promise.reject({code:ni.Status.UNIMPLEMENTED,details:`Received message compressed with unsupported encoding "${r}"`})}async decompressAndMaybePush(e){if(e.type!=="COMPRESSED")throw new Error(`Invalid queue entry type: ${e.type}`);let n=e.compressedMessage.readUInt8(0)===1?this.incomingEncoding:"identity",i;try{i=await this.decompressMessage(e.compressedMessage,n)}catch(s){this.sendStatus(s);return}try{e.parsedMessage=this.handler.deserialize(i)}catch(s){this.sendStatus({code:ni.Status.INTERNAL,details:`Error deserializing request: ${s.message}`});return}e.type="READABLE",this.maybePushNextMessage()}maybePushNextMessage(){if(this.listener&&this.isReadPending&&this.readQueue.length>0&&this.readQueue[0].type!=="COMPRESSED"){this.isReadPending=!1;let e=this.readQueue.shift();e.type==="READABLE"?this.listener.onReceiveMessage(e.parsedMessage):this.listener.onReceiveHalfClose()}}handleDataFrame(e){var r;if(this.checkCancelled())return;Pp("Request to "+this.handler.path+" received data frame of size "+e.length);let n;try{n=this.decoder.write(e)}catch(i){this.sendStatus({code:ni.Status.RESOURCE_EXHAUSTED,details:i.message});return}for(let i of n){this.stream.pause();let s={type:"COMPRESSED",compressedMessage:i,parsedMessage:null};this.readQueue.push(s),this.decompressAndMaybePush(s),(r=this.callEventTracker)===null||r===void 0||r.addMessageReceived()}}handleEndEvent(){this.readQueue.push({type:"HALF_CLOSE",compressedMessage:null,parsedMessage:null}),this.receivedHalfClose=!0,this.maybePushNextMessage()}start(e){Pp("Request to "+this.handler.path+" start called"),!this.checkCancelled()&&(this.listener=e,e.onReceiveMetadata(this.metadata))}sendMetadata(e){if(this.checkCancelled()||this.metadataSent)return;this.metadataSent=!0;let r=e?e.toHttp2Headers():null,n=Object.assign(Object.assign(Object.assign({},e$e),oNt),r);this.stream.respond(n,aNt)}sendMessage(e,r){if(this.checkCancelled())return;let n;try{n=this.serializeMessage(e)}catch(i){this.sendStatus({code:ni.Status.INTERNAL,details:`Error serializing response: ${(0,Kke.getErrorMessage)(i)}`,metadata:null});return}if(this.maxSendMessageSize!==-1&&n.length-5>this.maxSendMessageSize){this.sendStatus({code:ni.Status.RESOURCE_EXHAUSTED,details:`Sent message larger than max (${n.length} vs. ${this.maxSendMessageSize})`,metadata:null});return}this.maybeSendMetadata(),Pp("Request to "+this.handler.path+" sent data frame of size "+n.length),this.stream.write(n,i=>{var s;if(i){this.sendStatus({code:ni.Status.INTERNAL,details:`Error writing message: ${(0,Kke.getErrorMessage)(i)}`,metadata:null});return}(s=this.callEventTracker)===null||s===void 0||s.addMessageSent(),r()})}sendStatus(e){var r,n,i;if(this.checkCancelled())return;Pp("Request to method "+((r=this.handler)===null||r===void 0?void 0:r.path)+" ended with status code: "+ni.Status[e.code]+" details: "+e.details);let s=(i=(n=e.metadata)===null||n===void 0?void 0:n.clone())!==null&&i!==void 0?i:new xL.Metadata;if(this.shouldSendMetrics&&s.set(Zke.GRPC_METRICS_HEADER,this.metricsRecorder.serialize()),this.metadataSent)this.wantTrailers?this.notifyOnCancel():(this.wantTrailers=!0,this.stream.once("wantTrailers",()=>{this.callEventTracker&&!this.streamEnded&&(this.streamEnded=!0,this.callEventTracker.onStreamEnd(!0),this.callEventTracker.onCallEnd(e));let o=Object.assign({[Qke]:e.code,[Xke]:encodeURI(e.details)},s.toHttp2Headers());this.stream.sendTrailers(o),this.notifyOnCancel()}),this.stream.end());else{this.callEventTracker&&!this.streamEnded&&(this.streamEnded=!0,this.callEventTracker.onStreamEnd(!0),this.callEventTracker.onCallEnd(e));let o=Object.assign(Object.assign({[Qke]:e.code,[Xke]:encodeURI(e.details)},e$e),s.toHttp2Headers());this.stream.respond(o,{endStream:!0}),this.notifyOnCancel()}}startRead(){Pp("Request to "+this.handler.path+" startRead called"),!this.checkCancelled()&&(this.isReadPending=!0,this.readQueue.length===0?this.receivedHalfClose||this.stream.resume():this.maybePushNextMessage())}getPeer(){var e;let r=(e=this.stream.session)===null||e===void 0?void 0:e.socket;return r?.remoteAddress?r.remotePort?`${r.remoteAddress}:${r.remotePort}`:r.remoteAddress:"unknown"}getDeadline(){return this.deadline}getHost(){return this.host}getAuthContext(){var e;if(((e=this.stream.session)===null||e===void 0?void 0:e.socket)instanceof rNt.TLSSocket){let r=this.stream.session.socket.getPeerCertificate();return{transportSecurityType:"ssl",sslPeerCertificate:r.raw?r:void 0}}else return{}}getConnectionInfo(){return this.connectionInfo}getMetricsRecorder(){return this.metricsRecorder}};Ls.BaseServerInterceptingCall=IL;function cNt(t,e,r,n,i,s){let o={path:i.path,requestStream:i.type==="clientStream"||i.type==="bidi",responseStream:i.type==="serverStream"||i.type==="bidi",requestDeserialize:i.deserialize,responseSerialize:i.serialize},a=new IL(e,r,n,i,s);return t.reduce((c,l)=>l(o,c),a)}});var u$e=E(ed=>{"use strict";var lNt=ed&&ed.__runInitializers||function(t,e,r){for(var n=arguments.length>2,i=0;i<e.length;i++)r=n?e[i].call(t,r):e[i].call(t);return n?r:void 0},uNt=ed&&ed.__esDecorate||function(t,e,r,n,i,s){function o(y){if(y!==void 0&&typeof y!="function")throw new TypeError("Function expected");return y}for(var a=n.kind,c=a==="getter"?"get":a==="setter"?"set":"value",l=!e&&t?n.static?t:t.prototype:null,u=e||(l?Object.getOwnPropertyDescriptor(l,n.name):{}),d,f=!1,p=r.length-1;p>=0;p--){var h={};for(var m in n)h[m]=m==="access"?{}:n[m];for(var m in n.access)h.access[m]=n.access[m];h.addInitializer=function(y){if(f)throw new TypeError("Cannot add initializers after decoration has completed");s.push(o(y||null))};var _=(0,r[p])(a==="accessor"?{get:u.get,set:u.set}:u[c],h);if(a==="accessor"){if(_===void 0)continue;if(_===null||typeof _!="object")throw new TypeError("Object expected");(d=o(_.get))&&(u.get=d),(d=o(_.set))&&(u.set=d),(d=o(_.init))&&i.unshift(d)}else(d=o(_))&&(a==="field"?i.unshift(d):u[c]=d)}l&&Object.defineProperty(l,n.name,u),f=!0};Object.defineProperty(ed,"__esModule",{value:!0});ed.Server=void 0;var Ai=W("http2"),dNt=W("util"),vr=st(),sy=zke(),U9=bL(),i$e=co(),iy=qt(),Qu=Ti(),To=ei(),Lr=Yu(),s$e=M9(),ny=~(1<<31),F9=~(1<<31),fNt=2e4,o$e=~(1<<31),{HTTP2_HEADER_PATH:a$e}=Ai.constants,pNt="server",c$e=Buffer.from("max_age");function l$e(t){iy.trace(vr.LogVerbosity.DEBUG,"server_call",t)}function hNt(){}function mNt(t){return function(e,r){return dNt.deprecate(e,t)}}function j9(t){return{code:vr.Status.UNIMPLEMENTED,details:`The server does not implement the method ${t}`}}function gNt(t,e){let r=j9(e);switch(t){case"unary":return(n,i)=>{i(r,null)};case"clientStream":return(n,i)=>{i(r,null)};case"serverStream":return n=>{n.emit("error",r)};case"bidi":return n=>{n.emit("error",r)};default:throw new Error(`Invalid handlerType ${t}`)}}var _Nt=(()=>{var t;let e=[],r;return t=class{constructor(i){var s,o,a,c,l,u;this.boundPorts=(lNt(this,e),new Map),this.http2Servers=new Map,this.sessionIdleTimeouts=new Map,this.handlers=new Map,this.sessions=new Map,this.started=!1,this.shutdown=!1,this.serverAddressString="null",this.channelzEnabled=!0,this.options=i??{},this.options["grpc.enable_channelz"]===0?(this.channelzEnabled=!1,this.channelzTrace=new Lr.ChannelzTraceStub,this.callTracker=new Lr.ChannelzCallTrackerStub,this.listenerChildrenTracker=new Lr.ChannelzChildrenTrackerStub,this.sessionChildrenTracker=new Lr.ChannelzChildrenTrackerStub):(this.channelzTrace=new Lr.ChannelzTrace,this.callTracker=new Lr.ChannelzCallTracker,this.listenerChildrenTracker=new Lr.ChannelzChildrenTracker,this.sessionChildrenTracker=new Lr.ChannelzChildrenTracker),this.channelzRef=(0,Lr.registerChannelzServer)("server",()=>this.getChannelzInfo(),this.channelzEnabled),this.channelzTrace.addTrace("CT_INFO","Server created"),this.maxConnectionAgeMs=(s=this.options["grpc.max_connection_age_ms"])!==null&&s!==void 0?s:ny,this.maxConnectionAgeGraceMs=(o=this.options["grpc.max_connection_age_grace_ms"])!==null&&o!==void 0?o:ny,this.keepaliveTimeMs=(a=this.options["grpc.keepalive_time_ms"])!==null&&a!==void 0?a:F9,this.keepaliveTimeoutMs=(c=this.options["grpc.keepalive_timeout_ms"])!==null&&c!==void 0?c:fNt,this.sessionIdleTimeout=(l=this.options["grpc.max_connection_idle_ms"])!==null&&l!==void 0?l:o$e,this.commonServerOptions={maxSendHeaderBlockLength:Number.MAX_SAFE_INTEGER},"grpc-node.max_session_memory"in this.options?this.commonServerOptions.maxSessionMemory=this.options["grpc-node.max_session_memory"]:this.commonServerOptions.maxSessionMemory=Number.MAX_SAFE_INTEGER,"grpc.max_concurrent_streams"in this.options&&(this.commonServerOptions.settings={maxConcurrentStreams:this.options["grpc.max_concurrent_streams"]}),this.interceptors=(u=this.options.interceptors)!==null&&u!==void 0?u:[],this.trace("Server constructed")}getChannelzInfo(){return{trace:this.channelzTrace,callTracker:this.callTracker,listenerChildren:this.listenerChildrenTracker.getChildLists(),sessionChildren:this.sessionChildrenTracker.getChildLists()}}getChannelzSessionInfo(i){var s,o,a;let c=this.sessions.get(i),l=i.socket,u=l.remoteAddress?(0,Qu.stringToSubchannelAddress)(l.remoteAddress,l.remotePort):null,d=l.localAddress?(0,Qu.stringToSubchannelAddress)(l.localAddress,l.localPort):null,f;if(i.encrypted){let h=l,m=h.getCipher(),_=h.getCertificate(),y=h.getPeerCertificate();f={cipherSuiteStandardName:(s=m.standardName)!==null&&s!==void 0?s:null,cipherSuiteOtherName:m.standardName?null:m.name,localCertificate:_&&"raw"in _?_.raw:null,remoteCertificate:y&&"raw"in y?y.raw:null}}else f=null;return{remoteAddress:u,localAddress:d,security:f,remoteName:null,streamsStarted:c.streamTracker.callsStarted,streamsSucceeded:c.streamTracker.callsSucceeded,streamsFailed:c.streamTracker.callsFailed,messagesSent:c.messagesSent,messagesReceived:c.messagesReceived,keepAlivesSent:c.keepAlivesSent,lastLocalStreamCreatedTimestamp:null,lastRemoteStreamCreatedTimestamp:c.streamTracker.lastCallStartedTimestamp,lastMessageSentTimestamp:c.lastMessageSentTimestamp,lastMessageReceivedTimestamp:c.lastMessageReceivedTimestamp,localFlowControlWindow:(o=i.state.localWindowSize)!==null&&o!==void 0?o:null,remoteFlowControlWindow:(a=i.state.remoteWindowSize)!==null&&a!==void 0?a:null}}trace(i){iy.trace(vr.LogVerbosity.DEBUG,pNt,"("+this.channelzRef.id+") "+i)}keepaliveTrace(i){iy.trace(vr.LogVerbosity.DEBUG,"keepalive","("+this.channelzRef.id+") "+i)}addProtoService(){throw new Error("Not implemented. Use addService() instead")}addService(i,s){if(i===null||typeof i!="object"||s===null||typeof s!="object")throw new Error("addService() requires two objects as arguments");let o=Object.keys(i);if(o.length===0)throw new Error("Cannot add an empty service to a server");o.forEach(a=>{let c=i[a],l;c.requestStream?c.responseStream?l="bidi":l="clientStream":c.responseStream?l="serverStream":l="unary";let u=s[a],d;if(u===void 0&&typeof c.originalName=="string"&&(u=s[c.originalName]),u!==void 0?d=u.bind(s):d=gNt(l,a),this.register(c.path,d,c.responseSerialize,c.requestDeserialize,l)===!1)throw new Error(`Method handler for ${c.path} already provided.`)})}removeService(i){if(i===null||typeof i!="object")throw new Error("removeService() requires object as argument");Object.keys(i).forEach(o=>{let a=i[o];this.unregister(a.path)})}bind(i,s){throw new Error("Not implemented. Use bindAsync() instead")}experimentalRegisterListenerToChannelz(i){return(0,Lr.registerChannelzSocket)((0,Qu.subchannelAddressToString)(i),()=>({localAddress:i,remoteAddress:null,security:null,remoteName:null,streamsStarted:0,streamsSucceeded:0,streamsFailed:0,messagesSent:0,messagesReceived:0,keepAlivesSent:0,lastLocalStreamCreatedTimestamp:null,lastRemoteStreamCreatedTimestamp:null,lastMessageSentTimestamp:null,lastMessageReceivedTimestamp:null,localFlowControlWindow:null,remoteFlowControlWindow:null}),this.channelzEnabled)}experimentalUnregisterListenerFromChannelz(i){(0,Lr.unregisterChannelzRef)(i)}createHttp2Server(i){let s;if(i._isSecure()){let o=i._getConstructorOptions(),a=i._getSecureContextOptions(),c=Object.assign(Object.assign(Object.assign(Object.assign({},this.commonServerOptions),o),a),{enableTrace:this.options["grpc-node.tls_enable_trace"]===1}),l=a!==null;this.trace("Initial credentials valid: "+l),s=Ai.createSecureServer(c),s.prependListener("connection",d=>{l||(this.trace("Dropped connection from "+JSON.stringify(d.address())+" due to unloaded credentials"),d.destroy())}),s.on("secureConnection",d=>{d.on("error",f=>{this.trace("An incoming TLS connection closed with error: "+f.message)})});let u=d=>{if(d){let f=s;try{f.setSecureContext(d)}catch(p){iy.log(vr.LogVerbosity.ERROR,"Failed to set secure context with error "+p.message),d=null}}l=d!==null,this.trace("Post-update credentials valid: "+l)};i._addWatcher(u),s.on("close",()=>{i._removeWatcher(u)})}else s=Ai.createServer(this.commonServerOptions);return s.setTimeout(0,hNt),this._setupHandlers(s,i._getInterceptors()),s}bindOneAddress(i,s){this.trace("Attempting to bind "+(0,Qu.subchannelAddressToString)(i));let o=this.createHttp2Server(s.credentials);return new Promise((a,c)=>{let l=u=>{this.trace("Failed to bind "+(0,Qu.subchannelAddressToString)(i)+" with error "+u.message),a({port:"port"in i?i.port:1,error:u.message})};o.once("error",l),o.listen(i,()=>{let u=o.address(),d;typeof u=="string"?d={path:u}:d={host:u.address,port:u.port};let f=this.experimentalRegisterListenerToChannelz(d);this.listenerChildrenTracker.refChild(f),this.http2Servers.set(o,{channelzRef:f,sessions:new Set,ownsChannelzRef:!0}),s.listeningServers.add(o),this.trace("Successfully bound "+(0,Qu.subchannelAddressToString)(d)),a({port:"port"in d?d.port:1}),o.removeListener("error",l)})})}async bindManyPorts(i,s){if(i.length===0)return{count:0,port:0,errors:[]};if((0,Qu.isTcpSubchannelAddress)(i[0])&&i[0].port===0){let o=await this.bindOneAddress(i[0],s);if(o.error){let a=await this.bindManyPorts(i.slice(1),s);return Object.assign(Object.assign({},a),{errors:[o.error,...a.errors]})}else{let a=i.slice(1).map(u=>(0,Qu.isTcpSubchannelAddress)(u)?{host:u.host,port:o.port}:u),c=await Promise.all(a.map(u=>this.bindOneAddress(u,s))),l=[o,...c];return{count:l.filter(u=>u.error===void 0).length,port:o.port,errors:l.filter(u=>u.error).map(u=>u.error)}}}else{let o=await Promise.all(i.map(a=>this.bindOneAddress(a,s)));return{count:o.filter(a=>a.error===void 0).length,port:o[0].port,errors:o.filter(a=>a.error).map(a=>a.error)}}}async bindAddressList(i,s){let o=await this.bindManyPorts(i,s);if(o.count>0)return o.count<i.length&&iy.log(vr.LogVerbosity.INFO,`WARNING Only ${o.count} addresses added out of total ${i.length} resolved`),o.port;{let a=`No address added out of total ${i.length} resolved`;throw iy.log(vr.LogVerbosity.ERROR,a),new Error(`${a} errors: [${o.errors.join(",")}]`)}}resolvePort(i){return new Promise((s,o)=>{let a=!1,c=(u,d,f,p)=>{if(a)return!0;if(a=!0,!u.ok)return o(new Error(u.error.details)),!0;let h=[].concat(...u.value.map(m=>m.addresses));return h.length===0?(o(new Error(`No addresses resolved for port ${i}`)),!0):(s(h),!0)};(0,i$e.createResolver)(i,c,this.options).updateResolution()})}async bindPort(i,s){let o=await this.resolvePort(i);if(s.cancelled)throw this.completeUnbind(s),new Error("bindAsync operation cancelled by unbind call");let a=await this.bindAddressList(o,s);if(s.cancelled)throw this.completeUnbind(s),new Error("bindAsync operation cancelled by unbind call");return a}normalizePort(i){let s=(0,To.parseUri)(i);if(s===null)throw new Error(`Could not parse port "${i}"`);let o=(0,i$e.mapUriDefaultScheme)(s);if(o===null)throw new Error(`Could not get a default scheme for port "${i}"`);return o}bindAsync(i,s,o){if(this.shutdown)throw new Error("bindAsync called after shutdown");if(typeof i!="string")throw new TypeError("port must be a string");if(s===null||!(s instanceof U9.ServerCredentials))throw new TypeError("creds must be a ServerCredentials object");if(typeof o!="function")throw new TypeError("callback must be a function");this.trace("bindAsync port="+i);let a=this.normalizePort(i),c=(f,p)=>{process.nextTick(()=>o(f,p))},l=this.boundPorts.get((0,To.uriToString)(a));if(l){if(!s._equals(l.credentials)){c(new Error(`${i} already bound with incompatible credentials`),0);return}l.cancelled=!1,l.completionPromise?l.completionPromise.then(f=>o(null,f),f=>o(f,0)):c(null,l.portNumber);return}l={mapKey:(0,To.uriToString)(a),originalUri:a,completionPromise:null,cancelled:!1,portNumber:0,credentials:s,listeningServers:new Set};let u=(0,To.splitHostPort)(a.path),d=this.bindPort(a,l);l.completionPromise=d,u?.port===0?d.then(f=>{let p={scheme:a.scheme,authority:a.authority,path:(0,To.combineHostPort)({host:u.host,port:f})};l.mapKey=(0,To.uriToString)(p),l.completionPromise=null,l.portNumber=f,this.boundPorts.set(l.mapKey,l),o(null,f)},f=>{o(f,0)}):(this.boundPorts.set(l.mapKey,l),d.then(f=>{l.completionPromise=null,l.portNumber=f,o(null,f)},f=>{o(f,0)}))}registerInjectorToChannelz(){return(0,Lr.registerChannelzSocket)("injector",()=>({localAddress:null,remoteAddress:null,security:null,remoteName:null,streamsStarted:0,streamsSucceeded:0,streamsFailed:0,messagesSent:0,messagesReceived:0,keepAlivesSent:0,lastLocalStreamCreatedTimestamp:null,lastRemoteStreamCreatedTimestamp:null,lastMessageSentTimestamp:null,lastMessageReceivedTimestamp:null,localFlowControlWindow:null,remoteFlowControlWindow:null}),this.channelzEnabled)}experimentalCreateConnectionInjectorWithChannelzRef(i,s,o=!1){if(i===null||!(i instanceof U9.ServerCredentials))throw new TypeError("creds must be a ServerCredentials object");this.channelzEnabled&&this.listenerChildrenTracker.refChild(s);let a=this.createHttp2Server(i),c=new Set;return this.http2Servers.set(a,{channelzRef:s,sessions:c,ownsChannelzRef:o}),{injectConnection:l=>{a.emit("connection",l)},drain:l=>{var u,d;for(let f of c)this.closeSession(f);(d=(u=setTimeout(()=>{for(let f of c)f.destroy(Ai.constants.NGHTTP2_CANCEL)},l)).unref)===null||d===void 0||d.call(u)},destroy:()=>{this.closeServer(a);for(let l of c)this.closeSession(l)}}}createConnectionInjector(i){if(i===null||!(i instanceof U9.ServerCredentials))throw new TypeError("creds must be a ServerCredentials object");let s=this.registerInjectorToChannelz();return this.experimentalCreateConnectionInjectorWithChannelzRef(i,s,!0)}closeServer(i,s){this.trace("Closing server with address "+JSON.stringify(i.address()));let o=this.http2Servers.get(i);i.close(()=>{o&&o.ownsChannelzRef&&(this.listenerChildrenTracker.unrefChild(o.channelzRef),(0,Lr.unregisterChannelzRef)(o.channelzRef)),this.http2Servers.delete(i),s?.()})}closeSession(i,s){var o;this.trace("Closing session initiated by "+((o=i.socket)===null||o===void 0?void 0:o.remoteAddress));let a=this.sessions.get(i),c=()=>{a&&(this.sessionChildrenTracker.unrefChild(a.ref),(0,Lr.unregisterChannelzRef)(a.ref)),s?.()};i.closed?queueMicrotask(c):i.close(c)}completeUnbind(i){for(let s of i.listeningServers){let o=this.http2Servers.get(s);if(this.closeServer(s,()=>{i.listeningServers.delete(s)}),o)for(let a of o.sessions)this.closeSession(a)}this.boundPorts.delete(i.mapKey)}unbind(i){this.trace("unbind port="+i);let s=this.normalizePort(i),o=(0,To.splitHostPort)(s.path);if(o?.port===0)throw new Error("Cannot unbind port 0");let a=this.boundPorts.get((0,To.uriToString)(s));a&&(this.trace("unbinding "+a.mapKey+" originally bound as "+(0,To.uriToString)(a.originalUri)),a.completionPromise?a.cancelled=!0:this.completeUnbind(a))}drain(i,s){var o,a;this.trace("drain port="+i+" graceTimeMs="+s);let c=this.normalizePort(i),l=(0,To.splitHostPort)(c.path);if(l?.port===0)throw new Error("Cannot drain port 0");let u=this.boundPorts.get((0,To.uriToString)(c));if(!u)return;let d=new Set;for(let f of u.listeningServers){let p=this.http2Servers.get(f);if(p)for(let h of p.sessions)d.add(h),this.closeSession(h,()=>{d.delete(h)})}(a=(o=setTimeout(()=>{for(let f of d)f.destroy(Ai.constants.NGHTTP2_CANCEL)},s)).unref)===null||a===void 0||a.call(o)}forceShutdown(){for(let i of this.boundPorts.values())i.cancelled=!0;this.boundPorts.clear();for(let i of this.http2Servers.keys())this.closeServer(i);this.sessions.forEach((i,s)=>{this.closeSession(s),s.destroy(Ai.constants.NGHTTP2_CANCEL)}),this.sessions.clear(),(0,Lr.unregisterChannelzRef)(this.channelzRef),this.shutdown=!0}register(i,s,o,a,c){return this.handlers.has(i)?!1:(this.handlers.set(i,{func:s,serialize:o,deserialize:a,type:c,path:i}),!0)}unregister(i){return this.handlers.delete(i)}start(){if(this.http2Servers.size===0||[...this.http2Servers.keys()].every(i=>!i.listening))throw new Error("server must be bound in order to start");if(this.started===!0)throw new Error("server is already started");this.started=!0}tryShutdown(i){var s;let o=l=>{(0,Lr.unregisterChannelzRef)(this.channelzRef),i(l)},a=0;function c(){a--,a===0&&o()}this.shutdown=!0;for(let[l,u]of this.http2Servers.entries()){a++;let d=u.channelzRef.name;this.trace("Waiting for server "+d+" to close"),this.closeServer(l,()=>{this.trace("Server "+d+" finished closing"),c()});for(let f of u.sessions.keys()){a++;let p=(s=f.socket)===null||s===void 0?void 0:s.remoteAddress;this.trace("Waiting for session "+p+" to close"),this.closeSession(f,()=>{this.trace("Session "+p+" finished closing"),c()})}}a===0&&o()}addHttp2Port(){throw new Error("Not yet implemented")}getChannelzRef(){return this.channelzRef}_verifyContentType(i,s){let o=s[Ai.constants.HTTP2_HEADER_CONTENT_TYPE];return typeof o!="string"||!o.startsWith("application/grpc")?(i.respond({[Ai.constants.HTTP2_HEADER_STATUS]:Ai.constants.HTTP_STATUS_UNSUPPORTED_MEDIA_TYPE},{endStream:!0}),!1):!0}_retrieveHandler(i){l$e("Received call to method "+i+" at address "+this.serverAddressString);let s=this.handlers.get(i);return s===void 0?(l$e("No handler registered for method "+i+". Sending UNIMPLEMENTED status."),null):s}_respondWithError(i,s,o=null){var a,c;let l=Object.assign({"grpc-status":(a=i.code)!==null&&a!==void 0?a:vr.Status.INTERNAL,"grpc-message":i.details,[Ai.constants.HTTP2_HEADER_STATUS]:Ai.constants.HTTP_STATUS_OK,[Ai.constants.HTTP2_HEADER_CONTENT_TYPE]:"application/grpc+proto"},(c=i.metadata)===null||c===void 0?void 0:c.toHttp2Headers());s.respond(l,{endStream:!0}),this.callTracker.addCallFailed(),o?.streamTracker.addCallFailed()}_channelzHandler(i,s,o){s.once("error",f=>{}),this.onStreamOpened(s);let a=this.sessions.get(s.session);if(this.callTracker.addCallStarted(),a?.streamTracker.addCallStarted(),!this._verifyContentType(s,o)){this.callTracker.addCallFailed(),a?.streamTracker.addCallFailed();return}let c=o[a$e],l=this._retrieveHandler(c);if(!l){this._respondWithError(j9(c),s,a);return}let u={addMessageSent:()=>{a&&(a.messagesSent+=1,a.lastMessageSentTimestamp=new Date)},addMessageReceived:()=>{a&&(a.messagesReceived+=1,a.lastMessageReceivedTimestamp=new Date)},onCallEnd:f=>{f.code===vr.Status.OK?this.callTracker.addCallSucceeded():this.callTracker.addCallFailed()},onStreamEnd:f=>{a&&(f?a.streamTracker.addCallSucceeded():a.streamTracker.addCallFailed())}},d=(0,s$e.getServerInterceptingCall)([...i,...this.interceptors],s,o,u,l,this.options);this._runHandlerForCall(d,l)||(this.callTracker.addCallFailed(),a?.streamTracker.addCallFailed(),d.sendStatus({code:vr.Status.INTERNAL,details:`Unknown handler type: ${l.type}`}))}_streamHandler(i,s,o){if(s.once("error",u=>{}),this.onStreamOpened(s),this._verifyContentType(s,o)!==!0)return;let a=o[a$e],c=this._retrieveHandler(a);if(!c){this._respondWithError(j9(a),s,null);return}let l=(0,s$e.getServerInterceptingCall)([...i,...this.interceptors],s,o,null,c,this.options);this._runHandlerForCall(l,c)||l.sendStatus({code:vr.Status.INTERNAL,details:`Unknown handler type: ${c.type}`})}_runHandlerForCall(i,s){let{type:o}=s;if(o==="unary")yNt(i,s);else if(o==="clientStream")SNt(i,s);else if(o==="serverStream")ENt(i,s);else if(o==="bidi")vNt(i,s);else return!1;return!0}_setupHandlers(i,s){if(i===null)return;let o=i.address(),a="null";o&&(typeof o=="string"?a=o:a=o.address+":"+o.port),this.serverAddressString=a;let c=this.channelzEnabled?this._channelzHandler:this._streamHandler,l=this.channelzEnabled?this._channelzSessionHandler(i):this._sessionHandler(i);i.on("stream",c.bind(this,s)),i.on("session",l)}_sessionHandler(i){return s=>{var o,a;(o=this.http2Servers.get(i))===null||o===void 0||o.sessions.add(s);let c=null,l=null,u=null,d=!1,f=this.enableIdleTimeout(s);if(this.maxConnectionAgeMs!==ny){let y=this.maxConnectionAgeMs/10,v=Math.random()*y*2-y;c=setTimeout(()=>{var S,g;d=!0,this.trace("Connection dropped by max connection age: "+((S=s.socket)===null||S===void 0?void 0:S.remoteAddress));try{s.goaway(Ai.constants.NGHTTP2_NO_ERROR,~(1<<31),c$e)}catch{s.destroy();return}s.close(),this.maxConnectionAgeGraceMs!==ny&&(l=setTimeout(()=>{s.destroy()},this.maxConnectionAgeGraceMs),(g=l.unref)===null||g===void 0||g.call(l))},this.maxConnectionAgeMs+v),(a=c.unref)===null||a===void 0||a.call(c)}let p=()=>{u&&(clearTimeout(u),u=null)},h=()=>!s.destroyed&&this.keepaliveTimeMs<F9&&this.keepaliveTimeMs>0,m,_=()=>{var y;h()&&(this.keepaliveTrace("Starting keepalive timer for "+this.keepaliveTimeMs+"ms"),u=setTimeout(()=>{p(),m()},this.keepaliveTimeMs),(y=u.unref)===null||y===void 0||y.call(u))};m=()=>{var y;if(!h())return;this.keepaliveTrace("Sending ping with timeout "+this.keepaliveTimeoutMs+"ms");let v="";try{s.ping((g,T,I)=>{p(),g?(this.keepaliveTrace("Ping failed with error: "+g.message),d=!0,s.destroy()):(this.keepaliveTrace("Received ping response"),_())})||(v="Ping returned false")}catch(S){v=(S instanceof Error?S.message:"")||"Unknown error"}if(v){this.keepaliveTrace("Ping send failed: "+v),this.trace("Connection dropped due to ping send error: "+v),d=!0,s.destroy();return}u=setTimeout(()=>{p(),this.keepaliveTrace("Ping timeout passed without response"),this.trace("Connection dropped by keepalive timeout"),d=!0,s.destroy()},this.keepaliveTimeoutMs),(y=u.unref)===null||y===void 0||y.call(u)},_(),s.on("close",()=>{var y,v;d||this.trace(`Connection dropped by client ${(y=s.socket)===null||y===void 0?void 0:y.remoteAddress}`),c&&clearTimeout(c),l&&clearTimeout(l),p(),f!==null&&(clearTimeout(f.timeout),this.sessionIdleTimeouts.delete(s)),(v=this.http2Servers.get(i))===null||v===void 0||v.sessions.delete(s)})}}_channelzSessionHandler(i){return s=>{var o,a,c,l;let u=(0,Lr.registerChannelzSocket)((a=(o=s.socket)===null||o===void 0?void 0:o.remoteAddress)!==null&&a!==void 0?a:"unknown",this.getChannelzSessionInfo.bind(this,s),this.channelzEnabled),d={ref:u,streamTracker:new Lr.ChannelzCallTracker,messagesSent:0,messagesReceived:0,keepAlivesSent:0,lastMessageSentTimestamp:null,lastMessageReceivedTimestamp:null};(c=this.http2Servers.get(i))===null||c===void 0||c.sessions.add(s),this.sessions.set(s,d);let f=`${s.socket.remoteAddress}:${s.socket.remotePort}`;this.channelzTrace.addTrace("CT_INFO","Connection established by client "+f),this.trace("Connection established by client "+f),this.sessionChildrenTracker.refChild(u);let p=null,h=null,m=null,_=!1,y=this.enableIdleTimeout(s);if(this.maxConnectionAgeMs!==ny){let I=this.maxConnectionAgeMs/10,x=Math.random()*I*2-I;p=setTimeout(()=>{var R;_=!0,this.channelzTrace.addTrace("CT_INFO","Connection dropped by max connection age from "+f);try{s.goaway(Ai.constants.NGHTTP2_NO_ERROR,~(1<<31),c$e)}catch{s.destroy();return}s.close(),this.maxConnectionAgeGraceMs!==ny&&(h=setTimeout(()=>{s.destroy()},this.maxConnectionAgeGraceMs),(R=h.unref)===null||R===void 0||R.call(h))},this.maxConnectionAgeMs+x),(l=p.unref)===null||l===void 0||l.call(p)}let v=()=>{m&&(clearTimeout(m),m=null)},S=()=>!s.destroyed&&this.keepaliveTimeMs<F9&&this.keepaliveTimeMs>0,g,T=()=>{var I;S()&&(this.keepaliveTrace("Starting keepalive timer for "+this.keepaliveTimeMs+"ms"),m=setTimeout(()=>{v(),g()},this.keepaliveTimeMs),(I=m.unref)===null||I===void 0||I.call(m))};g=()=>{var I;if(!S())return;this.keepaliveTrace("Sending ping with timeout "+this.keepaliveTimeoutMs+"ms");let x="";try{s.ping((O,A,b)=>{v(),O?(this.keepaliveTrace("Ping failed with error: "+O.message),this.channelzTrace.addTrace("CT_INFO","Connection dropped due to error of a ping frame "+O.message+" return in "+A),_=!0,s.destroy()):(this.keepaliveTrace("Received ping response"),T())})||(x="Ping returned false")}catch(R){x=(R instanceof Error?R.message:"")||"Unknown error"}if(x){this.keepaliveTrace("Ping send failed: "+x),this.channelzTrace.addTrace("CT_INFO","Connection dropped due to ping send error: "+x),_=!0,s.destroy();return}d.keepAlivesSent+=1,m=setTimeout(()=>{v(),this.keepaliveTrace("Ping timeout passed without response"),this.channelzTrace.addTrace("CT_INFO","Connection dropped by keepalive timeout from "+f),_=!0,s.destroy()},this.keepaliveTimeoutMs),(I=m.unref)===null||I===void 0||I.call(m)},T(),s.on("close",()=>{var I;_||this.channelzTrace.addTrace("CT_INFO","Connection dropped by client "+f),this.sessionChildrenTracker.unrefChild(u),(0,Lr.unregisterChannelzRef)(u),p&&clearTimeout(p),h&&clearTimeout(h),v(),y!==null&&(clearTimeout(y.timeout),this.sessionIdleTimeouts.delete(s)),(I=this.http2Servers.get(i))===null||I===void 0||I.sessions.delete(s),this.sessions.delete(s)})}}enableIdleTimeout(i){var s,o;if(this.sessionIdleTimeout>=o$e)return null;let a={activeStreams:0,lastIdle:Date.now(),onClose:this.onStreamClose.bind(this,i),timeout:setTimeout(this.onIdleTimeout,this.sessionIdleTimeout,this,i)};(o=(s=a.timeout).unref)===null||o===void 0||o.call(s),this.sessionIdleTimeouts.set(i,a);let{socket:c}=i;return this.trace("Enable idle timeout for "+c.remoteAddress+":"+c.remotePort),a}onIdleTimeout(i,s){let{socket:o}=s,a=i.sessionIdleTimeouts.get(s);a!==void 0&&a.activeStreams===0&&(Date.now()-a.lastIdle>=i.sessionIdleTimeout?(i.trace("Session idle timeout triggered for "+o?.remoteAddress+":"+o?.remotePort+" last idle at "+a.lastIdle),i.closeSession(s)):a.timeout.refresh())}onStreamOpened(i){let s=i.session,o=this.sessionIdleTimeouts.get(s);o&&(o.activeStreams+=1,i.once("close",o.onClose))}onStreamClose(i){var s,o;let a=this.sessionIdleTimeouts.get(i);a&&(a.activeStreams-=1,a.activeStreams===0&&(a.lastIdle=Date.now(),a.timeout.refresh(),this.trace("Session onStreamClose"+((s=i.socket)===null||s===void 0?void 0:s.remoteAddress)+":"+((o=i.socket)===null||o===void 0?void 0:o.remotePort)+" at "+a.lastIdle)))}},(()=>{let n=typeof Symbol=="function"&&Symbol.metadata?Object.create(null):void 0;r=[mNt("Calling start() is no longer necessary. It can be safely omitted.")],uNt(t,null,r,{kind:"method",name:"start",static:!1,private:!1,access:{has:i=>"start"in i,get:i=>i.start},metadata:n},null,e),n&&Object.defineProperty(t,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:n})})(),t})();ed.Server=_Nt;async function yNt(t,e){let r;function n(o,a,c,l){if(o){t.sendStatus((0,sy.serverErrorToStatus)(o,c));return}t.sendMessage(a,()=>{t.sendStatus({code:vr.Status.OK,details:"OK",metadata:c??null})})}let i,s=null;t.start({onReceiveMetadata(o){i=o,t.startRead()},onReceiveMessage(o){if(s){t.sendStatus({code:vr.Status.UNIMPLEMENTED,details:`Received a second request message for server streaming method ${e.path}`,metadata:null});return}s=o,t.startRead()},onReceiveHalfClose(){if(!s){t.sendStatus({code:vr.Status.UNIMPLEMENTED,details:`Received no request message for server streaming method ${e.path}`,metadata:null});return}r=new sy.ServerWritableStreamImpl(e.path,t,i,s);try{e.func(r,n)}catch(o){t.sendStatus({code:vr.Status.UNKNOWN,details:`Server method handler threw error ${o.message}`,metadata:null})}},onCancel(){r&&(r.cancelled=!0,r.emit("cancelled","cancelled"))}})}function SNt(t,e){let r;function n(i,s,o,a){if(i){t.sendStatus((0,sy.serverErrorToStatus)(i,o));return}t.sendMessage(s,()=>{t.sendStatus({code:vr.Status.OK,details:"OK",metadata:o??null})})}t.start({onReceiveMetadata(i){r=new sy.ServerDuplexStreamImpl(e.path,t,i);try{e.func(r,n)}catch(s){t.sendStatus({code:vr.Status.UNKNOWN,details:`Server method handler threw error ${s.message}`,metadata:null})}},onReceiveMessage(i){r.push(i)},onReceiveHalfClose(){r.push(null)},onCancel(){r&&(r.cancelled=!0,r.emit("cancelled","cancelled"),r.destroy())}})}function ENt(t,e){let r,n,i=null;t.start({onReceiveMetadata(s){n=s,t.startRead()},onReceiveMessage(s){if(i){t.sendStatus({code:vr.Status.UNIMPLEMENTED,details:`Received a second request message for server streaming method ${e.path}`,metadata:null});return}i=s,t.startRead()},onReceiveHalfClose(){if(!i){t.sendStatus({code:vr.Status.UNIMPLEMENTED,details:`Received no request message for server streaming method ${e.path}`,metadata:null});return}r=new sy.ServerWritableStreamImpl(e.path,t,n,i);try{e.func(r)}catch(s){t.sendStatus({code:vr.Status.UNKNOWN,details:`Server method handler threw error ${s.message}`,metadata:null})}},onCancel(){r&&(r.cancelled=!0,r.emit("cancelled","cancelled"),r.destroy())}})}function vNt(t,e){let r;t.start({onReceiveMetadata(n){r=new sy.ServerDuplexStreamImpl(e.path,t,n);try{e.func(r)}catch(i){t.sendStatus({code:vr.Status.UNKNOWN,details:`Server method handler threw error ${i.message}`,metadata:null})}},onReceiveMessage(n){r.push(n)},onReceiveHalfClose(){r.push(null)},onCancel(){r&&(r.cancelled=!0,r.emit("cancelled","cancelled"),r.destroy())}})}});var d$e=E(OL=>{"use strict";Object.defineProperty(OL,"__esModule",{value:!0});OL.StatusBuilder=void 0;var q9=class{constructor(){this.code=null,this.details=null,this.metadata=null}withCode(e){return this.code=e,this}withDetails(e){return this.details=e,this}withMetadata(e){return this.metadata=e,this}build(){let e={};return this.code!==null&&(e.code=this.code),this.details!==null&&(e.details=this.details),this.metadata!==null&&(e.metadata=this.metadata),e}};OL.StatusBuilder=q9});var $w=E(Ca=>{"use strict";Object.defineProperty(Ca,"__esModule",{value:!0});Ca.LeafLoadBalancer=Ca.PickFirstLoadBalancer=Ca.PickFirstLoadBalancingConfig=void 0;Ca.shuffled=m$e;Ca.setup=ONt;var B9=Uu(),br=ti(),td=jc(),f$e=Ti(),bNt=qt(),TNt=st(),p$e=Ti(),h$e=W("net"),wNt=fp(),ANt="pick_first";function Cw(t){bNt.trace(TNt.LogVerbosity.DEBUG,ANt,t)}var Nw="pick_first",RNt=250,oy=class t{constructor(e){this.shuffleAddressList=e}getLoadBalancerName(){return Nw}toJsonObject(){return{[Nw]:{shuffleAddressList:this.shuffleAddressList}}}getShuffleAddressList(){return this.shuffleAddressList}static createFromJson(e){if("shuffleAddressList"in e&&typeof e.shuffleAddressList!="boolean")throw new Error("pick_first config field shuffleAddressList must be a boolean if provided");return new t(e.shuffleAddressList===!0)}};Ca.PickFirstLoadBalancingConfig=oy;var z9=class{constructor(e){this.subchannel=e}pick(e){return{pickResultType:td.PickResultType.COMPLETE,subchannel:this.subchannel,status:null,onCallStarted:null,onCallEnded:null}}};function m$e(t){let e=t.slice();for(let r=e.length-1;r>1;r--){let n=Math.floor(Math.random()*(r+1)),i=e[r];e[r]=e[n],e[n]=i}return e}function xNt(t){if(t.length===0)return[];let e=[],r=[],n=[],i=(0,p$e.isTcpSubchannelAddress)(t[0])&&(0,h$e.isIPv6)(t[0].host);for(let a of t)(0,p$e.isTcpSubchannelAddress)(a)&&(0,h$e.isIPv6)(a.host)?r.push(a):n.push(a);let s=i?r:n,o=i?n:r;for(let a=0;a<Math.max(s.length,o.length);a++)a<s.length&&e.push(s[a]),a<o.length&&e.push(o[a]);return e}var g$e="grpc-node.internal.pick-first.report_health_status",kw=class{constructor(e){this.channelControlHelper=e,this.children=[],this.currentState=br.ConnectivityState.IDLE,this.currentSubchannelIndex=0,this.currentPick=null,this.subchannelStateListener=(r,n,i,s,o)=>{this.onSubchannelStateUpdate(r,n,i,o)},this.pickedSubchannelHealthListener=()=>this.calculateAndReportNewState(),this.stickyTransientFailureMode=!1,this.reportHealthStatus=!1,this.lastError=null,this.latestAddressList=null,this.latestOptions={},this.latestResolutionNote="",this.connectionDelayTimeout=setTimeout(()=>{},0),clearTimeout(this.connectionDelayTimeout)}allChildrenHaveReportedTF(){return this.children.every(e=>e.hasReportedTransientFailure)}resetChildrenReportedTF(){this.children.every(e=>e.hasReportedTransientFailure=!1)}calculateAndReportNewState(){var e;if(this.currentPick)if(this.reportHealthStatus&&!this.currentPick.isHealthy()){let r=`Picked subchannel ${this.currentPick.getAddress()} is unhealthy`;this.updateState(br.ConnectivityState.TRANSIENT_FAILURE,new td.UnavailablePicker({details:r}),r)}else this.updateState(br.ConnectivityState.READY,new z9(this.currentPick),null);else if(((e=this.latestAddressList)===null||e===void 0?void 0:e.length)===0){let r=`No connection established. Last error: ${this.lastError}. Resolution note: ${this.latestResolutionNote}`;this.updateState(br.ConnectivityState.TRANSIENT_FAILURE,new td.UnavailablePicker({details:r}),r)}else if(this.children.length===0)this.updateState(br.ConnectivityState.IDLE,new td.QueuePicker(this),null);else if(this.stickyTransientFailureMode){let r=`No connection established. Last error: ${this.lastError}. Resolution note: ${this.latestResolutionNote}`;this.updateState(br.ConnectivityState.TRANSIENT_FAILURE,new td.UnavailablePicker({details:r}),r)}else this.updateState(br.ConnectivityState.CONNECTING,new td.QueuePicker(this),null)}requestReresolution(){this.channelControlHelper.requestReresolution()}maybeEnterStickyTransientFailureMode(){if(this.allChildrenHaveReportedTF()){if(this.requestReresolution(),this.resetChildrenReportedTF(),this.stickyTransientFailureMode){this.calculateAndReportNewState();return}this.stickyTransientFailureMode=!0;for(let{subchannel:e}of this.children)e.startConnecting();this.calculateAndReportNewState()}}removeCurrentPick(){this.currentPick!==null&&(this.currentPick.removeConnectivityStateListener(this.subchannelStateListener),this.channelControlHelper.removeChannelzChild(this.currentPick.getChannelzRef()),this.currentPick.removeHealthStateWatcher(this.pickedSubchannelHealthListener),this.currentPick.unref(),this.currentPick=null)}onSubchannelStateUpdate(e,r,n,i){var s;if(!((s=this.currentPick)===null||s===void 0)&&s.realSubchannelEquals(e)){n!==br.ConnectivityState.READY&&(this.removeCurrentPick(),this.calculateAndReportNewState());return}for(let[o,a]of this.children.entries())if(e.realSubchannelEquals(a.subchannel)){n===br.ConnectivityState.READY&&this.pickSubchannel(a.subchannel),n===br.ConnectivityState.TRANSIENT_FAILURE&&(a.hasReportedTransientFailure=!0,i&&(this.lastError=i),this.maybeEnterStickyTransientFailureMode(),o===this.currentSubchannelIndex&&this.startNextSubchannelConnecting(o+1)),a.subchannel.startConnecting();return}}startNextSubchannelConnecting(e){clearTimeout(this.connectionDelayTimeout);for(let[r,n]of this.children.entries())if(r>=e){let i=n.subchannel.getConnectivityState();if(i===br.ConnectivityState.IDLE||i===br.ConnectivityState.CONNECTING){this.startConnecting(r);return}}this.maybeEnterStickyTransientFailureMode()}startConnecting(e){var r,n;clearTimeout(this.connectionDelayTimeout),this.currentSubchannelIndex=e,this.children[e].subchannel.getConnectivityState()===br.ConnectivityState.IDLE&&(Cw("Start connecting to subchannel with address "+this.children[e].subchannel.getAddress()),process.nextTick(()=>{var i;(i=this.children[e])===null||i===void 0||i.subchannel.startConnecting()})),this.connectionDelayTimeout=setTimeout(()=>{this.startNextSubchannelConnecting(e+1)},RNt),(n=(r=this.connectionDelayTimeout).unref)===null||n===void 0||n.call(r)}pickSubchannel(e){Cw("Pick subchannel with address "+e.getAddress()),this.stickyTransientFailureMode=!1,e.ref(),this.channelControlHelper.addChannelzChild(e.getChannelzRef()),this.removeCurrentPick(),this.resetSubchannelList(),e.addConnectivityStateListener(this.subchannelStateListener),e.addHealthStateWatcher(this.pickedSubchannelHealthListener),this.currentPick=e,clearTimeout(this.connectionDelayTimeout),this.calculateAndReportNewState()}updateState(e,r,n){Cw(br.ConnectivityState[this.currentState]+" -> "+br.ConnectivityState[e]),this.currentState=e,this.channelControlHelper.updateState(e,r,n)}resetSubchannelList(){for(let e of this.children)e.subchannel.removeConnectivityStateListener(this.subchannelStateListener),e.subchannel.unref(),this.channelControlHelper.removeChannelzChild(e.subchannel.getChannelzRef());this.currentSubchannelIndex=0,this.children=[]}connectToAddressList(e,r){Cw("connectToAddressList(["+e.map(i=>(0,f$e.subchannelAddressToString)(i))+"])");let n=e.map(i=>({subchannel:this.channelControlHelper.createSubchannel(i,r),hasReportedTransientFailure:!1}));for(let{subchannel:i}of n)if(i.getConnectivityState()===br.ConnectivityState.READY){this.pickSubchannel(i);return}for(let{subchannel:i}of n)i.ref(),this.channelControlHelper.addChannelzChild(i.getChannelzRef());this.resetSubchannelList(),this.children=n;for(let{subchannel:i}of this.children)i.addConnectivityStateListener(this.subchannelStateListener);for(let i of this.children)i.subchannel.getConnectivityState()===br.ConnectivityState.TRANSIENT_FAILURE&&(i.hasReportedTransientFailure=!0);this.startNextSubchannelConnecting(0),this.calculateAndReportNewState()}updateAddressList(e,r,n,i){if(!(r instanceof oy))return!1;if(!e.ok)return this.children.length===0&&this.currentPick===null&&this.channelControlHelper.updateState(br.ConnectivityState.TRANSIENT_FAILURE,new td.UnavailablePicker(e.error),e.error.details),!0;let s=e.value;this.reportHealthStatus=n[g$e],r.getShuffleAddressList()&&(s=m$e(s));let o=[].concat(...s.map(c=>c.addresses));Cw("updateAddressList(["+o.map(c=>(0,f$e.subchannelAddressToString)(c))+"])");let a=xNt(o);return this.latestAddressList=a,this.latestOptions=n,this.connectToAddressList(a,n),this.latestResolutionNote=i,o.length>0?!0:(this.lastError="No addresses resolved",!1)}exitIdle(){this.currentState===br.ConnectivityState.IDLE&&this.latestAddressList&&this.connectToAddressList(this.latestAddressList,this.latestOptions)}resetBackoff(){}destroy(){this.resetSubchannelList(),this.removeCurrentPick()}getTypeName(){return Nw}};Ca.PickFirstLoadBalancer=kw;var INt=new oy(!1),V9=class{constructor(e,r,n,i){this.endpoint=e,this.options=n,this.resolutionNote=i,this.latestState=br.ConnectivityState.IDLE;let s=(0,B9.createChildChannelControlHelper)(r,{updateState:(o,a,c)=>{this.latestState=o,this.latestPicker=a,r.updateState(o,a,c)}});this.pickFirstBalancer=new kw(s),this.latestPicker=new td.QueuePicker(this.pickFirstBalancer)}startConnecting(){this.pickFirstBalancer.updateAddressList((0,wNt.statusOrFromValue)([this.endpoint]),INt,Object.assign(Object.assign({},this.options),{[g$e]:!0}),this.resolutionNote)}updateEndpoint(e,r){this.options=r,this.endpoint=e,this.latestState!==br.ConnectivityState.IDLE&&this.startConnecting()}getConnectivityState(){return this.latestState}getPicker(){return this.latestPicker}getEndpoint(){return this.endpoint}exitIdle(){this.pickFirstBalancer.exitIdle()}destroy(){this.pickFirstBalancer.destroy()}};Ca.LeafLoadBalancer=V9;function ONt(){(0,B9.registerLoadBalancerType)(Nw,kw,oy),(0,B9.registerDefaultLoadBalancerType)(Nw)}});var _$e=E(CL=>{"use strict";Object.defineProperty(CL,"__esModule",{value:!0});CL.FileWatcherCertificateProvider=void 0;var PNt=W("fs"),CNt=qt(),NNt=st(),kNt=W("util"),$Nt="certificate_provider";function PL(t){CNt.trace(NNt.LogVerbosity.DEBUG,$Nt,t)}var H9=(0,kNt.promisify)(PNt.readFile),G9=class{constructor(e){if(this.config=e,this.refreshTimer=null,this.fileResultPromise=null,this.latestCaUpdate=void 0,this.caListeners=new Set,this.latestIdentityUpdate=void 0,this.identityListeners=new Set,this.lastUpdateTime=null,e.certificateFile===void 0!=(e.privateKeyFile===void 0))throw new Error("certificateFile and privateKeyFile must be set or unset together");if(e.certificateFile===void 0&&e.caCertificateFile===void 0)throw new Error("At least one of certificateFile and caCertificateFile must be set");PL("File watcher constructed with config "+JSON.stringify(e))}updateCertificates(){this.fileResultPromise||(this.fileResultPromise=Promise.allSettled([this.config.certificateFile?H9(this.config.certificateFile):Promise.reject(),this.config.privateKeyFile?H9(this.config.privateKeyFile):Promise.reject(),this.config.caCertificateFile?H9(this.config.caCertificateFile):Promise.reject()]),this.fileResultPromise.then(([e,r,n])=>{if(this.refreshTimer){PL("File watcher read certificates certificate "+e.status+", privateKey "+r.status+", CA certificate "+n.status),this.lastUpdateTime=new Date,this.fileResultPromise=null,e.status==="fulfilled"&&r.status==="fulfilled"?this.latestIdentityUpdate={certificate:e.value,privateKey:r.value}:this.latestIdentityUpdate=null,n.status==="fulfilled"?this.latestCaUpdate={caCertificate:n.value}:this.latestCaUpdate=null;for(let i of this.identityListeners)i(this.latestIdentityUpdate);for(let i of this.caListeners)i(this.latestCaUpdate)}}),PL("File watcher initiated certificate update"))}maybeStartWatchingFiles(){if(!this.refreshTimer){let e=this.lastUpdateTime?new Date().getTime()-this.lastUpdateTime.getTime():1/0;e>this.config.refreshIntervalMs&&this.updateCertificates(),e>this.config.refreshIntervalMs*2&&(this.latestCaUpdate=void 0,this.latestIdentityUpdate=void 0),this.refreshTimer=setInterval(()=>this.updateCertificates(),this.config.refreshIntervalMs),PL("File watcher started watching")}}maybeStopWatchingFiles(){this.caListeners.size===0&&this.identityListeners.size===0&&(this.fileResultPromise=null,this.refreshTimer&&(clearInterval(this.refreshTimer),this.refreshTimer=null))}addCaCertificateListener(e){this.caListeners.add(e),this.maybeStartWatchingFiles(),this.latestCaUpdate!==void 0&&process.nextTick(e,this.latestCaUpdate)}removeCaCertificateListener(e){this.caListeners.delete(e),this.maybeStopWatchingFiles()}addIdentityCertificateListener(e){this.identityListeners.add(e),this.maybeStartWatchingFiles(),this.latestIdentityUpdate!==void 0&&process.nextTick(e,this.latestIdentityUpdate)}removeIdentityCertificateListener(e){this.identityListeners.delete(e),this.maybeStopWatchingFiles()}};CL.FileWatcherCertificateProvider=G9});var K9=E(xe=>{"use strict";Object.defineProperty(xe,"__esModule",{value:!0});xe.SUBCHANNEL_ARGS_EXCLUDE_KEY_PREFIX=xe.createCertificateProviderChannelCredentials=xe.FileWatcherCertificateProvider=xe.createCertificateProviderServerCredentials=xe.createServerCredentialsWithInterceptors=xe.BaseSubchannelWrapper=xe.registerAdminService=xe.FilterStackFactory=xe.BaseFilter=xe.statusOrFromError=xe.statusOrFromValue=xe.PickResultType=xe.QueuePicker=xe.UnavailablePicker=xe.ChildLoadBalancerHandler=xe.EndpointMap=xe.endpointHasAddress=xe.endpointToString=xe.subchannelAddressToString=xe.LeafLoadBalancer=xe.isLoadBalancerNameRegistered=xe.parseLoadBalancingConfig=xe.selectLbConfigFromList=xe.registerLoadBalancerType=xe.createChildChannelControlHelper=xe.BackoffTimeout=xe.parseDuration=xe.durationToMs=xe.splitHostPort=xe.uriToString=xe.CHANNEL_ARGS_CONFIG_SELECTOR_KEY=xe.createResolver=xe.registerResolver=xe.log=xe.trace=void 0;var y$e=qt();Object.defineProperty(xe,"trace",{enumerable:!0,get:function(){return y$e.trace}});Object.defineProperty(xe,"log",{enumerable:!0,get:function(){return y$e.log}});var W9=co();Object.defineProperty(xe,"registerResolver",{enumerable:!0,get:function(){return W9.registerResolver}});Object.defineProperty(xe,"createResolver",{enumerable:!0,get:function(){return W9.createResolver}});Object.defineProperty(xe,"CHANNEL_ARGS_CONFIG_SELECTOR_KEY",{enumerable:!0,get:function(){return W9.CHANNEL_ARGS_CONFIG_SELECTOR_KEY}});var S$e=ei();Object.defineProperty(xe,"uriToString",{enumerable:!0,get:function(){return S$e.uriToString}});Object.defineProperty(xe,"splitHostPort",{enumerable:!0,get:function(){return S$e.splitHostPort}});var E$e=Pw();Object.defineProperty(xe,"durationToMs",{enumerable:!0,get:function(){return E$e.durationToMs}});Object.defineProperty(xe,"parseDuration",{enumerable:!0,get:function(){return E$e.parseDuration}});var LNt=O_();Object.defineProperty(xe,"BackoffTimeout",{enumerable:!0,get:function(){return LNt.BackoffTimeout}});var Lw=Uu();Object.defineProperty(xe,"createChildChannelControlHelper",{enumerable:!0,get:function(){return Lw.createChildChannelControlHelper}});Object.defineProperty(xe,"registerLoadBalancerType",{enumerable:!0,get:function(){return Lw.registerLoadBalancerType}});Object.defineProperty(xe,"selectLbConfigFromList",{enumerable:!0,get:function(){return Lw.selectLbConfigFromList}});Object.defineProperty(xe,"parseLoadBalancingConfig",{enumerable:!0,get:function(){return Lw.parseLoadBalancingConfig}});Object.defineProperty(xe,"isLoadBalancerNameRegistered",{enumerable:!0,get:function(){return Lw.isLoadBalancerNameRegistered}});var DNt=$w();Object.defineProperty(xe,"LeafLoadBalancer",{enumerable:!0,get:function(){return DNt.LeafLoadBalancer}});var NL=Ti();Object.defineProperty(xe,"subchannelAddressToString",{enumerable:!0,get:function(){return NL.subchannelAddressToString}});Object.defineProperty(xe,"endpointToString",{enumerable:!0,get:function(){return NL.endpointToString}});Object.defineProperty(xe,"endpointHasAddress",{enumerable:!0,get:function(){return NL.endpointHasAddress}});Object.defineProperty(xe,"EndpointMap",{enumerable:!0,get:function(){return NL.EndpointMap}});var MNt=i$();Object.defineProperty(xe,"ChildLoadBalancerHandler",{enumerable:!0,get:function(){return MNt.ChildLoadBalancerHandler}});var Y9=jc();Object.defineProperty(xe,"UnavailablePicker",{enumerable:!0,get:function(){return Y9.UnavailablePicker}});Object.defineProperty(xe,"QueuePicker",{enumerable:!0,get:function(){return Y9.QueuePicker}});Object.defineProperty(xe,"PickResultType",{enumerable:!0,get:function(){return Y9.PickResultType}});var v$e=fp();Object.defineProperty(xe,"statusOrFromValue",{enumerable:!0,get:function(){return v$e.statusOrFromValue}});Object.defineProperty(xe,"statusOrFromError",{enumerable:!0,get:function(){return v$e.statusOrFromError}});var UNt=T8();Object.defineProperty(xe,"BaseFilter",{enumerable:!0,get:function(){return UNt.BaseFilter}});var FNt=tL();Object.defineProperty(xe,"FilterStackFactory",{enumerable:!0,get:function(){return FNt.FilterStackFactory}});var jNt=c$();Object.defineProperty(xe,"registerAdminService",{enumerable:!0,get:function(){return jNt.registerAdminService}});var qNt=Iw();Object.defineProperty(xe,"BaseSubchannelWrapper",{enumerable:!0,get:function(){return qNt.BaseSubchannelWrapper}});var b$e=bL();Object.defineProperty(xe,"createServerCredentialsWithInterceptors",{enumerable:!0,get:function(){return b$e.createServerCredentialsWithInterceptors}});Object.defineProperty(xe,"createCertificateProviderServerCredentials",{enumerable:!0,get:function(){return b$e.createCertificateProviderServerCredentials}});var BNt=_$e();Object.defineProperty(xe,"FileWatcherCertificateProvider",{enumerable:!0,get:function(){return BNt.FileWatcherCertificateProvider}});var zNt=I_();Object.defineProperty(xe,"createCertificateProviderChannelCredentials",{enumerable:!0,get:function(){return zNt.createCertificateProviderChannelCredentials}});var VNt=d9();Object.defineProperty(xe,"SUBCHANNEL_ARGS_EXCLUDE_KEY_PREFIX",{enumerable:!0,get:function(){return VNt.SUBCHANNEL_ARGS_EXCLUDE_KEY_PREFIX}})});var T$e=E(Z9=>{"use strict";Object.defineProperty(Z9,"__esModule",{value:!0});Z9.setup=WNt;var HNt=co(),GNt=fp(),J9=class{constructor(e,r,n){this.listener=r,this.hasReturnedResult=!1,this.endpoints=[];let i;e.authority===""?i="/"+e.path:i=e.path,this.endpoints=[{addresses:[{path:i}]}]}updateResolution(){this.hasReturnedResult||(this.hasReturnedResult=!0,process.nextTick(this.listener,(0,GNt.statusOrFromValue)(this.endpoints),{},null,""))}destroy(){this.hasReturnedResult=!1}static getDefaultAuthority(e){return"localhost"}};function WNt(){(0,HNt.registerResolver)("unix",J9)}});var O$e=E(tJ=>{"use strict";Object.defineProperty(tJ,"__esModule",{value:!0});tJ.setup=XNt;var w$e=W("net"),A$e=fp(),kL=st(),X9=Vr(),R$e=co(),YNt=Ti(),x$e=ei(),KNt=qt(),JNt="ip_resolver";function I$e(t){KNt.trace(kL.LogVerbosity.DEBUG,JNt,t)}var Q9="ipv4",eJ="ipv6",ZNt=443,$L=class{constructor(e,r,n){var i;this.listener=r,this.endpoints=[],this.error=null,this.hasReturnedResult=!1,I$e("Resolver constructed for target "+(0,x$e.uriToString)(e));let s=[];if(!(e.scheme===Q9||e.scheme===eJ)){this.error={code:kL.Status.UNAVAILABLE,details:`Unrecognized scheme ${e.scheme} in IP resolver`,metadata:new X9.Metadata};return}let o=e.path.split(",");for(let a of o){let c=(0,x$e.splitHostPort)(a);if(c===null){this.error={code:kL.Status.UNAVAILABLE,details:`Failed to parse ${e.scheme} address ${a}`,metadata:new X9.Metadata};return}if(e.scheme===Q9&&!(0,w$e.isIPv4)(c.host)||e.scheme===eJ&&!(0,w$e.isIPv6)(c.host)){this.error={code:kL.Status.UNAVAILABLE,details:`Failed to parse ${e.scheme} address ${a}`,metadata:new X9.Metadata};return}s.push({host:c.host,port:(i=c.port)!==null&&i!==void 0?i:ZNt})}this.endpoints=s.map(a=>({addresses:[a]})),I$e("Parsed "+e.scheme+" address list "+s.map(YNt.subchannelAddressToString))}updateResolution(){this.hasReturnedResult||(this.hasReturnedResult=!0,process.nextTick(()=>{this.error?this.listener((0,A$e.statusOrFromError)(this.error),{},null,""):this.listener((0,A$e.statusOrFromValue)(this.endpoints),{},null,"")}))}destroy(){this.hasReturnedResult=!1}static getDefaultAuthority(e){return e.path.split(",")[0]}};function XNt(){(0,R$e.registerResolver)(Q9,$L),(0,R$e.registerResolver)(eJ,$L)}});var k$e=E(Mw=>{"use strict";Object.defineProperty(Mw,"__esModule",{value:!0});Mw.RoundRobinLoadBalancer=void 0;Mw.setup=ikt;var N$e=Uu(),yn=ti(),Dw=jc(),QNt=qt(),ekt=st(),P$e=Ti(),tkt=$w(),rkt="round_robin";function C$e(t){QNt.trace(ekt.LogVerbosity.DEBUG,rkt,t)}var LL="round_robin",DL=class t{getLoadBalancerName(){return LL}constructor(){}toJsonObject(){return{[LL]:{}}}static createFromJson(e){return new t}},rJ=class{constructor(e,r=0){this.children=e,this.nextIndex=r}pick(e){let r=this.children[this.nextIndex].picker;return this.nextIndex=(this.nextIndex+1)%this.children.length,r.pick(e)}peekNextEndpoint(){return this.children[this.nextIndex].endpoint}};function nkt(t,e){return[...t.slice(e),...t.slice(0,e)]}var ML=class{constructor(e){this.channelControlHelper=e,this.children=[],this.currentState=yn.ConnectivityState.IDLE,this.currentReadyPicker=null,this.updatesPaused=!1,this.lastError=null,this.childChannelControlHelper=(0,N$e.createChildChannelControlHelper)(e,{updateState:(r,n,i)=>{this.currentState===yn.ConnectivityState.READY&&r!==yn.ConnectivityState.READY&&this.channelControlHelper.requestReresolution(),i&&(this.lastError=i),this.calculateAndUpdateState()}})}countChildrenWithState(e){return this.children.filter(r=>r.getConnectivityState()===e).length}calculateAndUpdateState(){if(!this.updatesPaused){if(this.countChildrenWithState(yn.ConnectivityState.READY)>0){let e=this.children.filter(n=>n.getConnectivityState()===yn.ConnectivityState.READY),r=0;if(this.currentReadyPicker!==null){let n=this.currentReadyPicker.peekNextEndpoint();r=e.findIndex(i=>(0,P$e.endpointEqual)(i.getEndpoint(),n)),r<0&&(r=0)}this.updateState(yn.ConnectivityState.READY,new rJ(e.map(n=>({endpoint:n.getEndpoint(),picker:n.getPicker()})),r),null)}else if(this.countChildrenWithState(yn.ConnectivityState.CONNECTING)>0)this.updateState(yn.ConnectivityState.CONNECTING,new Dw.QueuePicker(this),null);else if(this.countChildrenWithState(yn.ConnectivityState.TRANSIENT_FAILURE)>0){let e=`round_robin: No connection established. Last error: ${this.lastError}`;this.updateState(yn.ConnectivityState.TRANSIENT_FAILURE,new Dw.UnavailablePicker({details:e}),e)}else this.updateState(yn.ConnectivityState.IDLE,new Dw.QueuePicker(this),null);for(let e of this.children)e.getConnectivityState()===yn.ConnectivityState.IDLE&&e.exitIdle()}}updateState(e,r,n){C$e(yn.ConnectivityState[this.currentState]+" -> "+yn.ConnectivityState[e]),e===yn.ConnectivityState.READY?this.currentReadyPicker=r:this.currentReadyPicker=null,this.currentState=e,this.channelControlHelper.updateState(e,r,n)}resetSubchannelList(){for(let e of this.children)e.destroy();this.children=[]}updateAddressList(e,r,n,i){if(!(r instanceof DL))return!1;if(!e.ok)return this.children.length===0&&this.updateState(yn.ConnectivityState.TRANSIENT_FAILURE,new Dw.UnavailablePicker(e.error),e.error.details),!0;let s=Math.random()*e.value.length|0,o=nkt(e.value,s);if(this.resetSubchannelList(),o.length===0){let a=`No addresses resolved. Resolution note: ${i}`;this.updateState(yn.ConnectivityState.TRANSIENT_FAILURE,new Dw.UnavailablePicker({details:a}),a)}C$e("Connect to endpoint list "+o.map(P$e.endpointToString)),this.updatesPaused=!0,this.children=o.map(a=>new tkt.LeafLoadBalancer(a,this.childChannelControlHelper,n,i));for(let a of this.children)a.startConnecting();return this.updatesPaused=!1,this.calculateAndUpdateState(),!0}exitIdle(){}resetBackoff(){}destroy(){this.resetSubchannelList()}getTypeName(){return LL}};Mw.RoundRobinLoadBalancer=ML;function ikt(){(0,N$e.registerLoadBalancerType)(LL,ML,DL)}});var D$e=E(Np=>{"use strict";var nJ;Object.defineProperty(Np,"__esModule",{value:!0});Np.OutlierDetectionLoadBalancer=Np.OutlierDetectionLoadBalancingConfig=void 0;Np.setup=mkt;var skt=ti(),$$e=st(),Cp=Pw(),L$e=K9(),okt=Uu(),akt=i$(),ckt=jc(),iJ=Ti(),lkt=Iw(),ukt=qt(),dkt="outlier_detection";function Yr(t){ukt.trace($$e.LogVerbosity.DEBUG,dkt,t)}var uJ="outlier_detection",fkt=((nJ=process.env.GRPC_EXPERIMENTAL_ENABLE_OUTLIER_DETECTION)!==null&&nJ!==void 0?nJ:"true")==="true",pkt={stdev_factor:1900,enforcement_percentage:100,minimum_hosts:5,request_volume:100},hkt={threshold:85,enforcement_percentage:100,minimum_hosts:5,request_volume:50};function ay(t,e,r,n){if(e in t&&t[e]!==void 0&&typeof t[e]!==r){let i=n?`${n}.${e}`:e;throw new Error(`outlier detection config ${i} parse error: expected ${r}, got ${typeof t[e]}`)}}function sJ(t,e,r){let n=r?`${r}.${e}`:e;if(e in t&&t[e]!==void 0){if(!(0,Cp.isDuration)(t[e]))throw new Error(`outlier detection config ${n} parse error: expected Duration, got ${typeof t[e]}`);if(!(t[e].seconds>=0&&t[e].seconds<=315576e6&&t[e].nanos>=0&&t[e].nanos<=999999999))throw new Error(`outlier detection config ${n} parse error: values out of range for non-negative Duaration`)}}function UL(t,e,r){let n=r?`${r}.${e}`:e;if(ay(t,e,"number",r),e in t&&t[e]!==void 0&&!(t[e]>=0&&t[e]<=100))throw new Error(`outlier detection config ${n} parse error: value out of range for percentage (0-100)`)}var Uw=class t{constructor(e,r,n,i,s,o,a){if(this.childPolicy=a,a.getLoadBalancerName()==="pick_first")throw new Error("outlier_detection LB policy cannot have a pick_first child policy");this.intervalMs=e??1e4,this.baseEjectionTimeMs=r??3e4,this.maxEjectionTimeMs=n??3e5,this.maxEjectionPercent=i??10,this.successRateEjection=s?Object.assign(Object.assign({},pkt),s):null,this.failurePercentageEjection=o?Object.assign(Object.assign({},hkt),o):null}getLoadBalancerName(){return uJ}toJsonObject(){var e,r;return{outlier_detection:{interval:(0,Cp.msToDuration)(this.intervalMs),base_ejection_time:(0,Cp.msToDuration)(this.baseEjectionTimeMs),max_ejection_time:(0,Cp.msToDuration)(this.maxEjectionTimeMs),max_ejection_percent:this.maxEjectionPercent,success_rate_ejection:(e=this.successRateEjection)!==null&&e!==void 0?e:void 0,failure_percentage_ejection:(r=this.failurePercentageEjection)!==null&&r!==void 0?r:void 0,child_policy:[this.childPolicy.toJsonObject()]}}}getIntervalMs(){return this.intervalMs}getBaseEjectionTimeMs(){return this.baseEjectionTimeMs}getMaxEjectionTimeMs(){return this.maxEjectionTimeMs}getMaxEjectionPercent(){return this.maxEjectionPercent}getSuccessRateEjectionConfig(){return this.successRateEjection}getFailurePercentageEjectionConfig(){return this.failurePercentageEjection}getChildPolicy(){return this.childPolicy}static createFromJson(e){var r;if(sJ(e,"interval"),sJ(e,"base_ejection_time"),sJ(e,"max_ejection_time"),UL(e,"max_ejection_percent"),"success_rate_ejection"in e&&e.success_rate_ejection!==void 0){if(typeof e.success_rate_ejection!="object")throw new Error("outlier detection config success_rate_ejection must be an object");ay(e.success_rate_ejection,"stdev_factor","number","success_rate_ejection"),UL(e.success_rate_ejection,"enforcement_percentage","success_rate_ejection"),ay(e.success_rate_ejection,"minimum_hosts","number","success_rate_ejection"),ay(e.success_rate_ejection,"request_volume","number","success_rate_ejection")}if("failure_percentage_ejection"in e&&e.failure_percentage_ejection!==void 0){if(typeof e.failure_percentage_ejection!="object")throw new Error("outlier detection config failure_percentage_ejection must be an object");UL(e.failure_percentage_ejection,"threshold","failure_percentage_ejection"),UL(e.failure_percentage_ejection,"enforcement_percentage","failure_percentage_ejection"),ay(e.failure_percentage_ejection,"minimum_hosts","number","failure_percentage_ejection"),ay(e.failure_percentage_ejection,"request_volume","number","failure_percentage_ejection")}if(!("child_policy"in e)||!Array.isArray(e.child_policy))throw new Error("outlier detection config child_policy must be an array");let n=(0,okt.selectLbConfigFromList)(e.child_policy);if(!n)throw new Error("outlier detection config child_policy: no valid recognized policy found");return new t(e.interval?(0,Cp.durationToMs)(e.interval):null,e.base_ejection_time?(0,Cp.durationToMs)(e.base_ejection_time):null,e.max_ejection_time?(0,Cp.durationToMs)(e.max_ejection_time):null,(r=e.max_ejection_percent)!==null&&r!==void 0?r:null,e.success_rate_ejection,e.failure_percentage_ejection,n)}};Np.OutlierDetectionLoadBalancingConfig=Uw;var aJ=class extends lkt.BaseSubchannelWrapper{constructor(e,r){super(e),this.mapEntry=r,this.refCount=0}ref(){this.child.ref(),this.refCount+=1}unref(){if(this.child.unref(),this.refCount-=1,this.refCount<=0&&this.mapEntry){let e=this.mapEntry.subchannelWrappers.indexOf(this);e>=0&&this.mapEntry.subchannelWrappers.splice(e,1)}}eject(){this.setHealthy(!1)}uneject(){this.setHealthy(!0)}getMapEntry(){return this.mapEntry}getWrappedSubchannel(){return this.child}};function oJ(){return{success:0,failure:0}}var cJ=class{constructor(){this.activeBucket=oJ(),this.inactiveBucket=oJ()}addSuccess(){this.activeBucket.success+=1}addFailure(){this.activeBucket.failure+=1}switchBuckets(){this.inactiveBucket=this.activeBucket,this.activeBucket=oJ()}getLastSuccesses(){return this.inactiveBucket.success}getLastFailures(){return this.inactiveBucket.failure}},lJ=class{constructor(e,r){this.wrappedPicker=e,this.countCalls=r}pick(e){let r=this.wrappedPicker.pick(e);if(r.pickResultType===ckt.PickResultType.COMPLETE){let n=r.subchannel,i=n.getMapEntry();if(i){let s=r.onCallEnded;return this.countCalls&&(s=(o,a,c)=>{var l;o===$$e.Status.OK?i.counter.addSuccess():i.counter.addFailure(),(l=r.onCallEnded)===null||l===void 0||l.call(r,o,a,c)}),Object.assign(Object.assign({},r),{subchannel:n.getWrappedSubchannel(),onCallEnded:s})}else return Object.assign(Object.assign({},r),{subchannel:n.getWrappedSubchannel()})}else return r}},FL=class{constructor(e){this.entryMap=new iJ.EndpointMap,this.latestConfig=null,this.timerStartTime=null,this.childBalancer=new akt.ChildLoadBalancerHandler((0,L$e.createChildChannelControlHelper)(e,{createSubchannel:(r,n)=>{let i=e.createSubchannel(r,n),s=this.entryMap.getForSubchannelAddress(r),o=new aJ(i,s);return s?.currentEjectionTimestamp!==null&&o.eject(),s?.subchannelWrappers.push(o),o},updateState:(r,n,i)=>{r===skt.ConnectivityState.READY?e.updateState(r,new lJ(n,this.isCountingEnabled()),i):e.updateState(r,n,i)}})),this.ejectionTimer=setInterval(()=>{},0),clearInterval(this.ejectionTimer)}isCountingEnabled(){return this.latestConfig!==null&&(this.latestConfig.getSuccessRateEjectionConfig()!==null||this.latestConfig.getFailurePercentageEjectionConfig()!==null)}getCurrentEjectionPercent(){let e=0;for(let r of this.entryMap.values())r.currentEjectionTimestamp!==null&&(e+=1);return e*100/this.entryMap.size}runSuccessRateCheck(e){if(!this.latestConfig)return;let r=this.latestConfig.getSuccessRateEjectionConfig();if(!r)return;Yr("Running success rate check");let n=r.request_volume,i=0,s=[];for(let[d,f]of this.entryMap.entries()){let p=f.counter.getLastSuccesses(),h=f.counter.getLastFailures();Yr("Stats for "+(0,iJ.endpointToString)(d)+": successes="+p+" failures="+h+" targetRequestVolume="+n),p+h>=n&&(i+=1,s.push(p/(p+h)))}if(Yr("Found "+i+" success rate candidates; currentEjectionPercent="+this.getCurrentEjectionPercent()+" successRates=["+s+"]"),i<r.minimum_hosts)return;let o=s.reduce((d,f)=>d+f)/s.length,a=0;for(let d of s){let f=d-o;a+=f*f}let c=a/s.length,l=Math.sqrt(c),u=o-l*(r.stdev_factor/1e3);Yr("stdev="+l+" ejectionThreshold="+u);for(let[d,f]of this.entryMap.entries()){if(this.getCurrentEjectionPercent()>=this.latestConfig.getMaxEjectionPercent())break;let p=f.counter.getLastSuccesses(),h=f.counter.getLastFailures();if(p+h<n)continue;let m=p/(p+h);if(Yr("Checking candidate "+d+" successRate="+m),m<u){let _=Math.random()*100;Yr("Candidate "+d+" randomNumber="+_+" enforcement_percentage="+r.enforcement_percentage),_<r.enforcement_percentage&&(Yr("Ejecting candidate "+d),this.eject(f,e))}}}runFailurePercentageCheck(e){if(!this.latestConfig)return;let r=this.latestConfig.getFailurePercentageEjectionConfig();if(!r)return;Yr("Running failure percentage check. threshold="+r.threshold+" request volume threshold="+r.request_volume);let n=0;for(let i of this.entryMap.values()){let s=i.counter.getLastSuccesses(),o=i.counter.getLastFailures();s+o>=r.request_volume&&(n+=1)}if(!(n<r.minimum_hosts))for(let[i,s]of this.entryMap.entries()){if(this.getCurrentEjectionPercent()>=this.latestConfig.getMaxEjectionPercent())break;let o=s.counter.getLastSuccesses(),a=s.counter.getLastFailures();if(Yr("Candidate successes="+o+" failures="+a),o+a<r.request_volume)continue;if(a*100/(a+o)>r.threshold){let l=Math.random()*100;Yr("Candidate "+i+" randomNumber="+l+" enforcement_percentage="+r.enforcement_percentage),l<r.enforcement_percentage&&(Yr("Ejecting candidate "+i),this.eject(s,e))}}}eject(e,r){e.currentEjectionTimestamp=new Date,e.ejectionTimeMultiplier+=1;for(let n of e.subchannelWrappers)n.eject()}uneject(e){e.currentEjectionTimestamp=null;for(let r of e.subchannelWrappers)r.uneject()}switchAllBuckets(){for(let e of this.entryMap.values())e.counter.switchBuckets()}startTimer(e){var r,n;this.ejectionTimer=setTimeout(()=>this.runChecks(),e),(n=(r=this.ejectionTimer).unref)===null||n===void 0||n.call(r)}runChecks(){let e=new Date;if(Yr("Ejection timer running"),this.switchAllBuckets(),!!this.latestConfig){this.timerStartTime=e,this.startTimer(this.latestConfig.getIntervalMs()),this.runSuccessRateCheck(e),this.runFailurePercentageCheck(e);for(let[r,n]of this.entryMap.entries())if(n.currentEjectionTimestamp===null)n.ejectionTimeMultiplier>0&&(n.ejectionTimeMultiplier-=1);else{let i=this.latestConfig.getBaseEjectionTimeMs(),s=this.latestConfig.getMaxEjectionTimeMs(),o=new Date(n.currentEjectionTimestamp.getTime());o.setMilliseconds(o.getMilliseconds()+Math.min(i*n.ejectionTimeMultiplier,Math.max(i,s))),o<new Date&&(Yr("Unejecting "+r),this.uneject(n))}}}updateAddressList(e,r,n,i){if(!(r instanceof Uw))return!1;if(Yr("Received update with config: "+JSON.stringify(r.toJsonObject(),void 0,2)),e.ok){for(let o of e.value)this.entryMap.has(o)||(Yr("Adding map entry for "+(0,iJ.endpointToString)(o)),this.entryMap.set(o,{counter:new cJ,currentEjectionTimestamp:null,ejectionTimeMultiplier:0,subchannelWrappers:[]}));this.entryMap.deleteMissing(e.value)}let s=r.getChildPolicy();if(this.childBalancer.updateAddressList(e,s,n,i),r.getSuccessRateEjectionConfig()||r.getFailurePercentageEjectionConfig())if(this.timerStartTime){Yr("Previous timer existed. Replacing timer"),clearTimeout(this.ejectionTimer);let o=r.getIntervalMs()-(new Date().getTime()-this.timerStartTime.getTime());this.startTimer(o)}else Yr("Starting new timer"),this.timerStartTime=new Date,this.startTimer(r.getIntervalMs()),this.switchAllBuckets();else{Yr("Counting disabled. Cancelling timer."),this.timerStartTime=null,clearTimeout(this.ejectionTimer);for(let o of this.entryMap.values())this.uneject(o),o.ejectionTimeMultiplier=0}return this.latestConfig=r,!0}exitIdle(){this.childBalancer.exitIdle()}resetBackoff(){this.childBalancer.resetBackoff()}destroy(){clearTimeout(this.ejectionTimer),this.childBalancer.destroy()}getTypeName(){return uJ}};Np.OutlierDetectionLoadBalancer=FL;function mkt(){fkt&&(0,L$e.registerLoadBalancerType)(uJ,FL,Uw)}});var M$e=E(qL=>{"use strict";Object.defineProperty(qL,"__esModule",{value:!0});qL.PriorityQueue=void 0;var cy=0,dJ=t=>Math.floor(t/2),jL=t=>t*2+1,Fw=t=>t*2+2,fJ=class{constructor(e=(r,n)=>r>n){this.comparator=e,this.heap=[]}size(){return this.heap.length}isEmpty(){return this.size()==0}peek(){return this.heap[cy]}push(...e){return e.forEach(r=>{this.heap.push(r),this.siftUp()}),this.size()}pop(){let e=this.peek(),r=this.size()-1;return r>cy&&this.swap(cy,r),this.heap.pop(),this.siftDown(),e}replace(e){let r=this.peek();return this.heap[cy]=e,this.siftDown(),r}greater(e,r){return this.comparator(this.heap[e],this.heap[r])}swap(e,r){[this.heap[e],this.heap[r]]=[this.heap[r],this.heap[e]]}siftUp(){let e=this.size()-1;for(;e>cy&&this.greater(e,dJ(e));)this.swap(e,dJ(e)),e=dJ(e)}siftDown(){let e=cy;for(;jL(e)<this.size()&&this.greater(jL(e),e)||Fw(e)<this.size()&&this.greater(Fw(e),e);){let r=Fw(e)<this.size()&&this.greater(Fw(e),jL(e))?Fw(e):jL(e);this.swap(e,r),e=r}}};qL.PriorityQueue=fJ});var B$e=E(qw=>{"use strict";Object.defineProperty(qw,"__esModule",{value:!0});qw.WeightedRoundRobinLoadBalancingConfig=void 0;qw.setup=Rkt;var Kr=ti(),gkt=st(),Wi=Pw(),j$e=Uu(),_kt=$w(),ykt=qt(),q$e=wL(),ly=jc(),Skt=M$e(),U$e=Ti(),Ekt="weighted_round_robin";function pJ(t){ykt.trace(gkt.LogVerbosity.DEBUG,Ekt,t)}var gJ="weighted_round_robin",vkt=1e4,bkt=1e4,Tkt=3*6e4,wkt=1e3,Akt=1;function F$e(t,e,r){if(e in t&&t[e]!==void 0&&typeof t[e]!==r)throw new Error(`weighted round robin config ${e} parse error: expected ${r}, got ${typeof t[e]}`)}function BL(t,e){if(e in t&&t[e]!==void 0&&t[e]!==null){let r;if((0,Wi.isDuration)(t[e]))r=t[e];else if((0,Wi.isDurationMessage)(t[e]))r=(0,Wi.durationMessageToDuration)(t[e]);else if(typeof t[e]=="string"){let n=(0,Wi.parseDuration)(t[e]);if(!n)throw new Error(`weighted round robin config ${e}: failed to parse duration string ${t[e]}`);r=n}else throw new Error(`weighted round robin config ${e}: expected duration, got ${typeof t[e]}`);return(0,Wi.durationToMs)(r)}return null}var jw=class t{constructor(e,r,n,i,s,o){this.enableOobLoadReport=e??!1,this.oobLoadReportingPeriodMs=r??vkt,this.blackoutPeriodMs=n??bkt,this.weightExpirationPeriodMs=i??Tkt,this.weightUpdatePeriodMs=Math.max(s??wkt,100),this.errorUtilizationPenalty=o??Akt}getLoadBalancerName(){return gJ}toJsonObject(){return{enable_oob_load_report:this.enableOobLoadReport,oob_load_reporting_period:(0,Wi.durationToString)((0,Wi.msToDuration)(this.oobLoadReportingPeriodMs)),blackout_period:(0,Wi.durationToString)((0,Wi.msToDuration)(this.blackoutPeriodMs)),weight_expiration_period:(0,Wi.durationToString)((0,Wi.msToDuration)(this.weightExpirationPeriodMs)),weight_update_period:(0,Wi.durationToString)((0,Wi.msToDuration)(this.weightUpdatePeriodMs)),error_utilization_penalty:this.errorUtilizationPenalty}}static createFromJson(e){if(F$e(e,"enable_oob_load_report","boolean"),F$e(e,"error_utilization_penalty","number"),e.error_utilization_penalty<0)throw new Error("weighted round robin config error_utilization_penalty < 0");return new t(e.enable_oob_load_report,BL(e,"oob_load_reporting_period"),BL(e,"blackout_period"),BL(e,"weight_expiration_period"),BL(e,"weight_update_period"),e.error_utilization_penalty)}getEnableOobLoadReport(){return this.enableOobLoadReport}getOobLoadReportingPeriodMs(){return this.oobLoadReportingPeriodMs}getBlackoutPeriodMs(){return this.blackoutPeriodMs}getWeightExpirationPeriodMs(){return this.weightExpirationPeriodMs}getWeightUpdatePeriodMs(){return this.weightUpdatePeriodMs}getErrorUtilizationPenalty(){return this.errorUtilizationPenalty}};qw.WeightedRoundRobinLoadBalancingConfig=jw;var hJ=class{constructor(e,r){this.metricsHandler=r,this.queue=new Skt.PriorityQueue((s,o)=>s.deadline<o.deadline);let n=e.filter(s=>s.weight>0),i;if(n.length<2)i=1;else{let s=0;for(let{weight:o}of n)s+=o;i=s/n.length}for(let s of e){let o=s.weight>0?1/s.weight:i;this.queue.push({endpointName:s.endpointName,picker:s.picker,period:o,deadline:Math.random()*o})}}pick(e){let r=this.queue.pop();this.queue.push(Object.assign(Object.assign({},r),{deadline:r.deadline+r.period}));let n=r.picker.pick(e);if(n.pickResultType===ly.PickResultType.COMPLETE){if(this.metricsHandler)return Object.assign(Object.assign({},n),{onCallEnded:(0,q$e.createMetricsReader)(i=>this.metricsHandler(i,r.endpointName),n.onCallEnded)});{let i=n.subchannel;return Object.assign(Object.assign({},n),{subchannel:i.getWrappedSubchannel()})}}else return n}},mJ=class{constructor(e){this.channelControlHelper=e,this.latestConfig=null,this.children=new Map,this.currentState=Kr.ConnectivityState.IDLE,this.updatesPaused=!1,this.lastError=null,this.weightUpdateTimer=null}countChildrenWithState(e){let r=0;for(let n of this.children.values())n.child.getConnectivityState()===e&&(r+=1);return r}updateWeight(e,r){var n,i;let s=r.rps_fractional,o=r.application_utilization;o>0&&s>0&&(o+=r.eps/s*((i=(n=this.latestConfig)===null||n===void 0?void 0:n.getErrorUtilizationPenalty())!==null&&i!==void 0?i:0));let a=o===0?0:s/o;if(a===0)return;let c=new Date;e.nonEmptySince===null&&(e.nonEmptySince=c),e.lastUpdated=c,e.weight=a}getWeight(e){if(!this.latestConfig)return 0;let r=new Date().getTime();if(r-e.lastUpdated.getTime()>=this.latestConfig.getWeightExpirationPeriodMs())return e.nonEmptySince=null,0;let n=this.latestConfig.getBlackoutPeriodMs();return n>0&&(e.nonEmptySince===null||r-e.nonEmptySince.getTime()<n)?0:e.weight}calculateAndUpdateState(){if(!(this.updatesPaused||!this.latestConfig)){if(this.countChildrenWithState(Kr.ConnectivityState.READY)>0){let e=[];for(let[n,i]of this.children)i.child.getConnectivityState()===Kr.ConnectivityState.READY&&e.push({endpointName:n,picker:i.child.getPicker(),weight:this.getWeight(i)});pJ("Created picker with weights: "+e.map(n=>n.endpointName+":"+n.weight).join(","));let r;this.latestConfig.getEnableOobLoadReport()?r=null:r=(n,i)=>{let s=this.children.get(i);s&&this.updateWeight(s,n)},this.updateState(Kr.ConnectivityState.READY,new hJ(e,r),null)}else if(this.countChildrenWithState(Kr.ConnectivityState.CONNECTING)>0)this.updateState(Kr.ConnectivityState.CONNECTING,new ly.QueuePicker(this),null);else if(this.countChildrenWithState(Kr.ConnectivityState.TRANSIENT_FAILURE)>0){let e=`weighted_round_robin: No connection established. Last error: ${this.lastError}`;this.updateState(Kr.ConnectivityState.TRANSIENT_FAILURE,new ly.UnavailablePicker({details:e}),e)}else this.updateState(Kr.ConnectivityState.IDLE,new ly.QueuePicker(this),null);for(let{child:e}of this.children.values())e.getConnectivityState()===Kr.ConnectivityState.IDLE&&e.exitIdle()}}updateState(e,r,n){pJ(Kr.ConnectivityState[this.currentState]+" -> "+Kr.ConnectivityState[e]),this.currentState=e,this.channelControlHelper.updateState(e,r,n)}updateAddressList(e,r,n,i){var s,o;if(!(r instanceof jw))return!1;if(!e.ok)return this.children.size===0&&this.updateState(Kr.ConnectivityState.TRANSIENT_FAILURE,new ly.UnavailablePicker(e.error),e.error.details),!0;if(e.value.length===0){let l=`No addresses resolved. Resolution note: ${i}`;return this.updateState(Kr.ConnectivityState.TRANSIENT_FAILURE,new ly.UnavailablePicker({details:l}),l),!1}pJ("Connect to endpoint list "+e.value.map(U$e.endpointToString));let a=new Date,c=new Set;this.updatesPaused=!0,this.latestConfig=r;for(let l of e.value){let u=(0,U$e.endpointToString)(l);c.add(u);let d=this.children.get(u);d||(d={child:new _kt.LeafLoadBalancer(l,(0,j$e.createChildChannelControlHelper)(this.channelControlHelper,{updateState:(f,p,h)=>{this.currentState===Kr.ConnectivityState.READY&&f!==Kr.ConnectivityState.READY&&this.channelControlHelper.requestReresolution(),f===Kr.ConnectivityState.READY&&(d.nonEmptySince=null),h&&(this.lastError=h),this.calculateAndUpdateState()},createSubchannel:(f,p)=>{let h=this.channelControlHelper.createSubchannel(f,p);return d?.oobMetricsListener?new q$e.OrcaOobMetricsSubchannelWrapper(h,d.oobMetricsListener,this.latestConfig.getOobLoadReportingPeriodMs()):h}}),n,i),lastUpdated:a,nonEmptySince:null,weight:0,oobMetricsListener:null},this.children.set(u,d)),r.getEnableOobLoadReport()?d.oobMetricsListener=f=>{this.updateWeight(d,f)}:d.oobMetricsListener=null}for(let[l,u]of this.children)c.has(l)?u.child.startConnecting():(u.child.destroy(),this.children.delete(l));return this.updatesPaused=!1,this.calculateAndUpdateState(),this.weightUpdateTimer&&clearInterval(this.weightUpdateTimer),this.weightUpdateTimer=(o=(s=setInterval(()=>{this.currentState===Kr.ConnectivityState.READY&&this.calculateAndUpdateState()},r.getWeightUpdatePeriodMs())).unref)===null||o===void 0?void 0:o.call(s),!0}exitIdle(){}resetBackoff(){}destroy(){for(let e of this.children.values())e.child.destroy();this.children.clear(),this.weightUpdateTimer&&clearInterval(this.weightUpdateTimer)}getTypeName(){return gJ}};function Rkt(){(0,j$e.registerLoadBalancerType)(gJ,mJ,jw)}});var Bw=E(Ae=>{"use strict";Object.defineProperty(Ae,"__esModule",{value:!0});Ae.experimental=Ae.ServerMetricRecorder=Ae.ServerInterceptingCall=Ae.ResponderBuilder=Ae.ServerListenerBuilder=Ae.addAdminServicesToServer=Ae.getChannelzHandlers=Ae.getChannelzServiceDefinition=Ae.InterceptorConfigurationError=Ae.InterceptingCall=Ae.RequesterBuilder=Ae.ListenerBuilder=Ae.StatusBuilder=Ae.getClientChannel=Ae.ServerCredentials=Ae.Server=Ae.setLogVerbosity=Ae.setLogger=Ae.load=Ae.loadObject=Ae.CallCredentials=Ae.ChannelCredentials=Ae.waitForClientReady=Ae.closeClient=Ae.Channel=Ae.makeGenericClientConstructor=Ae.makeClientConstructor=Ae.loadPackageDefinition=Ae.Client=Ae.compressionAlgorithms=Ae.propagate=Ae.connectivityState=Ae.status=Ae.logVerbosity=Ae.Metadata=Ae.credentials=void 0;var zL=Wk();Object.defineProperty(Ae,"CallCredentials",{enumerable:!0,get:function(){return zL.CallCredentials}});var xkt=i5();Object.defineProperty(Ae,"Channel",{enumerable:!0,get:function(){return xkt.ChannelImplementation}});var Ikt=v8();Object.defineProperty(Ae,"compressionAlgorithms",{enumerable:!0,get:function(){return Ikt.CompressionAlgorithms}});var Okt=ti();Object.defineProperty(Ae,"connectivityState",{enumerable:!0,get:function(){return Okt.ConnectivityState}});var VL=I_();Object.defineProperty(Ae,"ChannelCredentials",{enumerable:!0,get:function(){return VL.ChannelCredentials}});var z$e=n5();Object.defineProperty(Ae,"Client",{enumerable:!0,get:function(){return z$e.Client}});var _J=st();Object.defineProperty(Ae,"logVerbosity",{enumerable:!0,get:function(){return _J.LogVerbosity}});Object.defineProperty(Ae,"status",{enumerable:!0,get:function(){return _J.Status}});Object.defineProperty(Ae,"propagate",{enumerable:!0,get:function(){return _J.Propagate}});var V$e=qt(),yJ=p$();Object.defineProperty(Ae,"loadPackageDefinition",{enumerable:!0,get:function(){return yJ.loadPackageDefinition}});Object.defineProperty(Ae,"makeClientConstructor",{enumerable:!0,get:function(){return yJ.makeClientConstructor}});Object.defineProperty(Ae,"makeGenericClientConstructor",{enumerable:!0,get:function(){return yJ.makeClientConstructor}});var Pkt=Vr();Object.defineProperty(Ae,"Metadata",{enumerable:!0,get:function(){return Pkt.Metadata}});var Ckt=u$e();Object.defineProperty(Ae,"Server",{enumerable:!0,get:function(){return Ckt.Server}});var Nkt=bL();Object.defineProperty(Ae,"ServerCredentials",{enumerable:!0,get:function(){return Nkt.ServerCredentials}});var kkt=d$e();Object.defineProperty(Ae,"StatusBuilder",{enumerable:!0,get:function(){return kkt.StatusBuilder}});Ae.credentials={combineChannelCredentials:(t,...e)=>e.reduce((r,n)=>r.compose(n),t),combineCallCredentials:(t,...e)=>e.reduce((r,n)=>r.compose(n),t),createInsecure:VL.ChannelCredentials.createInsecure,createSsl:VL.ChannelCredentials.createSsl,createFromSecureContext:VL.ChannelCredentials.createFromSecureContext,createFromMetadataGenerator:zL.CallCredentials.createFromMetadataGenerator,createFromGoogleCredential:zL.CallCredentials.createFromGoogleCredential,createEmpty:zL.CallCredentials.createEmpty};var $kt=t=>t.close();Ae.closeClient=$kt;var Lkt=(t,e,r)=>t.waitForReady(e,r);Ae.waitForClientReady=Lkt;var Dkt=(t,e)=>{throw new Error("Not available in this library. Use @grpc/proto-loader and loadPackageDefinition instead")};Ae.loadObject=Dkt;var Mkt=(t,e,r)=>{throw new Error("Not available in this library. Use @grpc/proto-loader and loadPackageDefinition instead")};Ae.load=Mkt;var Ukt=t=>{V$e.setLogger(t)};Ae.setLogger=Ukt;var Fkt=t=>{V$e.setLoggerVerbosity(t)};Ae.setLogVerbosity=Fkt;var jkt=t=>z$e.Client.prototype.getChannel.call(t);Ae.getClientChannel=jkt;var HL=e5();Object.defineProperty(Ae,"ListenerBuilder",{enumerable:!0,get:function(){return HL.ListenerBuilder}});Object.defineProperty(Ae,"RequesterBuilder",{enumerable:!0,get:function(){return HL.RequesterBuilder}});Object.defineProperty(Ae,"InterceptingCall",{enumerable:!0,get:function(){return HL.InterceptingCall}});Object.defineProperty(Ae,"InterceptorConfigurationError",{enumerable:!0,get:function(){return HL.InterceptorConfigurationError}});var H$e=Yu();Object.defineProperty(Ae,"getChannelzServiceDefinition",{enumerable:!0,get:function(){return H$e.getChannelzServiceDefinition}});Object.defineProperty(Ae,"getChannelzHandlers",{enumerable:!0,get:function(){return H$e.getChannelzHandlers}});var qkt=c$();Object.defineProperty(Ae,"addAdminServicesToServer",{enumerable:!0,get:function(){return qkt.addAdminServicesToServer}});var SJ=M9();Object.defineProperty(Ae,"ServerListenerBuilder",{enumerable:!0,get:function(){return SJ.ServerListenerBuilder}});Object.defineProperty(Ae,"ResponderBuilder",{enumerable:!0,get:function(){return SJ.ResponderBuilder}});Object.defineProperty(Ae,"ServerInterceptingCall",{enumerable:!0,get:function(){return SJ.ServerInterceptingCall}});var Bkt=wL();Object.defineProperty(Ae,"ServerMetricRecorder",{enumerable:!0,get:function(){return Bkt.ServerMetricRecorder}});var zkt=K9();Ae.experimental=zkt;var Vkt=j8(),Hkt=T$e(),Gkt=O$e(),Wkt=$w(),Ykt=k$e(),Kkt=D$e(),Jkt=B$e(),Zkt=Yu();Vkt.setup(),Hkt.setup(),Gkt.setup(),Wkt.setup(),Ykt.setup(),Kkt.setup(),Jkt.setup(),Zkt.setup()});var G$e=E(GL=>{"use strict";Object.defineProperty(GL,"__esModule",{value:!0});GL.createServiceClientConstructor=void 0;var Xkt=Bw();function Qkt(t,e){let r={export:{path:t,requestStream:!1,responseStream:!1,requestSerialize:n=>n,requestDeserialize:n=>n,responseSerialize:n=>n,responseDeserialize:n=>n}};return Xkt.makeGenericClientConstructor(r,e)}GL.createServiceClientConstructor=Qkt});var zw=E(Ds=>{"use strict";Object.defineProperty(Ds,"__esModule",{value:!0});Ds.createOtlpGrpcExporterTransport=Ds.GrpcExporterTransport=Ds.createEmptyMetadata=Ds.createSslCredentials=Ds.createInsecureCredentials=void 0;var e$t=FOe(),W$e=`OTel-OTLP-Exporter-JavaScript/${e$t.VERSION}`;function t$t(t){return t?`${t} ${W$e}`:W$e}var r$t=0,n$t=2;function i$t(t){return t==="gzip"?n$t:r$t}function s$t(){let{credentials:t}=Bw();return t.createInsecure()}Ds.createInsecureCredentials=s$t;function o$t(t,e,r){let{credentials:n}=Bw();return n.createSsl(t,e,r)}Ds.createSslCredentials=o$t;function a$t(){let{Metadata:t}=Bw();return new t}Ds.createEmptyMetadata=a$t;var WL=class{_client;_metadata;_parameters;constructor(e){this._parameters=e}shutdown(){this._client?.close()}send(e,r){let n=Buffer.from(e);if(this._client==null){let{createServiceClientConstructor:i}=G$e();try{this._metadata=this._parameters.metadata()}catch(o){return Promise.resolve({status:"failure",error:o})}let s=i(this._parameters.grpcPath,this._parameters.grpcName);try{this._client=new s(this._parameters.address,this._parameters.credentials(),{"grpc.default_compression_algorithm":i$t(this._parameters.compression),"grpc.primary_user_agent":t$t(this._parameters.userAgent)})}catch(o){return Promise.resolve({status:"failure",error:o})}}return new Promise(i=>{let s=Date.now()+r;if(this._metadata==null)return i({error:new Error("metadata was null"),status:"failure"});this._client.export(n,this._metadata,{deadline:s},(o,a)=>{i(o?{status:"failure",error:o}:{data:a,status:"success"})})})}};Ds.GrpcExporterTransport=WL;function c$t(t){return new WL(t)}Ds.createOtlpGrpcExporterTransport=c$t});var X$e=E(rd=>{"use strict";Object.defineProperty(rd,"__esModule",{value:!0});rd.getOtlpGrpcDefaultConfiguration=rd.mergeOtlpGrpcConfigurationWithDefaults=rd.validateAndNormalizeUrl=void 0;var J$e=(jk(),qn(Fk)),Vw=zw(),l$t=W("url"),Y$e=(Ne(),qn(Ou));function Z$e(t){t=t.trim(),t.match(/^([\w]{1,8}):\/\//)||(t=`https://${t}`);let r=new l$t.URL(t);return r.protocol==="unix:"?t:(r.pathname&&r.pathname!=="/"&&Y$e.diag.warn("URL path should not be set when using grpc, the path part of the URL will be ignored."),r.protocol!==""&&!r.protocol?.match(/^(http)s?:$/)&&Y$e.diag.warn("URL protocol should be http(s)://. Using http://."),r.host)}rd.validateAndNormalizeUrl=Z$e;function K$e(t,e){for(let[r,n]of Object.entries(e.getMap()))t.get(r).length<1&&t.set(r,n)}function u$t(t,e,r){let n=t.url??e.url??r.url;return{...(0,J$e.mergeOtlpSharedConfigurationWithDefaults)(t,e,r),metadata:()=>{let i=r.metadata();return K$e(i,t.metadata?.().clone()??(0,Vw.createEmptyMetadata)()),K$e(i,e.metadata?.()??(0,Vw.createEmptyMetadata)()),i},url:Z$e(n),credentials:t.credentials??e.credentials?.(n)??r.credentials(n),userAgent:t.userAgent}}rd.mergeOtlpGrpcConfigurationWithDefaults=u$t;function d$t(){return{...(0,J$e.getSharedConfigurationDefaults)(),metadata:()=>(0,Vw.createEmptyMetadata)(),url:"http://localhost:4317",credentials:t=>t.startsWith("http://")?()=>(0,Vw.createInsecureCredentials)():()=>(0,Vw.createSslCredentials)()}}rd.getOtlpGrpcDefaultConfiguration=d$t});function Q$e(t){let e={};return Object.entries(t??{}).forEach(([r,n])=>{typeof n<"u"?e[r]=String(n):ce.warn(`Header "${r}" has invalid value (${n}) and will be ignored`)}),e}var eLe=$(()=>{"use strict";Ne()});function f$t(t,e,r){return async()=>{let n={...await r()},i={};return e!=null&&Object.assign(i,await e()),t!=null&&Object.assign(i,Q$e(await t())),Object.assign(i,n)}}function p$t(t){if(t!=null)try{let e=globalThis.location?.href;return new URL(t,e).href}catch{throw new Error(`Configuration: Could not parse user-provided export URL: '${t}'`)}}function tLe(t,e,r){return{...hk(t,e,r),headers:f$t(t.headers,e.headers,r.headers),url:p$t(t.url)??e.url??r.url}}function rLe(t,e){return{...mk(),headers:async()=>t,url:"http://localhost:4318/"+e}}var nLe=$(()=>{"use strict";MT();eLe()});function kp(t){return async e=>{let r=e==="http:",n=r?import("http"):import("https"),{Agent:i}=await n;if(r){let{ca:s,cert:o,key:a,...c}=t;return new i(c)}return new i(t)}}function iLe(t,e,r){return{...tLe(t,e,r),agentFactory:t.agentFactory??e.agentFactory??r.agentFactory,userAgent:t.userAgent}}function sLe(t,e){return{...rLe(t,e),agentFactory:kp({keepAlive:!0})}}var YL=$(()=>{"use strict";nLe()});function EJ(t){return t===429||t===502||t===503||t===504}function vJ(t){if(t==null)return;let e=Number.parseInt(t,10);if(Number.isInteger(e))return e>0?e*1e3:-1;let r=new Date(t).getTime()-Date.now();return r>=0?r:0}var oLe=$(()=>{"use strict"});var aLe,cLe=$(()=>{"use strict";aLe="0.218.0"});import*as dLe from"zlib";import{Readable as h$t}from"stream";function fLe(t,e,r,n,i,s,o,a){return new Promise(c=>{let l=new URL(e);i?r["User-Agent"]=`${i} ${lLe}`:r["User-Agent"]=lLe;let d=t(l,{method:"POST",headers:r,agent:s},f=>{let p=[],h=0;f.on("data",m=>{if(h+=m.length,h>uLe){let _=new Error(`OTLP export response body exceeded size limit of ${uLe} bytes`);c({status:"failure",error:_}),f.destroy();return}p.push(m)}),f.on("end",()=>{if(f.statusCode&&f.statusCode<=299)c({status:"success",data:Buffer.concat(p)});else if(f.statusCode&&EJ(f.statusCode))c({status:"retryable",retryInMillis:vJ(f.headers["retry-after"])});else{let m=new Uc(f.statusMessage,f.statusCode,Buffer.concat(p).toString());c({status:"failure",error:m})}}),f.on("error",m=>{f.statusCode&&f.statusCode<=299?c({status:"success"}):f.statusCode&&EJ(f.statusCode)?c({status:"retryable",error:m,retryInMillis:vJ(f.headers["retry-after"])}):c({status:"failure",error:m})})});d.setTimeout(a,()=>{d.destroy(),c({status:"retryable",error:new Error("Request timed out")})}),d.on("error",f=>{_$t(f)?c({status:"retryable",error:f}):c({status:"failure",error:f})}),m$t(d,n,o,f=>{c({status:"failure",error:f})})})}function m$t(t,e,r,n){let i=g$t(r);e==="gzip"&&(t.setHeader("Content-Encoding","gzip"),i=i.on("error",n).pipe(dLe.createGzip()).on("error",n)),i.pipe(t).on("error",n)}function g$t(t){let e=new h$t;return e.push(t),e.push(null),e}function _$t(t){let e=new Set(["ECONNRESET","ECONNREFUSED","EPIPE","ETIMEDOUT","EAI_AGAIN","ENOTFOUND","ENETUNREACH","EHOSTUNREACH"]);return"code"in t&&typeof t.code=="string"?e.has(t.code):!1}var lLe,uLe,pLe=$(()=>{"use strict";oLe();fk();cLe();lLe=`OTel-OTLP-Exporter-JavaScript/${aLe}`,uLe=4*1024*1024});async function y$t(t){let e=t==="http:"?import("http"):import("https"),{request:r}=await e;return r}function hLe(t){return new bJ(t)}var bJ,mLe=$(()=>{"use strict";pLe();bJ=class{_utils=null;_parameters;constructor(e){this._parameters=e}async send(e,r){let{agent:n,request:i}=await this._loadUtils(),s=await this._parameters.headers();return fLe(i,this._parameters.url,s,this._parameters.compression,this._parameters.userAgent,n,e,r)}shutdown(){}async _loadUtils(){let e=this._utils;if(e===null){let r=new URL(this._parameters.url).protocol,[n,i]=await Promise.all([this._parameters.agentFactory(r),y$t(r)]);e=this._utils={agent:n,request:i}}return e}}});function b$t(){return Math.random()*(2*gLe)-gLe}function _Le(t){return new wJ(t.transport)}var TJ,S$t,E$t,v$t,gLe,wJ,yLe=$(()=>{"use strict";Ne();TJ=5,S$t=1e3,E$t=5e3,v$t=1.5,gLe=.2;wJ=class{_transport;constructor(e){this._transport=e}retry(e,r,n){return new Promise((i,s)=>{setTimeout(()=>{this._transport.send(e,r).then(i,s)},n)})}async send(e,r){let n=TJ,i=S$t,s=Date.now()+r,o=await this._transport.send(e,r);for(;o.status==="retryable"&&n>0;){n--;let a=Math.max(Math.min(i*(1+b$t()),E$t),0);i=i*v$t;let c=o.retryInMillis??a,l=s-Date.now();if(c>l)return ce.info(`Export retry time ${Math.round(c)}ms exceeds remaining timeout ${Math.round(l)}ms, not retrying further.`),o;ce.verbose(`Scheduling export retry in ${Math.round(c)}ms`),o=await this.retry(e,l,c)}return o.status==="success"?ce.verbose(`Export succeeded after ${TJ-n} retry attempts.`):o.status==="retryable"?ce.info(`Export failed after maximum retry attempts (${TJ}).`):ce.info(`Export failed with non-retryable error: ${o.error}`),o}shutdown(){return this._transport.shutdown()}}});function SLe(t,e){return Uk({transport:_Le({transport:hLe(t)}),serializer:e,promiseHandler:_k(t)},{timeout:t.timeoutMillis})}var ELe=$(()=>{"use strict";pK();mLe();YY();yLe()});function vLe(t){let e=E_(t);if(e!=null){if(Number.isFinite(e)&&e>0)return e;ce.warn(`Configuration: ${t} is invalid, expected number greater than 0 (actual: ${e})`)}}function T$t(t){let e=vLe(`OTEL_EXPORTER_OTLP_${t}_TIMEOUT`),r=vLe("OTEL_EXPORTER_OTLP_TIMEOUT");return e??r}function bLe(t){let e=vi(t)?.trim();if(e==null||e==="none"||e==="gzip")return e;ce.warn(`Configuration: ${t} is invalid, expected 'none' or 'gzip' (actual: '${e}')`)}function w$t(t){let e=bLe(`OTEL_EXPORTER_OTLP_${t}_COMPRESSION`),r=bLe("OTEL_EXPORTER_OTLP_COMPRESSION");return e??r}function KL(t){return{timeoutMillis:T$t(t),compression:w$t(t)}}var AJ=$(()=>{"use strict";T_();Ne()});import*as TLe from"fs";import*as wLe from"path";function A$t(t){let e=vi(`OTEL_EXPORTER_OTLP_${t}_HEADERS`),r=vi("OTEL_EXPORTER_OTLP_HEADERS"),n=op(e),i=op(r);if(!(Object.keys(n).length===0&&Object.keys(i).length===0))return Object.assign({},op(r),op(e))}function R$t(t){try{return new URL(t).toString()}catch{ce.warn(`Configuration: Could not parse environment-provided export URL: '${t}', falling back to undefined`);return}}function x$t(t,e){try{new URL(t)}catch{ce.warn(`Configuration: Could not parse environment-provided export URL: '${t}', falling back to undefined`);return}t.endsWith("/")||(t=t+"/"),t+=e;try{new URL(t)}catch{ce.warn(`Configuration: Provided URL appended with '${e}' is not a valid URL, using 'undefined' instead of '${t}'`);return}return t}function I$t(t){let e=vi("OTEL_EXPORTER_OTLP_ENDPOINT");if(e!==void 0)return x$t(e,t)}function O$t(t){let e=vi(`OTEL_EXPORTER_OTLP_${t}_ENDPOINT`);if(e!==void 0)return R$t(e)}function RJ(t,e,r){let n=vi(t),i=vi(e),s=n??i;if(s!=null)try{return TLe.readFileSync(wLe.resolve(process.cwd(),s))}catch{ce.warn(r);return}else return}function P$t(t){return RJ(`OTEL_EXPORTER_OTLP_${t}_CLIENT_CERTIFICATE`,"OTEL_EXPORTER_OTLP_CLIENT_CERTIFICATE","Failed to read client certificate chain file")}function C$t(t){return RJ(`OTEL_EXPORTER_OTLP_${t}_CLIENT_KEY`,"OTEL_EXPORTER_OTLP_CLIENT_KEY","Failed to read client certificate private key file")}function N$t(t){return RJ(`OTEL_EXPORTER_OTLP_${t}_CERTIFICATE`,"OTEL_EXPORTER_OTLP_CERTIFICATE","Failed to read root certificate file")}function ALe(t,e){return{...KL(t),url:O$t(t)??I$t(e),headers:pk(A$t(t)),agentFactory:kp({keepAlive:!0,ca:N$t(t),cert:P$t(t),key:C$t(t)})}}var RLe=$(()=>{"use strict";T_();Ne();AJ();MT();YL()});function xLe(t){return typeof t.headers=="function"?t.headers:pk(t.headers)}var ILe=$(()=>{"use strict";MT()});function k$t(t){if(typeof t.httpAgentOptions=="function")return t.httpAgentOptions;let e=t.httpAgentOptions;if(t.keepAlive!=null&&(e={keepAlive:t.keepAlive,...e}),e!=null)return kp(e)}function OLe(t,e,r,n){return t.metadata&&ce.warn("Metadata cannot be set when using http"),iLe({url:t.url,headers:xLe(t),concurrencyLimit:t.concurrencyLimit,timeoutMillis:t.timeoutMillis,compression:t.compression,agentFactory:k$t(t),userAgent:t.userAgent},ALe(e,r),sLe(n,r))}var PLe=$(()=>{"use strict";Ne();YL();xJ();RLe();ILe()});var CLe={};tn(CLe,{convertLegacyHttpOptions:()=>OLe,createOtlpHttpExportDelegate:()=>SLe,getSharedConfigurationFromEnvironment:()=>KL,httpAgentFactoryFromOptions:()=>kp});var xJ=$(()=>{"use strict";YL();ELe();AJ();PLe()});var DLe=E(JL=>{"use strict";Object.defineProperty(JL,"__esModule",{value:!0});JL.getOtlpGrpcConfigurationFromEnv=void 0;var NLe=(T_(),qn($Oe)),Hw=zw(),$$t=(xJ(),qn(CLe)),L$t=W("fs"),D$t=W("path"),$Le=(Ne(),qn(Ou));function IJ(t,e){if(t!=null&&t!=="")return t;if(e!=null&&e!=="")return e}function M$t(t){let e=process.env[`OTEL_EXPORTER_OTLP_${t}_HEADERS`]?.trim(),r=process.env.OTEL_EXPORTER_OTLP_HEADERS?.trim(),n=(0,NLe.parseKeyPairsIntoRecord)(e),i=(0,NLe.parseKeyPairsIntoRecord)(r);if(Object.keys(n).length===0&&Object.keys(i).length===0)return;let s=Object.assign({},i,n),o=(0,Hw.createEmptyMetadata)();for(let[a,c]of Object.entries(s))o.set(a,c);return o}function U$t(t){let e=M$t(t);if(e!=null)return()=>e}function F$t(t){let e=process.env[`OTEL_EXPORTER_OTLP_${t}_ENDPOINT`]?.trim(),r=process.env.OTEL_EXPORTER_OTLP_ENDPOINT?.trim();return IJ(e,r)}function j$t(t){let e=process.env[`OTEL_EXPORTER_OTLP_${t}_INSECURE`]?.toLowerCase().trim(),r=process.env.OTEL_EXPORTER_OTLP_INSECURE?.toLowerCase().trim();return IJ(e,r)==="true"}function OJ(t,e,r){let n=process.env[t]?.trim(),i=process.env[e]?.trim(),s=IJ(n,i);if(s!=null)try{return L$t.readFileSync(D$t.resolve(process.cwd(),s))}catch{$Le.diag.warn(r);return}else return}function q$t(t){return OJ(`OTEL_EXPORTER_OTLP_${t}_CLIENT_CERTIFICATE`,"OTEL_EXPORTER_OTLP_CLIENT_CERTIFICATE","Failed to read client certificate chain file")}function B$t(t){return OJ(`OTEL_EXPORTER_OTLP_${t}_CLIENT_KEY`,"OTEL_EXPORTER_OTLP_CLIENT_KEY","Failed to read client certificate private key file")}function kLe(t){return OJ(`OTEL_EXPORTER_OTLP_${t}_CERTIFICATE`,"OTEL_EXPORTER_OTLP_CERTIFICATE","Failed to read root certificate file")}function LLe(t){let e=B$t(t),r=q$t(t),n=kLe(t),i=e!=null&&r!=null;return n!=null&&!i?($Le.diag.warn("Client key and certificate must both be provided, but one was missing - attempting to create credentials from just the root certificate"),(0,Hw.createSslCredentials)(kLe(t))):(0,Hw.createSslCredentials)(n,e,r)}function z$t(t){return j$t(t)?(0,Hw.createInsecureCredentials)():LLe(t)}function V$t(t){return{...(0,$$t.getSharedConfigurationFromEnvironment)(t),metadata:U$t(t),url:F$t(t),credentials:e=>e.startsWith("http://")?()=>(0,Hw.createInsecureCredentials)():e.startsWith("https://")?()=>LLe(t):()=>z$t(t)}}JL.getOtlpGrpcConfigurationFromEnv=V$t});var ULe=E(ZL=>{"use strict";Object.defineProperty(ZL,"__esModule",{value:!0});ZL.convertLegacyOtlpGrpcOptions=void 0;var MLe=X$e(),H$t=zw(),G$t=DLe();function W$t(t,e){let r=t.credentials;return(0,MLe.mergeOtlpGrpcConfigurationWithDefaults)({url:t.url,metadata:()=>t.metadata??(0,H$t.createEmptyMetadata)(),compression:t.compression,timeoutMillis:t.timeoutMillis,concurrencyLimit:t.concurrencyLimit,credentials:r!=null?()=>r:void 0,userAgent:t.userAgent},(0,G$t.getOtlpGrpcConfigurationFromEnv)(e),(0,MLe.getOtlpGrpcDefaultConfiguration)())}ZL.convertLegacyOtlpGrpcOptions=W$t});var FLe=E(XL=>{"use strict";Object.defineProperty(XL,"__esModule",{value:!0});XL.createOtlpGrpcExportDelegate=void 0;var Y$t=(jk(),qn(Fk)),K$t=zw();function J$t(t,e,r,n){return(0,Y$t.createOtlpNetworkExportDelegate)(t,e,(0,K$t.createOtlpGrpcExporterTransport)({address:t.url,compression:t.compression,credentials:t.credentials,metadata:t.metadata,userAgent:t.userAgent,grpcName:r,grpcPath:n}))}XL.createOtlpGrpcExportDelegate=J$t});var jLe=E(uy=>{"use strict";Object.defineProperty(uy,"__esModule",{value:!0});uy.createOtlpGrpcExportDelegate=uy.convertLegacyOtlpGrpcOptions=void 0;var Z$t=ULe();Object.defineProperty(uy,"convertLegacyOtlpGrpcOptions",{enumerable:!0,get:function(){return Z$t.convertLegacyOtlpGrpcOptions}});var X$t=FLe();Object.defineProperty(uy,"createOtlpGrpcExportDelegate",{enumerable:!0,get:function(){return X$t.createOtlpGrpcExportDelegate}})});function Qc(t){return t<0?10:t<128?1:t<16384?2:t<2097152?3:t<268435456?4:t<34359738368?5:t<4398046511104?6:t<562949953421312?7:t<72057594037927940?8:9}var PJ=$(()=>{"use strict"});var Q$t,Gw,nd,QL=$(()=>{"use strict";Ne();PJ();Q$t="ProtobufWriter: estimated size was too small, growing buffer.",Gw=1,nd=class{_buffer;_textEncoder;_dataView;pos=0;constructor(e=65536){this._buffer=new Uint8Array(e),this._textEncoder=new TextEncoder,this._dataView=new DataView(this._buffer.buffer,this._buffer.byteOffset)}_ensureCapacity(e){let r=this.pos+e;if(r<=this._buffer.length)return;ce.debug(Q$t);let n=this._buffer.length*2;for(;n<r;)n*=2;let i=new Uint8Array(n);i.set(this._buffer),this._buffer=i,this._dataView=new DataView(this._buffer.buffer,this._buffer.byteOffset)}finish(){return this._buffer.subarray(0,this.pos)}startLengthDelimited(){let e=this.pos;return this._ensureCapacity(Gw),this.pos+=Gw,e}finishLengthDelimited(e,r){let n=r>>>0,i=Qc(n);if(i>Gw){let o=i-Gw;this._ensureCapacity(o),this._buffer.copyWithin(e+i,e+Gw,this.pos),this.pos+=o}let s=e;n<128?this._buffer[s]=n:n<16384?(this._buffer[s++]=n&127|128,this._buffer[s]=n>>>7):n<2097152?(this._buffer[s++]=n&127|128,this._buffer[s++]=n>>>7&127|128,this._buffer[s]=n>>>14):n<268435456?(this._buffer[s++]=n&127|128,this._buffer[s++]=n>>>7&127|128,this._buffer[s++]=n>>>14&127|128,this._buffer[s]=n>>>21):(this._buffer[s++]=n&127|128,this._buffer[s++]=n>>>7&127|128,this._buffer[s++]=n>>>14&127|128,this._buffer[s++]=n>>>21&127|128,this._buffer[s]=n>>>28)}writeSint32(e){this.writeVarint((e<<1^e>>31)>>>0)}writeSfixed64(e){let r,n;if(e>=0)r=e>>>0,n=e/4294967296>>>0;else{let i=Math.abs(e);r=i>>>0,n=i/4294967296>>>0,r=~r>>>0,n=~n>>>0,r=r+1>>>0,r===0&&(n=n+1>>>0)}this.writeFixed64(r,n)}writeVarint(e){if(this._ensureCapacity(Qc(e)),e>=0&&e<=4294967295){let r=e>>>0;for(;r>127;)this._buffer[this.pos++]=r&127|128,r>>>=7;this._buffer[this.pos++]=r}else{let r,n;if(e>=0)r=e>>>0,n=e/4294967296>>>0;else{let i=Math.abs(e);r=i>>>0,n=i/4294967296>>>0,r=~r>>>0,n=~n>>>0,r=r+1>>>0,r===0&&(n=n+1>>>0)}for(;n>0||r>127;)this._buffer[this.pos++]=r&127|128,r=(r>>>7|n<<25)>>>0,n>>>=7;this._buffer[this.pos++]=r&127}}writeFixed32(e){this._ensureCapacity(4);let r=e>>>0;this._buffer[this.pos++]=r&255,this._buffer[this.pos++]=r>>>8&255,this._buffer[this.pos++]=r>>>16&255,this._buffer[this.pos++]=r>>>24&255}writeFixed64(e,r){this._ensureCapacity(8);let n=e>>>0,i=r>>>0;this._buffer[this.pos++]=n&255,this._buffer[this.pos++]=n>>>8&255,this._buffer[this.pos++]=n>>>16&255,this._buffer[this.pos++]=n>>>24&255,this._buffer[this.pos++]=i&255,this._buffer[this.pos++]=i>>>8&255,this._buffer[this.pos++]=i>>>16&255,this._buffer[this.pos++]=i>>>24&255}writeBytes(e){this.writeVarint(e.length),this._ensureCapacity(e.length),this._buffer.set(e,this.pos),this.pos+=e.length}writeTag(e,r){this.writeVarint(e<<3|r)}writeDouble(e){this._ensureCapacity(8),this._dataView.setFloat64(this.pos,e,!0),this.pos+=8}writeString(e){let r=!0,n=e.length;for(let i=0;i<n;i++)if(e.charCodeAt(i)>127){r=!1;break}if(r){this.writeVarint(n),this._ensureCapacity(n);for(let i=0;i<n;i++)this._buffer[this.pos++]=e.charCodeAt(i)}else{let i=this._textEncoder.encode(e);this.writeBytes(i)}}}});function qLe(t){return t>=48&&t<=57?t-48:t>=97&&t<=102?t-87:t-55}function el(t){let e=new Uint8Array(t.length/2),r=0;for(let n=0;n<t.length;n+=2){let i=qLe(t.charCodeAt(n)),s=qLe(t.charCodeAt(n+1));e[r++]=i<<4|s}return e}var CJ=$(()=>{"use strict"});var Ww,BLe=$(()=>{"use strict";(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"})(Ww||(Ww={}))});var Yw,zLe,NJ=$(()=>{"use strict";Yw=class{emit(e){}enabled(){return!1}},zLe=new Yw});function VLe(t,e,r){return n=>n===t?e:r}var Kw,dy,kJ,HLe=$(()=>{"use strict";Kw=Symbol.for("io.opentelemetry.js.api.logs"),dy=globalThis;kJ=1});var $J,eD,LJ=$(()=>{"use strict";NJ();$J=class{getLogger(e,r,n){return new Yw}},eD=new $J});var tD,GLe=$(()=>{"use strict";NJ();tD=class{constructor(e,r,n,i){this._provider=e,this.name=r,this.version=n,this.options=i}emit(e){this._getLogger().emit(e)}enabled(e){return this._getLogger().enabled(e)}_getLogger(){if(this._delegate)return this._delegate;let e=this._provider._getDelegateLogger(this.name,this.version,this.options);return e?(this._delegate=e,this._delegate):zLe}}});var Jw,WLe=$(()=>{"use strict";LJ();GLe();Jw=class{getLogger(e,r,n){var i;return(i=this._getDelegateLogger(e,r,n))!==null&&i!==void 0?i:new tD(this,e,r,n)}_getDelegate(){var e;return(e=this._delegate)!==null&&e!==void 0?e:eD}_setDelegate(e){this._delegate=e}_getDelegateLogger(e,r,n){var i;return(i=this._delegate)===null||i===void 0?void 0:i.getLogger(e,r,n)}}});var rD,YLe=$(()=>{"use strict";HLe();LJ();WLe();rD=class t{constructor(){this._proxyLoggerProvider=new Jw}static getInstance(){return this._instance||(this._instance=new t),this._instance}setGlobalLoggerProvider(e){return dy[Kw]?this.getLoggerProvider():(dy[Kw]=VLe(kJ,e,eD),this._proxyLoggerProvider._setDelegate(e),e)}getLoggerProvider(){var e,r;return(r=(e=dy[Kw])===null||e===void 0?void 0:e.call(dy,kJ))!==null&&r!==void 0?r:this._proxyLoggerProvider}getLogger(e,r,n){return this.getLoggerProvider().getLogger(e,r,n)}disable(){delete dy[Kw],this._proxyLoggerProvider=new Jw}}});var bRr,KLe=$(()=>{"use strict";BLe();YLe();bRr=rD.getInstance()});function Ri(t,e){let r=e[0],n=e[1],i=1e9,s=r&65535,o=r/65536>>>0,a=s*i,c=o*i,l=a>>>0,u=Math.floor(a/4294967296),d=(c&65535)*65536>>>0,f=c/65536>>>0,p=l+d+n,h=p>>>0,m=Math.floor(p/4294967296),_=u+f+m>>>0;t.writeFixed64(h,_)}function wo(t,e,r){for(let n in e){if(!Object.prototype.hasOwnProperty.call(e,n))continue;let i=e[n];t.writeTag(r,2);let s=t.startLengthDelimited(),o=t.pos;eLt(t,n,i),t.finishLengthDelimited(s,t.pos-o)}}function eLt(t,e,r){t.writeTag(1,2),t.writeString(e),t.writeTag(2,2);let n=t.startLengthDelimited(),i=t.pos;Zw(t,r),t.finishLengthDelimited(n,t.pos-i)}function Zw(t,e){let r=typeof e;if(r==="string")t.writeTag(1,2),t.writeString(e);else if(r==="boolean")t.writeTag(2,0),t.writeVarint(e?1:0);else if(r==="number"){let n=e;Number.isInteger(n)&&n>=tLt&&n<rLt?(t.writeTag(3,0),t.writeVarint(n)):(t.writeTag(4,1),t.writeDouble(n))}else if(e instanceof Uint8Array)t.writeTag(7,2),t.writeBytes(e);else if(Array.isArray(e)){t.writeTag(5,2);let n=t.startLengthDelimited(),i=t.pos;for(let s of e){t.writeTag(1,2);let o=t.startLengthDelimited(),a=t.pos;Zw(t,s),t.finishLengthDelimited(o,t.pos-a)}t.finishLengthDelimited(n,t.pos-i)}else if(r==="object"&&e!=null){t.writeTag(6,2);let n=t.startLengthDelimited(),i=t.pos,s=e;for(let o in s){if(!Object.prototype.hasOwnProperty.call(s,o))continue;let a=s[o];t.writeTag(1,2);let c=t.startLengthDelimited(),l=t.pos;t.writeTag(1,2),t.writeString(o),t.writeTag(2,2);let u=t.startLengthDelimited(),d=t.pos;Zw(t,a),t.finishLengthDelimited(u,t.pos-d),t.finishLengthDelimited(c,t.pos-l)}t.finishLengthDelimited(n,t.pos-i)}}function fy(t,e,r){t.writeTag(r,2);let n=t.startLengthDelimited(),i=t.pos;t.writeTag(1,2),t.writeString(e.name),e.version&&(t.writeTag(2,2),t.writeString(e.version)),t.finishLengthDelimited(n,t.pos-i)}function py(t,e,r){t.writeTag(r,2);let n=t.startLengthDelimited(),i=t.pos;e.attributes&&wo(t,e.attributes,1),t.writeTag(2,0),t.writeVarint(0),t.finishLengthDelimited(n,t.pos-i)}var tLt,rLt,nD=$(()=>{"use strict";tLt=-(2**63),rLt=2**63});function nLt(t){let e=t.length,r=0;for(let n=0;n<e;n++){let i=t.charCodeAt(n);i<128?r+=1:i<2048?r+=2:i<55296||i>=57344?r+=3:(n++,r+=4)}return r}var id,iD=$(()=>{"use strict";PJ();id=class{pos=0;startLengthDelimited(){return this.pos}finishLengthDelimited(e,r){this.pos+=Qc(r)}writeVarint(e){this.pos+=Qc(e)}writeSint32(e){this.pos+=Qc((e<<1^e>>31)>>>0)}writeSfixed64(e){this.pos+=8}writeFixed32(e){this.pos+=4}writeFixed64(e,r){this.pos+=8}writeBytes(e){this.pos+=Qc(e.length),this.pos+=e.length}writeTag(e,r){this.writeVarint(e<<3|r)}writeDouble(e){this.pos+=8}writeString(e){let r=nLt(e);this.pos+=Qc(r),this.pos+=r}}});function iLt(t,e){let r=t.startLengthDelimited(),n=t.pos;if(t.writeTag(1,1),Ri(t,e.hrTime),e.severityNumber!==void 0&&e.severityNumber!==Ww.UNSPECIFIED&&(t.writeTag(2,0),t.writeVarint(e.severityNumber)),e.severityText&&(t.writeTag(3,2),t.writeString(e.severityText)),e.body!==void 0){t.writeTag(5,2);let i=t.startLengthDelimited(),s=t.pos;Zw(t,e.body),t.finishLengthDelimited(i,t.pos-s)}e.attributes&&wo(t,e.attributes,6),t.writeTag(7,0),t.writeVarint(e.droppedAttributesCount),e.spanContext?.traceFlags&&(t.writeTag(8,5),t.writeFixed32(e.spanContext.traceFlags)),e.spanContext?.traceId&&(t.writeTag(9,2),t.writeBytes(el(e.spanContext.traceId))),e.spanContext?.spanId&&(t.writeTag(10,2),t.writeBytes(el(e.spanContext.spanId))),t.writeTag(11,1),Ri(t,e.hrTimeObserved),e.eventName&&(t.writeTag(12,2),t.writeString(e.eventName)),t.finishLengthDelimited(r,t.pos-n)}function sLt(t,e,r){let n=t.startLengthDelimited(),i=t.pos;fy(t,e,1);for(let s of r)t.writeTag(2,2),iLt(t,s);e.schemaUrl&&(t.writeTag(3,2),t.writeString(e.schemaUrl)),t.finishLengthDelimited(n,t.pos-i)}function JLe(t,e,r){let n=t.startLengthDelimited(),i=t.pos;py(t,e,1);for(let s of r.values()){t.writeTag(2,2);let o=s[0].instrumentationScope;sLt(t,o,s)}e.schemaUrl&&(t.writeTag(3,2),t.writeString(e.schemaUrl)),t.finishLengthDelimited(n,t.pos-i)}function oLt(t){let e=new Map;for(let r of t){let n=r.resource,i=r.instrumentationScope,s=e.get(n);s||(s=new Map,e.set(n,s));let o=s.get(i);o||(o=[],s.set(i,o)),o.push(r)}return e}function ZLe(t){let e=oLt(t),r=new id;for(let[i,s]of e)r.writeTag(1,2),JLe(r,i,s);let n=new nd(r.pos);for(let[i,s]of e)n.writeTag(1,2),JLe(n,i,s);return n.finish()}var XLe=$(()=>{"use strict";QL();CJ();KLe();nD();iD()});var Ao,sD=$(()=>{"use strict";Ao=class{pos=0;_buf;_textDecoder;constructor(e){this._buf=e,this._textDecoder=new TextDecoder}isAtEnd(){return this.pos>=this._buf.length}readTag(){let e=this.readVarint();return{fieldNumber:e>>>3,wireType:e&7}}readVarint(){let e=0,r=0,n=!1;for(;this.pos<this._buf.length;){let i=this._buf[this.pos++];if(e+=(i&127)*Math.pow(2,r),r+=7,(i&128)===0){n=!0;break}}if(!n)throw new Error("Truncated buffer: unexpected end of data while reading varint");return e}readBytes(){let e=this.readVarint();if(this.pos+e>this._buf.length)throw new Error(`Truncated buffer: expected ${e} bytes at position ${this.pos}, but only ${this._buf.length-this.pos} available`);let r=this._buf.subarray(this.pos,this.pos+e);return this.pos+=e,r}readString(){return this._textDecoder.decode(this.readBytes())}skip(e){switch(e){case 0:this.readVarint();break;case 1:this.pos+=8;break;case 2:this.readBytes();break;case 3:for(;!this.isAtEnd();){let{wireType:r}=this.readTag();if(r===4)break;this.skip(r)}break;case 4:break;case 5:this.pos+=4;break;default:throw new Error(`Unknown wire type ${e}, cannot safely skip`)}}}});function aLt(t){let e=new Ao(t),r={};for(;!e.isAtEnd();){let{fieldNumber:n,wireType:i}=e.readTag();switch(n){case 1:i===0?r.rejectedLogRecords=e.readVarint():e.skip(i);break;case 2:i===2?r.errorMessage=e.readString():e.skip(i);break;default:e.skip(i);break}}return r}function QLe(t){let e=new Ao(t),r={};for(;!e.isAtEnd();){let{fieldNumber:n,wireType:i}=e.readTag();n===1&&i===2?r.partialSuccess=aLt(e.readBytes()):e.skip(i)}return r}var eDe=$(()=>{"use strict";sD()});var DJ,tDe=$(()=>{"use strict";XLe();eDe();DJ={serializeRequest:t=>ZLe(t),deserializeResponse:t=>QLe(t)}});var rDe=$(()=>{"use strict";tDe()});var tl,nDe=$(()=>{"use strict";(function(t){t[t.DELTA=0]="DELTA",t[t.CUMULATIVE=1]="CUMULATIVE"})(tl||(tl={}))});var MJ,Yi,iDe=$(()=>{"use strict";(function(t){t.COUNTER="COUNTER",t.GAUGE="GAUGE",t.HISTOGRAM="HISTOGRAM",t.UP_DOWN_COUNTER="UP_DOWN_COUNTER",t.OBSERVABLE_COUNTER="OBSERVABLE_COUNTER",t.OBSERVABLE_GAUGE="OBSERVABLE_GAUGE",t.OBSERVABLE_UP_DOWN_COUNTER="OBSERVABLE_UP_DOWN_COUNTER"})(MJ||(MJ={}));(function(t){t[t.HISTOGRAM=0]="HISTOGRAM",t[t.EXPONENTIAL_HISTOGRAM=1]="EXPONENTIAL_HISTOGRAM",t[t.GAUGE=2]="GAUGE",t[t.SUM=3]="SUM"})(Yi||(Yi={}))});var UJ=$(()=>{"use strict";nDe();iDe()});function aDe(t,e,r){let n=t.startLengthDelimited(),i=t.pos;t.writeTag(2,1),Ri(t,e.startTime),t.writeTag(3,1),Ri(t,e.endTime),r===Nc.INT?(t.writeTag(6,1),t.writeSfixed64(e.value)):(t.writeTag(4,1),t.writeDouble(e.value)),e.attributes&&wo(t,e.attributes,7),t.finishLengthDelimited(n,t.pos-i)}function cLt(t,e){let r=t.startLengthDelimited(),n=t.pos,i=e.value;if(t.writeTag(2,1),Ri(t,e.startTime),t.writeTag(3,1),Ri(t,e.endTime),t.writeTag(4,1),t.writeFixed64(i.count>>>0,i.count/4294967296>>>0),i.sum!==void 0&&(t.writeTag(5,1),t.writeDouble(i.sum)),i.buckets.counts.length>0){t.writeTag(6,2);let s=t.startLengthDelimited(),o=t.pos;for(let a of i.buckets.counts)t.writeFixed64(a>>>0,a/4294967296>>>0);t.finishLengthDelimited(s,t.pos-o)}if(i.buckets.boundaries.length>0){t.writeTag(7,2);let s=t.startLengthDelimited(),o=t.pos;for(let a of i.buckets.boundaries)t.writeDouble(a);t.finishLengthDelimited(s,t.pos-o)}e.attributes&&wo(t,e.attributes,9),i.min!==void 0&&(t.writeTag(11,1),t.writeDouble(i.min)),i.max!==void 0&&(t.writeTag(12,1),t.writeDouble(i.max)),t.finishLengthDelimited(r,t.pos-n)}function sDe(t,e,r){let n=t.startLengthDelimited(),i=t.pos;if(e!==0&&(t.writeTag(1,0),t.writeSint32(e)),r.length>0){t.writeTag(2,2);let s=t.startLengthDelimited(),o=t.pos;for(let a of r)t.writeVarint(a);t.finishLengthDelimited(s,t.pos-o)}t.finishLengthDelimited(n,t.pos-i)}function lLt(t,e){let r=t.startLengthDelimited(),n=t.pos,i=e.value;e.attributes&&wo(t,e.attributes,1),t.writeTag(2,1),Ri(t,e.startTime),t.writeTag(3,1),Ri(t,e.endTime),t.writeTag(4,1),t.writeFixed64(i.count>>>0,i.count/4294967296>>>0),i.sum!==void 0&&(t.writeTag(5,1),t.writeDouble(i.sum)),i.scale!==0&&(t.writeTag(6,0),t.writeSint32(i.scale)),t.writeTag(7,1),t.writeFixed64(i.zeroCount>>>0,i.zeroCount/4294967296>>>0),t.writeTag(8,2),sDe(t,i.positive.offset,i.positive.bucketCounts),t.writeTag(9,2),sDe(t,i.negative.offset,i.negative.bucketCounts),i.min!==void 0&&(t.writeTag(12,1),t.writeDouble(i.min)),i.max!==void 0&&(t.writeTag(13,1),t.writeDouble(i.max)),t.finishLengthDelimited(r,t.pos-n)}function uLt(t,e){let r=t.startLengthDelimited(),n=t.pos;switch(t.writeTag(1,2),t.writeString(e.descriptor.name),e.descriptor.description&&(t.writeTag(2,2),t.writeString(e.descriptor.description)),e.descriptor.unit&&(t.writeTag(3,2),t.writeString(e.descriptor.unit)),e.dataPointType){case Yi.GAUGE:t.writeTag(5,2),dLt(t,e);break;case Yi.SUM:t.writeTag(7,2),fLt(t,e);break;case Yi.HISTOGRAM:t.writeTag(9,2),pLt(t,e);break;case Yi.EXPONENTIAL_HISTOGRAM:t.writeTag(10,2),hLt(t,e);break;default:{let i=e}}t.finishLengthDelimited(r,t.pos-n)}function dLt(t,e){let r=t.startLengthDelimited(),n=t.pos;for(let i of e.dataPoints)t.writeTag(1,2),aDe(t,i,e.descriptor.valueType);t.finishLengthDelimited(r,t.pos-n)}function fLt(t,e){let r=t.startLengthDelimited(),n=t.pos;for(let s of e.dataPoints)t.writeTag(1,2),aDe(t,s,e.descriptor.valueType);let i=FJ(e.aggregationTemporality);i!==0&&(t.writeTag(2,0),t.writeVarint(i)),e.isMonotonic&&(t.writeTag(3,0),t.writeVarint(1)),t.finishLengthDelimited(r,t.pos-n)}function pLt(t,e){let r=t.startLengthDelimited(),n=t.pos;for(let s of e.dataPoints)t.writeTag(1,2),cLt(t,s);let i=FJ(e.aggregationTemporality);i!==0&&(t.writeTag(2,0),t.writeVarint(i)),t.finishLengthDelimited(r,t.pos-n)}function hLt(t,e){let r=t.startLengthDelimited(),n=t.pos;for(let s of e.dataPoints)t.writeTag(1,2),lLt(t,s);let i=FJ(e.aggregationTemporality);i!==0&&(t.writeTag(2,0),t.writeVarint(i)),t.finishLengthDelimited(r,t.pos-n)}function mLt(t,e){let r=t.startLengthDelimited(),n=t.pos;fy(t,e.scope,1);for(let i of e.metrics)t.writeTag(2,2),uLt(t,i);e.scope.schemaUrl&&(t.writeTag(3,2),t.writeString(e.scope.schemaUrl)),t.finishLengthDelimited(r,t.pos-n)}function oDe(t,e){let r=t.startLengthDelimited(),n=t.pos;py(t,e.resource,1);for(let i of e.scopeMetrics)t.writeTag(2,2),mLt(t,i);e.resource.schemaUrl&&(t.writeTag(3,2),t.writeString(e.resource.schemaUrl)),t.finishLengthDelimited(r,t.pos-n)}function FJ(t){switch(t){case tl.DELTA:return 1;case tl.CUMULATIVE:return 2;default:return 0}}function cDe(t){let e=new id;e.writeTag(1,2),oDe(e,t);let r=new nd(e.pos);return r.writeTag(1,2),oDe(r,t),r.finish()}var lDe=$(()=>{"use strict";Ne();UJ();nD();iD();QL()});function gLt(t){let e=new Ao(t),r={};for(;!e.isAtEnd();){let{fieldNumber:n,wireType:i}=e.readTag();switch(n){case 1:i===0?r.rejectedDataPoints=e.readVarint():e.skip(i);break;case 2:i===2?r.errorMessage=e.readString():e.skip(i);break;default:e.skip(i);break}}return r}function uDe(t){let e=new Ao(t),r={};for(;!e.isAtEnd();){let{fieldNumber:n,wireType:i}=e.readTag();n===1&&i===2?r.partialSuccess=gLt(e.readBytes()):e.skip(i)}return r}var dDe=$(()=>{"use strict";sD()});var jJ,fDe=$(()=>{"use strict";lDe();dDe();jJ={serializeRequest:t=>cDe(t),deserializeResponse:t=>uDe(t)}});var pDe=$(()=>{"use strict";fDe()});function mDe(t,e){let r=t&255|_Lt;return e&&(r|=yLt),r}function SLt(t,e){let r=t.startLengthDelimited(),n=t.pos;e.message&&(t.writeTag(2,2),t.writeString(e.message)),t.writeTag(3,0),t.writeVarint(e.code),t.finishLengthDelimited(r,t.pos-n)}function ELt(t,e){let r=t.startLengthDelimited(),n=t.pos;t.writeTag(1,1),Ri(t,e.time),t.writeTag(2,2),t.writeString(e.name),e.attributes&&wo(t,e.attributes,3),t.writeTag(4,0),t.writeVarint(e.droppedAttributesCount||0),t.finishLengthDelimited(r,t.pos-n)}function vLt(t,e){let r=t.startLengthDelimited(),n=t.pos,i=e.context;t.writeTag(1,2),t.writeBytes(el(i.traceId)),t.writeTag(2,2),t.writeBytes(el(i.spanId));let s=i.traceState?.serialize();s&&(t.writeTag(3,2),t.writeString(s)),e.attributes&&wo(t,e.attributes,4),t.writeTag(5,0),t.writeVarint(e.droppedAttributesCount||0);let o=mDe(i.traceFlags,i.isRemote);o&&(t.writeTag(6,5),t.writeFixed32(o)),t.finishLengthDelimited(r,t.pos-n)}function bLt(t,e){let r=t.startLengthDelimited(),n=t.pos,i=e.spanContext();t.writeTag(1,2),t.writeBytes(el(i.traceId)),t.writeTag(2,2),t.writeBytes(el(i.spanId));let s=i.traceState?.serialize();s&&(t.writeTag(3,2),t.writeString(s)),e.parentSpanContext?.spanId&&(t.writeTag(4,2),t.writeBytes(el(e.parentSpanContext.spanId))),t.writeTag(5,2),t.writeString(e.name);let o=e.kind==null?0:e.kind+1;o!==0&&(t.writeTag(6,0),t.writeVarint(o)),t.writeTag(7,1),Ri(t,e.startTime),t.writeTag(8,1),Ri(t,e.endTime),e.attributes&&wo(t,e.attributes,9),t.writeTag(10,0),t.writeVarint(e.droppedAttributesCount);for(let c of e.events)t.writeTag(11,2),ELt(t,c);t.writeTag(12,0),t.writeVarint(e.droppedEventsCount);for(let c of e.links)t.writeTag(13,2),vLt(t,c);t.writeTag(14,0),t.writeVarint(e.droppedLinksCount),t.writeTag(15,2),SLt(t,e.status);let a=mDe(i.traceFlags,e.parentSpanContext?.isRemote);a&&(t.writeTag(16,5),t.writeFixed32(a)),t.finishLengthDelimited(r,t.pos-n)}function TLt(t,e,r){let n=t.startLengthDelimited(),i=t.pos;fy(t,e,1);for(let s of r)t.writeTag(2,2),bLt(t,s);e.schemaUrl&&(t.writeTag(3,2),t.writeString(e.schemaUrl)),t.finishLengthDelimited(n,t.pos-i)}function hDe(t,e,r){let n=t.startLengthDelimited(),i=t.pos;py(t,e,1);for(let s of r.values()){t.writeTag(2,2);let o=s[0].instrumentationScope;TLt(t,o,s)}e.schemaUrl&&(t.writeTag(3,2),t.writeString(e.schemaUrl)),t.finishLengthDelimited(n,t.pos-i)}function wLt(t){let e=new Map;for(let r of t){let n=r.resource,i=r.instrumentationScope,s=e.get(n);s||(s=new Map,e.set(n,s));let o=s.get(i);o||(o=[],s.set(i,o)),o.push(r)}return e}function gDe(t){let e=wLt(t),r=new id;for(let[i,s]of e)r.writeTag(1,2),hDe(r,i,s);let n=new nd(r.pos);for(let[i,s]of e)n.writeTag(1,2),hDe(n,i,s);return n.finish()}var _Lt,yLt,_De=$(()=>{"use strict";QL();CJ();nD();iD();_Lt=256,yLt=512});function ALt(t){let e=new Ao(t),r={};for(;!e.isAtEnd();){let{fieldNumber:n,wireType:i}=e.readTag();switch(n){case 1:i===0?r.rejectedSpans=e.readVarint():e.skip(i);break;case 2:i===2?r.errorMessage=e.readString():e.skip(i);break;default:e.skip(i);break}}return r}function yDe(t){let e=new Ao(t),r={};for(;!e.isAtEnd();){let{fieldNumber:n,wireType:i}=e.readTag();n===1&&i===2?r.partialSuccess=ALt(e.readBytes()):e.skip(i)}return r}var SDe=$(()=>{"use strict";sD()});var qJ,EDe=$(()=>{"use strict";_De();SDe();qJ={serializeRequest:t=>gDe(t),deserializeResponse:t=>yDe(t)}});var vDe=$(()=>{"use strict";EDe()});function hy(t,e){let r={attributes:rl(t.attributes,e),droppedAttributesCount:0},n=t.schemaUrl;return n&&n!==""&&(r.schemaUrl=n),r}function my(t){return{name:t.name,version:t.version}}function rl(t,e){return Object.keys(t).map(r=>BJ(r,t[r],e))}function BJ(t,e,r){return{key:t,value:Xw(e,r)}}function Xw(t,e){let r=typeof t;if(r==="string")return{stringValue:t};if(r==="number")return Number.isInteger(t)?{intValue:t}:{doubleValue:t};if(r==="boolean")return{boolValue:t};if(t instanceof Uint8Array)return{bytesValue:e.encodeUint8Array(t)};if(Array.isArray(t)){let n=new Array(t.length);for(let i=0;i<t.length;i++)n[i]=Xw(t[i],e);return{arrayValue:{values:n}}}if(r==="object"&&t!=null){let n=Object.keys(t),i=new Array(n.length);for(let s=0;s<n.length;s++)i[s]={key:n[s],value:Xw(t[n[s]],e)};return{kvlistValue:{values:i}}}return{}}var oD=$(()=>{"use strict"});function bDe(t,e){return{resourceLogs:xLt(t,e)}}function RLt(t){let e=new Map;for(let r of t){let{resource:n,instrumentationScope:{name:i,version:s="",schemaUrl:o=""}}=r,a=e.get(n);a||(a=new Map,e.set(n,a));let c=`${i}@${s}:${o}`,l=a.get(c);l||(l=[],a.set(c,l)),l.push(r)}return e}function xLt(t,e){let r=RLt(t);return Array.from(r,([n,i])=>{let s=hy(n,e);return{resource:s,scopeLogs:Array.from(i,([,o])=>({scope:my(o[0].instrumentationScope),logRecords:o.map(a=>ILt(a,e)),schemaUrl:o[0].instrumentationScope.schemaUrl})),schemaUrl:s.schemaUrl}})}function ILt(t,e){return{timeUnixNano:e.encodeHrTime(t.hrTime),observedTimeUnixNano:e.encodeHrTime(t.hrTimeObserved),severityNumber:t.severityNumber,severityText:t.severityText,body:Xw(t.body,e),eventName:t.eventName,attributes:OLt(t.attributes,e),droppedAttributesCount:t.droppedAttributesCount,flags:t.spanContext?.traceFlags,traceId:e.encodeOptionalSpanContext(t.spanContext?.traceId),spanId:e.encodeOptionalSpanContext(t.spanContext?.spanId)}}function OLt(t,e){return Object.keys(t).map(r=>BJ(r,t[r],e))}var TDe=$(()=>{"use strict";oD()});function PLt(t){let e=BigInt(1e9);return BigInt(Math.trunc(t[0]))*e+BigInt(Math.trunc(t[1]))}function CLt(t){return PLt(t).toString()}function wDe(t){return t}var NLt,gy,aD=$(()=>{"use strict";T_();NLt=typeof BigInt<"u"?CLt:Ok;gy={encodeHrTime:NLt,encodeSpanContext:wDe,encodeOptionalSpanContext:wDe,encodeUint8Array:t=>{if(typeof Buffer<"u")return Buffer.from(t).toString("base64");let e=new Array(t.length);for(let r=0;r<t.length;r++)e[r]=String.fromCharCode(t[r]);return btoa(e.join(""))}}});var zJ,ADe=$(()=>{"use strict";TDe();aD();Ne();zJ={serializeRequest:t=>{let e=bDe(t,gy);return new TextEncoder().encode(JSON.stringify(e))},deserializeResponse:t=>{if(t.length===0)return{};let e=new TextDecoder;try{return JSON.parse(e.decode(t))}catch(r){return ce.warn(`Failed to parse logs export response: ${r.message}. Returning empty response`),{}}}}});var RDe=$(()=>{"use strict";ADe()});var Qw,xDe=$(()=>{"use strict";(function(t){t[t.AGGREGATION_TEMPORALITY_UNSPECIFIED=0]="AGGREGATION_TEMPORALITY_UNSPECIFIED",t[t.AGGREGATION_TEMPORALITY_DELTA=1]="AGGREGATION_TEMPORALITY_DELTA",t[t.AGGREGATION_TEMPORALITY_CUMULATIVE=2]="AGGREGATION_TEMPORALITY_CUMULATIVE"})(Qw||(Qw={}))});function kLt(t,e){let r=hy(t.resource,e);return{resource:r,schemaUrl:r.schemaUrl,scopeMetrics:$Lt(t.scopeMetrics,e)}}function $Lt(t,e){return Array.from(t.map(r=>({scope:my(r.scope),metrics:r.metrics.map(n=>LLt(n,e)),schemaUrl:r.scope.schemaUrl})))}function LLt(t,e){let r={name:t.descriptor.name,description:t.descriptor.description,unit:t.descriptor.unit},n=FLt(t.aggregationTemporality);switch(t.dataPointType){case Yi.SUM:r.sum={aggregationTemporality:n,isMonotonic:t.isMonotonic,dataPoints:IDe(t,e)};break;case Yi.GAUGE:r.gauge={dataPoints:IDe(t,e)};break;case Yi.HISTOGRAM:r.histogram={aggregationTemporality:n,dataPoints:MLt(t,e)};break;case Yi.EXPONENTIAL_HISTOGRAM:r.exponentialHistogram={aggregationTemporality:n,dataPoints:ULt(t,e)};break}return r}function DLt(t,e,r){let n={attributes:rl(t.attributes,r),startTimeUnixNano:r.encodeHrTime(t.startTime),timeUnixNano:r.encodeHrTime(t.endTime)};switch(e){case Nc.INT:n.asInt=t.value;break;case Nc.DOUBLE:n.asDouble=t.value;break}return n}function IDe(t,e){return t.dataPoints.map(r=>DLt(r,t.descriptor.valueType,e))}function MLt(t,e){return t.dataPoints.map(r=>{let n=r.value;return{attributes:rl(r.attributes,e),bucketCounts:n.buckets.counts,explicitBounds:n.buckets.boundaries,count:n.count,sum:n.sum,min:n.min,max:n.max,startTimeUnixNano:e.encodeHrTime(r.startTime),timeUnixNano:e.encodeHrTime(r.endTime)}})}function ULt(t,e){return t.dataPoints.map(r=>{let n=r.value;return{attributes:rl(r.attributes,e),count:n.count,min:n.min,max:n.max,sum:n.sum,positive:{offset:n.positive.offset,bucketCounts:n.positive.bucketCounts},negative:{offset:n.negative.offset,bucketCounts:n.negative.bucketCounts},scale:n.scale,zeroCount:n.zeroCount,startTimeUnixNano:e.encodeHrTime(r.startTime),timeUnixNano:e.encodeHrTime(r.endTime)}})}function FLt(t){switch(t){case tl.DELTA:return Qw.AGGREGATION_TEMPORALITY_DELTA;case tl.CUMULATIVE:return Qw.AGGREGATION_TEMPORALITY_CUMULATIVE}}function ODe(t,e){return{resourceMetrics:t.map(r=>kLt(r,e))}}var PDe=$(()=>{"use strict";Ne();UJ();xDe();oD()});var VJ,CDe=$(()=>{"use strict";PDe();aD();Ne();VJ={serializeRequest:t=>{let e=ODe([t],gy);return new TextEncoder().encode(JSON.stringify(e))},deserializeResponse:t=>{if(t.length===0)return{};let e=new TextDecoder;try{return JSON.parse(e.decode(t))}catch(r){return ce.warn(`Failed to parse metrics export response: ${r.message}. Returning empty response`),{}}}}});var NDe=$(()=>{"use strict";CDe()});function kDe(t,e){let r=t&255|jLt;return e&&(r|=qLt),r}function BLt(t,e){let r=t.spanContext(),n=t.status,i=t.parentSpanContext?.spanId?e.encodeSpanContext(t.parentSpanContext?.spanId):void 0;return{traceId:e.encodeSpanContext(r.traceId),spanId:e.encodeSpanContext(r.spanId),parentSpanId:i,traceState:r.traceState?.serialize(),name:t.name,kind:t.kind==null?0:t.kind+1,startTimeUnixNano:e.encodeHrTime(t.startTime),endTimeUnixNano:e.encodeHrTime(t.endTime),attributes:rl(t.attributes,e),droppedAttributesCount:t.droppedAttributesCount,events:t.events.map(s=>VLt(s,e)),droppedEventsCount:t.droppedEventsCount,status:{code:n.code,message:n.message},links:t.links.map(s=>zLt(s,e)),droppedLinksCount:t.droppedLinksCount,flags:kDe(r.traceFlags,t.parentSpanContext?.isRemote)}}function zLt(t,e){return{attributes:t.attributes?rl(t.attributes,e):[],spanId:e.encodeSpanContext(t.context.spanId),traceId:e.encodeSpanContext(t.context.traceId),traceState:t.context.traceState?.serialize(),droppedAttributesCount:t.droppedAttributesCount||0,flags:kDe(t.context.traceFlags,t.context.isRemote)}}function VLt(t,e){return{attributes:t.attributes?rl(t.attributes,e):[],name:t.name,timeUnixNano:e.encodeHrTime(t.time),droppedAttributesCount:t.droppedAttributesCount||0}}function $De(t,e){return{resourceSpans:GLt(t,e)}}function HLt(t){let e=new Map;for(let r of t){let n=e.get(r.resource);n||(n=new Map,e.set(r.resource,n));let i=`${r.instrumentationScope.name}@${r.instrumentationScope.version||""}:${r.instrumentationScope.schemaUrl||""}`,s=n.get(i);s||(s=[],n.set(i,s)),s.push(r)}return e}function GLt(t,e){let r=HLt(t),n=[],i=r.entries(),s=i.next();for(;!s.done;){let[o,a]=s.value,c=[],l=a.values(),u=l.next();for(;!u.done;){let p=u.value;if(p.length>0){let h=p.map(m=>BLt(m,e));c.push({scope:my(p[0].instrumentationScope),spans:h,schemaUrl:p[0].instrumentationScope.schemaUrl})}u=l.next()}let d=hy(o,e),f={resource:d,scopeSpans:c,schemaUrl:d.schemaUrl};n.push(f),s=i.next()}return n}var jLt,qLt,LDe=$(()=>{"use strict";oD();jLt=256,qLt=512});var HJ,DDe=$(()=>{"use strict";LDe();aD();Ne();HJ={serializeRequest:t=>{let e=$De(t,gy);return new TextEncoder().encode(JSON.stringify(e))},deserializeResponse:t=>{if(t.length===0)return{};let e=new TextDecoder;try{return JSON.parse(e.decode(t))}catch(r){return ce.warn(`Failed to parse trace export response: ${r.message}. Returning empty response`),{}}}}});var MDe=$(()=>{"use strict";DDe()});var UDe={};tn(UDe,{JsonLogsSerializer:()=>zJ,JsonMetricsSerializer:()=>VJ,JsonTraceSerializer:()=>HJ,ProtobufLogsSerializer:()=>DJ,ProtobufMetricsSerializer:()=>jJ,ProtobufTraceSerializer:()=>qJ});var FDe=$(()=>{"use strict";rDe();pDe();vDe();RDe();NDe();MDe()});var qDe=E(cD=>{"use strict";Object.defineProperty(cD,"__esModule",{value:!0});cD.OTLPTraceExporter=void 0;var jDe=jLe(),WLt=(FDe(),qn(UDe)),YLt=(jk(),qn(Fk)),GJ=class extends YLt.OTLPExporterBase{constructor(e={}){super((0,jDe.createOtlpGrpcExportDelegate)((0,jDe.convertLegacyOtlpGrpcOptions)(e,"TRACES"),WLt.ProtobufTraceSerializer,"TraceExportService","/opentelemetry.proto.collector.trace.v1.TraceService/Export"))}};cD.OTLPTraceExporter=GJ});var BDe=E(lD=>{"use strict";Object.defineProperty(lD,"__esModule",{value:!0});lD.OTLPTraceExporter=void 0;var KLt=qDe();Object.defineProperty(lD,"OTLPTraceExporter",{enumerable:!0,get:function(){return KLt.OTLPTraceExporter}})});var MUe=E((IFr,DUe)=>{"use strict";var wd=W("constants"),aFt=process.cwd,lM=null,cFt=process.env.GRACEFUL_FS_PLATFORM||process.platform;process.cwd=function(){return lM||(lM=aFt.call(process)),lM};try{process.cwd()}catch{}typeof process.chdir=="function"&&(dX=process.chdir,process.chdir=function(t){lM=null,dX.call(process,t)},Object.setPrototypeOf&&Object.setPrototypeOf(process.chdir,dX));var dX;DUe.exports=lFt;function lFt(t){wd.hasOwnProperty("O_SYMLINK")&&process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)&&e(t),t.lutimes||r(t),t.chown=s(t.chown),t.fchown=s(t.fchown),t.lchown=s(t.lchown),t.chmod=n(t.chmod),t.fchmod=n(t.fchmod),t.lchmod=n(t.lchmod),t.chownSync=o(t.chownSync),t.fchownSync=o(t.fchownSync),t.lchownSync=o(t.lchownSync),t.chmodSync=i(t.chmodSync),t.fchmodSync=i(t.fchmodSync),t.lchmodSync=i(t.lchmodSync),t.stat=a(t.stat),t.fstat=a(t.fstat),t.lstat=a(t.lstat),t.statSync=c(t.statSync),t.fstatSync=c(t.fstatSync),t.lstatSync=c(t.lstatSync),t.chmod&&!t.lchmod&&(t.lchmod=function(u,d,f){f&&process.nextTick(f)},t.lchmodSync=function(){}),t.chown&&!t.lchown&&(t.lchown=function(u,d,f,p){p&&process.nextTick(p)},t.lchownSync=function(){}),cFt==="win32"&&(t.rename=typeof t.rename!="function"?t.rename:(function(u){function d(f,p,h){var m=Date.now(),_=0;u(f,p,function y(v){if(v&&(v.code==="EACCES"||v.code==="EPERM"||v.code==="EBUSY")&&Date.now()-m<6e4){setTimeout(function(){t.stat(p,function(S,g){S&&S.code==="ENOENT"?u(f,p,y):h(v)})},_),_<100&&(_+=10);return}h&&h(v)})}return Object.setPrototypeOf&&Object.setPrototypeOf(d,u),d})(t.rename)),t.read=typeof t.read!="function"?t.read:(function(u){function d(f,p,h,m,_,y){var v;if(y&&typeof y=="function"){var S=0;v=function(g,T,I){if(g&&g.code==="EAGAIN"&&S<10)return S++,u.call(t,f,p,h,m,_,v);y.apply(this,arguments)}}return u.call(t,f,p,h,m,_,v)}return Object.setPrototypeOf&&Object.setPrototypeOf(d,u),d})(t.read),t.readSync=typeof t.readSync!="function"?t.readSync:(function(u){return function(d,f,p,h,m){for(var _=0;;)try{return u.call(t,d,f,p,h,m)}catch(y){if(y.code==="EAGAIN"&&_<10){_++;continue}throw y}}})(t.readSync);function e(u){u.lchmod=function(d,f,p){u.open(d,wd.O_WRONLY|wd.O_SYMLINK,f,function(h,m){if(h){p&&p(h);return}u.fchmod(m,f,function(_){u.close(m,function(y){p&&p(_||y)})})})},u.lchmodSync=function(d,f){var p=u.openSync(d,wd.O_WRONLY|wd.O_SYMLINK,f),h=!0,m;try{m=u.fchmodSync(p,f),h=!1}finally{if(h)try{u.closeSync(p)}catch{}else u.closeSync(p)}return m}}function r(u){wd.hasOwnProperty("O_SYMLINK")&&u.futimes?(u.lutimes=function(d,f,p,h){u.open(d,wd.O_SYMLINK,function(m,_){if(m){h&&h(m);return}u.futimes(_,f,p,function(y){u.close(_,function(v){h&&h(y||v)})})})},u.lutimesSync=function(d,f,p){var h=u.openSync(d,wd.O_SYMLINK),m,_=!0;try{m=u.futimesSync(h,f,p),_=!1}finally{if(_)try{u.closeSync(h)}catch{}else u.closeSync(h)}return m}):u.futimes&&(u.lutimes=function(d,f,p,h){h&&process.nextTick(h)},u.lutimesSync=function(){})}function n(u){return u&&function(d,f,p){return u.call(t,d,f,function(h){l(h)&&(h=null),p&&p.apply(this,arguments)})}}function i(u){return u&&function(d,f){try{return u.call(t,d,f)}catch(p){if(!l(p))throw p}}}function s(u){return u&&function(d,f,p,h){return u.call(t,d,f,p,function(m){l(m)&&(m=null),h&&h.apply(this,arguments)})}}function o(u){return u&&function(d,f,p){try{return u.call(t,d,f,p)}catch(h){if(!l(h))throw h}}}function a(u){return u&&function(d,f,p){typeof f=="function"&&(p=f,f=null);function h(m,_){_&&(_.uid<0&&(_.uid+=4294967296),_.gid<0&&(_.gid+=4294967296)),p&&p.apply(this,arguments)}return f?u.call(t,d,f,h):u.call(t,d,h)}}function c(u){return u&&function(d,f){var p=f?u.call(t,d,f):u.call(t,d);return p&&(p.uid<0&&(p.uid+=4294967296),p.gid<0&&(p.gid+=4294967296)),p}}function l(u){if(!u||u.code==="ENOSYS")return!0;var d=!process.getuid||process.getuid()!==0;return!!(d&&(u.code==="EINVAL"||u.code==="EPERM"))}}});var jUe=E((OFr,FUe)=>{"use strict";var UUe=W("stream").Stream;FUe.exports=uFt;function uFt(t){return{ReadStream:e,WriteStream:r};function e(n,i){if(!(this instanceof e))return new e(n,i);UUe.call(this);var s=this;this.path=n,this.fd=null,this.readable=!0,this.paused=!1,this.flags="r",this.mode=438,this.bufferSize=64*1024,i=i||{};for(var o=Object.keys(i),a=0,c=o.length;a<c;a++){var l=o[a];this[l]=i[l]}if(this.encoding&&this.setEncoding(this.encoding),this.start!==void 0){if(typeof this.start!="number")throw TypeError("start must be a Number");if(this.end===void 0)this.end=1/0;else if(typeof this.end!="number")throw TypeError("end must be a Number");if(this.start>this.end)throw new Error("start must be <= end");this.pos=this.start}if(this.fd!==null){process.nextTick(function(){s._read()});return}t.open(this.path,this.flags,this.mode,function(u,d){if(u){s.emit("error",u),s.readable=!1;return}s.fd=d,s.emit("open",d),s._read()})}function r(n,i){if(!(this instanceof r))return new r(n,i);UUe.call(this),this.path=n,this.fd=null,this.writable=!0,this.flags="w",this.encoding="binary",this.mode=438,this.bytesWritten=0,i=i||{};for(var s=Object.keys(i),o=0,a=s.length;o<a;o++){var c=s[o];this[c]=i[c]}if(this.start!==void 0){if(typeof this.start!="number")throw TypeError("start must be a Number");if(this.start<0)throw new Error("start must be >= zero");this.pos=this.start}this.busy=!1,this._queue=[],this.fd===null&&(this._open=t.open,this._queue.push([this._open,this.path,this.flags,this.mode,void 0]),this.flush())}}});var BUe=E((PFr,qUe)=>{"use strict";qUe.exports=fFt;var dFt=Object.getPrototypeOf||function(t){return t.__proto__};function fFt(t){if(t===null||typeof t!="object")return t;if(t instanceof Object)var e={__proto__:dFt(t)};else var e=Object.create(null);return Object.getOwnPropertyNames(t).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}),e}});var GUe=E((CFr,hX)=>{"use strict";var ar=W("fs"),pFt=MUe(),hFt=jUe(),mFt=BUe(),uM=W("util"),vn,fM;typeof Symbol=="function"&&typeof Symbol.for=="function"?(vn=Symbol.for("graceful-fs.queue"),fM=Symbol.for("graceful-fs.previous")):(vn="___graceful-fs.queue",fM="___graceful-fs.previous");function gFt(){}function HUe(t,e){Object.defineProperty(t,vn,{get:function(){return e}})}var lh=gFt;uM.debuglog?lh=uM.debuglog("gfs4"):/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&(lh=function(){var t=uM.format.apply(uM,arguments);t="GFS4: "+t.split(/\n/).join(`
393
- GFS4: `),console.error(t)});ar[vn]||(zUe=global[vn]||[],HUe(ar,zUe),ar.close=(function(t){function e(r,n){return t.call(ar,r,function(i){i||VUe(),typeof n=="function"&&n.apply(this,arguments)})}return Object.defineProperty(e,fM,{value:t}),e})(ar.close),ar.closeSync=(function(t){function e(r){t.apply(ar,arguments),VUe()}return Object.defineProperty(e,fM,{value:t}),e})(ar.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&process.on("exit",function(){lh(ar[vn]),W("assert").equal(ar[vn].length,0)}));var zUe;global[vn]||HUe(global,ar[vn]);hX.exports=fX(mFt(ar));process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!ar.__patched&&(hX.exports=fX(ar),ar.__patched=!0);function fX(t){pFt(t),t.gracefulify=fX,t.createReadStream=T,t.createWriteStream=I;var e=t.readFile;t.readFile=r;function r(O,A,b){return typeof A=="function"&&(b=A,A=null),L(O,A,b);function L(C,w,P,N){return e(C,w,function(j){j&&(j.code==="EMFILE"||j.code==="ENFILE")?_S([L,[C,w,P],j,N||Date.now(),Date.now()]):typeof P=="function"&&P.apply(this,arguments)})}}var n=t.writeFile;t.writeFile=i;function i(O,A,b,L){return typeof b=="function"&&(L=b,b=null),C(O,A,b,L);function C(w,P,N,j,V){return n(w,P,N,function(de){de&&(de.code==="EMFILE"||de.code==="ENFILE")?_S([C,[w,P,N,j],de,V||Date.now(),Date.now()]):typeof j=="function"&&j.apply(this,arguments)})}}var s=t.appendFile;s&&(t.appendFile=o);function o(O,A,b,L){return typeof b=="function"&&(L=b,b=null),C(O,A,b,L);function C(w,P,N,j,V){return s(w,P,N,function(de){de&&(de.code==="EMFILE"||de.code==="ENFILE")?_S([C,[w,P,N,j],de,V||Date.now(),Date.now()]):typeof j=="function"&&j.apply(this,arguments)})}}var a=t.copyFile;a&&(t.copyFile=c);function c(O,A,b,L){return typeof b=="function"&&(L=b,b=0),C(O,A,b,L);function C(w,P,N,j,V){return a(w,P,N,function(de){de&&(de.code==="EMFILE"||de.code==="ENFILE")?_S([C,[w,P,N,j],de,V||Date.now(),Date.now()]):typeof j=="function"&&j.apply(this,arguments)})}}var l=t.readdir;t.readdir=d;var u=/^v[0-5]\./;function d(O,A,b){typeof A=="function"&&(b=A,A=null);var L=u.test(process.version)?function(P,N,j,V){return l(P,C(P,N,j,V))}:function(P,N,j,V){return l(P,N,C(P,N,j,V))};return L(O,A,b);function C(w,P,N,j){return function(V,de){V&&(V.code==="EMFILE"||V.code==="ENFILE")?_S([L,[w,P,N],V,j||Date.now(),Date.now()]):(de&&de.sort&&de.sort(),typeof N=="function"&&N.call(this,V,de))}}}if(process.version.substr(0,4)==="v0.8"){var f=hFt(t);y=f.ReadStream,S=f.WriteStream}var p=t.ReadStream;p&&(y.prototype=Object.create(p.prototype),y.prototype.open=v);var h=t.WriteStream;h&&(S.prototype=Object.create(h.prototype),S.prototype.open=g),Object.defineProperty(t,"ReadStream",{get:function(){return y},set:function(O){y=O},enumerable:!0,configurable:!0}),Object.defineProperty(t,"WriteStream",{get:function(){return S},set:function(O){S=O},enumerable:!0,configurable:!0});var m=y;Object.defineProperty(t,"FileReadStream",{get:function(){return m},set:function(O){m=O},enumerable:!0,configurable:!0});var _=S;Object.defineProperty(t,"FileWriteStream",{get:function(){return _},set:function(O){_=O},enumerable:!0,configurable:!0});function y(O,A){return this instanceof y?(p.apply(this,arguments),this):y.apply(Object.create(y.prototype),arguments)}function v(){var O=this;R(O.path,O.flags,O.mode,function(A,b){A?(O.autoClose&&O.destroy(),O.emit("error",A)):(O.fd=b,O.emit("open",b),O.read())})}function S(O,A){return this instanceof S?(h.apply(this,arguments),this):S.apply(Object.create(S.prototype),arguments)}function g(){var O=this;R(O.path,O.flags,O.mode,function(A,b){A?(O.destroy(),O.emit("error",A)):(O.fd=b,O.emit("open",b))})}function T(O,A){return new t.ReadStream(O,A)}function I(O,A){return new t.WriteStream(O,A)}var x=t.open;t.open=R;function R(O,A,b,L){return typeof b=="function"&&(L=b,b=null),C(O,A,b,L);function C(w,P,N,j,V){return x(w,P,N,function(de,Te){de&&(de.code==="EMFILE"||de.code==="ENFILE")?_S([C,[w,P,N,j],de,V||Date.now(),Date.now()]):typeof j=="function"&&j.apply(this,arguments)})}}return t}function _S(t){lh("ENQUEUE",t[0].name,t[1]),ar[vn].push(t),pX()}var dM;function VUe(){for(var t=Date.now(),e=0;e<ar[vn].length;++e)ar[vn][e].length>2&&(ar[vn][e][3]=t,ar[vn][e][4]=t);pX()}function pX(){if(clearTimeout(dM),dM=void 0,ar[vn].length!==0){var t=ar[vn].shift(),e=t[0],r=t[1],n=t[2],i=t[3],s=t[4];if(i===void 0)lh("RETRY",e.name,r),e.apply(null,r);else if(Date.now()-i>=6e4){lh("TIMEOUT",e.name,r);var o=r.pop();typeof o=="function"&&o.call(null,n)}else{var a=Date.now()-s,c=Math.max(s-i,1),l=Math.min(c*1.2,100);a>=l?(lh("RETRY",e.name,r),e.apply(null,r.concat([i]))):ar[vn].push(t)}dM===void 0&&(dM=setTimeout(pX,0))}}});var oFe=E(yS=>{"use strict";Object.defineProperty(yS,"__esModule",{value:!0});yS.splitWhen=yS.flatten=void 0;function DFt(t){return t.reduce((e,r)=>[].concat(e,r),[])}yS.flatten=DFt;function MFt(t,e){let r=[[]],n=0;for(let i of t)e(i)?(n++,r[n]=[]):r[n].push(i);return r}yS.splitWhen=MFt});var aFe=E(hM=>{"use strict";Object.defineProperty(hM,"__esModule",{value:!0});hM.isEnoentCodeError=void 0;function UFt(t){return t.code==="ENOENT"}hM.isEnoentCodeError=UFt});var cFe=E(mM=>{"use strict";Object.defineProperty(mM,"__esModule",{value:!0});mM.createDirentFromStats=void 0;var TX=class{constructor(e,r){this.name=e,this.isBlockDevice=r.isBlockDevice.bind(r),this.isCharacterDevice=r.isCharacterDevice.bind(r),this.isDirectory=r.isDirectory.bind(r),this.isFIFO=r.isFIFO.bind(r),this.isFile=r.isFile.bind(r),this.isSocket=r.isSocket.bind(r),this.isSymbolicLink=r.isSymbolicLink.bind(r)}};function FFt(t,e){return new TX(t,e)}mM.createDirentFromStats=FFt});var fFe=E(Pr=>{"use strict";Object.defineProperty(Pr,"__esModule",{value:!0});Pr.convertPosixPathToPattern=Pr.convertWindowsPathToPattern=Pr.convertPathToPattern=Pr.escapePosixPath=Pr.escapeWindowsPath=Pr.escape=Pr.removeLeadingDotSegment=Pr.makeAbsolute=Pr.unixify=void 0;var jFt=W("os"),qFt=W("path"),lFe=jFt.platform()==="win32",BFt=2,zFt=/(\\?)([()*?[\]{|}]|^!|[!+@](?=\()|\\(?![!()*+?@[\]{|}]))/g,VFt=/(\\?)([()[\]{}]|^!|[!+@](?=\())/g,HFt=/^\\\\([.?])/,GFt=/\\(?![!()+@[\]{}])/g;function WFt(t){return t.replace(/\\/g,"/")}Pr.unixify=WFt;function YFt(t,e){return qFt.resolve(t,e)}Pr.makeAbsolute=YFt;function KFt(t){if(t.charAt(0)==="."){let e=t.charAt(1);if(e==="/"||e==="\\")return t.slice(BFt)}return t}Pr.removeLeadingDotSegment=KFt;Pr.escape=lFe?wX:AX;function wX(t){return t.replace(VFt,"\\$2")}Pr.escapeWindowsPath=wX;function AX(t){return t.replace(zFt,"\\$2")}Pr.escapePosixPath=AX;Pr.convertPathToPattern=lFe?uFe:dFe;function uFe(t){return wX(t).replace(HFt,"//$1").replace(GFt,"/")}Pr.convertWindowsPathToPattern=uFe;function dFe(t){return AX(t)}Pr.convertPosixPathToPattern=dFe});var hFe=E((ijr,pFe)=>{"use strict";pFe.exports=function(e){if(typeof e!="string"||e==="")return!1;for(var r;r=/(\\).|([@?!+*]\(.*\))/g.exec(e);){if(r[2])return!0;e=e.slice(r.index+r[0].length)}return!1}});var _Fe=E((sjr,gFe)=>{"use strict";var JFt=hFe(),mFe={"{":"}","(":")","[":"]"},ZFt=function(t){if(t[0]==="!")return!0;for(var e=0,r=-2,n=-2,i=-2,s=-2,o=-2;e<t.length;){if(t[e]==="*"||t[e+1]==="?"&&/[\].+)]/.test(t[e])||n!==-1&&t[e]==="["&&t[e+1]!=="]"&&(n<e&&(n=t.indexOf("]",e)),n>e&&(o===-1||o>n||(o=t.indexOf("\\",e),o===-1||o>n)))||i!==-1&&t[e]==="{"&&t[e+1]!=="}"&&(i=t.indexOf("}",e),i>e&&(o=t.indexOf("\\",e),o===-1||o>i))||s!==-1&&t[e]==="("&&t[e+1]==="?"&&/[:!=]/.test(t[e+2])&&t[e+3]!==")"&&(s=t.indexOf(")",e),s>e&&(o=t.indexOf("\\",e),o===-1||o>s))||r!==-1&&t[e]==="("&&t[e+1]!=="|"&&(r<e&&(r=t.indexOf("|",e)),r!==-1&&t[r+1]!==")"&&(s=t.indexOf(")",r),s>r&&(o=t.indexOf("\\",r),o===-1||o>s))))return!0;if(t[e]==="\\"){var a=t[e+1];e+=2;var c=mFe[a];if(c){var l=t.indexOf(c,e);l!==-1&&(e=l+1)}if(t[e]==="!")return!0}else e++}return!1},XFt=function(t){if(t[0]==="!")return!0;for(var e=0;e<t.length;){if(/[*?{}()[\]]/.test(t[e]))return!0;if(t[e]==="\\"){var r=t[e+1];e+=2;var n=mFe[r];if(n){var i=t.indexOf(n,e);i!==-1&&(e=i+1)}if(t[e]==="!")return!0}else e++}return!1};gFe.exports=function(e,r){if(typeof e!="string"||e==="")return!1;if(JFt(e))return!0;var n=ZFt;return r&&r.strict===!1&&(n=XFt),n(e)}});var SFe=E((ojr,yFe)=>{"use strict";var QFt=_Fe(),ejt=W("path").posix.dirname,tjt=W("os").platform()==="win32",RX="/",rjt=/\\/g,njt=/[\{\[].*[\}\]]$/,ijt=/(^|[^\\])([\{\[]|\([^\)]+$)/,sjt=/\\([\!\*\?\|\[\]\(\)\{\}])/g;yFe.exports=function(e,r){var n=Object.assign({flipBackslashes:!0},r);n.flipBackslashes&&tjt&&e.indexOf(RX)<0&&(e=e.replace(rjt,RX)),njt.test(e)&&(e+=RX),e+="a";do e=ejt(e);while(QFt(e)||ijt.test(e));return e.replace(sjt,"$1")}});var gM=E(Ms=>{"use strict";Ms.isInteger=t=>typeof t=="number"?Number.isInteger(t):typeof t=="string"&&t.trim()!==""?Number.isInteger(Number(t)):!1;Ms.find=(t,e)=>t.nodes.find(r=>r.type===e);Ms.exceedsLimit=(t,e,r=1,n)=>n===!1||!Ms.isInteger(t)||!Ms.isInteger(e)?!1:(Number(e)-Number(t))/Number(r)>=n;Ms.escapeNode=(t,e=0,r)=>{let n=t.nodes[e];n&&(r&&n.type===r||n.type==="open"||n.type==="close")&&n.escaped!==!0&&(n.value="\\"+n.value,n.escaped=!0)};Ms.encloseBrace=t=>t.type!=="brace"?!1:t.commas>>0+t.ranges>>0===0?(t.invalid=!0,!0):!1;Ms.isInvalidBrace=t=>t.type!=="brace"?!1:t.invalid===!0||t.dollar?!0:t.commas>>0+t.ranges>>0===0||t.open!==!0||t.close!==!0?(t.invalid=!0,!0):!1;Ms.isOpenOrClose=t=>t.type==="open"||t.type==="close"?!0:t.open===!0||t.close===!0;Ms.reduce=t=>t.reduce((e,r)=>(r.type==="text"&&e.push(r.value),r.type==="range"&&(r.type="text"),e),[]);Ms.flatten=(...t)=>{let e=[],r=n=>{for(let i=0;i<n.length;i++){let s=n[i];if(Array.isArray(s)){r(s);continue}s!==void 0&&e.push(s)}return e};return r(t),e}});var _M=E((cjr,vFe)=>{"use strict";var EFe=gM();vFe.exports=(t,e={})=>{let r=(n,i={})=>{let s=e.escapeInvalid&&EFe.isInvalidBrace(i),o=n.invalid===!0&&e.escapeInvalid===!0,a="";if(n.value)return(s||o)&&EFe.isOpenOrClose(n)?"\\"+n.value:n.value;if(n.value)return n.value;if(n.nodes)for(let c of n.nodes)a+=r(c);return a};return r(t)}});var TFe=E((ljr,bFe)=>{"use strict";bFe.exports=function(t){return typeof t=="number"?t-t===0:typeof t=="string"&&t.trim()!==""?Number.isFinite?Number.isFinite(+t):isFinite(+t):!1}});var NFe=E((ujr,CFe)=>{"use strict";var wFe=TFe(),dh=(t,e,r)=>{if(wFe(t)===!1)throw new TypeError("toRegexRange: expected the first argument to be a number");if(e===void 0||t===e)return String(t);if(wFe(e)===!1)throw new TypeError("toRegexRange: expected the second argument to be a number.");let n={relaxZeros:!0,...r};typeof n.strictZeros=="boolean"&&(n.relaxZeros=n.strictZeros===!1);let i=String(n.relaxZeros),s=String(n.shorthand),o=String(n.capture),a=String(n.wrap),c=t+":"+e+"="+i+s+o+a;if(dh.cache.hasOwnProperty(c))return dh.cache[c].result;let l=Math.min(t,e),u=Math.max(t,e);if(Math.abs(l-u)===1){let m=t+"|"+e;return n.capture?`(${m})`:n.wrap===!1?m:`(?:${m})`}let d=PFe(t)||PFe(e),f={min:t,max:e,a:l,b:u},p=[],h=[];if(d&&(f.isPadded=d,f.maxLen=String(f.max).length),l<0){let m=u<0?Math.abs(u):1;h=AFe(m,Math.abs(l),f,n),l=f.a=0}return u>=0&&(p=AFe(l,u,f,n)),f.negatives=h,f.positives=p,f.result=ojt(h,p,n),n.capture===!0?f.result=`(${f.result})`:n.wrap!==!1&&p.length+h.length>1&&(f.result=`(?:${f.result})`),dh.cache[c]=f,f.result};function ojt(t,e,r){let n=xX(t,e,"-",!1,r)||[],i=xX(e,t,"",!1,r)||[],s=xX(t,e,"-?",!0,r)||[];return n.concat(s).concat(i).join("|")}function ajt(t,e){let r=1,n=1,i=xFe(t,r),s=new Set([e]);for(;t<=i&&i<=e;)s.add(i),r+=1,i=xFe(t,r);for(i=IFe(e+1,n)-1;t<i&&i<=e;)s.add(i),n+=1,i=IFe(e+1,n)-1;return s=[...s],s.sort(ujt),s}function cjt(t,e,r){if(t===e)return{pattern:t,count:[],digits:0};let n=ljt(t,e),i=n.length,s="",o=0;for(let a=0;a<i;a++){let[c,l]=n[a];c===l?s+=c:c!=="0"||l!=="9"?s+=djt(c,l,r):o++}return o&&(s+=r.shorthand===!0?"\\d":"[0-9]"),{pattern:s,count:[o],digits:i}}function AFe(t,e,r,n){let i=ajt(t,e),s=[],o=t,a;for(let c=0;c<i.length;c++){let l=i[c],u=cjt(String(o),String(l),n),d="";if(!r.isPadded&&a&&a.pattern===u.pattern){a.count.length>1&&a.count.pop(),a.count.push(u.count[0]),a.string=a.pattern+OFe(a.count),o=l+1;continue}r.isPadded&&(d=fjt(l,r,n)),u.string=d+u.pattern+OFe(u.count),s.push(u),o=l+1,a=u}return s}function xX(t,e,r,n,i){let s=[];for(let o of t){let{string:a}=o;!n&&!RFe(e,"string",a)&&s.push(r+a),n&&RFe(e,"string",a)&&s.push(r+a)}return s}function ljt(t,e){let r=[];for(let n=0;n<t.length;n++)r.push([t[n],e[n]]);return r}function ujt(t,e){return t>e?1:e>t?-1:0}function RFe(t,e,r){return t.some(n=>n[e]===r)}function xFe(t,e){return Number(String(t).slice(0,-e)+"9".repeat(e))}function IFe(t,e){return t-t%Math.pow(10,e)}function OFe(t){let[e=0,r=""]=t;return r||e>1?`{${e+(r?","+r:"")}}`:""}function djt(t,e,r){return`[${t}${e-t===1?"":"-"}${e}]`}function PFe(t){return/^-?(0+)\d/.test(t)}function fjt(t,e,r){if(!e.isPadded)return t;let n=Math.abs(e.maxLen-String(t).length),i=r.relaxZeros!==!1;switch(n){case 0:return"";case 1:return i?"0?":"0";case 2:return i?"0{0,2}":"00";default:return i?`0{0,${n}}`:`0{${n}}`}}dh.cache={};dh.clearCache=()=>dh.cache={};CFe.exports=dh});var PX=E((djr,FFe)=>{"use strict";var pjt=W("util"),$Fe=NFe(),kFe=t=>t!==null&&typeof t=="object"&&!Array.isArray(t),hjt=t=>e=>t===!0?Number(e):String(e),IX=t=>typeof t=="number"||typeof t=="string"&&t!=="",z0=t=>Number.isInteger(+t),OX=t=>{let e=`${t}`,r=-1;if(e[0]==="-"&&(e=e.slice(1)),e==="0")return!1;for(;e[++r]==="0";);return r>0},mjt=(t,e,r)=>typeof t=="string"||typeof e=="string"?!0:r.stringify===!0,gjt=(t,e,r)=>{if(e>0){let n=t[0]==="-"?"-":"";n&&(t=t.slice(1)),t=n+t.padStart(n?e-1:e,"0")}return r===!1?String(t):t},SM=(t,e)=>{let r=t[0]==="-"?"-":"";for(r&&(t=t.slice(1),e--);t.length<e;)t="0"+t;return r?"-"+t:t},_jt=(t,e,r)=>{t.negatives.sort((a,c)=>a<c?-1:a>c?1:0),t.positives.sort((a,c)=>a<c?-1:a>c?1:0);let n=e.capture?"":"?:",i="",s="",o;return t.positives.length&&(i=t.positives.map(a=>SM(String(a),r)).join("|")),t.negatives.length&&(s=`-(${n}${t.negatives.map(a=>SM(String(a),r)).join("|")})`),i&&s?o=`${i}|${s}`:o=i||s,e.wrap?`(${n}${o})`:o},LFe=(t,e,r,n)=>{if(r)return $Fe(t,e,{wrap:!1,...n});let i=String.fromCharCode(t);if(t===e)return i;let s=String.fromCharCode(e);return`[${i}-${s}]`},DFe=(t,e,r)=>{if(Array.isArray(t)){let n=r.wrap===!0,i=r.capture?"":"?:";return n?`(${i}${t.join("|")})`:t.join("|")}return $Fe(t,e,r)},MFe=(...t)=>new RangeError("Invalid range arguments: "+pjt.inspect(...t)),UFe=(t,e,r)=>{if(r.strictRanges===!0)throw MFe([t,e]);return[]},yjt=(t,e)=>{if(e.strictRanges===!0)throw new TypeError(`Expected step "${t}" to be a number`);return[]},Sjt=(t,e,r=1,n={})=>{let i=Number(t),s=Number(e);if(!Number.isInteger(i)||!Number.isInteger(s)){if(n.strictRanges===!0)throw MFe([t,e]);return[]}i===0&&(i=0),s===0&&(s=0);let o=i>s,a=String(t),c=String(e),l=String(r);r=Math.max(Math.abs(r),1);let u=OX(a)||OX(c)||OX(l),d=u?Math.max(a.length,c.length,l.length):0,f=u===!1&&mjt(t,e,n)===!1,p=n.transform||hjt(f);if(n.toRegex&&r===1)return LFe(SM(t,d),SM(e,d),!0,n);let h={negatives:[],positives:[]},m=v=>h[v<0?"negatives":"positives"].push(Math.abs(v)),_=[],y=0;for(;o?i>=s:i<=s;)n.toRegex===!0&&r>1?m(i):_.push(gjt(p(i,y),d,f)),i=o?i-r:i+r,y++;return n.toRegex===!0?r>1?_jt(h,n,d):DFe(_,null,{wrap:!1,...n}):_},Ejt=(t,e,r=1,n={})=>{if(!z0(t)&&t.length>1||!z0(e)&&e.length>1)return UFe(t,e,n);let i=n.transform||(f=>String.fromCharCode(f)),s=`${t}`.charCodeAt(0),o=`${e}`.charCodeAt(0),a=s>o,c=Math.min(s,o),l=Math.max(s,o);if(n.toRegex&&r===1)return LFe(c,l,!1,n);let u=[],d=0;for(;a?s>=o:s<=o;)u.push(i(s,d)),s=a?s-r:s+r,d++;return n.toRegex===!0?DFe(u,null,{wrap:!1,options:n}):u},yM=(t,e,r,n={})=>{if(e==null&&IX(t))return[t];if(!IX(t)||!IX(e))return UFe(t,e,n);if(typeof r=="function")return yM(t,e,1,{transform:r});if(kFe(r))return yM(t,e,0,r);let i={...n};return i.capture===!0&&(i.wrap=!0),r=r||i.step||1,z0(r)?z0(t)&&z0(e)?Sjt(t,e,r,i):Ejt(t,e,Math.max(Math.abs(r),1),i):r!=null&&!kFe(r)?yjt(r,i):yM(t,e,1,r)};FFe.exports=yM});var BFe=E((fjr,qFe)=>{"use strict";var vjt=PX(),jFe=gM(),bjt=(t,e={})=>{let r=(n,i={})=>{let s=jFe.isInvalidBrace(i),o=n.invalid===!0&&e.escapeInvalid===!0,a=s===!0||o===!0,c=e.escapeInvalid===!0?"\\":"",l="";if(n.isOpen===!0)return c+n.value;if(n.isClose===!0)return console.log("node.isClose",c,n.value),c+n.value;if(n.type==="open")return a?c+n.value:"(";if(n.type==="close")return a?c+n.value:")";if(n.type==="comma")return n.prev.type==="comma"?"":a?n.value:"|";if(n.value)return n.value;if(n.nodes&&n.ranges>0){let u=jFe.reduce(n.nodes),d=vjt(...u,{...e,wrap:!1,toRegex:!0,strictZeros:!0});if(d.length!==0)return u.length>1&&d.length>1?`(${d})`:d}if(n.nodes)for(let u of n.nodes)l+=r(u,n);return l};return r(t)};qFe.exports=bjt});var HFe=E((pjr,VFe)=>{"use strict";var Tjt=PX(),zFe=_M(),SS=gM(),fh=(t="",e="",r=!1)=>{let n=[];if(t=[].concat(t),e=[].concat(e),!e.length)return t;if(!t.length)return r?SS.flatten(e).map(i=>`{${i}}`):e;for(let i of t)if(Array.isArray(i))for(let s of i)n.push(fh(s,e,r));else for(let s of e)r===!0&&typeof s=="string"&&(s=`{${s}}`),n.push(Array.isArray(s)?fh(i,s,r):i+s);return SS.flatten(n)},wjt=(t,e={})=>{let r=e.rangeLimit===void 0?1e3:e.rangeLimit,n=(i,s={})=>{i.queue=[];let o=s,a=s.queue;for(;o.type!=="brace"&&o.type!=="root"&&o.parent;)o=o.parent,a=o.queue;if(i.invalid||i.dollar){a.push(fh(a.pop(),zFe(i,e)));return}if(i.type==="brace"&&i.invalid!==!0&&i.nodes.length===2){a.push(fh(a.pop(),["{}"]));return}if(i.nodes&&i.ranges>0){let d=SS.reduce(i.nodes);if(SS.exceedsLimit(...d,e.step,r))throw new RangeError("expanded array length exceeds range limit. Use options.rangeLimit to increase or disable the limit.");let f=Tjt(...d,e);f.length===0&&(f=zFe(i,e)),a.push(fh(a.pop(),f)),i.nodes=[];return}let c=SS.encloseBrace(i),l=i.queue,u=i;for(;u.type!=="brace"&&u.type!=="root"&&u.parent;)u=u.parent,l=u.queue;for(let d=0;d<i.nodes.length;d++){let f=i.nodes[d];if(f.type==="comma"&&i.type==="brace"){d===1&&l.push(""),l.push("");continue}if(f.type==="close"){a.push(fh(a.pop(),l,c));continue}if(f.value&&f.type!=="open"){l.push(fh(l.pop(),f.value));continue}f.nodes&&n(f,i)}return l};return SS.flatten(n(t))};VFe.exports=wjt});var WFe=E((hjr,GFe)=>{"use strict";GFe.exports={MAX_LENGTH:1e4,CHAR_0:"0",CHAR_9:"9",CHAR_UPPERCASE_A:"A",CHAR_LOWERCASE_A:"a",CHAR_UPPERCASE_Z:"Z",CHAR_LOWERCASE_Z:"z",CHAR_LEFT_PARENTHESES:"(",CHAR_RIGHT_PARENTHESES:")",CHAR_ASTERISK:"*",CHAR_AMPERSAND:"&",CHAR_AT:"@",CHAR_BACKSLASH:"\\",CHAR_BACKTICK:"`",CHAR_CARRIAGE_RETURN:"\r",CHAR_CIRCUMFLEX_ACCENT:"^",CHAR_COLON:":",CHAR_COMMA:",",CHAR_DOLLAR:"$",CHAR_DOT:".",CHAR_DOUBLE_QUOTE:'"',CHAR_EQUAL:"=",CHAR_EXCLAMATION_MARK:"!",CHAR_FORM_FEED:"\f",CHAR_FORWARD_SLASH:"/",CHAR_HASH:"#",CHAR_HYPHEN_MINUS:"-",CHAR_LEFT_ANGLE_BRACKET:"<",CHAR_LEFT_CURLY_BRACE:"{",CHAR_LEFT_SQUARE_BRACKET:"[",CHAR_LINE_FEED:`
394
- `,CHAR_NO_BREAK_SPACE:"\xA0",CHAR_PERCENT:"%",CHAR_PLUS:"+",CHAR_QUESTION_MARK:"?",CHAR_RIGHT_ANGLE_BRACKET:">",CHAR_RIGHT_CURLY_BRACE:"}",CHAR_RIGHT_SQUARE_BRACKET:"]",CHAR_SEMICOLON:";",CHAR_SINGLE_QUOTE:"'",CHAR_SPACE:" ",CHAR_TAB:" ",CHAR_UNDERSCORE:"_",CHAR_VERTICAL_LINE:"|",CHAR_ZERO_WIDTH_NOBREAK_SPACE:"\uFEFF"}});var XFe=E((mjr,ZFe)=>{"use strict";var Ajt=_M(),{MAX_LENGTH:YFe,CHAR_BACKSLASH:CX,CHAR_BACKTICK:Rjt,CHAR_COMMA:xjt,CHAR_DOT:Ijt,CHAR_LEFT_PARENTHESES:Ojt,CHAR_RIGHT_PARENTHESES:Pjt,CHAR_LEFT_CURLY_BRACE:Cjt,CHAR_RIGHT_CURLY_BRACE:Njt,CHAR_LEFT_SQUARE_BRACKET:KFe,CHAR_RIGHT_SQUARE_BRACKET:JFe,CHAR_DOUBLE_QUOTE:kjt,CHAR_SINGLE_QUOTE:$jt,CHAR_NO_BREAK_SPACE:Ljt,CHAR_ZERO_WIDTH_NOBREAK_SPACE:Djt}=WFe(),Mjt=(t,e={})=>{if(typeof t!="string")throw new TypeError("Expected a string");let r=e||{},n=typeof r.maxLength=="number"?Math.min(YFe,r.maxLength):YFe;if(t.length>n)throw new SyntaxError(`Input length (${t.length}), exceeds max characters (${n})`);let i={type:"root",input:t,nodes:[]},s=[i],o=i,a=i,c=0,l=t.length,u=0,d=0,f,p=()=>t[u++],h=m=>{if(m.type==="text"&&a.type==="dot"&&(a.type="text"),a&&a.type==="text"&&m.type==="text"){a.value+=m.value;return}return o.nodes.push(m),m.parent=o,m.prev=a,a=m,m};for(h({type:"bos"});u<l;)if(o=s[s.length-1],f=p(),!(f===Djt||f===Ljt)){if(f===CX){h({type:"text",value:(e.keepEscaping?f:"")+p()});continue}if(f===JFe){h({type:"text",value:"\\"+f});continue}if(f===KFe){c++;let m;for(;u<l&&(m=p());){if(f+=m,m===KFe){c++;continue}if(m===CX){f+=p();continue}if(m===JFe&&(c--,c===0))break}h({type:"text",value:f});continue}if(f===Ojt){o=h({type:"paren",nodes:[]}),s.push(o),h({type:"text",value:f});continue}if(f===Pjt){if(o.type!=="paren"){h({type:"text",value:f});continue}o=s.pop(),h({type:"text",value:f}),o=s[s.length-1];continue}if(f===kjt||f===$jt||f===Rjt){let m=f,_;for(e.keepQuotes!==!0&&(f="");u<l&&(_=p());){if(_===CX){f+=_+p();continue}if(_===m){e.keepQuotes===!0&&(f+=_);break}f+=_}h({type:"text",value:f});continue}if(f===Cjt){d++;let _={type:"brace",open:!0,close:!1,dollar:a.value&&a.value.slice(-1)==="$"||o.dollar===!0,depth:d,commas:0,ranges:0,nodes:[]};o=h(_),s.push(o),h({type:"open",value:f});continue}if(f===Njt){if(o.type!=="brace"){h({type:"text",value:f});continue}let m="close";o=s.pop(),o.close=!0,h({type:m,value:f}),d--,o=s[s.length-1];continue}if(f===xjt&&d>0){if(o.ranges>0){o.ranges=0;let m=o.nodes.shift();o.nodes=[m,{type:"text",value:Ajt(o)}]}h({type:"comma",value:f}),o.commas++;continue}if(f===Ijt&&d>0&&o.commas===0){let m=o.nodes;if(d===0||m.length===0){h({type:"text",value:f});continue}if(a.type==="dot"){if(o.range=[],a.value+=f,a.type="range",o.nodes.length!==3&&o.nodes.length!==5){o.invalid=!0,o.ranges=0,a.type="text";continue}o.ranges++,o.args=[];continue}if(a.type==="range"){m.pop();let _=m[m.length-1];_.value+=a.value+f,a=_,o.ranges--;continue}h({type:"dot",value:f});continue}h({type:"text",value:f})}do if(o=s.pop(),o.type!=="root"){o.nodes.forEach(y=>{y.nodes||(y.type==="open"&&(y.isOpen=!0),y.type==="close"&&(y.isClose=!0),y.nodes||(y.type="text"),y.invalid=!0)});let m=s[s.length-1],_=m.nodes.indexOf(o);m.nodes.splice(_,1,...o.nodes)}while(s.length>0);return h({type:"eos"}),i};ZFe.exports=Mjt});var tje=E((gjr,eje)=>{"use strict";var QFe=_M(),Ujt=BFe(),Fjt=HFe(),jjt=XFe(),Qi=(t,e={})=>{let r=[];if(Array.isArray(t))for(let n of t){let i=Qi.create(n,e);Array.isArray(i)?r.push(...i):r.push(i)}else r=[].concat(Qi.create(t,e));return e&&e.expand===!0&&e.nodupes===!0&&(r=[...new Set(r)]),r};Qi.parse=(t,e={})=>jjt(t,e);Qi.stringify=(t,e={})=>QFe(typeof t=="string"?Qi.parse(t,e):t,e);Qi.compile=(t,e={})=>(typeof t=="string"&&(t=Qi.parse(t,e)),Ujt(t,e));Qi.expand=(t,e={})=>{typeof t=="string"&&(t=Qi.parse(t,e));let r=Fjt(t,e);return e.noempty===!0&&(r=r.filter(Boolean)),e.nodupes===!0&&(r=[...new Set(r)]),r};Qi.create=(t,e={})=>t===""||t.length<3?[t]:e.expand!==!0?Qi.compile(t,e):Qi.expand(t,e);eje.exports=Qi});var V0=E((_jr,oje)=>{"use strict";var qjt=W("path"),qa="\\\\/",rje=`[^${qa}]`,Bjt=0,_l="\\.",zjt="\\+",Vjt="\\?",EM="\\/",Hjt="(?=.)",nje="[^/]",NX=`(?:${EM}|$)`,ije=`(?:^|${EM})`,kX=`${_l}{1,2}${NX}`,Gjt=`(?!${_l})`,Wjt=`(?!${ije}${kX})`,Yjt=`(?!${_l}{0,1}${NX})`,Kjt=`(?!${kX})`,Jjt=`[^.${EM}]`,Zjt=`${nje}*?`,sje={DOT_LITERAL:_l,PLUS_LITERAL:zjt,QMARK_LITERAL:Vjt,SLASH_LITERAL:EM,ONE_CHAR:Hjt,QMARK:nje,END_ANCHOR:NX,DOTS_SLASH:kX,NO_DOT:Gjt,NO_DOTS:Wjt,NO_DOT_SLASH:Yjt,NO_DOTS_SLASH:Kjt,QMARK_NO_DOT:Jjt,STAR:Zjt,START_ANCHOR:ije},Xjt={...sje,SLASH_LITERAL:`[${qa}]`,QMARK:rje,STAR:`${rje}*?`,DOTS_SLASH:`${_l}{1,2}(?:[${qa}]|$)`,NO_DOT:`(?!${_l})`,NO_DOTS:`(?!(?:^|[${qa}])${_l}{1,2}(?:[${qa}]|$))`,NO_DOT_SLASH:`(?!${_l}{0,1}(?:[${qa}]|$))`,NO_DOTS_SLASH:`(?!${_l}{1,2}(?:[${qa}]|$))`,QMARK_NO_DOT:`[^.${qa}]`,START_ANCHOR:`(?:^|[${qa}])`,END_ANCHOR:`(?:[${qa}]|$)`},Qjt={__proto__:null,alnum:"a-zA-Z0-9",alpha:"a-zA-Z",ascii:"\\x00-\\x7F",blank:" \\t",cntrl:"\\x00-\\x1F\\x7F",digit:"0-9",graph:"\\x21-\\x7E",lower:"a-z",print:"\\x20-\\x7E ",punct:"\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",space:" \\t\\r\\n\\v\\f",upper:"A-Z",word:"A-Za-z0-9_",xdigit:"A-Fa-f0-9"};oje.exports={DEFAULT_MAX_EXTGLOB_RECURSION:Bjt,MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:Qjt,REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,REGEX_NON_SPECIAL_CHARS:/^[^@![\].,$*+?^{}()|\\/]+/,REGEX_SPECIAL_CHARS:/[-*+?.^${}(|)[\]]/,REGEX_SPECIAL_CHARS_BACKREF:/(\\?)((\W)(\3*))/g,REGEX_SPECIAL_CHARS_GLOBAL:/([-*+?.^${}(|)[\]])/g,REGEX_REMOVE_BACKSLASH:/(?:\[.*?[^\\]\]|\\(?=.))/g,REPLACEMENTS:{__proto__:null,"***":"*","**/**":"**","**/**/**":"**"},CHAR_0:48,CHAR_9:57,CHAR_UPPERCASE_A:65,CHAR_LOWERCASE_A:97,CHAR_UPPERCASE_Z:90,CHAR_LOWERCASE_Z:122,CHAR_LEFT_PARENTHESES:40,CHAR_RIGHT_PARENTHESES:41,CHAR_ASTERISK:42,CHAR_AMPERSAND:38,CHAR_AT:64,CHAR_BACKWARD_SLASH:92,CHAR_CARRIAGE_RETURN:13,CHAR_CIRCUMFLEX_ACCENT:94,CHAR_COLON:58,CHAR_COMMA:44,CHAR_DOT:46,CHAR_DOUBLE_QUOTE:34,CHAR_EQUAL:61,CHAR_EXCLAMATION_MARK:33,CHAR_FORM_FEED:12,CHAR_FORWARD_SLASH:47,CHAR_GRAVE_ACCENT:96,CHAR_HASH:35,CHAR_HYPHEN_MINUS:45,CHAR_LEFT_ANGLE_BRACKET:60,CHAR_LEFT_CURLY_BRACE:123,CHAR_LEFT_SQUARE_BRACKET:91,CHAR_LINE_FEED:10,CHAR_NO_BREAK_SPACE:160,CHAR_PERCENT:37,CHAR_PLUS:43,CHAR_QUESTION_MARK:63,CHAR_RIGHT_ANGLE_BRACKET:62,CHAR_RIGHT_CURLY_BRACE:125,CHAR_RIGHT_SQUARE_BRACKET:93,CHAR_SEMICOLON:59,CHAR_SINGLE_QUOTE:39,CHAR_SPACE:32,CHAR_TAB:9,CHAR_UNDERSCORE:95,CHAR_VERTICAL_LINE:124,CHAR_ZERO_WIDTH_NOBREAK_SPACE:65279,SEP:qjt.sep,extglobChars(t){return{"!":{type:"negate",open:"(?:(?!(?:",close:`))${t.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}},globChars(t){return t===!0?Xjt:sje}}});var H0=E(Pi=>{"use strict";var eqt=W("path"),tqt=process.platform==="win32",{REGEX_BACKSLASH:rqt,REGEX_REMOVE_BACKSLASH:nqt,REGEX_SPECIAL_CHARS:iqt,REGEX_SPECIAL_CHARS_GLOBAL:sqt}=V0();Pi.isObject=t=>t!==null&&typeof t=="object"&&!Array.isArray(t);Pi.hasRegexChars=t=>iqt.test(t);Pi.isRegexChar=t=>t.length===1&&Pi.hasRegexChars(t);Pi.escapeRegex=t=>t.replace(sqt,"\\$1");Pi.toPosixSlashes=t=>t.replace(rqt,"/");Pi.removeBackslashes=t=>t.replace(nqt,e=>e==="\\"?"":e);Pi.supportsLookbehinds=()=>{let t=process.version.slice(1).split(".").map(Number);return t.length===3&&t[0]>=9||t[0]===8&&t[1]>=10};Pi.isWindows=t=>t&&typeof t.windows=="boolean"?t.windows:tqt===!0||eqt.sep==="\\";Pi.escapeLast=(t,e,r)=>{let n=t.lastIndexOf(e,r);return n===-1?t:t[n-1]==="\\"?Pi.escapeLast(t,e,n-1):`${t.slice(0,n)}\\${t.slice(n)}`};Pi.removePrefix=(t,e={})=>{let r=t;return r.startsWith("./")&&(r=r.slice(2),e.prefix="./"),r};Pi.wrapOutput=(t,e={},r={})=>{let n=r.contains?"":"^",i=r.contains?"":"$",s=`${n}(?:${t})${i}`;return e.negated===!0&&(s=`(?:^(?!${s}).*$)`),s}});var hje=E((Sjr,pje)=>{"use strict";var aje=H0(),{CHAR_ASTERISK:$X,CHAR_AT:oqt,CHAR_BACKWARD_SLASH:G0,CHAR_COMMA:aqt,CHAR_DOT:LX,CHAR_EXCLAMATION_MARK:DX,CHAR_FORWARD_SLASH:fje,CHAR_LEFT_CURLY_BRACE:MX,CHAR_LEFT_PARENTHESES:UX,CHAR_LEFT_SQUARE_BRACKET:cqt,CHAR_PLUS:lqt,CHAR_QUESTION_MARK:cje,CHAR_RIGHT_CURLY_BRACE:uqt,CHAR_RIGHT_PARENTHESES:lje,CHAR_RIGHT_SQUARE_BRACKET:dqt}=V0(),uje=t=>t===fje||t===G0,dje=t=>{t.isPrefix!==!0&&(t.depth=t.isGlobstar?1/0:1)},fqt=(t,e)=>{let r=e||{},n=t.length-1,i=r.parts===!0||r.scanToEnd===!0,s=[],o=[],a=[],c=t,l=-1,u=0,d=0,f=!1,p=!1,h=!1,m=!1,_=!1,y=!1,v=!1,S=!1,g=!1,T=!1,I=0,x,R,O={value:"",depth:0,isGlob:!1},A=()=>l>=n,b=()=>c.charCodeAt(l+1),L=()=>(x=R,c.charCodeAt(++l));for(;l<n;){R=L();let j;if(R===G0){v=O.backslashes=!0,R=L(),R===MX&&(y=!0);continue}if(y===!0||R===MX){for(I++;A()!==!0&&(R=L());){if(R===G0){v=O.backslashes=!0,L();continue}if(R===MX){I++;continue}if(y!==!0&&R===LX&&(R=L())===LX){if(f=O.isBrace=!0,h=O.isGlob=!0,T=!0,i===!0)continue;break}if(y!==!0&&R===aqt){if(f=O.isBrace=!0,h=O.isGlob=!0,T=!0,i===!0)continue;break}if(R===uqt&&(I--,I===0)){y=!1,f=O.isBrace=!0,T=!0;break}}if(i===!0)continue;break}if(R===fje){if(s.push(l),o.push(O),O={value:"",depth:0,isGlob:!1},T===!0)continue;if(x===LX&&l===u+1){u+=2;continue}d=l+1;continue}if(r.noext!==!0&&(R===lqt||R===oqt||R===$X||R===cje||R===DX)===!0&&b()===UX){if(h=O.isGlob=!0,m=O.isExtglob=!0,T=!0,R===DX&&l===u&&(g=!0),i===!0){for(;A()!==!0&&(R=L());){if(R===G0){v=O.backslashes=!0,R=L();continue}if(R===lje){h=O.isGlob=!0,T=!0;break}}continue}break}if(R===$X){if(x===$X&&(_=O.isGlobstar=!0),h=O.isGlob=!0,T=!0,i===!0)continue;break}if(R===cje){if(h=O.isGlob=!0,T=!0,i===!0)continue;break}if(R===cqt){for(;A()!==!0&&(j=L());){if(j===G0){v=O.backslashes=!0,L();continue}if(j===dqt){p=O.isBracket=!0,h=O.isGlob=!0,T=!0;break}}if(i===!0)continue;break}if(r.nonegate!==!0&&R===DX&&l===u){S=O.negated=!0,u++;continue}if(r.noparen!==!0&&R===UX){if(h=O.isGlob=!0,i===!0){for(;A()!==!0&&(R=L());){if(R===UX){v=O.backslashes=!0,R=L();continue}if(R===lje){T=!0;break}}continue}break}if(h===!0){if(T=!0,i===!0)continue;break}}r.noext===!0&&(m=!1,h=!1);let C=c,w="",P="";u>0&&(w=c.slice(0,u),c=c.slice(u),d-=u),C&&h===!0&&d>0?(C=c.slice(0,d),P=c.slice(d)):h===!0?(C="",P=c):C=c,C&&C!==""&&C!=="/"&&C!==c&&uje(C.charCodeAt(C.length-1))&&(C=C.slice(0,-1)),r.unescape===!0&&(P&&(P=aje.removeBackslashes(P)),C&&v===!0&&(C=aje.removeBackslashes(C)));let N={prefix:w,input:t,start:u,base:C,glob:P,isBrace:f,isBracket:p,isGlob:h,isExtglob:m,isGlobstar:_,negated:S,negatedExtglob:g};if(r.tokens===!0&&(N.maxDepth=0,uje(R)||o.push(O),N.tokens=o),r.parts===!0||r.tokens===!0){let j;for(let V=0;V<s.length;V++){let de=j?j+1:u,Te=s[V],Ie=t.slice(de,Te);r.tokens&&(V===0&&u!==0?(o[V].isPrefix=!0,o[V].value=w):o[V].value=Ie,dje(o[V]),N.maxDepth+=o[V].depth),(V!==0||Ie!=="")&&a.push(Ie),j=Te}if(j&&j+1<t.length){let V=t.slice(j+1);a.push(V),r.tokens&&(o[o.length-1].value=V,dje(o[o.length-1]),N.maxDepth+=o[o.length-1].depth)}N.slashes=s,N.parts=a}return N};pje.exports=fqt});var Sje=E((Ejr,yje)=>{"use strict";var W0=V0(),Dn=H0(),{MAX_LENGTH:vM,POSIX_REGEX_SOURCE:pqt,REGEX_NON_SPECIAL_CHARS:hqt,REGEX_SPECIAL_CHARS_BACKREF:mqt,REPLACEMENTS:mje}=W0,gqt=(t,e)=>{if(typeof e.expandRange=="function")return e.expandRange(...t,e);t.sort();let r=`[${t.join("-")}]`;try{new RegExp(r)}catch{return t.map(i=>Dn.escapeRegex(i)).join("..")}return r},ES=(t,e)=>`Missing ${t}: "${e}" - use "\\\\${e}" to match literal characters`,gje=t=>{let e=[],r=0,n=0,i=0,s="",o=!1;for(let a of t){if(o===!0){s+=a,o=!1;continue}if(a==="\\"){s+=a,o=!0;continue}if(a==='"'){i=i===1?0:1,s+=a;continue}if(i===0){if(a==="[")r++;else if(a==="]"&&r>0)r--;else if(r===0){if(a==="(")n++;else if(a===")"&&n>0)n--;else if(a==="|"&&n===0){e.push(s),s="";continue}}}s+=a}return e.push(s),e},_qt=t=>{let e=!1;for(let r of t){if(e===!0){e=!1;continue}if(r==="\\"){e=!0;continue}if(/[?*+@!()[\]{}]/.test(r))return!1}return!0},_je=t=>{let e=t.trim(),r=!0;for(;r===!0;)r=!1,/^@\([^\\()[\]{}|]+\)$/.test(e)&&(e=e.slice(2,-1),r=!0);if(_qt(e))return e.replace(/\\(.)/g,"$1")},yqt=t=>{let e=t.map(_je).filter(Boolean);for(let r=0;r<e.length;r++)for(let n=r+1;n<e.length;n++){let i=e[r],s=e[n],o=i[0];if(!(!o||i!==o.repeat(i.length)||s!==o.repeat(s.length))&&(i===s||i.startsWith(s)||s.startsWith(i)))return!0}return!1},FX=(t,e=!0)=>{if(t[0]!=="+"&&t[0]!=="*"||t[1]!=="(")return;let r=0,n=0,i=0,s=!1;for(let o=1;o<t.length;o++){let a=t[o];if(s===!0){s=!1;continue}if(a==="\\"){s=!0;continue}if(a==='"'){i=i===1?0:1;continue}if(i!==1){if(a==="["){r++;continue}if(a==="]"&&r>0){r--;continue}if(!(r>0)){if(a==="("){n++;continue}if(a===")"&&(n--,n===0))return e===!0&&o!==t.length-1?void 0:{type:t[0],body:t.slice(2,o),end:o}}}}},Sqt=t=>{let e=0,r=[];for(;e<t.length;){let i=FX(t.slice(e),!1);if(!i||i.type!=="*")return;let s=gje(i.body).map(a=>a.trim());if(s.length!==1)return;let o=_je(s[0]);if(!o||o.length!==1)return;r.push(o),e+=i.end+1}return r.length<1?void 0:`${r.length===1?Dn.escapeRegex(r[0]):`[${r.map(i=>Dn.escapeRegex(i)).join("")}]`}*`},Eqt=t=>{let e=0,r=t.trim(),n=FX(r);for(;n;)e++,r=n.body.trim(),n=FX(r);return e},vqt=(t,e)=>{if(e.maxExtglobRecursion===!1)return{risky:!1};let r=typeof e.maxExtglobRecursion=="number"?e.maxExtglobRecursion:W0.DEFAULT_MAX_EXTGLOB_RECURSION,n=gje(t).map(i=>i.trim());if(n.length>1&&(n.some(i=>i==="")||n.some(i=>/^[*?]+$/.test(i))||yqt(n)))return{risky:!0};for(let i of n){let s=Sqt(i);if(s)return{risky:!0,safeOutput:s};if(Eqt(i)>r)return{risky:!0}}return{risky:!1}},jX=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");t=mje[t]||t;let r={...e},n=typeof r.maxLength=="number"?Math.min(vM,r.maxLength):vM,i=t.length;if(i>n)throw new SyntaxError(`Input length: ${i}, exceeds maximum allowed length: ${n}`);let s={type:"bos",value:"",output:r.prepend||""},o=[s],a=r.capture?"":"?:",c=Dn.isWindows(e),l=W0.globChars(c),u=W0.extglobChars(l),{DOT_LITERAL:d,PLUS_LITERAL:f,SLASH_LITERAL:p,ONE_CHAR:h,DOTS_SLASH:m,NO_DOT:_,NO_DOT_SLASH:y,NO_DOTS_SLASH:v,QMARK:S,QMARK_NO_DOT:g,STAR:T,START_ANCHOR:I}=l,x=F=>`(${a}(?:(?!${I}${F.dot?m:d}).)*?)`,R=r.dot?"":_,O=r.dot?S:g,A=r.bash===!0?x(r):T;r.capture&&(A=`(${A})`),typeof r.noext=="boolean"&&(r.noextglob=r.noext);let b={input:t,index:-1,start:0,dot:r.dot===!0,consumed:"",output:"",prefix:"",backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:o};t=Dn.removePrefix(t,b),i=t.length;let L=[],C=[],w=[],P=s,N,j=()=>b.index===i-1,V=b.peek=(F=1)=>t[b.index+F],de=b.advance=()=>t[++b.index]||"",Te=()=>t.slice(b.index+1),Ie=(F="",se=0)=>{b.consumed+=F,b.index+=se},$e=F=>{b.output+=F.output!=null?F.output:F.value,Ie(F.value)},oe=()=>{let F=1;for(;V()==="!"&&(V(2)!=="("||V(3)==="?");)de(),b.start++,F++;return F%2===0?!1:(b.negated=!0,b.start++,!0)},Ee=F=>{b[F]++,w.push(F)},he=F=>{b[F]--,w.pop()},k=F=>{if(P.type==="globstar"){let se=b.braces>0&&(F.type==="comma"||F.type==="brace"),M=F.extglob===!0||L.length&&(F.type==="pipe"||F.type==="paren");F.type!=="slash"&&F.type!=="paren"&&!se&&!M&&(b.output=b.output.slice(0,-P.output.length),P.type="star",P.value="*",P.output=A,b.output+=P.output)}if(L.length&&F.type!=="paren"&&(L[L.length-1].inner+=F.value),(F.value||F.output)&&$e(F),P&&P.type==="text"&&F.type==="text"){P.value+=F.value,P.output=(P.output||"")+F.value;return}F.prev=P,o.push(F),P=F},U=(F,se)=>{let M={...u[se],conditions:1,inner:""};M.prev=P,M.parens=b.parens,M.output=b.output,M.startIndex=b.index,M.tokensIndex=o.length;let D=(r.capture?"(":"")+M.open;Ee("parens"),k({type:F,value:se,output:b.output?"":h}),k({type:"paren",extglob:!0,value:de(),output:D}),L.push(M)},ne=F=>{let se=t.slice(F.startIndex,b.index+1),M=t.slice(F.startIndex+2,b.index),D=vqt(M,r);if((F.type==="plus"||F.type==="star")&&D.risky){let H=D.safeOutput?(F.output?"":h)+(r.capture?`(${D.safeOutput})`:D.safeOutput):void 0,z=o[F.tokensIndex];z.type="text",z.value=se,z.output=H||Dn.escapeRegex(se);for(let K=F.tokensIndex+1;K<o.length;K++)o[K].value="",o[K].output="",delete o[K].suffix;b.output=F.output+z.output,b.backtrack=!0,k({type:"paren",extglob:!0,value:N,output:""}),he("parens");return}let B=F.close+(r.capture?")":""),J;if(F.type==="negate"){let H=A;if(F.inner&&F.inner.length>1&&F.inner.includes("/")&&(H=x(r)),(H!==A||j()||/^\)+$/.test(Te()))&&(B=F.close=`)$))${H}`),F.inner.includes("*")&&(J=Te())&&/^\.[^\\/.]+$/.test(J)){let z=jX(J,{...e,fastpaths:!1}).output;B=F.close=`)${z})${H})`}F.prev.type==="bos"&&(b.negatedExtglob=!0)}k({type:"paren",extglob:!0,value:N,output:B}),he("parens")};if(r.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(t)){let F=!1,se=t.replace(mqt,(M,D,B,J,H,z)=>J==="\\"?(F=!0,M):J==="?"?D?D+J+(H?S.repeat(H.length):""):z===0?O+(H?S.repeat(H.length):""):S.repeat(B.length):J==="."?d.repeat(B.length):J==="*"?D?D+J+(H?A:""):A:D?M:`\\${M}`);return F===!0&&(r.unescape===!0?se=se.replace(/\\/g,""):se=se.replace(/\\+/g,M=>M.length%2===0?"\\\\":M?"\\":"")),se===t&&r.contains===!0?(b.output=t,b):(b.output=Dn.wrapOutput(se,b,e),b)}for(;!j();){if(N=de(),N==="\0")continue;if(N==="\\"){let M=V();if(M==="/"&&r.bash!==!0||M==="."||M===";")continue;if(!M){N+="\\",k({type:"text",value:N});continue}let D=/^\\+/.exec(Te()),B=0;if(D&&D[0].length>2&&(B=D[0].length,b.index+=B,B%2!==0&&(N+="\\")),r.unescape===!0?N=de():N+=de(),b.brackets===0){k({type:"text",value:N});continue}}if(b.brackets>0&&(N!=="]"||P.value==="["||P.value==="[^")){if(r.posix!==!1&&N===":"){let M=P.value.slice(1);if(M.includes("[")&&(P.posix=!0,M.includes(":"))){let D=P.value.lastIndexOf("["),B=P.value.slice(0,D),J=P.value.slice(D+2),H=pqt[J];if(H){P.value=B+H,b.backtrack=!0,de(),!s.output&&o.indexOf(P)===1&&(s.output=h);continue}}}(N==="["&&V()!==":"||N==="-"&&V()==="]")&&(N=`\\${N}`),N==="]"&&(P.value==="["||P.value==="[^")&&(N=`\\${N}`),r.posix===!0&&N==="!"&&P.value==="["&&(N="^"),P.value+=N,$e({value:N});continue}if(b.quotes===1&&N!=='"'){N=Dn.escapeRegex(N),P.value+=N,$e({value:N});continue}if(N==='"'){b.quotes=b.quotes===1?0:1,r.keepQuotes===!0&&k({type:"text",value:N});continue}if(N==="("){Ee("parens"),k({type:"paren",value:N});continue}if(N===")"){if(b.parens===0&&r.strictBrackets===!0)throw new SyntaxError(ES("opening","("));let M=L[L.length-1];if(M&&b.parens===M.parens+1){ne(L.pop());continue}k({type:"paren",value:N,output:b.parens?")":"\\)"}),he("parens");continue}if(N==="["){if(r.nobracket===!0||!Te().includes("]")){if(r.nobracket!==!0&&r.strictBrackets===!0)throw new SyntaxError(ES("closing","]"));N=`\\${N}`}else Ee("brackets");k({type:"bracket",value:N});continue}if(N==="]"){if(r.nobracket===!0||P&&P.type==="bracket"&&P.value.length===1){k({type:"text",value:N,output:`\\${N}`});continue}if(b.brackets===0){if(r.strictBrackets===!0)throw new SyntaxError(ES("opening","["));k({type:"text",value:N,output:`\\${N}`});continue}he("brackets");let M=P.value.slice(1);if(P.posix!==!0&&M[0]==="^"&&!M.includes("/")&&(N=`/${N}`),P.value+=N,$e({value:N}),r.literalBrackets===!1||Dn.hasRegexChars(M))continue;let D=Dn.escapeRegex(P.value);if(b.output=b.output.slice(0,-P.value.length),r.literalBrackets===!0){b.output+=D,P.value=D;continue}P.value=`(${a}${D}|${P.value})`,b.output+=P.value;continue}if(N==="{"&&r.nobrace!==!0){Ee("braces");let M={type:"brace",value:N,output:"(",outputIndex:b.output.length,tokensIndex:b.tokens.length};C.push(M),k(M);continue}if(N==="}"){let M=C[C.length-1];if(r.nobrace===!0||!M){k({type:"text",value:N,output:N});continue}let D=")";if(M.dots===!0){let B=o.slice(),J=[];for(let H=B.length-1;H>=0&&(o.pop(),B[H].type!=="brace");H--)B[H].type!=="dots"&&J.unshift(B[H].value);D=gqt(J,r),b.backtrack=!0}if(M.comma!==!0&&M.dots!==!0){let B=b.output.slice(0,M.outputIndex),J=b.tokens.slice(M.tokensIndex);M.value=M.output="\\{",N=D="\\}",b.output=B;for(let H of J)b.output+=H.output||H.value}k({type:"brace",value:N,output:D}),he("braces"),C.pop();continue}if(N==="|"){L.length>0&&L[L.length-1].conditions++,k({type:"text",value:N});continue}if(N===","){let M=N,D=C[C.length-1];D&&w[w.length-1]==="braces"&&(D.comma=!0,M="|"),k({type:"comma",value:N,output:M});continue}if(N==="/"){if(P.type==="dot"&&b.index===b.start+1){b.start=b.index+1,b.consumed="",b.output="",o.pop(),P=s;continue}k({type:"slash",value:N,output:p});continue}if(N==="."){if(b.braces>0&&P.type==="dot"){P.value==="."&&(P.output=d);let M=C[C.length-1];P.type="dots",P.output+=N,P.value+=N,M.dots=!0;continue}if(b.braces+b.parens===0&&P.type!=="bos"&&P.type!=="slash"){k({type:"text",value:N,output:d});continue}k({type:"dot",value:N,output:d});continue}if(N==="?"){if(!(P&&P.value==="(")&&r.noextglob!==!0&&V()==="("&&V(2)!=="?"){U("qmark",N);continue}if(P&&P.type==="paren"){let D=V(),B=N;if(D==="<"&&!Dn.supportsLookbehinds())throw new Error("Node.js v10 or higher is required for regex lookbehinds");(P.value==="("&&!/[!=<:]/.test(D)||D==="<"&&!/<([!=]|\w+>)/.test(Te()))&&(B=`\\${N}`),k({type:"text",value:N,output:B});continue}if(r.dot!==!0&&(P.type==="slash"||P.type==="bos")){k({type:"qmark",value:N,output:g});continue}k({type:"qmark",value:N,output:S});continue}if(N==="!"){if(r.noextglob!==!0&&V()==="("&&(V(2)!=="?"||!/[!=<:]/.test(V(3)))){U("negate",N);continue}if(r.nonegate!==!0&&b.index===0){oe();continue}}if(N==="+"){if(r.noextglob!==!0&&V()==="("&&V(2)!=="?"){U("plus",N);continue}if(P&&P.value==="("||r.regex===!1){k({type:"plus",value:N,output:f});continue}if(P&&(P.type==="bracket"||P.type==="paren"||P.type==="brace")||b.parens>0){k({type:"plus",value:N});continue}k({type:"plus",value:f});continue}if(N==="@"){if(r.noextglob!==!0&&V()==="("&&V(2)!=="?"){k({type:"at",extglob:!0,value:N,output:""});continue}k({type:"text",value:N});continue}if(N!=="*"){(N==="$"||N==="^")&&(N=`\\${N}`);let M=hqt.exec(Te());M&&(N+=M[0],b.index+=M[0].length),k({type:"text",value:N});continue}if(P&&(P.type==="globstar"||P.star===!0)){P.type="star",P.star=!0,P.value+=N,P.output=A,b.backtrack=!0,b.globstar=!0,Ie(N);continue}let F=Te();if(r.noextglob!==!0&&/^\([^?]/.test(F)){U("star",N);continue}if(P.type==="star"){if(r.noglobstar===!0){Ie(N);continue}let M=P.prev,D=M.prev,B=M.type==="slash"||M.type==="bos",J=D&&(D.type==="star"||D.type==="globstar");if(r.bash===!0&&(!B||F[0]&&F[0]!=="/")){k({type:"star",value:N,output:""});continue}let H=b.braces>0&&(M.type==="comma"||M.type==="brace"),z=L.length&&(M.type==="pipe"||M.type==="paren");if(!B&&M.type!=="paren"&&!H&&!z){k({type:"star",value:N,output:""});continue}for(;F.slice(0,3)==="/**";){let K=t[b.index+4];if(K&&K!=="/")break;F=F.slice(3),Ie("/**",3)}if(M.type==="bos"&&j()){P.type="globstar",P.value+=N,P.output=x(r),b.output=P.output,b.globstar=!0,Ie(N);continue}if(M.type==="slash"&&M.prev.type!=="bos"&&!J&&j()){b.output=b.output.slice(0,-(M.output+P.output).length),M.output=`(?:${M.output}`,P.type="globstar",P.output=x(r)+(r.strictSlashes?")":"|$)"),P.value+=N,b.globstar=!0,b.output+=M.output+P.output,Ie(N);continue}if(M.type==="slash"&&M.prev.type!=="bos"&&F[0]==="/"){let K=F[1]!==void 0?"|$":"";b.output=b.output.slice(0,-(M.output+P.output).length),M.output=`(?:${M.output}`,P.type="globstar",P.output=`${x(r)}${p}|${p}${K})`,P.value+=N,b.output+=M.output+P.output,b.globstar=!0,Ie(N+de()),k({type:"slash",value:"/",output:""});continue}if(M.type==="bos"&&F[0]==="/"){P.type="globstar",P.value+=N,P.output=`(?:^|${p}|${x(r)}${p})`,b.output=P.output,b.globstar=!0,Ie(N+de()),k({type:"slash",value:"/",output:""});continue}b.output=b.output.slice(0,-P.output.length),P.type="globstar",P.output=x(r),P.value+=N,b.output+=P.output,b.globstar=!0,Ie(N);continue}let se={type:"star",value:N,output:A};if(r.bash===!0){se.output=".*?",(P.type==="bos"||P.type==="slash")&&(se.output=R+se.output),k(se);continue}if(P&&(P.type==="bracket"||P.type==="paren")&&r.regex===!0){se.output=N,k(se);continue}(b.index===b.start||P.type==="slash"||P.type==="dot")&&(P.type==="dot"?(b.output+=y,P.output+=y):r.dot===!0?(b.output+=v,P.output+=v):(b.output+=R,P.output+=R),V()!=="*"&&(b.output+=h,P.output+=h)),k(se)}for(;b.brackets>0;){if(r.strictBrackets===!0)throw new SyntaxError(ES("closing","]"));b.output=Dn.escapeLast(b.output,"["),he("brackets")}for(;b.parens>0;){if(r.strictBrackets===!0)throw new SyntaxError(ES("closing",")"));b.output=Dn.escapeLast(b.output,"("),he("parens")}for(;b.braces>0;){if(r.strictBrackets===!0)throw new SyntaxError(ES("closing","}"));b.output=Dn.escapeLast(b.output,"{"),he("braces")}if(r.strictSlashes!==!0&&(P.type==="star"||P.type==="bracket")&&k({type:"maybe_slash",value:"",output:`${p}?`}),b.backtrack===!0){b.output="";for(let F of b.tokens)b.output+=F.output!=null?F.output:F.value,F.suffix&&(b.output+=F.suffix)}return b};jX.fastpaths=(t,e)=>{let r={...e},n=typeof r.maxLength=="number"?Math.min(vM,r.maxLength):vM,i=t.length;if(i>n)throw new SyntaxError(`Input length: ${i}, exceeds maximum allowed length: ${n}`);t=mje[t]||t;let s=Dn.isWindows(e),{DOT_LITERAL:o,SLASH_LITERAL:a,ONE_CHAR:c,DOTS_SLASH:l,NO_DOT:u,NO_DOTS:d,NO_DOTS_SLASH:f,STAR:p,START_ANCHOR:h}=W0.globChars(s),m=r.dot?d:u,_=r.dot?f:u,y=r.capture?"":"?:",v={negated:!1,prefix:""},S=r.bash===!0?".*?":p;r.capture&&(S=`(${S})`);let g=R=>R.noglobstar===!0?S:`(${y}(?:(?!${h}${R.dot?l:o}).)*?)`,T=R=>{switch(R){case"*":return`${m}${c}${S}`;case".*":return`${o}${c}${S}`;case"*.*":return`${m}${S}${o}${c}${S}`;case"*/*":return`${m}${S}${a}${c}${_}${S}`;case"**":return m+g(r);case"**/*":return`(?:${m}${g(r)}${a})?${_}${c}${S}`;case"**/*.*":return`(?:${m}${g(r)}${a})?${_}${S}${o}${c}${S}`;case"**/.*":return`(?:${m}${g(r)}${a})?${o}${c}${S}`;default:{let O=/^(.*?)\.(\w+)$/.exec(R);if(!O)return;let A=T(O[1]);return A?A+o+O[2]:void 0}}},I=Dn.removePrefix(t,v),x=T(I);return x&&r.strictSlashes!==!0&&(x+=`${a}?`),x};yje.exports=jX});var vje=E((vjr,Eje)=>{"use strict";var bqt=W("path"),Tqt=hje(),qX=Sje(),BX=H0(),wqt=V0(),Aqt=t=>t&&typeof t=="object"&&!Array.isArray(t),wr=(t,e,r=!1)=>{if(Array.isArray(t)){let u=t.map(f=>wr(f,e,r));return f=>{for(let p of u){let h=p(f);if(h)return h}return!1}}let n=Aqt(t)&&t.tokens&&t.input;if(t===""||typeof t!="string"&&!n)throw new TypeError("Expected pattern to be a non-empty string");let i=e||{},s=BX.isWindows(e),o=n?wr.compileRe(t,e):wr.makeRe(t,e,!1,!0),a=o.state;delete o.state;let c=()=>!1;if(i.ignore){let u={...e,ignore:null,onMatch:null,onResult:null};c=wr(i.ignore,u,r)}let l=(u,d=!1)=>{let{isMatch:f,match:p,output:h}=wr.test(u,o,e,{glob:t,posix:s}),m={glob:t,state:a,regex:o,posix:s,input:u,output:h,match:p,isMatch:f};return typeof i.onResult=="function"&&i.onResult(m),f===!1?(m.isMatch=!1,d?m:!1):c(u)?(typeof i.onIgnore=="function"&&i.onIgnore(m),m.isMatch=!1,d?m:!1):(typeof i.onMatch=="function"&&i.onMatch(m),d?m:!0)};return r&&(l.state=a),l};wr.test=(t,e,r,{glob:n,posix:i}={})=>{if(typeof t!="string")throw new TypeError("Expected input to be a string");if(t==="")return{isMatch:!1,output:""};let s=r||{},o=s.format||(i?BX.toPosixSlashes:null),a=t===n,c=a&&o?o(t):t;return a===!1&&(c=o?o(t):t,a=c===n),(a===!1||s.capture===!0)&&(s.matchBase===!0||s.basename===!0?a=wr.matchBase(t,e,r,i):a=e.exec(c)),{isMatch:!!a,match:a,output:c}};wr.matchBase=(t,e,r,n=BX.isWindows(r))=>(e instanceof RegExp?e:wr.makeRe(e,r)).test(bqt.basename(t));wr.isMatch=(t,e,r)=>wr(e,r)(t);wr.parse=(t,e)=>Array.isArray(t)?t.map(r=>wr.parse(r,e)):qX(t,{...e,fastpaths:!1});wr.scan=(t,e)=>Tqt(t,e);wr.compileRe=(t,e,r=!1,n=!1)=>{if(r===!0)return t.output;let i=e||{},s=i.contains?"":"^",o=i.contains?"":"$",a=`${s}(?:${t.output})${o}`;t&&t.negated===!0&&(a=`^(?!${a}).*$`);let c=wr.toRegex(a,e);return n===!0&&(c.state=t),c};wr.makeRe=(t,e={},r=!1,n=!1)=>{if(!t||typeof t!="string")throw new TypeError("Expected a non-empty string");let i={negated:!1,fastpaths:!0};return e.fastpaths!==!1&&(t[0]==="."||t[0]==="*")&&(i.output=qX.fastpaths(t,e)),i.output||(i=qX(t,e)),wr.compileRe(i,e,r,n)};wr.toRegex=(t,e)=>{try{let r=e||{};return new RegExp(t,r.flags||(r.nocase?"i":""))}catch(r){if(e&&e.debug===!0)throw r;return/$^/}};wr.constants=wqt;Eje.exports=wr});var Tje=E((bjr,bje)=>{"use strict";bje.exports=vje()});var VX=E((Tjr,Ije)=>{"use strict";var Aje=W("util"),Rje=tje(),Ba=Tje(),zX=H0(),wje=t=>t===""||t==="./",xje=t=>{let e=t.indexOf("{");return e>-1&&t.indexOf("}",e)>-1},er=(t,e,r)=>{e=[].concat(e),t=[].concat(t);let n=new Set,i=new Set,s=new Set,o=0,a=u=>{s.add(u.output),r&&r.onResult&&r.onResult(u)};for(let u=0;u<e.length;u++){let d=Ba(String(e[u]),{...r,onResult:a},!0),f=d.state.negated||d.state.negatedExtglob;f&&o++;for(let p of t){let h=d(p,!0);(f?!h.isMatch:h.isMatch)&&(f?n.add(h.output):(n.delete(h.output),i.add(h.output)))}}let l=(o===e.length?[...s]:[...i]).filter(u=>!n.has(u));if(r&&l.length===0){if(r.failglob===!0)throw new Error(`No matches found for "${e.join(", ")}"`);if(r.nonull===!0||r.nullglob===!0)return r.unescape?e.map(u=>u.replace(/\\/g,"")):e}return l};er.match=er;er.matcher=(t,e)=>Ba(t,e);er.isMatch=(t,e,r)=>Ba(e,r)(t);er.any=er.isMatch;er.not=(t,e,r={})=>{e=[].concat(e).map(String);let n=new Set,i=[],s=a=>{r.onResult&&r.onResult(a),i.push(a.output)},o=new Set(er(t,e,{...r,onResult:s}));for(let a of i)o.has(a)||n.add(a);return[...n]};er.contains=(t,e,r)=>{if(typeof t!="string")throw new TypeError(`Expected a string: "${Aje.inspect(t)}"`);if(Array.isArray(e))return e.some(n=>er.contains(t,n,r));if(typeof e=="string"){if(wje(t)||wje(e))return!1;if(t.includes(e)||t.startsWith("./")&&t.slice(2).includes(e))return!0}return er.isMatch(t,e,{...r,contains:!0})};er.matchKeys=(t,e,r)=>{if(!zX.isObject(t))throw new TypeError("Expected the first argument to be an object");let n=er(Object.keys(t),e,r),i={};for(let s of n)i[s]=t[s];return i};er.some=(t,e,r)=>{let n=[].concat(t);for(let i of[].concat(e)){let s=Ba(String(i),r);if(n.some(o=>s(o)))return!0}return!1};er.every=(t,e,r)=>{let n=[].concat(t);for(let i of[].concat(e)){let s=Ba(String(i),r);if(!n.every(o=>s(o)))return!1}return!0};er.all=(t,e,r)=>{if(typeof t!="string")throw new TypeError(`Expected a string: "${Aje.inspect(t)}"`);return[].concat(e).every(n=>Ba(n,r)(t))};er.capture=(t,e,r)=>{let n=zX.isWindows(r),s=Ba.makeRe(String(t),{...r,capture:!0}).exec(n?zX.toPosixSlashes(e):e);if(s)return s.slice(1).map(o=>o===void 0?"":o)};er.makeRe=(...t)=>Ba.makeRe(...t);er.scan=(...t)=>Ba.scan(...t);er.parse=(t,e)=>{let r=[];for(let n of[].concat(t||[]))for(let i of Rje(String(n),e))r.push(Ba.parse(i,e));return r};er.braces=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");return e&&e.nobrace===!0||!xje(t)?[t]:Rje(t,e)};er.braceExpand=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");return er.braces(t,{...e,expand:!0})};er.hasBraces=xje;Ije.exports=er});var Uje=E(je=>{"use strict";Object.defineProperty(je,"__esModule",{value:!0});je.isAbsolute=je.partitionAbsoluteAndRelative=je.removeDuplicateSlashes=je.matchAny=je.convertPatternsToRe=je.makeRe=je.getPatternParts=je.expandBraceExpansion=je.expandPatternsWithBraceExpansion=je.isAffectDepthOfReadingPattern=je.endsWithSlashGlobStar=je.hasGlobStar=je.getBaseDirectory=je.isPatternRelatedToParentDirectory=je.getPatternsOutsideCurrentDirectory=je.getPatternsInsideCurrentDirectory=je.getPositivePatterns=je.getNegativePatterns=je.isPositivePattern=je.isNegativePattern=je.convertToNegativePattern=je.convertToPositivePattern=je.isDynamicPattern=je.isStaticPattern=void 0;var Oje=W("path"),Rqt=SFe(),HX=VX(),Pje="**",xqt="\\",Iqt=/[*?]|^!/,Oqt=/\[[^[]*]/,Pqt=/(?:^|[^!*+?@])\([^(]*\|[^|]*\)/,Cqt=/[!*+?@]\([^(]*\)/,Nqt=/,|\.\./,kqt=/(?!^)\/{2,}/g;function Cje(t,e={}){return!Nje(t,e)}je.isStaticPattern=Cje;function Nje(t,e={}){return t===""?!1:!!(e.caseSensitiveMatch===!1||t.includes(xqt)||Iqt.test(t)||Oqt.test(t)||Pqt.test(t)||e.extglob!==!1&&Cqt.test(t)||e.braceExpansion!==!1&&$qt(t))}je.isDynamicPattern=Nje;function $qt(t){let e=t.indexOf("{");if(e===-1)return!1;let r=t.indexOf("}",e+1);if(r===-1)return!1;let n=t.slice(e,r);return Nqt.test(n)}function Lqt(t){return bM(t)?t.slice(1):t}je.convertToPositivePattern=Lqt;function Dqt(t){return"!"+t}je.convertToNegativePattern=Dqt;function bM(t){return t.startsWith("!")&&t[1]!=="("}je.isNegativePattern=bM;function kje(t){return!bM(t)}je.isPositivePattern=kje;function Mqt(t){return t.filter(bM)}je.getNegativePatterns=Mqt;function Uqt(t){return t.filter(kje)}je.getPositivePatterns=Uqt;function Fqt(t){return t.filter(e=>!GX(e))}je.getPatternsInsideCurrentDirectory=Fqt;function jqt(t){return t.filter(GX)}je.getPatternsOutsideCurrentDirectory=jqt;function GX(t){return t.startsWith("..")||t.startsWith("./..")}je.isPatternRelatedToParentDirectory=GX;function qqt(t){return Rqt(t,{flipBackslashes:!1})}je.getBaseDirectory=qqt;function Bqt(t){return t.includes(Pje)}je.hasGlobStar=Bqt;function $je(t){return t.endsWith("/"+Pje)}je.endsWithSlashGlobStar=$je;function zqt(t){let e=Oje.basename(t);return $je(t)||Cje(e)}je.isAffectDepthOfReadingPattern=zqt;function Vqt(t){return t.reduce((e,r)=>e.concat(Lje(r)),[])}je.expandPatternsWithBraceExpansion=Vqt;function Lje(t){let e=HX.braces(t,{expand:!0,nodupes:!0,keepEscaping:!0});return e.sort((r,n)=>r.length-n.length),e.filter(r=>r!=="")}je.expandBraceExpansion=Lje;function Hqt(t,e){let{parts:r}=HX.scan(t,Object.assign(Object.assign({},e),{parts:!0}));return r.length===0&&(r=[t]),r[0].startsWith("/")&&(r[0]=r[0].slice(1),r.unshift("")),r}je.getPatternParts=Hqt;function Dje(t,e){return HX.makeRe(t,e)}je.makeRe=Dje;function Gqt(t,e){return t.map(r=>Dje(r,e))}je.convertPatternsToRe=Gqt;function Wqt(t,e){return e.some(r=>r.test(t))}je.matchAny=Wqt;function Yqt(t){return t.replace(kqt,"/")}je.removeDuplicateSlashes=Yqt;function Kqt(t){let e=[],r=[];for(let n of t)Mje(n)?e.push(n):r.push(n);return[e,r]}je.partitionAbsoluteAndRelative=Kqt;function Mje(t){return Oje.isAbsolute(t)}je.isAbsolute=Mje});var Bje=E((Ajr,qje)=>{"use strict";var Jqt=W("stream"),Fje=Jqt.PassThrough,Zqt=Array.prototype.slice;qje.exports=Xqt;function Xqt(){let t=[],e=Zqt.call(arguments),r=!1,n=e[e.length-1];n&&!Array.isArray(n)&&n.pipe==null?e.pop():n={};let i=n.end!==!1,s=n.pipeError===!0;n.objectMode==null&&(n.objectMode=!0),n.highWaterMark==null&&(n.highWaterMark=64*1024);let o=Fje(n);function a(){for(let u=0,d=arguments.length;u<d;u++)t.push(jje(arguments[u],n));return c(),this}function c(){if(r)return;r=!0;let u=t.shift();if(!u){process.nextTick(l);return}Array.isArray(u)||(u=[u]);let d=u.length+1;function f(){--d>0||(r=!1,c())}function p(h){function m(){h.removeListener("merge2UnpipeEnd",m),h.removeListener("end",m),s&&h.removeListener("error",_),f()}function _(y){o.emit("error",y)}if(h._readableState.endEmitted)return f();h.on("merge2UnpipeEnd",m),h.on("end",m),s&&h.on("error",_),h.pipe(o,{end:!1}),h.resume()}for(let h=0;h<u.length;h++)p(u[h]);f()}function l(){r=!1,o.emit("queueDrain"),i&&o.end()}return o.setMaxListeners(0),o.add=a,o.on("unpipe",function(u){u.emit("merge2UnpipeEnd")}),e.length&&a.apply(null,e),o}function jje(t,e){if(Array.isArray(t))for(let r=0,n=t.length;r<n;r++)t[r]=jje(t[r],e);else{if(!t._readableState&&t.pipe&&(t=t.pipe(Fje(e))),!t._readableState||!t.pause||!t.pipe)throw new Error("Only readable stream can be merged.");t.pause()}return t}});var Vje=E(TM=>{"use strict";Object.defineProperty(TM,"__esModule",{value:!0});TM.merge=void 0;var Qqt=Bje();function e2t(t){let e=Qqt(t);return t.forEach(r=>{r.once("error",n=>e.emit("error",n))}),e.once("close",()=>zje(t)),e.once("end",()=>zje(t)),e}TM.merge=e2t;function zje(t){t.forEach(e=>e.emit("close"))}});var Hje=E(vS=>{"use strict";Object.defineProperty(vS,"__esModule",{value:!0});vS.isEmpty=vS.isString=void 0;function t2t(t){return typeof t=="string"}vS.isString=t2t;function r2t(t){return t===""}vS.isEmpty=r2t});var yl=E(Mn=>{"use strict";Object.defineProperty(Mn,"__esModule",{value:!0});Mn.string=Mn.stream=Mn.pattern=Mn.path=Mn.fs=Mn.errno=Mn.array=void 0;var n2t=oFe();Mn.array=n2t;var i2t=aFe();Mn.errno=i2t;var s2t=cFe();Mn.fs=s2t;var o2t=fFe();Mn.path=o2t;var a2t=Uje();Mn.pattern=a2t;var c2t=Vje();Mn.stream=c2t;var l2t=Hje();Mn.string=l2t});var Kje=E(Un=>{"use strict";Object.defineProperty(Un,"__esModule",{value:!0});Un.convertPatternGroupToTask=Un.convertPatternGroupsToTasks=Un.groupPatternsByBaseDirectory=Un.getNegativePatternsAsPositive=Un.getPositivePatterns=Un.convertPatternsToTasks=Un.generate=void 0;var Co=yl();function u2t(t,e){let r=Gje(t,e),n=Gje(e.ignore,e),i=Wje(r),s=Yje(r,n),o=i.filter(u=>Co.pattern.isStaticPattern(u,e)),a=i.filter(u=>Co.pattern.isDynamicPattern(u,e)),c=WX(o,s,!1),l=WX(a,s,!0);return c.concat(l)}Un.generate=u2t;function Gje(t,e){let r=t;return e.braceExpansion&&(r=Co.pattern.expandPatternsWithBraceExpansion(r)),e.baseNameMatch&&(r=r.map(n=>n.includes("/")?n:`**/${n}`)),r.map(n=>Co.pattern.removeDuplicateSlashes(n))}function WX(t,e,r){let n=[],i=Co.pattern.getPatternsOutsideCurrentDirectory(t),s=Co.pattern.getPatternsInsideCurrentDirectory(t),o=YX(i),a=YX(s);return n.push(...KX(o,e,r)),"."in a?n.push(JX(".",s,e,r)):n.push(...KX(a,e,r)),n}Un.convertPatternsToTasks=WX;function Wje(t){return Co.pattern.getPositivePatterns(t)}Un.getPositivePatterns=Wje;function Yje(t,e){return Co.pattern.getNegativePatterns(t).concat(e).map(Co.pattern.convertToPositivePattern)}Un.getNegativePatternsAsPositive=Yje;function YX(t){let e={};return t.reduce((r,n)=>{let i=Co.pattern.getBaseDirectory(n);return i in r?r[i].push(n):r[i]=[n],r},e)}Un.groupPatternsByBaseDirectory=YX;function KX(t,e,r){return Object.keys(t).map(n=>JX(n,t[n],e,r))}Un.convertPatternGroupsToTasks=KX;function JX(t,e,r,n){return{dynamic:n,positive:e,negative:r,base:t,patterns:[].concat(e,r.map(Co.pattern.convertToNegativePattern))}}Un.convertPatternGroupToTask=JX});var Zje=E(wM=>{"use strict";Object.defineProperty(wM,"__esModule",{value:!0});wM.read=void 0;function d2t(t,e,r){e.fs.lstat(t,(n,i)=>{if(n!==null){Jje(r,n);return}if(!i.isSymbolicLink()||!e.followSymbolicLink){ZX(r,i);return}e.fs.stat(t,(s,o)=>{if(s!==null){if(e.throwErrorOnBrokenSymbolicLink){Jje(r,s);return}ZX(r,i);return}e.markSymbolicLink&&(o.isSymbolicLink=()=>!0),ZX(r,o)})})}wM.read=d2t;function Jje(t,e){t(e)}function ZX(t,e){t(null,e)}});var Xje=E(AM=>{"use strict";Object.defineProperty(AM,"__esModule",{value:!0});AM.read=void 0;function f2t(t,e){let r=e.fs.lstatSync(t);if(!r.isSymbolicLink()||!e.followSymbolicLink)return r;try{let n=e.fs.statSync(t);return e.markSymbolicLink&&(n.isSymbolicLink=()=>!0),n}catch(n){if(!e.throwErrorOnBrokenSymbolicLink)return r;throw n}}AM.read=f2t});var Qje=E(Ad=>{"use strict";Object.defineProperty(Ad,"__esModule",{value:!0});Ad.createFileSystemAdapter=Ad.FILE_SYSTEM_ADAPTER=void 0;var RM=W("fs");Ad.FILE_SYSTEM_ADAPTER={lstat:RM.lstat,stat:RM.stat,lstatSync:RM.lstatSync,statSync:RM.statSync};function p2t(t){return t===void 0?Ad.FILE_SYSTEM_ADAPTER:Object.assign(Object.assign({},Ad.FILE_SYSTEM_ADAPTER),t)}Ad.createFileSystemAdapter=p2t});var eqe=E(QX=>{"use strict";Object.defineProperty(QX,"__esModule",{value:!0});var h2t=Qje(),XX=class{constructor(e={}){this._options=e,this.followSymbolicLink=this._getValue(this._options.followSymbolicLink,!0),this.fs=h2t.createFileSystemAdapter(this._options.fs),this.markSymbolicLink=this._getValue(this._options.markSymbolicLink,!1),this.throwErrorOnBrokenSymbolicLink=this._getValue(this._options.throwErrorOnBrokenSymbolicLink,!0)}_getValue(e,r){return e??r}};QX.default=XX});var ph=E(Rd=>{"use strict";Object.defineProperty(Rd,"__esModule",{value:!0});Rd.statSync=Rd.stat=Rd.Settings=void 0;var tqe=Zje(),m2t=Xje(),e7=eqe();Rd.Settings=e7.default;function g2t(t,e,r){if(typeof e=="function"){tqe.read(t,t7(),e);return}tqe.read(t,t7(e),r)}Rd.stat=g2t;function _2t(t,e){let r=t7(e);return m2t.read(t,r)}Rd.statSync=_2t;function t7(t={}){return t instanceof e7.default?t:new e7.default(t)}});var iqe=E((Ljr,nqe)=>{"use strict";var rqe;nqe.exports=typeof queueMicrotask=="function"?queueMicrotask.bind(typeof window<"u"?window:global):t=>(rqe||(rqe=Promise.resolve())).then(t).catch(e=>setTimeout(()=>{throw e},0))});var oqe=E((Djr,sqe)=>{"use strict";sqe.exports=S2t;var y2t=iqe();function S2t(t,e){let r,n,i,s=!0;Array.isArray(t)?(r=[],n=t.length):(i=Object.keys(t),r={},n=i.length);function o(c){function l(){e&&e(c,r),e=null}s?y2t(l):l()}function a(c,l,u){r[c]=u,(--n===0||l)&&o(l)}n?i?i.forEach(function(c){t[c](function(l,u){a(c,l,u)})}):t.forEach(function(c,l){c(function(u,d){a(l,u,d)})}):o(null),s=!1}});var r7=E(IM=>{"use strict";Object.defineProperty(IM,"__esModule",{value:!0});IM.IS_SUPPORT_READDIR_WITH_FILE_TYPES=void 0;var xM=process.versions.node.split(".");if(xM[0]===void 0||xM[1]===void 0)throw new Error(`Unexpected behavior. The 'process.versions.node' variable has invalid value: ${process.versions.node}`);var aqe=Number.parseInt(xM[0],10),E2t=Number.parseInt(xM[1],10),cqe=10,v2t=10,b2t=aqe>cqe,T2t=aqe===cqe&&E2t>=v2t;IM.IS_SUPPORT_READDIR_WITH_FILE_TYPES=b2t||T2t});var lqe=E(OM=>{"use strict";Object.defineProperty(OM,"__esModule",{value:!0});OM.createDirentFromStats=void 0;var n7=class{constructor(e,r){this.name=e,this.isBlockDevice=r.isBlockDevice.bind(r),this.isCharacterDevice=r.isCharacterDevice.bind(r),this.isDirectory=r.isDirectory.bind(r),this.isFIFO=r.isFIFO.bind(r),this.isFile=r.isFile.bind(r),this.isSocket=r.isSocket.bind(r),this.isSymbolicLink=r.isSymbolicLink.bind(r)}};function w2t(t,e){return new n7(t,e)}OM.createDirentFromStats=w2t});var i7=E(PM=>{"use strict";Object.defineProperty(PM,"__esModule",{value:!0});PM.fs=void 0;var A2t=lqe();PM.fs=A2t});var s7=E(CM=>{"use strict";Object.defineProperty(CM,"__esModule",{value:!0});CM.joinPathSegments=void 0;function R2t(t,e,r){return t.endsWith(r)?t+e:t+r+e}CM.joinPathSegments=R2t});var mqe=E(xd=>{"use strict";Object.defineProperty(xd,"__esModule",{value:!0});xd.readdir=xd.readdirWithFileTypes=xd.read=void 0;var x2t=ph(),uqe=oqe(),I2t=r7(),dqe=i7(),fqe=s7();function O2t(t,e,r){if(!e.stats&&I2t.IS_SUPPORT_READDIR_WITH_FILE_TYPES){pqe(t,e,r);return}hqe(t,e,r)}xd.read=O2t;function pqe(t,e,r){e.fs.readdir(t,{withFileTypes:!0},(n,i)=>{if(n!==null){NM(r,n);return}let s=i.map(a=>({dirent:a,name:a.name,path:fqe.joinPathSegments(t,a.name,e.pathSegmentSeparator)}));if(!e.followSymbolicLinks){o7(r,s);return}let o=s.map(a=>P2t(a,e));uqe(o,(a,c)=>{if(a!==null){NM(r,a);return}o7(r,c)})})}xd.readdirWithFileTypes=pqe;function P2t(t,e){return r=>{if(!t.dirent.isSymbolicLink()){r(null,t);return}e.fs.stat(t.path,(n,i)=>{if(n!==null){if(e.throwErrorOnBrokenSymbolicLink){r(n);return}r(null,t);return}t.dirent=dqe.fs.createDirentFromStats(t.name,i),r(null,t)})}}function hqe(t,e,r){e.fs.readdir(t,(n,i)=>{if(n!==null){NM(r,n);return}let s=i.map(o=>{let a=fqe.joinPathSegments(t,o,e.pathSegmentSeparator);return c=>{x2t.stat(a,e.fsStatSettings,(l,u)=>{if(l!==null){c(l);return}let d={name:o,path:a,dirent:dqe.fs.createDirentFromStats(o,u)};e.stats&&(d.stats=u),c(null,d)})}});uqe(s,(o,a)=>{if(o!==null){NM(r,o);return}o7(r,a)})})}xd.readdir=hqe;function NM(t,e){t(e)}function o7(t,e){t(null,e)}});var Eqe=E(Id=>{"use strict";Object.defineProperty(Id,"__esModule",{value:!0});Id.readdir=Id.readdirWithFileTypes=Id.read=void 0;var C2t=ph(),N2t=r7(),gqe=i7(),_qe=s7();function k2t(t,e){return!e.stats&&N2t.IS_SUPPORT_READDIR_WITH_FILE_TYPES?yqe(t,e):Sqe(t,e)}Id.read=k2t;function yqe(t,e){return e.fs.readdirSync(t,{withFileTypes:!0}).map(n=>{let i={dirent:n,name:n.name,path:_qe.joinPathSegments(t,n.name,e.pathSegmentSeparator)};if(i.dirent.isSymbolicLink()&&e.followSymbolicLinks)try{let s=e.fs.statSync(i.path);i.dirent=gqe.fs.createDirentFromStats(i.name,s)}catch(s){if(e.throwErrorOnBrokenSymbolicLink)throw s}return i})}Id.readdirWithFileTypes=yqe;function Sqe(t,e){return e.fs.readdirSync(t).map(n=>{let i=_qe.joinPathSegments(t,n,e.pathSegmentSeparator),s=C2t.statSync(i,e.fsStatSettings),o={name:n,path:i,dirent:gqe.fs.createDirentFromStats(n,s)};return e.stats&&(o.stats=s),o})}Id.readdir=Sqe});var vqe=E(Od=>{"use strict";Object.defineProperty(Od,"__esModule",{value:!0});Od.createFileSystemAdapter=Od.FILE_SYSTEM_ADAPTER=void 0;var bS=W("fs");Od.FILE_SYSTEM_ADAPTER={lstat:bS.lstat,stat:bS.stat,lstatSync:bS.lstatSync,statSync:bS.statSync,readdir:bS.readdir,readdirSync:bS.readdirSync};function $2t(t){return t===void 0?Od.FILE_SYSTEM_ADAPTER:Object.assign(Object.assign({},Od.FILE_SYSTEM_ADAPTER),t)}Od.createFileSystemAdapter=$2t});var bqe=E(c7=>{"use strict";Object.defineProperty(c7,"__esModule",{value:!0});var L2t=W("path"),D2t=ph(),M2t=vqe(),a7=class{constructor(e={}){this._options=e,this.followSymbolicLinks=this._getValue(this._options.followSymbolicLinks,!1),this.fs=M2t.createFileSystemAdapter(this._options.fs),this.pathSegmentSeparator=this._getValue(this._options.pathSegmentSeparator,L2t.sep),this.stats=this._getValue(this._options.stats,!1),this.throwErrorOnBrokenSymbolicLink=this._getValue(this._options.throwErrorOnBrokenSymbolicLink,!0),this.fsStatSettings=new D2t.Settings({followSymbolicLink:this.followSymbolicLinks,fs:this.fs,throwErrorOnBrokenSymbolicLink:this.throwErrorOnBrokenSymbolicLink})}_getValue(e,r){return e??r}};c7.default=a7});var kM=E(Pd=>{"use strict";Object.defineProperty(Pd,"__esModule",{value:!0});Pd.Settings=Pd.scandirSync=Pd.scandir=void 0;var Tqe=mqe(),U2t=Eqe(),l7=bqe();Pd.Settings=l7.default;function F2t(t,e,r){if(typeof e=="function"){Tqe.read(t,u7(),e);return}Tqe.read(t,u7(e),r)}Pd.scandir=F2t;function j2t(t,e){let r=u7(e);return U2t.read(t,r)}Pd.scandirSync=j2t;function u7(t={}){return t instanceof l7.default?t:new l7.default(t)}});var $M=E(za=>{"use strict";Object.defineProperty(za,"__esModule",{value:!0});za.joinPathSegments=za.replacePathSegmentSeparator=za.isAppliedFilter=za.isFatalError=void 0;function q2t(t,e){return t.errorFilter===null?!0:!t.errorFilter(e)}za.isFatalError=q2t;function B2t(t,e){return t===null||t(e)}za.isAppliedFilter=B2t;function z2t(t,e){return t.split(/[/\\]/).join(e)}za.replacePathSegmentSeparator=z2t;function V2t(t,e,r){return t===""?e:t.endsWith(r)?t+e:t+r+e}za.joinPathSegments=V2t});var p7=E(f7=>{"use strict";Object.defineProperty(f7,"__esModule",{value:!0});var H2t=$M(),d7=class{constructor(e,r){this._root=e,this._settings=r,this._root=H2t.replacePathSegmentSeparator(e,r.pathSegmentSeparator)}};f7.default=d7});var g7=E(m7=>{"use strict";Object.defineProperty(m7,"__esModule",{value:!0});var G2t=W("events"),W2t=kM(),Y2t=H1(),LM=$M(),K2t=p7(),h7=class extends K2t.default{constructor(e,r){super(e,r),this._settings=r,this._scandir=W2t.scandir,this._emitter=new G2t.EventEmitter,this._queue=Y2t(this._worker.bind(this),this._settings.concurrency),this._isFatalError=!1,this._isDestroyed=!1,this._queue.drain=()=>{this._isFatalError||this._emitter.emit("end")}}read(){return this._isFatalError=!1,this._isDestroyed=!1,setImmediate(()=>{this._pushToQueue(this._root,this._settings.basePath)}),this._emitter}get isDestroyed(){return this._isDestroyed}destroy(){if(this._isDestroyed)throw new Error("The reader is already destroyed");this._isDestroyed=!0,this._queue.killAndDrain()}onEntry(e){this._emitter.on("entry",e)}onError(e){this._emitter.once("error",e)}onEnd(e){this._emitter.once("end",e)}_pushToQueue(e,r){let n={directory:e,base:r};this._queue.push(n,i=>{i!==null&&this._handleError(i)})}_worker(e,r){this._scandir(e.directory,this._settings.fsScandirSettings,(n,i)=>{if(n!==null){r(n,void 0);return}for(let s of i)this._handleEntry(s,e.base);r(null,void 0)})}_handleError(e){this._isDestroyed||!LM.isFatalError(this._settings,e)||(this._isFatalError=!0,this._isDestroyed=!0,this._emitter.emit("error",e))}_handleEntry(e,r){if(this._isDestroyed||this._isFatalError)return;let n=e.path;r!==void 0&&(e.path=LM.joinPathSegments(r,e.name,this._settings.pathSegmentSeparator)),LM.isAppliedFilter(this._settings.entryFilter,e)&&this._emitEntry(e),e.dirent.isDirectory()&&LM.isAppliedFilter(this._settings.deepFilter,e)&&this._pushToQueue(n,r===void 0?void 0:e.path)}_emitEntry(e){this._emitter.emit("entry",e)}};m7.default=h7});var wqe=E(y7=>{"use strict";Object.defineProperty(y7,"__esModule",{value:!0});var J2t=g7(),_7=class{constructor(e,r){this._root=e,this._settings=r,this._reader=new J2t.default(this._root,this._settings),this._storage=[]}read(e){this._reader.onError(r=>{Z2t(e,r)}),this._reader.onEntry(r=>{this._storage.push(r)}),this._reader.onEnd(()=>{X2t(e,this._storage)}),this._reader.read()}};y7.default=_7;function Z2t(t,e){t(e)}function X2t(t,e){t(null,e)}});var Aqe=E(E7=>{"use strict";Object.defineProperty(E7,"__esModule",{value:!0});var Q2t=W("stream"),eBt=g7(),S7=class{constructor(e,r){this._root=e,this._settings=r,this._reader=new eBt.default(this._root,this._settings),this._stream=new Q2t.Readable({objectMode:!0,read:()=>{},destroy:()=>{this._reader.isDestroyed||this._reader.destroy()}})}read(){return this._reader.onError(e=>{this._stream.emit("error",e)}),this._reader.onEntry(e=>{this._stream.push(e)}),this._reader.onEnd(()=>{this._stream.push(null)}),this._reader.read(),this._stream}};E7.default=S7});var Rqe=E(b7=>{"use strict";Object.defineProperty(b7,"__esModule",{value:!0});var tBt=kM(),DM=$M(),rBt=p7(),v7=class extends rBt.default{constructor(){super(...arguments),this._scandir=tBt.scandirSync,this._storage=[],this._queue=new Set}read(){return this._pushToQueue(this._root,this._settings.basePath),this._handleQueue(),this._storage}_pushToQueue(e,r){this._queue.add({directory:e,base:r})}_handleQueue(){for(let e of this._queue.values())this._handleDirectory(e.directory,e.base)}_handleDirectory(e,r){try{let n=this._scandir(e,this._settings.fsScandirSettings);for(let i of n)this._handleEntry(i,r)}catch(n){this._handleError(n)}}_handleError(e){if(DM.isFatalError(this._settings,e))throw e}_handleEntry(e,r){let n=e.path;r!==void 0&&(e.path=DM.joinPathSegments(r,e.name,this._settings.pathSegmentSeparator)),DM.isAppliedFilter(this._settings.entryFilter,e)&&this._pushToStorage(e),e.dirent.isDirectory()&&DM.isAppliedFilter(this._settings.deepFilter,e)&&this._pushToQueue(n,r===void 0?void 0:e.path)}_pushToStorage(e){this._storage.push(e)}};b7.default=v7});var xqe=E(w7=>{"use strict";Object.defineProperty(w7,"__esModule",{value:!0});var nBt=Rqe(),T7=class{constructor(e,r){this._root=e,this._settings=r,this._reader=new nBt.default(this._root,this._settings)}read(){return this._reader.read()}};w7.default=T7});var Iqe=E(R7=>{"use strict";Object.defineProperty(R7,"__esModule",{value:!0});var iBt=W("path"),sBt=kM(),A7=class{constructor(e={}){this._options=e,this.basePath=this._getValue(this._options.basePath,void 0),this.concurrency=this._getValue(this._options.concurrency,Number.POSITIVE_INFINITY),this.deepFilter=this._getValue(this._options.deepFilter,null),this.entryFilter=this._getValue(this._options.entryFilter,null),this.errorFilter=this._getValue(this._options.errorFilter,null),this.pathSegmentSeparator=this._getValue(this._options.pathSegmentSeparator,iBt.sep),this.fsScandirSettings=new sBt.Settings({followSymbolicLinks:this._options.followSymbolicLinks,fs:this._options.fs,pathSegmentSeparator:this._options.pathSegmentSeparator,stats:this._options.stats,throwErrorOnBrokenSymbolicLink:this._options.throwErrorOnBrokenSymbolicLink})}_getValue(e,r){return e??r}};R7.default=A7});var UM=E(Va=>{"use strict";Object.defineProperty(Va,"__esModule",{value:!0});Va.Settings=Va.walkStream=Va.walkSync=Va.walk=void 0;var Oqe=wqe(),oBt=Aqe(),aBt=xqe(),x7=Iqe();Va.Settings=x7.default;function cBt(t,e,r){if(typeof e=="function"){new Oqe.default(t,MM()).read(e);return}new Oqe.default(t,MM(e)).read(r)}Va.walk=cBt;function lBt(t,e){let r=MM(e);return new aBt.default(t,r).read()}Va.walkSync=lBt;function uBt(t,e){let r=MM(e);return new oBt.default(t,r).read()}Va.walkStream=uBt;function MM(t={}){return t instanceof x7.default?t:new x7.default(t)}});var FM=E(O7=>{"use strict";Object.defineProperty(O7,"__esModule",{value:!0});var dBt=W("path"),fBt=ph(),Pqe=yl(),I7=class{constructor(e){this._settings=e,this._fsStatSettings=new fBt.Settings({followSymbolicLink:this._settings.followSymbolicLinks,fs:this._settings.fs,throwErrorOnBrokenSymbolicLink:this._settings.followSymbolicLinks})}_getFullEntryPath(e){return dBt.resolve(this._settings.cwd,e)}_makeEntry(e,r){let n={name:r,path:r,dirent:Pqe.fs.createDirentFromStats(r,e)};return this._settings.stats&&(n.stats=e),n}_isFatalError(e){return!Pqe.errno.isEnoentCodeError(e)&&!this._settings.suppressErrors}};O7.default=I7});var N7=E(C7=>{"use strict";Object.defineProperty(C7,"__esModule",{value:!0});var pBt=W("stream"),hBt=ph(),mBt=UM(),gBt=FM(),P7=class extends gBt.default{constructor(){super(...arguments),this._walkStream=mBt.walkStream,this._stat=hBt.stat}dynamic(e,r){return this._walkStream(e,r)}static(e,r){let n=e.map(this._getFullEntryPath,this),i=new pBt.PassThrough({objectMode:!0});i._write=(s,o,a)=>this._getEntry(n[s],e[s],r).then(c=>{c!==null&&r.entryFilter(c)&&i.push(c),s===n.length-1&&i.end(),a()}).catch(a);for(let s=0;s<n.length;s++)i.write(s);return i}_getEntry(e,r,n){return this._getStat(e).then(i=>this._makeEntry(i,r)).catch(i=>{if(n.errorFilter(i))return null;throw i})}_getStat(e){return new Promise((r,n)=>{this._stat(e,this._fsStatSettings,(i,s)=>i===null?r(s):n(i))})}};C7.default=P7});var Cqe=E($7=>{"use strict";Object.defineProperty($7,"__esModule",{value:!0});var _Bt=UM(),yBt=FM(),SBt=N7(),k7=class extends yBt.default{constructor(){super(...arguments),this._walkAsync=_Bt.walk,this._readerStream=new SBt.default(this._settings)}dynamic(e,r){return new Promise((n,i)=>{this._walkAsync(e,r,(s,o)=>{s===null?n(o):i(s)})})}async static(e,r){let n=[],i=this._readerStream.static(e,r);return new Promise((s,o)=>{i.once("error",o),i.on("data",a=>n.push(a)),i.once("end",()=>s(n))})}};$7.default=k7});var Nqe=E(D7=>{"use strict";Object.defineProperty(D7,"__esModule",{value:!0});var Y0=yl(),L7=class{constructor(e,r,n){this._patterns=e,this._settings=r,this._micromatchOptions=n,this._storage=[],this._fillStorage()}_fillStorage(){for(let e of this._patterns){let r=this._getPatternSegments(e),n=this._splitSegmentsIntoSections(r);this._storage.push({complete:n.length<=1,pattern:e,segments:r,sections:n})}}_getPatternSegments(e){return Y0.pattern.getPatternParts(e,this._micromatchOptions).map(n=>Y0.pattern.isDynamicPattern(n,this._settings)?{dynamic:!0,pattern:n,patternRe:Y0.pattern.makeRe(n,this._micromatchOptions)}:{dynamic:!1,pattern:n})}_splitSegmentsIntoSections(e){return Y0.array.splitWhen(e,r=>r.dynamic&&Y0.pattern.hasGlobStar(r.pattern))}};D7.default=L7});var kqe=E(U7=>{"use strict";Object.defineProperty(U7,"__esModule",{value:!0});var EBt=Nqe(),M7=class extends EBt.default{match(e){let r=e.split("/"),n=r.length,i=this._storage.filter(s=>!s.complete||s.segments.length>n);for(let s of i){let o=s.sections[0];if(!s.complete&&n>o.length||r.every((c,l)=>{let u=s.segments[l];return!!(u.dynamic&&u.patternRe.test(c)||!u.dynamic&&u.pattern===c)}))return!0}return!1}};U7.default=M7});var $qe=E(j7=>{"use strict";Object.defineProperty(j7,"__esModule",{value:!0});var jM=yl(),vBt=kqe(),F7=class{constructor(e,r){this._settings=e,this._micromatchOptions=r}getFilter(e,r,n){let i=this._getMatcher(r),s=this._getNegativePatternsRe(n);return o=>this._filter(e,o,i,s)}_getMatcher(e){return new vBt.default(e,this._settings,this._micromatchOptions)}_getNegativePatternsRe(e){let r=e.filter(jM.pattern.isAffectDepthOfReadingPattern);return jM.pattern.convertPatternsToRe(r,this._micromatchOptions)}_filter(e,r,n,i){if(this._isSkippedByDeep(e,r.path)||this._isSkippedSymbolicLink(r))return!1;let s=jM.path.removeLeadingDotSegment(r.path);return this._isSkippedByPositivePatterns(s,n)?!1:this._isSkippedByNegativePatterns(s,i)}_isSkippedByDeep(e,r){return this._settings.deep===1/0?!1:this._getEntryLevel(e,r)>=this._settings.deep}_getEntryLevel(e,r){let n=r.split("/").length;if(e==="")return n;let i=e.split("/").length;return n-i}_isSkippedSymbolicLink(e){return!this._settings.followSymbolicLinks&&e.dirent.isSymbolicLink()}_isSkippedByPositivePatterns(e,r){return!this._settings.baseNameMatch&&!r.match(e)}_isSkippedByNegativePatterns(e,r){return!jM.pattern.matchAny(e,r)}};j7.default=F7});var Lqe=E(B7=>{"use strict";Object.defineProperty(B7,"__esModule",{value:!0});var Cd=yl(),q7=class{constructor(e,r){this._settings=e,this._micromatchOptions=r,this.index=new Map}getFilter(e,r){let[n,i]=Cd.pattern.partitionAbsoluteAndRelative(r),s={positive:{all:Cd.pattern.convertPatternsToRe(e,this._micromatchOptions)},negative:{absolute:Cd.pattern.convertPatternsToRe(n,Object.assign(Object.assign({},this._micromatchOptions),{dot:!0})),relative:Cd.pattern.convertPatternsToRe(i,Object.assign(Object.assign({},this._micromatchOptions),{dot:!0}))}};return o=>this._filter(o,s)}_filter(e,r){let n=Cd.path.removeLeadingDotSegment(e.path);if(this._settings.unique&&this._isDuplicateEntry(n)||this._onlyFileFilter(e)||this._onlyDirectoryFilter(e))return!1;let i=this._isMatchToPatternsSet(n,r,e.dirent.isDirectory());return this._settings.unique&&i&&this._createIndexRecord(n),i}_isDuplicateEntry(e){return this.index.has(e)}_createIndexRecord(e){this.index.set(e,void 0)}_onlyFileFilter(e){return this._settings.onlyFiles&&!e.dirent.isFile()}_onlyDirectoryFilter(e){return this._settings.onlyDirectories&&!e.dirent.isDirectory()}_isMatchToPatternsSet(e,r,n){return!(!this._isMatchToPatterns(e,r.positive.all,n)||this._isMatchToPatterns(e,r.negative.relative,n)||this._isMatchToAbsoluteNegative(e,r.negative.absolute,n))}_isMatchToAbsoluteNegative(e,r,n){if(r.length===0)return!1;let i=Cd.path.makeAbsolute(this._settings.cwd,e);return this._isMatchToPatterns(i,r,n)}_isMatchToPatterns(e,r,n){if(r.length===0)return!1;let i=Cd.pattern.matchAny(e,r);return!i&&n?Cd.pattern.matchAny(e+"/",r):i}};B7.default=q7});var Dqe=E(V7=>{"use strict";Object.defineProperty(V7,"__esModule",{value:!0});var bBt=yl(),z7=class{constructor(e){this._settings=e}getFilter(){return e=>this._isNonFatalError(e)}_isNonFatalError(e){return bBt.errno.isEnoentCodeError(e)||this._settings.suppressErrors}};V7.default=z7});var Uqe=E(G7=>{"use strict";Object.defineProperty(G7,"__esModule",{value:!0});var Mqe=yl(),H7=class{constructor(e){this._settings=e}getTransformer(){return e=>this._transform(e)}_transform(e){let r=e.path;return this._settings.absolute&&(r=Mqe.path.makeAbsolute(this._settings.cwd,r),r=Mqe.path.unixify(r)),this._settings.markDirectories&&e.dirent.isDirectory()&&(r+="/"),this._settings.objectMode?Object.assign(Object.assign({},e),{path:r}):r}};G7.default=H7});var qM=E(Y7=>{"use strict";Object.defineProperty(Y7,"__esModule",{value:!0});var TBt=W("path"),wBt=$qe(),ABt=Lqe(),RBt=Dqe(),xBt=Uqe(),W7=class{constructor(e){this._settings=e,this.errorFilter=new RBt.default(this._settings),this.entryFilter=new ABt.default(this._settings,this._getMicromatchOptions()),this.deepFilter=new wBt.default(this._settings,this._getMicromatchOptions()),this.entryTransformer=new xBt.default(this._settings)}_getRootDirectory(e){return TBt.resolve(this._settings.cwd,e.base)}_getReaderOptions(e){let r=e.base==="."?"":e.base;return{basePath:r,pathSegmentSeparator:"/",concurrency:this._settings.concurrency,deepFilter:this.deepFilter.getFilter(r,e.positive,e.negative),entryFilter:this.entryFilter.getFilter(e.positive,e.negative),errorFilter:this.errorFilter.getFilter(),followSymbolicLinks:this._settings.followSymbolicLinks,fs:this._settings.fs,stats:this._settings.stats,throwErrorOnBrokenSymbolicLink:this._settings.throwErrorOnBrokenSymbolicLink,transform:this.entryTransformer.getTransformer()}}_getMicromatchOptions(){return{dot:this._settings.dot,matchBase:this._settings.baseNameMatch,nobrace:!this._settings.braceExpansion,nocase:!this._settings.caseSensitiveMatch,noext:!this._settings.extglob,noglobstar:!this._settings.globstar,posix:!0,strictSlashes:!1}}};Y7.default=W7});var Fqe=E(J7=>{"use strict";Object.defineProperty(J7,"__esModule",{value:!0});var IBt=Cqe(),OBt=qM(),K7=class extends OBt.default{constructor(){super(...arguments),this._reader=new IBt.default(this._settings)}async read(e){let r=this._getRootDirectory(e),n=this._getReaderOptions(e);return(await this.api(r,e,n)).map(s=>n.transform(s))}api(e,r,n){return r.dynamic?this._reader.dynamic(e,n):this._reader.static(r.patterns,n)}};J7.default=K7});var jqe=E(X7=>{"use strict";Object.defineProperty(X7,"__esModule",{value:!0});var PBt=W("stream"),CBt=N7(),NBt=qM(),Z7=class extends NBt.default{constructor(){super(...arguments),this._reader=new CBt.default(this._settings)}read(e){let r=this._getRootDirectory(e),n=this._getReaderOptions(e),i=this.api(r,e,n),s=new PBt.Readable({objectMode:!0,read:()=>{}});return i.once("error",o=>s.emit("error",o)).on("data",o=>s.emit("data",n.transform(o))).once("end",()=>s.emit("end")),s.once("close",()=>i.destroy()),s}api(e,r,n){return r.dynamic?this._reader.dynamic(e,n):this._reader.static(r.patterns,n)}};X7.default=Z7});var qqe=E(eQ=>{"use strict";Object.defineProperty(eQ,"__esModule",{value:!0});var kBt=ph(),$Bt=UM(),LBt=FM(),Q7=class extends LBt.default{constructor(){super(...arguments),this._walkSync=$Bt.walkSync,this._statSync=kBt.statSync}dynamic(e,r){return this._walkSync(e,r)}static(e,r){let n=[];for(let i of e){let s=this._getFullEntryPath(i),o=this._getEntry(s,i,r);o===null||!r.entryFilter(o)||n.push(o)}return n}_getEntry(e,r,n){try{let i=this._getStat(e);return this._makeEntry(i,r)}catch(i){if(n.errorFilter(i))return null;throw i}}_getStat(e){return this._statSync(e,this._fsStatSettings)}};eQ.default=Q7});var Bqe=E(rQ=>{"use strict";Object.defineProperty(rQ,"__esModule",{value:!0});var DBt=qqe(),MBt=qM(),tQ=class extends MBt.default{constructor(){super(...arguments),this._reader=new DBt.default(this._settings)}read(e){let r=this._getRootDirectory(e),n=this._getReaderOptions(e);return this.api(r,e,n).map(n.transform)}api(e,r,n){return r.dynamic?this._reader.dynamic(e,n):this._reader.static(r.patterns,n)}};rQ.default=tQ});var zqe=E(wS=>{"use strict";Object.defineProperty(wS,"__esModule",{value:!0});wS.DEFAULT_FILE_SYSTEM_ADAPTER=void 0;var TS=W("fs"),UBt=W("os"),FBt=Math.max(UBt.cpus().length,1);wS.DEFAULT_FILE_SYSTEM_ADAPTER={lstat:TS.lstat,lstatSync:TS.lstatSync,stat:TS.stat,statSync:TS.statSync,readdir:TS.readdir,readdirSync:TS.readdirSync};var nQ=class{constructor(e={}){this._options=e,this.absolute=this._getValue(this._options.absolute,!1),this.baseNameMatch=this._getValue(this._options.baseNameMatch,!1),this.braceExpansion=this._getValue(this._options.braceExpansion,!0),this.caseSensitiveMatch=this._getValue(this._options.caseSensitiveMatch,!0),this.concurrency=this._getValue(this._options.concurrency,FBt),this.cwd=this._getValue(this._options.cwd,process.cwd()),this.deep=this._getValue(this._options.deep,1/0),this.dot=this._getValue(this._options.dot,!1),this.extglob=this._getValue(this._options.extglob,!0),this.followSymbolicLinks=this._getValue(this._options.followSymbolicLinks,!0),this.fs=this._getFileSystemMethods(this._options.fs),this.globstar=this._getValue(this._options.globstar,!0),this.ignore=this._getValue(this._options.ignore,[]),this.markDirectories=this._getValue(this._options.markDirectories,!1),this.objectMode=this._getValue(this._options.objectMode,!1),this.onlyDirectories=this._getValue(this._options.onlyDirectories,!1),this.onlyFiles=this._getValue(this._options.onlyFiles,!0),this.stats=this._getValue(this._options.stats,!1),this.suppressErrors=this._getValue(this._options.suppressErrors,!1),this.throwErrorOnBrokenSymbolicLink=this._getValue(this._options.throwErrorOnBrokenSymbolicLink,!1),this.unique=this._getValue(this._options.unique,!0),this.onlyDirectories&&(this.onlyFiles=!1),this.stats&&(this.objectMode=!0),this.ignore=[].concat(this.ignore)}_getValue(e,r){return e===void 0?r:e}_getFileSystemMethods(e={}){return Object.assign(Object.assign({},wS.DEFAULT_FILE_SYSTEM_ADAPTER),e)}};wS.default=nQ});var K0=E((gqr,Hqe)=>{"use strict";var Vqe=Kje(),jBt=Fqe(),qBt=jqe(),BBt=Bqe(),iQ=zqe(),Us=yl();async function sQ(t,e){No(t);let r=oQ(t,jBt.default,e),n=await Promise.all(r);return Us.array.flatten(n)}(function(t){t.glob=t,t.globSync=e,t.globStream=r,t.async=t;function e(l,u){No(l);let d=oQ(l,BBt.default,u);return Us.array.flatten(d)}t.sync=e;function r(l,u){No(l);let d=oQ(l,qBt.default,u);return Us.stream.merge(d)}t.stream=r;function n(l,u){No(l);let d=[].concat(l),f=new iQ.default(u);return Vqe.generate(d,f)}t.generateTasks=n;function i(l,u){No(l);let d=new iQ.default(u);return Us.pattern.isDynamicPattern(l,d)}t.isDynamicPattern=i;function s(l){return No(l),Us.path.escape(l)}t.escapePath=s;function o(l){return No(l),Us.path.convertPathToPattern(l)}t.convertPathToPattern=o;let a;(function(l){function u(f){return No(f),Us.path.escapePosixPath(f)}l.escapePath=u;function d(f){return No(f),Us.path.convertPosixPathToPattern(f)}l.convertPathToPattern=d})(a=t.posix||(t.posix={}));let c;(function(l){function u(f){return No(f),Us.path.escapeWindowsPath(f)}l.escapePath=u;function d(f){return No(f),Us.path.convertWindowsPathToPattern(f)}l.convertPathToPattern=d})(c=t.win32||(t.win32={}))})(sQ||(sQ={}));function oQ(t,e,r){let n=[].concat(t),i=new iQ.default(r),s=Vqe.generate(n,i),o=new e(i);return s.map(o.read,o)}function No(t){if(![].concat(t).every(n=>Us.string.isString(n)&&!Us.string.isEmpty(n)))throw new TypeError("Patterns must be a string (non empty) or an array of strings")}Hqe.exports=sQ});var mQ=E((wqr,VM)=>{"use strict";function Jqe(t){return Array.isArray(t)?t:[t]}var HBt=void 0,uQ="",Yqe=" ",lQ="\\",GBt=/^\s+$/,WBt=/(?:[^\\]|^)\\$/,YBt=/^\\!/,KBt=/^\\#/,JBt=/\r?\n/g,ZBt=/^\.{0,2}\/|^\.{1,2}$/,XBt=/\/$/,AS="/",Zqe="node-ignore";typeof Symbol<"u"&&(Zqe=Symbol.for("node-ignore"));var Xqe=Zqe,RS=(t,e,r)=>(Object.defineProperty(t,e,{value:r}),r),QBt=/([0-z])-([0-z])/g,Qqe=()=>!1,ezt=t=>t.replace(QBt,(e,r,n)=>r.charCodeAt(0)<=n.charCodeAt(0)?e:uQ),tzt=t=>{let{length:e}=t;return t.slice(0,e-e%2)},rzt=[[/^\uFEFF/,()=>uQ],[/((?:\\\\)*?)(\\?\s+)$/,(t,e,r)=>e+(r.indexOf("\\")===0?Yqe:uQ)],[/(\\+?)\s/g,(t,e)=>{let{length:r}=e;return e.slice(0,r-r%2)+Yqe}],[/[\\$.|*+(){^]/g,t=>`\\${t}`],[/(?!\\)\?/g,()=>"[^/]"],[/^\//,()=>"^"],[/\//g,()=>"\\/"],[/^\^*\\\*\\\*\\\//,()=>"^(?:.*\\/)?"],[/^(?=[^^])/,function(){return/\/(?!$)/.test(this)?"^":"(?:^|\\/)"}],[/\\\/\\\*\\\*(?=\\\/|$)/g,(t,e,r)=>e+6<r.length?"(?:\\/[^\\/]+)*":"\\/.+"],[/(^|[^\\]+)(\\\*)+(?=.+)/g,(t,e,r)=>{let n=r.replace(/\\\*/g,"[^\\/]*");return e+n}],[/\\\\\\(?=[$.|*+(){^])/g,()=>lQ],[/\\\\/g,()=>lQ],[/(\\)?\[([^\]/]*?)(\\*)($|\])/g,(t,e,r,n,i)=>e===lQ?`\\[${r}${tzt(n)}${i}`:i==="]"&&n.length%2===0?`[${ezt(r)}${n}]`:"[]"],[/(?:[^*])$/,t=>/\/$/.test(t)?`${t}$`:`${t}(?=$|\\/$)`]],nzt=/(^|\\\/)?\\\*$/,J0="regex",BM="checkRegex",Kqe="_",izt={[J0](t,e){return`${e?`${e}[^/]+`:"[^/]*"}(?=$|\\/$)`},[BM](t,e){return`${e?`${e}[^/]*`:"[^/]*"}(?=$|\\/$)`}},szt=t=>rzt.reduce((e,[r,n])=>e.replace(r,n.bind(t)),t),zM=t=>typeof t=="string",ozt=t=>t&&zM(t)&&!GBt.test(t)&&!WBt.test(t)&&t.indexOf("#")!==0,azt=t=>t.split(JBt).filter(Boolean),dQ=class{constructor(e,r,n,i,s,o){this.pattern=e,this.mark=r,this.negative=s,RS(this,"body",n),RS(this,"ignoreCase",i),RS(this,"regexPrefix",o)}get regex(){let e=Kqe+J0;return this[e]?this[e]:this._make(J0,e)}get checkRegex(){let e=Kqe+BM;return this[e]?this[e]:this._make(BM,e)}_make(e,r){let n=this.regexPrefix.replace(nzt,izt[e]),i=this.ignoreCase?new RegExp(n,"i"):new RegExp(n);return RS(this,r,i)}},czt=({pattern:t,mark:e},r)=>{let n=!1,i=t;i.indexOf("!")===0&&(n=!0,i=i.substr(1)),i=i.replace(YBt,"!").replace(KBt,"#");let s=szt(i);return new dQ(t,e,i,r,n,s)},fQ=class{constructor(e){this._ignoreCase=e,this._rules=[]}_add(e){if(e&&e[Xqe]){this._rules=this._rules.concat(e._rules._rules),this._added=!0;return}if(zM(e)&&(e={pattern:e}),ozt(e.pattern)){let r=czt(e,this._ignoreCase);this._added=!0,this._rules.push(r)}}add(e){return this._added=!1,Jqe(zM(e)?azt(e):e).forEach(this._add,this),this._added}test(e,r,n){let i=!1,s=!1,o;this._rules.forEach(c=>{let{negative:l}=c;s===l&&i!==s||l&&!i&&!s&&!r||!c[n].test(e)||(i=!l,s=l,o=l?HBt:c)});let a={ignored:i,unignored:s};return o&&(a.rule=o),a}},lzt=(t,e)=>{throw new e(t)},Sl=(t,e,r)=>zM(t)?t?Sl.isNotRelative(t)?r(`path should be a \`path.relative()\`d string, but got "${e}"`,RangeError):!0:r("path must not be empty",TypeError):r(`path must be a string, but got \`${e}\``,TypeError),e2e=t=>ZBt.test(t);Sl.isNotRelative=e2e;Sl.convert=t=>t;var pQ=class{constructor({ignorecase:e=!0,ignoreCase:r=e,allowRelativePaths:n=!1}={}){RS(this,Xqe,!0),this._rules=new fQ(r),this._strictPathCheck=!n,this._initCache()}_initCache(){this._ignoreCache=Object.create(null),this._testCache=Object.create(null)}add(e){return this._rules.add(e)&&this._initCache(),this}addPattern(e){return this.add(e)}_test(e,r,n,i){let s=e&&Sl.convert(e);return Sl(s,e,this._strictPathCheck?lzt:Qqe),this._t(s,r,n,i)}checkIgnore(e){if(!XBt.test(e))return this.test(e);let r=e.split(AS).filter(Boolean);if(r.pop(),r.length){let n=this._t(r.join(AS)+AS,this._testCache,!0,r);if(n.ignored)return n}return this._rules.test(e,!1,BM)}_t(e,r,n,i){if(e in r)return r[e];if(i||(i=e.split(AS).filter(Boolean)),i.pop(),!i.length)return r[e]=this._rules.test(e,n,J0);let s=this._t(i.join(AS)+AS,r,n,i);return r[e]=s.ignored?s:this._rules.test(e,n,J0)}ignores(e){return this._test(e,this._ignoreCache,!1).ignored}createFilter(){return e=>!this.ignores(e)}filter(e){return Jqe(e).filter(this.createFilter())}test(e){return this._test(e,this._testCache,!0)}},hQ=t=>new pQ(t),uzt=t=>Sl(t&&Sl.convert(t),t,Qqe),t2e=()=>{let t=r=>/^\\\\\?\\/.test(r)||/["<>|\u0000-\u001F]+/u.test(r)?r:r.replace(/\\/g,"/");Sl.convert=t;let e=/^[a-z]:\//i;Sl.isNotRelative=r=>e.test(r)||e2e(r)};typeof process<"u"&&process.platform==="win32"&&t2e();VM.exports=hQ;hQ.default=hQ;VM.exports.isPathValid=uzt;RS(VM.exports,Symbol.for("setupWindows"),t2e)});var KQ=E(eze=>{"use strict";eze.parse=function(t,e){return new YQ(t,e).parse()};var YQ=class t{constructor(e,r){this.source=e,this.transform=r||LHt,this.position=0,this.entries=[],this.recorded=[],this.dimension=0}isEof(){return this.position>=this.source.length}nextCharacter(){var e=this.source[this.position++];return e==="\\"?{value:this.source[this.position++],escaped:!0}:{value:e,escaped:!1}}record(e){this.recorded.push(e)}newEntry(e){var r;(this.recorded.length>0||e)&&(r=this.recorded.join(""),r==="NULL"&&!e&&(r=null),r!==null&&(r=this.transform(r)),this.entries.push(r),this.recorded=[])}consumeDimensions(){if(this.source[0]==="[")for(;!this.isEof();){var e=this.nextCharacter();if(e.value==="=")break}}parse(e){var r,n,i;for(this.consumeDimensions();!this.isEof();)if(r=this.nextCharacter(),r.value==="{"&&!i)this.dimension++,this.dimension>1&&(n=new t(this.source.substr(this.position-1),this.transform),this.entries.push(n.parse(!0)),this.position+=n.position-2);else if(r.value==="}"&&!i){if(this.dimension--,!this.dimension&&(this.newEntry(),e))return this.entries}else r.value==='"'&&!r.escaped?(i&&this.newEntry(!0),i=!i):r.value===","&&!i?this.newEntry():this.record(r.value);if(this.dimension!==0)throw new Error("array dimension not balanced");return this.entries}};function LHt(t){return t}});var JQ=E((CVr,tze)=>{"use strict";var DHt=KQ();tze.exports={create:function(t,e){return{parse:function(){return DHt.parse(t,e)}}}}});var ize=E((NVr,nze)=>{"use strict";var MHt=/(\d{1,})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})(\.\d{1,})?.*?( BC)?$/,UHt=/^(\d{1,})-(\d{2})-(\d{2})( BC)?$/,FHt=/([Z+-])(\d{2})?:?(\d{2})?:?(\d{2})?/,jHt=/^-?infinity$/;nze.exports=function(e){if(jHt.test(e))return Number(e.replace("i","I"));var r=MHt.exec(e);if(!r)return qHt(e)||null;var n=!!r[8],i=parseInt(r[1],10);n&&(i=rze(i));var s=parseInt(r[2],10)-1,o=r[3],a=parseInt(r[4],10),c=parseInt(r[5],10),l=parseInt(r[6],10),u=r[7];u=u?1e3*parseFloat(u):0;var d,f=BHt(e);return f!=null?(d=new Date(Date.UTC(i,s,o,a,c,l,u)),ZQ(i)&&d.setUTCFullYear(i),f!==0&&d.setTime(d.getTime()-f)):(d=new Date(i,s,o,a,c,l,u),ZQ(i)&&d.setFullYear(i)),d};function qHt(t){var e=UHt.exec(t);if(e){var r=parseInt(e[1],10),n=!!e[4];n&&(r=rze(r));var i=parseInt(e[2],10)-1,s=e[3],o=new Date(r,i,s);return ZQ(r)&&o.setFullYear(r),o}}function BHt(t){if(t.endsWith("+00"))return 0;var e=FHt.exec(t.split(" ")[1]);if(e){var r=e[1];if(r==="Z")return 0;var n=r==="-"?-1:1,i=parseInt(e[2],10)*3600+parseInt(e[3]||0,10)*60+parseInt(e[4]||0,10);return i*n*1e3}}function rze(t){return-(t-1)}function ZQ(t){return t>=0&&t<100}});var oze=E((kVr,sze)=>{"use strict";sze.exports=VHt;var zHt=Object.prototype.hasOwnProperty;function VHt(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)zHt.call(r,n)&&(t[n]=r[n])}return t}});var lze=E(($Vr,cze)=>{"use strict";var HHt=oze();cze.exports=US;function US(t){if(!(this instanceof US))return new US(t);HHt(this,n4t(t))}var GHt=["seconds","minutes","hours","days","months","years"];US.prototype.toPostgres=function(){var t=GHt.filter(this.hasOwnProperty,this);return this.milliseconds&&t.indexOf("seconds")<0&&t.push("seconds"),t.length===0?"0":t.map(function(e){var r=this[e]||0;return e==="seconds"&&this.milliseconds&&(r=(r+this.milliseconds/1e3).toFixed(6).replace(/\.?0+$/,"")),r+" "+e},this).join(" ")};var WHt={years:"Y",months:"M",days:"D",hours:"H",minutes:"M",seconds:"S"},YHt=["years","months","days"],KHt=["hours","minutes","seconds"];US.prototype.toISOString=US.prototype.toISO=function(){var t=YHt.map(r,this).join(""),e=KHt.map(r,this).join("");return"P"+t+"T"+e;function r(n){var i=this[n]||0;return n==="seconds"&&this.milliseconds&&(i=(i+this.milliseconds/1e3).toFixed(6).replace(/0+$/,"")),i+WHt[n]}};var XQ="([+-]?\\d+)",JHt=XQ+"\\s+years?",ZHt=XQ+"\\s+mons?",XHt=XQ+"\\s+days?",QHt="([+-])?([\\d]*):(\\d\\d):(\\d\\d)\\.?(\\d{1,6})?",e4t=new RegExp([JHt,ZHt,XHt,QHt].map(function(t){return"("+t+")?"}).join("\\s*")),aze={years:2,months:4,days:6,hours:9,minutes:10,seconds:11,milliseconds:12},t4t=["hours","minutes","seconds","milliseconds"];function r4t(t){var e=t+"000000".slice(t.length);return parseInt(e,10)/1e3}function n4t(t){if(!t)return{};var e=e4t.exec(t),r=e[8]==="-";return Object.keys(aze).reduce(function(n,i){var s=aze[i],o=e[s];return!o||(o=i==="milliseconds"?r4t(o):parseInt(o,10),!o)||(r&&~t4t.indexOf(i)&&(o*=-1),n[i]=o),n},{})}});var fze=E((LVr,dze)=>{"use strict";var uze=Buffer.from||Buffer;dze.exports=function(e){if(/^\\x/.test(e))return uze(e.substr(2),"hex");for(var r="",n=0;n<e.length;)if(e[n]!=="\\")r+=e[n],++n;else if(/[0-7]{3}/.test(e.substr(n+1,3)))r+=String.fromCharCode(parseInt(e.substr(n+1,3),8)),n+=4;else{for(var i=1;n+i<e.length&&e[n+i]==="\\";)i++;for(var s=0;s<Math.floor(i/2);++s)r+="\\";n+=Math.floor(i/2)*2}return uze(r,"binary")}});var Sze=E((DVr,yze)=>{"use strict";var iA=KQ(),sA=JQ(),s1=ize(),hze=lze(),mze=fze();function o1(t){return function(r){return r===null?r:t(r)}}function gze(t){return t===null?t:t==="TRUE"||t==="t"||t==="true"||t==="y"||t==="yes"||t==="on"||t==="1"}function i4t(t){return t?iA.parse(t,gze):null}function s4t(t){return parseInt(t,10)}function QQ(t){return t?iA.parse(t,o1(s4t)):null}function o4t(t){return t?iA.parse(t,o1(function(e){return _ze(e).trim()})):null}var a4t=function(t){if(!t)return null;var e=sA.create(t,function(r){return r!==null&&(r=nee(r)),r});return e.parse()},eee=function(t){if(!t)return null;var e=sA.create(t,function(r){return r!==null&&(r=parseFloat(r)),r});return e.parse()},Fs=function(t){if(!t)return null;var e=sA.create(t);return e.parse()},tee=function(t){if(!t)return null;var e=sA.create(t,function(r){return r!==null&&(r=s1(r)),r});return e.parse()},c4t=function(t){if(!t)return null;var e=sA.create(t,function(r){return r!==null&&(r=hze(r)),r});return e.parse()},l4t=function(t){return t?iA.parse(t,o1(mze)):null},ree=function(t){return parseInt(t,10)},_ze=function(t){var e=String(t);return/^\d+$/.test(e)?e:t},pze=function(t){return t?iA.parse(t,o1(JSON.parse)):null},nee=function(t){return t[0]!=="("?null:(t=t.substring(1,t.length-1).split(","),{x:parseFloat(t[0]),y:parseFloat(t[1])})},u4t=function(t){if(t[0]!=="<"&&t[1]!=="(")return null;for(var e="(",r="",n=!1,i=2;i<t.length-1;i++){if(n||(e+=t[i]),t[i]===")"){n=!0;continue}else if(!n)continue;t[i]!==","&&(r+=t[i])}var s=nee(e);return s.radius=parseFloat(r),s},d4t=function(t){t(20,_ze),t(21,ree),t(23,ree),t(26,ree),t(700,parseFloat),t(701,parseFloat),t(16,gze),t(1082,s1),t(1114,s1),t(1184,s1),t(600,nee),t(651,Fs),t(718,u4t),t(1e3,i4t),t(1001,l4t),t(1005,QQ),t(1007,QQ),t(1028,QQ),t(1016,o4t),t(1017,a4t),t(1021,eee),t(1022,eee),t(1231,eee),t(1014,Fs),t(1015,Fs),t(1008,Fs),t(1009,Fs),t(1040,Fs),t(1041,Fs),t(1115,tee),t(1182,tee),t(1185,tee),t(1186,hze),t(1187,c4t),t(17,mze),t(114,JSON.parse.bind(JSON)),t(3802,JSON.parse.bind(JSON)),t(199,pze),t(3807,pze),t(3907,Fs),t(2951,Fs),t(791,Fs),t(1183,Fs),t(1270,Fs)};yze.exports={init:d4t}});var vze=E((MVr,Eze)=>{"use strict";var Ci=1e6;function f4t(t){var e=t.readInt32BE(0),r=t.readUInt32BE(4),n="";e<0&&(e=~e+(r===0),r=~r+1>>>0,n="-");var i="",s,o,a,c,l,u;{if(s=e%Ci,e=e/Ci>>>0,o=4294967296*s+r,r=o/Ci>>>0,a=""+(o-Ci*r),r===0&&e===0)return n+a+i;for(c="",l=6-a.length,u=0;u<l;u++)c+="0";i=c+a+i}{if(s=e%Ci,e=e/Ci>>>0,o=4294967296*s+r,r=o/Ci>>>0,a=""+(o-Ci*r),r===0&&e===0)return n+a+i;for(c="",l=6-a.length,u=0;u<l;u++)c+="0";i=c+a+i}{if(s=e%Ci,e=e/Ci>>>0,o=4294967296*s+r,r=o/Ci>>>0,a=""+(o-Ci*r),r===0&&e===0)return n+a+i;for(c="",l=6-a.length,u=0;u<l;u++)c+="0";i=c+a+i}return s=e%Ci,o=4294967296*s+r,a=""+o%Ci,n+a+i}Eze.exports=f4t});var Rze=E((UVr,Aze)=>{"use strict";var p4t=vze(),cr=function(t,e,r,n,i){r=r||0,n=n||!1,i=i||function(p,h,m){return p*Math.pow(2,m)+h};var s=r>>3,o=function(p){return n?~p&255:p},a=255,c=8-r%8;e<c&&(a=255<<8-e&255,c=e),r&&(a=a>>r%8);var l=0;r%8+e>=8&&(l=i(0,o(t[s])&a,c));for(var u=e+r>>3,d=s+1;d<u;d++)l=i(l,o(t[d]),8);var f=(e+r)%8;return f>0&&(l=i(l,o(t[u])>>8-f,f)),l},wze=function(t,e,r){var n=Math.pow(2,r-1)-1,i=cr(t,1),s=cr(t,r,1);if(s===0)return 0;var o=1,a=function(l,u,d){l===0&&(l=1);for(var f=1;f<=d;f++)o/=2,(u&1<<d-f)>0&&(l+=o);return l},c=cr(t,e,r+1,!1,a);return s==Math.pow(2,r+1)-1?c===0?i===0?1/0:-1/0:NaN:(i===0?1:-1)*Math.pow(2,s-n)*c},h4t=function(t){return cr(t,1)==1?-1*(cr(t,15,1,!0)+1):cr(t,15,1)},bze=function(t){return cr(t,1)==1?-1*(cr(t,31,1,!0)+1):cr(t,31,1)},m4t=function(t){return wze(t,23,8)},g4t=function(t){return wze(t,52,11)},_4t=function(t){var e=cr(t,16,32);if(e==49152)return NaN;for(var r=Math.pow(1e4,cr(t,16,16)),n=0,i=[],s=cr(t,16),o=0;o<s;o++)n+=cr(t,16,64+16*o)*r,r/=1e4;var a=Math.pow(10,cr(t,16,48));return(e===0?1:-1)*Math.round(n*a)/a},Tze=function(t,e){var r=cr(e,1),n=cr(e,63,1),i=new Date((r===0?1:-1)*n/1e3+9466848e5);return t||i.setTime(i.getTime()+i.getTimezoneOffset()*6e4),i.usec=n%1e3,i.getMicroSeconds=function(){return this.usec},i.setMicroSeconds=function(s){this.usec=s},i.getUTCMicroSeconds=function(){return this.usec},i},oA=function(t){for(var e=cr(t,32),r=cr(t,32,32),n=cr(t,32,64),i=96,s=[],o=0;o<e;o++)s[o]=cr(t,32,i),i+=32,i+=32;var a=function(l){var u=cr(t,32,i);if(i+=32,u==4294967295)return null;var d;if(l==23||l==20)return d=cr(t,u*8,i),i+=u*8,d;if(l==25)return d=t.toString(this.encoding,i>>3,(i+=u<<3)>>3),d;console.log("ERROR: ElementType not implemented: "+l)},c=function(l,u){var d=[],f;if(l.length>1){var p=l.shift();for(f=0;f<p;f++)d[f]=c(l,u);l.unshift(p)}else for(f=0;f<l[0];f++)d[f]=a(u);return d};return c(s,n)},y4t=function(t){return t.toString("utf8")},S4t=function(t){return t===null?null:cr(t,8)>0},E4t=function(t){t(20,p4t),t(21,h4t),t(23,bze),t(26,bze),t(1700,_4t),t(700,m4t),t(701,g4t),t(16,S4t),t(1114,Tze.bind(null,!1)),t(1184,Tze.bind(null,!0)),t(1e3,oA),t(1007,oA),t(1016,oA),t(1008,oA),t(1009,oA),t(25,y4t)};Aze.exports={init:E4t}});var Ize=E((FVr,xze)=>{"use strict";xze.exports={BOOL:16,BYTEA:17,CHAR:18,INT8:20,INT2:21,INT4:23,REGPROC:24,TEXT:25,OID:26,TID:27,XID:28,CID:29,JSON:114,XML:142,PG_NODE_TREE:194,SMGR:210,PATH:602,POLYGON:604,CIDR:650,FLOAT4:700,FLOAT8:701,ABSTIME:702,RELTIME:703,TINTERVAL:704,CIRCLE:718,MACADDR8:774,MONEY:790,MACADDR:829,INET:869,ACLITEM:1033,BPCHAR:1042,VARCHAR:1043,DATE:1082,TIME:1083,TIMESTAMP:1114,TIMESTAMPTZ:1184,INTERVAL:1186,TIMETZ:1266,BIT:1560,VARBIT:1562,NUMERIC:1700,REFCURSOR:1790,REGPROCEDURE:2202,REGOPER:2203,REGOPERATOR:2204,REGCLASS:2205,REGTYPE:2206,UUID:2950,TXID_SNAPSHOT:2970,PG_LSN:3220,PG_NDISTINCT:3361,PG_DEPENDENCIES:3402,TSVECTOR:3614,TSQUERY:3615,GTSVECTOR:3642,REGCONFIG:3734,REGDICTIONARY:3769,JSONB:3802,REGNAMESPACE:4089,REGROLE:4096}});var lA=E(cA=>{"use strict";var v4t=Sze(),b4t=Rze(),T4t=JQ(),w4t=Ize();cA.getTypeParser=A4t;cA.setTypeParser=R4t;cA.arrayParser=T4t;cA.builtins=w4t;var aA={text:{},binary:{}};function Oze(t){return String(t)}function A4t(t,e){return e=e||"text",aA[e]&&aA[e][t]||Oze}function R4t(t,e,r){typeof e=="function"&&(r=e,e="text"),aA[e][t]=r}v4t.init(function(t,e){aA.text[t]=e});b4t.init(function(t,e){aA.binary[t]=e})});var uA=E((qVr,iee)=>{"use strict";var Pze;try{Pze=process.platform==="win32"?process.env.USERNAME:process.env.USER}catch{}iee.exports={host:"localhost",user:Pze,database:void 0,password:null,connectionString:void 0,port:5432,rows:0,binary:!1,max:10,idleTimeoutMillis:3e4,client_encoding:"",ssl:!1,application_name:void 0,fallback_application_name:void 0,options:void 0,parseInputDatesAsUTC:!1,statement_timeout:!1,lock_timeout:!1,idle_in_transaction_session_timeout:!1,query_timeout:!1,connect_timeout:0,keepalives:1,keepalives_idle:0};var FS=lA(),x4t=FS.getTypeParser(20,"text"),I4t=FS.getTypeParser(1016,"text");iee.exports.__defineSetter__("parseInt8",function(t){FS.setTypeParser(20,"text",t?FS.getTypeParser(23,"text"):x4t),FS.setTypeParser(1016,"text",t?FS.getTypeParser(1007,"text"):I4t)})});var jS=E((BVr,Nze)=>{"use strict";var O4t=uA(),{isDate:P4t}=W("util/types");function C4t(t){return'"'+t.replace(/\\/g,"\\\\").replace(/"/g,'\\"')+'"'}function Cze(t){let e="{";for(let r=0;r<t.length;r++){r>0&&(e+=",");let n=t[r];n==null?e+="NULL":Array.isArray(n)?e+=Cze(n):ArrayBuffer.isView(n)?(n instanceof Buffer||(n=Buffer.from(n.buffer,n.byteOffset,n.byteLength)),e+="\\\\x"+n.toString("hex")):e+=C4t(a1(n))}return e+="}",e}var a1=function(t,e){return t==null?null:typeof t=="object"?t instanceof Buffer?t:ArrayBuffer.isView(t)?Buffer.from(t.buffer,t.byteOffset,t.byteLength):P4t(t)?O4t.parseInputDatesAsUTC?$4t(t):k4t(t):Array.isArray(t)?Cze(t):N4t(t,e):t.toString()};function N4t(t,e){if(t&&typeof t.toPostgres=="function"){if(e=e||[],e.indexOf(t)!==-1)throw new Error('circular reference detected while preparing "'+t+'" for query');return e.push(t),a1(t.toPostgres(a1),e)}return JSON.stringify(t)}function k4t(t){let e=-t.getTimezoneOffset(),r=t.getFullYear(),n=r<1;n&&(r=Math.abs(r)+1);let i=String(r).padStart(4,"0")+"-"+String(t.getMonth()+1).padStart(2,"0")+"-"+String(t.getDate()).padStart(2,"0")+"T"+String(t.getHours()).padStart(2,"0")+":"+String(t.getMinutes()).padStart(2,"0")+":"+String(t.getSeconds()).padStart(2,"0")+"."+String(t.getMilliseconds()).padStart(3,"0");return e<0?(i+="-",e*=-1):i+="+",i+=String(Math.floor(e/60)).padStart(2,"0")+":"+String(e%60).padStart(2,"0"),n&&(i+=" BC"),i}function $4t(t){let e=t.getUTCFullYear(),r=e<1;r&&(e=Math.abs(e)+1);let n=String(e).padStart(4,"0")+"-"+String(t.getUTCMonth()+1).padStart(2,"0")+"-"+String(t.getUTCDate()).padStart(2,"0")+"T"+String(t.getUTCHours()).padStart(2,"0")+":"+String(t.getUTCMinutes()).padStart(2,"0")+":"+String(t.getUTCSeconds()).padStart(2,"0")+"."+String(t.getUTCMilliseconds()).padStart(3,"0");return n+="+00:00",r&&(n+=" BC"),n}function L4t(t,e,r){return t=typeof t=="string"?{text:t}:t,e&&(typeof e=="function"?t.callback=e:t.values=e),r&&(t.callback=r),t}var D4t=function(t){return'"'+t.replace(/"/g,'""')+'"'},M4t=function(t){let e=!1,r="'";if(t==null||typeof t!="string")return"''";for(let n=0;n<t.length;n++){let i=t[n];i==="'"?r+=i+i:i==="\\"?(r+=i+i,e=!0):r+=i}return r+="'",e===!0&&(r=" E"+r),r};Nze.exports={prepareValue:function(e){return a1(e)},normalizeQueryConfig:L4t,escapeIdentifier:D4t,escapeLiteral:M4t}});var aee=E((zVr,Lze)=>{"use strict";var kze=W("crypto");Lze.exports={postgresMd5PasswordHash:F4t,randomBytes:U4t,deriveKey:z4t,sha256:j4t,hashByName:q4t,hmacSha256:B4t,md5:see};var $ze=kze.webcrypto||globalThis.crypto,gh=$ze.subtle,oee=new TextEncoder;function U4t(t){return $ze.getRandomValues(Buffer.alloc(t))}async function see(t){try{return kze.createHash("md5").update(t,"utf-8").digest("hex")}catch{let r=typeof t=="string"?oee.encode(t):t,n=await gh.digest("MD5",r);return Array.from(new Uint8Array(n)).map(i=>i.toString(16).padStart(2,"0")).join("")}}async function F4t(t,e,r){let n=await see(e+t);return"md5"+await see(Buffer.concat([Buffer.from(n),r]))}async function j4t(t){return await gh.digest("SHA-256",t)}async function q4t(t,e){return await gh.digest(t,e)}async function B4t(t,e){let r=await gh.importKey("raw",t,{name:"HMAC",hash:"SHA-256"},!1,["sign"]);return await gh.sign("HMAC",r,oee.encode(e))}async function z4t(t,e,r){let n=await gh.importKey("raw",oee.encode(t),"PBKDF2",!1,["deriveBits"]),i={name:"PBKDF2",hash:"SHA-256",salt:e,iterations:r};return await gh.deriveBits(i,n,256,["deriveBits"])}});var Uze=E((VVr,Mze)=>{"use strict";function _h(t,e){return new Error("SASL channel binding: "+t+" when parsing public certificate "+e.toString("base64"))}function cee(t,e){let r=t[e++];if(r<128)return{length:r,index:e};let n=r&127;if(n>4)throw _h("bad length",t);r=0;for(let i=0;i<n;i++)r=r<<8|t[e++];return{length:r,index:e}}function Dze(t,e){if(t[e++]!==6)throw _h("non-OID data",t);let{length:r,index:n}=cee(t,e);e=n;let i=e+r,s=t[e++],o=(s/40>>0)+"."+s%40;for(;e<i;){let a=0;for(;e<i;){let c=t[e++];if(a=a<<7|c&127,c<128)break}o+="."+a}return{oid:o,index:e}}function dA(t,e){if(t[e++]!==48)throw _h("non-sequence data",t);return cee(t,e)}function V4t(t,e){e===void 0&&(e=0),e=dA(t,e).index;let{length:r,index:n}=dA(t,e);e=n+r,e=dA(t,e).index;let{oid:i,index:s}=Dze(t,e);switch(i){case"1.2.840.113549.1.1.4":return"MD5";case"1.2.840.113549.1.1.5":return"SHA-1";case"1.2.840.113549.1.1.11":return"SHA-256";case"1.2.840.113549.1.1.12":return"SHA-384";case"1.2.840.113549.1.1.13":return"SHA-512";case"1.2.840.113549.1.1.14":return"SHA-224";case"1.2.840.113549.1.1.15":return"SHA512-224";case"1.2.840.113549.1.1.16":return"SHA512-256";case"1.2.840.10045.4.1":return"SHA-1";case"1.2.840.10045.4.3.1":return"SHA-224";case"1.2.840.10045.4.3.2":return"SHA-256";case"1.2.840.10045.4.3.3":return"SHA-384";case"1.2.840.10045.4.3.4":return"SHA-512";case"1.2.840.113549.1.1.10":{if(e=s,e=dA(t,e).index,t[e++]!==160)throw _h("non-tag data",t);e=cee(t,e).index,e=dA(t,e).index;let{oid:o}=Dze(t,e);switch(o){case"1.2.840.113549.2.5":return"MD5";case"1.3.14.3.2.26":return"SHA-1";case"2.16.840.1.101.3.4.2.1":return"SHA-256";case"2.16.840.1.101.3.4.2.2":return"SHA-384";case"2.16.840.1.101.3.4.2.3":return"SHA-512"}throw _h("unknown hash OID "+o,t)}case"1.3.101.110":case"1.3.101.112":return"SHA-512";case"1.3.101.111":case"1.3.101.113":throw _h("Ed448 certificate channel binding is not currently supported by Postgres")}throw _h("unknown OID "+i,t)}Mze.exports={signatureAlgorithmHashFromCertificate:V4t}});var Bze=E((HVr,qze)=>{"use strict";var $d=aee(),{signatureAlgorithmHashFromCertificate:H4t}=Uze();function G4t(t){let e=/[\u00A0\u1680\u2000-\u200B\u202F\u205F\u3000]/g,r=/[\u00AD\u034F\u1806\u180B\u180C\u180D\u200C\u200D\u2060\uFE00-\uFE0F\uFEFF]/g;return t.replace(e," ").replace(r,"").normalize("NFKC")}var lee=1e5;function W4t(t,e,r=lee){let n=["SCRAM-SHA-256"];e&&n.unshift("SCRAM-SHA-256-PLUS");let i=n.find(a=>t.includes(a));if(!i)throw new Error("SASL: Only mechanism(s) "+n.join(" and ")+" are supported");if(i==="SCRAM-SHA-256-PLUS"&&typeof e.getPeerCertificate!="function")throw new Error("SASL: Mechanism SCRAM-SHA-256-PLUS requires a certificate");let s=$d.randomBytes(18).toString("base64");return{mechanism:i,clientNonce:s,response:(i==="SCRAM-SHA-256-PLUS"?"p=tls-server-end-point":e?"y":"n")+",,n=*,r="+s,message:"SASLInitialResponse",scramMaxIterations:r}}async function Y4t(t,e,r,n){if(t.message!=="SASLInitialResponse")throw new Error("SASL: Last message was not SASLInitialResponse");if(typeof e!="string")throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: client password must be a string");if(e==="")throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: client password must be a non-empty string");if(typeof r!="string")throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: serverData must be a string");let i=Z4t(r);if(i.nonce.startsWith(t.clientNonce)){if(i.nonce.length===t.clientNonce.length)throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: server nonce is too short")}else throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: server nonce does not start with client nonce");let s=typeof t.scramMaxIterations=="number"?t.scramMaxIterations:lee;if(s!==0&&i.iteration>s)throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: iteration count "+i.iteration+" exceeds scramMaxIterations of "+s);let o="n=*,r="+t.clientNonce,a="r="+i.nonce+",s="+i.salt+",i="+i.iteration,c=n?"eSws":"biws";if(t.mechanism==="SCRAM-SHA-256-PLUS"){let S=n.getPeerCertificate().raw,g=H4t(S);(g==="MD5"||g==="SHA-1")&&(g="SHA-256");let T=await $d.hashByName(g,S);c=Buffer.concat([Buffer.from("p=tls-server-end-point,,"),Buffer.from(T)]).toString("base64")}let l="c="+c+",r="+i.nonce,u=o+","+a+","+l,d=Buffer.from(i.salt,"base64"),f=await $d.deriveKey(G4t(e),d,i.iteration),p=await $d.hmacSha256(f,"Client Key"),h=await $d.sha256(p),m=await $d.hmacSha256(h,u),_=Q4t(Buffer.from(p),Buffer.from(m)).toString("base64"),y=await $d.hmacSha256(f,"Server Key"),v=await $d.hmacSha256(y,u);t.message="SASLResponse",t.serverSignature=Buffer.from(v).toString("base64"),t.response=l+",p="+_}function K4t(t,e){if(t.message!=="SASLResponse")throw new Error("SASL: Last message was not SASLResponse");if(typeof e!="string")throw new Error("SASL: SCRAM-SERVER-FINAL-MESSAGE: serverData must be a string");let{serverSignature:r}=X4t(e);if(r!==t.serverSignature)throw new Error("SASL: SCRAM-SERVER-FINAL-MESSAGE: server signature does not match")}function J4t(t){if(typeof t!="string")throw new TypeError("SASL: text must be a string");return t.split("").map((e,r)=>t.charCodeAt(r)).every(e=>e>=33&&e<=43||e>=45&&e<=126)}function Fze(t){return/^(?:[a-zA-Z0-9+/]{4})*(?:[a-zA-Z0-9+/]{2}==|[a-zA-Z0-9+/]{3}=)?$/.test(t)}function jze(t){if(typeof t!="string")throw new TypeError("SASL: attribute pairs text must be a string");return new Map(t.split(",").map(e=>{if(!/^.=/.test(e))throw new Error("SASL: Invalid attribute pair entry");let r=e[0],n=e.substring(2);return[r,n]}))}function Z4t(t){let e=jze(t),r=e.get("r");if(r){if(!J4t(r))throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: nonce must only contain printable characters")}else throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: nonce missing");let n=e.get("s");if(n){if(!Fze(n))throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: salt must be base64")}else throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: salt missing");let i=e.get("i");if(i){if(!/^[1-9][0-9]*$/.test(i))throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: invalid iteration count")}else throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: iteration missing");let s=parseInt(i,10);return{nonce:r,salt:n,iteration:s}}function X4t(t){let e=jze(t),r=e.get("e"),n=e.get("v");if(r)throw new Error(`SASL: SCRAM-SERVER-FINAL-MESSAGE: server returned error: "${r}"`);if(n){if(!Fze(n))throw new Error("SASL: SCRAM-SERVER-FINAL-MESSAGE: server signature must be base64")}else throw new Error("SASL: SCRAM-SERVER-FINAL-MESSAGE: server signature is missing");return{serverSignature:n}}function Q4t(t,e){if(!Buffer.isBuffer(t))throw new TypeError("first argument must be a Buffer");if(!Buffer.isBuffer(e))throw new TypeError("second argument must be a Buffer");if(t.length!==e.length)throw new Error("Buffer lengths must match");if(t.length===0)throw new Error("Buffers cannot be empty");return Buffer.from(t.map((r,n)=>t[n]^e[n]))}qze.exports={startSession:W4t,continueSession:Y4t,finalizeSession:K4t,DEFAULT_MAX_SCRAM_ITERATIONS:lee}});var l1=E((GVr,zze)=>{"use strict";var eGt=lA();function c1(t){this._types=t||eGt,this.text={},this.binary={}}c1.prototype.getOverrides=function(t){switch(t){case"text":return this.text;case"binary":return this.binary;default:return{}}};c1.prototype.setTypeParser=function(t,e,r){typeof e=="function"&&(r=e,e="text"),this.getOverrides(e)[t]=r};c1.prototype.getTypeParser=function(t,e){return e=e||"text",this.getOverrides(e)[t]||this._types.getTypeParser(t,e)};zze.exports=c1});var Gze=E((WVr,Hze)=>{"use strict";function qS(t,e={}){if(t.charAt(0)==="/"){let c=t.split(" ");return{host:c[0],database:c[1]}}let r=Object.create(null),n,i=!1;/ |%[^a-f0-9]|%[a-f0-9][^a-f0-9]/i.test(t)&&(t=encodeURI(t).replace(/%25(\d\d)/g,"%$1"));try{try{n=new URL(t,"postgres://base")}catch{n=new URL(t.replace("@/","@___DUMMY___/"),"postgres://base"),i=!0}}catch(c){throw c.input&&(c.input="*****REDACTED*****"),c}for(let c of n.searchParams.entries())r[c[0]]=c[1];if(r.user=r.user||decodeURIComponent(n.username),r.password=r.password||decodeURIComponent(n.password),n.protocol=="socket:")return r.host=decodeURI(n.pathname),r.database=n.searchParams.get("db"),r.client_encoding=n.searchParams.get("encoding"),r;let s=i?"":n.hostname;r.host?s&&/^%2f/i.test(s)&&(n.pathname=s+n.pathname):r.host=decodeURIComponent(s),r.port||(r.port=n.port);let o=n.pathname.slice(1)||null;r.database=o?decodeURI(o):null,(r.ssl==="true"||r.ssl==="1")&&(r.ssl=!0),r.ssl==="0"&&(r.ssl=!1),(r.sslcert||r.sslkey||r.sslrootcert||r.sslmode)&&(r.ssl={});let a=r.sslcert||r.sslkey||r.sslrootcert?W("fs"):null;if(r.sslcert&&(r.ssl.cert=a.readFileSync(r.sslcert).toString()),r.sslkey&&(r.ssl.key=a.readFileSync(r.sslkey).toString()),r.sslrootcert&&(r.ssl.ca=a.readFileSync(r.sslrootcert).toString()),e.useLibpqCompat&&r.uselibpqcompat)throw new Error("Both useLibpqCompat and uselibpqcompat are set. Please use only one of them.");if(r.uselibpqcompat==="true"||e.useLibpqCompat)switch(r.sslmode){case"disable":{r.ssl=!1;break}case"prefer":{r.ssl.rejectUnauthorized=!1;break}case"require":{r.sslrootcert?r.ssl.checkServerIdentity=function(){}:r.ssl.rejectUnauthorized=!1;break}case"verify-ca":{if(!r.ssl.ca)throw new Error("SECURITY WARNING: Using sslmode=verify-ca requires specifying a CA with sslrootcert. If a public CA is used, verify-ca allows connections to a server that somebody else may have registered with the CA, making you vulnerable to Man-in-the-Middle attacks. Either specify a custom CA certificate with sslrootcert parameter or use sslmode=verify-full for proper security.");r.ssl.checkServerIdentity=function(){};break}case"verify-full":break}else switch(r.sslmode){case"disable":{r.ssl=!1;break}case"prefer":case"require":case"verify-ca":case"verify-full":{r.sslmode!=="verify-full"&&uee(r.sslmode);break}case"no-verify":{r.ssl.rejectUnauthorized=!1;break}}return r}function tGt(t){return Object.entries(t).reduce((r,[n,i])=>(i!=null&&(r[n]=i),r),Object.create(null))}function Vze(t){return Object.entries(t).reduce((r,[n,i])=>{if(n==="ssl"){let s=i;typeof s=="boolean"&&(r[n]=s),typeof s=="object"&&(r[n]=tGt(s))}else if(i!=null)if(n==="port"){if(i!==""){let s=parseInt(i,10);if(isNaN(s))throw new Error(`Invalid ${n}: ${i}`);r[n]=s}}else r[n]=i;return r},Object.create(null))}function rGt(t){return Vze(qS(t))}function uee(t){!uee.warned&&typeof process<"u"&&process.emitWarning&&(uee.warned=!0,process.emitWarning(`SECURITY WARNING: The SSL modes 'prefer', 'require', and 'verify-ca' are treated as aliases for 'verify-full'.
393
+ GFS4: `),console.error(t)});ar[vn]||(zUe=global[vn]||[],HUe(ar,zUe),ar.close=(function(t){function e(r,n){return t.call(ar,r,function(i){i||VUe(),typeof n=="function"&&n.apply(this,arguments)})}return Object.defineProperty(e,fM,{value:t}),e})(ar.close),ar.closeSync=(function(t){function e(r){t.apply(ar,arguments),VUe()}return Object.defineProperty(e,fM,{value:t}),e})(ar.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&process.on("exit",function(){lh(ar[vn]),W("assert").equal(ar[vn].length,0)}));var zUe;global[vn]||HUe(global,ar[vn]);hX.exports=fX(mFt(ar));process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!ar.__patched&&(hX.exports=fX(ar),ar.__patched=!0);function fX(t){pFt(t),t.gracefulify=fX,t.createReadStream=T,t.createWriteStream=I;var e=t.readFile;t.readFile=r;function r(O,A,b){return typeof A=="function"&&(b=A,A=null),L(O,A,b);function L(C,w,P,N){return e(C,w,function(F){F&&(F.code==="EMFILE"||F.code==="ENFILE")?_S([L,[C,w,P],F,N||Date.now(),Date.now()]):typeof P=="function"&&P.apply(this,arguments)})}}var n=t.writeFile;t.writeFile=i;function i(O,A,b,L){return typeof b=="function"&&(L=b,b=null),C(O,A,b,L);function C(w,P,N,F,V){return n(w,P,N,function(de){de&&(de.code==="EMFILE"||de.code==="ENFILE")?_S([C,[w,P,N,F],de,V||Date.now(),Date.now()]):typeof F=="function"&&F.apply(this,arguments)})}}var s=t.appendFile;s&&(t.appendFile=o);function o(O,A,b,L){return typeof b=="function"&&(L=b,b=null),C(O,A,b,L);function C(w,P,N,F,V){return s(w,P,N,function(de){de&&(de.code==="EMFILE"||de.code==="ENFILE")?_S([C,[w,P,N,F],de,V||Date.now(),Date.now()]):typeof F=="function"&&F.apply(this,arguments)})}}var a=t.copyFile;a&&(t.copyFile=c);function c(O,A,b,L){return typeof b=="function"&&(L=b,b=0),C(O,A,b,L);function C(w,P,N,F,V){return a(w,P,N,function(de){de&&(de.code==="EMFILE"||de.code==="ENFILE")?_S([C,[w,P,N,F],de,V||Date.now(),Date.now()]):typeof F=="function"&&F.apply(this,arguments)})}}var l=t.readdir;t.readdir=d;var u=/^v[0-5]\./;function d(O,A,b){typeof A=="function"&&(b=A,A=null);var L=u.test(process.version)?function(P,N,F,V){return l(P,C(P,N,F,V))}:function(P,N,F,V){return l(P,N,C(P,N,F,V))};return L(O,A,b);function C(w,P,N,F){return function(V,de){V&&(V.code==="EMFILE"||V.code==="ENFILE")?_S([L,[w,P,N],V,F||Date.now(),Date.now()]):(de&&de.sort&&de.sort(),typeof N=="function"&&N.call(this,V,de))}}}if(process.version.substr(0,4)==="v0.8"){var f=hFt(t);y=f.ReadStream,S=f.WriteStream}var p=t.ReadStream;p&&(y.prototype=Object.create(p.prototype),y.prototype.open=v);var h=t.WriteStream;h&&(S.prototype=Object.create(h.prototype),S.prototype.open=g),Object.defineProperty(t,"ReadStream",{get:function(){return y},set:function(O){y=O},enumerable:!0,configurable:!0}),Object.defineProperty(t,"WriteStream",{get:function(){return S},set:function(O){S=O},enumerable:!0,configurable:!0});var m=y;Object.defineProperty(t,"FileReadStream",{get:function(){return m},set:function(O){m=O},enumerable:!0,configurable:!0});var _=S;Object.defineProperty(t,"FileWriteStream",{get:function(){return _},set:function(O){_=O},enumerable:!0,configurable:!0});function y(O,A){return this instanceof y?(p.apply(this,arguments),this):y.apply(Object.create(y.prototype),arguments)}function v(){var O=this;R(O.path,O.flags,O.mode,function(A,b){A?(O.autoClose&&O.destroy(),O.emit("error",A)):(O.fd=b,O.emit("open",b),O.read())})}function S(O,A){return this instanceof S?(h.apply(this,arguments),this):S.apply(Object.create(S.prototype),arguments)}function g(){var O=this;R(O.path,O.flags,O.mode,function(A,b){A?(O.destroy(),O.emit("error",A)):(O.fd=b,O.emit("open",b))})}function T(O,A){return new t.ReadStream(O,A)}function I(O,A){return new t.WriteStream(O,A)}var x=t.open;t.open=R;function R(O,A,b,L){return typeof b=="function"&&(L=b,b=null),C(O,A,b,L);function C(w,P,N,F,V){return x(w,P,N,function(de,Te){de&&(de.code==="EMFILE"||de.code==="ENFILE")?_S([C,[w,P,N,F],de,V||Date.now(),Date.now()]):typeof F=="function"&&F.apply(this,arguments)})}}return t}function _S(t){lh("ENQUEUE",t[0].name,t[1]),ar[vn].push(t),pX()}var dM;function VUe(){for(var t=Date.now(),e=0;e<ar[vn].length;++e)ar[vn][e].length>2&&(ar[vn][e][3]=t,ar[vn][e][4]=t);pX()}function pX(){if(clearTimeout(dM),dM=void 0,ar[vn].length!==0){var t=ar[vn].shift(),e=t[0],r=t[1],n=t[2],i=t[3],s=t[4];if(i===void 0)lh("RETRY",e.name,r),e.apply(null,r);else if(Date.now()-i>=6e4){lh("TIMEOUT",e.name,r);var o=r.pop();typeof o=="function"&&o.call(null,n)}else{var a=Date.now()-s,c=Math.max(s-i,1),l=Math.min(c*1.2,100);a>=l?(lh("RETRY",e.name,r),e.apply(null,r.concat([i]))):ar[vn].push(t)}dM===void 0&&(dM=setTimeout(pX,0))}}});var oFe=E(yS=>{"use strict";Object.defineProperty(yS,"__esModule",{value:!0});yS.splitWhen=yS.flatten=void 0;function DFt(t){return t.reduce((e,r)=>[].concat(e,r),[])}yS.flatten=DFt;function MFt(t,e){let r=[[]],n=0;for(let i of t)e(i)?(n++,r[n]=[]):r[n].push(i);return r}yS.splitWhen=MFt});var aFe=E(hM=>{"use strict";Object.defineProperty(hM,"__esModule",{value:!0});hM.isEnoentCodeError=void 0;function UFt(t){return t.code==="ENOENT"}hM.isEnoentCodeError=UFt});var cFe=E(mM=>{"use strict";Object.defineProperty(mM,"__esModule",{value:!0});mM.createDirentFromStats=void 0;var TX=class{constructor(e,r){this.name=e,this.isBlockDevice=r.isBlockDevice.bind(r),this.isCharacterDevice=r.isCharacterDevice.bind(r),this.isDirectory=r.isDirectory.bind(r),this.isFIFO=r.isFIFO.bind(r),this.isFile=r.isFile.bind(r),this.isSocket=r.isSocket.bind(r),this.isSymbolicLink=r.isSymbolicLink.bind(r)}};function FFt(t,e){return new TX(t,e)}mM.createDirentFromStats=FFt});var fFe=E(Pr=>{"use strict";Object.defineProperty(Pr,"__esModule",{value:!0});Pr.convertPosixPathToPattern=Pr.convertWindowsPathToPattern=Pr.convertPathToPattern=Pr.escapePosixPath=Pr.escapeWindowsPath=Pr.escape=Pr.removeLeadingDotSegment=Pr.makeAbsolute=Pr.unixify=void 0;var jFt=W("os"),qFt=W("path"),lFe=jFt.platform()==="win32",BFt=2,zFt=/(\\?)([()*?[\]{|}]|^!|[!+@](?=\()|\\(?![!()*+?@[\]{|}]))/g,VFt=/(\\?)([()[\]{}]|^!|[!+@](?=\())/g,HFt=/^\\\\([.?])/,GFt=/\\(?![!()+@[\]{}])/g;function WFt(t){return t.replace(/\\/g,"/")}Pr.unixify=WFt;function YFt(t,e){return qFt.resolve(t,e)}Pr.makeAbsolute=YFt;function KFt(t){if(t.charAt(0)==="."){let e=t.charAt(1);if(e==="/"||e==="\\")return t.slice(BFt)}return t}Pr.removeLeadingDotSegment=KFt;Pr.escape=lFe?wX:AX;function wX(t){return t.replace(VFt,"\\$2")}Pr.escapeWindowsPath=wX;function AX(t){return t.replace(zFt,"\\$2")}Pr.escapePosixPath=AX;Pr.convertPathToPattern=lFe?uFe:dFe;function uFe(t){return wX(t).replace(HFt,"//$1").replace(GFt,"/")}Pr.convertWindowsPathToPattern=uFe;function dFe(t){return AX(t)}Pr.convertPosixPathToPattern=dFe});var hFe=E((ijr,pFe)=>{"use strict";pFe.exports=function(e){if(typeof e!="string"||e==="")return!1;for(var r;r=/(\\).|([@?!+*]\(.*\))/g.exec(e);){if(r[2])return!0;e=e.slice(r.index+r[0].length)}return!1}});var _Fe=E((sjr,gFe)=>{"use strict";var JFt=hFe(),mFe={"{":"}","(":")","[":"]"},ZFt=function(t){if(t[0]==="!")return!0;for(var e=0,r=-2,n=-2,i=-2,s=-2,o=-2;e<t.length;){if(t[e]==="*"||t[e+1]==="?"&&/[\].+)]/.test(t[e])||n!==-1&&t[e]==="["&&t[e+1]!=="]"&&(n<e&&(n=t.indexOf("]",e)),n>e&&(o===-1||o>n||(o=t.indexOf("\\",e),o===-1||o>n)))||i!==-1&&t[e]==="{"&&t[e+1]!=="}"&&(i=t.indexOf("}",e),i>e&&(o=t.indexOf("\\",e),o===-1||o>i))||s!==-1&&t[e]==="("&&t[e+1]==="?"&&/[:!=]/.test(t[e+2])&&t[e+3]!==")"&&(s=t.indexOf(")",e),s>e&&(o=t.indexOf("\\",e),o===-1||o>s))||r!==-1&&t[e]==="("&&t[e+1]!=="|"&&(r<e&&(r=t.indexOf("|",e)),r!==-1&&t[r+1]!==")"&&(s=t.indexOf(")",r),s>r&&(o=t.indexOf("\\",r),o===-1||o>s))))return!0;if(t[e]==="\\"){var a=t[e+1];e+=2;var c=mFe[a];if(c){var l=t.indexOf(c,e);l!==-1&&(e=l+1)}if(t[e]==="!")return!0}else e++}return!1},XFt=function(t){if(t[0]==="!")return!0;for(var e=0;e<t.length;){if(/[*?{}()[\]]/.test(t[e]))return!0;if(t[e]==="\\"){var r=t[e+1];e+=2;var n=mFe[r];if(n){var i=t.indexOf(n,e);i!==-1&&(e=i+1)}if(t[e]==="!")return!0}else e++}return!1};gFe.exports=function(e,r){if(typeof e!="string"||e==="")return!1;if(JFt(e))return!0;var n=ZFt;return r&&r.strict===!1&&(n=XFt),n(e)}});var SFe=E((ojr,yFe)=>{"use strict";var QFt=_Fe(),ejt=W("path").posix.dirname,tjt=W("os").platform()==="win32",RX="/",rjt=/\\/g,njt=/[\{\[].*[\}\]]$/,ijt=/(^|[^\\])([\{\[]|\([^\)]+$)/,sjt=/\\([\!\*\?\|\[\]\(\)\{\}])/g;yFe.exports=function(e,r){var n=Object.assign({flipBackslashes:!0},r);n.flipBackslashes&&tjt&&e.indexOf(RX)<0&&(e=e.replace(rjt,RX)),njt.test(e)&&(e+=RX),e+="a";do e=ejt(e);while(QFt(e)||ijt.test(e));return e.replace(sjt,"$1")}});var gM=E(Ms=>{"use strict";Ms.isInteger=t=>typeof t=="number"?Number.isInteger(t):typeof t=="string"&&t.trim()!==""?Number.isInteger(Number(t)):!1;Ms.find=(t,e)=>t.nodes.find(r=>r.type===e);Ms.exceedsLimit=(t,e,r=1,n)=>n===!1||!Ms.isInteger(t)||!Ms.isInteger(e)?!1:(Number(e)-Number(t))/Number(r)>=n;Ms.escapeNode=(t,e=0,r)=>{let n=t.nodes[e];n&&(r&&n.type===r||n.type==="open"||n.type==="close")&&n.escaped!==!0&&(n.value="\\"+n.value,n.escaped=!0)};Ms.encloseBrace=t=>t.type!=="brace"?!1:t.commas>>0+t.ranges>>0===0?(t.invalid=!0,!0):!1;Ms.isInvalidBrace=t=>t.type!=="brace"?!1:t.invalid===!0||t.dollar?!0:t.commas>>0+t.ranges>>0===0||t.open!==!0||t.close!==!0?(t.invalid=!0,!0):!1;Ms.isOpenOrClose=t=>t.type==="open"||t.type==="close"?!0:t.open===!0||t.close===!0;Ms.reduce=t=>t.reduce((e,r)=>(r.type==="text"&&e.push(r.value),r.type==="range"&&(r.type="text"),e),[]);Ms.flatten=(...t)=>{let e=[],r=n=>{for(let i=0;i<n.length;i++){let s=n[i];if(Array.isArray(s)){r(s);continue}s!==void 0&&e.push(s)}return e};return r(t),e}});var _M=E((cjr,vFe)=>{"use strict";var EFe=gM();vFe.exports=(t,e={})=>{let r=(n,i={})=>{let s=e.escapeInvalid&&EFe.isInvalidBrace(i),o=n.invalid===!0&&e.escapeInvalid===!0,a="";if(n.value)return(s||o)&&EFe.isOpenOrClose(n)?"\\"+n.value:n.value;if(n.value)return n.value;if(n.nodes)for(let c of n.nodes)a+=r(c);return a};return r(t)}});var TFe=E((ljr,bFe)=>{"use strict";bFe.exports=function(t){return typeof t=="number"?t-t===0:typeof t=="string"&&t.trim()!==""?Number.isFinite?Number.isFinite(+t):isFinite(+t):!1}});var NFe=E((ujr,CFe)=>{"use strict";var wFe=TFe(),dh=(t,e,r)=>{if(wFe(t)===!1)throw new TypeError("toRegexRange: expected the first argument to be a number");if(e===void 0||t===e)return String(t);if(wFe(e)===!1)throw new TypeError("toRegexRange: expected the second argument to be a number.");let n={relaxZeros:!0,...r};typeof n.strictZeros=="boolean"&&(n.relaxZeros=n.strictZeros===!1);let i=String(n.relaxZeros),s=String(n.shorthand),o=String(n.capture),a=String(n.wrap),c=t+":"+e+"="+i+s+o+a;if(dh.cache.hasOwnProperty(c))return dh.cache[c].result;let l=Math.min(t,e),u=Math.max(t,e);if(Math.abs(l-u)===1){let m=t+"|"+e;return n.capture?`(${m})`:n.wrap===!1?m:`(?:${m})`}let d=PFe(t)||PFe(e),f={min:t,max:e,a:l,b:u},p=[],h=[];if(d&&(f.isPadded=d,f.maxLen=String(f.max).length),l<0){let m=u<0?Math.abs(u):1;h=AFe(m,Math.abs(l),f,n),l=f.a=0}return u>=0&&(p=AFe(l,u,f,n)),f.negatives=h,f.positives=p,f.result=ojt(h,p,n),n.capture===!0?f.result=`(${f.result})`:n.wrap!==!1&&p.length+h.length>1&&(f.result=`(?:${f.result})`),dh.cache[c]=f,f.result};function ojt(t,e,r){let n=xX(t,e,"-",!1,r)||[],i=xX(e,t,"",!1,r)||[],s=xX(t,e,"-?",!0,r)||[];return n.concat(s).concat(i).join("|")}function ajt(t,e){let r=1,n=1,i=xFe(t,r),s=new Set([e]);for(;t<=i&&i<=e;)s.add(i),r+=1,i=xFe(t,r);for(i=IFe(e+1,n)-1;t<i&&i<=e;)s.add(i),n+=1,i=IFe(e+1,n)-1;return s=[...s],s.sort(ujt),s}function cjt(t,e,r){if(t===e)return{pattern:t,count:[],digits:0};let n=ljt(t,e),i=n.length,s="",o=0;for(let a=0;a<i;a++){let[c,l]=n[a];c===l?s+=c:c!=="0"||l!=="9"?s+=djt(c,l,r):o++}return o&&(s+=r.shorthand===!0?"\\d":"[0-9]"),{pattern:s,count:[o],digits:i}}function AFe(t,e,r,n){let i=ajt(t,e),s=[],o=t,a;for(let c=0;c<i.length;c++){let l=i[c],u=cjt(String(o),String(l),n),d="";if(!r.isPadded&&a&&a.pattern===u.pattern){a.count.length>1&&a.count.pop(),a.count.push(u.count[0]),a.string=a.pattern+OFe(a.count),o=l+1;continue}r.isPadded&&(d=fjt(l,r,n)),u.string=d+u.pattern+OFe(u.count),s.push(u),o=l+1,a=u}return s}function xX(t,e,r,n,i){let s=[];for(let o of t){let{string:a}=o;!n&&!RFe(e,"string",a)&&s.push(r+a),n&&RFe(e,"string",a)&&s.push(r+a)}return s}function ljt(t,e){let r=[];for(let n=0;n<t.length;n++)r.push([t[n],e[n]]);return r}function ujt(t,e){return t>e?1:e>t?-1:0}function RFe(t,e,r){return t.some(n=>n[e]===r)}function xFe(t,e){return Number(String(t).slice(0,-e)+"9".repeat(e))}function IFe(t,e){return t-t%Math.pow(10,e)}function OFe(t){let[e=0,r=""]=t;return r||e>1?`{${e+(r?","+r:"")}}`:""}function djt(t,e,r){return`[${t}${e-t===1?"":"-"}${e}]`}function PFe(t){return/^-?(0+)\d/.test(t)}function fjt(t,e,r){if(!e.isPadded)return t;let n=Math.abs(e.maxLen-String(t).length),i=r.relaxZeros!==!1;switch(n){case 0:return"";case 1:return i?"0?":"0";case 2:return i?"0{0,2}":"00";default:return i?`0{0,${n}}`:`0{${n}}`}}dh.cache={};dh.clearCache=()=>dh.cache={};CFe.exports=dh});var PX=E((djr,FFe)=>{"use strict";var pjt=W("util"),$Fe=NFe(),kFe=t=>t!==null&&typeof t=="object"&&!Array.isArray(t),hjt=t=>e=>t===!0?Number(e):String(e),IX=t=>typeof t=="number"||typeof t=="string"&&t!=="",z0=t=>Number.isInteger(+t),OX=t=>{let e=`${t}`,r=-1;if(e[0]==="-"&&(e=e.slice(1)),e==="0")return!1;for(;e[++r]==="0";);return r>0},mjt=(t,e,r)=>typeof t=="string"||typeof e=="string"?!0:r.stringify===!0,gjt=(t,e,r)=>{if(e>0){let n=t[0]==="-"?"-":"";n&&(t=t.slice(1)),t=n+t.padStart(n?e-1:e,"0")}return r===!1?String(t):t},SM=(t,e)=>{let r=t[0]==="-"?"-":"";for(r&&(t=t.slice(1),e--);t.length<e;)t="0"+t;return r?"-"+t:t},_jt=(t,e,r)=>{t.negatives.sort((a,c)=>a<c?-1:a>c?1:0),t.positives.sort((a,c)=>a<c?-1:a>c?1:0);let n=e.capture?"":"?:",i="",s="",o;return t.positives.length&&(i=t.positives.map(a=>SM(String(a),r)).join("|")),t.negatives.length&&(s=`-(${n}${t.negatives.map(a=>SM(String(a),r)).join("|")})`),i&&s?o=`${i}|${s}`:o=i||s,e.wrap?`(${n}${o})`:o},LFe=(t,e,r,n)=>{if(r)return $Fe(t,e,{wrap:!1,...n});let i=String.fromCharCode(t);if(t===e)return i;let s=String.fromCharCode(e);return`[${i}-${s}]`},DFe=(t,e,r)=>{if(Array.isArray(t)){let n=r.wrap===!0,i=r.capture?"":"?:";return n?`(${i}${t.join("|")})`:t.join("|")}return $Fe(t,e,r)},MFe=(...t)=>new RangeError("Invalid range arguments: "+pjt.inspect(...t)),UFe=(t,e,r)=>{if(r.strictRanges===!0)throw MFe([t,e]);return[]},yjt=(t,e)=>{if(e.strictRanges===!0)throw new TypeError(`Expected step "${t}" to be a number`);return[]},Sjt=(t,e,r=1,n={})=>{let i=Number(t),s=Number(e);if(!Number.isInteger(i)||!Number.isInteger(s)){if(n.strictRanges===!0)throw MFe([t,e]);return[]}i===0&&(i=0),s===0&&(s=0);let o=i>s,a=String(t),c=String(e),l=String(r);r=Math.max(Math.abs(r),1);let u=OX(a)||OX(c)||OX(l),d=u?Math.max(a.length,c.length,l.length):0,f=u===!1&&mjt(t,e,n)===!1,p=n.transform||hjt(f);if(n.toRegex&&r===1)return LFe(SM(t,d),SM(e,d),!0,n);let h={negatives:[],positives:[]},m=v=>h[v<0?"negatives":"positives"].push(Math.abs(v)),_=[],y=0;for(;o?i>=s:i<=s;)n.toRegex===!0&&r>1?m(i):_.push(gjt(p(i,y),d,f)),i=o?i-r:i+r,y++;return n.toRegex===!0?r>1?_jt(h,n,d):DFe(_,null,{wrap:!1,...n}):_},Ejt=(t,e,r=1,n={})=>{if(!z0(t)&&t.length>1||!z0(e)&&e.length>1)return UFe(t,e,n);let i=n.transform||(f=>String.fromCharCode(f)),s=`${t}`.charCodeAt(0),o=`${e}`.charCodeAt(0),a=s>o,c=Math.min(s,o),l=Math.max(s,o);if(n.toRegex&&r===1)return LFe(c,l,!1,n);let u=[],d=0;for(;a?s>=o:s<=o;)u.push(i(s,d)),s=a?s-r:s+r,d++;return n.toRegex===!0?DFe(u,null,{wrap:!1,options:n}):u},yM=(t,e,r,n={})=>{if(e==null&&IX(t))return[t];if(!IX(t)||!IX(e))return UFe(t,e,n);if(typeof r=="function")return yM(t,e,1,{transform:r});if(kFe(r))return yM(t,e,0,r);let i={...n};return i.capture===!0&&(i.wrap=!0),r=r||i.step||1,z0(r)?z0(t)&&z0(e)?Sjt(t,e,r,i):Ejt(t,e,Math.max(Math.abs(r),1),i):r!=null&&!kFe(r)?yjt(r,i):yM(t,e,1,r)};FFe.exports=yM});var BFe=E((fjr,qFe)=>{"use strict";var vjt=PX(),jFe=gM(),bjt=(t,e={})=>{let r=(n,i={})=>{let s=jFe.isInvalidBrace(i),o=n.invalid===!0&&e.escapeInvalid===!0,a=s===!0||o===!0,c=e.escapeInvalid===!0?"\\":"",l="";if(n.isOpen===!0)return c+n.value;if(n.isClose===!0)return console.log("node.isClose",c,n.value),c+n.value;if(n.type==="open")return a?c+n.value:"(";if(n.type==="close")return a?c+n.value:")";if(n.type==="comma")return n.prev.type==="comma"?"":a?n.value:"|";if(n.value)return n.value;if(n.nodes&&n.ranges>0){let u=jFe.reduce(n.nodes),d=vjt(...u,{...e,wrap:!1,toRegex:!0,strictZeros:!0});if(d.length!==0)return u.length>1&&d.length>1?`(${d})`:d}if(n.nodes)for(let u of n.nodes)l+=r(u,n);return l};return r(t)};qFe.exports=bjt});var HFe=E((pjr,VFe)=>{"use strict";var Tjt=PX(),zFe=_M(),SS=gM(),fh=(t="",e="",r=!1)=>{let n=[];if(t=[].concat(t),e=[].concat(e),!e.length)return t;if(!t.length)return r?SS.flatten(e).map(i=>`{${i}}`):e;for(let i of t)if(Array.isArray(i))for(let s of i)n.push(fh(s,e,r));else for(let s of e)r===!0&&typeof s=="string"&&(s=`{${s}}`),n.push(Array.isArray(s)?fh(i,s,r):i+s);return SS.flatten(n)},wjt=(t,e={})=>{let r=e.rangeLimit===void 0?1e3:e.rangeLimit,n=(i,s={})=>{i.queue=[];let o=s,a=s.queue;for(;o.type!=="brace"&&o.type!=="root"&&o.parent;)o=o.parent,a=o.queue;if(i.invalid||i.dollar){a.push(fh(a.pop(),zFe(i,e)));return}if(i.type==="brace"&&i.invalid!==!0&&i.nodes.length===2){a.push(fh(a.pop(),["{}"]));return}if(i.nodes&&i.ranges>0){let d=SS.reduce(i.nodes);if(SS.exceedsLimit(...d,e.step,r))throw new RangeError("expanded array length exceeds range limit. Use options.rangeLimit to increase or disable the limit.");let f=Tjt(...d,e);f.length===0&&(f=zFe(i,e)),a.push(fh(a.pop(),f)),i.nodes=[];return}let c=SS.encloseBrace(i),l=i.queue,u=i;for(;u.type!=="brace"&&u.type!=="root"&&u.parent;)u=u.parent,l=u.queue;for(let d=0;d<i.nodes.length;d++){let f=i.nodes[d];if(f.type==="comma"&&i.type==="brace"){d===1&&l.push(""),l.push("");continue}if(f.type==="close"){a.push(fh(a.pop(),l,c));continue}if(f.value&&f.type!=="open"){l.push(fh(l.pop(),f.value));continue}f.nodes&&n(f,i)}return l};return SS.flatten(n(t))};VFe.exports=wjt});var WFe=E((hjr,GFe)=>{"use strict";GFe.exports={MAX_LENGTH:1e4,CHAR_0:"0",CHAR_9:"9",CHAR_UPPERCASE_A:"A",CHAR_LOWERCASE_A:"a",CHAR_UPPERCASE_Z:"Z",CHAR_LOWERCASE_Z:"z",CHAR_LEFT_PARENTHESES:"(",CHAR_RIGHT_PARENTHESES:")",CHAR_ASTERISK:"*",CHAR_AMPERSAND:"&",CHAR_AT:"@",CHAR_BACKSLASH:"\\",CHAR_BACKTICK:"`",CHAR_CARRIAGE_RETURN:"\r",CHAR_CIRCUMFLEX_ACCENT:"^",CHAR_COLON:":",CHAR_COMMA:",",CHAR_DOLLAR:"$",CHAR_DOT:".",CHAR_DOUBLE_QUOTE:'"',CHAR_EQUAL:"=",CHAR_EXCLAMATION_MARK:"!",CHAR_FORM_FEED:"\f",CHAR_FORWARD_SLASH:"/",CHAR_HASH:"#",CHAR_HYPHEN_MINUS:"-",CHAR_LEFT_ANGLE_BRACKET:"<",CHAR_LEFT_CURLY_BRACE:"{",CHAR_LEFT_SQUARE_BRACKET:"[",CHAR_LINE_FEED:`
394
+ `,CHAR_NO_BREAK_SPACE:"\xA0",CHAR_PERCENT:"%",CHAR_PLUS:"+",CHAR_QUESTION_MARK:"?",CHAR_RIGHT_ANGLE_BRACKET:">",CHAR_RIGHT_CURLY_BRACE:"}",CHAR_RIGHT_SQUARE_BRACKET:"]",CHAR_SEMICOLON:";",CHAR_SINGLE_QUOTE:"'",CHAR_SPACE:" ",CHAR_TAB:" ",CHAR_UNDERSCORE:"_",CHAR_VERTICAL_LINE:"|",CHAR_ZERO_WIDTH_NOBREAK_SPACE:"\uFEFF"}});var XFe=E((mjr,ZFe)=>{"use strict";var Ajt=_M(),{MAX_LENGTH:YFe,CHAR_BACKSLASH:CX,CHAR_BACKTICK:Rjt,CHAR_COMMA:xjt,CHAR_DOT:Ijt,CHAR_LEFT_PARENTHESES:Ojt,CHAR_RIGHT_PARENTHESES:Pjt,CHAR_LEFT_CURLY_BRACE:Cjt,CHAR_RIGHT_CURLY_BRACE:Njt,CHAR_LEFT_SQUARE_BRACKET:KFe,CHAR_RIGHT_SQUARE_BRACKET:JFe,CHAR_DOUBLE_QUOTE:kjt,CHAR_SINGLE_QUOTE:$jt,CHAR_NO_BREAK_SPACE:Ljt,CHAR_ZERO_WIDTH_NOBREAK_SPACE:Djt}=WFe(),Mjt=(t,e={})=>{if(typeof t!="string")throw new TypeError("Expected a string");let r=e||{},n=typeof r.maxLength=="number"?Math.min(YFe,r.maxLength):YFe;if(t.length>n)throw new SyntaxError(`Input length (${t.length}), exceeds max characters (${n})`);let i={type:"root",input:t,nodes:[]},s=[i],o=i,a=i,c=0,l=t.length,u=0,d=0,f,p=()=>t[u++],h=m=>{if(m.type==="text"&&a.type==="dot"&&(a.type="text"),a&&a.type==="text"&&m.type==="text"){a.value+=m.value;return}return o.nodes.push(m),m.parent=o,m.prev=a,a=m,m};for(h({type:"bos"});u<l;)if(o=s[s.length-1],f=p(),!(f===Djt||f===Ljt)){if(f===CX){h({type:"text",value:(e.keepEscaping?f:"")+p()});continue}if(f===JFe){h({type:"text",value:"\\"+f});continue}if(f===KFe){c++;let m;for(;u<l&&(m=p());){if(f+=m,m===KFe){c++;continue}if(m===CX){f+=p();continue}if(m===JFe&&(c--,c===0))break}h({type:"text",value:f});continue}if(f===Ojt){o=h({type:"paren",nodes:[]}),s.push(o),h({type:"text",value:f});continue}if(f===Pjt){if(o.type!=="paren"){h({type:"text",value:f});continue}o=s.pop(),h({type:"text",value:f}),o=s[s.length-1];continue}if(f===kjt||f===$jt||f===Rjt){let m=f,_;for(e.keepQuotes!==!0&&(f="");u<l&&(_=p());){if(_===CX){f+=_+p();continue}if(_===m){e.keepQuotes===!0&&(f+=_);break}f+=_}h({type:"text",value:f});continue}if(f===Cjt){d++;let _={type:"brace",open:!0,close:!1,dollar:a.value&&a.value.slice(-1)==="$"||o.dollar===!0,depth:d,commas:0,ranges:0,nodes:[]};o=h(_),s.push(o),h({type:"open",value:f});continue}if(f===Njt){if(o.type!=="brace"){h({type:"text",value:f});continue}let m="close";o=s.pop(),o.close=!0,h({type:m,value:f}),d--,o=s[s.length-1];continue}if(f===xjt&&d>0){if(o.ranges>0){o.ranges=0;let m=o.nodes.shift();o.nodes=[m,{type:"text",value:Ajt(o)}]}h({type:"comma",value:f}),o.commas++;continue}if(f===Ijt&&d>0&&o.commas===0){let m=o.nodes;if(d===0||m.length===0){h({type:"text",value:f});continue}if(a.type==="dot"){if(o.range=[],a.value+=f,a.type="range",o.nodes.length!==3&&o.nodes.length!==5){o.invalid=!0,o.ranges=0,a.type="text";continue}o.ranges++,o.args=[];continue}if(a.type==="range"){m.pop();let _=m[m.length-1];_.value+=a.value+f,a=_,o.ranges--;continue}h({type:"dot",value:f});continue}h({type:"text",value:f})}do if(o=s.pop(),o.type!=="root"){o.nodes.forEach(y=>{y.nodes||(y.type==="open"&&(y.isOpen=!0),y.type==="close"&&(y.isClose=!0),y.nodes||(y.type="text"),y.invalid=!0)});let m=s[s.length-1],_=m.nodes.indexOf(o);m.nodes.splice(_,1,...o.nodes)}while(s.length>0);return h({type:"eos"}),i};ZFe.exports=Mjt});var tje=E((gjr,eje)=>{"use strict";var QFe=_M(),Ujt=BFe(),Fjt=HFe(),jjt=XFe(),Qi=(t,e={})=>{let r=[];if(Array.isArray(t))for(let n of t){let i=Qi.create(n,e);Array.isArray(i)?r.push(...i):r.push(i)}else r=[].concat(Qi.create(t,e));return e&&e.expand===!0&&e.nodupes===!0&&(r=[...new Set(r)]),r};Qi.parse=(t,e={})=>jjt(t,e);Qi.stringify=(t,e={})=>QFe(typeof t=="string"?Qi.parse(t,e):t,e);Qi.compile=(t,e={})=>(typeof t=="string"&&(t=Qi.parse(t,e)),Ujt(t,e));Qi.expand=(t,e={})=>{typeof t=="string"&&(t=Qi.parse(t,e));let r=Fjt(t,e);return e.noempty===!0&&(r=r.filter(Boolean)),e.nodupes===!0&&(r=[...new Set(r)]),r};Qi.create=(t,e={})=>t===""||t.length<3?[t]:e.expand!==!0?Qi.compile(t,e):Qi.expand(t,e);eje.exports=Qi});var V0=E((_jr,oje)=>{"use strict";var qjt=W("path"),qa="\\\\/",rje=`[^${qa}]`,Bjt=0,_l="\\.",zjt="\\+",Vjt="\\?",EM="\\/",Hjt="(?=.)",nje="[^/]",NX=`(?:${EM}|$)`,ije=`(?:^|${EM})`,kX=`${_l}{1,2}${NX}`,Gjt=`(?!${_l})`,Wjt=`(?!${ije}${kX})`,Yjt=`(?!${_l}{0,1}${NX})`,Kjt=`(?!${kX})`,Jjt=`[^.${EM}]`,Zjt=`${nje}*?`,sje={DOT_LITERAL:_l,PLUS_LITERAL:zjt,QMARK_LITERAL:Vjt,SLASH_LITERAL:EM,ONE_CHAR:Hjt,QMARK:nje,END_ANCHOR:NX,DOTS_SLASH:kX,NO_DOT:Gjt,NO_DOTS:Wjt,NO_DOT_SLASH:Yjt,NO_DOTS_SLASH:Kjt,QMARK_NO_DOT:Jjt,STAR:Zjt,START_ANCHOR:ije},Xjt={...sje,SLASH_LITERAL:`[${qa}]`,QMARK:rje,STAR:`${rje}*?`,DOTS_SLASH:`${_l}{1,2}(?:[${qa}]|$)`,NO_DOT:`(?!${_l})`,NO_DOTS:`(?!(?:^|[${qa}])${_l}{1,2}(?:[${qa}]|$))`,NO_DOT_SLASH:`(?!${_l}{0,1}(?:[${qa}]|$))`,NO_DOTS_SLASH:`(?!${_l}{1,2}(?:[${qa}]|$))`,QMARK_NO_DOT:`[^.${qa}]`,START_ANCHOR:`(?:^|[${qa}])`,END_ANCHOR:`(?:[${qa}]|$)`},Qjt={__proto__:null,alnum:"a-zA-Z0-9",alpha:"a-zA-Z",ascii:"\\x00-\\x7F",blank:" \\t",cntrl:"\\x00-\\x1F\\x7F",digit:"0-9",graph:"\\x21-\\x7E",lower:"a-z",print:"\\x20-\\x7E ",punct:"\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",space:" \\t\\r\\n\\v\\f",upper:"A-Z",word:"A-Za-z0-9_",xdigit:"A-Fa-f0-9"};oje.exports={DEFAULT_MAX_EXTGLOB_RECURSION:Bjt,MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:Qjt,REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,REGEX_NON_SPECIAL_CHARS:/^[^@![\].,$*+?^{}()|\\/]+/,REGEX_SPECIAL_CHARS:/[-*+?.^${}(|)[\]]/,REGEX_SPECIAL_CHARS_BACKREF:/(\\?)((\W)(\3*))/g,REGEX_SPECIAL_CHARS_GLOBAL:/([-*+?.^${}(|)[\]])/g,REGEX_REMOVE_BACKSLASH:/(?:\[.*?[^\\]\]|\\(?=.))/g,REPLACEMENTS:{__proto__:null,"***":"*","**/**":"**","**/**/**":"**"},CHAR_0:48,CHAR_9:57,CHAR_UPPERCASE_A:65,CHAR_LOWERCASE_A:97,CHAR_UPPERCASE_Z:90,CHAR_LOWERCASE_Z:122,CHAR_LEFT_PARENTHESES:40,CHAR_RIGHT_PARENTHESES:41,CHAR_ASTERISK:42,CHAR_AMPERSAND:38,CHAR_AT:64,CHAR_BACKWARD_SLASH:92,CHAR_CARRIAGE_RETURN:13,CHAR_CIRCUMFLEX_ACCENT:94,CHAR_COLON:58,CHAR_COMMA:44,CHAR_DOT:46,CHAR_DOUBLE_QUOTE:34,CHAR_EQUAL:61,CHAR_EXCLAMATION_MARK:33,CHAR_FORM_FEED:12,CHAR_FORWARD_SLASH:47,CHAR_GRAVE_ACCENT:96,CHAR_HASH:35,CHAR_HYPHEN_MINUS:45,CHAR_LEFT_ANGLE_BRACKET:60,CHAR_LEFT_CURLY_BRACE:123,CHAR_LEFT_SQUARE_BRACKET:91,CHAR_LINE_FEED:10,CHAR_NO_BREAK_SPACE:160,CHAR_PERCENT:37,CHAR_PLUS:43,CHAR_QUESTION_MARK:63,CHAR_RIGHT_ANGLE_BRACKET:62,CHAR_RIGHT_CURLY_BRACE:125,CHAR_RIGHT_SQUARE_BRACKET:93,CHAR_SEMICOLON:59,CHAR_SINGLE_QUOTE:39,CHAR_SPACE:32,CHAR_TAB:9,CHAR_UNDERSCORE:95,CHAR_VERTICAL_LINE:124,CHAR_ZERO_WIDTH_NOBREAK_SPACE:65279,SEP:qjt.sep,extglobChars(t){return{"!":{type:"negate",open:"(?:(?!(?:",close:`))${t.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}},globChars(t){return t===!0?Xjt:sje}}});var H0=E(Pi=>{"use strict";var eqt=W("path"),tqt=process.platform==="win32",{REGEX_BACKSLASH:rqt,REGEX_REMOVE_BACKSLASH:nqt,REGEX_SPECIAL_CHARS:iqt,REGEX_SPECIAL_CHARS_GLOBAL:sqt}=V0();Pi.isObject=t=>t!==null&&typeof t=="object"&&!Array.isArray(t);Pi.hasRegexChars=t=>iqt.test(t);Pi.isRegexChar=t=>t.length===1&&Pi.hasRegexChars(t);Pi.escapeRegex=t=>t.replace(sqt,"\\$1");Pi.toPosixSlashes=t=>t.replace(rqt,"/");Pi.removeBackslashes=t=>t.replace(nqt,e=>e==="\\"?"":e);Pi.supportsLookbehinds=()=>{let t=process.version.slice(1).split(".").map(Number);return t.length===3&&t[0]>=9||t[0]===8&&t[1]>=10};Pi.isWindows=t=>t&&typeof t.windows=="boolean"?t.windows:tqt===!0||eqt.sep==="\\";Pi.escapeLast=(t,e,r)=>{let n=t.lastIndexOf(e,r);return n===-1?t:t[n-1]==="\\"?Pi.escapeLast(t,e,n-1):`${t.slice(0,n)}\\${t.slice(n)}`};Pi.removePrefix=(t,e={})=>{let r=t;return r.startsWith("./")&&(r=r.slice(2),e.prefix="./"),r};Pi.wrapOutput=(t,e={},r={})=>{let n=r.contains?"":"^",i=r.contains?"":"$",s=`${n}(?:${t})${i}`;return e.negated===!0&&(s=`(?:^(?!${s}).*$)`),s}});var hje=E((Sjr,pje)=>{"use strict";var aje=H0(),{CHAR_ASTERISK:$X,CHAR_AT:oqt,CHAR_BACKWARD_SLASH:G0,CHAR_COMMA:aqt,CHAR_DOT:LX,CHAR_EXCLAMATION_MARK:DX,CHAR_FORWARD_SLASH:fje,CHAR_LEFT_CURLY_BRACE:MX,CHAR_LEFT_PARENTHESES:UX,CHAR_LEFT_SQUARE_BRACKET:cqt,CHAR_PLUS:lqt,CHAR_QUESTION_MARK:cje,CHAR_RIGHT_CURLY_BRACE:uqt,CHAR_RIGHT_PARENTHESES:lje,CHAR_RIGHT_SQUARE_BRACKET:dqt}=V0(),uje=t=>t===fje||t===G0,dje=t=>{t.isPrefix!==!0&&(t.depth=t.isGlobstar?1/0:1)},fqt=(t,e)=>{let r=e||{},n=t.length-1,i=r.parts===!0||r.scanToEnd===!0,s=[],o=[],a=[],c=t,l=-1,u=0,d=0,f=!1,p=!1,h=!1,m=!1,_=!1,y=!1,v=!1,S=!1,g=!1,T=!1,I=0,x,R,O={value:"",depth:0,isGlob:!1},A=()=>l>=n,b=()=>c.charCodeAt(l+1),L=()=>(x=R,c.charCodeAt(++l));for(;l<n;){R=L();let F;if(R===G0){v=O.backslashes=!0,R=L(),R===MX&&(y=!0);continue}if(y===!0||R===MX){for(I++;A()!==!0&&(R=L());){if(R===G0){v=O.backslashes=!0,L();continue}if(R===MX){I++;continue}if(y!==!0&&R===LX&&(R=L())===LX){if(f=O.isBrace=!0,h=O.isGlob=!0,T=!0,i===!0)continue;break}if(y!==!0&&R===aqt){if(f=O.isBrace=!0,h=O.isGlob=!0,T=!0,i===!0)continue;break}if(R===uqt&&(I--,I===0)){y=!1,f=O.isBrace=!0,T=!0;break}}if(i===!0)continue;break}if(R===fje){if(s.push(l),o.push(O),O={value:"",depth:0,isGlob:!1},T===!0)continue;if(x===LX&&l===u+1){u+=2;continue}d=l+1;continue}if(r.noext!==!0&&(R===lqt||R===oqt||R===$X||R===cje||R===DX)===!0&&b()===UX){if(h=O.isGlob=!0,m=O.isExtglob=!0,T=!0,R===DX&&l===u&&(g=!0),i===!0){for(;A()!==!0&&(R=L());){if(R===G0){v=O.backslashes=!0,R=L();continue}if(R===lje){h=O.isGlob=!0,T=!0;break}}continue}break}if(R===$X){if(x===$X&&(_=O.isGlobstar=!0),h=O.isGlob=!0,T=!0,i===!0)continue;break}if(R===cje){if(h=O.isGlob=!0,T=!0,i===!0)continue;break}if(R===cqt){for(;A()!==!0&&(F=L());){if(F===G0){v=O.backslashes=!0,L();continue}if(F===dqt){p=O.isBracket=!0,h=O.isGlob=!0,T=!0;break}}if(i===!0)continue;break}if(r.nonegate!==!0&&R===DX&&l===u){S=O.negated=!0,u++;continue}if(r.noparen!==!0&&R===UX){if(h=O.isGlob=!0,i===!0){for(;A()!==!0&&(R=L());){if(R===UX){v=O.backslashes=!0,R=L();continue}if(R===lje){T=!0;break}}continue}break}if(h===!0){if(T=!0,i===!0)continue;break}}r.noext===!0&&(m=!1,h=!1);let C=c,w="",P="";u>0&&(w=c.slice(0,u),c=c.slice(u),d-=u),C&&h===!0&&d>0?(C=c.slice(0,d),P=c.slice(d)):h===!0?(C="",P=c):C=c,C&&C!==""&&C!=="/"&&C!==c&&uje(C.charCodeAt(C.length-1))&&(C=C.slice(0,-1)),r.unescape===!0&&(P&&(P=aje.removeBackslashes(P)),C&&v===!0&&(C=aje.removeBackslashes(C)));let N={prefix:w,input:t,start:u,base:C,glob:P,isBrace:f,isBracket:p,isGlob:h,isExtglob:m,isGlobstar:_,negated:S,negatedExtglob:g};if(r.tokens===!0&&(N.maxDepth=0,uje(R)||o.push(O),N.tokens=o),r.parts===!0||r.tokens===!0){let F;for(let V=0;V<s.length;V++){let de=F?F+1:u,Te=s[V],Ie=t.slice(de,Te);r.tokens&&(V===0&&u!==0?(o[V].isPrefix=!0,o[V].value=w):o[V].value=Ie,dje(o[V]),N.maxDepth+=o[V].depth),(V!==0||Ie!=="")&&a.push(Ie),F=Te}if(F&&F+1<t.length){let V=t.slice(F+1);a.push(V),r.tokens&&(o[o.length-1].value=V,dje(o[o.length-1]),N.maxDepth+=o[o.length-1].depth)}N.slashes=s,N.parts=a}return N};pje.exports=fqt});var Sje=E((Ejr,yje)=>{"use strict";var W0=V0(),Dn=H0(),{MAX_LENGTH:vM,POSIX_REGEX_SOURCE:pqt,REGEX_NON_SPECIAL_CHARS:hqt,REGEX_SPECIAL_CHARS_BACKREF:mqt,REPLACEMENTS:mje}=W0,gqt=(t,e)=>{if(typeof e.expandRange=="function")return e.expandRange(...t,e);t.sort();let r=`[${t.join("-")}]`;try{new RegExp(r)}catch{return t.map(i=>Dn.escapeRegex(i)).join("..")}return r},ES=(t,e)=>`Missing ${t}: "${e}" - use "\\\\${e}" to match literal characters`,gje=t=>{let e=[],r=0,n=0,i=0,s="",o=!1;for(let a of t){if(o===!0){s+=a,o=!1;continue}if(a==="\\"){s+=a,o=!0;continue}if(a==='"'){i=i===1?0:1,s+=a;continue}if(i===0){if(a==="[")r++;else if(a==="]"&&r>0)r--;else if(r===0){if(a==="(")n++;else if(a===")"&&n>0)n--;else if(a==="|"&&n===0){e.push(s),s="";continue}}}s+=a}return e.push(s),e},_qt=t=>{let e=!1;for(let r of t){if(e===!0){e=!1;continue}if(r==="\\"){e=!0;continue}if(/[?*+@!()[\]{}]/.test(r))return!1}return!0},_je=t=>{let e=t.trim(),r=!0;for(;r===!0;)r=!1,/^@\([^\\()[\]{}|]+\)$/.test(e)&&(e=e.slice(2,-1),r=!0);if(_qt(e))return e.replace(/\\(.)/g,"$1")},yqt=t=>{let e=t.map(_je).filter(Boolean);for(let r=0;r<e.length;r++)for(let n=r+1;n<e.length;n++){let i=e[r],s=e[n],o=i[0];if(!(!o||i!==o.repeat(i.length)||s!==o.repeat(s.length))&&(i===s||i.startsWith(s)||s.startsWith(i)))return!0}return!1},FX=(t,e=!0)=>{if(t[0]!=="+"&&t[0]!=="*"||t[1]!=="(")return;let r=0,n=0,i=0,s=!1;for(let o=1;o<t.length;o++){let a=t[o];if(s===!0){s=!1;continue}if(a==="\\"){s=!0;continue}if(a==='"'){i=i===1?0:1;continue}if(i!==1){if(a==="["){r++;continue}if(a==="]"&&r>0){r--;continue}if(!(r>0)){if(a==="("){n++;continue}if(a===")"&&(n--,n===0))return e===!0&&o!==t.length-1?void 0:{type:t[0],body:t.slice(2,o),end:o}}}}},Sqt=t=>{let e=0,r=[];for(;e<t.length;){let i=FX(t.slice(e),!1);if(!i||i.type!=="*")return;let s=gje(i.body).map(a=>a.trim());if(s.length!==1)return;let o=_je(s[0]);if(!o||o.length!==1)return;r.push(o),e+=i.end+1}return r.length<1?void 0:`${r.length===1?Dn.escapeRegex(r[0]):`[${r.map(i=>Dn.escapeRegex(i)).join("")}]`}*`},Eqt=t=>{let e=0,r=t.trim(),n=FX(r);for(;n;)e++,r=n.body.trim(),n=FX(r);return e},vqt=(t,e)=>{if(e.maxExtglobRecursion===!1)return{risky:!1};let r=typeof e.maxExtglobRecursion=="number"?e.maxExtglobRecursion:W0.DEFAULT_MAX_EXTGLOB_RECURSION,n=gje(t).map(i=>i.trim());if(n.length>1&&(n.some(i=>i==="")||n.some(i=>/^[*?]+$/.test(i))||yqt(n)))return{risky:!0};for(let i of n){let s=Sqt(i);if(s)return{risky:!0,safeOutput:s};if(Eqt(i)>r)return{risky:!0}}return{risky:!1}},jX=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");t=mje[t]||t;let r={...e},n=typeof r.maxLength=="number"?Math.min(vM,r.maxLength):vM,i=t.length;if(i>n)throw new SyntaxError(`Input length: ${i}, exceeds maximum allowed length: ${n}`);let s={type:"bos",value:"",output:r.prepend||""},o=[s],a=r.capture?"":"?:",c=Dn.isWindows(e),l=W0.globChars(c),u=W0.extglobChars(l),{DOT_LITERAL:d,PLUS_LITERAL:f,SLASH_LITERAL:p,ONE_CHAR:h,DOTS_SLASH:m,NO_DOT:_,NO_DOT_SLASH:y,NO_DOTS_SLASH:v,QMARK:S,QMARK_NO_DOT:g,STAR:T,START_ANCHOR:I}=l,x=j=>`(${a}(?:(?!${I}${j.dot?m:d}).)*?)`,R=r.dot?"":_,O=r.dot?S:g,A=r.bash===!0?x(r):T;r.capture&&(A=`(${A})`),typeof r.noext=="boolean"&&(r.noextglob=r.noext);let b={input:t,index:-1,start:0,dot:r.dot===!0,consumed:"",output:"",prefix:"",backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:o};t=Dn.removePrefix(t,b),i=t.length;let L=[],C=[],w=[],P=s,N,F=()=>b.index===i-1,V=b.peek=(j=1)=>t[b.index+j],de=b.advance=()=>t[++b.index]||"",Te=()=>t.slice(b.index+1),Ie=(j="",se=0)=>{b.consumed+=j,b.index+=se},$e=j=>{b.output+=j.output!=null?j.output:j.value,Ie(j.value)},oe=()=>{let j=1;for(;V()==="!"&&(V(2)!=="("||V(3)==="?");)de(),b.start++,j++;return j%2===0?!1:(b.negated=!0,b.start++,!0)},Ee=j=>{b[j]++,w.push(j)},he=j=>{b[j]--,w.pop()},k=j=>{if(P.type==="globstar"){let se=b.braces>0&&(j.type==="comma"||j.type==="brace"),M=j.extglob===!0||L.length&&(j.type==="pipe"||j.type==="paren");j.type!=="slash"&&j.type!=="paren"&&!se&&!M&&(b.output=b.output.slice(0,-P.output.length),P.type="star",P.value="*",P.output=A,b.output+=P.output)}if(L.length&&j.type!=="paren"&&(L[L.length-1].inner+=j.value),(j.value||j.output)&&$e(j),P&&P.type==="text"&&j.type==="text"){P.value+=j.value,P.output=(P.output||"")+j.value;return}j.prev=P,o.push(j),P=j},U=(j,se)=>{let M={...u[se],conditions:1,inner:""};M.prev=P,M.parens=b.parens,M.output=b.output,M.startIndex=b.index,M.tokensIndex=o.length;let D=(r.capture?"(":"")+M.open;Ee("parens"),k({type:j,value:se,output:b.output?"":h}),k({type:"paren",extglob:!0,value:de(),output:D}),L.push(M)},ne=j=>{let se=t.slice(j.startIndex,b.index+1),M=t.slice(j.startIndex+2,b.index),D=vqt(M,r);if((j.type==="plus"||j.type==="star")&&D.risky){let H=D.safeOutput?(j.output?"":h)+(r.capture?`(${D.safeOutput})`:D.safeOutput):void 0,z=o[j.tokensIndex];z.type="text",z.value=se,z.output=H||Dn.escapeRegex(se);for(let K=j.tokensIndex+1;K<o.length;K++)o[K].value="",o[K].output="",delete o[K].suffix;b.output=j.output+z.output,b.backtrack=!0,k({type:"paren",extglob:!0,value:N,output:""}),he("parens");return}let B=j.close+(r.capture?")":""),J;if(j.type==="negate"){let H=A;if(j.inner&&j.inner.length>1&&j.inner.includes("/")&&(H=x(r)),(H!==A||F()||/^\)+$/.test(Te()))&&(B=j.close=`)$))${H}`),j.inner.includes("*")&&(J=Te())&&/^\.[^\\/.]+$/.test(J)){let z=jX(J,{...e,fastpaths:!1}).output;B=j.close=`)${z})${H})`}j.prev.type==="bos"&&(b.negatedExtglob=!0)}k({type:"paren",extglob:!0,value:N,output:B}),he("parens")};if(r.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(t)){let j=!1,se=t.replace(mqt,(M,D,B,J,H,z)=>J==="\\"?(j=!0,M):J==="?"?D?D+J+(H?S.repeat(H.length):""):z===0?O+(H?S.repeat(H.length):""):S.repeat(B.length):J==="."?d.repeat(B.length):J==="*"?D?D+J+(H?A:""):A:D?M:`\\${M}`);return j===!0&&(r.unescape===!0?se=se.replace(/\\/g,""):se=se.replace(/\\+/g,M=>M.length%2===0?"\\\\":M?"\\":"")),se===t&&r.contains===!0?(b.output=t,b):(b.output=Dn.wrapOutput(se,b,e),b)}for(;!F();){if(N=de(),N==="\0")continue;if(N==="\\"){let M=V();if(M==="/"&&r.bash!==!0||M==="."||M===";")continue;if(!M){N+="\\",k({type:"text",value:N});continue}let D=/^\\+/.exec(Te()),B=0;if(D&&D[0].length>2&&(B=D[0].length,b.index+=B,B%2!==0&&(N+="\\")),r.unescape===!0?N=de():N+=de(),b.brackets===0){k({type:"text",value:N});continue}}if(b.brackets>0&&(N!=="]"||P.value==="["||P.value==="[^")){if(r.posix!==!1&&N===":"){let M=P.value.slice(1);if(M.includes("[")&&(P.posix=!0,M.includes(":"))){let D=P.value.lastIndexOf("["),B=P.value.slice(0,D),J=P.value.slice(D+2),H=pqt[J];if(H){P.value=B+H,b.backtrack=!0,de(),!s.output&&o.indexOf(P)===1&&(s.output=h);continue}}}(N==="["&&V()!==":"||N==="-"&&V()==="]")&&(N=`\\${N}`),N==="]"&&(P.value==="["||P.value==="[^")&&(N=`\\${N}`),r.posix===!0&&N==="!"&&P.value==="["&&(N="^"),P.value+=N,$e({value:N});continue}if(b.quotes===1&&N!=='"'){N=Dn.escapeRegex(N),P.value+=N,$e({value:N});continue}if(N==='"'){b.quotes=b.quotes===1?0:1,r.keepQuotes===!0&&k({type:"text",value:N});continue}if(N==="("){Ee("parens"),k({type:"paren",value:N});continue}if(N===")"){if(b.parens===0&&r.strictBrackets===!0)throw new SyntaxError(ES("opening","("));let M=L[L.length-1];if(M&&b.parens===M.parens+1){ne(L.pop());continue}k({type:"paren",value:N,output:b.parens?")":"\\)"}),he("parens");continue}if(N==="["){if(r.nobracket===!0||!Te().includes("]")){if(r.nobracket!==!0&&r.strictBrackets===!0)throw new SyntaxError(ES("closing","]"));N=`\\${N}`}else Ee("brackets");k({type:"bracket",value:N});continue}if(N==="]"){if(r.nobracket===!0||P&&P.type==="bracket"&&P.value.length===1){k({type:"text",value:N,output:`\\${N}`});continue}if(b.brackets===0){if(r.strictBrackets===!0)throw new SyntaxError(ES("opening","["));k({type:"text",value:N,output:`\\${N}`});continue}he("brackets");let M=P.value.slice(1);if(P.posix!==!0&&M[0]==="^"&&!M.includes("/")&&(N=`/${N}`),P.value+=N,$e({value:N}),r.literalBrackets===!1||Dn.hasRegexChars(M))continue;let D=Dn.escapeRegex(P.value);if(b.output=b.output.slice(0,-P.value.length),r.literalBrackets===!0){b.output+=D,P.value=D;continue}P.value=`(${a}${D}|${P.value})`,b.output+=P.value;continue}if(N==="{"&&r.nobrace!==!0){Ee("braces");let M={type:"brace",value:N,output:"(",outputIndex:b.output.length,tokensIndex:b.tokens.length};C.push(M),k(M);continue}if(N==="}"){let M=C[C.length-1];if(r.nobrace===!0||!M){k({type:"text",value:N,output:N});continue}let D=")";if(M.dots===!0){let B=o.slice(),J=[];for(let H=B.length-1;H>=0&&(o.pop(),B[H].type!=="brace");H--)B[H].type!=="dots"&&J.unshift(B[H].value);D=gqt(J,r),b.backtrack=!0}if(M.comma!==!0&&M.dots!==!0){let B=b.output.slice(0,M.outputIndex),J=b.tokens.slice(M.tokensIndex);M.value=M.output="\\{",N=D="\\}",b.output=B;for(let H of J)b.output+=H.output||H.value}k({type:"brace",value:N,output:D}),he("braces"),C.pop();continue}if(N==="|"){L.length>0&&L[L.length-1].conditions++,k({type:"text",value:N});continue}if(N===","){let M=N,D=C[C.length-1];D&&w[w.length-1]==="braces"&&(D.comma=!0,M="|"),k({type:"comma",value:N,output:M});continue}if(N==="/"){if(P.type==="dot"&&b.index===b.start+1){b.start=b.index+1,b.consumed="",b.output="",o.pop(),P=s;continue}k({type:"slash",value:N,output:p});continue}if(N==="."){if(b.braces>0&&P.type==="dot"){P.value==="."&&(P.output=d);let M=C[C.length-1];P.type="dots",P.output+=N,P.value+=N,M.dots=!0;continue}if(b.braces+b.parens===0&&P.type!=="bos"&&P.type!=="slash"){k({type:"text",value:N,output:d});continue}k({type:"dot",value:N,output:d});continue}if(N==="?"){if(!(P&&P.value==="(")&&r.noextglob!==!0&&V()==="("&&V(2)!=="?"){U("qmark",N);continue}if(P&&P.type==="paren"){let D=V(),B=N;if(D==="<"&&!Dn.supportsLookbehinds())throw new Error("Node.js v10 or higher is required for regex lookbehinds");(P.value==="("&&!/[!=<:]/.test(D)||D==="<"&&!/<([!=]|\w+>)/.test(Te()))&&(B=`\\${N}`),k({type:"text",value:N,output:B});continue}if(r.dot!==!0&&(P.type==="slash"||P.type==="bos")){k({type:"qmark",value:N,output:g});continue}k({type:"qmark",value:N,output:S});continue}if(N==="!"){if(r.noextglob!==!0&&V()==="("&&(V(2)!=="?"||!/[!=<:]/.test(V(3)))){U("negate",N);continue}if(r.nonegate!==!0&&b.index===0){oe();continue}}if(N==="+"){if(r.noextglob!==!0&&V()==="("&&V(2)!=="?"){U("plus",N);continue}if(P&&P.value==="("||r.regex===!1){k({type:"plus",value:N,output:f});continue}if(P&&(P.type==="bracket"||P.type==="paren"||P.type==="brace")||b.parens>0){k({type:"plus",value:N});continue}k({type:"plus",value:f});continue}if(N==="@"){if(r.noextglob!==!0&&V()==="("&&V(2)!=="?"){k({type:"at",extglob:!0,value:N,output:""});continue}k({type:"text",value:N});continue}if(N!=="*"){(N==="$"||N==="^")&&(N=`\\${N}`);let M=hqt.exec(Te());M&&(N+=M[0],b.index+=M[0].length),k({type:"text",value:N});continue}if(P&&(P.type==="globstar"||P.star===!0)){P.type="star",P.star=!0,P.value+=N,P.output=A,b.backtrack=!0,b.globstar=!0,Ie(N);continue}let j=Te();if(r.noextglob!==!0&&/^\([^?]/.test(j)){U("star",N);continue}if(P.type==="star"){if(r.noglobstar===!0){Ie(N);continue}let M=P.prev,D=M.prev,B=M.type==="slash"||M.type==="bos",J=D&&(D.type==="star"||D.type==="globstar");if(r.bash===!0&&(!B||j[0]&&j[0]!=="/")){k({type:"star",value:N,output:""});continue}let H=b.braces>0&&(M.type==="comma"||M.type==="brace"),z=L.length&&(M.type==="pipe"||M.type==="paren");if(!B&&M.type!=="paren"&&!H&&!z){k({type:"star",value:N,output:""});continue}for(;j.slice(0,3)==="/**";){let K=t[b.index+4];if(K&&K!=="/")break;j=j.slice(3),Ie("/**",3)}if(M.type==="bos"&&F()){P.type="globstar",P.value+=N,P.output=x(r),b.output=P.output,b.globstar=!0,Ie(N);continue}if(M.type==="slash"&&M.prev.type!=="bos"&&!J&&F()){b.output=b.output.slice(0,-(M.output+P.output).length),M.output=`(?:${M.output}`,P.type="globstar",P.output=x(r)+(r.strictSlashes?")":"|$)"),P.value+=N,b.globstar=!0,b.output+=M.output+P.output,Ie(N);continue}if(M.type==="slash"&&M.prev.type!=="bos"&&j[0]==="/"){let K=j[1]!==void 0?"|$":"";b.output=b.output.slice(0,-(M.output+P.output).length),M.output=`(?:${M.output}`,P.type="globstar",P.output=`${x(r)}${p}|${p}${K})`,P.value+=N,b.output+=M.output+P.output,b.globstar=!0,Ie(N+de()),k({type:"slash",value:"/",output:""});continue}if(M.type==="bos"&&j[0]==="/"){P.type="globstar",P.value+=N,P.output=`(?:^|${p}|${x(r)}${p})`,b.output=P.output,b.globstar=!0,Ie(N+de()),k({type:"slash",value:"/",output:""});continue}b.output=b.output.slice(0,-P.output.length),P.type="globstar",P.output=x(r),P.value+=N,b.output+=P.output,b.globstar=!0,Ie(N);continue}let se={type:"star",value:N,output:A};if(r.bash===!0){se.output=".*?",(P.type==="bos"||P.type==="slash")&&(se.output=R+se.output),k(se);continue}if(P&&(P.type==="bracket"||P.type==="paren")&&r.regex===!0){se.output=N,k(se);continue}(b.index===b.start||P.type==="slash"||P.type==="dot")&&(P.type==="dot"?(b.output+=y,P.output+=y):r.dot===!0?(b.output+=v,P.output+=v):(b.output+=R,P.output+=R),V()!=="*"&&(b.output+=h,P.output+=h)),k(se)}for(;b.brackets>0;){if(r.strictBrackets===!0)throw new SyntaxError(ES("closing","]"));b.output=Dn.escapeLast(b.output,"["),he("brackets")}for(;b.parens>0;){if(r.strictBrackets===!0)throw new SyntaxError(ES("closing",")"));b.output=Dn.escapeLast(b.output,"("),he("parens")}for(;b.braces>0;){if(r.strictBrackets===!0)throw new SyntaxError(ES("closing","}"));b.output=Dn.escapeLast(b.output,"{"),he("braces")}if(r.strictSlashes!==!0&&(P.type==="star"||P.type==="bracket")&&k({type:"maybe_slash",value:"",output:`${p}?`}),b.backtrack===!0){b.output="";for(let j of b.tokens)b.output+=j.output!=null?j.output:j.value,j.suffix&&(b.output+=j.suffix)}return b};jX.fastpaths=(t,e)=>{let r={...e},n=typeof r.maxLength=="number"?Math.min(vM,r.maxLength):vM,i=t.length;if(i>n)throw new SyntaxError(`Input length: ${i}, exceeds maximum allowed length: ${n}`);t=mje[t]||t;let s=Dn.isWindows(e),{DOT_LITERAL:o,SLASH_LITERAL:a,ONE_CHAR:c,DOTS_SLASH:l,NO_DOT:u,NO_DOTS:d,NO_DOTS_SLASH:f,STAR:p,START_ANCHOR:h}=W0.globChars(s),m=r.dot?d:u,_=r.dot?f:u,y=r.capture?"":"?:",v={negated:!1,prefix:""},S=r.bash===!0?".*?":p;r.capture&&(S=`(${S})`);let g=R=>R.noglobstar===!0?S:`(${y}(?:(?!${h}${R.dot?l:o}).)*?)`,T=R=>{switch(R){case"*":return`${m}${c}${S}`;case".*":return`${o}${c}${S}`;case"*.*":return`${m}${S}${o}${c}${S}`;case"*/*":return`${m}${S}${a}${c}${_}${S}`;case"**":return m+g(r);case"**/*":return`(?:${m}${g(r)}${a})?${_}${c}${S}`;case"**/*.*":return`(?:${m}${g(r)}${a})?${_}${S}${o}${c}${S}`;case"**/.*":return`(?:${m}${g(r)}${a})?${o}${c}${S}`;default:{let O=/^(.*?)\.(\w+)$/.exec(R);if(!O)return;let A=T(O[1]);return A?A+o+O[2]:void 0}}},I=Dn.removePrefix(t,v),x=T(I);return x&&r.strictSlashes!==!0&&(x+=`${a}?`),x};yje.exports=jX});var vje=E((vjr,Eje)=>{"use strict";var bqt=W("path"),Tqt=hje(),qX=Sje(),BX=H0(),wqt=V0(),Aqt=t=>t&&typeof t=="object"&&!Array.isArray(t),wr=(t,e,r=!1)=>{if(Array.isArray(t)){let u=t.map(f=>wr(f,e,r));return f=>{for(let p of u){let h=p(f);if(h)return h}return!1}}let n=Aqt(t)&&t.tokens&&t.input;if(t===""||typeof t!="string"&&!n)throw new TypeError("Expected pattern to be a non-empty string");let i=e||{},s=BX.isWindows(e),o=n?wr.compileRe(t,e):wr.makeRe(t,e,!1,!0),a=o.state;delete o.state;let c=()=>!1;if(i.ignore){let u={...e,ignore:null,onMatch:null,onResult:null};c=wr(i.ignore,u,r)}let l=(u,d=!1)=>{let{isMatch:f,match:p,output:h}=wr.test(u,o,e,{glob:t,posix:s}),m={glob:t,state:a,regex:o,posix:s,input:u,output:h,match:p,isMatch:f};return typeof i.onResult=="function"&&i.onResult(m),f===!1?(m.isMatch=!1,d?m:!1):c(u)?(typeof i.onIgnore=="function"&&i.onIgnore(m),m.isMatch=!1,d?m:!1):(typeof i.onMatch=="function"&&i.onMatch(m),d?m:!0)};return r&&(l.state=a),l};wr.test=(t,e,r,{glob:n,posix:i}={})=>{if(typeof t!="string")throw new TypeError("Expected input to be a string");if(t==="")return{isMatch:!1,output:""};let s=r||{},o=s.format||(i?BX.toPosixSlashes:null),a=t===n,c=a&&o?o(t):t;return a===!1&&(c=o?o(t):t,a=c===n),(a===!1||s.capture===!0)&&(s.matchBase===!0||s.basename===!0?a=wr.matchBase(t,e,r,i):a=e.exec(c)),{isMatch:!!a,match:a,output:c}};wr.matchBase=(t,e,r,n=BX.isWindows(r))=>(e instanceof RegExp?e:wr.makeRe(e,r)).test(bqt.basename(t));wr.isMatch=(t,e,r)=>wr(e,r)(t);wr.parse=(t,e)=>Array.isArray(t)?t.map(r=>wr.parse(r,e)):qX(t,{...e,fastpaths:!1});wr.scan=(t,e)=>Tqt(t,e);wr.compileRe=(t,e,r=!1,n=!1)=>{if(r===!0)return t.output;let i=e||{},s=i.contains?"":"^",o=i.contains?"":"$",a=`${s}(?:${t.output})${o}`;t&&t.negated===!0&&(a=`^(?!${a}).*$`);let c=wr.toRegex(a,e);return n===!0&&(c.state=t),c};wr.makeRe=(t,e={},r=!1,n=!1)=>{if(!t||typeof t!="string")throw new TypeError("Expected a non-empty string");let i={negated:!1,fastpaths:!0};return e.fastpaths!==!1&&(t[0]==="."||t[0]==="*")&&(i.output=qX.fastpaths(t,e)),i.output||(i=qX(t,e)),wr.compileRe(i,e,r,n)};wr.toRegex=(t,e)=>{try{let r=e||{};return new RegExp(t,r.flags||(r.nocase?"i":""))}catch(r){if(e&&e.debug===!0)throw r;return/$^/}};wr.constants=wqt;Eje.exports=wr});var Tje=E((bjr,bje)=>{"use strict";bje.exports=vje()});var VX=E((Tjr,Ije)=>{"use strict";var Aje=W("util"),Rje=tje(),Ba=Tje(),zX=H0(),wje=t=>t===""||t==="./",xje=t=>{let e=t.indexOf("{");return e>-1&&t.indexOf("}",e)>-1},er=(t,e,r)=>{e=[].concat(e),t=[].concat(t);let n=new Set,i=new Set,s=new Set,o=0,a=u=>{s.add(u.output),r&&r.onResult&&r.onResult(u)};for(let u=0;u<e.length;u++){let d=Ba(String(e[u]),{...r,onResult:a},!0),f=d.state.negated||d.state.negatedExtglob;f&&o++;for(let p of t){let h=d(p,!0);(f?!h.isMatch:h.isMatch)&&(f?n.add(h.output):(n.delete(h.output),i.add(h.output)))}}let l=(o===e.length?[...s]:[...i]).filter(u=>!n.has(u));if(r&&l.length===0){if(r.failglob===!0)throw new Error(`No matches found for "${e.join(", ")}"`);if(r.nonull===!0||r.nullglob===!0)return r.unescape?e.map(u=>u.replace(/\\/g,"")):e}return l};er.match=er;er.matcher=(t,e)=>Ba(t,e);er.isMatch=(t,e,r)=>Ba(e,r)(t);er.any=er.isMatch;er.not=(t,e,r={})=>{e=[].concat(e).map(String);let n=new Set,i=[],s=a=>{r.onResult&&r.onResult(a),i.push(a.output)},o=new Set(er(t,e,{...r,onResult:s}));for(let a of i)o.has(a)||n.add(a);return[...n]};er.contains=(t,e,r)=>{if(typeof t!="string")throw new TypeError(`Expected a string: "${Aje.inspect(t)}"`);if(Array.isArray(e))return e.some(n=>er.contains(t,n,r));if(typeof e=="string"){if(wje(t)||wje(e))return!1;if(t.includes(e)||t.startsWith("./")&&t.slice(2).includes(e))return!0}return er.isMatch(t,e,{...r,contains:!0})};er.matchKeys=(t,e,r)=>{if(!zX.isObject(t))throw new TypeError("Expected the first argument to be an object");let n=er(Object.keys(t),e,r),i={};for(let s of n)i[s]=t[s];return i};er.some=(t,e,r)=>{let n=[].concat(t);for(let i of[].concat(e)){let s=Ba(String(i),r);if(n.some(o=>s(o)))return!0}return!1};er.every=(t,e,r)=>{let n=[].concat(t);for(let i of[].concat(e)){let s=Ba(String(i),r);if(!n.every(o=>s(o)))return!1}return!0};er.all=(t,e,r)=>{if(typeof t!="string")throw new TypeError(`Expected a string: "${Aje.inspect(t)}"`);return[].concat(e).every(n=>Ba(n,r)(t))};er.capture=(t,e,r)=>{let n=zX.isWindows(r),s=Ba.makeRe(String(t),{...r,capture:!0}).exec(n?zX.toPosixSlashes(e):e);if(s)return s.slice(1).map(o=>o===void 0?"":o)};er.makeRe=(...t)=>Ba.makeRe(...t);er.scan=(...t)=>Ba.scan(...t);er.parse=(t,e)=>{let r=[];for(let n of[].concat(t||[]))for(let i of Rje(String(n),e))r.push(Ba.parse(i,e));return r};er.braces=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");return e&&e.nobrace===!0||!xje(t)?[t]:Rje(t,e)};er.braceExpand=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");return er.braces(t,{...e,expand:!0})};er.hasBraces=xje;Ije.exports=er});var Uje=E(je=>{"use strict";Object.defineProperty(je,"__esModule",{value:!0});je.isAbsolute=je.partitionAbsoluteAndRelative=je.removeDuplicateSlashes=je.matchAny=je.convertPatternsToRe=je.makeRe=je.getPatternParts=je.expandBraceExpansion=je.expandPatternsWithBraceExpansion=je.isAffectDepthOfReadingPattern=je.endsWithSlashGlobStar=je.hasGlobStar=je.getBaseDirectory=je.isPatternRelatedToParentDirectory=je.getPatternsOutsideCurrentDirectory=je.getPatternsInsideCurrentDirectory=je.getPositivePatterns=je.getNegativePatterns=je.isPositivePattern=je.isNegativePattern=je.convertToNegativePattern=je.convertToPositivePattern=je.isDynamicPattern=je.isStaticPattern=void 0;var Oje=W("path"),Rqt=SFe(),HX=VX(),Pje="**",xqt="\\",Iqt=/[*?]|^!/,Oqt=/\[[^[]*]/,Pqt=/(?:^|[^!*+?@])\([^(]*\|[^|]*\)/,Cqt=/[!*+?@]\([^(]*\)/,Nqt=/,|\.\./,kqt=/(?!^)\/{2,}/g;function Cje(t,e={}){return!Nje(t,e)}je.isStaticPattern=Cje;function Nje(t,e={}){return t===""?!1:!!(e.caseSensitiveMatch===!1||t.includes(xqt)||Iqt.test(t)||Oqt.test(t)||Pqt.test(t)||e.extglob!==!1&&Cqt.test(t)||e.braceExpansion!==!1&&$qt(t))}je.isDynamicPattern=Nje;function $qt(t){let e=t.indexOf("{");if(e===-1)return!1;let r=t.indexOf("}",e+1);if(r===-1)return!1;let n=t.slice(e,r);return Nqt.test(n)}function Lqt(t){return bM(t)?t.slice(1):t}je.convertToPositivePattern=Lqt;function Dqt(t){return"!"+t}je.convertToNegativePattern=Dqt;function bM(t){return t.startsWith("!")&&t[1]!=="("}je.isNegativePattern=bM;function kje(t){return!bM(t)}je.isPositivePattern=kje;function Mqt(t){return t.filter(bM)}je.getNegativePatterns=Mqt;function Uqt(t){return t.filter(kje)}je.getPositivePatterns=Uqt;function Fqt(t){return t.filter(e=>!GX(e))}je.getPatternsInsideCurrentDirectory=Fqt;function jqt(t){return t.filter(GX)}je.getPatternsOutsideCurrentDirectory=jqt;function GX(t){return t.startsWith("..")||t.startsWith("./..")}je.isPatternRelatedToParentDirectory=GX;function qqt(t){return Rqt(t,{flipBackslashes:!1})}je.getBaseDirectory=qqt;function Bqt(t){return t.includes(Pje)}je.hasGlobStar=Bqt;function $je(t){return t.endsWith("/"+Pje)}je.endsWithSlashGlobStar=$je;function zqt(t){let e=Oje.basename(t);return $je(t)||Cje(e)}je.isAffectDepthOfReadingPattern=zqt;function Vqt(t){return t.reduce((e,r)=>e.concat(Lje(r)),[])}je.expandPatternsWithBraceExpansion=Vqt;function Lje(t){let e=HX.braces(t,{expand:!0,nodupes:!0,keepEscaping:!0});return e.sort((r,n)=>r.length-n.length),e.filter(r=>r!=="")}je.expandBraceExpansion=Lje;function Hqt(t,e){let{parts:r}=HX.scan(t,Object.assign(Object.assign({},e),{parts:!0}));return r.length===0&&(r=[t]),r[0].startsWith("/")&&(r[0]=r[0].slice(1),r.unshift("")),r}je.getPatternParts=Hqt;function Dje(t,e){return HX.makeRe(t,e)}je.makeRe=Dje;function Gqt(t,e){return t.map(r=>Dje(r,e))}je.convertPatternsToRe=Gqt;function Wqt(t,e){return e.some(r=>r.test(t))}je.matchAny=Wqt;function Yqt(t){return t.replace(kqt,"/")}je.removeDuplicateSlashes=Yqt;function Kqt(t){let e=[],r=[];for(let n of t)Mje(n)?e.push(n):r.push(n);return[e,r]}je.partitionAbsoluteAndRelative=Kqt;function Mje(t){return Oje.isAbsolute(t)}je.isAbsolute=Mje});var Bje=E((Ajr,qje)=>{"use strict";var Jqt=W("stream"),Fje=Jqt.PassThrough,Zqt=Array.prototype.slice;qje.exports=Xqt;function Xqt(){let t=[],e=Zqt.call(arguments),r=!1,n=e[e.length-1];n&&!Array.isArray(n)&&n.pipe==null?e.pop():n={};let i=n.end!==!1,s=n.pipeError===!0;n.objectMode==null&&(n.objectMode=!0),n.highWaterMark==null&&(n.highWaterMark=64*1024);let o=Fje(n);function a(){for(let u=0,d=arguments.length;u<d;u++)t.push(jje(arguments[u],n));return c(),this}function c(){if(r)return;r=!0;let u=t.shift();if(!u){process.nextTick(l);return}Array.isArray(u)||(u=[u]);let d=u.length+1;function f(){--d>0||(r=!1,c())}function p(h){function m(){h.removeListener("merge2UnpipeEnd",m),h.removeListener("end",m),s&&h.removeListener("error",_),f()}function _(y){o.emit("error",y)}if(h._readableState.endEmitted)return f();h.on("merge2UnpipeEnd",m),h.on("end",m),s&&h.on("error",_),h.pipe(o,{end:!1}),h.resume()}for(let h=0;h<u.length;h++)p(u[h]);f()}function l(){r=!1,o.emit("queueDrain"),i&&o.end()}return o.setMaxListeners(0),o.add=a,o.on("unpipe",function(u){u.emit("merge2UnpipeEnd")}),e.length&&a.apply(null,e),o}function jje(t,e){if(Array.isArray(t))for(let r=0,n=t.length;r<n;r++)t[r]=jje(t[r],e);else{if(!t._readableState&&t.pipe&&(t=t.pipe(Fje(e))),!t._readableState||!t.pause||!t.pipe)throw new Error("Only readable stream can be merged.");t.pause()}return t}});var Vje=E(TM=>{"use strict";Object.defineProperty(TM,"__esModule",{value:!0});TM.merge=void 0;var Qqt=Bje();function e2t(t){let e=Qqt(t);return t.forEach(r=>{r.once("error",n=>e.emit("error",n))}),e.once("close",()=>zje(t)),e.once("end",()=>zje(t)),e}TM.merge=e2t;function zje(t){t.forEach(e=>e.emit("close"))}});var Hje=E(vS=>{"use strict";Object.defineProperty(vS,"__esModule",{value:!0});vS.isEmpty=vS.isString=void 0;function t2t(t){return typeof t=="string"}vS.isString=t2t;function r2t(t){return t===""}vS.isEmpty=r2t});var yl=E(Mn=>{"use strict";Object.defineProperty(Mn,"__esModule",{value:!0});Mn.string=Mn.stream=Mn.pattern=Mn.path=Mn.fs=Mn.errno=Mn.array=void 0;var n2t=oFe();Mn.array=n2t;var i2t=aFe();Mn.errno=i2t;var s2t=cFe();Mn.fs=s2t;var o2t=fFe();Mn.path=o2t;var a2t=Uje();Mn.pattern=a2t;var c2t=Vje();Mn.stream=c2t;var l2t=Hje();Mn.string=l2t});var Kje=E(Un=>{"use strict";Object.defineProperty(Un,"__esModule",{value:!0});Un.convertPatternGroupToTask=Un.convertPatternGroupsToTasks=Un.groupPatternsByBaseDirectory=Un.getNegativePatternsAsPositive=Un.getPositivePatterns=Un.convertPatternsToTasks=Un.generate=void 0;var Co=yl();function u2t(t,e){let r=Gje(t,e),n=Gje(e.ignore,e),i=Wje(r),s=Yje(r,n),o=i.filter(u=>Co.pattern.isStaticPattern(u,e)),a=i.filter(u=>Co.pattern.isDynamicPattern(u,e)),c=WX(o,s,!1),l=WX(a,s,!0);return c.concat(l)}Un.generate=u2t;function Gje(t,e){let r=t;return e.braceExpansion&&(r=Co.pattern.expandPatternsWithBraceExpansion(r)),e.baseNameMatch&&(r=r.map(n=>n.includes("/")?n:`**/${n}`)),r.map(n=>Co.pattern.removeDuplicateSlashes(n))}function WX(t,e,r){let n=[],i=Co.pattern.getPatternsOutsideCurrentDirectory(t),s=Co.pattern.getPatternsInsideCurrentDirectory(t),o=YX(i),a=YX(s);return n.push(...KX(o,e,r)),"."in a?n.push(JX(".",s,e,r)):n.push(...KX(a,e,r)),n}Un.convertPatternsToTasks=WX;function Wje(t){return Co.pattern.getPositivePatterns(t)}Un.getPositivePatterns=Wje;function Yje(t,e){return Co.pattern.getNegativePatterns(t).concat(e).map(Co.pattern.convertToPositivePattern)}Un.getNegativePatternsAsPositive=Yje;function YX(t){let e={};return t.reduce((r,n)=>{let i=Co.pattern.getBaseDirectory(n);return i in r?r[i].push(n):r[i]=[n],r},e)}Un.groupPatternsByBaseDirectory=YX;function KX(t,e,r){return Object.keys(t).map(n=>JX(n,t[n],e,r))}Un.convertPatternGroupsToTasks=KX;function JX(t,e,r,n){return{dynamic:n,positive:e,negative:r,base:t,patterns:[].concat(e,r.map(Co.pattern.convertToNegativePattern))}}Un.convertPatternGroupToTask=JX});var Zje=E(wM=>{"use strict";Object.defineProperty(wM,"__esModule",{value:!0});wM.read=void 0;function d2t(t,e,r){e.fs.lstat(t,(n,i)=>{if(n!==null){Jje(r,n);return}if(!i.isSymbolicLink()||!e.followSymbolicLink){ZX(r,i);return}e.fs.stat(t,(s,o)=>{if(s!==null){if(e.throwErrorOnBrokenSymbolicLink){Jje(r,s);return}ZX(r,i);return}e.markSymbolicLink&&(o.isSymbolicLink=()=>!0),ZX(r,o)})})}wM.read=d2t;function Jje(t,e){t(e)}function ZX(t,e){t(null,e)}});var Xje=E(AM=>{"use strict";Object.defineProperty(AM,"__esModule",{value:!0});AM.read=void 0;function f2t(t,e){let r=e.fs.lstatSync(t);if(!r.isSymbolicLink()||!e.followSymbolicLink)return r;try{let n=e.fs.statSync(t);return e.markSymbolicLink&&(n.isSymbolicLink=()=>!0),n}catch(n){if(!e.throwErrorOnBrokenSymbolicLink)return r;throw n}}AM.read=f2t});var Qje=E(Ad=>{"use strict";Object.defineProperty(Ad,"__esModule",{value:!0});Ad.createFileSystemAdapter=Ad.FILE_SYSTEM_ADAPTER=void 0;var RM=W("fs");Ad.FILE_SYSTEM_ADAPTER={lstat:RM.lstat,stat:RM.stat,lstatSync:RM.lstatSync,statSync:RM.statSync};function p2t(t){return t===void 0?Ad.FILE_SYSTEM_ADAPTER:Object.assign(Object.assign({},Ad.FILE_SYSTEM_ADAPTER),t)}Ad.createFileSystemAdapter=p2t});var eqe=E(QX=>{"use strict";Object.defineProperty(QX,"__esModule",{value:!0});var h2t=Qje(),XX=class{constructor(e={}){this._options=e,this.followSymbolicLink=this._getValue(this._options.followSymbolicLink,!0),this.fs=h2t.createFileSystemAdapter(this._options.fs),this.markSymbolicLink=this._getValue(this._options.markSymbolicLink,!1),this.throwErrorOnBrokenSymbolicLink=this._getValue(this._options.throwErrorOnBrokenSymbolicLink,!0)}_getValue(e,r){return e??r}};QX.default=XX});var ph=E(Rd=>{"use strict";Object.defineProperty(Rd,"__esModule",{value:!0});Rd.statSync=Rd.stat=Rd.Settings=void 0;var tqe=Zje(),m2t=Xje(),e7=eqe();Rd.Settings=e7.default;function g2t(t,e,r){if(typeof e=="function"){tqe.read(t,t7(),e);return}tqe.read(t,t7(e),r)}Rd.stat=g2t;function _2t(t,e){let r=t7(e);return m2t.read(t,r)}Rd.statSync=_2t;function t7(t={}){return t instanceof e7.default?t:new e7.default(t)}});var iqe=E((Ljr,nqe)=>{"use strict";var rqe;nqe.exports=typeof queueMicrotask=="function"?queueMicrotask.bind(typeof window<"u"?window:global):t=>(rqe||(rqe=Promise.resolve())).then(t).catch(e=>setTimeout(()=>{throw e},0))});var oqe=E((Djr,sqe)=>{"use strict";sqe.exports=S2t;var y2t=iqe();function S2t(t,e){let r,n,i,s=!0;Array.isArray(t)?(r=[],n=t.length):(i=Object.keys(t),r={},n=i.length);function o(c){function l(){e&&e(c,r),e=null}s?y2t(l):l()}function a(c,l,u){r[c]=u,(--n===0||l)&&o(l)}n?i?i.forEach(function(c){t[c](function(l,u){a(c,l,u)})}):t.forEach(function(c,l){c(function(u,d){a(l,u,d)})}):o(null),s=!1}});var r7=E(IM=>{"use strict";Object.defineProperty(IM,"__esModule",{value:!0});IM.IS_SUPPORT_READDIR_WITH_FILE_TYPES=void 0;var xM=process.versions.node.split(".");if(xM[0]===void 0||xM[1]===void 0)throw new Error(`Unexpected behavior. The 'process.versions.node' variable has invalid value: ${process.versions.node}`);var aqe=Number.parseInt(xM[0],10),E2t=Number.parseInt(xM[1],10),cqe=10,v2t=10,b2t=aqe>cqe,T2t=aqe===cqe&&E2t>=v2t;IM.IS_SUPPORT_READDIR_WITH_FILE_TYPES=b2t||T2t});var lqe=E(OM=>{"use strict";Object.defineProperty(OM,"__esModule",{value:!0});OM.createDirentFromStats=void 0;var n7=class{constructor(e,r){this.name=e,this.isBlockDevice=r.isBlockDevice.bind(r),this.isCharacterDevice=r.isCharacterDevice.bind(r),this.isDirectory=r.isDirectory.bind(r),this.isFIFO=r.isFIFO.bind(r),this.isFile=r.isFile.bind(r),this.isSocket=r.isSocket.bind(r),this.isSymbolicLink=r.isSymbolicLink.bind(r)}};function w2t(t,e){return new n7(t,e)}OM.createDirentFromStats=w2t});var i7=E(PM=>{"use strict";Object.defineProperty(PM,"__esModule",{value:!0});PM.fs=void 0;var A2t=lqe();PM.fs=A2t});var s7=E(CM=>{"use strict";Object.defineProperty(CM,"__esModule",{value:!0});CM.joinPathSegments=void 0;function R2t(t,e,r){return t.endsWith(r)?t+e:t+r+e}CM.joinPathSegments=R2t});var mqe=E(xd=>{"use strict";Object.defineProperty(xd,"__esModule",{value:!0});xd.readdir=xd.readdirWithFileTypes=xd.read=void 0;var x2t=ph(),uqe=oqe(),I2t=r7(),dqe=i7(),fqe=s7();function O2t(t,e,r){if(!e.stats&&I2t.IS_SUPPORT_READDIR_WITH_FILE_TYPES){pqe(t,e,r);return}hqe(t,e,r)}xd.read=O2t;function pqe(t,e,r){e.fs.readdir(t,{withFileTypes:!0},(n,i)=>{if(n!==null){NM(r,n);return}let s=i.map(a=>({dirent:a,name:a.name,path:fqe.joinPathSegments(t,a.name,e.pathSegmentSeparator)}));if(!e.followSymbolicLinks){o7(r,s);return}let o=s.map(a=>P2t(a,e));uqe(o,(a,c)=>{if(a!==null){NM(r,a);return}o7(r,c)})})}xd.readdirWithFileTypes=pqe;function P2t(t,e){return r=>{if(!t.dirent.isSymbolicLink()){r(null,t);return}e.fs.stat(t.path,(n,i)=>{if(n!==null){if(e.throwErrorOnBrokenSymbolicLink){r(n);return}r(null,t);return}t.dirent=dqe.fs.createDirentFromStats(t.name,i),r(null,t)})}}function hqe(t,e,r){e.fs.readdir(t,(n,i)=>{if(n!==null){NM(r,n);return}let s=i.map(o=>{let a=fqe.joinPathSegments(t,o,e.pathSegmentSeparator);return c=>{x2t.stat(a,e.fsStatSettings,(l,u)=>{if(l!==null){c(l);return}let d={name:o,path:a,dirent:dqe.fs.createDirentFromStats(o,u)};e.stats&&(d.stats=u),c(null,d)})}});uqe(s,(o,a)=>{if(o!==null){NM(r,o);return}o7(r,a)})})}xd.readdir=hqe;function NM(t,e){t(e)}function o7(t,e){t(null,e)}});var Eqe=E(Id=>{"use strict";Object.defineProperty(Id,"__esModule",{value:!0});Id.readdir=Id.readdirWithFileTypes=Id.read=void 0;var C2t=ph(),N2t=r7(),gqe=i7(),_qe=s7();function k2t(t,e){return!e.stats&&N2t.IS_SUPPORT_READDIR_WITH_FILE_TYPES?yqe(t,e):Sqe(t,e)}Id.read=k2t;function yqe(t,e){return e.fs.readdirSync(t,{withFileTypes:!0}).map(n=>{let i={dirent:n,name:n.name,path:_qe.joinPathSegments(t,n.name,e.pathSegmentSeparator)};if(i.dirent.isSymbolicLink()&&e.followSymbolicLinks)try{let s=e.fs.statSync(i.path);i.dirent=gqe.fs.createDirentFromStats(i.name,s)}catch(s){if(e.throwErrorOnBrokenSymbolicLink)throw s}return i})}Id.readdirWithFileTypes=yqe;function Sqe(t,e){return e.fs.readdirSync(t).map(n=>{let i=_qe.joinPathSegments(t,n,e.pathSegmentSeparator),s=C2t.statSync(i,e.fsStatSettings),o={name:n,path:i,dirent:gqe.fs.createDirentFromStats(n,s)};return e.stats&&(o.stats=s),o})}Id.readdir=Sqe});var vqe=E(Od=>{"use strict";Object.defineProperty(Od,"__esModule",{value:!0});Od.createFileSystemAdapter=Od.FILE_SYSTEM_ADAPTER=void 0;var bS=W("fs");Od.FILE_SYSTEM_ADAPTER={lstat:bS.lstat,stat:bS.stat,lstatSync:bS.lstatSync,statSync:bS.statSync,readdir:bS.readdir,readdirSync:bS.readdirSync};function $2t(t){return t===void 0?Od.FILE_SYSTEM_ADAPTER:Object.assign(Object.assign({},Od.FILE_SYSTEM_ADAPTER),t)}Od.createFileSystemAdapter=$2t});var bqe=E(c7=>{"use strict";Object.defineProperty(c7,"__esModule",{value:!0});var L2t=W("path"),D2t=ph(),M2t=vqe(),a7=class{constructor(e={}){this._options=e,this.followSymbolicLinks=this._getValue(this._options.followSymbolicLinks,!1),this.fs=M2t.createFileSystemAdapter(this._options.fs),this.pathSegmentSeparator=this._getValue(this._options.pathSegmentSeparator,L2t.sep),this.stats=this._getValue(this._options.stats,!1),this.throwErrorOnBrokenSymbolicLink=this._getValue(this._options.throwErrorOnBrokenSymbolicLink,!0),this.fsStatSettings=new D2t.Settings({followSymbolicLink:this.followSymbolicLinks,fs:this.fs,throwErrorOnBrokenSymbolicLink:this.throwErrorOnBrokenSymbolicLink})}_getValue(e,r){return e??r}};c7.default=a7});var kM=E(Pd=>{"use strict";Object.defineProperty(Pd,"__esModule",{value:!0});Pd.Settings=Pd.scandirSync=Pd.scandir=void 0;var Tqe=mqe(),U2t=Eqe(),l7=bqe();Pd.Settings=l7.default;function F2t(t,e,r){if(typeof e=="function"){Tqe.read(t,u7(),e);return}Tqe.read(t,u7(e),r)}Pd.scandir=F2t;function j2t(t,e){let r=u7(e);return U2t.read(t,r)}Pd.scandirSync=j2t;function u7(t={}){return t instanceof l7.default?t:new l7.default(t)}});var $M=E(za=>{"use strict";Object.defineProperty(za,"__esModule",{value:!0});za.joinPathSegments=za.replacePathSegmentSeparator=za.isAppliedFilter=za.isFatalError=void 0;function q2t(t,e){return t.errorFilter===null?!0:!t.errorFilter(e)}za.isFatalError=q2t;function B2t(t,e){return t===null||t(e)}za.isAppliedFilter=B2t;function z2t(t,e){return t.split(/[/\\]/).join(e)}za.replacePathSegmentSeparator=z2t;function V2t(t,e,r){return t===""?e:t.endsWith(r)?t+e:t+r+e}za.joinPathSegments=V2t});var p7=E(f7=>{"use strict";Object.defineProperty(f7,"__esModule",{value:!0});var H2t=$M(),d7=class{constructor(e,r){this._root=e,this._settings=r,this._root=H2t.replacePathSegmentSeparator(e,r.pathSegmentSeparator)}};f7.default=d7});var g7=E(m7=>{"use strict";Object.defineProperty(m7,"__esModule",{value:!0});var G2t=W("events"),W2t=kM(),Y2t=H1(),LM=$M(),K2t=p7(),h7=class extends K2t.default{constructor(e,r){super(e,r),this._settings=r,this._scandir=W2t.scandir,this._emitter=new G2t.EventEmitter,this._queue=Y2t(this._worker.bind(this),this._settings.concurrency),this._isFatalError=!1,this._isDestroyed=!1,this._queue.drain=()=>{this._isFatalError||this._emitter.emit("end")}}read(){return this._isFatalError=!1,this._isDestroyed=!1,setImmediate(()=>{this._pushToQueue(this._root,this._settings.basePath)}),this._emitter}get isDestroyed(){return this._isDestroyed}destroy(){if(this._isDestroyed)throw new Error("The reader is already destroyed");this._isDestroyed=!0,this._queue.killAndDrain()}onEntry(e){this._emitter.on("entry",e)}onError(e){this._emitter.once("error",e)}onEnd(e){this._emitter.once("end",e)}_pushToQueue(e,r){let n={directory:e,base:r};this._queue.push(n,i=>{i!==null&&this._handleError(i)})}_worker(e,r){this._scandir(e.directory,this._settings.fsScandirSettings,(n,i)=>{if(n!==null){r(n,void 0);return}for(let s of i)this._handleEntry(s,e.base);r(null,void 0)})}_handleError(e){this._isDestroyed||!LM.isFatalError(this._settings,e)||(this._isFatalError=!0,this._isDestroyed=!0,this._emitter.emit("error",e))}_handleEntry(e,r){if(this._isDestroyed||this._isFatalError)return;let n=e.path;r!==void 0&&(e.path=LM.joinPathSegments(r,e.name,this._settings.pathSegmentSeparator)),LM.isAppliedFilter(this._settings.entryFilter,e)&&this._emitEntry(e),e.dirent.isDirectory()&&LM.isAppliedFilter(this._settings.deepFilter,e)&&this._pushToQueue(n,r===void 0?void 0:e.path)}_emitEntry(e){this._emitter.emit("entry",e)}};m7.default=h7});var wqe=E(y7=>{"use strict";Object.defineProperty(y7,"__esModule",{value:!0});var J2t=g7(),_7=class{constructor(e,r){this._root=e,this._settings=r,this._reader=new J2t.default(this._root,this._settings),this._storage=[]}read(e){this._reader.onError(r=>{Z2t(e,r)}),this._reader.onEntry(r=>{this._storage.push(r)}),this._reader.onEnd(()=>{X2t(e,this._storage)}),this._reader.read()}};y7.default=_7;function Z2t(t,e){t(e)}function X2t(t,e){t(null,e)}});var Aqe=E(E7=>{"use strict";Object.defineProperty(E7,"__esModule",{value:!0});var Q2t=W("stream"),eBt=g7(),S7=class{constructor(e,r){this._root=e,this._settings=r,this._reader=new eBt.default(this._root,this._settings),this._stream=new Q2t.Readable({objectMode:!0,read:()=>{},destroy:()=>{this._reader.isDestroyed||this._reader.destroy()}})}read(){return this._reader.onError(e=>{this._stream.emit("error",e)}),this._reader.onEntry(e=>{this._stream.push(e)}),this._reader.onEnd(()=>{this._stream.push(null)}),this._reader.read(),this._stream}};E7.default=S7});var Rqe=E(b7=>{"use strict";Object.defineProperty(b7,"__esModule",{value:!0});var tBt=kM(),DM=$M(),rBt=p7(),v7=class extends rBt.default{constructor(){super(...arguments),this._scandir=tBt.scandirSync,this._storage=[],this._queue=new Set}read(){return this._pushToQueue(this._root,this._settings.basePath),this._handleQueue(),this._storage}_pushToQueue(e,r){this._queue.add({directory:e,base:r})}_handleQueue(){for(let e of this._queue.values())this._handleDirectory(e.directory,e.base)}_handleDirectory(e,r){try{let n=this._scandir(e,this._settings.fsScandirSettings);for(let i of n)this._handleEntry(i,r)}catch(n){this._handleError(n)}}_handleError(e){if(DM.isFatalError(this._settings,e))throw e}_handleEntry(e,r){let n=e.path;r!==void 0&&(e.path=DM.joinPathSegments(r,e.name,this._settings.pathSegmentSeparator)),DM.isAppliedFilter(this._settings.entryFilter,e)&&this._pushToStorage(e),e.dirent.isDirectory()&&DM.isAppliedFilter(this._settings.deepFilter,e)&&this._pushToQueue(n,r===void 0?void 0:e.path)}_pushToStorage(e){this._storage.push(e)}};b7.default=v7});var xqe=E(w7=>{"use strict";Object.defineProperty(w7,"__esModule",{value:!0});var nBt=Rqe(),T7=class{constructor(e,r){this._root=e,this._settings=r,this._reader=new nBt.default(this._root,this._settings)}read(){return this._reader.read()}};w7.default=T7});var Iqe=E(R7=>{"use strict";Object.defineProperty(R7,"__esModule",{value:!0});var iBt=W("path"),sBt=kM(),A7=class{constructor(e={}){this._options=e,this.basePath=this._getValue(this._options.basePath,void 0),this.concurrency=this._getValue(this._options.concurrency,Number.POSITIVE_INFINITY),this.deepFilter=this._getValue(this._options.deepFilter,null),this.entryFilter=this._getValue(this._options.entryFilter,null),this.errorFilter=this._getValue(this._options.errorFilter,null),this.pathSegmentSeparator=this._getValue(this._options.pathSegmentSeparator,iBt.sep),this.fsScandirSettings=new sBt.Settings({followSymbolicLinks:this._options.followSymbolicLinks,fs:this._options.fs,pathSegmentSeparator:this._options.pathSegmentSeparator,stats:this._options.stats,throwErrorOnBrokenSymbolicLink:this._options.throwErrorOnBrokenSymbolicLink})}_getValue(e,r){return e??r}};R7.default=A7});var UM=E(Va=>{"use strict";Object.defineProperty(Va,"__esModule",{value:!0});Va.Settings=Va.walkStream=Va.walkSync=Va.walk=void 0;var Oqe=wqe(),oBt=Aqe(),aBt=xqe(),x7=Iqe();Va.Settings=x7.default;function cBt(t,e,r){if(typeof e=="function"){new Oqe.default(t,MM()).read(e);return}new Oqe.default(t,MM(e)).read(r)}Va.walk=cBt;function lBt(t,e){let r=MM(e);return new aBt.default(t,r).read()}Va.walkSync=lBt;function uBt(t,e){let r=MM(e);return new oBt.default(t,r).read()}Va.walkStream=uBt;function MM(t={}){return t instanceof x7.default?t:new x7.default(t)}});var FM=E(O7=>{"use strict";Object.defineProperty(O7,"__esModule",{value:!0});var dBt=W("path"),fBt=ph(),Pqe=yl(),I7=class{constructor(e){this._settings=e,this._fsStatSettings=new fBt.Settings({followSymbolicLink:this._settings.followSymbolicLinks,fs:this._settings.fs,throwErrorOnBrokenSymbolicLink:this._settings.followSymbolicLinks})}_getFullEntryPath(e){return dBt.resolve(this._settings.cwd,e)}_makeEntry(e,r){let n={name:r,path:r,dirent:Pqe.fs.createDirentFromStats(r,e)};return this._settings.stats&&(n.stats=e),n}_isFatalError(e){return!Pqe.errno.isEnoentCodeError(e)&&!this._settings.suppressErrors}};O7.default=I7});var N7=E(C7=>{"use strict";Object.defineProperty(C7,"__esModule",{value:!0});var pBt=W("stream"),hBt=ph(),mBt=UM(),gBt=FM(),P7=class extends gBt.default{constructor(){super(...arguments),this._walkStream=mBt.walkStream,this._stat=hBt.stat}dynamic(e,r){return this._walkStream(e,r)}static(e,r){let n=e.map(this._getFullEntryPath,this),i=new pBt.PassThrough({objectMode:!0});i._write=(s,o,a)=>this._getEntry(n[s],e[s],r).then(c=>{c!==null&&r.entryFilter(c)&&i.push(c),s===n.length-1&&i.end(),a()}).catch(a);for(let s=0;s<n.length;s++)i.write(s);return i}_getEntry(e,r,n){return this._getStat(e).then(i=>this._makeEntry(i,r)).catch(i=>{if(n.errorFilter(i))return null;throw i})}_getStat(e){return new Promise((r,n)=>{this._stat(e,this._fsStatSettings,(i,s)=>i===null?r(s):n(i))})}};C7.default=P7});var Cqe=E($7=>{"use strict";Object.defineProperty($7,"__esModule",{value:!0});var _Bt=UM(),yBt=FM(),SBt=N7(),k7=class extends yBt.default{constructor(){super(...arguments),this._walkAsync=_Bt.walk,this._readerStream=new SBt.default(this._settings)}dynamic(e,r){return new Promise((n,i)=>{this._walkAsync(e,r,(s,o)=>{s===null?n(o):i(s)})})}async static(e,r){let n=[],i=this._readerStream.static(e,r);return new Promise((s,o)=>{i.once("error",o),i.on("data",a=>n.push(a)),i.once("end",()=>s(n))})}};$7.default=k7});var Nqe=E(D7=>{"use strict";Object.defineProperty(D7,"__esModule",{value:!0});var Y0=yl(),L7=class{constructor(e,r,n){this._patterns=e,this._settings=r,this._micromatchOptions=n,this._storage=[],this._fillStorage()}_fillStorage(){for(let e of this._patterns){let r=this._getPatternSegments(e),n=this._splitSegmentsIntoSections(r);this._storage.push({complete:n.length<=1,pattern:e,segments:r,sections:n})}}_getPatternSegments(e){return Y0.pattern.getPatternParts(e,this._micromatchOptions).map(n=>Y0.pattern.isDynamicPattern(n,this._settings)?{dynamic:!0,pattern:n,patternRe:Y0.pattern.makeRe(n,this._micromatchOptions)}:{dynamic:!1,pattern:n})}_splitSegmentsIntoSections(e){return Y0.array.splitWhen(e,r=>r.dynamic&&Y0.pattern.hasGlobStar(r.pattern))}};D7.default=L7});var kqe=E(U7=>{"use strict";Object.defineProperty(U7,"__esModule",{value:!0});var EBt=Nqe(),M7=class extends EBt.default{match(e){let r=e.split("/"),n=r.length,i=this._storage.filter(s=>!s.complete||s.segments.length>n);for(let s of i){let o=s.sections[0];if(!s.complete&&n>o.length||r.every((c,l)=>{let u=s.segments[l];return!!(u.dynamic&&u.patternRe.test(c)||!u.dynamic&&u.pattern===c)}))return!0}return!1}};U7.default=M7});var $qe=E(j7=>{"use strict";Object.defineProperty(j7,"__esModule",{value:!0});var jM=yl(),vBt=kqe(),F7=class{constructor(e,r){this._settings=e,this._micromatchOptions=r}getFilter(e,r,n){let i=this._getMatcher(r),s=this._getNegativePatternsRe(n);return o=>this._filter(e,o,i,s)}_getMatcher(e){return new vBt.default(e,this._settings,this._micromatchOptions)}_getNegativePatternsRe(e){let r=e.filter(jM.pattern.isAffectDepthOfReadingPattern);return jM.pattern.convertPatternsToRe(r,this._micromatchOptions)}_filter(e,r,n,i){if(this._isSkippedByDeep(e,r.path)||this._isSkippedSymbolicLink(r))return!1;let s=jM.path.removeLeadingDotSegment(r.path);return this._isSkippedByPositivePatterns(s,n)?!1:this._isSkippedByNegativePatterns(s,i)}_isSkippedByDeep(e,r){return this._settings.deep===1/0?!1:this._getEntryLevel(e,r)>=this._settings.deep}_getEntryLevel(e,r){let n=r.split("/").length;if(e==="")return n;let i=e.split("/").length;return n-i}_isSkippedSymbolicLink(e){return!this._settings.followSymbolicLinks&&e.dirent.isSymbolicLink()}_isSkippedByPositivePatterns(e,r){return!this._settings.baseNameMatch&&!r.match(e)}_isSkippedByNegativePatterns(e,r){return!jM.pattern.matchAny(e,r)}};j7.default=F7});var Lqe=E(B7=>{"use strict";Object.defineProperty(B7,"__esModule",{value:!0});var Cd=yl(),q7=class{constructor(e,r){this._settings=e,this._micromatchOptions=r,this.index=new Map}getFilter(e,r){let[n,i]=Cd.pattern.partitionAbsoluteAndRelative(r),s={positive:{all:Cd.pattern.convertPatternsToRe(e,this._micromatchOptions)},negative:{absolute:Cd.pattern.convertPatternsToRe(n,Object.assign(Object.assign({},this._micromatchOptions),{dot:!0})),relative:Cd.pattern.convertPatternsToRe(i,Object.assign(Object.assign({},this._micromatchOptions),{dot:!0}))}};return o=>this._filter(o,s)}_filter(e,r){let n=Cd.path.removeLeadingDotSegment(e.path);if(this._settings.unique&&this._isDuplicateEntry(n)||this._onlyFileFilter(e)||this._onlyDirectoryFilter(e))return!1;let i=this._isMatchToPatternsSet(n,r,e.dirent.isDirectory());return this._settings.unique&&i&&this._createIndexRecord(n),i}_isDuplicateEntry(e){return this.index.has(e)}_createIndexRecord(e){this.index.set(e,void 0)}_onlyFileFilter(e){return this._settings.onlyFiles&&!e.dirent.isFile()}_onlyDirectoryFilter(e){return this._settings.onlyDirectories&&!e.dirent.isDirectory()}_isMatchToPatternsSet(e,r,n){return!(!this._isMatchToPatterns(e,r.positive.all,n)||this._isMatchToPatterns(e,r.negative.relative,n)||this._isMatchToAbsoluteNegative(e,r.negative.absolute,n))}_isMatchToAbsoluteNegative(e,r,n){if(r.length===0)return!1;let i=Cd.path.makeAbsolute(this._settings.cwd,e);return this._isMatchToPatterns(i,r,n)}_isMatchToPatterns(e,r,n){if(r.length===0)return!1;let i=Cd.pattern.matchAny(e,r);return!i&&n?Cd.pattern.matchAny(e+"/",r):i}};B7.default=q7});var Dqe=E(V7=>{"use strict";Object.defineProperty(V7,"__esModule",{value:!0});var bBt=yl(),z7=class{constructor(e){this._settings=e}getFilter(){return e=>this._isNonFatalError(e)}_isNonFatalError(e){return bBt.errno.isEnoentCodeError(e)||this._settings.suppressErrors}};V7.default=z7});var Uqe=E(G7=>{"use strict";Object.defineProperty(G7,"__esModule",{value:!0});var Mqe=yl(),H7=class{constructor(e){this._settings=e}getTransformer(){return e=>this._transform(e)}_transform(e){let r=e.path;return this._settings.absolute&&(r=Mqe.path.makeAbsolute(this._settings.cwd,r),r=Mqe.path.unixify(r)),this._settings.markDirectories&&e.dirent.isDirectory()&&(r+="/"),this._settings.objectMode?Object.assign(Object.assign({},e),{path:r}):r}};G7.default=H7});var qM=E(Y7=>{"use strict";Object.defineProperty(Y7,"__esModule",{value:!0});var TBt=W("path"),wBt=$qe(),ABt=Lqe(),RBt=Dqe(),xBt=Uqe(),W7=class{constructor(e){this._settings=e,this.errorFilter=new RBt.default(this._settings),this.entryFilter=new ABt.default(this._settings,this._getMicromatchOptions()),this.deepFilter=new wBt.default(this._settings,this._getMicromatchOptions()),this.entryTransformer=new xBt.default(this._settings)}_getRootDirectory(e){return TBt.resolve(this._settings.cwd,e.base)}_getReaderOptions(e){let r=e.base==="."?"":e.base;return{basePath:r,pathSegmentSeparator:"/",concurrency:this._settings.concurrency,deepFilter:this.deepFilter.getFilter(r,e.positive,e.negative),entryFilter:this.entryFilter.getFilter(e.positive,e.negative),errorFilter:this.errorFilter.getFilter(),followSymbolicLinks:this._settings.followSymbolicLinks,fs:this._settings.fs,stats:this._settings.stats,throwErrorOnBrokenSymbolicLink:this._settings.throwErrorOnBrokenSymbolicLink,transform:this.entryTransformer.getTransformer()}}_getMicromatchOptions(){return{dot:this._settings.dot,matchBase:this._settings.baseNameMatch,nobrace:!this._settings.braceExpansion,nocase:!this._settings.caseSensitiveMatch,noext:!this._settings.extglob,noglobstar:!this._settings.globstar,posix:!0,strictSlashes:!1}}};Y7.default=W7});var Fqe=E(J7=>{"use strict";Object.defineProperty(J7,"__esModule",{value:!0});var IBt=Cqe(),OBt=qM(),K7=class extends OBt.default{constructor(){super(...arguments),this._reader=new IBt.default(this._settings)}async read(e){let r=this._getRootDirectory(e),n=this._getReaderOptions(e);return(await this.api(r,e,n)).map(s=>n.transform(s))}api(e,r,n){return r.dynamic?this._reader.dynamic(e,n):this._reader.static(r.patterns,n)}};J7.default=K7});var jqe=E(X7=>{"use strict";Object.defineProperty(X7,"__esModule",{value:!0});var PBt=W("stream"),CBt=N7(),NBt=qM(),Z7=class extends NBt.default{constructor(){super(...arguments),this._reader=new CBt.default(this._settings)}read(e){let r=this._getRootDirectory(e),n=this._getReaderOptions(e),i=this.api(r,e,n),s=new PBt.Readable({objectMode:!0,read:()=>{}});return i.once("error",o=>s.emit("error",o)).on("data",o=>s.emit("data",n.transform(o))).once("end",()=>s.emit("end")),s.once("close",()=>i.destroy()),s}api(e,r,n){return r.dynamic?this._reader.dynamic(e,n):this._reader.static(r.patterns,n)}};X7.default=Z7});var qqe=E(eQ=>{"use strict";Object.defineProperty(eQ,"__esModule",{value:!0});var kBt=ph(),$Bt=UM(),LBt=FM(),Q7=class extends LBt.default{constructor(){super(...arguments),this._walkSync=$Bt.walkSync,this._statSync=kBt.statSync}dynamic(e,r){return this._walkSync(e,r)}static(e,r){let n=[];for(let i of e){let s=this._getFullEntryPath(i),o=this._getEntry(s,i,r);o===null||!r.entryFilter(o)||n.push(o)}return n}_getEntry(e,r,n){try{let i=this._getStat(e);return this._makeEntry(i,r)}catch(i){if(n.errorFilter(i))return null;throw i}}_getStat(e){return this._statSync(e,this._fsStatSettings)}};eQ.default=Q7});var Bqe=E(rQ=>{"use strict";Object.defineProperty(rQ,"__esModule",{value:!0});var DBt=qqe(),MBt=qM(),tQ=class extends MBt.default{constructor(){super(...arguments),this._reader=new DBt.default(this._settings)}read(e){let r=this._getRootDirectory(e),n=this._getReaderOptions(e);return this.api(r,e,n).map(n.transform)}api(e,r,n){return r.dynamic?this._reader.dynamic(e,n):this._reader.static(r.patterns,n)}};rQ.default=tQ});var zqe=E(wS=>{"use strict";Object.defineProperty(wS,"__esModule",{value:!0});wS.DEFAULT_FILE_SYSTEM_ADAPTER=void 0;var TS=W("fs"),UBt=W("os"),FBt=Math.max(UBt.cpus().length,1);wS.DEFAULT_FILE_SYSTEM_ADAPTER={lstat:TS.lstat,lstatSync:TS.lstatSync,stat:TS.stat,statSync:TS.statSync,readdir:TS.readdir,readdirSync:TS.readdirSync};var nQ=class{constructor(e={}){this._options=e,this.absolute=this._getValue(this._options.absolute,!1),this.baseNameMatch=this._getValue(this._options.baseNameMatch,!1),this.braceExpansion=this._getValue(this._options.braceExpansion,!0),this.caseSensitiveMatch=this._getValue(this._options.caseSensitiveMatch,!0),this.concurrency=this._getValue(this._options.concurrency,FBt),this.cwd=this._getValue(this._options.cwd,process.cwd()),this.deep=this._getValue(this._options.deep,1/0),this.dot=this._getValue(this._options.dot,!1),this.extglob=this._getValue(this._options.extglob,!0),this.followSymbolicLinks=this._getValue(this._options.followSymbolicLinks,!0),this.fs=this._getFileSystemMethods(this._options.fs),this.globstar=this._getValue(this._options.globstar,!0),this.ignore=this._getValue(this._options.ignore,[]),this.markDirectories=this._getValue(this._options.markDirectories,!1),this.objectMode=this._getValue(this._options.objectMode,!1),this.onlyDirectories=this._getValue(this._options.onlyDirectories,!1),this.onlyFiles=this._getValue(this._options.onlyFiles,!0),this.stats=this._getValue(this._options.stats,!1),this.suppressErrors=this._getValue(this._options.suppressErrors,!1),this.throwErrorOnBrokenSymbolicLink=this._getValue(this._options.throwErrorOnBrokenSymbolicLink,!1),this.unique=this._getValue(this._options.unique,!0),this.onlyDirectories&&(this.onlyFiles=!1),this.stats&&(this.objectMode=!0),this.ignore=[].concat(this.ignore)}_getValue(e,r){return e===void 0?r:e}_getFileSystemMethods(e={}){return Object.assign(Object.assign({},wS.DEFAULT_FILE_SYSTEM_ADAPTER),e)}};wS.default=nQ});var K0=E((gqr,Hqe)=>{"use strict";var Vqe=Kje(),jBt=Fqe(),qBt=jqe(),BBt=Bqe(),iQ=zqe(),Us=yl();async function sQ(t,e){No(t);let r=oQ(t,jBt.default,e),n=await Promise.all(r);return Us.array.flatten(n)}(function(t){t.glob=t,t.globSync=e,t.globStream=r,t.async=t;function e(l,u){No(l);let d=oQ(l,BBt.default,u);return Us.array.flatten(d)}t.sync=e;function r(l,u){No(l);let d=oQ(l,qBt.default,u);return Us.stream.merge(d)}t.stream=r;function n(l,u){No(l);let d=[].concat(l),f=new iQ.default(u);return Vqe.generate(d,f)}t.generateTasks=n;function i(l,u){No(l);let d=new iQ.default(u);return Us.pattern.isDynamicPattern(l,d)}t.isDynamicPattern=i;function s(l){return No(l),Us.path.escape(l)}t.escapePath=s;function o(l){return No(l),Us.path.convertPathToPattern(l)}t.convertPathToPattern=o;let a;(function(l){function u(f){return No(f),Us.path.escapePosixPath(f)}l.escapePath=u;function d(f){return No(f),Us.path.convertPosixPathToPattern(f)}l.convertPathToPattern=d})(a=t.posix||(t.posix={}));let c;(function(l){function u(f){return No(f),Us.path.escapeWindowsPath(f)}l.escapePath=u;function d(f){return No(f),Us.path.convertWindowsPathToPattern(f)}l.convertPathToPattern=d})(c=t.win32||(t.win32={}))})(sQ||(sQ={}));function oQ(t,e,r){let n=[].concat(t),i=new iQ.default(r),s=Vqe.generate(n,i),o=new e(i);return s.map(o.read,o)}function No(t){if(![].concat(t).every(n=>Us.string.isString(n)&&!Us.string.isEmpty(n)))throw new TypeError("Patterns must be a string (non empty) or an array of strings")}Hqe.exports=sQ});var mQ=E((wqr,VM)=>{"use strict";function Jqe(t){return Array.isArray(t)?t:[t]}var HBt=void 0,uQ="",Yqe=" ",lQ="\\",GBt=/^\s+$/,WBt=/(?:[^\\]|^)\\$/,YBt=/^\\!/,KBt=/^\\#/,JBt=/\r?\n/g,ZBt=/^\.{0,2}\/|^\.{1,2}$/,XBt=/\/$/,AS="/",Zqe="node-ignore";typeof Symbol<"u"&&(Zqe=Symbol.for("node-ignore"));var Xqe=Zqe,RS=(t,e,r)=>(Object.defineProperty(t,e,{value:r}),r),QBt=/([0-z])-([0-z])/g,Qqe=()=>!1,ezt=t=>t.replace(QBt,(e,r,n)=>r.charCodeAt(0)<=n.charCodeAt(0)?e:uQ),tzt=t=>{let{length:e}=t;return t.slice(0,e-e%2)},rzt=[[/^\uFEFF/,()=>uQ],[/((?:\\\\)*?)(\\?\s+)$/,(t,e,r)=>e+(r.indexOf("\\")===0?Yqe:uQ)],[/(\\+?)\s/g,(t,e)=>{let{length:r}=e;return e.slice(0,r-r%2)+Yqe}],[/[\\$.|*+(){^]/g,t=>`\\${t}`],[/(?!\\)\?/g,()=>"[^/]"],[/^\//,()=>"^"],[/\//g,()=>"\\/"],[/^\^*\\\*\\\*\\\//,()=>"^(?:.*\\/)?"],[/^(?=[^^])/,function(){return/\/(?!$)/.test(this)?"^":"(?:^|\\/)"}],[/\\\/\\\*\\\*(?=\\\/|$)/g,(t,e,r)=>e+6<r.length?"(?:\\/[^\\/]+)*":"\\/.+"],[/(^|[^\\]+)(\\\*)+(?=.+)/g,(t,e,r)=>{let n=r.replace(/\\\*/g,"[^\\/]*");return e+n}],[/\\\\\\(?=[$.|*+(){^])/g,()=>lQ],[/\\\\/g,()=>lQ],[/(\\)?\[([^\]/]*?)(\\*)($|\])/g,(t,e,r,n,i)=>e===lQ?`\\[${r}${tzt(n)}${i}`:i==="]"&&n.length%2===0?`[${ezt(r)}${n}]`:"[]"],[/(?:[^*])$/,t=>/\/$/.test(t)?`${t}$`:`${t}(?=$|\\/$)`]],nzt=/(^|\\\/)?\\\*$/,J0="regex",BM="checkRegex",Kqe="_",izt={[J0](t,e){return`${e?`${e}[^/]+`:"[^/]*"}(?=$|\\/$)`},[BM](t,e){return`${e?`${e}[^/]*`:"[^/]*"}(?=$|\\/$)`}},szt=t=>rzt.reduce((e,[r,n])=>e.replace(r,n.bind(t)),t),zM=t=>typeof t=="string",ozt=t=>t&&zM(t)&&!GBt.test(t)&&!WBt.test(t)&&t.indexOf("#")!==0,azt=t=>t.split(JBt).filter(Boolean),dQ=class{constructor(e,r,n,i,s,o){this.pattern=e,this.mark=r,this.negative=s,RS(this,"body",n),RS(this,"ignoreCase",i),RS(this,"regexPrefix",o)}get regex(){let e=Kqe+J0;return this[e]?this[e]:this._make(J0,e)}get checkRegex(){let e=Kqe+BM;return this[e]?this[e]:this._make(BM,e)}_make(e,r){let n=this.regexPrefix.replace(nzt,izt[e]),i=this.ignoreCase?new RegExp(n,"i"):new RegExp(n);return RS(this,r,i)}},czt=({pattern:t,mark:e},r)=>{let n=!1,i=t;i.indexOf("!")===0&&(n=!0,i=i.substr(1)),i=i.replace(YBt,"!").replace(KBt,"#");let s=szt(i);return new dQ(t,e,i,r,n,s)},fQ=class{constructor(e){this._ignoreCase=e,this._rules=[]}_add(e){if(e&&e[Xqe]){this._rules=this._rules.concat(e._rules._rules),this._added=!0;return}if(zM(e)&&(e={pattern:e}),ozt(e.pattern)){let r=czt(e,this._ignoreCase);this._added=!0,this._rules.push(r)}}add(e){return this._added=!1,Jqe(zM(e)?azt(e):e).forEach(this._add,this),this._added}test(e,r,n){let i=!1,s=!1,o;this._rules.forEach(c=>{let{negative:l}=c;s===l&&i!==s||l&&!i&&!s&&!r||!c[n].test(e)||(i=!l,s=l,o=l?HBt:c)});let a={ignored:i,unignored:s};return o&&(a.rule=o),a}},lzt=(t,e)=>{throw new e(t)},Sl=(t,e,r)=>zM(t)?t?Sl.isNotRelative(t)?r(`path should be a \`path.relative()\`d string, but got "${e}"`,RangeError):!0:r("path must not be empty",TypeError):r(`path must be a string, but got \`${e}\``,TypeError),e2e=t=>ZBt.test(t);Sl.isNotRelative=e2e;Sl.convert=t=>t;var pQ=class{constructor({ignorecase:e=!0,ignoreCase:r=e,allowRelativePaths:n=!1}={}){RS(this,Xqe,!0),this._rules=new fQ(r),this._strictPathCheck=!n,this._initCache()}_initCache(){this._ignoreCache=Object.create(null),this._testCache=Object.create(null)}add(e){return this._rules.add(e)&&this._initCache(),this}addPattern(e){return this.add(e)}_test(e,r,n,i){let s=e&&Sl.convert(e);return Sl(s,e,this._strictPathCheck?lzt:Qqe),this._t(s,r,n,i)}checkIgnore(e){if(!XBt.test(e))return this.test(e);let r=e.split(AS).filter(Boolean);if(r.pop(),r.length){let n=this._t(r.join(AS)+AS,this._testCache,!0,r);if(n.ignored)return n}return this._rules.test(e,!1,BM)}_t(e,r,n,i){if(e in r)return r[e];if(i||(i=e.split(AS).filter(Boolean)),i.pop(),!i.length)return r[e]=this._rules.test(e,n,J0);let s=this._t(i.join(AS)+AS,r,n,i);return r[e]=s.ignored?s:this._rules.test(e,n,J0)}ignores(e){return this._test(e,this._ignoreCache,!1).ignored}createFilter(){return e=>!this.ignores(e)}filter(e){return Jqe(e).filter(this.createFilter())}test(e){return this._test(e,this._testCache,!0)}},hQ=t=>new pQ(t),uzt=t=>Sl(t&&Sl.convert(t),t,Qqe),t2e=()=>{let t=r=>/^\\\\\?\\/.test(r)||/["<>|\u0000-\u001F]+/u.test(r)?r:r.replace(/\\/g,"/");Sl.convert=t;let e=/^[a-z]:\//i;Sl.isNotRelative=r=>e.test(r)||e2e(r)};typeof process<"u"&&process.platform==="win32"&&t2e();VM.exports=hQ;hQ.default=hQ;VM.exports.isPathValid=uzt;RS(VM.exports,Symbol.for("setupWindows"),t2e)});var KQ=E(eze=>{"use strict";eze.parse=function(t,e){return new YQ(t,e).parse()};var YQ=class t{constructor(e,r){this.source=e,this.transform=r||LHt,this.position=0,this.entries=[],this.recorded=[],this.dimension=0}isEof(){return this.position>=this.source.length}nextCharacter(){var e=this.source[this.position++];return e==="\\"?{value:this.source[this.position++],escaped:!0}:{value:e,escaped:!1}}record(e){this.recorded.push(e)}newEntry(e){var r;(this.recorded.length>0||e)&&(r=this.recorded.join(""),r==="NULL"&&!e&&(r=null),r!==null&&(r=this.transform(r)),this.entries.push(r),this.recorded=[])}consumeDimensions(){if(this.source[0]==="[")for(;!this.isEof();){var e=this.nextCharacter();if(e.value==="=")break}}parse(e){var r,n,i;for(this.consumeDimensions();!this.isEof();)if(r=this.nextCharacter(),r.value==="{"&&!i)this.dimension++,this.dimension>1&&(n=new t(this.source.substr(this.position-1),this.transform),this.entries.push(n.parse(!0)),this.position+=n.position-2);else if(r.value==="}"&&!i){if(this.dimension--,!this.dimension&&(this.newEntry(),e))return this.entries}else r.value==='"'&&!r.escaped?(i&&this.newEntry(!0),i=!i):r.value===","&&!i?this.newEntry():this.record(r.value);if(this.dimension!==0)throw new Error("array dimension not balanced");return this.entries}};function LHt(t){return t}});var JQ=E((CVr,tze)=>{"use strict";var DHt=KQ();tze.exports={create:function(t,e){return{parse:function(){return DHt.parse(t,e)}}}}});var ize=E((NVr,nze)=>{"use strict";var MHt=/(\d{1,})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})(\.\d{1,})?.*?( BC)?$/,UHt=/^(\d{1,})-(\d{2})-(\d{2})( BC)?$/,FHt=/([Z+-])(\d{2})?:?(\d{2})?:?(\d{2})?/,jHt=/^-?infinity$/;nze.exports=function(e){if(jHt.test(e))return Number(e.replace("i","I"));var r=MHt.exec(e);if(!r)return qHt(e)||null;var n=!!r[8],i=parseInt(r[1],10);n&&(i=rze(i));var s=parseInt(r[2],10)-1,o=r[3],a=parseInt(r[4],10),c=parseInt(r[5],10),l=parseInt(r[6],10),u=r[7];u=u?1e3*parseFloat(u):0;var d,f=BHt(e);return f!=null?(d=new Date(Date.UTC(i,s,o,a,c,l,u)),ZQ(i)&&d.setUTCFullYear(i),f!==0&&d.setTime(d.getTime()-f)):(d=new Date(i,s,o,a,c,l,u),ZQ(i)&&d.setFullYear(i)),d};function qHt(t){var e=UHt.exec(t);if(e){var r=parseInt(e[1],10),n=!!e[4];n&&(r=rze(r));var i=parseInt(e[2],10)-1,s=e[3],o=new Date(r,i,s);return ZQ(r)&&o.setFullYear(r),o}}function BHt(t){if(t.endsWith("+00"))return 0;var e=FHt.exec(t.split(" ")[1]);if(e){var r=e[1];if(r==="Z")return 0;var n=r==="-"?-1:1,i=parseInt(e[2],10)*3600+parseInt(e[3]||0,10)*60+parseInt(e[4]||0,10);return i*n*1e3}}function rze(t){return-(t-1)}function ZQ(t){return t>=0&&t<100}});var oze=E((kVr,sze)=>{"use strict";sze.exports=VHt;var zHt=Object.prototype.hasOwnProperty;function VHt(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)zHt.call(r,n)&&(t[n]=r[n])}return t}});var lze=E(($Vr,cze)=>{"use strict";var HHt=oze();cze.exports=US;function US(t){if(!(this instanceof US))return new US(t);HHt(this,n4t(t))}var GHt=["seconds","minutes","hours","days","months","years"];US.prototype.toPostgres=function(){var t=GHt.filter(this.hasOwnProperty,this);return this.milliseconds&&t.indexOf("seconds")<0&&t.push("seconds"),t.length===0?"0":t.map(function(e){var r=this[e]||0;return e==="seconds"&&this.milliseconds&&(r=(r+this.milliseconds/1e3).toFixed(6).replace(/\.?0+$/,"")),r+" "+e},this).join(" ")};var WHt={years:"Y",months:"M",days:"D",hours:"H",minutes:"M",seconds:"S"},YHt=["years","months","days"],KHt=["hours","minutes","seconds"];US.prototype.toISOString=US.prototype.toISO=function(){var t=YHt.map(r,this).join(""),e=KHt.map(r,this).join("");return"P"+t+"T"+e;function r(n){var i=this[n]||0;return n==="seconds"&&this.milliseconds&&(i=(i+this.milliseconds/1e3).toFixed(6).replace(/0+$/,"")),i+WHt[n]}};var XQ="([+-]?\\d+)",JHt=XQ+"\\s+years?",ZHt=XQ+"\\s+mons?",XHt=XQ+"\\s+days?",QHt="([+-])?([\\d]*):(\\d\\d):(\\d\\d)\\.?(\\d{1,6})?",e4t=new RegExp([JHt,ZHt,XHt,QHt].map(function(t){return"("+t+")?"}).join("\\s*")),aze={years:2,months:4,days:6,hours:9,minutes:10,seconds:11,milliseconds:12},t4t=["hours","minutes","seconds","milliseconds"];function r4t(t){var e=t+"000000".slice(t.length);return parseInt(e,10)/1e3}function n4t(t){if(!t)return{};var e=e4t.exec(t),r=e[8]==="-";return Object.keys(aze).reduce(function(n,i){var s=aze[i],o=e[s];return!o||(o=i==="milliseconds"?r4t(o):parseInt(o,10),!o)||(r&&~t4t.indexOf(i)&&(o*=-1),n[i]=o),n},{})}});var fze=E((LVr,dze)=>{"use strict";var uze=Buffer.from||Buffer;dze.exports=function(e){if(/^\\x/.test(e))return uze(e.substr(2),"hex");for(var r="",n=0;n<e.length;)if(e[n]!=="\\")r+=e[n],++n;else if(/[0-7]{3}/.test(e.substr(n+1,3)))r+=String.fromCharCode(parseInt(e.substr(n+1,3),8)),n+=4;else{for(var i=1;n+i<e.length&&e[n+i]==="\\";)i++;for(var s=0;s<Math.floor(i/2);++s)r+="\\";n+=Math.floor(i/2)*2}return uze(r,"binary")}});var Sze=E((DVr,yze)=>{"use strict";var iA=KQ(),sA=JQ(),s1=ize(),hze=lze(),mze=fze();function o1(t){return function(r){return r===null?r:t(r)}}function gze(t){return t===null?t:t==="TRUE"||t==="t"||t==="true"||t==="y"||t==="yes"||t==="on"||t==="1"}function i4t(t){return t?iA.parse(t,gze):null}function s4t(t){return parseInt(t,10)}function QQ(t){return t?iA.parse(t,o1(s4t)):null}function o4t(t){return t?iA.parse(t,o1(function(e){return _ze(e).trim()})):null}var a4t=function(t){if(!t)return null;var e=sA.create(t,function(r){return r!==null&&(r=nee(r)),r});return e.parse()},eee=function(t){if(!t)return null;var e=sA.create(t,function(r){return r!==null&&(r=parseFloat(r)),r});return e.parse()},Fs=function(t){if(!t)return null;var e=sA.create(t);return e.parse()},tee=function(t){if(!t)return null;var e=sA.create(t,function(r){return r!==null&&(r=s1(r)),r});return e.parse()},c4t=function(t){if(!t)return null;var e=sA.create(t,function(r){return r!==null&&(r=hze(r)),r});return e.parse()},l4t=function(t){return t?iA.parse(t,o1(mze)):null},ree=function(t){return parseInt(t,10)},_ze=function(t){var e=String(t);return/^\d+$/.test(e)?e:t},pze=function(t){return t?iA.parse(t,o1(JSON.parse)):null},nee=function(t){return t[0]!=="("?null:(t=t.substring(1,t.length-1).split(","),{x:parseFloat(t[0]),y:parseFloat(t[1])})},u4t=function(t){if(t[0]!=="<"&&t[1]!=="(")return null;for(var e="(",r="",n=!1,i=2;i<t.length-1;i++){if(n||(e+=t[i]),t[i]===")"){n=!0;continue}else if(!n)continue;t[i]!==","&&(r+=t[i])}var s=nee(e);return s.radius=parseFloat(r),s},d4t=function(t){t(20,_ze),t(21,ree),t(23,ree),t(26,ree),t(700,parseFloat),t(701,parseFloat),t(16,gze),t(1082,s1),t(1114,s1),t(1184,s1),t(600,nee),t(651,Fs),t(718,u4t),t(1e3,i4t),t(1001,l4t),t(1005,QQ),t(1007,QQ),t(1028,QQ),t(1016,o4t),t(1017,a4t),t(1021,eee),t(1022,eee),t(1231,eee),t(1014,Fs),t(1015,Fs),t(1008,Fs),t(1009,Fs),t(1040,Fs),t(1041,Fs),t(1115,tee),t(1182,tee),t(1185,tee),t(1186,hze),t(1187,c4t),t(17,mze),t(114,JSON.parse.bind(JSON)),t(3802,JSON.parse.bind(JSON)),t(199,pze),t(3807,pze),t(3907,Fs),t(2951,Fs),t(791,Fs),t(1183,Fs),t(1270,Fs)};yze.exports={init:d4t}});var vze=E((MVr,Eze)=>{"use strict";var Ci=1e6;function f4t(t){var e=t.readInt32BE(0),r=t.readUInt32BE(4),n="";e<0&&(e=~e+(r===0),r=~r+1>>>0,n="-");var i="",s,o,a,c,l,u;{if(s=e%Ci,e=e/Ci>>>0,o=4294967296*s+r,r=o/Ci>>>0,a=""+(o-Ci*r),r===0&&e===0)return n+a+i;for(c="",l=6-a.length,u=0;u<l;u++)c+="0";i=c+a+i}{if(s=e%Ci,e=e/Ci>>>0,o=4294967296*s+r,r=o/Ci>>>0,a=""+(o-Ci*r),r===0&&e===0)return n+a+i;for(c="",l=6-a.length,u=0;u<l;u++)c+="0";i=c+a+i}{if(s=e%Ci,e=e/Ci>>>0,o=4294967296*s+r,r=o/Ci>>>0,a=""+(o-Ci*r),r===0&&e===0)return n+a+i;for(c="",l=6-a.length,u=0;u<l;u++)c+="0";i=c+a+i}return s=e%Ci,o=4294967296*s+r,a=""+o%Ci,n+a+i}Eze.exports=f4t});var Rze=E((UVr,Aze)=>{"use strict";var p4t=vze(),cr=function(t,e,r,n,i){r=r||0,n=n||!1,i=i||function(p,h,m){return p*Math.pow(2,m)+h};var s=r>>3,o=function(p){return n?~p&255:p},a=255,c=8-r%8;e<c&&(a=255<<8-e&255,c=e),r&&(a=a>>r%8);var l=0;r%8+e>=8&&(l=i(0,o(t[s])&a,c));for(var u=e+r>>3,d=s+1;d<u;d++)l=i(l,o(t[d]),8);var f=(e+r)%8;return f>0&&(l=i(l,o(t[u])>>8-f,f)),l},wze=function(t,e,r){var n=Math.pow(2,r-1)-1,i=cr(t,1),s=cr(t,r,1);if(s===0)return 0;var o=1,a=function(l,u,d){l===0&&(l=1);for(var f=1;f<=d;f++)o/=2,(u&1<<d-f)>0&&(l+=o);return l},c=cr(t,e,r+1,!1,a);return s==Math.pow(2,r+1)-1?c===0?i===0?1/0:-1/0:NaN:(i===0?1:-1)*Math.pow(2,s-n)*c},h4t=function(t){return cr(t,1)==1?-1*(cr(t,15,1,!0)+1):cr(t,15,1)},bze=function(t){return cr(t,1)==1?-1*(cr(t,31,1,!0)+1):cr(t,31,1)},m4t=function(t){return wze(t,23,8)},g4t=function(t){return wze(t,52,11)},_4t=function(t){var e=cr(t,16,32);if(e==49152)return NaN;for(var r=Math.pow(1e4,cr(t,16,16)),n=0,i=[],s=cr(t,16),o=0;o<s;o++)n+=cr(t,16,64+16*o)*r,r/=1e4;var a=Math.pow(10,cr(t,16,48));return(e===0?1:-1)*Math.round(n*a)/a},Tze=function(t,e){var r=cr(e,1),n=cr(e,63,1),i=new Date((r===0?1:-1)*n/1e3+9466848e5);return t||i.setTime(i.getTime()+i.getTimezoneOffset()*6e4),i.usec=n%1e3,i.getMicroSeconds=function(){return this.usec},i.setMicroSeconds=function(s){this.usec=s},i.getUTCMicroSeconds=function(){return this.usec},i},oA=function(t){for(var e=cr(t,32),r=cr(t,32,32),n=cr(t,32,64),i=96,s=[],o=0;o<e;o++)s[o]=cr(t,32,i),i+=32,i+=32;var a=function(l){var u=cr(t,32,i);if(i+=32,u==4294967295)return null;var d;if(l==23||l==20)return d=cr(t,u*8,i),i+=u*8,d;if(l==25)return d=t.toString(this.encoding,i>>3,(i+=u<<3)>>3),d;console.log("ERROR: ElementType not implemented: "+l)},c=function(l,u){var d=[],f;if(l.length>1){var p=l.shift();for(f=0;f<p;f++)d[f]=c(l,u);l.unshift(p)}else for(f=0;f<l[0];f++)d[f]=a(u);return d};return c(s,n)},y4t=function(t){return t.toString("utf8")},S4t=function(t){return t===null?null:cr(t,8)>0},E4t=function(t){t(20,p4t),t(21,h4t),t(23,bze),t(26,bze),t(1700,_4t),t(700,m4t),t(701,g4t),t(16,S4t),t(1114,Tze.bind(null,!1)),t(1184,Tze.bind(null,!0)),t(1e3,oA),t(1007,oA),t(1016,oA),t(1008,oA),t(1009,oA),t(25,y4t)};Aze.exports={init:E4t}});var Ize=E((FVr,xze)=>{"use strict";xze.exports={BOOL:16,BYTEA:17,CHAR:18,INT8:20,INT2:21,INT4:23,REGPROC:24,TEXT:25,OID:26,TID:27,XID:28,CID:29,JSON:114,XML:142,PG_NODE_TREE:194,SMGR:210,PATH:602,POLYGON:604,CIDR:650,FLOAT4:700,FLOAT8:701,ABSTIME:702,RELTIME:703,TINTERVAL:704,CIRCLE:718,MACADDR8:774,MONEY:790,MACADDR:829,INET:869,ACLITEM:1033,BPCHAR:1042,VARCHAR:1043,DATE:1082,TIME:1083,TIMESTAMP:1114,TIMESTAMPTZ:1184,INTERVAL:1186,TIMETZ:1266,BIT:1560,VARBIT:1562,NUMERIC:1700,REFCURSOR:1790,REGPROCEDURE:2202,REGOPER:2203,REGOPERATOR:2204,REGCLASS:2205,REGTYPE:2206,UUID:2950,TXID_SNAPSHOT:2970,PG_LSN:3220,PG_NDISTINCT:3361,PG_DEPENDENCIES:3402,TSVECTOR:3614,TSQUERY:3615,GTSVECTOR:3642,REGCONFIG:3734,REGDICTIONARY:3769,JSONB:3802,REGNAMESPACE:4089,REGROLE:4096}});var lA=E(cA=>{"use strict";var v4t=Sze(),b4t=Rze(),T4t=JQ(),w4t=Ize();cA.getTypeParser=A4t;cA.setTypeParser=R4t;cA.arrayParser=T4t;cA.builtins=w4t;var aA={text:{},binary:{}};function Oze(t){return String(t)}function A4t(t,e){return e=e||"text",aA[e]&&aA[e][t]||Oze}function R4t(t,e,r){typeof e=="function"&&(r=e,e="text"),aA[e][t]=r}v4t.init(function(t,e){aA.text[t]=e});b4t.init(function(t,e){aA.binary[t]=e})});var uA=E((qVr,iee)=>{"use strict";var Pze;try{Pze=process.platform==="win32"?process.env.USERNAME:process.env.USER}catch{}iee.exports={host:"localhost",user:Pze,database:void 0,password:null,connectionString:void 0,port:5432,rows:0,binary:!1,max:10,idleTimeoutMillis:3e4,client_encoding:"",ssl:!1,application_name:void 0,fallback_application_name:void 0,options:void 0,parseInputDatesAsUTC:!1,statement_timeout:!1,lock_timeout:!1,idle_in_transaction_session_timeout:!1,query_timeout:!1,connect_timeout:0,keepalives:1,keepalives_idle:0};var FS=lA(),x4t=FS.getTypeParser(20,"text"),I4t=FS.getTypeParser(1016,"text");iee.exports.__defineSetter__("parseInt8",function(t){FS.setTypeParser(20,"text",t?FS.getTypeParser(23,"text"):x4t),FS.setTypeParser(1016,"text",t?FS.getTypeParser(1007,"text"):I4t)})});var jS=E((BVr,Nze)=>{"use strict";var O4t=uA(),{isDate:P4t}=W("util/types");function C4t(t){return'"'+t.replace(/\\/g,"\\\\").replace(/"/g,'\\"')+'"'}function Cze(t){let e="{";for(let r=0;r<t.length;r++){r>0&&(e+=",");let n=t[r];n==null?e+="NULL":Array.isArray(n)?e+=Cze(n):ArrayBuffer.isView(n)?(n instanceof Buffer||(n=Buffer.from(n.buffer,n.byteOffset,n.byteLength)),e+="\\\\x"+n.toString("hex")):e+=C4t(a1(n))}return e+="}",e}var a1=function(t,e){return t==null?null:typeof t=="object"?t instanceof Buffer?t:ArrayBuffer.isView(t)?Buffer.from(t.buffer,t.byteOffset,t.byteLength):P4t(t)?O4t.parseInputDatesAsUTC?$4t(t):k4t(t):Array.isArray(t)?Cze(t):N4t(t,e):t.toString()};function N4t(t,e){if(t&&typeof t.toPostgres=="function"){if(e=e||[],e.indexOf(t)!==-1)throw new Error('circular reference detected while preparing "'+t+'" for query');return e.push(t),a1(t.toPostgres(a1),e)}return JSON.stringify(t)}function k4t(t){let e=-t.getTimezoneOffset(),r=t.getFullYear(),n=r<1;n&&(r=Math.abs(r)+1);let i=String(r).padStart(4,"0")+"-"+String(t.getMonth()+1).padStart(2,"0")+"-"+String(t.getDate()).padStart(2,"0")+"T"+String(t.getHours()).padStart(2,"0")+":"+String(t.getMinutes()).padStart(2,"0")+":"+String(t.getSeconds()).padStart(2,"0")+"."+String(t.getMilliseconds()).padStart(3,"0");return e<0?(i+="-",e*=-1):i+="+",i+=String(Math.floor(e/60)).padStart(2,"0")+":"+String(e%60).padStart(2,"0"),n&&(i+=" BC"),i}function $4t(t){let e=t.getUTCFullYear(),r=e<1;r&&(e=Math.abs(e)+1);let n=String(e).padStart(4,"0")+"-"+String(t.getUTCMonth()+1).padStart(2,"0")+"-"+String(t.getUTCDate()).padStart(2,"0")+"T"+String(t.getUTCHours()).padStart(2,"0")+":"+String(t.getUTCMinutes()).padStart(2,"0")+":"+String(t.getUTCSeconds()).padStart(2,"0")+"."+String(t.getUTCMilliseconds()).padStart(3,"0");return n+="+00:00",r&&(n+=" BC"),n}function L4t(t,e,r){return t=typeof t=="string"?{text:t}:t,e&&(typeof e=="function"?t.callback=e:t.values=e),r&&(t.callback=r),t}var D4t=function(t){return'"'+t.replace(/"/g,'""')+'"'},M4t=function(t){let e=!1,r="'";if(t==null||typeof t!="string")return"''";for(let n=0;n<t.length;n++){let i=t[n];i==="'"?r+=i+i:i==="\\"?(r+=i+i,e=!0):r+=i}return r+="'",e===!0&&(r=" E"+r),r};Nze.exports={prepareValue:function(e){return a1(e)},normalizeQueryConfig:L4t,escapeIdentifier:D4t,escapeLiteral:M4t}});var aee=E((zVr,Lze)=>{"use strict";var kze=W("crypto");Lze.exports={postgresMd5PasswordHash:F4t,randomBytes:U4t,deriveKey:z4t,sha256:j4t,hashByName:q4t,hmacSha256:B4t,md5:see};var $ze=kze.webcrypto||globalThis.crypto,gh=$ze.subtle,oee=new TextEncoder;function U4t(t){return $ze.getRandomValues(Buffer.alloc(t))}async function see(t){try{return kze.createHash("md5").update(t,"utf-8").digest("hex")}catch{let r=typeof t=="string"?oee.encode(t):t,n=await gh.digest("MD5",r);return Array.from(new Uint8Array(n)).map(i=>i.toString(16).padStart(2,"0")).join("")}}async function F4t(t,e,r){let n=await see(e+t);return"md5"+await see(Buffer.concat([Buffer.from(n),r]))}async function j4t(t){return await gh.digest("SHA-256",t)}async function q4t(t,e){return await gh.digest(t,e)}async function B4t(t,e){let r=await gh.importKey("raw",t,{name:"HMAC",hash:"SHA-256"},!1,["sign"]);return await gh.sign("HMAC",r,oee.encode(e))}async function z4t(t,e,r){let n=await gh.importKey("raw",oee.encode(t),"PBKDF2",!1,["deriveBits"]),i={name:"PBKDF2",hash:"SHA-256",salt:e,iterations:r};return await gh.deriveBits(i,n,256,["deriveBits"])}});var Uze=E((VVr,Mze)=>{"use strict";function _h(t,e){return new Error("SASL channel binding: "+t+" when parsing public certificate "+e.toString("base64"))}function cee(t,e){let r=t[e++];if(r<128)return{length:r,index:e};let n=r&127;if(n>4)throw _h("bad length",t);r=0;for(let i=0;i<n;i++)r=r<<8|t[e++];return{length:r,index:e}}function Dze(t,e){if(t[e++]!==6)throw _h("non-OID data",t);let{length:r,index:n}=cee(t,e);e=n;let i=e+r,s=t[e++],o=(s/40>>0)+"."+s%40;for(;e<i;){let a=0;for(;e<i;){let c=t[e++];if(a=a<<7|c&127,c<128)break}o+="."+a}return{oid:o,index:e}}function dA(t,e){if(t[e++]!==48)throw _h("non-sequence data",t);return cee(t,e)}function V4t(t,e){e===void 0&&(e=0),e=dA(t,e).index;let{length:r,index:n}=dA(t,e);e=n+r,e=dA(t,e).index;let{oid:i,index:s}=Dze(t,e);switch(i){case"1.2.840.113549.1.1.4":return"MD5";case"1.2.840.113549.1.1.5":return"SHA-1";case"1.2.840.113549.1.1.11":return"SHA-256";case"1.2.840.113549.1.1.12":return"SHA-384";case"1.2.840.113549.1.1.13":return"SHA-512";case"1.2.840.113549.1.1.14":return"SHA-224";case"1.2.840.113549.1.1.15":return"SHA512-224";case"1.2.840.113549.1.1.16":return"SHA512-256";case"1.2.840.10045.4.1":return"SHA-1";case"1.2.840.10045.4.3.1":return"SHA-224";case"1.2.840.10045.4.3.2":return"SHA-256";case"1.2.840.10045.4.3.3":return"SHA-384";case"1.2.840.10045.4.3.4":return"SHA-512";case"1.2.840.113549.1.1.10":{if(e=s,e=dA(t,e).index,t[e++]!==160)throw _h("non-tag data",t);e=cee(t,e).index,e=dA(t,e).index;let{oid:o}=Dze(t,e);switch(o){case"1.2.840.113549.2.5":return"MD5";case"1.3.14.3.2.26":return"SHA-1";case"2.16.840.1.101.3.4.2.1":return"SHA-256";case"2.16.840.1.101.3.4.2.2":return"SHA-384";case"2.16.840.1.101.3.4.2.3":return"SHA-512"}throw _h("unknown hash OID "+o,t)}case"1.3.101.110":case"1.3.101.112":return"SHA-512";case"1.3.101.111":case"1.3.101.113":throw _h("Ed448 certificate channel binding is not currently supported by Postgres")}throw _h("unknown OID "+i,t)}Mze.exports={signatureAlgorithmHashFromCertificate:V4t}});var Bze=E((HVr,qze)=>{"use strict";var $d=aee(),{signatureAlgorithmHashFromCertificate:H4t}=Uze();function G4t(t){let e=/[\u00A0\u1680\u2000-\u200B\u202F\u205F\u3000]/g,r=/[\u00AD\u034F\u1806\u180B\u180C\u180D\u200C\u200D\u2060\uFE00-\uFE0F\uFEFF]/g;return t.replace(e," ").replace(r,"").normalize("NFKC")}var lee=1e5;function W4t(t,e,r=lee){let n=["SCRAM-SHA-256"];e&&n.unshift("SCRAM-SHA-256-PLUS");let i=n.find(a=>t.includes(a));if(!i)throw new Error("SASL: Only mechanism(s) "+n.join(" and ")+" are supported");if(i==="SCRAM-SHA-256-PLUS"&&typeof e.getPeerCertificate!="function")throw new Error("SASL: Mechanism SCRAM-SHA-256-PLUS requires a certificate");let s=$d.randomBytes(18).toString("base64");return{mechanism:i,clientNonce:s,response:(i==="SCRAM-SHA-256-PLUS"?"p=tls-server-end-point":e?"y":"n")+",,n=*,r="+s,message:"SASLInitialResponse",scramMaxIterations:r}}async function Y4t(t,e,r,n){if(t.message!=="SASLInitialResponse")throw new Error("SASL: Last message was not SASLInitialResponse");if(typeof e!="string")throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: client password must be a string");if(e==="")throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: client password must be a non-empty string");if(typeof r!="string")throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: serverData must be a string");let i=Z4t(r);if(i.nonce.startsWith(t.clientNonce)){if(i.nonce.length===t.clientNonce.length)throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: server nonce is too short")}else throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: server nonce does not start with client nonce");let s=typeof t.scramMaxIterations=="number"?t.scramMaxIterations:lee;if(s!==0&&i.iteration>s)throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: iteration count "+i.iteration+" exceeds scramMaxIterations of "+s);let o="n=*,r="+t.clientNonce,a="r="+i.nonce+",s="+i.salt+",i="+i.iteration,c=n?"eSws":"biws";if(t.mechanism==="SCRAM-SHA-256-PLUS"){let S=n.getPeerCertificate().raw,g=H4t(S);(g==="MD5"||g==="SHA-1")&&(g="SHA-256");let T=await $d.hashByName(g,S);c=Buffer.concat([Buffer.from("p=tls-server-end-point,,"),Buffer.from(T)]).toString("base64")}let l="c="+c+",r="+i.nonce,u=o+","+a+","+l,d=Buffer.from(i.salt,"base64"),f=await $d.deriveKey(G4t(e),d,i.iteration),p=await $d.hmacSha256(f,"Client Key"),h=await $d.sha256(p),m=await $d.hmacSha256(h,u),_=Q4t(Buffer.from(p),Buffer.from(m)).toString("base64"),y=await $d.hmacSha256(f,"Server Key"),v=await $d.hmacSha256(y,u);t.message="SASLResponse",t.serverSignature=Buffer.from(v).toString("base64"),t.response=l+",p="+_}function K4t(t,e){if(t.message!=="SASLResponse")throw new Error("SASL: Last message was not SASLResponse");if(typeof e!="string")throw new Error("SASL: SCRAM-SERVER-FINAL-MESSAGE: serverData must be a string");let{serverSignature:r}=X4t(e);if(r!==t.serverSignature)throw new Error("SASL: SCRAM-SERVER-FINAL-MESSAGE: server signature does not match")}function J4t(t){if(typeof t!="string")throw new TypeError("SASL: text must be a string");return t.split("").map((e,r)=>t.charCodeAt(r)).every(e=>e>=33&&e<=43||e>=45&&e<=126)}function Fze(t){return/^(?:[a-zA-Z0-9+/]{4})*(?:[a-zA-Z0-9+/]{2}==|[a-zA-Z0-9+/]{3}=)?$/.test(t)}function jze(t){if(typeof t!="string")throw new TypeError("SASL: attribute pairs text must be a string");return new Map(t.split(",").map(e=>{if(!/^.=/.test(e))throw new Error("SASL: Invalid attribute pair entry");let r=e[0],n=e.substring(2);return[r,n]}))}function Z4t(t){let e=jze(t),r=e.get("r");if(r){if(!J4t(r))throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: nonce must only contain printable characters")}else throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: nonce missing");let n=e.get("s");if(n){if(!Fze(n))throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: salt must be base64")}else throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: salt missing");let i=e.get("i");if(i){if(!/^[1-9][0-9]*$/.test(i))throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: invalid iteration count")}else throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: iteration missing");let s=parseInt(i,10);return{nonce:r,salt:n,iteration:s}}function X4t(t){let e=jze(t),r=e.get("e"),n=e.get("v");if(r)throw new Error(`SASL: SCRAM-SERVER-FINAL-MESSAGE: server returned error: "${r}"`);if(n){if(!Fze(n))throw new Error("SASL: SCRAM-SERVER-FINAL-MESSAGE: server signature must be base64")}else throw new Error("SASL: SCRAM-SERVER-FINAL-MESSAGE: server signature is missing");return{serverSignature:n}}function Q4t(t,e){if(!Buffer.isBuffer(t))throw new TypeError("first argument must be a Buffer");if(!Buffer.isBuffer(e))throw new TypeError("second argument must be a Buffer");if(t.length!==e.length)throw new Error("Buffer lengths must match");if(t.length===0)throw new Error("Buffers cannot be empty");return Buffer.from(t.map((r,n)=>t[n]^e[n]))}qze.exports={startSession:W4t,continueSession:Y4t,finalizeSession:K4t,DEFAULT_MAX_SCRAM_ITERATIONS:lee}});var l1=E((GVr,zze)=>{"use strict";var eGt=lA();function c1(t){this._types=t||eGt,this.text={},this.binary={}}c1.prototype.getOverrides=function(t){switch(t){case"text":return this.text;case"binary":return this.binary;default:return{}}};c1.prototype.setTypeParser=function(t,e,r){typeof e=="function"&&(r=e,e="text"),this.getOverrides(e)[t]=r};c1.prototype.getTypeParser=function(t,e){return e=e||"text",this.getOverrides(e)[t]||this._types.getTypeParser(t,e)};zze.exports=c1});var Gze=E((WVr,Hze)=>{"use strict";function qS(t,e={}){if(t.charAt(0)==="/"){let c=t.split(" ");return{host:c[0],database:c[1]}}let r=Object.create(null),n,i=!1;/ |%[^a-f0-9]|%[a-f0-9][^a-f0-9]/i.test(t)&&(t=encodeURI(t).replace(/%25(\d\d)/g,"%$1"));try{try{n=new URL(t,"postgres://base")}catch{n=new URL(t.replace("@/","@___DUMMY___/"),"postgres://base"),i=!0}}catch(c){throw c.input&&(c.input="*****REDACTED*****"),c}for(let c of n.searchParams.entries())r[c[0]]=c[1];if(r.user=r.user||decodeURIComponent(n.username),r.password=r.password||decodeURIComponent(n.password),n.protocol=="socket:")return r.host=decodeURI(n.pathname),r.database=n.searchParams.get("db"),r.client_encoding=n.searchParams.get("encoding"),r;let s=i?"":n.hostname;r.host?s&&/^%2f/i.test(s)&&(n.pathname=s+n.pathname):r.host=decodeURIComponent(s),r.port||(r.port=n.port);let o=n.pathname.slice(1)||null;r.database=o?decodeURI(o):null,(r.ssl==="true"||r.ssl==="1")&&(r.ssl=!0),r.ssl==="0"&&(r.ssl=!1),(r.sslcert||r.sslkey||r.sslrootcert||r.sslmode)&&(r.ssl={});let a=r.sslcert||r.sslkey||r.sslrootcert?W("fs"):null;if(r.sslcert&&(r.ssl.cert=a.readFileSync(r.sslcert).toString()),r.sslkey&&(r.ssl.key=a.readFileSync(r.sslkey).toString()),r.sslrootcert&&(r.ssl.ca=a.readFileSync(r.sslrootcert).toString()),e.useLibpqCompat&&r.uselibpqcompat)throw new Error("Both useLibpqCompat and uselibpqcompat are set. Please use only one of them.");if(r.uselibpqcompat==="true"||e.useLibpqCompat)switch(r.sslmode){case"disable":{r.ssl=!1;break}case"prefer":{r.ssl.rejectUnauthorized=!1;break}case"require":{r.sslrootcert?r.ssl.checkServerIdentity=function(){}:r.ssl.rejectUnauthorized=!1;break}case"verify-ca":{if(!r.ssl.ca)throw new Error("SECURITY WARNING: Using sslmode=verify-ca requires specifying a CA with sslrootcert. If a public CA is used, verify-ca allows connections to a server that somebody else may have registered with the CA, making you vulnerable to Man-in-the-Middle attacks. Either specify a custom CA certificate with sslrootcert parameter or use sslmode=verify-full for proper security.");r.ssl.checkServerIdentity=function(){};break}case"verify-full":break}else switch(r.sslmode){case"disable":{r.ssl=!1;break}case"prefer":case"require":case"verify-ca":case"verify-full":{r.sslmode!=="verify-full"&&uee(r.sslmode);break}case"no-verify":{r.ssl.rejectUnauthorized=!1;break}}return r}function tGt(t){return Object.entries(t).reduce((r,[n,i])=>(i!=null&&(r[n]=i),r),Object.create(null))}function Vze(t){return Object.entries(t).reduce((r,[n,i])=>{if(n==="ssl"){let s=i;typeof s=="boolean"&&(r[n]=s),typeof s=="object"&&(r[n]=tGt(s))}else if(i!=null)if(n==="port"){if(i!==""){let s=parseInt(i,10);if(isNaN(s))throw new Error(`Invalid ${n}: ${i}`);r[n]=s}}else r[n]=i;return r},Object.create(null))}function rGt(t){return Vze(qS(t))}function uee(t){!uee.warned&&typeof process<"u"&&process.emitWarning&&(uee.warned=!0,process.emitWarning(`SECURITY WARNING: The SSL modes 'prefer', 'require', and 'verify-ca' are treated as aliases for 'verify-full'.
395
395
  In the next major version (pg-connection-string v3.0.0 and pg v9.0.0), these modes will adopt standard libpq semantics, which have weaker security guarantees.
396
396
 
397
397
  To prepare for this change:
@@ -545,7 +545,7 @@ A: ${i}`).join(`
545
545
  `),r=!0}}),i=>{r||n.send(i,e,t,s=>{if(s&&!r){let o=s.code??s.message;jf.stderr.write(`[metrics] UDP send to ${t}:${e} failed: ${o}
546
546
  `),r=!0}})}},N6=()=>{},KSe=()=>!!jf.env.VITEST,JSe=()=>({enabled:!!jf.env.HOST_NODE_IP&&!KSe()}),qht=()=>{if(KSe())return N6;let t=jf.env.HOST_NODE_IP;if(!t)return N6;let e=jf.env.DD_AGENT_PORT,r=e===void 0?Mht:Number(e);return!Number.isInteger(r)||r<=0||r>65535?(jf.stderr.write(`[metrics] DD_AGENT_PORT="${e}" is not a valid port; metrics disabled
547
547
  `),N6):jht(t,r)},Bht=(t=qht())=>({inc(e,r=1,n={}){t(Fb(e,r,"c",jb(n)))},gauge(e,r,n={}){t(Fb(e,r,"g",jb(n)))},histogram(e,r,n={}){t(Fb(e,r,"h",jb(n)))},timing(e,r,n={}){t(Fb(e,r,"ms",jb(n)))},distribution(e,r,n={}){t(Fb(e,r,"d",jb(n)))}}),ge=Bht(),L6=({previewDeployed:t,hadFailedAttempts:e})=>{ge.inc("deploy.final_outcome",1,{outcome:t?e?"recovered":"success":"no_preview"})},Su=(t,e={})=>{let r=t.input_tokens??0,n=t.output_tokens??0,i=t.reasoning_output_tokens??0,s=t.cache_creation_input_tokens??0,o=t.cache_read_input_tokens??0;ge.distribution("inference.tokens",r,{...e,kind:"input"}),ge.distribution("inference.tokens",n,{...e,kind:"output"}),ge.distribution("inference.tokens",i,{...e,kind:"reasoning"});let a=t.total_tokens??r+n+i+s+o;ge.distribution("inference.tokens.total",a,e)};import D6 from"path";import zht from"fs/promises";var M6=ye("agent-output-utils");async function Eu({initialResult:t,agentName:e,hasError:r}){let n="",i=D6.join(process.cwd(),rn,Ga);try{let s=await zht.readFile(i,"utf-8");s&&(n=s,M6.log(`Pulled result from ${D6.relative(process.cwd(),i)}`))}catch{M6.log(`No results file found at ${D6.relative(process.cwd(),i)}`)}return n||(!t&&!r?`${e} has finished working on task.`:t||void 0)}var Vht=[/^API Error:\s*\d{3}/i,/^\d{3}\s*status code/i,/^API request failed:\s*\d{3}/i,/^API Error: The socket connection was closed/i,/^overloaded_error/i];function $P(t){let e=t.trim();return Vht.some(r=>r.test(e))?"Encountered a temporary issue \u2014 the agent will attempt to continue.":t}var ZSe=256*1024,XSe=t=>`
548
- \u2026 [truncated ${t} characters]`;function QSe(t){if(t.length<=ZSe)return t;let e=XSe(t.length).length,r=t.slice(0,ZSe-e);return`${r}${XSe(t.length-r.length)}`}function eEe(t){return t.includes("usage exceeded")?!1:t.includes("insufficient credits")||t.includes("openrouter.ai/settings/credits")}function vu({error:t,agentName:e}){let r=t&&typeof t=="object"?JSON.stringify(t):t,n=r?.replace(/\s+/g," ").trim().toLowerCase()||"",i="";return n?.includes("ai gateway is not available for your account")||n?.includes("ai gateway is not enabled for your account")?i="AI Gateway is currently not available on your account. Please confirm your account meets the criteria for using Agent Runners and AI Gateway and that your account has remaining AI Gateway inference credits available. Reach out to Netlify support if this is unexpected.":n?.includes("error when talking to gemini api")?i="Gemini's API is currently having issues. Please try again or use a different available agent while Google resolves the issue.":(n?.includes("connection closed prematurely")||n?.includes("499")&&e.toLowerCase().includes("gemini"))&&(i=`The ${e} models were currently overloaded. Please try again or use a different available agent.`),n?.includes("request timed out")&&(i=`The ${e} API request's have timed out. Please try again or use a different available agent.`),(n?.includes("network error")||n?.includes("socket connection was closed"))&&(i=`The ${e} agent is having network issues. Please try again or use a different available agent.`),n?.includes("503")&&!n?.includes("usage exceeded")&&(i=`The ${e} API is currently experiencing high load. Retrying automatically...`),(n?.includes("529")||n?.includes("overloaded_error"))&&(i=`The ${e} API is currently overloaded. Retrying automatically...`),n?.includes("at capacity")&&(i=`The ${e} model is currently at capacity. Retrying automatically...`),(n?.includes("there's an issue with the selected model")||n?.includes("is not available for")&&n?.includes("provider"))&&(i=`The ${e} model is temporarily unavailable. Please try again later or use a different available agent.`),eEe(n)&&(i=`${e} is temporarily unavailable. Please use a different available agent.`),i&&M6.log(`Providing updated error messsage: ${i}, replacing original error: ${r}`),i||r||void 0}function bu(t){if(!t)return!1;let r=(t&&typeof t=="object"?JSON.stringify(t):t)?.replace(/\s+/g," ").trim().toLowerCase()||"";return r?.includes("error when talking to gemini api")||r?.includes("499")||r?.includes("connection closed prematurely")||r?.includes("socket connection was closed")||r?.includes("request timed out")||r?.includes("network error")?!0:r?.includes("usage exceeded")?!1:!!(r?.includes("503")||r?.includes("529")||r?.includes("overloaded_error")||r?.includes("at capacity"))}function Tu(t){if(!t)return!1;let e=t.replace(/\s+/g," ").trim().toLowerCase();return!!(e.includes("there's an issue with the selected model")||e.includes("is not available for")&&e.includes("provider")||eEe(e))}import Pc from"process";import Oc from"path";import zC from"fs";import{fileURLToPath as Tbt}from"url";import{createRequire as wbt}from"module";function Sr(t){if(typeof t!="object"||t===null)return!1;let e=Object.getPrototypeOf(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)}import{fileURLToPath as Hht}from"url";var Lg=(t,e)=>{let r=F6(Ght(t));if(typeof r!="string")throw new TypeError(`${e} must be a string or a file URL: ${r}.`);return r},Ght=t=>U6(t)?t.toString():t,U6=t=>typeof t!="string"&&t&&Object.getPrototypeOf(t)===String.prototype,F6=t=>t instanceof URL?Hht(t):t;var LP=(t,e=[],r={})=>{let n=Lg(t,"First argument"),[i,s]=Sr(e)?[[],e]:[e,r];if(!Array.isArray(i))throw new TypeError(`Second argument must be either an array of arguments or an options object: ${i}`);if(i.some(c=>typeof c=="object"&&c!==null))throw new TypeError(`Second argument must be an array of strings: ${i}`);let o=i.map(String),a=o.find(c=>c.includes("\0"));if(a!==void 0)throw new TypeError(`Arguments cannot contain null bytes ("\\0"): ${a}`);if(!Sr(s))throw new TypeError(`Last argument must be an options object: ${s}`);return[n,o,s]};import{ChildProcess as Qht}from"child_process";import{StringDecoder as Wht}from"string_decoder";var{toString:tEe}=Object.prototype,rEe=t=>tEe.call(t)==="[object ArrayBuffer]",kr=t=>tEe.call(t)==="[object Uint8Array]",wc=t=>new Uint8Array(t.buffer,t.byteOffset,t.byteLength),Yht=new TextEncoder,nEe=t=>Yht.encode(t),Kht=new TextDecoder,DP=t=>Kht.decode(t),iEe=(t,e)=>Jht(t,e).join(""),Jht=(t,e)=>{if(e==="utf8"&&t.every(s=>typeof s=="string"))return t;let r=new Wht(e),n=t.map(s=>typeof s=="string"?nEe(s):s).map(s=>r.write(s)),i=r.end();return i===""?n:[...n,i]},qb=t=>t.length===1&&kr(t[0])?t[0]:j6(Zht(t)),Zht=t=>t.map(e=>typeof e=="string"?nEe(e):e),j6=t=>{let e=new Uint8Array(Xht(t)),r=0;for(let n of t)e.set(n,r),r+=n.length;return e},Xht=t=>{let e=0;for(let r of t)e+=r.length;return e};var cEe=t=>Array.isArray(t)&&Array.isArray(t.raw),lEe=(t,e)=>{let r=[];for(let[s,o]of t.entries())r=emt({templates:t,expressions:e,tokens:r,index:s,template:o});if(r.length===0)throw new TypeError("Template script must not be empty");let[n,...i]=r;return[n,i,{}]},emt=({templates:t,expressions:e,tokens:r,index:n,template:i})=>{if(i===void 0)throw new TypeError(`Invalid backslash sequence: ${t.raw[n]}`);let{nextTokens:s,leadingWhitespaces:o,trailingWhitespaces:a}=tmt(i,t.raw[n]),c=oEe(r,s,o);if(n===e.length)return c;let l=e[n],u=Array.isArray(l)?l.map(d=>aEe(d)):[aEe(l)];return oEe(c,u,a)},tmt=(t,e)=>{if(e.length===0)return{nextTokens:[],leadingWhitespaces:!1,trailingWhitespaces:!1};let r=[],n=0,i=sEe.has(e[0]);for(let o=0,a=0;o<t.length;o+=1,a+=1){let c=e[a];if(sEe.has(c))n!==o&&r.push(t.slice(n,o)),n=o+1;else if(c==="\\"){let l=e[a+1];l===`
548
+ \u2026 [truncated ${t} characters]`;function QSe(t){if(t.length<=ZSe)return t;let e=XSe(t.length).length,r=t.slice(0,ZSe-e);return`${r}${XSe(t.length-r.length)}`}function eEe(t){return t.includes("usage exceeded")?!1:t.includes("insufficient credits")||t.includes("openrouter.ai/settings/credits")}function vu({error:t,agentName:e}){let r=t&&typeof t=="object"?JSON.stringify(t):t,n=r?.replace(/\s+/g," ").trim().toLowerCase()||"",i="";return n?.includes("ai gateway is not available for your account")||n?.includes("ai gateway is not enabled for your account")?i="AI Gateway is currently not available on your account. Please confirm your account meets the criteria for using Agent Runners and AI Gateway and that your account has remaining AI Gateway inference credits available. Reach out to Netlify support if this is unexpected.":n?.includes("error when talking to gemini api")?i="Gemini's API is currently having issues. Please try again or use a different available agent while Google resolves the issue.":(n?.includes("connection closed prematurely")||n?.includes("499")&&e.toLowerCase().includes("gemini"))&&(i=`The ${e} models were currently overloaded. Please try again or use a different available agent.`),n?.includes("request timed out")&&(i=`The ${e} API request's have timed out. Please try again or use a different available agent.`),(n?.includes("network error")||n?.includes("socket connection was closed"))&&(i=`The ${e} agent is having network issues. Please try again or use a different available agent.`),(n?.includes("econnreset")||n?.includes("fetch failed"))&&(i=`The ${e} agent hit a temporary connection issue. Retrying automatically...`),n?.includes("503")&&!n?.includes("usage exceeded")&&(i=`The ${e} API is currently experiencing high load. Retrying automatically...`),(n?.includes("529")||n?.includes("overloaded_error"))&&(i=`The ${e} API is currently overloaded. Retrying automatically...`),n?.includes("at capacity")&&(i=`The ${e} model is currently at capacity. Retrying automatically...`),(n?.includes("there's an issue with the selected model")||n?.includes("is not available for")&&n?.includes("provider"))&&(i=`The ${e} model is temporarily unavailable. Please try again later or use a different available agent.`),eEe(n)&&(i=`${e} is temporarily unavailable. Please use a different available agent.`),i&&M6.log(`Providing updated error messsage: ${i}, replacing original error: ${r}`),i||r||void 0}function bu(t){if(!t)return!1;let r=(t&&typeof t=="object"?JSON.stringify(t):t)?.replace(/\s+/g," ").trim().toLowerCase()||"";return r?.includes("error when talking to gemini api")||r?.includes("499")||r?.includes("connection closed prematurely")||r?.includes("socket connection was closed")||r?.includes("request timed out")||r?.includes("network error")||r?.includes("econnreset")||r?.includes("fetch failed")?!0:r?.includes("usage exceeded")?!1:!!(r?.includes("503")||r?.includes("529")||r?.includes("overloaded_error")||r?.includes("at capacity"))}function Tu(t){if(!t)return!1;let e=t.replace(/\s+/g," ").trim().toLowerCase();return!!(e.includes("there's an issue with the selected model")||e.includes("is not available for")&&e.includes("provider")||eEe(e))}import Pc from"process";import Oc from"path";import zC from"fs";import{fileURLToPath as Tbt}from"url";import{createRequire as wbt}from"module";function Sr(t){if(typeof t!="object"||t===null)return!1;let e=Object.getPrototypeOf(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)}import{fileURLToPath as Hht}from"url";var Lg=(t,e)=>{let r=F6(Ght(t));if(typeof r!="string")throw new TypeError(`${e} must be a string or a file URL: ${r}.`);return r},Ght=t=>U6(t)?t.toString():t,U6=t=>typeof t!="string"&&t&&Object.getPrototypeOf(t)===String.prototype,F6=t=>t instanceof URL?Hht(t):t;var LP=(t,e=[],r={})=>{let n=Lg(t,"First argument"),[i,s]=Sr(e)?[[],e]:[e,r];if(!Array.isArray(i))throw new TypeError(`Second argument must be either an array of arguments or an options object: ${i}`);if(i.some(c=>typeof c=="object"&&c!==null))throw new TypeError(`Second argument must be an array of strings: ${i}`);let o=i.map(String),a=o.find(c=>c.includes("\0"));if(a!==void 0)throw new TypeError(`Arguments cannot contain null bytes ("\\0"): ${a}`);if(!Sr(s))throw new TypeError(`Last argument must be an options object: ${s}`);return[n,o,s]};import{ChildProcess as Qht}from"child_process";import{StringDecoder as Wht}from"string_decoder";var{toString:tEe}=Object.prototype,rEe=t=>tEe.call(t)==="[object ArrayBuffer]",kr=t=>tEe.call(t)==="[object Uint8Array]",wc=t=>new Uint8Array(t.buffer,t.byteOffset,t.byteLength),Yht=new TextEncoder,nEe=t=>Yht.encode(t),Kht=new TextDecoder,DP=t=>Kht.decode(t),iEe=(t,e)=>Jht(t,e).join(""),Jht=(t,e)=>{if(e==="utf8"&&t.every(s=>typeof s=="string"))return t;let r=new Wht(e),n=t.map(s=>typeof s=="string"?nEe(s):s).map(s=>r.write(s)),i=r.end();return i===""?n:[...n,i]},qb=t=>t.length===1&&kr(t[0])?t[0]:j6(Zht(t)),Zht=t=>t.map(e=>typeof e=="string"?nEe(e):e),j6=t=>{let e=new Uint8Array(Xht(t)),r=0;for(let n of t)e.set(n,r),r+=n.length;return e},Xht=t=>{let e=0;for(let r of t)e+=r.length;return e};var cEe=t=>Array.isArray(t)&&Array.isArray(t.raw),lEe=(t,e)=>{let r=[];for(let[s,o]of t.entries())r=emt({templates:t,expressions:e,tokens:r,index:s,template:o});if(r.length===0)throw new TypeError("Template script must not be empty");let[n,...i]=r;return[n,i,{}]},emt=({templates:t,expressions:e,tokens:r,index:n,template:i})=>{if(i===void 0)throw new TypeError(`Invalid backslash sequence: ${t.raw[n]}`);let{nextTokens:s,leadingWhitespaces:o,trailingWhitespaces:a}=tmt(i,t.raw[n]),c=oEe(r,s,o);if(n===e.length)return c;let l=e[n],u=Array.isArray(l)?l.map(d=>aEe(d)):[aEe(l)];return oEe(c,u,a)},tmt=(t,e)=>{if(e.length===0)return{nextTokens:[],leadingWhitespaces:!1,trailingWhitespaces:!1};let r=[],n=0,i=sEe.has(e[0]);for(let o=0,a=0;o<t.length;o+=1,a+=1){let c=e[a];if(sEe.has(c))n!==o&&r.push(t.slice(n,o)),n=o+1;else if(c==="\\"){let l=e[a+1];l===`
549
549
  `?(o-=1,a+=1):l==="u"&&e[a+2]==="{"?a=e.indexOf("}",a+3):a+=rmt[l]??1}}let s=n===t.length;return s||r.push(t.slice(n)),{nextTokens:r,leadingWhitespaces:i,trailingWhitespaces:s}},sEe=new Set([" "," ","\r",`
550
550
  `]),rmt={x:3,u:5},oEe=(t,e,r)=>r||t.length===0||e.length===0?[...t,...e]:[...t.slice(0,-1),`${t.at(-1)}${e[0]}`,...e.slice(1)],aEe=t=>{let e=typeof t;if(e==="string")return t;if(e==="number")return String(t);if(Sr(t)&&("stdout"in t||"isMaxBuffer"in t))return nmt(t);throw t instanceof Qht||Object.prototype.toString.call(t)==="[object Promise]"?new TypeError("Unexpected subprocess in template expression. Please use ${await subprocess} instead of ${subprocess}."):new TypeError(`Unexpected "${e}" in template expression`)},nmt=({stdout:t})=>{if(typeof t=="string")return t;if(kr(t))return DP(t);throw t===void 0?new TypeError(`Missing result.stdout in template expression. This is probably due to the previous subprocess' "stdout" option.`):new TypeError(`Unexpected "${typeof t}" stdout in template expression`)};import{spawnSync as aEt}from"child_process";import{debuglog as imt}from"util";import q6 from"process";var ro=t=>MP.includes(t),MP=[q6.stdin,q6.stdout,q6.stderr],bs=["stdin","stdout","stderr"],UP=t=>bs[t]??`stdio[${t}]`;var dEe=t=>{let e={...t};for(let r of V6)e[r]=B6(t,r);return e},B6=(t,e)=>{let r=Array.from({length:smt(t)+1}),n=omt(t[e],r,e);return dmt(n,e)},smt=({stdio:t})=>Array.isArray(t)?Math.max(t.length,bs.length):bs.length,omt=(t,e,r)=>Sr(t)?amt(t,e,r):e.fill(t),amt=(t,e,r)=>{for(let n of Object.keys(t).sort(cmt))for(let i of lmt(n,r,e))e[i]=t[n];return e},cmt=(t,e)=>uEe(t)<uEe(e)?1:-1,uEe=t=>t==="stdout"||t==="stderr"?0:t==="all"?2:1,lmt=(t,e,r)=>{if(t==="ipc")return[r.length-1];let n=z6(t);if(n===void 0||n===0)throw new TypeError(`"${e}.${t}" is invalid.
551
551
  It must be "${e}.stdout", "${e}.stderr", "${e}.all", "${e}.ipc", or "${e}.fd3", "${e}.fd4" (and so on).`);if(n>=r.length)throw new TypeError(`"${e}.${t}" is invalid: that file descriptor does not exist.
@@ -587,7 +587,7 @@ For example, you can use the \`pathToFileURL()\` method of the \`url\` core modu
587
587
  `,LF:`
588
588
  `,concatBytes:P3},ISt=(t,e)=>{let r=new Uint8Array(t.length+e.length);return r.set(t,0),r.set(e,t.length),r},OSt={windowsNewline:new Uint8Array([13,10]),unixNewline:new Uint8Array([10]),LF:10,concatBytes:ISt};import{Buffer as PSt}from"buffer";var PTe=(t,e)=>t?void 0:CSt.bind(void 0,e),CSt=function*(t,e){if(typeof e!="string"&&!kr(e)&&!PSt.isBuffer(e))throw new TypeError(`The \`${t}\` option's transform must use "objectMode: true" to receive as input: ${typeof e}.`);yield e},CTe=(t,e)=>t?NSt.bind(void 0,e):kSt.bind(void 0,e),NSt=function*(t,e){NTe(t,e),yield e},kSt=function*(t,e){if(NTe(t,e),typeof e!="string"&&!kr(e))throw new TypeError(`The \`${t}\` option's function must yield a string or an Uint8Array, not ${typeof e}.`);yield e},NTe=(t,e)=>{if(e==null)throw new TypeError(`The \`${t}\` option's function must not call \`yield ${e}\`.
589
589
  Instead, \`yield\` should either be called with a value, or not be called at all. For example:
590
- if (condition) { yield value; }`)};import{Buffer as $St}from"buffer";import{StringDecoder as LSt}from"string_decoder";var xC=(t,e,r)=>{if(r)return;if(t)return{transform:DSt.bind(void 0,new TextEncoder)};let n=new LSt(e);return{transform:MSt.bind(void 0,n),final:USt.bind(void 0,n)}},DSt=function*(t,e){$St.isBuffer(e)?yield wc(e):typeof e=="string"?yield t.encode(e):yield e},MSt=function*(t,e){yield kr(e)?t.write(e):e},USt=function*(t){let e=t.end();e!==""&&(yield e)};import{callbackify as kTe}from"util";var N3=kTe(async(t,e,r,n)=>{e.currentIterable=t(...r);try{for await(let i of e.currentIterable)n.push(i)}finally{delete e.currentIterable}}),IC=async function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=jSt}=e[r];for await(let i of n(t))yield*IC(i,e,r+1)},$Te=async function*(t){for(let[e,{final:r}]of Object.entries(t))yield*FSt(r,Number(e),t)},FSt=async function*(t,e,r){if(t!==void 0)for await(let n of t())yield*IC(n,r,e+1)},LTe=kTe(async({currentIterable:t},e)=>{if(t!==void 0){await(e?t.throw(e):t.return());return}if(e)throw e}),jSt=function*(t){yield t};var k3=(t,e,r,n)=>{try{for(let i of t(...e))r.push(i);n()}catch(i){n(i)}},DTe=(t,e)=>[...e.flatMap(r=>[...Hf(r,t,0)]),...Zb(t)],Hf=function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=BSt}=e[r];for(let i of n(t))yield*Hf(i,e,r+1)},Zb=function*(t){for(let[e,{final:r}]of Object.entries(t))yield*qSt(r,Number(e),t)},qSt=function*(t,e,r){if(t!==void 0)for(let n of t())yield*Hf(n,r,e+1)},BSt=function*(t){yield t};var $3=({value:t,value:{transform:e,final:r,writableObjectMode:n,readableObjectMode:i},optionName:s},{encoding:o})=>{let a={},c=UTe(t,o,s),l=Vf(e),u=Vf(r),d=l?N3.bind(void 0,IC,a):k3.bind(void 0,Hf),f=l||u?N3.bind(void 0,$Te,a):k3.bind(void 0,Zb),p=l||u?LTe.bind(void 0,a):void 0;return{stream:new zSt({writableObjectMode:n,writableHighWaterMark:MTe(n),readableObjectMode:i,readableHighWaterMark:MTe(i),transform(m,_,y){d([m,c,0],this,y)},flush(m){f([c],this,m)},destroy:p})}},OC=(t,e,r,n)=>{let i=e.filter(({type:o})=>o==="generator"),s=n?i.reverse():i;for(let{value:o,optionName:a}of s){let c=UTe(o,r,a);t=DTe(c,t)}return t},UTe=({transform:t,final:e,binary:r,writableObjectMode:n,readableObjectMode:i,preserveNewlines:s},o,a)=>{let c={};return[{transform:PTe(n,a)},xC(r,o,n),RC(r,s,n,c),{transform:t,final:e},{transform:CTe(i,a)},OTe({binary:r,preserveNewlines:s,readableObjectMode:i,state:c})].filter(Boolean)};var FTe=(t,e)=>{for(let r of VSt(t))HSt(t,r,e)},VSt=t=>new Set(Object.entries(t).filter(([,{direction:e}])=>e==="input").map(([e])=>Number(e))),HSt=(t,e,r)=>{let{stdioItems:n}=t[e],i=n.filter(({contents:a})=>a!==void 0);if(i.length===0)return;if(e!==0){let[{type:a,optionName:c}]=i;throw new TypeError(`Only the \`stdin\` option, not \`${c}\`, can be ${Ru[a]} with synchronous methods.`)}let o=i.map(({contents:a})=>a).map(a=>GSt(a,n));r.input=qb(o)},GSt=(t,e)=>{let r=OC(t,e,"utf8",!0);return WSt(r),qb(r)},WSt=t=>{let e=t.find(r=>typeof r!="string"&&!kr(r));if(e!==void 0)throw new TypeError(`The \`stdin\` option is invalid: when passing objects as input, a transform must be used to serialize them to strings or Uint8Arrays: ${e}.`)};import{writeFileSync as ZSt,appendFileSync as XSt}from"fs";var PC=({stdioItems:t,encoding:e,verboseInfo:r,fdNumber:n})=>n!=="all"&&Mg(r,n)&&!ji.has(e)&&YSt(n)&&(t.some(({type:i,value:s})=>i==="native"&&KSt.has(s))||t.every(({type:i})=>Ts.has(i))),YSt=t=>t===1||t===2,KSt=new Set(["pipe","overlapped"]),jTe=async(t,e,r,n)=>{for await(let i of t)JSt(e)||BTe(i,r,n)},qTe=(t,e,r)=>{for(let n of t)BTe(n,e,r)},JSt=t=>t._readableState.pipes.length>0,BTe=(t,e,r)=>{let n=VP(t);na({type:"output",verboseMessage:n,fdNumber:e,verboseInfo:r})};var zTe=({fileDescriptors:t,syncResult:{output:e},options:r,isMaxBuffer:n,verboseInfo:i})=>{if(e===null)return{output:Array.from({length:3})};let s={},o=new Set([]);return{output:e.map((c,l)=>QSt({result:c,fileDescriptors:t,fdNumber:l,state:s,outputFiles:o,isMaxBuffer:n,verboseInfo:i},r)),...s}},QSt=({result:t,fileDescriptors:e,fdNumber:r,state:n,outputFiles:i,isMaxBuffer:s,verboseInfo:o},{buffer:a,encoding:c,lines:l,stripFinalNewline:u,maxBuffer:d})=>{if(t===null)return;let f=Vbe(t,s,d),p=wc(f),{stdioItems:h,objectMode:m}=e[r],_=eEt([p],h,c,n),{serializedResult:y,finalResult:v=y}=tEt({chunks:_,objectMode:m,encoding:c,lines:l,stripFinalNewline:u,fdNumber:r});rEt({serializedResult:y,fdNumber:r,state:n,verboseInfo:o,encoding:c,stdioItems:h,objectMode:m});let S=a[r]?v:void 0;try{return n.error===void 0&&nEt(y,h,i),S}catch(g){return n.error=g,S}},eEt=(t,e,r,n)=>{try{return OC(t,e,r,!1)}catch(i){return n.error=i,t}},tEt=({chunks:t,objectMode:e,encoding:r,lines:n,stripFinalNewline:i,fdNumber:s})=>{if(e)return{serializedResult:t};if(r==="buffer")return{serializedResult:qb(t)};let o=iEe(t,r);return n[s]?{serializedResult:o,finalResult:C3(o,!i[s],e)}:{serializedResult:o}},rEt=({serializedResult:t,fdNumber:e,state:r,verboseInfo:n,encoding:i,stdioItems:s,objectMode:o})=>{if(!PC({stdioItems:s,encoding:i,verboseInfo:n,fdNumber:e}))return;let a=C3(t,!1,o);try{qTe(a,e,n)}catch(c){r.error??=c}},nEt=(t,e,r)=>{for(let{path:n,append:i}of e.filter(({type:s})=>wC.has(s))){let s=typeof n=="string"?n:n.toString();i||r.has(s)?XSt(n,t):(r.add(s),ZSt(n,t))}};var VTe=([,t,e],r)=>{if(r.all)return t===void 0?e:e===void 0?t:Array.isArray(t)?Array.isArray(e)?[...t,...e]:[...t,xc(e,r,"all")]:Array.isArray(e)?[xc(t,r,"all"),...e]:kr(t)&&kr(e)?j6([t,e]):`${t}${e}`};import{once as L3}from"events";var HTe=async(t,e)=>{let[r,n]=await iEt(t);return e.isForcefullyTerminated??=!1,[r,n]},iEt=async t=>{let[e,r]=await Promise.allSettled([L3(t,"spawn"),L3(t,"exit")]);return e.status==="rejected"?[]:r.status==="rejected"?GTe(t):r.value},GTe=async t=>{try{return await L3(t,"exit")}catch{return GTe(t)}},WTe=async t=>{let[e,r]=await t;if(!sEt(e,r)&&D3(e,r))throw new no;return[e,r]},sEt=(t,e)=>t===void 0&&e===void 0,D3=(t,e)=>t!==0||e!==null;var YTe=({error:t,status:e,signal:r,output:n},{maxBuffer:i})=>{let s=oEt(t,e,r),o=s?.code==="ETIMEDOUT",a=zbe(s,n,i);return{resultError:s,exitCode:e,signal:r,timedOut:o,isMaxBuffer:a}},oEt=(t,e,r)=>t!==void 0?t:D3(e,r)?new no:void 0;var KTe=(t,e,r)=>{let{file:n,commandArguments:i,command:s,escapedCommand:o,startTime:a,verboseInfo:c,options:l,fileDescriptors:u}=cEt(t,e,r),d=dEt({file:n,commandArguments:i,options:l,command:s,escapedCommand:o,verboseInfo:c,fileDescriptors:u,startTime:a});return Wg(d,c,l)},cEt=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:s,verboseInfo:o}=GP(t,e,r),a=lEt(r),{file:c,commandArguments:l,options:u}=fC(t,e,a);uEt(u);let d=ATe(u,o);return{file:c,commandArguments:l,command:n,escapedCommand:i,startTime:s,verboseInfo:o,options:u,fileDescriptors:d}},lEt=t=>t.node&&!t.ipc?{...t,ipc:!1}:t,uEt=({ipc:t,ipcInput:e,detached:r,cancelSignal:n})=>{e&&CC("ipcInput"),t&&CC("ipc: true"),r&&CC("detached: true"),n&&CC("cancelSignal")},CC=t=>{throw new TypeError(`The "${t}" option cannot be used with synchronous methods.`)},dEt=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,verboseInfo:s,fileDescriptors:o,startTime:a})=>{let c=fEt({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,fileDescriptors:o,startTime:a});if(c.failed)return c;let{resultError:l,exitCode:u,signal:d,timedOut:f,isMaxBuffer:p}=YTe(c,r),{output:h,error:m=l}=zTe({fileDescriptors:o,syncResult:c,options:r,isMaxBuffer:p,verboseInfo:s}),_=h.map((v,S)=>xc(v,r,S)),y=xc(VTe(h,r),r,"all");return hEt({error:m,exitCode:u,signal:d,timedOut:f,isMaxBuffer:p,stdio:_,all:y,options:r,command:n,escapedCommand:i,startTime:a})},fEt=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,fileDescriptors:s,startTime:o})=>{try{FTe(s,r);let a=pEt(r);return aEt(...pC(t,e,a))}catch(a){return Gg({error:a,command:n,escapedCommand:i,fileDescriptors:s,options:r,startTime:o,isSync:!0})}},pEt=({encoding:t,maxBuffer:e,...r})=>({...r,encoding:"buffer",maxBuffer:EC(e)}),hEt=({error:t,exitCode:e,signal:r,timedOut:n,isMaxBuffer:i,stdio:s,all:o,options:a,command:c,escapedCommand:l,startTime:u})=>t===void 0?vC({command:c,escapedCommand:l,stdio:s,all:o,ipcOutput:[],options:a,startTime:u}):Jb({error:t,command:c,escapedCommand:l,timedOut:n,isCanceled:!1,isGracefullyCanceled:!1,isMaxBuffer:i,isForcefullyTerminated:!1,exitCode:e,signal:r,stdio:s,all:o,ipcOutput:[],options:a,startTime:u,isSync:!0});import{setMaxListeners as tbt}from"events";import{spawn as rbt}from"child_process";import ewe from"process";import{once as M3,on as mEt}from"events";var JTe=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0,filter:s}={})=>(jg({methodName:"getOneMessage",isSubprocess:r,ipc:n,isConnected:oC(t)}),gEt({anyProcess:t,channel:e,isSubprocess:r,filter:s,reference:i})),gEt=async({anyProcess:t,channel:e,isSubprocess:r,filter:n,reference:i})=>{rC(e,i);let s=Au(t,e,r),o=new AbortController;try{return await Promise.race([_Et(s,n,o),yEt(s,r,o),SEt(s,r,o)])}catch(a){throw qg(t),a}finally{o.abort(),nC(e,i)}},_Et=async(t,e,{signal:r})=>{if(e===void 0){let[n]=await M3(t,"message",{signal:r});return n}for await(let[n]of mEt(t,"message",{signal:r}))if(e(n))return n},yEt=async(t,e,{signal:r})=>{await M3(t,"disconnect",{signal:r}),Dve(e)},SEt=async(t,e,{signal:r})=>{let[n]=await M3(t,"strict:error",{signal:r});throw QP(n,e)};import{once as XTe,on as EEt}from"events";var QTe=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0}={})=>U3({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:!r,reference:i}),U3=({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:i,reference:s})=>{jg({methodName:"getEachMessage",isSubprocess:r,ipc:n,isConnected:oC(t)}),rC(e,s);let o=Au(t,e,r),a=new AbortController,c={};return vEt(t,o,a),bEt({ipcEmitter:o,isSubprocess:r,controller:a,state:c}),TEt({anyProcess:t,channel:e,ipcEmitter:o,isSubprocess:r,shouldAwait:i,controller:a,state:c,reference:s})},vEt=async(t,e,r)=>{try{await XTe(e,"disconnect",{signal:r.signal}),r.abort()}catch{}},bEt=async({ipcEmitter:t,isSubprocess:e,controller:r,state:n})=>{try{let[i]=await XTe(t,"strict:error",{signal:r.signal});n.error=QP(i,e),r.abort()}catch{}},TEt=async function*({anyProcess:t,channel:e,ipcEmitter:r,isSubprocess:n,shouldAwait:i,controller:s,state:o,reference:a}){try{for await(let[c]of EEt(r,"message",{signal:s.signal}))ZTe(o),yield c}catch{ZTe(o)}finally{s.abort(),nC(e,a),n||qg(t),i&&await t}},ZTe=({error:t})=>{if(t)throw t};var twe=(t,{ipc:e})=>{Object.assign(t,nwe(t,!1,e))},rwe=()=>{let t=ewe,e=!0,r=ewe.channel!==void 0;return{...nwe(t,e,r),getCancelSignal:lbe.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})}},nwe=(t,e,r)=>({sendMessage:uC.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getOneMessage:JTe.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getEachMessage:QTe.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})});import{ChildProcess as wEt}from"child_process";import{PassThrough as AEt,Readable as REt,Writable as xEt,Duplex as IEt}from"stream";var iwe=({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:s,verboseInfo:o})=>{I3(n);let a=new wEt;OEt(a,n),Object.assign(a,{readable:PEt,writable:CEt,duplex:NEt});let c=Gg({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:s,isSync:!1}),l=kEt(c,o,i);return{subprocess:a,promise:l}},OEt=(t,e)=>{let r=Xb(),n=Xb(),i=Xb(),s=Array.from({length:e.length-3},Xb),o=Xb(),a=[r,n,i,...s];Object.assign(t,{stdin:r,stdout:n,stderr:i,all:o,stdio:a})},Xb=()=>{let t=new AEt;return t.end(),t},PEt=()=>new REt({read(){}}),CEt=()=>new xEt({write(){}}),NEt=()=>new IEt({read(){},write(){}}),kEt=async(t,e,r)=>Wg(t,e,r);import{createReadStream as swe,createWriteStream as owe}from"fs";import{Buffer as $Et}from"buffer";import{Readable as Qb,Writable as LEt,Duplex as DEt}from"stream";var cwe=(t,e)=>AC(MEt,t,e,!1),eT=({type:t,optionName:e})=>{throw new TypeError(`The \`${e}\` option cannot be ${Ru[t]}.`)},awe={fileNumber:eT,generator:$3,asyncGenerator:$3,nodeStream:({value:t})=>({stream:t}),webTransform({value:{transform:t,writableObjectMode:e,readableObjectMode:r}}){let n=e||r;return{stream:DEt.fromWeb(t,{objectMode:n})}},duplex:({value:{transform:t}})=>({stream:t}),native(){}},MEt={input:{...awe,fileUrl:({value:t})=>({stream:swe(t)}),filePath:({value:{file:t}})=>({stream:swe(t)}),webStream:({value:t})=>({stream:Qb.fromWeb(t)}),iterable:({value:t})=>({stream:Qb.from(t)}),asyncIterable:({value:t})=>({stream:Qb.from(t)}),string:({value:t})=>({stream:Qb.from(t)}),uint8Array:({value:t})=>({stream:Qb.from($Et.from(t))})},output:{...awe,fileUrl:({value:t})=>({stream:owe(t)}),filePath:({value:{file:t,append:e}})=>({stream:owe(t,e?{flags:"a"}:{})}),webStream:({value:t})=>({stream:LEt.fromWeb(t)}),iterable:eT,asyncIterable:eT,string:eT,uint8Array:eT}};import{on as UEt,once as lwe}from"events";import{PassThrough as FEt,getDefaultHighWaterMark as jEt}from"stream";import{finished as fwe}from"stream/promises";function Gf(t){if(!Array.isArray(t))throw new TypeError(`Expected an array, got \`${typeof t}\`.`);for(let i of t)j3(i);let e=t.some(({readableObjectMode:i})=>i),r=qEt(t,e),n=new F3({objectMode:e,writableHighWaterMark:r,readableHighWaterMark:r});for(let i of t)n.add(i);return n}var qEt=(t,e)=>{if(t.length===0)return jEt(e);let r=t.filter(({readableObjectMode:n})=>n===e).map(({readableHighWaterMark:n})=>n);return Math.max(...r)},F3=class extends FEt{#e=new Set([]);#r=new Set([]);#t=new Set([]);#n;#s=Symbol("unpipe");#i=new WeakMap;add(e){if(j3(e),this.#e.has(e))return;this.#e.add(e),this.#n??=BEt(this,this.#e,this.#s);let r=HEt({passThroughStream:this,stream:e,streams:this.#e,ended:this.#r,aborted:this.#t,onFinished:this.#n,unpipeEvent:this.#s});this.#i.set(e,r),e.pipe(this,{end:!1})}async remove(e){if(j3(e),!this.#e.has(e))return!1;let r=this.#i.get(e);return r===void 0?!1:(this.#i.delete(e),e.unpipe(this),await r,!0)}},BEt=async(t,e,r)=>{NC(t,uwe);let n=new AbortController;try{await Promise.race([zEt(t,n),VEt(t,e,r,n)])}finally{n.abort(),NC(t,-uwe)}},zEt=async(t,{signal:e})=>{try{await fwe(t,{signal:e,cleanup:!0})}catch(r){throw pwe(t,r),r}},VEt=async(t,e,r,{signal:n})=>{for await(let[i]of UEt(t,"unpipe",{signal:n}))e.has(i)&&i.emit(r)},j3=t=>{if(typeof t?.pipe!="function")throw new TypeError(`Expected a readable stream, got: \`${typeof t}\`.`)},HEt=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,onFinished:s,unpipeEvent:o})=>{NC(t,dwe);let a=new AbortController;try{await Promise.race([GEt(s,e,a),WEt({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:a}),YEt({stream:e,streams:r,ended:n,aborted:i,unpipeEvent:o,controller:a})])}finally{a.abort(),NC(t,-dwe)}r.size>0&&r.size===n.size+i.size&&(n.size===0&&i.size>0?q3(t):KEt(t))},GEt=async(t,e,{signal:r})=>{try{await t,r.aborted||q3(e)}catch(n){r.aborted||pwe(e,n)}},WEt=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:{signal:s}})=>{try{await fwe(e,{signal:s,cleanup:!0,readable:!0,writable:!1}),r.has(e)&&n.add(e)}catch(o){if(s.aborted||!r.has(e))return;hwe(o)?i.add(e):mwe(t,o)}},YEt=async({stream:t,streams:e,ended:r,aborted:n,unpipeEvent:i,controller:{signal:s}})=>{if(await lwe(t,i,{signal:s}),!t.readable)return lwe(s,"abort",{signal:s});e.delete(t),r.delete(t),n.delete(t)},KEt=t=>{t.writable&&t.end()},pwe=(t,e)=>{hwe(e)?q3(t):mwe(t,e)},hwe=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",q3=t=>{(t.readable||t.writable)&&t.destroy()},mwe=(t,e)=>{t.destroyed||(t.once("error",JEt),t.destroy(e))},JEt=()=>{},NC=(t,e)=>{let r=t.getMaxListeners();r!==0&&r!==Number.POSITIVE_INFINITY&&t.setMaxListeners(r+e)},uwe=2,dwe=1;import{finished as gwe}from"stream/promises";var Kg=(t,e)=>{t.pipe(e),ZEt(t,e),XEt(t,e)},ZEt=async(t,e)=>{if(!(ro(t)||ro(e))){try{await gwe(t,{cleanup:!0,readable:!0,writable:!1})}catch{}B3(e)}},B3=t=>{t.writable&&t.end()},XEt=async(t,e)=>{if(!(ro(t)||ro(e))){try{await gwe(e,{cleanup:!0,readable:!1,writable:!0})}catch{}z3(t)}},z3=t=>{t.readable&&t.destroy()};var _we=(t,e,r)=>{let n=new Map;for(let[i,{stdioItems:s,direction:o}]of Object.entries(e)){for(let{stream:a}of s.filter(({type:c})=>Ts.has(c)))QEt(t,a,o,i);for(let{stream:a}of s.filter(({type:c})=>!Ts.has(c)))tvt({subprocess:t,stream:a,direction:o,fdNumber:i,pipeGroups:n,controller:r})}for(let[i,s]of n.entries()){let o=s.length===1?s[0]:Gf(s);Kg(o,i)}},QEt=(t,e,r,n)=>{r==="output"?Kg(t.stdio[n],e):Kg(e,t.stdio[n]);let i=evt[n];i!==void 0&&(t[i]=e),t.stdio[n]=e},evt=["stdin","stdout","stderr"],tvt=({subprocess:t,stream:e,direction:r,fdNumber:n,pipeGroups:i,controller:s})=>{if(e===void 0)return;rvt(e,s);let[o,a]=r==="output"?[e,t.stdio[n]]:[t.stdio[n],e],c=i.get(o)??[];i.set(o,[...c,a])},rvt=(t,{signal:e})=>{ro(t)&&Bf(t,nvt,e)},nvt=2;import{addAbortListener as ovt}from"events";var Wf=[];Wf.push("SIGHUP","SIGINT","SIGTERM");process.platform!=="win32"&&Wf.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&Wf.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT");var kC=t=>!!t&&typeof t=="object"&&typeof t.removeListener=="function"&&typeof t.emit=="function"&&typeof t.reallyExit=="function"&&typeof t.listeners=="function"&&typeof t.kill=="function"&&typeof t.pid=="number"&&typeof t.on=="function",V3=Symbol.for("signal-exit emitter"),H3=globalThis,ivt=Object.defineProperty.bind(Object),G3=class{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(H3[V3])return H3[V3];ivt(H3,V3,{value:this,writable:!1,enumerable:!1,configurable:!1})}on(e,r){this.listeners[e].push(r)}removeListener(e,r){let n=this.listeners[e],i=n.indexOf(r);i!==-1&&(i===0&&n.length===1?n.length=0:n.splice(i,1))}emit(e,r,n){if(this.emitted[e])return!1;this.emitted[e]=!0;let i=!1;for(let s of this.listeners[e])i=s(r,n)===!0||i;return e==="exit"&&(i=this.emit("afterExit",r,n)||i),i}},$C=class{},svt=t=>({onExit(e,r){return t.onExit(e,r)},load(){return t.load()},unload(){return t.unload()}}),W3=class extends $C{onExit(){return()=>{}}load(){}unload(){}},Y3=class extends $C{#e=K3.platform==="win32"?"SIGINT":"SIGHUP";#r=new G3;#t;#n;#s;#i={};#o=!1;constructor(e){super(),this.#t=e,this.#i={};for(let r of Wf)this.#i[r]=()=>{let n=this.#t.listeners(r),{count:i}=this.#r,s=e;if(typeof s.__signal_exit_emitter__=="object"&&typeof s.__signal_exit_emitter__.count=="number"&&(i+=s.__signal_exit_emitter__.count),n.length===i){this.unload();let o=this.#r.emit("exit",null,r),a=r==="SIGHUP"?this.#e:r;o||e.kill(e.pid,a)}};this.#s=e.reallyExit,this.#n=e.emit}onExit(e,r){if(!kC(this.#t))return()=>{};this.#o===!1&&this.load();let n=r?.alwaysLast?"afterExit":"exit";return this.#r.on(n,e),()=>{this.#r.removeListener(n,e),this.#r.listeners.exit.length===0&&this.#r.listeners.afterExit.length===0&&this.unload()}}load(){if(!this.#o){this.#o=!0,this.#r.count+=1;for(let e of Wf)try{let r=this.#i[e];r&&this.#t.on(e,r)}catch{}this.#t.emit=(e,...r)=>this.#c(e,...r),this.#t.reallyExit=e=>this.#a(e)}}unload(){this.#o&&(this.#o=!1,Wf.forEach(e=>{let r=this.#i[e];if(!r)throw new Error("Listener not defined for signal: "+e);try{this.#t.removeListener(e,r)}catch{}}),this.#t.emit=this.#n,this.#t.reallyExit=this.#s,this.#r.count-=1)}#a(e){return kC(this.#t)?(this.#t.exitCode=e||0,this.#r.emit("exit",this.#t.exitCode,null),this.#s.call(this.#t,this.#t.exitCode)):0}#c(e,...r){let n=this.#n;if(e==="exit"&&kC(this.#t)){typeof r[0]=="number"&&(this.#t.exitCode=r[0]);let i=n.call(this.#t,e,...r);return this.#r.emit("exit",this.#t.exitCode,null),i}else return n.call(this.#t,e,...r)}},K3=globalThis.process,{onExit:ywe,load:pur,unload:hur}=svt(kC(K3)?new Y3(K3):new W3);var Swe=(t,{cleanup:e,detached:r},{signal:n})=>{if(!e||r)return;let i=ywe(()=>{t.kill()});ovt(n,()=>{i()})};var vwe=({source:t,sourcePromise:e,boundOptions:r,createNested:n},...i)=>{let s=HP(),{destination:o,destinationStream:a,destinationError:c,from:l,unpipeSignal:u}=avt(r,n,i),{sourceStream:d,sourceError:f}=lvt(t,l),{options:p,fileDescriptors:h}=sa.get(t);return{sourcePromise:e,sourceStream:d,sourceOptions:p,sourceError:f,destination:o,destinationStream:a,destinationError:c,unpipeSignal:u,fileDescriptors:h,startTime:s}},avt=(t,e,r)=>{try{let{destination:n,pipeOptions:{from:i,to:s,unpipeSignal:o}={}}=cvt(t,e,...r),a=tC(n,s);return{destination:n,destinationStream:a,from:i,unpipeSignal:o}}catch(n){return{destinationError:n}}},cvt=(t,e,r,...n)=>{if(Array.isArray(r))return{destination:e(Ewe,t)(r,...n),pipeOptions:t};if(typeof r=="string"||r instanceof URL||U6(r)){if(Object.keys(t).length>0)throw new TypeError('Please use .pipe("file", ..., options) or .pipe(execa("file", ..., options)) instead of .pipe(options)("file", ...).');let[i,s,o]=LP(r,...n);return{destination:e(Ewe)(i,s,o),pipeOptions:o}}if(sa.has(r)){if(Object.keys(t).length>0)throw new TypeError("Please use .pipe(options)`command` or .pipe($(options)`command`) instead of .pipe(options)($`command`).");return{destination:r,pipeOptions:n[0]}}throw new TypeError(`The first argument must be a template string, an options object, or an Execa subprocess: ${r}`)},Ewe=({options:t})=>({options:{...t,stdin:"pipe",piped:!0}}),lvt=(t,e)=>{try{return{sourceStream:Bg(t,e)}}catch(r){return{sourceError:r}}};var Twe=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n,fileDescriptors:i,sourceOptions:s,startTime:o})=>{let a=uvt({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n});if(a!==void 0)throw J3({error:a,fileDescriptors:i,sourceOptions:s,startTime:o})},uvt=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n})=>{if(e!==void 0&&n!==void 0)return n;if(n!==void 0)return z3(t),n;if(e!==void 0)return B3(r),e},J3=({error:t,fileDescriptors:e,sourceOptions:r,startTime:n})=>Gg({error:t,command:bwe,escapedCommand:bwe,fileDescriptors:e,options:r,startTime:n,isSync:!1}),bwe="source.pipe(destination)";var wwe=async t=>{let[{status:e,reason:r,value:n=r},{status:i,reason:s,value:o=s}]=await t;if(o.pipedFrom.includes(n)||o.pipedFrom.push(n),i==="rejected")throw o;if(e==="rejected")throw n;return o};import{finished as dvt}from"stream/promises";var Awe=(t,e,r)=>{let n=LC.has(e)?pvt(t,e):fvt(t,e);return Bf(t,mvt,r.signal),Bf(e,gvt,r.signal),hvt(e),n},fvt=(t,e)=>{let r=Gf([t]);return Kg(r,e),LC.set(e,r),r},pvt=(t,e)=>{let r=LC.get(e);return r.add(t),r},hvt=async t=>{try{await dvt(t,{cleanup:!0,readable:!1,writable:!0})}catch{}LC.delete(t)},LC=new WeakMap,mvt=2,gvt=1;import{aborted as _vt}from"util";var Rwe=(t,e)=>t===void 0?[]:[yvt(t,e)],yvt=async(t,{sourceStream:e,mergedStream:r,fileDescriptors:n,sourceOptions:i,startTime:s})=>{await _vt(t,e),await r.remove(e);let o=new Error("Pipe canceled by `unpipeSignal` option.");throw J3({error:o,fileDescriptors:n,sourceOptions:i,startTime:s})};var DC=(t,...e)=>{if(Sr(e[0]))return DC.bind(void 0,{...t,boundOptions:{...t.boundOptions,...e[0]}});let{destination:r,...n}=vwe(t,...e),i=Svt({...n,destination:r});return i.pipe=DC.bind(void 0,{...t,source:r,sourcePromise:i,boundOptions:{}}),i},Svt=async({sourcePromise:t,sourceStream:e,sourceOptions:r,sourceError:n,destination:i,destinationStream:s,destinationError:o,unpipeSignal:a,fileDescriptors:c,startTime:l})=>{let u=Evt(t,i);Twe({sourceStream:e,sourceError:n,destinationStream:s,destinationError:o,fileDescriptors:c,sourceOptions:r,startTime:l});let d=new AbortController;try{let f=Awe(e,s,d);return await Promise.race([wwe(u),...Rwe(a,{sourceStream:e,mergedStream:f,sourceOptions:r,fileDescriptors:c,startTime:l})])}finally{d.abort()}},Evt=(t,e)=>Promise.allSettled([t,e]);import{setImmediate as xvt}from"timers/promises";import{on as vvt}from"events";import{getDefaultHighWaterMark as bvt}from"stream";var MC=({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:n,encoding:i,preserveNewlines:s})=>{let o=new AbortController;return Tvt(e,o),Iwe({stream:t,controller:o,binary:r,shouldEncode:!t.readableObjectMode&&n,encoding:i,shouldSplit:!t.readableObjectMode,preserveNewlines:s})},Tvt=async(t,e)=>{try{await t}catch{}finally{e.abort()}},Z3=({stream:t,onStreamEnd:e,lines:r,encoding:n,stripFinalNewline:i,allMixed:s})=>{let o=new AbortController;wvt(e,o,t);let a=t.readableObjectMode&&!s;return Iwe({stream:t,controller:o,binary:n==="buffer",shouldEncode:!a,encoding:n,shouldSplit:!a&&r,preserveNewlines:!i})},wvt=async(t,e,r)=>{try{await t}catch{r.destroy()}finally{e.abort()}},Iwe=({stream:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:s,preserveNewlines:o})=>{let a=vvt(t,"data",{signal:e.signal,highWaterMark:xwe,highWatermark:xwe});return Avt({onStdoutChunk:a,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:s,preserveNewlines:o})},X3=bvt(!0),xwe=X3,Avt=async function*({onStdoutChunk:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:s,preserveNewlines:o}){let a=Rvt({binary:r,shouldEncode:n,encoding:i,shouldSplit:s,preserveNewlines:o});try{for await(let[c]of t)yield*Hf(c,a,0)}catch(c){if(!e.signal.aborted)throw c}finally{yield*Zb(a)}},Rvt=({binary:t,shouldEncode:e,encoding:r,shouldSplit:n,preserveNewlines:i})=>[xC(t,r,!e),RC(t,i,!n,{})].filter(Boolean);var Owe=async({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,buffer:i,maxBuffer:s,lines:o,allMixed:a,stripFinalNewline:c,verboseInfo:l,streamInfo:u})=>{let d=Ivt({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:a,verboseInfo:l,streamInfo:u});if(!i){await Promise.all([Ovt(t),d]);return}let f=O3(c,r),p=Z3({stream:t,onStreamEnd:e,lines:o,encoding:n,stripFinalNewline:f,allMixed:a}),[h]=await Promise.all([Pvt({stream:t,iterable:p,fdNumber:r,encoding:n,maxBuffer:s,lines:o}),d]);return h},Ivt=async({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:i,verboseInfo:s,streamInfo:{fileDescriptors:o}})=>{if(!PC({stdioItems:o[r]?.stdioItems,encoding:n,verboseInfo:s,fdNumber:r}))return;let a=Z3({stream:t,onStreamEnd:e,lines:!0,encoding:n,stripFinalNewline:!0,allMixed:i});await jTe(a,t,r,s)},Ovt=async t=>{await xvt(),t.readableFlowing===null&&t.resume()},Pvt=async({stream:t,stream:{readableObjectMode:e},iterable:r,fdNumber:n,encoding:i,maxBuffer:s,lines:o})=>{try{return e||o?await _C(r,{maxBuffer:s}):i==="buffer"?new Uint8Array(await yC(r,{maxBuffer:s})):await Hg(r,{maxBuffer:s})}catch(a){return Pwe(jbe({error:a,stream:t,readableObjectMode:e,lines:o,encoding:i,fdNumber:n}))}},Q3=async t=>{try{return await t}catch(e){return Pwe(e)}},Pwe=({bufferedData:t})=>rEe(t)?new Uint8Array(t):t;import{finished as Cvt}from"stream/promises";var tT=async(t,e,r,{isSameDirection:n,stopOnExit:i=!1}={})=>{let s=Nvt(t,r),o=new AbortController;try{await Promise.race([...i?[r.exitPromise]:[],Cvt(t,{cleanup:!0,signal:o.signal})])}catch(a){s.stdinCleanedUp||Lvt(a,e,r,n)}finally{o.abort()}},Nvt=(t,{originalStreams:[e],subprocess:r})=>{let n={stdinCleanedUp:!1};return t===e&&kvt(t,r,n),n},kvt=(t,e,r)=>{let{_destroy:n}=t;t._destroy=(...i)=>{$vt(e,r),n.call(t,...i)}},$vt=({exitCode:t,signalCode:e},r)=>{(t!==null||e!==null)&&(r.stdinCleanedUp=!0)},Lvt=(t,e,r,n)=>{if(!Dvt(t,e,r,n))throw t},Dvt=(t,e,r,n=!0)=>r.propagating?Cwe(t)||UC(t):(r.propagating=!0,eW(r,e)===n?Cwe(t):UC(t)),eW=({fileDescriptors:t},e)=>e!=="all"&&t[e].direction==="input",UC=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",Cwe=t=>t?.code==="EPIPE";var Nwe=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:s,verboseInfo:o,streamInfo:a})=>t.stdio.map((c,l)=>tW({stream:c,fdNumber:l,encoding:e,buffer:r[l],maxBuffer:n[l],lines:i[l],allMixed:!1,stripFinalNewline:s,verboseInfo:o,streamInfo:a})),tW=async({stream:t,fdNumber:e,encoding:r,buffer:n,maxBuffer:i,lines:s,allMixed:o,stripFinalNewline:a,verboseInfo:c,streamInfo:l})=>{if(!t)return;let u=tT(t,e,l);if(eW(l,e)){await u;return}let[d]=await Promise.all([Owe({stream:t,onStreamEnd:u,fdNumber:e,encoding:r,buffer:n,maxBuffer:i,lines:s,allMixed:o,stripFinalNewline:a,verboseInfo:c,streamInfo:l}),u]);return d};var kwe=({stdout:t,stderr:e},{all:r})=>r&&(t||e)?Gf([t,e].filter(Boolean)):void 0,$we=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:s,verboseInfo:o,streamInfo:a})=>tW({...Mvt(t,r),fdNumber:"all",encoding:e,maxBuffer:n[1]+n[2],lines:i[1]||i[2],allMixed:Uvt(t),stripFinalNewline:s,verboseInfo:o,streamInfo:a}),Mvt=({stdout:t,stderr:e,all:r},[,n,i])=>{let s=n||i;return s?n?i?{stream:r,buffer:s}:{stream:t,buffer:s}:{stream:e,buffer:s}:{stream:r,buffer:s}},Uvt=({all:t,stdout:e,stderr:r})=>t&&e&&r&&e.readableObjectMode!==r.readableObjectMode;import{once as Fvt}from"events";var Lwe=t=>Mg(t,"ipc"),Dwe=(t,e)=>{let r=VP(t);na({type:"ipc",verboseMessage:r,fdNumber:"ipc",verboseInfo:e})};var Mwe=async({subprocess:t,buffer:e,maxBuffer:r,ipc:n,ipcOutput:i,verboseInfo:s})=>{if(!n)return i;let o=Lwe(s),a=Ac(e,"ipc"),c=Ac(r,"ipc");for await(let l of U3({anyProcess:t,channel:t.channel,isSubprocess:!1,ipc:n,shouldAwait:!1,reference:!0}))a&&(qbe(t,i,c),i.push(l)),o&&Dwe(l,s);return i},Uwe=async(t,e)=>(await Promise.allSettled([t]),e);var Fwe=async({subprocess:t,options:{encoding:e,buffer:r,maxBuffer:n,lines:i,timeoutDuration:s,cancelSignal:o,gracefulCancel:a,forceKillAfterDelay:c,stripFinalNewline:l,ipc:u,ipcInput:d},context:f,verboseInfo:p,fileDescriptors:h,originalStreams:m,onInternalError:_,controller:y})=>{let v=HTe(t,f),S={originalStreams:m,fileDescriptors:h,subprocess:t,exitPromise:v,propagating:!1},g=Nwe({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:S}),T=$we({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:S}),I=[],x=Mwe({subprocess:t,buffer:r,maxBuffer:n,ipc:u,ipcOutput:I,verboseInfo:p}),R=jvt(m,t,S),O=qvt(h,S);try{return await Promise.race([Promise.all([{},WTe(v),Promise.all(g),T,x,Sbe(t,d),...R,...O]),_,Bvt(t,y),...hbe(t,s,f,y),...Lve({subprocess:t,cancelSignal:o,gracefulCancel:a,context:f,controller:y}),...fbe({subprocess:t,cancelSignal:o,gracefulCancel:a,forceKillAfterDelay:c,context:f,controller:y})])}catch(A){return f.terminationReason??="other",Promise.all([{error:A},v,Promise.all(g.map(b=>Q3(b))),Q3(T),Uwe(x,I),Promise.allSettled(R),Promise.allSettled(O)])}},jvt=(t,e,r)=>t.map((n,i)=>n===e.stdio[i]?void 0:tT(n,i,r)),qvt=(t,e)=>t.flatMap(({stdioItems:r},n)=>r.filter(({value:i,stream:s=i})=>so(s,{checkOpen:!1})&&!ro(s)).map(({type:i,value:s,stream:o=s})=>tT(o,n,e,{isSameDirection:Ts.has(i),stopOnExit:i==="native"}))),Bvt=async(t,{signal:e})=>{let[r]=await Fvt(t,"error",{signal:e});throw r};var jwe=()=>({readableDestroy:new WeakMap,writableFinal:new WeakMap,writableDestroy:new WeakMap}),rT=(t,e,r)=>{let n=t[r];n.has(e)||n.set(e,[]);let i=n.get(e),s=ia();return i.push(s),{resolve:s.resolve.bind(s),promises:i}},Jg=async({resolve:t,promises:e},r)=>{t();let[n]=await Promise.race([Promise.allSettled([!0,r]),Promise.all([!1,...e])]);return!n};import{Readable as zvt}from"stream";import{callbackify as Vvt}from"util";import{finished as qwe}from"stream/promises";var rW=async t=>{if(t!==void 0)try{await nW(t)}catch{}},Bwe=async t=>{if(t!==void 0)try{await iW(t)}catch{}},nW=async t=>{await qwe(t,{cleanup:!0,readable:!1,writable:!0})},iW=async t=>{await qwe(t,{cleanup:!0,readable:!0,writable:!1})},FC=async(t,e)=>{if(await t,e)throw e},jC=(t,e,r)=>{r&&!UC(r)?t.destroy(r):e&&t.destroy()};var zwe=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,binary:i=!0,preserveNewlines:s=!0}={})=>{let o=i||ji.has(r),{subprocessStdout:a,waitReadableDestroy:c}=sW(t,n,e),{readableEncoding:l,readableObjectMode:u,readableHighWaterMark:d}=oW(a,o),{read:f,onStdoutDataDone:p}=aW({subprocessStdout:a,subprocess:t,binary:o,encoding:r,preserveNewlines:s}),h=new zvt({read:f,destroy:Vvt(lW.bind(void 0,{subprocessStdout:a,subprocess:t,waitReadableDestroy:c})),highWaterMark:d,objectMode:u,encoding:l});return cW({subprocessStdout:a,onStdoutDataDone:p,readable:h,subprocess:t}),h},sW=(t,e,r)=>{let n=Bg(t,e),i=rT(r,n,"readableDestroy");return{subprocessStdout:n,waitReadableDestroy:i}},oW=({readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r},n)=>n?{readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r}:{readableEncoding:t,readableObjectMode:!0,readableHighWaterMark:X3},aW=({subprocessStdout:t,subprocess:e,binary:r,encoding:n,preserveNewlines:i})=>{let s=ia(),o=MC({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:!r,encoding:n,preserveNewlines:i});return{read(){Hvt(this,o,s)},onStdoutDataDone:s}},Hvt=async(t,e,r)=>{try{let{value:n,done:i}=await e.next();i?r.resolve():t.push(n)}catch{}},cW=async({subprocessStdout:t,onStdoutDataDone:e,readable:r,subprocess:n,subprocessStdin:i})=>{try{await iW(t),await n,await rW(i),await e,r.readable&&r.push(null)}catch(s){await rW(i),Vwe(r,s)}},lW=async({subprocessStdout:t,subprocess:e,waitReadableDestroy:r},n)=>{await Jg(r,e)&&(Vwe(t,n),await FC(e,n))},Vwe=(t,e)=>{jC(t,t.readable,e)};import{Writable as Gvt}from"stream";import{callbackify as Hwe}from"util";var Gwe=({subprocess:t,concurrentStreams:e},{to:r}={})=>{let{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:s}=uW(t,r,e),o=new Gvt({...dW(n,t,i),destroy:Hwe(pW.bind(void 0,{subprocessStdin:n,subprocess:t,waitWritableFinal:i,waitWritableDestroy:s})),highWaterMark:n.writableHighWaterMark,objectMode:n.writableObjectMode});return fW(n,o),o},uW=(t,e,r)=>{let n=tC(t,e),i=rT(r,n,"writableFinal"),s=rT(r,n,"writableDestroy");return{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:s}},dW=(t,e,r)=>({write:Wvt.bind(void 0,t),final:Hwe(Yvt.bind(void 0,t,e,r))}),Wvt=(t,e,r,n)=>{t.write(e,r)?n():t.once("drain",n)},Yvt=async(t,e,r)=>{await Jg(r,e)&&(t.writable&&t.end(),await e)},fW=async(t,e,r)=>{try{await nW(t),e.writable&&e.end()}catch(n){await Bwe(r),Wwe(e,n)}},pW=async({subprocessStdin:t,subprocess:e,waitWritableFinal:r,waitWritableDestroy:n},i)=>{await Jg(r,e),await Jg(n,e)&&(Wwe(t,i),await FC(e,i))},Wwe=(t,e)=>{jC(t,t.writable,e)};import{Duplex as Kvt}from"stream";import{callbackify as Jvt}from"util";var Ywe=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,to:i,binary:s=!0,preserveNewlines:o=!0}={})=>{let a=s||ji.has(r),{subprocessStdout:c,waitReadableDestroy:l}=sW(t,n,e),{subprocessStdin:u,waitWritableFinal:d,waitWritableDestroy:f}=uW(t,i,e),{readableEncoding:p,readableObjectMode:h,readableHighWaterMark:m}=oW(c,a),{read:_,onStdoutDataDone:y}=aW({subprocessStdout:c,subprocess:t,binary:a,encoding:r,preserveNewlines:o}),v=new Kvt({read:_,...dW(u,t,d),destroy:Jvt(Zvt.bind(void 0,{subprocessStdout:c,subprocessStdin:u,subprocess:t,waitReadableDestroy:l,waitWritableFinal:d,waitWritableDestroy:f})),readableHighWaterMark:m,writableHighWaterMark:u.writableHighWaterMark,readableObjectMode:h,writableObjectMode:u.writableObjectMode,encoding:p});return cW({subprocessStdout:c,onStdoutDataDone:y,readable:v,subprocess:t,subprocessStdin:u}),fW(u,v,c),v},Zvt=async({subprocessStdout:t,subprocessStdin:e,subprocess:r,waitReadableDestroy:n,waitWritableFinal:i,waitWritableDestroy:s},o)=>{await Promise.all([lW({subprocessStdout:t,subprocess:r,waitReadableDestroy:n},o),pW({subprocessStdin:e,subprocess:r,waitWritableFinal:i,waitWritableDestroy:s},o)])};var hW=(t,e,{from:r,binary:n=!1,preserveNewlines:i=!1}={})=>{let s=n||ji.has(e),o=Bg(t,r),a=MC({subprocessStdout:o,subprocess:t,binary:s,shouldEncode:!0,encoding:e,preserveNewlines:i});return Xvt(a,o,t)},Xvt=async function*(t,e,r){try{yield*t}finally{e.readable&&e.destroy(),await r}};var Kwe=(t,{encoding:e})=>{let r=jwe();t.readable=zwe.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.writable=Gwe.bind(void 0,{subprocess:t,concurrentStreams:r}),t.duplex=Ywe.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.iterable=hW.bind(void 0,t,e),t[Symbol.asyncIterator]=hW.bind(void 0,t,e,{})};var Jwe=(t,e)=>{for(let[r,n]of ebt){let i=n.value.bind(e);Reflect.defineProperty(t,r,{...n,value:i})}},Qvt=(async()=>{})().constructor.prototype,ebt=["then","catch","finally"].map(t=>[t,Reflect.getOwnPropertyDescriptor(Qvt,t)]);var Zwe=(t,e,r,n)=>{let{file:i,commandArguments:s,command:o,escapedCommand:a,startTime:c,verboseInfo:l,options:u,fileDescriptors:d}=nbt(t,e,r),{subprocess:f,promise:p}=sbt({file:i,commandArguments:s,options:u,startTime:c,verboseInfo:l,command:o,escapedCommand:a,fileDescriptors:d});return f.pipe=DC.bind(void 0,{source:f,sourcePromise:p,boundOptions:{},createNested:n}),Jwe(f,p),sa.set(f,{options:u,fileDescriptors:d}),f},nbt=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:s,verboseInfo:o}=GP(t,e,r),{file:a,commandArguments:c,options:l}=fC(t,e,r),u=ibt(l),d=cwe(u,o);return{file:a,commandArguments:c,command:n,escapedCommand:i,startTime:s,verboseInfo:o,options:u,fileDescriptors:d}},ibt=({timeout:t,signal:e,...r})=>{if(e!==void 0)throw new TypeError('The "signal" option has been renamed to "cancelSignal" instead.');return{...r,timeoutDuration:t}},sbt=({file:t,commandArguments:e,options:r,startTime:n,verboseInfo:i,command:s,escapedCommand:o,fileDescriptors:a})=>{let c;try{c=rbt(...pC(t,e,r))}catch(h){return iwe({error:h,command:s,escapedCommand:o,fileDescriptors:a,options:r,startTime:n,verboseInfo:i})}let l=new AbortController;tbt(Number.POSITIVE_INFINITY,l.signal);let u=[...c.stdio];_we(c,a,l),Swe(c,r,l);let d={},f=ia();c.kill=kve.bind(void 0,{kill:c.kill.bind(c),options:r,onInternalError:f,context:d,controller:l}),c.all=kwe(c,r),Kwe(c,r),twe(c,r);let p=obt({subprocess:c,options:r,startTime:n,verboseInfo:i,fileDescriptors:a,originalStreams:u,command:s,escapedCommand:o,context:d,onInternalError:f,controller:l});return{subprocess:c,promise:p}},obt=async({subprocess:t,options:e,startTime:r,verboseInfo:n,fileDescriptors:i,originalStreams:s,command:o,escapedCommand:a,context:c,onInternalError:l,controller:u})=>{let[d,[f,p],h,m,_]=await Fwe({subprocess:t,options:e,context:c,verboseInfo:n,fileDescriptors:i,originalStreams:s,onInternalError:l,controller:u});u.abort(),l.resolve();let y=h.map((g,T)=>xc(g,e,T)),v=xc(m,e,"all"),S=abt({errorInfo:d,exitCode:f,signal:p,stdio:y,all:v,ipcOutput:_,context:c,options:e,command:o,escapedCommand:a,startTime:r});return Wg(S,n,e)},abt=({errorInfo:t,exitCode:e,signal:r,stdio:n,all:i,ipcOutput:s,context:o,options:a,command:c,escapedCommand:l,startTime:u})=>"error"in t?Jb({error:t.error,command:c,escapedCommand:l,timedOut:o.terminationReason==="timeout",isCanceled:o.terminationReason==="cancel"||o.terminationReason==="gracefulCancel",isGracefullyCanceled:o.terminationReason==="gracefulCancel",isMaxBuffer:t.error instanceof oa,isForcefullyTerminated:o.isForcefullyTerminated,exitCode:e,signal:r,stdio:n,all:i,ipcOutput:s,options:a,startTime:u,isSync:!1}):vC({command:c,escapedCommand:l,stdio:n,all:i,ipcOutput:s,options:a,startTime:u});var qC=(t,e)=>{let r=Object.fromEntries(Object.entries(e).map(([n,i])=>[n,cbt(n,t[n],i)]));return{...t,...r}},cbt=(t,e,r)=>lbt.has(t)&&Sr(e)&&Sr(r)?{...e,...r}:r,lbt=new Set(["env",...V6]);var xu=(t,e,r,n)=>{let i=(o,a,c)=>xu(o,a,r,c),s=(...o)=>ubt({mapArguments:t,deepOptions:r,boundOptions:e,setBoundExeca:n,createNested:i},...o);return n!==void 0&&n(s,i,e),s},ubt=({mapArguments:t,deepOptions:e={},boundOptions:r={},setBoundExeca:n,createNested:i},s,...o)=>{if(Sr(s))return i(t,qC(r,s),n);let{file:a,commandArguments:c,options:l,isSync:u}=dbt({mapArguments:t,firstArgument:s,nextArguments:o,deepOptions:e,boundOptions:r});return u?KTe(a,c,l):Zwe(a,c,l,i)},dbt=({mapArguments:t,firstArgument:e,nextArguments:r,deepOptions:n,boundOptions:i})=>{let s=cEe(e)?lEe(e,r):[e,...r],[o,a,c]=LP(...s),l=qC(qC(n,i),c),{file:u=o,commandArguments:d=a,options:f=l,isSync:p=!1}=t({file:o,commandArguments:a,options:l});return{file:u,commandArguments:d,options:f,isSync:p}};var Xwe=({file:t,commandArguments:e})=>e0e(t,e),Qwe=({file:t,commandArguments:e})=>({...e0e(t,e),isSync:!0}),e0e=(t,e)=>{if(e.length>0)throw new TypeError(`The command and its arguments must be passed as a single string: ${t} ${e}.`);let[r,...n]=fbt(t);return{file:r,commandArguments:n}},fbt=t=>{if(typeof t!="string")throw new TypeError(`The command must be a string: ${String(t)}.`);let e=t.trim();if(e==="")return[];let r=[];for(let n of e.split(pbt)){let i=r.at(-1);i&&i.endsWith("\\")?r[r.length-1]=`${i.slice(0,-1)} ${n}`:r.push(n)}return r},pbt=/ +/g;var t0e=(t,e,r)=>{t.sync=e(hbt,r),t.s=t.sync},r0e=({options:t})=>n0e(t),hbt=({options:t})=>({...n0e(t),isSync:!0}),n0e=t=>({options:{...mbt(t),...t}}),mbt=({input:t,inputFile:e,stdio:r})=>t===void 0&&e===void 0&&r===void 0?{stdin:"inherit"}:{},i0e={preferLocal:!0};var s0e=xu(()=>({})),npr=xu(()=>({isSync:!0})),o0e=xu(Xwe),ipr=xu(Qwe),spr=xu(gbe),opr=xu(r0e,{},i0e,t0e),{sendMessage:apr,getOneMessage:cpr,getEachMessage:lpr,getCancelSignal:upr}=rwe();import{Transform as gbt}from"stream";var _bt=["NETLIFY_AI_GATEWAY_KEY"];function ybt(){let t=(process.env.NETLIFY_SENSITIVE_ENV_KEYS||"").split(",").map(e=>e.trim()).filter(Boolean);return[...new Set([...t,..._bt])]}function Sbt(t){let e=t.toLowerCase();return e==="true"||e==="false"?!0:t.trim().length<4}function Ebt(){let e=ybt().map(r=>process.env[r]).filter(r=>!(!r||Sbt(r)));return[...new Set(e)].sort((r,n)=>n.length-r.length)}function ws(t){if(typeof t!="string")return t;let e=Ebt();if(e.length===0)return t;let r=t;return e.forEach(n=>{let i=new RegExp(vbt(n),"g");r=r.replace(i,"******")}),r}function vbt(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}var nT=class extends gbt{constructor(e={}){super({...e,objectMode:!1})}_transform(e,r,n){let i=e.toString(),s=ws(i);n(null,s)}},BC=Symbol("maskedWrite");function a0e(){if(process.env.NETLIFY_MASK_LOGS!=="false"){if(!process.stdout.write[BC]){let e=process.stdout.write.bind(process.stdout),r=function(n,i,s){let o=typeof n=="string"?ws(n):n;return typeof i=="function"?e(o,i):e(o,i,s)};r[BC]=!0,process.stdout.write=r}if(!process.stderr.write[BC]){let e=process.stderr.write.bind(process.stderr),r=function(n,i,s){let o=typeof n=="string"?ws(n):n;return typeof i=="function"?e(o,i):e(o,i,s)};r[BC]=!0,process.stderr.write=r}}}var c0e=!1,l0e=()=>{c0e=!0},Si=()=>c0e;var iT=null,u0e=t=>(iT&&iT.destroy(),iT=new Ic({totalAllowedTime:t}),iT),d0e=()=>iT;var Ic=class{constructor({totalAllowedTime:e}){this.withStageTimer=async(e,r,n,{interruptible:i=!0}={})=>{if(this.isTimeExpired())throw new Error(`${e} stage did not complete in the allowed time. Time has already expired.`);if(i&&Si())throw new Error(`Aborting ${e} stage \u2014 shutting down`);let s=this.onTimesUp(()=>{throw new Error(`${e} stage did not complete in the allowed time.`)}),o=null,a=null;n!==void 0&&(a=new Promise((u,d)=>{o=setTimeout(()=>{d(new Error(`${e} stage exceeded its maximum duration of ${n}ms`))},n)}));let c=Date.now(),l="success";try{return await kP({stage:e},async()=>a?await Promise.race([r(),a]):await r())}catch(u){throw l="failure",u}finally{ge.timing("stage.duration",Date.now()-c,{stage:e,outcome:l}),s(),o&&clearTimeout(o)}};this.startTime=Date.now(),this.totalAllowedTime=e,this.globalTimeoutId=null,this.subscribers=[],this.hasTimedOut=!1,this.setupGlobalTimeout()}getElapsedTime(){return Date.now()-this.startTime}getRemainingTime(){let e=this.getElapsedTime(),r=this.totalAllowedTime-e;return Math.max(0,r)}isTimeExpired(){return this.getRemainingTime()===0||this.hasTimedOut}setupGlobalTimeout(){this.globalTimeoutId&&clearTimeout(this.globalTimeoutId),this.globalTimeoutId=setTimeout(()=>{this.notifyTimeUp()},this.totalAllowedTime)}notifyTimeUp(){this.hasTimedOut=!0;for(let e=this.subscribers.length-1;e>=0;e--)try{this.subscribers[e]()}catch(r){console.error("TimeKeeper: Error in time up callback:",r)}}onTimesUp(e){if(this.subscribers.push(e),this.hasTimedOut)try{e()}catch(r){console.error("TimeKeeper: Error in time up callback:",r)}return()=>{let r=this.subscribers.indexOf(e);r>-1&&this.subscribers.splice(r,1)}}off(e){let r=this.subscribers.indexOf(e);r>-1&&this.subscribers.splice(r,1)}clearSubscribers(){this.subscribers.length=0}getSubscriberCount(){return this.subscribers.length}destroy(){this.globalTimeoutId&&(clearTimeout(this.globalTimeoutId),this.globalTimeoutId=null),this.clearSubscribers()}static{this.timeUnits={seconds:e=>e*1e3,minutes:e=>e*60*1e3,hours:e=>e*60*60*1e3}}};var f0e={name:"@netlify/agent-runner-cli",type:"module",version:"1.159.2",description:"CLI tool for running Netlify agents",main:"./dist/index.js",types:"./dist/index.d.ts",exports:"./dist/index.js",bin:{"agent-runner-cli":"./dist/bin.js","agent-runner-cli-local":"./dist/bin-local.js"},files:["dist/**/*.js","dist/**/*.d.ts","dist/skills/**","patches","scripts"],scripts:{prebuild:"rm -rf dist",build:"tsup",dev:"tsup --watch",prepare:"husky install node_modules/@netlify/eslint-config-node/.husky/",prepublishOnly:"npm ci && npm test",prepack:"npm run build",test:"run-s build format test:dev",format:"run-s build format:check-fix:*","format:ci":"run-s build format:check:*","format:check-fix:lint":"run-e format:check:lint format:fix:lint","format:check:lint":'eslint --cache --format=codeframe --max-warnings=0 "{src,scripts,test,.github}/**/*.{js,ts,md,html}"',"format:fix:lint":'eslint --fix --cache --format=codeframe --max-warnings=0 "{src,scripts,test,.github}/**/*.{js,ts,md,html}"',"format:check-fix:prettier":"run-e format:check:prettier format:fix:prettier","format:check:prettier":'prettier --check --ignore-path .gitignore --loglevel=warn "{src,scripts,test,.github}/**/*.{js,ts,md,yml,json,html}" "*.{js,ts,yml,json,html}" ".*.{js,ts,yml,json,html}" "!**/package-lock.json" "!package-lock.json" "!src/skills/**/*.md"',"format:fix:prettier":'prettier --write --ignore-path .gitignore --loglevel=warn "{src,scripts,test,.github}/**/*.{js,ts,md,yml,json,html}" "*.{js,ts,yml,json,html}" ".*.{js,ts,yml,json,html}" "!**/package-lock.json" "!package-lock.json" "!src/skills/**/*.md"',"test:dev":"run-s build test:dev:*","test:ci":"run-s build test:ci:*","test:dev:vitest":"LOG=0 vitest --exclude '**/integration/**'","test:ci:vitest":"LOG=0 vitest run --coverage --exclude '**/integration/**'","test:smoke":"node scripts/smoke-dist.js","test:integration":"vitest run test/integration/","test:integration:codex":"vitest run test/integration/codex.test.ts","test:integration:claude":"vitest run test/integration/claude.test.ts","test:integration:gemini":"vitest run test/integration/gemini.test.ts","test:integration:skill-invocation":"vitest run test/integration/skill-invocation.test.ts","check:types":"tsc --noEmit",postinstall:"node scripts/postinstall.js"},keywords:[],license:"MIT",repository:"netlify/agent-runner-cli",bugs:{url:"https://github.com/netlify/agent-runner-cli/issues"},author:"Netlify Inc.",directories:{test:"test"},devDependencies:{"@commitlint/cli":"^20.0.0","@commitlint/config-conventional":"^20.0.0","@eslint/compat":"^2.0.0","@eslint/js":"^10.0.1","@netlify/axis":"^1.17.3","@netlify/eslint-config-node":"^7.0.1","@types/node":"^24.5.0","@typescript-eslint/eslint-plugin":"^8.0.0","@typescript-eslint/parser":"^8.0.0","@vitest/coverage-v8":"^4.1.5","@vitest/eslint-plugin":"^1.6.6",eslint:"^10.5.0","eslint-config-prettier":"^10.1.8","eslint-plugin-n":"^17.0.0",husky:"^9.0.0",jiti:"^2.7.0","patch-package":"^8.0.0",tsup:"^8.5.0",typescript:"^5.0.0","typescript-eslint":"^8.44.0",vitest:"^4.0.16"},dependencies:{"@anthropic-ai/claude-code":"^2.1.219","@anthropic-ai/sdk":"0.91.1","@google/gemini-cli":"0.42.0","@modelcontextprotocol/sdk":"^1.29.0","@netlify/cache-utils":"^6.0.5","@netlify/database-proxy":"^0.1.5","@netlify/otel":"^6.0.6","@netlify/ts-cli":"^1.2.0","@openai/codex":"0.128.0","@opentelemetry/api":"^1.9.0","@opentelemetry/exporter-trace-otlp-grpc":"0.218.0",execa:"^9.6.1",fastify:"5.8.5",minimist:"^1.2.8",openai:"6.34.0",zod:"^4.4.3"}};var Abt=Tbt(import.meta.url),Rbt=Oc.dirname(Abt),xbt=wbt(import.meta.url),Zg=ye("shell"),mW=new Set,p0e={preferLocal:!0},hn=(t,e,r)=>{let[n,i]=Ibt(e,r),s={...p0e,...i},o=s0e(t,n,s);m0e(o,s),y0e(o);let a=r?.idleTimeout;return a&&a>0&&_0e(o,a),o},h0e=(t,e)=>{let r={...p0e,...e},n=o0e(t,r);return m0e(n,r),y0e(n),e?.idleTimeout&&e.idleTimeout>0&&_0e(n,e.idleTimeout),n},Ibt=function(t,e){return Array.isArray(t)?[t,e]:typeof t=="object"&&t!==null?[[],t]:[[],void 0]},m0e=(t,e)=>{if(e.stdio!==void 0||e.stdout!==void 0||e.stderr!==void 0)return;if(Pc.env.NETLIFY_MASK_LOGS!=="false"){t.stdout?.pipe(new nT).pipe(Pc.stdout),t.stderr?.pipe(new nT).pipe(Pc.stderr);return}t.stdout?.pipe(Pc.stdout),t.stderr?.pipe(Pc.stderr)},gW=(t,e="SIGTERM")=>{try{return t.pid&&!t.killed?(Pc.kill(-t.pid,e),Zg.log(`Killed process ${t.pid} with signal ${e}`),!0):!1}catch(r){return Zg.error("Error killing process:",r),!1}},g0e=t=>gW(t,"SIGKILL"),_0e=(t,e)=>{let r=null,n=()=>{Zg.log(`Process ${t.pid} killed due to idle timeout (no output for ${e}ms)`),gW(t,"SIGTERM"),setTimeout(()=>{t.pid&&!t.killed&&(Zg.log(`Force killing idle process ${t.pid}`),g0e(t))},5e3)},i=()=>{r&&clearTimeout(r),r=setTimeout(n,e)};i(),t.stdout?.on("data",i),t.stderr?.on("data",i);let s=()=>{r&&(clearTimeout(r),r=null)};t.on("exit",s),t.on("error",s)},y0e=t=>{mW.add(t);let e=d0e();if(e){let r=e.onTimesUp(()=>{Zg.log(`Global timer expired, killing process ${t.pid}`),gW(t,"SIGTERM"),setTimeout(()=>{t.pid&&!t.killed&&(Zg.log(`Force killing process ${t.pid} after timeout`),g0e(t))},5e3)});t.on("exit",()=>{mW.delete(t),r()}),t.on("error",()=>{mW.delete(t),r()})}};function ca(t,e){if(!Pc.env.NETLIFY_LOCAL_MODE)try{let i=xbt.resolve(f0e.name),s=Oc.dirname(i);for(;s!==Oc.dirname(s);){let o=Oc.dirname(s);if(Oc.basename(o)==="node_modules"){let a=Oc.join(o,".bin",e);if(zC.existsSync(a))return a;break}s=o}}catch(i){console.error("Could not resolve package.json",i)}if(Pc.env.NODE_PATH){let i=Oc.join(Pc.env.NODE_PATH,".bin",e);if(zC.existsSync(i))return i}let r=Oc.join(t,"node_modules",".bin",e);if(zC.existsSync(r))return r;let n=Oc.join(Rbt,"..","node_modules",".bin",e);if(zC.existsSync(n))return n}import fD from"process";import{fileURLToPath as nDt}from"url";import{createRequire as iDt}from"module";import pD from"path";var Obt="__netlify__getTracer",Pbt="__netlify__shutdownTracers",mt=(t,e)=>globalThis[Obt]?.(t,e),S0e=async()=>globalThis[Pbt]?.();function Yf(t,e,r,n,i){let s=typeof n=="function"?n:typeof r=="function"?r:i;if(!s)throw new Error("function to execute with active span is missing");return t?t.withActiveSpan(e,r,n,s):s()}import{setTimeout as JLt}from"timers/promises";Ne();import Cwt from"process";Ne();var eTt=(t,e)=>{e.recordException(t),e.setStatus({code:Cn.ERROR})};var kc=class{constructor(e){this._tracer=e,this.startSpan=e.startSpan.bind(this._tracer),this.startActiveSpan=e.startActiveSpan.bind(this._tracer)}withActiveSpan(e,r,n,i){let{opts:s,ctx:o,fn:a}=fAe(r,n,i);return this._tracer.startActiveSpan(e,s,o,c=>pAe(c,s,a))}withSpan(e,r,n,i){let{opts:s,ctx:o,fn:a}=fAe(r,n,i),c=this._tracer.startSpan(e,s,o);return pAe(c,s,a)}};function fAe(t,e,r){let n,i,s;return!e&&!r?s=t:r?(n=t,i=e,s=r):(n=t,s=e),n=n??{},i=i??jt.active(),{opts:n,ctx:i,fn:s}}function pAe(t,e,r){var n;let i=(n=e.onException)!==null&&n!==void 0?n:eTt,s=o=>{throw i(o,t),t.end(),o};try{let o=r(t);return typeof o?.then=="function"?o.then(a=>(t.end(),a),s):(t.end(),o)}catch(o){throw s(o)}}Ne();var i_=t=>t!==null&&typeof t=="object"&&typeof t.then=="function";var JW=class t{_rawAttributes;_asyncAttributesPending=!1;_schemaUrl;_memoizedAttributes;static FromAttributeList(e,r){let n=new t({},r);return n._rawAttributes=TAe(e),n._asyncAttributesPending=e.filter(([i,s])=>i_(s)).length>0,n}constructor(e,r){let n=e.attributes??{};this._rawAttributes=Object.entries(n).map(([i,s])=>(i_(s)&&(this._asyncAttributesPending=!0),[i,s])),this._rawAttributes=TAe(this._rawAttributes),this._schemaUrl=tTt(r?.schemaUrl)}get asyncAttributesPending(){return this._asyncAttributesPending}async waitForAsyncAttributes(){if(this.asyncAttributesPending){for(let e=0;e<this._rawAttributes.length;e++){let[r,n]=this._rawAttributes[e];this._rawAttributes[e]=[r,i_(n)?await n:n]}this._asyncAttributesPending=!1}}get attributes(){if(this.asyncAttributesPending&&ce.error("Accessing resource attributes before async attributes settled"),this._memoizedAttributes)return this._memoizedAttributes;let e={};for(let[r,n]of this._rawAttributes){if(i_(n)){ce.debug(`Unsettled resource attribute ${r} skipped`);continue}n!=null&&(e[r]??=n)}return this._asyncAttributesPending||(this._memoizedAttributes=e),e}getRawAttributes(){return this._rawAttributes}get schemaUrl(){return this._schemaUrl}merge(e){if(e==null)return this;let r=rTt(this,e),n=r?{schemaUrl:r}:void 0;return t.FromAttributeList([...e.getRawAttributes(),...this.getRawAttributes()],n)}};function ZW(t,e){return JW.FromAttributeList(Object.entries(t),e)}function TAe(t){return t.map(([e,r])=>i_(r)?[e,r.catch(n=>{ce.debug("promise rejection for resource attribute: %s - %s",e,n)})]:[e,r])}function tTt(t){if(typeof t=="string"||t===void 0)return t;ce.warn("Schema URL must be string or undefined, got %s. Schema URL will be ignored.",t)}function rTt(t,e){let r=t?.schemaUrl,n=e?.schemaUrl,i=r===void 0||r==="",s=n===void 0||n==="";if(i)return n;if(s||r===n)return r;ce.warn('Schema URL merge conflict: old resource has "%s", updating resource has "%s". Resulting resource will have undefined Schema URL.',r,n)}Ne();var gT=class{emit(e){}enabled(){return!1}},wAe=new gT;var _T=Symbol.for("io.opentelemetry.js.api.logs"),s_=globalThis;function AAe(t,e,r){return n=>n===t?e:r}var XW=1;var QW=class{getLogger(e,r,n){return new gT}},fN=new QW;var pN=class{constructor(e,r,n,i){this._provider=e,this.name=r,this.version=n,this.options=i}emit(e){this._getLogger().emit(e)}enabled(e){return this._getLogger().enabled(e)}_getLogger(){if(this._delegate)return this._delegate;let e=this._provider._getDelegateLogger(this.name,this.version,this.options);return e?(this._delegate=e,this._delegate):wAe}};var yT=class{getLogger(e,r,n){var i;return(i=this._getDelegateLogger(e,r,n))!==null&&i!==void 0?i:new pN(this,e,r,n)}_getDelegate(){var e;return(e=this._delegate)!==null&&e!==void 0?e:fN}_setDelegate(e){this._delegate=e}_getDelegateLogger(e,r,n){var i;return(i=this._delegate)===null||i===void 0?void 0:i.getLogger(e,r,n)}};var hN=class t{constructor(){this._proxyLoggerProvider=new yT}static getInstance(){return this._instance||(this._instance=new t),this._instance}setGlobalLoggerProvider(e){return s_[_T]?this.getLoggerProvider():(s_[_T]=AAe(XW,e,fN),this._proxyLoggerProvider._setDelegate(e),e)}getLoggerProvider(){var e,r;return(r=(e=s_[_T])===null||e===void 0?void 0:e.call(s_,XW))!==null&&r!==void 0?r:this._proxyLoggerProvider}getLogger(e,r,n){return this.getLoggerProvider().getLogger(e,r,n)}disable(){delete s_[_T],this._proxyLoggerProvider=new yT}};var RAe=hN.getInstance();function xAe(t,e,r,n){for(let i=0,s=t.length;i<s;i++){let o=t[i];e&&o.setTracerProvider(e),r&&o.setMeterProvider(r),n&&o.setLoggerProvider&&o.setLoggerProvider(n),o.getConfig().enabled||o.enable()}}function IAe(t){t.forEach(e=>e.disable())}function eY(t){let e=t.tracerProvider||At.getTracerProvider(),r=t.meterProvider||mT.getMeterProvider(),n=t.loggerProvider||RAe.getLoggerProvider(),i=t.instrumentations?.flat()??[];return xAe(i,e,r,n),()=>{IAe(i)}}Ne();var nTt=zr("OpenTelemetry SDK Context Key SUPPRESS_TRACING");function OAe(t){return t.getValue(nTt)===!0}var o_;(function(t){t[t.SUCCESS=0]="SUCCESS",t[t.FAILED=1]="FAILED"})(o_||(o_={}));Ne();var tY="[_0-9a-z-*/]",iTt=`[a-z]${tY}{0,255}`,sTt=`[a-z0-9]${tY}{0,240}@[a-z]${tY}{0,13}`,oTt=new RegExp(`^(?:${iTt}|${sTt})$`),aTt=/^[ -~]{0,255}[!-~]$/,cTt=/,|=/;function rY(t){return oTt.test(t)}function nY(t){return aTt.test(t)&&!cTt.test(t)}var lTt=32,PAe=512,CAe=",",NAe="=",mN=class t{_length;_rawTraceState;_internalState;constructor(e){this._rawTraceState=typeof e=="string"?e:"",this._length=this._rawTraceState.length}set(e,r){if(!rY(e)||!nY(r))return this;let n=this._getState(),i=n.get(e),s=this._length;if(typeof i=="string"?s+=r.length-i.length:s+=e.length+r.length+(n.size>0?2:1),s>PAe)return this;let o=new Map(n);return o.delete(e),o.set(e,r),this._fromState(o,s)}unset(e){let r=this._getState(),n=r.get(e);if(typeof n!="string")return this;let i=this._length-(e.length+n.length+1);r.size>1&&(i=i-1);let s=new Map(r);return s.delete(e),this._fromState(s,i)}get(e){return this._getState().get(e)}serialize(){let e="",r=0;for(let n of this._getState())r>0&&(e=CAe+e),e=`${n[0]}${NAe}${n[1]}`+e,r++;return e}_getState(){if(this._internalState)return this._internalState;let e=this._rawTraceState.split(CAe),r=new Map,n=0;for(let i of e){let s=i.trim(),o=s.indexOf(NAe);if(o===-1)continue;let a=s.slice(0,o),c=s.slice(o+1);if(!rY(a)||!nY(c))continue;let l=n+s.length+(r.size>0?1:0);if(!(l>PAe)&&(r.set(a,c),n=l,r.size>=lTt))break}return this._length=n,this._internalState=new Map(Array.from(r.entries()).reverse()),this._internalState}_fromState(e,r){let n=Object.create(t.prototype);return n._internalState=e,n._length=r,n}};var gN="traceparent",_N="tracestate",uTt="00",dTt="(?!ff)[\\da-f]{2}",fTt="(?![0]{32})[\\da-f]{32}",pTt="(?![0]{16})[\\da-f]{16}",hTt="[\\da-f]{2}",mTt=new RegExp(`^\\s?(${dTt})-(${fTt})-(${pTt})-(${hTt})(-.*)?\\s?$`);function kAe(t){let e=mTt.exec(t);return!e||e[1]==="00"&&e[5]?null:{traceId:e[2],spanId:e[3],traceFlags:parseInt(e[4],16)}}var Pu=class{inject(e,r,n){let i=At.getSpanContext(e);if(!i||OAe(e)||!Ei(i))return;let s=`${uTt}-${i.traceId}-${i.spanId}-0${Number(i.traceFlags||pr.NONE).toString(16)}`;n.set(r,gN,s),i.traceState&&n.set(r,_N,i.traceState.serialize())}extract(e,r,n){let i=n.get(r,gN);if(!i)return e;let s=Array.isArray(i)?i[0]:i;if(typeof s!="string")return e;let o=kAe(s);if(!o)return e;o.isRemote=!0;let a=n.get(r,_N);if(a){let c=Array.isArray(a)?a.join(","):a;o.traceState=new mN(typeof c=="string"?c:void 0)}return At.setSpanContext(e,o)}fields(){return[gN,_N]}};var yN=class{_promise;_resolve;_reject;constructor(){this._promise=new Promise((e,r)=>{this._resolve=e,this._reject=r})}get promise(){return this._promise}resolve(e){this._resolve(e)}reject(e){this._reject(e)}};var ST=class{_isCalled=!1;_deferred=new yN;_callback;_that;constructor(e,r){this._callback=e,this._that=r}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(r=>this._deferred.resolve(r),r=>this._deferred.reject(r))}catch(r){this._deferred.reject(r)}}return this._deferred.promise}};var lk=jn(BY(),1);Ne();var mIe=t=>{throw TypeError(t)},GY=(t,e,r)=>e.has(t)||mIe("Cannot "+r),ck=(t,e,r)=>(GY(t,e,"read from private field"),r?r.call(t):e.get(t)),zY=(t,e,r)=>e.has(t)?mIe("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r),fIe=(t,e,r,n)=>(GY(t,e,"write to private field"),n?n.call(t,r):e.set(t,r),r),Pwt=(t,e,r)=>(GY(t,e,"access private method"),r),pIe="__netlify__getTracer",Nwt="__netlify__shutdownTracers",kwt="__nfOTLPTrace",$T,LT,HY,gIe,$wt=class{constructor(){zY(this,HY),zY(this,$T),zY(this,LT),fIe(this,$T,new ST(Pwt(this,HY,gIe),this)),fIe(this,LT,ce.createComponentLogger({namespace:"netlify-span-exporter"}))}export(t,e){if(ck(this,LT).debug(`export ${t.length.toString()} spans`),ck(this,$T).isCalled){e({code:o_.FAILED,error:new Error("Exporter has been shutdown")});return}console.log(kwt,JSON.stringify(Lwt(t))),e({code:o_.SUCCESS})}shutdown(){return ck(this,$T).call()}};$T=new WeakMap;LT=new WeakMap;HY=new WeakSet;gIe=function(){return ck(this,LT).debug("Shutting down"),Promise.resolve()};function Lwt(t){return{resourceSpans:t.map(e=>{let r=e.spanContext();return{resource:{attributes:ak(e.resource.attributes),droppedAttributesCount:e.droppedAttributesCount},scopeSpans:[{scope:{name:e.instrumentationScope.name,version:e.instrumentationScope.version},spans:[{traceId:r.traceId,spanId:r.spanId,parentSpanId:e.parentSpanContext?.spanId,name:e.name,kind:e.kind||oo.SERVER,startTimeUnixNano:VY(e.startTime),endTimeUnixNano:VY(e.endTime),attributes:ak(e.attributes),droppedAttributesCount:e.droppedAttributesCount,events:e.events.map(n=>({name:n.name,timeUnixNano:VY(n.time),attributes:ak(n.attributes??{}),droppedAttributesCount:n.droppedAttributesCount??0})),droppedEventsCount:e.droppedEventsCount,status:{code:e.status.code,message:e.status.message},links:e.links.map(n=>({spanId:n.context.spanId,traceId:n.context.traceId,attributes:ak(n.attributes??{}),droppedAttributesCount:n.droppedAttributesCount??0})),droppedLinksCount:e.droppedLinksCount}]}]}})}}function ak(t){return Object.keys(t).map(e=>_Ie(e,t[e]))}function _Ie(t,e){return{key:t,value:yIe(e)}}function yIe(t){let e=typeof t;return e==="string"?{stringValue:t}:e==="number"?Number.isInteger(t)?{intValue:t}:{doubleValue:t}:e==="boolean"?{boolValue:t}:t instanceof Uint8Array?{bytesValue:t}:Array.isArray(t)?{arrayValue:{values:t.map(yIe)}}:e==="object"&&t!=null?{kvlistValue:{values:Object.entries(t).map(([r,n])=>_Ie(r,n))}}:{}}function VY(t){let e=BigInt(1e9);return(BigInt(Math.trunc(t[0]))*e+BigInt(Math.trunc(t[1]))).toString()}var hIe={name:"@netlify/otel",version:"6.0.6",type:"module",engines:{node:"^18.14.0 || >=20.6.1"},main:"./dist/main.cjs",module:"./dist/main.js",types:"./dist/main.d.ts",exports:{".":{require:{types:"./dist/main.d.cts",default:"./dist/main.cjs"},import:{types:"./dist/main.d.ts",default:"./dist/main.js"},default:{types:"./dist/main.d.ts",default:"./dist/main.js"}},"./package.json":"./package.json","./bootstrap":{require:{types:"./dist/bootstrap/main.d.cts",default:"./dist/bootstrap/main.cjs"},import:{types:"./dist/bootstrap/main.d.ts",default:"./dist/bootstrap/main.js"},default:{types:"./dist/bootstrap/main.d.ts",default:"./dist/bootstrap/main.js"}},"./exporter-netlify":{require:{types:"./dist/exporters/netlify.d.cts",default:"./dist/exporters/netlify.cjs"},import:{types:"./dist/exporters/netlify.d.ts",default:"./dist/exporters/netlify.js"},default:{types:"./dist/exporters/netlify.d.ts",default:"./dist/exporters/netlify.js"}},"./instrumentation-fetch":{require:{types:"./dist/instrumentations/fetch.d.cts",default:"./dist/instrumentations/fetch.cjs"},import:{types:"./dist/instrumentations/fetch.d.ts",default:"./dist/instrumentations/fetch.js"},default:{types:"./dist/instrumentations/fetch.d.ts",default:"./dist/instrumentations/fetch.js"}},"./instrumentation-http":{require:{types:"./dist/instrumentations/http.d.cts",default:"./dist/instrumentations/http.cjs"},import:{types:"./dist/instrumentations/http.d.ts",default:"./dist/instrumentations/http.js"},default:{types:"./dist/instrumentations/http.d.ts",default:"./dist/instrumentations/http.js"}},"./opentelemetry":{require:{types:"./dist/opentelemetry.d.cts",default:"./dist/opentelemetry.cjs"},import:{types:"./dist/opentelemetry.d.ts",default:"./dist/opentelemetry.js"},default:{types:"./dist/opentelemetry.d.ts",default:"./dist/opentelemetry.js"}}},files:["dist/**/*"],scripts:{build:"tsup-node",dev:"tsup-node --watch",prepack:"npm run build",test:"run-s build test:ci","test:dev":"run-s build test:dev:*","test:ci":"run-s build test:ci:*","test:dev:vitest":"vitest","test:dev:vitest:watch":"vitest watch","test:ci:vitest":"vitest run",publint:"npx -y publint --strict"},keywords:["netlify","cdn"],license:"MIT",repository:{type:"git",url:"https://github.com/netlify/primitives.git",directory:"packages/otel"},bugs:{url:"https://github.com/netlify/primitives/issues"},author:"Netlify Inc.",devDependencies:{"@netlify/dev-utils":"^5.0.0",msw:"^2.10.5","npm-run-all2":"^7.0.2",tsup:"^8.0.0",vitest:"^3.0.0"},dependencies:{"@opentelemetry/api":"1.9.1","@opentelemetry/core":"2.8.0","@opentelemetry/instrumentation":"^0.220.0","@opentelemetry/resources":"2.9.0","@opentelemetry/sdk-trace-node":"2.9.0"}},SIe=t=>{if(Object.prototype.hasOwnProperty.call(globalThis,pIe))return;let e=Cwt.version.slice(1),r=ZW({"service.name":t.serviceName,"service.version":t.serviceVersion,"process.runtime.name":"nodejs","process.runtime.version":e,"deployment.environment":t.deploymentEnvironment,"http.url":t.siteUrl,"netlify.site.id":t.siteId,"netlify.site.name":t.siteName}),n=t.spanProcessors??[Dwt()],i=new lk.NodeTracerProvider({resource:r,spanProcessors:n});i.register({propagator:new Pu});let s=t.instrumentations??[];eY({instrumentations:s,tracerProvider:i}),Object.defineProperty(globalThis,pIe,{enumerable:!1,configurable:!0,writable:!1,value:function(a,c){return a?new kc(At.getTracer(a,c)):new kc(At.getTracer(hIe.name,hIe.version))}}),Object.defineProperty(globalThis,Nwt,{enumerable:!1,configurable:!0,writable:!1,value:async()=>await i.shutdown()})},Dwt=()=>new lk.SimpleSpanProcessor(new $wt);Ne();var DT=jn(BY(),1);Ne();import*as uk from"diagnostics_channel";var EIe=class{constructor(t={}){this.instrumentationName="@netlify/otel/instrumentation-fetch",this.instrumentationVersion="1.0.0",this._recordFromReq=new WeakMap,this.config=t,this._channelSubs=[]}getConfig(){return this.config}setConfig(){}setMeterProvider(){}setTracerProvider(t){this.provider=t}getTracerProvider(){return this.provider}annotateFromRequest(t,e){let r=this.config.getRequestAttributes?.(e)??{},n=new URL(e.path,e.origin);t.setAttributes({...r,"http.request.method":e.method,"url.full":n.href,"url.host":n.host,"url.scheme":n.protocol.slice(0,-1),"server.address":n.hostname,"server.port":n.port,...this.prepareHeaders("request",e.headers)})}annotateFromResponse(t,e){let r=this.config.getResponseAttributes?.(e)??{};t.setAttributes({...r,"http.response.status_code":e.statusCode,...this.prepareHeaders("response",e.headers)}),t.setStatus({code:e.statusCode>=400?Cn.ERROR:Cn.UNSET})}prepareHeaders(t,e){if(!Array.isArray(e))return{};if(this.config.skipHeaders===!0)return{};let r=["*","/.*/"],n=this.config.skipHeaders??[],i=this.config.redactHeaders??[],s=n.some(a=>r.includes(a.toString())),o={};if(s)return o;for(let a=0;a+1<e.length;a=a+2){let c=e[a],l=e[a+1];if(typeof c!="string"&&!Buffer.isBuffer(c)||typeof l!="string"&&!Buffer.isBuffer(l))continue;let u=c.toString().toLowerCase();if(n.some(f=>typeof f=="string"?f==u:f.test(u)))continue;let d=`http.${t}.header.${u}`;i===!0||i.some(f=>typeof f=="string"?f==u:f.test(u))?o[d]="REDACTED":o[d]=l.toString()}return o}getRequestMethod(t){return["HEAD","GET","POST","PUT","PATCH","DELETE"].includes(t.toUpperCase())?t.toUpperCase():"_OTHER"}getTracer(){if(!this.provider)return;let t=this.provider.getTracer(this.instrumentationName,this.instrumentationVersion);return t instanceof kc?t:new kc(t)}enable(){this._channelSubs.length>0||(this.subscribe("undici:request:create",this.onRequestCreate.bind(this)),this.subscribe("undici:request:headers",this.onRequestHeaders.bind(this)),this.subscribe("undici:request:trailers",this.onRequestEnd.bind(this)),this.subscribe("undici:request:error",this.onRequestError.bind(this)))}subscribe(t,e){uk.subscribe(t,e);let r=()=>uk.unsubscribe(t,e);this._channelSubs.push({name:t,unsubscribe:r})}disable(){this._channelSubs.forEach(t=>{t.unsubscribe()}),this._channelSubs.length=0}onRequestCreate({request:t}){try{let e=this.getTracer(),r=new URL(t.path,t.origin);if(!e||t.method==="CONNECT"||this.config.skipURLs?.some(i=>typeof i=="string"?r.href.startsWith(i):i.test(r.href)))return;let n=e.startSpan(this.getRequestMethod(t.method),{kind:oo.CLIENT},jt.active());this.annotateFromRequest(n,t),this._recordFromReq.set(t,n)}catch{}}onRequestHeaders({request:t,response:e}){try{let r=this._recordFromReq.get(t);if(!r)return;this.annotateFromResponse(r,e)}catch{}}onRequestError({request:t,error:e}){try{let r=this._recordFromReq.get(t);if(!r)return;r.recordException(e),r.setStatus({code:Cn.ERROR,message:e.message}),r.end(),this._recordFromReq.delete(t)}catch{}}onRequestEnd({request:t}){try{let e=this._recordFromReq.get(t);if(!e)return;e.end(),this._recordFromReq.delete(t)}catch{}}};var VDe=jn(BDe(),1);var uD=ye("tracing"),zDe=8e3,ZLt=5e3,e0=async(t=ZLt)=>{try{await Promise.race([S0e(),JLt(t)])}catch(e){uD.warn("Failed to flush tracers on shutdown",e)}},HDe=async(t,e,r)=>{if(!mt()){let n=[new DT.SimpleSpanProcessor(new WJ),new DT.SimpleSpanProcessor(new VDe.OTLPTraceExporter({url:r.exporterUrl}))];await SIe({serviceName:"@netlify/agent-runner-cli",serviceVersion:t,deploymentEnvironment:"production",siteUrl:"",siteId:process.env.SITE_ID??"",siteName:e,spanProcessors:n,instrumentations:[new EIe({skipHeaders:!0})]})}return r.traceparent?(Xn.setGlobalPropagator(new Pu),Xn.extract(jt.active(),{traceparent:r.traceparent,isRemote:!0})):jt.active()};function Gt(t,e,r){return uD.log(`\u23F3 TRACE: ${e} starting...`),Yf(t,e,r)}var WJ=class{export(e,r){for(let n of e)this.logSpan(n);r({code:1})}async shutdown(){}forceFlush(){return Promise.resolve()}logSpan(e){let r=(e.endTime[0]-e.startTime[0])*1e3+(e.endTime[1]-e.startTime[1])/1e6,n=e.attributes,i=[];for(let[a,c]of Object.entries(n))a.includes("duration")&&typeof c=="number"?i.push(`${a}=${c.toFixed(2)}ms`):i.push(`${a}=${c}`);let s=e.status?.code===2?"\u274C":"\u2705",o=i.length>0?` [${i.join(", ")}]`:"";uD.log(`${s} TRACE: ${e.name} completed in ${r.toFixed(2)}ms${o}`),e.status?.code===2&&e.status.message&&uD.log(` \u274C Error: ${e.status.message}`)}};function YJ(){return Be().captureLlmContentEnabled}function GDe(t){return t.includes("claude")?"anthropic":t.includes("codex")?"openai":t.includes("gemini")?"google":t.includes("opencode")?"opencode":t}function dD(t,e,r){let n={role:t,parts:[{type:"text",content:ws(e)}]};return r&&(n.finish_reason=r),JSON.stringify([n])}var XLt=new Set([Q.Task,Q.RunCommand,Q.Explore,Q.FileRead,Q.FileWrite,Q.Notebook,Q.Web,Q.Todo,Q.Skill,Q.Tool,Q.Memorize,Q.Deployment,Q.SiteGeneration]);function WDe(t,e,r,n){if(!t.length)return;let i=mt();if(!i)return;let s=YJ(),o=Math.max(1,(n-r)/t.length);t.forEach((a,c)=>{let l=Math.min(n,r+c*o),u=Math.min(n,l+o),d=a.type==="tool_use"||a.type==="tool_result"||a.category!=null&&XLt.has(a.category),f=d?"execute_tool":"chat",p=a.title||a.type||`step-${a.id??c}`,h=a.category||"unknown",m=d?`${f} ${h}`:f,_=a.message?a.message.length>zDe?`${a.message.slice(0,zDe)}\u2026`:a.message:void 0;i.startSpan(m,{startTime:l,attributes:{"gen_ai.capability.name":e,"gen_ai.step.name":p,"gen_ai.operation.name":f,...d?{"gen_ai.tool.name":h}:{},"spark.step.id":a.id??-1,...a.type?{"spark.step.type":a.type}:{},...a.category?{"spark.step.category":a.category}:{},...a.groupId?{"spark.step.group_id":a.groupId}:{},...a.parentGroupId?{"spark.step.parent_group_id":a.parentGroupId}:{},...s&&_?d?{"gen_ai.tool.call.result":ws(_)}:{"gen_ai.output.messages":dD("assistant",_)}:{}}}).end(u)})}import{readdir as QLt,rm as eDt}from"fs/promises";import{join as tDt}from"path";async function YDe(t,e=[]){let n=(await QLt(t)).filter(i=>!e.includes(i));await Promise.all(n.map(i=>eDt(tDt(t,i),{recursive:!0,force:!0})))}var rDt=700,KDe=t=>{if(t.mode!=="create")return!1;if(t.accountType===Al)return!0;let{enforcedAICreditsRemaining:e}=t;return e!=null&&e<=rDt};var sDt=pD.dirname(nDt(import.meta.url)),JDe=iDt(import.meta.url),oDt=pD.resolve(sDt,"scripts/scaffold.js"),aDt="scripts/scaffold.js",cDt=/"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\S+/g,KJ=t=>{if(t.length>=2){let e=t[0],r=t[t.length-1];if(e==='"'&&r==='"'||e==="'"&&r==="'")return t.slice(1,-1)}return t},lDt=t=>/^[A-Za-z_][A-Za-z0-9_]*=.*/.test(t),uDt=t=>{let e=KJ(t);return e==="node"||e.endsWith("/node")},nl=t=>{if(typeof t!="string")return!1;let e=t.match(cDt)||[];if(e.length<2)return!1;let r=0;for(;r<e.length&&lDt(KJ(e[r]));)r+=1;if(r>=e.length||!uDt(e[r]))return!1;let n=e[r+1];return n?KJ(n).includes(aDt):!1},_y=ye("create_stage"),ZDe="Do not run local validation or dev-server commands to check your work \u2014 specifically `tsc`, `npx tsc`, `vite build`, `vite dev`, or any equivalent build/start/test command. The build pipeline installs and validates the project automatically after your edits. Verify your changes by reading the files you edited.",dDt=`${ZDe}
590
+ if (condition) { yield value; }`)};import{Buffer as $St}from"buffer";import{StringDecoder as LSt}from"string_decoder";var xC=(t,e,r)=>{if(r)return;if(t)return{transform:DSt.bind(void 0,new TextEncoder)};let n=new LSt(e);return{transform:MSt.bind(void 0,n),final:USt.bind(void 0,n)}},DSt=function*(t,e){$St.isBuffer(e)?yield wc(e):typeof e=="string"?yield t.encode(e):yield e},MSt=function*(t,e){yield kr(e)?t.write(e):e},USt=function*(t){let e=t.end();e!==""&&(yield e)};import{callbackify as kTe}from"util";var N3=kTe(async(t,e,r,n)=>{e.currentIterable=t(...r);try{for await(let i of e.currentIterable)n.push(i)}finally{delete e.currentIterable}}),IC=async function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=jSt}=e[r];for await(let i of n(t))yield*IC(i,e,r+1)},$Te=async function*(t){for(let[e,{final:r}]of Object.entries(t))yield*FSt(r,Number(e),t)},FSt=async function*(t,e,r){if(t!==void 0)for await(let n of t())yield*IC(n,r,e+1)},LTe=kTe(async({currentIterable:t},e)=>{if(t!==void 0){await(e?t.throw(e):t.return());return}if(e)throw e}),jSt=function*(t){yield t};var k3=(t,e,r,n)=>{try{for(let i of t(...e))r.push(i);n()}catch(i){n(i)}},DTe=(t,e)=>[...e.flatMap(r=>[...Hf(r,t,0)]),...Zb(t)],Hf=function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=BSt}=e[r];for(let i of n(t))yield*Hf(i,e,r+1)},Zb=function*(t){for(let[e,{final:r}]of Object.entries(t))yield*qSt(r,Number(e),t)},qSt=function*(t,e,r){if(t!==void 0)for(let n of t())yield*Hf(n,r,e+1)},BSt=function*(t){yield t};var $3=({value:t,value:{transform:e,final:r,writableObjectMode:n,readableObjectMode:i},optionName:s},{encoding:o})=>{let a={},c=UTe(t,o,s),l=Vf(e),u=Vf(r),d=l?N3.bind(void 0,IC,a):k3.bind(void 0,Hf),f=l||u?N3.bind(void 0,$Te,a):k3.bind(void 0,Zb),p=l||u?LTe.bind(void 0,a):void 0;return{stream:new zSt({writableObjectMode:n,writableHighWaterMark:MTe(n),readableObjectMode:i,readableHighWaterMark:MTe(i),transform(m,_,y){d([m,c,0],this,y)},flush(m){f([c],this,m)},destroy:p})}},OC=(t,e,r,n)=>{let i=e.filter(({type:o})=>o==="generator"),s=n?i.reverse():i;for(let{value:o,optionName:a}of s){let c=UTe(o,r,a);t=DTe(c,t)}return t},UTe=({transform:t,final:e,binary:r,writableObjectMode:n,readableObjectMode:i,preserveNewlines:s},o,a)=>{let c={};return[{transform:PTe(n,a)},xC(r,o,n),RC(r,s,n,c),{transform:t,final:e},{transform:CTe(i,a)},OTe({binary:r,preserveNewlines:s,readableObjectMode:i,state:c})].filter(Boolean)};var FTe=(t,e)=>{for(let r of VSt(t))HSt(t,r,e)},VSt=t=>new Set(Object.entries(t).filter(([,{direction:e}])=>e==="input").map(([e])=>Number(e))),HSt=(t,e,r)=>{let{stdioItems:n}=t[e],i=n.filter(({contents:a})=>a!==void 0);if(i.length===0)return;if(e!==0){let[{type:a,optionName:c}]=i;throw new TypeError(`Only the \`stdin\` option, not \`${c}\`, can be ${Ru[a]} with synchronous methods.`)}let o=i.map(({contents:a})=>a).map(a=>GSt(a,n));r.input=qb(o)},GSt=(t,e)=>{let r=OC(t,e,"utf8",!0);return WSt(r),qb(r)},WSt=t=>{let e=t.find(r=>typeof r!="string"&&!kr(r));if(e!==void 0)throw new TypeError(`The \`stdin\` option is invalid: when passing objects as input, a transform must be used to serialize them to strings or Uint8Arrays: ${e}.`)};import{writeFileSync as ZSt,appendFileSync as XSt}from"fs";var PC=({stdioItems:t,encoding:e,verboseInfo:r,fdNumber:n})=>n!=="all"&&Mg(r,n)&&!ji.has(e)&&YSt(n)&&(t.some(({type:i,value:s})=>i==="native"&&KSt.has(s))||t.every(({type:i})=>Ts.has(i))),YSt=t=>t===1||t===2,KSt=new Set(["pipe","overlapped"]),jTe=async(t,e,r,n)=>{for await(let i of t)JSt(e)||BTe(i,r,n)},qTe=(t,e,r)=>{for(let n of t)BTe(n,e,r)},JSt=t=>t._readableState.pipes.length>0,BTe=(t,e,r)=>{let n=VP(t);na({type:"output",verboseMessage:n,fdNumber:e,verboseInfo:r})};var zTe=({fileDescriptors:t,syncResult:{output:e},options:r,isMaxBuffer:n,verboseInfo:i})=>{if(e===null)return{output:Array.from({length:3})};let s={},o=new Set([]);return{output:e.map((c,l)=>QSt({result:c,fileDescriptors:t,fdNumber:l,state:s,outputFiles:o,isMaxBuffer:n,verboseInfo:i},r)),...s}},QSt=({result:t,fileDescriptors:e,fdNumber:r,state:n,outputFiles:i,isMaxBuffer:s,verboseInfo:o},{buffer:a,encoding:c,lines:l,stripFinalNewline:u,maxBuffer:d})=>{if(t===null)return;let f=Vbe(t,s,d),p=wc(f),{stdioItems:h,objectMode:m}=e[r],_=eEt([p],h,c,n),{serializedResult:y,finalResult:v=y}=tEt({chunks:_,objectMode:m,encoding:c,lines:l,stripFinalNewline:u,fdNumber:r});rEt({serializedResult:y,fdNumber:r,state:n,verboseInfo:o,encoding:c,stdioItems:h,objectMode:m});let S=a[r]?v:void 0;try{return n.error===void 0&&nEt(y,h,i),S}catch(g){return n.error=g,S}},eEt=(t,e,r,n)=>{try{return OC(t,e,r,!1)}catch(i){return n.error=i,t}},tEt=({chunks:t,objectMode:e,encoding:r,lines:n,stripFinalNewline:i,fdNumber:s})=>{if(e)return{serializedResult:t};if(r==="buffer")return{serializedResult:qb(t)};let o=iEe(t,r);return n[s]?{serializedResult:o,finalResult:C3(o,!i[s],e)}:{serializedResult:o}},rEt=({serializedResult:t,fdNumber:e,state:r,verboseInfo:n,encoding:i,stdioItems:s,objectMode:o})=>{if(!PC({stdioItems:s,encoding:i,verboseInfo:n,fdNumber:e}))return;let a=C3(t,!1,o);try{qTe(a,e,n)}catch(c){r.error??=c}},nEt=(t,e,r)=>{for(let{path:n,append:i}of e.filter(({type:s})=>wC.has(s))){let s=typeof n=="string"?n:n.toString();i||r.has(s)?XSt(n,t):(r.add(s),ZSt(n,t))}};var VTe=([,t,e],r)=>{if(r.all)return t===void 0?e:e===void 0?t:Array.isArray(t)?Array.isArray(e)?[...t,...e]:[...t,xc(e,r,"all")]:Array.isArray(e)?[xc(t,r,"all"),...e]:kr(t)&&kr(e)?j6([t,e]):`${t}${e}`};import{once as L3}from"events";var HTe=async(t,e)=>{let[r,n]=await iEt(t);return e.isForcefullyTerminated??=!1,[r,n]},iEt=async t=>{let[e,r]=await Promise.allSettled([L3(t,"spawn"),L3(t,"exit")]);return e.status==="rejected"?[]:r.status==="rejected"?GTe(t):r.value},GTe=async t=>{try{return await L3(t,"exit")}catch{return GTe(t)}},WTe=async t=>{let[e,r]=await t;if(!sEt(e,r)&&D3(e,r))throw new no;return[e,r]},sEt=(t,e)=>t===void 0&&e===void 0,D3=(t,e)=>t!==0||e!==null;var YTe=({error:t,status:e,signal:r,output:n},{maxBuffer:i})=>{let s=oEt(t,e,r),o=s?.code==="ETIMEDOUT",a=zbe(s,n,i);return{resultError:s,exitCode:e,signal:r,timedOut:o,isMaxBuffer:a}},oEt=(t,e,r)=>t!==void 0?t:D3(e,r)?new no:void 0;var KTe=(t,e,r)=>{let{file:n,commandArguments:i,command:s,escapedCommand:o,startTime:a,verboseInfo:c,options:l,fileDescriptors:u}=cEt(t,e,r),d=dEt({file:n,commandArguments:i,options:l,command:s,escapedCommand:o,verboseInfo:c,fileDescriptors:u,startTime:a});return Wg(d,c,l)},cEt=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:s,verboseInfo:o}=GP(t,e,r),a=lEt(r),{file:c,commandArguments:l,options:u}=fC(t,e,a);uEt(u);let d=ATe(u,o);return{file:c,commandArguments:l,command:n,escapedCommand:i,startTime:s,verboseInfo:o,options:u,fileDescriptors:d}},lEt=t=>t.node&&!t.ipc?{...t,ipc:!1}:t,uEt=({ipc:t,ipcInput:e,detached:r,cancelSignal:n})=>{e&&CC("ipcInput"),t&&CC("ipc: true"),r&&CC("detached: true"),n&&CC("cancelSignal")},CC=t=>{throw new TypeError(`The "${t}" option cannot be used with synchronous methods.`)},dEt=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,verboseInfo:s,fileDescriptors:o,startTime:a})=>{let c=fEt({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,fileDescriptors:o,startTime:a});if(c.failed)return c;let{resultError:l,exitCode:u,signal:d,timedOut:f,isMaxBuffer:p}=YTe(c,r),{output:h,error:m=l}=zTe({fileDescriptors:o,syncResult:c,options:r,isMaxBuffer:p,verboseInfo:s}),_=h.map((v,S)=>xc(v,r,S)),y=xc(VTe(h,r),r,"all");return hEt({error:m,exitCode:u,signal:d,timedOut:f,isMaxBuffer:p,stdio:_,all:y,options:r,command:n,escapedCommand:i,startTime:a})},fEt=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,fileDescriptors:s,startTime:o})=>{try{FTe(s,r);let a=pEt(r);return aEt(...pC(t,e,a))}catch(a){return Gg({error:a,command:n,escapedCommand:i,fileDescriptors:s,options:r,startTime:o,isSync:!0})}},pEt=({encoding:t,maxBuffer:e,...r})=>({...r,encoding:"buffer",maxBuffer:EC(e)}),hEt=({error:t,exitCode:e,signal:r,timedOut:n,isMaxBuffer:i,stdio:s,all:o,options:a,command:c,escapedCommand:l,startTime:u})=>t===void 0?vC({command:c,escapedCommand:l,stdio:s,all:o,ipcOutput:[],options:a,startTime:u}):Jb({error:t,command:c,escapedCommand:l,timedOut:n,isCanceled:!1,isGracefullyCanceled:!1,isMaxBuffer:i,isForcefullyTerminated:!1,exitCode:e,signal:r,stdio:s,all:o,ipcOutput:[],options:a,startTime:u,isSync:!0});import{setMaxListeners as tbt}from"events";import{spawn as rbt}from"child_process";import ewe from"process";import{once as M3,on as mEt}from"events";var JTe=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0,filter:s}={})=>(jg({methodName:"getOneMessage",isSubprocess:r,ipc:n,isConnected:oC(t)}),gEt({anyProcess:t,channel:e,isSubprocess:r,filter:s,reference:i})),gEt=async({anyProcess:t,channel:e,isSubprocess:r,filter:n,reference:i})=>{rC(e,i);let s=Au(t,e,r),o=new AbortController;try{return await Promise.race([_Et(s,n,o),yEt(s,r,o),SEt(s,r,o)])}catch(a){throw qg(t),a}finally{o.abort(),nC(e,i)}},_Et=async(t,e,{signal:r})=>{if(e===void 0){let[n]=await M3(t,"message",{signal:r});return n}for await(let[n]of mEt(t,"message",{signal:r}))if(e(n))return n},yEt=async(t,e,{signal:r})=>{await M3(t,"disconnect",{signal:r}),Dve(e)},SEt=async(t,e,{signal:r})=>{let[n]=await M3(t,"strict:error",{signal:r});throw QP(n,e)};import{once as XTe,on as EEt}from"events";var QTe=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0}={})=>U3({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:!r,reference:i}),U3=({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:i,reference:s})=>{jg({methodName:"getEachMessage",isSubprocess:r,ipc:n,isConnected:oC(t)}),rC(e,s);let o=Au(t,e,r),a=new AbortController,c={};return vEt(t,o,a),bEt({ipcEmitter:o,isSubprocess:r,controller:a,state:c}),TEt({anyProcess:t,channel:e,ipcEmitter:o,isSubprocess:r,shouldAwait:i,controller:a,state:c,reference:s})},vEt=async(t,e,r)=>{try{await XTe(e,"disconnect",{signal:r.signal}),r.abort()}catch{}},bEt=async({ipcEmitter:t,isSubprocess:e,controller:r,state:n})=>{try{let[i]=await XTe(t,"strict:error",{signal:r.signal});n.error=QP(i,e),r.abort()}catch{}},TEt=async function*({anyProcess:t,channel:e,ipcEmitter:r,isSubprocess:n,shouldAwait:i,controller:s,state:o,reference:a}){try{for await(let[c]of EEt(r,"message",{signal:s.signal}))ZTe(o),yield c}catch{ZTe(o)}finally{s.abort(),nC(e,a),n||qg(t),i&&await t}},ZTe=({error:t})=>{if(t)throw t};var twe=(t,{ipc:e})=>{Object.assign(t,nwe(t,!1,e))},rwe=()=>{let t=ewe,e=!0,r=ewe.channel!==void 0;return{...nwe(t,e,r),getCancelSignal:lbe.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})}},nwe=(t,e,r)=>({sendMessage:uC.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getOneMessage:JTe.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getEachMessage:QTe.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})});import{ChildProcess as wEt}from"child_process";import{PassThrough as AEt,Readable as REt,Writable as xEt,Duplex as IEt}from"stream";var iwe=({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:s,verboseInfo:o})=>{I3(n);let a=new wEt;OEt(a,n),Object.assign(a,{readable:PEt,writable:CEt,duplex:NEt});let c=Gg({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:s,isSync:!1}),l=kEt(c,o,i);return{subprocess:a,promise:l}},OEt=(t,e)=>{let r=Xb(),n=Xb(),i=Xb(),s=Array.from({length:e.length-3},Xb),o=Xb(),a=[r,n,i,...s];Object.assign(t,{stdin:r,stdout:n,stderr:i,all:o,stdio:a})},Xb=()=>{let t=new AEt;return t.end(),t},PEt=()=>new REt({read(){}}),CEt=()=>new xEt({write(){}}),NEt=()=>new IEt({read(){},write(){}}),kEt=async(t,e,r)=>Wg(t,e,r);import{createReadStream as swe,createWriteStream as owe}from"fs";import{Buffer as $Et}from"buffer";import{Readable as Qb,Writable as LEt,Duplex as DEt}from"stream";var cwe=(t,e)=>AC(MEt,t,e,!1),eT=({type:t,optionName:e})=>{throw new TypeError(`The \`${e}\` option cannot be ${Ru[t]}.`)},awe={fileNumber:eT,generator:$3,asyncGenerator:$3,nodeStream:({value:t})=>({stream:t}),webTransform({value:{transform:t,writableObjectMode:e,readableObjectMode:r}}){let n=e||r;return{stream:DEt.fromWeb(t,{objectMode:n})}},duplex:({value:{transform:t}})=>({stream:t}),native(){}},MEt={input:{...awe,fileUrl:({value:t})=>({stream:swe(t)}),filePath:({value:{file:t}})=>({stream:swe(t)}),webStream:({value:t})=>({stream:Qb.fromWeb(t)}),iterable:({value:t})=>({stream:Qb.from(t)}),asyncIterable:({value:t})=>({stream:Qb.from(t)}),string:({value:t})=>({stream:Qb.from(t)}),uint8Array:({value:t})=>({stream:Qb.from($Et.from(t))})},output:{...awe,fileUrl:({value:t})=>({stream:owe(t)}),filePath:({value:{file:t,append:e}})=>({stream:owe(t,e?{flags:"a"}:{})}),webStream:({value:t})=>({stream:LEt.fromWeb(t)}),iterable:eT,asyncIterable:eT,string:eT,uint8Array:eT}};import{on as UEt,once as lwe}from"events";import{PassThrough as FEt,getDefaultHighWaterMark as jEt}from"stream";import{finished as fwe}from"stream/promises";function Gf(t){if(!Array.isArray(t))throw new TypeError(`Expected an array, got \`${typeof t}\`.`);for(let i of t)j3(i);let e=t.some(({readableObjectMode:i})=>i),r=qEt(t,e),n=new F3({objectMode:e,writableHighWaterMark:r,readableHighWaterMark:r});for(let i of t)n.add(i);return n}var qEt=(t,e)=>{if(t.length===0)return jEt(e);let r=t.filter(({readableObjectMode:n})=>n===e).map(({readableHighWaterMark:n})=>n);return Math.max(...r)},F3=class extends FEt{#e=new Set([]);#r=new Set([]);#t=new Set([]);#n;#s=Symbol("unpipe");#i=new WeakMap;add(e){if(j3(e),this.#e.has(e))return;this.#e.add(e),this.#n??=BEt(this,this.#e,this.#s);let r=HEt({passThroughStream:this,stream:e,streams:this.#e,ended:this.#r,aborted:this.#t,onFinished:this.#n,unpipeEvent:this.#s});this.#i.set(e,r),e.pipe(this,{end:!1})}async remove(e){if(j3(e),!this.#e.has(e))return!1;let r=this.#i.get(e);return r===void 0?!1:(this.#i.delete(e),e.unpipe(this),await r,!0)}},BEt=async(t,e,r)=>{NC(t,uwe);let n=new AbortController;try{await Promise.race([zEt(t,n),VEt(t,e,r,n)])}finally{n.abort(),NC(t,-uwe)}},zEt=async(t,{signal:e})=>{try{await fwe(t,{signal:e,cleanup:!0})}catch(r){throw pwe(t,r),r}},VEt=async(t,e,r,{signal:n})=>{for await(let[i]of UEt(t,"unpipe",{signal:n}))e.has(i)&&i.emit(r)},j3=t=>{if(typeof t?.pipe!="function")throw new TypeError(`Expected a readable stream, got: \`${typeof t}\`.`)},HEt=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,onFinished:s,unpipeEvent:o})=>{NC(t,dwe);let a=new AbortController;try{await Promise.race([GEt(s,e,a),WEt({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:a}),YEt({stream:e,streams:r,ended:n,aborted:i,unpipeEvent:o,controller:a})])}finally{a.abort(),NC(t,-dwe)}r.size>0&&r.size===n.size+i.size&&(n.size===0&&i.size>0?q3(t):KEt(t))},GEt=async(t,e,{signal:r})=>{try{await t,r.aborted||q3(e)}catch(n){r.aborted||pwe(e,n)}},WEt=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:{signal:s}})=>{try{await fwe(e,{signal:s,cleanup:!0,readable:!0,writable:!1}),r.has(e)&&n.add(e)}catch(o){if(s.aborted||!r.has(e))return;hwe(o)?i.add(e):mwe(t,o)}},YEt=async({stream:t,streams:e,ended:r,aborted:n,unpipeEvent:i,controller:{signal:s}})=>{if(await lwe(t,i,{signal:s}),!t.readable)return lwe(s,"abort",{signal:s});e.delete(t),r.delete(t),n.delete(t)},KEt=t=>{t.writable&&t.end()},pwe=(t,e)=>{hwe(e)?q3(t):mwe(t,e)},hwe=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",q3=t=>{(t.readable||t.writable)&&t.destroy()},mwe=(t,e)=>{t.destroyed||(t.once("error",JEt),t.destroy(e))},JEt=()=>{},NC=(t,e)=>{let r=t.getMaxListeners();r!==0&&r!==Number.POSITIVE_INFINITY&&t.setMaxListeners(r+e)},uwe=2,dwe=1;import{finished as gwe}from"stream/promises";var Kg=(t,e)=>{t.pipe(e),ZEt(t,e),XEt(t,e)},ZEt=async(t,e)=>{if(!(ro(t)||ro(e))){try{await gwe(t,{cleanup:!0,readable:!0,writable:!1})}catch{}B3(e)}},B3=t=>{t.writable&&t.end()},XEt=async(t,e)=>{if(!(ro(t)||ro(e))){try{await gwe(e,{cleanup:!0,readable:!1,writable:!0})}catch{}z3(t)}},z3=t=>{t.readable&&t.destroy()};var _we=(t,e,r)=>{let n=new Map;for(let[i,{stdioItems:s,direction:o}]of Object.entries(e)){for(let{stream:a}of s.filter(({type:c})=>Ts.has(c)))QEt(t,a,o,i);for(let{stream:a}of s.filter(({type:c})=>!Ts.has(c)))tvt({subprocess:t,stream:a,direction:o,fdNumber:i,pipeGroups:n,controller:r})}for(let[i,s]of n.entries()){let o=s.length===1?s[0]:Gf(s);Kg(o,i)}},QEt=(t,e,r,n)=>{r==="output"?Kg(t.stdio[n],e):Kg(e,t.stdio[n]);let i=evt[n];i!==void 0&&(t[i]=e),t.stdio[n]=e},evt=["stdin","stdout","stderr"],tvt=({subprocess:t,stream:e,direction:r,fdNumber:n,pipeGroups:i,controller:s})=>{if(e===void 0)return;rvt(e,s);let[o,a]=r==="output"?[e,t.stdio[n]]:[t.stdio[n],e],c=i.get(o)??[];i.set(o,[...c,a])},rvt=(t,{signal:e})=>{ro(t)&&Bf(t,nvt,e)},nvt=2;import{addAbortListener as ovt}from"events";var Wf=[];Wf.push("SIGHUP","SIGINT","SIGTERM");process.platform!=="win32"&&Wf.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&Wf.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT");var kC=t=>!!t&&typeof t=="object"&&typeof t.removeListener=="function"&&typeof t.emit=="function"&&typeof t.reallyExit=="function"&&typeof t.listeners=="function"&&typeof t.kill=="function"&&typeof t.pid=="number"&&typeof t.on=="function",V3=Symbol.for("signal-exit emitter"),H3=globalThis,ivt=Object.defineProperty.bind(Object),G3=class{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(H3[V3])return H3[V3];ivt(H3,V3,{value:this,writable:!1,enumerable:!1,configurable:!1})}on(e,r){this.listeners[e].push(r)}removeListener(e,r){let n=this.listeners[e],i=n.indexOf(r);i!==-1&&(i===0&&n.length===1?n.length=0:n.splice(i,1))}emit(e,r,n){if(this.emitted[e])return!1;this.emitted[e]=!0;let i=!1;for(let s of this.listeners[e])i=s(r,n)===!0||i;return e==="exit"&&(i=this.emit("afterExit",r,n)||i),i}},$C=class{},svt=t=>({onExit(e,r){return t.onExit(e,r)},load(){return t.load()},unload(){return t.unload()}}),W3=class extends $C{onExit(){return()=>{}}load(){}unload(){}},Y3=class extends $C{#e=K3.platform==="win32"?"SIGINT":"SIGHUP";#r=new G3;#t;#n;#s;#i={};#o=!1;constructor(e){super(),this.#t=e,this.#i={};for(let r of Wf)this.#i[r]=()=>{let n=this.#t.listeners(r),{count:i}=this.#r,s=e;if(typeof s.__signal_exit_emitter__=="object"&&typeof s.__signal_exit_emitter__.count=="number"&&(i+=s.__signal_exit_emitter__.count),n.length===i){this.unload();let o=this.#r.emit("exit",null,r),a=r==="SIGHUP"?this.#e:r;o||e.kill(e.pid,a)}};this.#s=e.reallyExit,this.#n=e.emit}onExit(e,r){if(!kC(this.#t))return()=>{};this.#o===!1&&this.load();let n=r?.alwaysLast?"afterExit":"exit";return this.#r.on(n,e),()=>{this.#r.removeListener(n,e),this.#r.listeners.exit.length===0&&this.#r.listeners.afterExit.length===0&&this.unload()}}load(){if(!this.#o){this.#o=!0,this.#r.count+=1;for(let e of Wf)try{let r=this.#i[e];r&&this.#t.on(e,r)}catch{}this.#t.emit=(e,...r)=>this.#c(e,...r),this.#t.reallyExit=e=>this.#a(e)}}unload(){this.#o&&(this.#o=!1,Wf.forEach(e=>{let r=this.#i[e];if(!r)throw new Error("Listener not defined for signal: "+e);try{this.#t.removeListener(e,r)}catch{}}),this.#t.emit=this.#n,this.#t.reallyExit=this.#s,this.#r.count-=1)}#a(e){return kC(this.#t)?(this.#t.exitCode=e||0,this.#r.emit("exit",this.#t.exitCode,null),this.#s.call(this.#t,this.#t.exitCode)):0}#c(e,...r){let n=this.#n;if(e==="exit"&&kC(this.#t)){typeof r[0]=="number"&&(this.#t.exitCode=r[0]);let i=n.call(this.#t,e,...r);return this.#r.emit("exit",this.#t.exitCode,null),i}else return n.call(this.#t,e,...r)}},K3=globalThis.process,{onExit:ywe,load:pur,unload:hur}=svt(kC(K3)?new Y3(K3):new W3);var Swe=(t,{cleanup:e,detached:r},{signal:n})=>{if(!e||r)return;let i=ywe(()=>{t.kill()});ovt(n,()=>{i()})};var vwe=({source:t,sourcePromise:e,boundOptions:r,createNested:n},...i)=>{let s=HP(),{destination:o,destinationStream:a,destinationError:c,from:l,unpipeSignal:u}=avt(r,n,i),{sourceStream:d,sourceError:f}=lvt(t,l),{options:p,fileDescriptors:h}=sa.get(t);return{sourcePromise:e,sourceStream:d,sourceOptions:p,sourceError:f,destination:o,destinationStream:a,destinationError:c,unpipeSignal:u,fileDescriptors:h,startTime:s}},avt=(t,e,r)=>{try{let{destination:n,pipeOptions:{from:i,to:s,unpipeSignal:o}={}}=cvt(t,e,...r),a=tC(n,s);return{destination:n,destinationStream:a,from:i,unpipeSignal:o}}catch(n){return{destinationError:n}}},cvt=(t,e,r,...n)=>{if(Array.isArray(r))return{destination:e(Ewe,t)(r,...n),pipeOptions:t};if(typeof r=="string"||r instanceof URL||U6(r)){if(Object.keys(t).length>0)throw new TypeError('Please use .pipe("file", ..., options) or .pipe(execa("file", ..., options)) instead of .pipe(options)("file", ...).');let[i,s,o]=LP(r,...n);return{destination:e(Ewe)(i,s,o),pipeOptions:o}}if(sa.has(r)){if(Object.keys(t).length>0)throw new TypeError("Please use .pipe(options)`command` or .pipe($(options)`command`) instead of .pipe(options)($`command`).");return{destination:r,pipeOptions:n[0]}}throw new TypeError(`The first argument must be a template string, an options object, or an Execa subprocess: ${r}`)},Ewe=({options:t})=>({options:{...t,stdin:"pipe",piped:!0}}),lvt=(t,e)=>{try{return{sourceStream:Bg(t,e)}}catch(r){return{sourceError:r}}};var Twe=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n,fileDescriptors:i,sourceOptions:s,startTime:o})=>{let a=uvt({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n});if(a!==void 0)throw J3({error:a,fileDescriptors:i,sourceOptions:s,startTime:o})},uvt=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n})=>{if(e!==void 0&&n!==void 0)return n;if(n!==void 0)return z3(t),n;if(e!==void 0)return B3(r),e},J3=({error:t,fileDescriptors:e,sourceOptions:r,startTime:n})=>Gg({error:t,command:bwe,escapedCommand:bwe,fileDescriptors:e,options:r,startTime:n,isSync:!1}),bwe="source.pipe(destination)";var wwe=async t=>{let[{status:e,reason:r,value:n=r},{status:i,reason:s,value:o=s}]=await t;if(o.pipedFrom.includes(n)||o.pipedFrom.push(n),i==="rejected")throw o;if(e==="rejected")throw n;return o};import{finished as dvt}from"stream/promises";var Awe=(t,e,r)=>{let n=LC.has(e)?pvt(t,e):fvt(t,e);return Bf(t,mvt,r.signal),Bf(e,gvt,r.signal),hvt(e),n},fvt=(t,e)=>{let r=Gf([t]);return Kg(r,e),LC.set(e,r),r},pvt=(t,e)=>{let r=LC.get(e);return r.add(t),r},hvt=async t=>{try{await dvt(t,{cleanup:!0,readable:!1,writable:!0})}catch{}LC.delete(t)},LC=new WeakMap,mvt=2,gvt=1;import{aborted as _vt}from"util";var Rwe=(t,e)=>t===void 0?[]:[yvt(t,e)],yvt=async(t,{sourceStream:e,mergedStream:r,fileDescriptors:n,sourceOptions:i,startTime:s})=>{await _vt(t,e),await r.remove(e);let o=new Error("Pipe canceled by `unpipeSignal` option.");throw J3({error:o,fileDescriptors:n,sourceOptions:i,startTime:s})};var DC=(t,...e)=>{if(Sr(e[0]))return DC.bind(void 0,{...t,boundOptions:{...t.boundOptions,...e[0]}});let{destination:r,...n}=vwe(t,...e),i=Svt({...n,destination:r});return i.pipe=DC.bind(void 0,{...t,source:r,sourcePromise:i,boundOptions:{}}),i},Svt=async({sourcePromise:t,sourceStream:e,sourceOptions:r,sourceError:n,destination:i,destinationStream:s,destinationError:o,unpipeSignal:a,fileDescriptors:c,startTime:l})=>{let u=Evt(t,i);Twe({sourceStream:e,sourceError:n,destinationStream:s,destinationError:o,fileDescriptors:c,sourceOptions:r,startTime:l});let d=new AbortController;try{let f=Awe(e,s,d);return await Promise.race([wwe(u),...Rwe(a,{sourceStream:e,mergedStream:f,sourceOptions:r,fileDescriptors:c,startTime:l})])}finally{d.abort()}},Evt=(t,e)=>Promise.allSettled([t,e]);import{setImmediate as xvt}from"timers/promises";import{on as vvt}from"events";import{getDefaultHighWaterMark as bvt}from"stream";var MC=({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:n,encoding:i,preserveNewlines:s})=>{let o=new AbortController;return Tvt(e,o),Iwe({stream:t,controller:o,binary:r,shouldEncode:!t.readableObjectMode&&n,encoding:i,shouldSplit:!t.readableObjectMode,preserveNewlines:s})},Tvt=async(t,e)=>{try{await t}catch{}finally{e.abort()}},Z3=({stream:t,onStreamEnd:e,lines:r,encoding:n,stripFinalNewline:i,allMixed:s})=>{let o=new AbortController;wvt(e,o,t);let a=t.readableObjectMode&&!s;return Iwe({stream:t,controller:o,binary:n==="buffer",shouldEncode:!a,encoding:n,shouldSplit:!a&&r,preserveNewlines:!i})},wvt=async(t,e,r)=>{try{await t}catch{r.destroy()}finally{e.abort()}},Iwe=({stream:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:s,preserveNewlines:o})=>{let a=vvt(t,"data",{signal:e.signal,highWaterMark:xwe,highWatermark:xwe});return Avt({onStdoutChunk:a,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:s,preserveNewlines:o})},X3=bvt(!0),xwe=X3,Avt=async function*({onStdoutChunk:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:s,preserveNewlines:o}){let a=Rvt({binary:r,shouldEncode:n,encoding:i,shouldSplit:s,preserveNewlines:o});try{for await(let[c]of t)yield*Hf(c,a,0)}catch(c){if(!e.signal.aborted)throw c}finally{yield*Zb(a)}},Rvt=({binary:t,shouldEncode:e,encoding:r,shouldSplit:n,preserveNewlines:i})=>[xC(t,r,!e),RC(t,i,!n,{})].filter(Boolean);var Owe=async({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,buffer:i,maxBuffer:s,lines:o,allMixed:a,stripFinalNewline:c,verboseInfo:l,streamInfo:u})=>{let d=Ivt({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:a,verboseInfo:l,streamInfo:u});if(!i){await Promise.all([Ovt(t),d]);return}let f=O3(c,r),p=Z3({stream:t,onStreamEnd:e,lines:o,encoding:n,stripFinalNewline:f,allMixed:a}),[h]=await Promise.all([Pvt({stream:t,iterable:p,fdNumber:r,encoding:n,maxBuffer:s,lines:o}),d]);return h},Ivt=async({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:i,verboseInfo:s,streamInfo:{fileDescriptors:o}})=>{if(!PC({stdioItems:o[r]?.stdioItems,encoding:n,verboseInfo:s,fdNumber:r}))return;let a=Z3({stream:t,onStreamEnd:e,lines:!0,encoding:n,stripFinalNewline:!0,allMixed:i});await jTe(a,t,r,s)},Ovt=async t=>{await xvt(),t.readableFlowing===null&&t.resume()},Pvt=async({stream:t,stream:{readableObjectMode:e},iterable:r,fdNumber:n,encoding:i,maxBuffer:s,lines:o})=>{try{return e||o?await _C(r,{maxBuffer:s}):i==="buffer"?new Uint8Array(await yC(r,{maxBuffer:s})):await Hg(r,{maxBuffer:s})}catch(a){return Pwe(jbe({error:a,stream:t,readableObjectMode:e,lines:o,encoding:i,fdNumber:n}))}},Q3=async t=>{try{return await t}catch(e){return Pwe(e)}},Pwe=({bufferedData:t})=>rEe(t)?new Uint8Array(t):t;import{finished as Cvt}from"stream/promises";var tT=async(t,e,r,{isSameDirection:n,stopOnExit:i=!1}={})=>{let s=Nvt(t,r),o=new AbortController;try{await Promise.race([...i?[r.exitPromise]:[],Cvt(t,{cleanup:!0,signal:o.signal})])}catch(a){s.stdinCleanedUp||Lvt(a,e,r,n)}finally{o.abort()}},Nvt=(t,{originalStreams:[e],subprocess:r})=>{let n={stdinCleanedUp:!1};return t===e&&kvt(t,r,n),n},kvt=(t,e,r)=>{let{_destroy:n}=t;t._destroy=(...i)=>{$vt(e,r),n.call(t,...i)}},$vt=({exitCode:t,signalCode:e},r)=>{(t!==null||e!==null)&&(r.stdinCleanedUp=!0)},Lvt=(t,e,r,n)=>{if(!Dvt(t,e,r,n))throw t},Dvt=(t,e,r,n=!0)=>r.propagating?Cwe(t)||UC(t):(r.propagating=!0,eW(r,e)===n?Cwe(t):UC(t)),eW=({fileDescriptors:t},e)=>e!=="all"&&t[e].direction==="input",UC=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",Cwe=t=>t?.code==="EPIPE";var Nwe=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:s,verboseInfo:o,streamInfo:a})=>t.stdio.map((c,l)=>tW({stream:c,fdNumber:l,encoding:e,buffer:r[l],maxBuffer:n[l],lines:i[l],allMixed:!1,stripFinalNewline:s,verboseInfo:o,streamInfo:a})),tW=async({stream:t,fdNumber:e,encoding:r,buffer:n,maxBuffer:i,lines:s,allMixed:o,stripFinalNewline:a,verboseInfo:c,streamInfo:l})=>{if(!t)return;let u=tT(t,e,l);if(eW(l,e)){await u;return}let[d]=await Promise.all([Owe({stream:t,onStreamEnd:u,fdNumber:e,encoding:r,buffer:n,maxBuffer:i,lines:s,allMixed:o,stripFinalNewline:a,verboseInfo:c,streamInfo:l}),u]);return d};var kwe=({stdout:t,stderr:e},{all:r})=>r&&(t||e)?Gf([t,e].filter(Boolean)):void 0,$we=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:s,verboseInfo:o,streamInfo:a})=>tW({...Mvt(t,r),fdNumber:"all",encoding:e,maxBuffer:n[1]+n[2],lines:i[1]||i[2],allMixed:Uvt(t),stripFinalNewline:s,verboseInfo:o,streamInfo:a}),Mvt=({stdout:t,stderr:e,all:r},[,n,i])=>{let s=n||i;return s?n?i?{stream:r,buffer:s}:{stream:t,buffer:s}:{stream:e,buffer:s}:{stream:r,buffer:s}},Uvt=({all:t,stdout:e,stderr:r})=>t&&e&&r&&e.readableObjectMode!==r.readableObjectMode;import{once as Fvt}from"events";var Lwe=t=>Mg(t,"ipc"),Dwe=(t,e)=>{let r=VP(t);na({type:"ipc",verboseMessage:r,fdNumber:"ipc",verboseInfo:e})};var Mwe=async({subprocess:t,buffer:e,maxBuffer:r,ipc:n,ipcOutput:i,verboseInfo:s})=>{if(!n)return i;let o=Lwe(s),a=Ac(e,"ipc"),c=Ac(r,"ipc");for await(let l of U3({anyProcess:t,channel:t.channel,isSubprocess:!1,ipc:n,shouldAwait:!1,reference:!0}))a&&(qbe(t,i,c),i.push(l)),o&&Dwe(l,s);return i},Uwe=async(t,e)=>(await Promise.allSettled([t]),e);var Fwe=async({subprocess:t,options:{encoding:e,buffer:r,maxBuffer:n,lines:i,timeoutDuration:s,cancelSignal:o,gracefulCancel:a,forceKillAfterDelay:c,stripFinalNewline:l,ipc:u,ipcInput:d},context:f,verboseInfo:p,fileDescriptors:h,originalStreams:m,onInternalError:_,controller:y})=>{let v=HTe(t,f),S={originalStreams:m,fileDescriptors:h,subprocess:t,exitPromise:v,propagating:!1},g=Nwe({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:S}),T=$we({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:S}),I=[],x=Mwe({subprocess:t,buffer:r,maxBuffer:n,ipc:u,ipcOutput:I,verboseInfo:p}),R=jvt(m,t,S),O=qvt(h,S);try{return await Promise.race([Promise.all([{},WTe(v),Promise.all(g),T,x,Sbe(t,d),...R,...O]),_,Bvt(t,y),...hbe(t,s,f,y),...Lve({subprocess:t,cancelSignal:o,gracefulCancel:a,context:f,controller:y}),...fbe({subprocess:t,cancelSignal:o,gracefulCancel:a,forceKillAfterDelay:c,context:f,controller:y})])}catch(A){return f.terminationReason??="other",Promise.all([{error:A},v,Promise.all(g.map(b=>Q3(b))),Q3(T),Uwe(x,I),Promise.allSettled(R),Promise.allSettled(O)])}},jvt=(t,e,r)=>t.map((n,i)=>n===e.stdio[i]?void 0:tT(n,i,r)),qvt=(t,e)=>t.flatMap(({stdioItems:r},n)=>r.filter(({value:i,stream:s=i})=>so(s,{checkOpen:!1})&&!ro(s)).map(({type:i,value:s,stream:o=s})=>tT(o,n,e,{isSameDirection:Ts.has(i),stopOnExit:i==="native"}))),Bvt=async(t,{signal:e})=>{let[r]=await Fvt(t,"error",{signal:e});throw r};var jwe=()=>({readableDestroy:new WeakMap,writableFinal:new WeakMap,writableDestroy:new WeakMap}),rT=(t,e,r)=>{let n=t[r];n.has(e)||n.set(e,[]);let i=n.get(e),s=ia();return i.push(s),{resolve:s.resolve.bind(s),promises:i}},Jg=async({resolve:t,promises:e},r)=>{t();let[n]=await Promise.race([Promise.allSettled([!0,r]),Promise.all([!1,...e])]);return!n};import{Readable as zvt}from"stream";import{callbackify as Vvt}from"util";import{finished as qwe}from"stream/promises";var rW=async t=>{if(t!==void 0)try{await nW(t)}catch{}},Bwe=async t=>{if(t!==void 0)try{await iW(t)}catch{}},nW=async t=>{await qwe(t,{cleanup:!0,readable:!1,writable:!0})},iW=async t=>{await qwe(t,{cleanup:!0,readable:!0,writable:!1})},FC=async(t,e)=>{if(await t,e)throw e},jC=(t,e,r)=>{r&&!UC(r)?t.destroy(r):e&&t.destroy()};var zwe=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,binary:i=!0,preserveNewlines:s=!0}={})=>{let o=i||ji.has(r),{subprocessStdout:a,waitReadableDestroy:c}=sW(t,n,e),{readableEncoding:l,readableObjectMode:u,readableHighWaterMark:d}=oW(a,o),{read:f,onStdoutDataDone:p}=aW({subprocessStdout:a,subprocess:t,binary:o,encoding:r,preserveNewlines:s}),h=new zvt({read:f,destroy:Vvt(lW.bind(void 0,{subprocessStdout:a,subprocess:t,waitReadableDestroy:c})),highWaterMark:d,objectMode:u,encoding:l});return cW({subprocessStdout:a,onStdoutDataDone:p,readable:h,subprocess:t}),h},sW=(t,e,r)=>{let n=Bg(t,e),i=rT(r,n,"readableDestroy");return{subprocessStdout:n,waitReadableDestroy:i}},oW=({readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r},n)=>n?{readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r}:{readableEncoding:t,readableObjectMode:!0,readableHighWaterMark:X3},aW=({subprocessStdout:t,subprocess:e,binary:r,encoding:n,preserveNewlines:i})=>{let s=ia(),o=MC({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:!r,encoding:n,preserveNewlines:i});return{read(){Hvt(this,o,s)},onStdoutDataDone:s}},Hvt=async(t,e,r)=>{try{let{value:n,done:i}=await e.next();i?r.resolve():t.push(n)}catch{}},cW=async({subprocessStdout:t,onStdoutDataDone:e,readable:r,subprocess:n,subprocessStdin:i})=>{try{await iW(t),await n,await rW(i),await e,r.readable&&r.push(null)}catch(s){await rW(i),Vwe(r,s)}},lW=async({subprocessStdout:t,subprocess:e,waitReadableDestroy:r},n)=>{await Jg(r,e)&&(Vwe(t,n),await FC(e,n))},Vwe=(t,e)=>{jC(t,t.readable,e)};import{Writable as Gvt}from"stream";import{callbackify as Hwe}from"util";var Gwe=({subprocess:t,concurrentStreams:e},{to:r}={})=>{let{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:s}=uW(t,r,e),o=new Gvt({...dW(n,t,i),destroy:Hwe(pW.bind(void 0,{subprocessStdin:n,subprocess:t,waitWritableFinal:i,waitWritableDestroy:s})),highWaterMark:n.writableHighWaterMark,objectMode:n.writableObjectMode});return fW(n,o),o},uW=(t,e,r)=>{let n=tC(t,e),i=rT(r,n,"writableFinal"),s=rT(r,n,"writableDestroy");return{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:s}},dW=(t,e,r)=>({write:Wvt.bind(void 0,t),final:Hwe(Yvt.bind(void 0,t,e,r))}),Wvt=(t,e,r,n)=>{t.write(e,r)?n():t.once("drain",n)},Yvt=async(t,e,r)=>{await Jg(r,e)&&(t.writable&&t.end(),await e)},fW=async(t,e,r)=>{try{await nW(t),e.writable&&e.end()}catch(n){await Bwe(r),Wwe(e,n)}},pW=async({subprocessStdin:t,subprocess:e,waitWritableFinal:r,waitWritableDestroy:n},i)=>{await Jg(r,e),await Jg(n,e)&&(Wwe(t,i),await FC(e,i))},Wwe=(t,e)=>{jC(t,t.writable,e)};import{Duplex as Kvt}from"stream";import{callbackify as Jvt}from"util";var Ywe=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,to:i,binary:s=!0,preserveNewlines:o=!0}={})=>{let a=s||ji.has(r),{subprocessStdout:c,waitReadableDestroy:l}=sW(t,n,e),{subprocessStdin:u,waitWritableFinal:d,waitWritableDestroy:f}=uW(t,i,e),{readableEncoding:p,readableObjectMode:h,readableHighWaterMark:m}=oW(c,a),{read:_,onStdoutDataDone:y}=aW({subprocessStdout:c,subprocess:t,binary:a,encoding:r,preserveNewlines:o}),v=new Kvt({read:_,...dW(u,t,d),destroy:Jvt(Zvt.bind(void 0,{subprocessStdout:c,subprocessStdin:u,subprocess:t,waitReadableDestroy:l,waitWritableFinal:d,waitWritableDestroy:f})),readableHighWaterMark:m,writableHighWaterMark:u.writableHighWaterMark,readableObjectMode:h,writableObjectMode:u.writableObjectMode,encoding:p});return cW({subprocessStdout:c,onStdoutDataDone:y,readable:v,subprocess:t,subprocessStdin:u}),fW(u,v,c),v},Zvt=async({subprocessStdout:t,subprocessStdin:e,subprocess:r,waitReadableDestroy:n,waitWritableFinal:i,waitWritableDestroy:s},o)=>{await Promise.all([lW({subprocessStdout:t,subprocess:r,waitReadableDestroy:n},o),pW({subprocessStdin:e,subprocess:r,waitWritableFinal:i,waitWritableDestroy:s},o)])};var hW=(t,e,{from:r,binary:n=!1,preserveNewlines:i=!1}={})=>{let s=n||ji.has(e),o=Bg(t,r),a=MC({subprocessStdout:o,subprocess:t,binary:s,shouldEncode:!0,encoding:e,preserveNewlines:i});return Xvt(a,o,t)},Xvt=async function*(t,e,r){try{yield*t}finally{e.readable&&e.destroy(),await r}};var Kwe=(t,{encoding:e})=>{let r=jwe();t.readable=zwe.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.writable=Gwe.bind(void 0,{subprocess:t,concurrentStreams:r}),t.duplex=Ywe.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.iterable=hW.bind(void 0,t,e),t[Symbol.asyncIterator]=hW.bind(void 0,t,e,{})};var Jwe=(t,e)=>{for(let[r,n]of ebt){let i=n.value.bind(e);Reflect.defineProperty(t,r,{...n,value:i})}},Qvt=(async()=>{})().constructor.prototype,ebt=["then","catch","finally"].map(t=>[t,Reflect.getOwnPropertyDescriptor(Qvt,t)]);var Zwe=(t,e,r,n)=>{let{file:i,commandArguments:s,command:o,escapedCommand:a,startTime:c,verboseInfo:l,options:u,fileDescriptors:d}=nbt(t,e,r),{subprocess:f,promise:p}=sbt({file:i,commandArguments:s,options:u,startTime:c,verboseInfo:l,command:o,escapedCommand:a,fileDescriptors:d});return f.pipe=DC.bind(void 0,{source:f,sourcePromise:p,boundOptions:{},createNested:n}),Jwe(f,p),sa.set(f,{options:u,fileDescriptors:d}),f},nbt=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:s,verboseInfo:o}=GP(t,e,r),{file:a,commandArguments:c,options:l}=fC(t,e,r),u=ibt(l),d=cwe(u,o);return{file:a,commandArguments:c,command:n,escapedCommand:i,startTime:s,verboseInfo:o,options:u,fileDescriptors:d}},ibt=({timeout:t,signal:e,...r})=>{if(e!==void 0)throw new TypeError('The "signal" option has been renamed to "cancelSignal" instead.');return{...r,timeoutDuration:t}},sbt=({file:t,commandArguments:e,options:r,startTime:n,verboseInfo:i,command:s,escapedCommand:o,fileDescriptors:a})=>{let c;try{c=rbt(...pC(t,e,r))}catch(h){return iwe({error:h,command:s,escapedCommand:o,fileDescriptors:a,options:r,startTime:n,verboseInfo:i})}let l=new AbortController;tbt(Number.POSITIVE_INFINITY,l.signal);let u=[...c.stdio];_we(c,a,l),Swe(c,r,l);let d={},f=ia();c.kill=kve.bind(void 0,{kill:c.kill.bind(c),options:r,onInternalError:f,context:d,controller:l}),c.all=kwe(c,r),Kwe(c,r),twe(c,r);let p=obt({subprocess:c,options:r,startTime:n,verboseInfo:i,fileDescriptors:a,originalStreams:u,command:s,escapedCommand:o,context:d,onInternalError:f,controller:l});return{subprocess:c,promise:p}},obt=async({subprocess:t,options:e,startTime:r,verboseInfo:n,fileDescriptors:i,originalStreams:s,command:o,escapedCommand:a,context:c,onInternalError:l,controller:u})=>{let[d,[f,p],h,m,_]=await Fwe({subprocess:t,options:e,context:c,verboseInfo:n,fileDescriptors:i,originalStreams:s,onInternalError:l,controller:u});u.abort(),l.resolve();let y=h.map((g,T)=>xc(g,e,T)),v=xc(m,e,"all"),S=abt({errorInfo:d,exitCode:f,signal:p,stdio:y,all:v,ipcOutput:_,context:c,options:e,command:o,escapedCommand:a,startTime:r});return Wg(S,n,e)},abt=({errorInfo:t,exitCode:e,signal:r,stdio:n,all:i,ipcOutput:s,context:o,options:a,command:c,escapedCommand:l,startTime:u})=>"error"in t?Jb({error:t.error,command:c,escapedCommand:l,timedOut:o.terminationReason==="timeout",isCanceled:o.terminationReason==="cancel"||o.terminationReason==="gracefulCancel",isGracefullyCanceled:o.terminationReason==="gracefulCancel",isMaxBuffer:t.error instanceof oa,isForcefullyTerminated:o.isForcefullyTerminated,exitCode:e,signal:r,stdio:n,all:i,ipcOutput:s,options:a,startTime:u,isSync:!1}):vC({command:c,escapedCommand:l,stdio:n,all:i,ipcOutput:s,options:a,startTime:u});var qC=(t,e)=>{let r=Object.fromEntries(Object.entries(e).map(([n,i])=>[n,cbt(n,t[n],i)]));return{...t,...r}},cbt=(t,e,r)=>lbt.has(t)&&Sr(e)&&Sr(r)?{...e,...r}:r,lbt=new Set(["env",...V6]);var xu=(t,e,r,n)=>{let i=(o,a,c)=>xu(o,a,r,c),s=(...o)=>ubt({mapArguments:t,deepOptions:r,boundOptions:e,setBoundExeca:n,createNested:i},...o);return n!==void 0&&n(s,i,e),s},ubt=({mapArguments:t,deepOptions:e={},boundOptions:r={},setBoundExeca:n,createNested:i},s,...o)=>{if(Sr(s))return i(t,qC(r,s),n);let{file:a,commandArguments:c,options:l,isSync:u}=dbt({mapArguments:t,firstArgument:s,nextArguments:o,deepOptions:e,boundOptions:r});return u?KTe(a,c,l):Zwe(a,c,l,i)},dbt=({mapArguments:t,firstArgument:e,nextArguments:r,deepOptions:n,boundOptions:i})=>{let s=cEe(e)?lEe(e,r):[e,...r],[o,a,c]=LP(...s),l=qC(qC(n,i),c),{file:u=o,commandArguments:d=a,options:f=l,isSync:p=!1}=t({file:o,commandArguments:a,options:l});return{file:u,commandArguments:d,options:f,isSync:p}};var Xwe=({file:t,commandArguments:e})=>e0e(t,e),Qwe=({file:t,commandArguments:e})=>({...e0e(t,e),isSync:!0}),e0e=(t,e)=>{if(e.length>0)throw new TypeError(`The command and its arguments must be passed as a single string: ${t} ${e}.`);let[r,...n]=fbt(t);return{file:r,commandArguments:n}},fbt=t=>{if(typeof t!="string")throw new TypeError(`The command must be a string: ${String(t)}.`);let e=t.trim();if(e==="")return[];let r=[];for(let n of e.split(pbt)){let i=r.at(-1);i&&i.endsWith("\\")?r[r.length-1]=`${i.slice(0,-1)} ${n}`:r.push(n)}return r},pbt=/ +/g;var t0e=(t,e,r)=>{t.sync=e(hbt,r),t.s=t.sync},r0e=({options:t})=>n0e(t),hbt=({options:t})=>({...n0e(t),isSync:!0}),n0e=t=>({options:{...mbt(t),...t}}),mbt=({input:t,inputFile:e,stdio:r})=>t===void 0&&e===void 0&&r===void 0?{stdin:"inherit"}:{},i0e={preferLocal:!0};var s0e=xu(()=>({})),npr=xu(()=>({isSync:!0})),o0e=xu(Xwe),ipr=xu(Qwe),spr=xu(gbe),opr=xu(r0e,{},i0e,t0e),{sendMessage:apr,getOneMessage:cpr,getEachMessage:lpr,getCancelSignal:upr}=rwe();import{Transform as gbt}from"stream";var _bt=["NETLIFY_AI_GATEWAY_KEY"];function ybt(){let t=(process.env.NETLIFY_SENSITIVE_ENV_KEYS||"").split(",").map(e=>e.trim()).filter(Boolean);return[...new Set([...t,..._bt])]}function Sbt(t){let e=t.toLowerCase();return e==="true"||e==="false"?!0:t.trim().length<4}function Ebt(){let e=ybt().map(r=>process.env[r]).filter(r=>!(!r||Sbt(r)));return[...new Set(e)].sort((r,n)=>n.length-r.length)}function ws(t){if(typeof t!="string")return t;let e=Ebt();if(e.length===0)return t;let r=t;return e.forEach(n=>{let i=new RegExp(vbt(n),"g");r=r.replace(i,"******")}),r}function vbt(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}var nT=class extends gbt{constructor(e={}){super({...e,objectMode:!1})}_transform(e,r,n){let i=e.toString(),s=ws(i);n(null,s)}},BC=Symbol("maskedWrite");function a0e(){if(process.env.NETLIFY_MASK_LOGS!=="false"){if(!process.stdout.write[BC]){let e=process.stdout.write.bind(process.stdout),r=function(n,i,s){let o=typeof n=="string"?ws(n):n;return typeof i=="function"?e(o,i):e(o,i,s)};r[BC]=!0,process.stdout.write=r}if(!process.stderr.write[BC]){let e=process.stderr.write.bind(process.stderr),r=function(n,i,s){let o=typeof n=="string"?ws(n):n;return typeof i=="function"?e(o,i):e(o,i,s)};r[BC]=!0,process.stderr.write=r}}}var c0e=!1,l0e=()=>{c0e=!0},Si=()=>c0e;var iT=null,u0e=t=>(iT&&iT.destroy(),iT=new Ic({totalAllowedTime:t}),iT),d0e=()=>iT;var Ic=class{constructor({totalAllowedTime:e}){this.withStageTimer=async(e,r,n,{interruptible:i=!0}={})=>{if(this.isTimeExpired())throw new Error(`${e} stage did not complete in the allowed time. Time has already expired.`);if(i&&Si())throw new Error(`Aborting ${e} stage \u2014 shutting down`);let s=this.onTimesUp(()=>{throw new Error(`${e} stage did not complete in the allowed time.`)}),o=null,a=null;n!==void 0&&(a=new Promise((u,d)=>{o=setTimeout(()=>{d(new Error(`${e} stage exceeded its maximum duration of ${n}ms`))},n)}));let c=Date.now(),l="success";try{return await kP({stage:e},async()=>a?await Promise.race([r(),a]):await r())}catch(u){throw l="failure",u}finally{ge.timing("stage.duration",Date.now()-c,{stage:e,outcome:l}),s(),o&&clearTimeout(o)}};this.startTime=Date.now(),this.totalAllowedTime=e,this.globalTimeoutId=null,this.subscribers=[],this.hasTimedOut=!1,this.setupGlobalTimeout()}getElapsedTime(){return Date.now()-this.startTime}getRemainingTime(){let e=this.getElapsedTime(),r=this.totalAllowedTime-e;return Math.max(0,r)}isTimeExpired(){return this.getRemainingTime()===0||this.hasTimedOut}setupGlobalTimeout(){this.globalTimeoutId&&clearTimeout(this.globalTimeoutId),this.globalTimeoutId=setTimeout(()=>{this.notifyTimeUp()},this.totalAllowedTime)}notifyTimeUp(){this.hasTimedOut=!0;for(let e=this.subscribers.length-1;e>=0;e--)try{this.subscribers[e]()}catch(r){console.error("TimeKeeper: Error in time up callback:",r)}}onTimesUp(e){if(this.subscribers.push(e),this.hasTimedOut)try{e()}catch(r){console.error("TimeKeeper: Error in time up callback:",r)}return()=>{let r=this.subscribers.indexOf(e);r>-1&&this.subscribers.splice(r,1)}}off(e){let r=this.subscribers.indexOf(e);r>-1&&this.subscribers.splice(r,1)}clearSubscribers(){this.subscribers.length=0}getSubscriberCount(){return this.subscribers.length}destroy(){this.globalTimeoutId&&(clearTimeout(this.globalTimeoutId),this.globalTimeoutId=null),this.clearSubscribers()}static{this.timeUnits={seconds:e=>e*1e3,minutes:e=>e*60*1e3,hours:e=>e*60*60*1e3}}};var f0e={name:"@netlify/agent-runner-cli",type:"module",version:"1.159.4",description:"CLI tool for running Netlify agents",main:"./dist/index.js",types:"./dist/index.d.ts",exports:"./dist/index.js",bin:{"agent-runner-cli":"./dist/bin.js","agent-runner-cli-local":"./dist/bin-local.js"},files:["dist/**/*.js","dist/**/*.d.ts","dist/skills/**","patches","scripts"],scripts:{prebuild:"rm -rf dist",build:"tsup",dev:"tsup --watch",prepare:"husky install node_modules/@netlify/eslint-config-node/.husky/",prepublishOnly:"npm ci && npm test",prepack:"npm run build",test:"run-s build format test:dev",format:"run-s build format:check-fix:*","format:ci":"run-s build format:check:*","format:check-fix:lint":"run-e format:check:lint format:fix:lint","format:check:lint":'eslint --cache --format=codeframe --max-warnings=0 "{src,scripts,test,.github}/**/*.{js,ts,md,html}"',"format:fix:lint":'eslint --fix --cache --format=codeframe --max-warnings=0 "{src,scripts,test,.github}/**/*.{js,ts,md,html}"',"format:check-fix:prettier":"run-e format:check:prettier format:fix:prettier","format:check:prettier":'prettier --check --ignore-path .gitignore --loglevel=warn "{src,scripts,test,.github}/**/*.{js,ts,md,yml,json,html}" "*.{js,ts,yml,json,html}" ".*.{js,ts,yml,json,html}" "!**/package-lock.json" "!package-lock.json" "!src/skills/**/*.md"',"format:fix:prettier":'prettier --write --ignore-path .gitignore --loglevel=warn "{src,scripts,test,.github}/**/*.{js,ts,md,yml,json,html}" "*.{js,ts,yml,json,html}" ".*.{js,ts,yml,json,html}" "!**/package-lock.json" "!package-lock.json" "!src/skills/**/*.md"',"test:dev":"run-s build test:dev:*","test:ci":"run-s build test:ci:*","test:dev:vitest":"LOG=0 vitest --exclude '**/integration/**'","test:ci:vitest":"LOG=0 vitest run --coverage --exclude '**/integration/**'","test:smoke":"node scripts/smoke-dist.js","test:integration":"vitest run test/integration/","test:integration:codex":"vitest run test/integration/codex.test.ts","test:integration:claude":"vitest run test/integration/claude.test.ts","test:integration:gemini":"vitest run test/integration/gemini.test.ts","test:integration:skill-invocation":"vitest run test/integration/skill-invocation.test.ts","check:types":"tsc --noEmit",postinstall:"node scripts/postinstall.js"},keywords:[],license:"MIT",repository:"netlify/agent-runner-cli",bugs:{url:"https://github.com/netlify/agent-runner-cli/issues"},author:"Netlify Inc.",directories:{test:"test"},devDependencies:{"@commitlint/cli":"^20.0.0","@commitlint/config-conventional":"^20.0.0","@eslint/compat":"^2.0.0","@eslint/js":"^10.0.1","@netlify/axis":"^1.17.4","@netlify/eslint-config-node":"^7.0.1","@types/node":"^24.5.0","@typescript-eslint/eslint-plugin":"^8.0.0","@typescript-eslint/parser":"^8.0.0","@vitest/coverage-v8":"^4.1.5","@vitest/eslint-plugin":"^1.6.6",eslint:"^10.5.0","eslint-config-prettier":"^10.1.8","eslint-plugin-n":"^17.0.0",husky:"^9.0.0",jiti:"^2.7.0","patch-package":"^8.0.0",tsup:"^8.5.0",typescript:"^5.0.0","typescript-eslint":"^8.44.0",vitest:"^4.0.16"},dependencies:{"@anthropic-ai/claude-code":"^2.1.219","@anthropic-ai/sdk":"0.91.1","@google/gemini-cli":"0.42.0","@modelcontextprotocol/sdk":"^1.29.0","@netlify/cache-utils":"^6.0.5","@netlify/database-proxy":"^0.1.5","@netlify/otel":"^6.0.6","@netlify/ts-cli":"^1.2.0","@openai/codex":"0.128.0","@opentelemetry/api":"^1.9.0","@opentelemetry/exporter-trace-otlp-grpc":"0.218.0",execa:"^9.6.1",fastify:"5.8.5",minimist:"^1.2.8",openai:"6.34.0",zod:"^4.4.3"}};var Abt=Tbt(import.meta.url),Rbt=Oc.dirname(Abt),xbt=wbt(import.meta.url),Zg=ye("shell"),mW=new Set,p0e={preferLocal:!0},hn=(t,e,r)=>{let[n,i]=Ibt(e,r),s={...p0e,...i},o=s0e(t,n,s);m0e(o,s),y0e(o);let a=r?.idleTimeout;return a&&a>0&&_0e(o,a),o},h0e=(t,e)=>{let r={...p0e,...e},n=o0e(t,r);return m0e(n,r),y0e(n),e?.idleTimeout&&e.idleTimeout>0&&_0e(n,e.idleTimeout),n},Ibt=function(t,e){return Array.isArray(t)?[t,e]:typeof t=="object"&&t!==null?[[],t]:[[],void 0]},m0e=(t,e)=>{if(e.stdio!==void 0||e.stdout!==void 0||e.stderr!==void 0)return;if(Pc.env.NETLIFY_MASK_LOGS!=="false"){t.stdout?.pipe(new nT).pipe(Pc.stdout),t.stderr?.pipe(new nT).pipe(Pc.stderr);return}t.stdout?.pipe(Pc.stdout),t.stderr?.pipe(Pc.stderr)},gW=(t,e="SIGTERM")=>{try{return t.pid&&!t.killed?(Pc.kill(-t.pid,e),Zg.log(`Killed process ${t.pid} with signal ${e}`),!0):!1}catch(r){return Zg.error("Error killing process:",r),!1}},g0e=t=>gW(t,"SIGKILL"),_0e=(t,e)=>{let r=null,n=()=>{Zg.log(`Process ${t.pid} killed due to idle timeout (no output for ${e}ms)`),gW(t,"SIGTERM"),setTimeout(()=>{t.pid&&!t.killed&&(Zg.log(`Force killing idle process ${t.pid}`),g0e(t))},5e3)},i=()=>{r&&clearTimeout(r),r=setTimeout(n,e)};i(),t.stdout?.on("data",i),t.stderr?.on("data",i);let s=()=>{r&&(clearTimeout(r),r=null)};t.on("exit",s),t.on("error",s)},y0e=t=>{mW.add(t);let e=d0e();if(e){let r=e.onTimesUp(()=>{Zg.log(`Global timer expired, killing process ${t.pid}`),gW(t,"SIGTERM"),setTimeout(()=>{t.pid&&!t.killed&&(Zg.log(`Force killing process ${t.pid} after timeout`),g0e(t))},5e3)});t.on("exit",()=>{mW.delete(t),r()}),t.on("error",()=>{mW.delete(t),r()})}};function ca(t,e){if(!Pc.env.NETLIFY_LOCAL_MODE)try{let i=xbt.resolve(f0e.name),s=Oc.dirname(i);for(;s!==Oc.dirname(s);){let o=Oc.dirname(s);if(Oc.basename(o)==="node_modules"){let a=Oc.join(o,".bin",e);if(zC.existsSync(a))return a;break}s=o}}catch(i){console.error("Could not resolve package.json",i)}if(Pc.env.NODE_PATH){let i=Oc.join(Pc.env.NODE_PATH,".bin",e);if(zC.existsSync(i))return i}let r=Oc.join(t,"node_modules",".bin",e);if(zC.existsSync(r))return r;let n=Oc.join(Rbt,"..","node_modules",".bin",e);if(zC.existsSync(n))return n}import fD from"process";import{fileURLToPath as nDt}from"url";import{createRequire as iDt}from"module";import pD from"path";var Obt="__netlify__getTracer",Pbt="__netlify__shutdownTracers",mt=(t,e)=>globalThis[Obt]?.(t,e),S0e=async()=>globalThis[Pbt]?.();function Yf(t,e,r,n,i){let s=typeof n=="function"?n:typeof r=="function"?r:i;if(!s)throw new Error("function to execute with active span is missing");return t?t.withActiveSpan(e,r,n,s):s()}import{setTimeout as JLt}from"timers/promises";Ne();import Cwt from"process";Ne();var eTt=(t,e)=>{e.recordException(t),e.setStatus({code:Cn.ERROR})};var kc=class{constructor(e){this._tracer=e,this.startSpan=e.startSpan.bind(this._tracer),this.startActiveSpan=e.startActiveSpan.bind(this._tracer)}withActiveSpan(e,r,n,i){let{opts:s,ctx:o,fn:a}=fAe(r,n,i);return this._tracer.startActiveSpan(e,s,o,c=>pAe(c,s,a))}withSpan(e,r,n,i){let{opts:s,ctx:o,fn:a}=fAe(r,n,i),c=this._tracer.startSpan(e,s,o);return pAe(c,s,a)}};function fAe(t,e,r){let n,i,s;return!e&&!r?s=t:r?(n=t,i=e,s=r):(n=t,s=e),n=n??{},i=i??jt.active(),{opts:n,ctx:i,fn:s}}function pAe(t,e,r){var n;let i=(n=e.onException)!==null&&n!==void 0?n:eTt,s=o=>{throw i(o,t),t.end(),o};try{let o=r(t);return typeof o?.then=="function"?o.then(a=>(t.end(),a),s):(t.end(),o)}catch(o){throw s(o)}}Ne();var i_=t=>t!==null&&typeof t=="object"&&typeof t.then=="function";var JW=class t{_rawAttributes;_asyncAttributesPending=!1;_schemaUrl;_memoizedAttributes;static FromAttributeList(e,r){let n=new t({},r);return n._rawAttributes=TAe(e),n._asyncAttributesPending=e.filter(([i,s])=>i_(s)).length>0,n}constructor(e,r){let n=e.attributes??{};this._rawAttributes=Object.entries(n).map(([i,s])=>(i_(s)&&(this._asyncAttributesPending=!0),[i,s])),this._rawAttributes=TAe(this._rawAttributes),this._schemaUrl=tTt(r?.schemaUrl)}get asyncAttributesPending(){return this._asyncAttributesPending}async waitForAsyncAttributes(){if(this.asyncAttributesPending){for(let e=0;e<this._rawAttributes.length;e++){let[r,n]=this._rawAttributes[e];this._rawAttributes[e]=[r,i_(n)?await n:n]}this._asyncAttributesPending=!1}}get attributes(){if(this.asyncAttributesPending&&ce.error("Accessing resource attributes before async attributes settled"),this._memoizedAttributes)return this._memoizedAttributes;let e={};for(let[r,n]of this._rawAttributes){if(i_(n)){ce.debug(`Unsettled resource attribute ${r} skipped`);continue}n!=null&&(e[r]??=n)}return this._asyncAttributesPending||(this._memoizedAttributes=e),e}getRawAttributes(){return this._rawAttributes}get schemaUrl(){return this._schemaUrl}merge(e){if(e==null)return this;let r=rTt(this,e),n=r?{schemaUrl:r}:void 0;return t.FromAttributeList([...e.getRawAttributes(),...this.getRawAttributes()],n)}};function ZW(t,e){return JW.FromAttributeList(Object.entries(t),e)}function TAe(t){return t.map(([e,r])=>i_(r)?[e,r.catch(n=>{ce.debug("promise rejection for resource attribute: %s - %s",e,n)})]:[e,r])}function tTt(t){if(typeof t=="string"||t===void 0)return t;ce.warn("Schema URL must be string or undefined, got %s. Schema URL will be ignored.",t)}function rTt(t,e){let r=t?.schemaUrl,n=e?.schemaUrl,i=r===void 0||r==="",s=n===void 0||n==="";if(i)return n;if(s||r===n)return r;ce.warn('Schema URL merge conflict: old resource has "%s", updating resource has "%s". Resulting resource will have undefined Schema URL.',r,n)}Ne();var gT=class{emit(e){}enabled(){return!1}},wAe=new gT;var _T=Symbol.for("io.opentelemetry.js.api.logs"),s_=globalThis;function AAe(t,e,r){return n=>n===t?e:r}var XW=1;var QW=class{getLogger(e,r,n){return new gT}},fN=new QW;var pN=class{constructor(e,r,n,i){this._provider=e,this.name=r,this.version=n,this.options=i}emit(e){this._getLogger().emit(e)}enabled(e){return this._getLogger().enabled(e)}_getLogger(){if(this._delegate)return this._delegate;let e=this._provider._getDelegateLogger(this.name,this.version,this.options);return e?(this._delegate=e,this._delegate):wAe}};var yT=class{getLogger(e,r,n){var i;return(i=this._getDelegateLogger(e,r,n))!==null&&i!==void 0?i:new pN(this,e,r,n)}_getDelegate(){var e;return(e=this._delegate)!==null&&e!==void 0?e:fN}_setDelegate(e){this._delegate=e}_getDelegateLogger(e,r,n){var i;return(i=this._delegate)===null||i===void 0?void 0:i.getLogger(e,r,n)}};var hN=class t{constructor(){this._proxyLoggerProvider=new yT}static getInstance(){return this._instance||(this._instance=new t),this._instance}setGlobalLoggerProvider(e){return s_[_T]?this.getLoggerProvider():(s_[_T]=AAe(XW,e,fN),this._proxyLoggerProvider._setDelegate(e),e)}getLoggerProvider(){var e,r;return(r=(e=s_[_T])===null||e===void 0?void 0:e.call(s_,XW))!==null&&r!==void 0?r:this._proxyLoggerProvider}getLogger(e,r,n){return this.getLoggerProvider().getLogger(e,r,n)}disable(){delete s_[_T],this._proxyLoggerProvider=new yT}};var RAe=hN.getInstance();function xAe(t,e,r,n){for(let i=0,s=t.length;i<s;i++){let o=t[i];e&&o.setTracerProvider(e),r&&o.setMeterProvider(r),n&&o.setLoggerProvider&&o.setLoggerProvider(n),o.getConfig().enabled||o.enable()}}function IAe(t){t.forEach(e=>e.disable())}function eY(t){let e=t.tracerProvider||At.getTracerProvider(),r=t.meterProvider||mT.getMeterProvider(),n=t.loggerProvider||RAe.getLoggerProvider(),i=t.instrumentations?.flat()??[];return xAe(i,e,r,n),()=>{IAe(i)}}Ne();var nTt=zr("OpenTelemetry SDK Context Key SUPPRESS_TRACING");function OAe(t){return t.getValue(nTt)===!0}var o_;(function(t){t[t.SUCCESS=0]="SUCCESS",t[t.FAILED=1]="FAILED"})(o_||(o_={}));Ne();var tY="[_0-9a-z-*/]",iTt=`[a-z]${tY}{0,255}`,sTt=`[a-z0-9]${tY}{0,240}@[a-z]${tY}{0,13}`,oTt=new RegExp(`^(?:${iTt}|${sTt})$`),aTt=/^[ -~]{0,255}[!-~]$/,cTt=/,|=/;function rY(t){return oTt.test(t)}function nY(t){return aTt.test(t)&&!cTt.test(t)}var lTt=32,PAe=512,CAe=",",NAe="=",mN=class t{_length;_rawTraceState;_internalState;constructor(e){this._rawTraceState=typeof e=="string"?e:"",this._length=this._rawTraceState.length}set(e,r){if(!rY(e)||!nY(r))return this;let n=this._getState(),i=n.get(e),s=this._length;if(typeof i=="string"?s+=r.length-i.length:s+=e.length+r.length+(n.size>0?2:1),s>PAe)return this;let o=new Map(n);return o.delete(e),o.set(e,r),this._fromState(o,s)}unset(e){let r=this._getState(),n=r.get(e);if(typeof n!="string")return this;let i=this._length-(e.length+n.length+1);r.size>1&&(i=i-1);let s=new Map(r);return s.delete(e),this._fromState(s,i)}get(e){return this._getState().get(e)}serialize(){let e="",r=0;for(let n of this._getState())r>0&&(e=CAe+e),e=`${n[0]}${NAe}${n[1]}`+e,r++;return e}_getState(){if(this._internalState)return this._internalState;let e=this._rawTraceState.split(CAe),r=new Map,n=0;for(let i of e){let s=i.trim(),o=s.indexOf(NAe);if(o===-1)continue;let a=s.slice(0,o),c=s.slice(o+1);if(!rY(a)||!nY(c))continue;let l=n+s.length+(r.size>0?1:0);if(!(l>PAe)&&(r.set(a,c),n=l,r.size>=lTt))break}return this._length=n,this._internalState=new Map(Array.from(r.entries()).reverse()),this._internalState}_fromState(e,r){let n=Object.create(t.prototype);return n._internalState=e,n._length=r,n}};var gN="traceparent",_N="tracestate",uTt="00",dTt="(?!ff)[\\da-f]{2}",fTt="(?![0]{32})[\\da-f]{32}",pTt="(?![0]{16})[\\da-f]{16}",hTt="[\\da-f]{2}",mTt=new RegExp(`^\\s?(${dTt})-(${fTt})-(${pTt})-(${hTt})(-.*)?\\s?$`);function kAe(t){let e=mTt.exec(t);return!e||e[1]==="00"&&e[5]?null:{traceId:e[2],spanId:e[3],traceFlags:parseInt(e[4],16)}}var Pu=class{inject(e,r,n){let i=At.getSpanContext(e);if(!i||OAe(e)||!Ei(i))return;let s=`${uTt}-${i.traceId}-${i.spanId}-0${Number(i.traceFlags||pr.NONE).toString(16)}`;n.set(r,gN,s),i.traceState&&n.set(r,_N,i.traceState.serialize())}extract(e,r,n){let i=n.get(r,gN);if(!i)return e;let s=Array.isArray(i)?i[0]:i;if(typeof s!="string")return e;let o=kAe(s);if(!o)return e;o.isRemote=!0;let a=n.get(r,_N);if(a){let c=Array.isArray(a)?a.join(","):a;o.traceState=new mN(typeof c=="string"?c:void 0)}return At.setSpanContext(e,o)}fields(){return[gN,_N]}};var yN=class{_promise;_resolve;_reject;constructor(){this._promise=new Promise((e,r)=>{this._resolve=e,this._reject=r})}get promise(){return this._promise}resolve(e){this._resolve(e)}reject(e){this._reject(e)}};var ST=class{_isCalled=!1;_deferred=new yN;_callback;_that;constructor(e,r){this._callback=e,this._that=r}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(r=>this._deferred.resolve(r),r=>this._deferred.reject(r))}catch(r){this._deferred.reject(r)}}return this._deferred.promise}};var lk=jn(BY(),1);Ne();var mIe=t=>{throw TypeError(t)},GY=(t,e,r)=>e.has(t)||mIe("Cannot "+r),ck=(t,e,r)=>(GY(t,e,"read from private field"),r?r.call(t):e.get(t)),zY=(t,e,r)=>e.has(t)?mIe("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r),fIe=(t,e,r,n)=>(GY(t,e,"write to private field"),n?n.call(t,r):e.set(t,r),r),Pwt=(t,e,r)=>(GY(t,e,"access private method"),r),pIe="__netlify__getTracer",Nwt="__netlify__shutdownTracers",kwt="__nfOTLPTrace",$T,LT,HY,gIe,$wt=class{constructor(){zY(this,HY),zY(this,$T),zY(this,LT),fIe(this,$T,new ST(Pwt(this,HY,gIe),this)),fIe(this,LT,ce.createComponentLogger({namespace:"netlify-span-exporter"}))}export(t,e){if(ck(this,LT).debug(`export ${t.length.toString()} spans`),ck(this,$T).isCalled){e({code:o_.FAILED,error:new Error("Exporter has been shutdown")});return}console.log(kwt,JSON.stringify(Lwt(t))),e({code:o_.SUCCESS})}shutdown(){return ck(this,$T).call()}};$T=new WeakMap;LT=new WeakMap;HY=new WeakSet;gIe=function(){return ck(this,LT).debug("Shutting down"),Promise.resolve()};function Lwt(t){return{resourceSpans:t.map(e=>{let r=e.spanContext();return{resource:{attributes:ak(e.resource.attributes),droppedAttributesCount:e.droppedAttributesCount},scopeSpans:[{scope:{name:e.instrumentationScope.name,version:e.instrumentationScope.version},spans:[{traceId:r.traceId,spanId:r.spanId,parentSpanId:e.parentSpanContext?.spanId,name:e.name,kind:e.kind||oo.SERVER,startTimeUnixNano:VY(e.startTime),endTimeUnixNano:VY(e.endTime),attributes:ak(e.attributes),droppedAttributesCount:e.droppedAttributesCount,events:e.events.map(n=>({name:n.name,timeUnixNano:VY(n.time),attributes:ak(n.attributes??{}),droppedAttributesCount:n.droppedAttributesCount??0})),droppedEventsCount:e.droppedEventsCount,status:{code:e.status.code,message:e.status.message},links:e.links.map(n=>({spanId:n.context.spanId,traceId:n.context.traceId,attributes:ak(n.attributes??{}),droppedAttributesCount:n.droppedAttributesCount??0})),droppedLinksCount:e.droppedLinksCount}]}]}})}}function ak(t){return Object.keys(t).map(e=>_Ie(e,t[e]))}function _Ie(t,e){return{key:t,value:yIe(e)}}function yIe(t){let e=typeof t;return e==="string"?{stringValue:t}:e==="number"?Number.isInteger(t)?{intValue:t}:{doubleValue:t}:e==="boolean"?{boolValue:t}:t instanceof Uint8Array?{bytesValue:t}:Array.isArray(t)?{arrayValue:{values:t.map(yIe)}}:e==="object"&&t!=null?{kvlistValue:{values:Object.entries(t).map(([r,n])=>_Ie(r,n))}}:{}}function VY(t){let e=BigInt(1e9);return(BigInt(Math.trunc(t[0]))*e+BigInt(Math.trunc(t[1]))).toString()}var hIe={name:"@netlify/otel",version:"6.0.6",type:"module",engines:{node:"^18.14.0 || >=20.6.1"},main:"./dist/main.cjs",module:"./dist/main.js",types:"./dist/main.d.ts",exports:{".":{require:{types:"./dist/main.d.cts",default:"./dist/main.cjs"},import:{types:"./dist/main.d.ts",default:"./dist/main.js"},default:{types:"./dist/main.d.ts",default:"./dist/main.js"}},"./package.json":"./package.json","./bootstrap":{require:{types:"./dist/bootstrap/main.d.cts",default:"./dist/bootstrap/main.cjs"},import:{types:"./dist/bootstrap/main.d.ts",default:"./dist/bootstrap/main.js"},default:{types:"./dist/bootstrap/main.d.ts",default:"./dist/bootstrap/main.js"}},"./exporter-netlify":{require:{types:"./dist/exporters/netlify.d.cts",default:"./dist/exporters/netlify.cjs"},import:{types:"./dist/exporters/netlify.d.ts",default:"./dist/exporters/netlify.js"},default:{types:"./dist/exporters/netlify.d.ts",default:"./dist/exporters/netlify.js"}},"./instrumentation-fetch":{require:{types:"./dist/instrumentations/fetch.d.cts",default:"./dist/instrumentations/fetch.cjs"},import:{types:"./dist/instrumentations/fetch.d.ts",default:"./dist/instrumentations/fetch.js"},default:{types:"./dist/instrumentations/fetch.d.ts",default:"./dist/instrumentations/fetch.js"}},"./instrumentation-http":{require:{types:"./dist/instrumentations/http.d.cts",default:"./dist/instrumentations/http.cjs"},import:{types:"./dist/instrumentations/http.d.ts",default:"./dist/instrumentations/http.js"},default:{types:"./dist/instrumentations/http.d.ts",default:"./dist/instrumentations/http.js"}},"./opentelemetry":{require:{types:"./dist/opentelemetry.d.cts",default:"./dist/opentelemetry.cjs"},import:{types:"./dist/opentelemetry.d.ts",default:"./dist/opentelemetry.js"},default:{types:"./dist/opentelemetry.d.ts",default:"./dist/opentelemetry.js"}}},files:["dist/**/*"],scripts:{build:"tsup-node",dev:"tsup-node --watch",prepack:"npm run build",test:"run-s build test:ci","test:dev":"run-s build test:dev:*","test:ci":"run-s build test:ci:*","test:dev:vitest":"vitest","test:dev:vitest:watch":"vitest watch","test:ci:vitest":"vitest run",publint:"npx -y publint --strict"},keywords:["netlify","cdn"],license:"MIT",repository:{type:"git",url:"https://github.com/netlify/primitives.git",directory:"packages/otel"},bugs:{url:"https://github.com/netlify/primitives/issues"},author:"Netlify Inc.",devDependencies:{"@netlify/dev-utils":"^5.0.0",msw:"^2.10.5","npm-run-all2":"^7.0.2",tsup:"^8.0.0",vitest:"^3.0.0"},dependencies:{"@opentelemetry/api":"1.9.1","@opentelemetry/core":"2.8.0","@opentelemetry/instrumentation":"^0.220.0","@opentelemetry/resources":"2.9.0","@opentelemetry/sdk-trace-node":"2.9.0"}},SIe=t=>{if(Object.prototype.hasOwnProperty.call(globalThis,pIe))return;let e=Cwt.version.slice(1),r=ZW({"service.name":t.serviceName,"service.version":t.serviceVersion,"process.runtime.name":"nodejs","process.runtime.version":e,"deployment.environment":t.deploymentEnvironment,"http.url":t.siteUrl,"netlify.site.id":t.siteId,"netlify.site.name":t.siteName}),n=t.spanProcessors??[Dwt()],i=new lk.NodeTracerProvider({resource:r,spanProcessors:n});i.register({propagator:new Pu});let s=t.instrumentations??[];eY({instrumentations:s,tracerProvider:i}),Object.defineProperty(globalThis,pIe,{enumerable:!1,configurable:!0,writable:!1,value:function(a,c){return a?new kc(At.getTracer(a,c)):new kc(At.getTracer(hIe.name,hIe.version))}}),Object.defineProperty(globalThis,Nwt,{enumerable:!1,configurable:!0,writable:!1,value:async()=>await i.shutdown()})},Dwt=()=>new lk.SimpleSpanProcessor(new $wt);Ne();var DT=jn(BY(),1);Ne();import*as uk from"diagnostics_channel";var EIe=class{constructor(t={}){this.instrumentationName="@netlify/otel/instrumentation-fetch",this.instrumentationVersion="1.0.0",this._recordFromReq=new WeakMap,this.config=t,this._channelSubs=[]}getConfig(){return this.config}setConfig(){}setMeterProvider(){}setTracerProvider(t){this.provider=t}getTracerProvider(){return this.provider}annotateFromRequest(t,e){let r=this.config.getRequestAttributes?.(e)??{},n=new URL(e.path,e.origin);t.setAttributes({...r,"http.request.method":e.method,"url.full":n.href,"url.host":n.host,"url.scheme":n.protocol.slice(0,-1),"server.address":n.hostname,"server.port":n.port,...this.prepareHeaders("request",e.headers)})}annotateFromResponse(t,e){let r=this.config.getResponseAttributes?.(e)??{};t.setAttributes({...r,"http.response.status_code":e.statusCode,...this.prepareHeaders("response",e.headers)}),t.setStatus({code:e.statusCode>=400?Cn.ERROR:Cn.UNSET})}prepareHeaders(t,e){if(!Array.isArray(e))return{};if(this.config.skipHeaders===!0)return{};let r=["*","/.*/"],n=this.config.skipHeaders??[],i=this.config.redactHeaders??[],s=n.some(a=>r.includes(a.toString())),o={};if(s)return o;for(let a=0;a+1<e.length;a=a+2){let c=e[a],l=e[a+1];if(typeof c!="string"&&!Buffer.isBuffer(c)||typeof l!="string"&&!Buffer.isBuffer(l))continue;let u=c.toString().toLowerCase();if(n.some(f=>typeof f=="string"?f==u:f.test(u)))continue;let d=`http.${t}.header.${u}`;i===!0||i.some(f=>typeof f=="string"?f==u:f.test(u))?o[d]="REDACTED":o[d]=l.toString()}return o}getRequestMethod(t){return["HEAD","GET","POST","PUT","PATCH","DELETE"].includes(t.toUpperCase())?t.toUpperCase():"_OTHER"}getTracer(){if(!this.provider)return;let t=this.provider.getTracer(this.instrumentationName,this.instrumentationVersion);return t instanceof kc?t:new kc(t)}enable(){this._channelSubs.length>0||(this.subscribe("undici:request:create",this.onRequestCreate.bind(this)),this.subscribe("undici:request:headers",this.onRequestHeaders.bind(this)),this.subscribe("undici:request:trailers",this.onRequestEnd.bind(this)),this.subscribe("undici:request:error",this.onRequestError.bind(this)))}subscribe(t,e){uk.subscribe(t,e);let r=()=>uk.unsubscribe(t,e);this._channelSubs.push({name:t,unsubscribe:r})}disable(){this._channelSubs.forEach(t=>{t.unsubscribe()}),this._channelSubs.length=0}onRequestCreate({request:t}){try{let e=this.getTracer(),r=new URL(t.path,t.origin);if(!e||t.method==="CONNECT"||this.config.skipURLs?.some(i=>typeof i=="string"?r.href.startsWith(i):i.test(r.href)))return;let n=e.startSpan(this.getRequestMethod(t.method),{kind:oo.CLIENT},jt.active());this.annotateFromRequest(n,t),this._recordFromReq.set(t,n)}catch{}}onRequestHeaders({request:t,response:e}){try{let r=this._recordFromReq.get(t);if(!r)return;this.annotateFromResponse(r,e)}catch{}}onRequestError({request:t,error:e}){try{let r=this._recordFromReq.get(t);if(!r)return;r.recordException(e),r.setStatus({code:Cn.ERROR,message:e.message}),r.end(),this._recordFromReq.delete(t)}catch{}}onRequestEnd({request:t}){try{let e=this._recordFromReq.get(t);if(!e)return;e.end(),this._recordFromReq.delete(t)}catch{}}};var VDe=jn(BDe(),1);var uD=ye("tracing"),zDe=8e3,ZLt=5e3,e0=async(t=ZLt)=>{try{await Promise.race([S0e(),JLt(t)])}catch(e){uD.warn("Failed to flush tracers on shutdown",e)}},HDe=async(t,e,r)=>{if(!mt()){let n=[new DT.SimpleSpanProcessor(new WJ),new DT.SimpleSpanProcessor(new VDe.OTLPTraceExporter({url:r.exporterUrl}))];await SIe({serviceName:"@netlify/agent-runner-cli",serviceVersion:t,deploymentEnvironment:"production",siteUrl:"",siteId:process.env.SITE_ID??"",siteName:e,spanProcessors:n,instrumentations:[new EIe({skipHeaders:!0})]})}return r.traceparent?(Xn.setGlobalPropagator(new Pu),Xn.extract(jt.active(),{traceparent:r.traceparent,isRemote:!0})):jt.active()};function Gt(t,e,r){return uD.log(`\u23F3 TRACE: ${e} starting...`),Yf(t,e,r)}var WJ=class{export(e,r){for(let n of e)this.logSpan(n);r({code:1})}async shutdown(){}forceFlush(){return Promise.resolve()}logSpan(e){let r=(e.endTime[0]-e.startTime[0])*1e3+(e.endTime[1]-e.startTime[1])/1e6,n=e.attributes,i=[];for(let[a,c]of Object.entries(n))a.includes("duration")&&typeof c=="number"?i.push(`${a}=${c.toFixed(2)}ms`):i.push(`${a}=${c}`);let s=e.status?.code===2?"\u274C":"\u2705",o=i.length>0?` [${i.join(", ")}]`:"";uD.log(`${s} TRACE: ${e.name} completed in ${r.toFixed(2)}ms${o}`),e.status?.code===2&&e.status.message&&uD.log(` \u274C Error: ${e.status.message}`)}};function YJ(){return Be().captureLlmContentEnabled}function GDe(t){return t.includes("claude")?"anthropic":t.includes("codex")?"openai":t.includes("gemini")?"google":t.includes("opencode")?"opencode":t}function dD(t,e,r){let n={role:t,parts:[{type:"text",content:ws(e)}]};return r&&(n.finish_reason=r),JSON.stringify([n])}var XLt=new Set([Q.Task,Q.RunCommand,Q.Explore,Q.FileRead,Q.FileWrite,Q.Notebook,Q.Web,Q.Todo,Q.Skill,Q.Tool,Q.Memorize,Q.Deployment,Q.SiteGeneration]);function WDe(t,e,r,n){if(!t.length)return;let i=mt();if(!i)return;let s=YJ(),o=Math.max(1,(n-r)/t.length);t.forEach((a,c)=>{let l=Math.min(n,r+c*o),u=Math.min(n,l+o),d=a.type==="tool_use"||a.type==="tool_result"||a.category!=null&&XLt.has(a.category),f=d?"execute_tool":"chat",p=a.title||a.type||`step-${a.id??c}`,h=a.category||"unknown",m=d?`${f} ${h}`:f,_=a.message?a.message.length>zDe?`${a.message.slice(0,zDe)}\u2026`:a.message:void 0;i.startSpan(m,{startTime:l,attributes:{"gen_ai.capability.name":e,"gen_ai.step.name":p,"gen_ai.operation.name":f,...d?{"gen_ai.tool.name":h}:{},"spark.step.id":a.id??-1,...a.type?{"spark.step.type":a.type}:{},...a.category?{"spark.step.category":a.category}:{},...a.groupId?{"spark.step.group_id":a.groupId}:{},...a.parentGroupId?{"spark.step.parent_group_id":a.parentGroupId}:{},...s&&_?d?{"gen_ai.tool.call.result":ws(_)}:{"gen_ai.output.messages":dD("assistant",_)}:{}}}).end(u)})}import{readdir as QLt,rm as eDt}from"fs/promises";import{join as tDt}from"path";async function YDe(t,e=[]){let n=(await QLt(t)).filter(i=>!e.includes(i));await Promise.all(n.map(i=>eDt(tDt(t,i),{recursive:!0,force:!0})))}var rDt=700,KDe=t=>{if(t.mode!=="create")return!1;if(t.accountType===Al)return!0;let{enforcedAICreditsRemaining:e}=t;return e!=null&&e<=rDt};var sDt=pD.dirname(nDt(import.meta.url)),JDe=iDt(import.meta.url),oDt=pD.resolve(sDt,"scripts/scaffold.js"),aDt="scripts/scaffold.js",cDt=/"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\S+/g,KJ=t=>{if(t.length>=2){let e=t[0],r=t[t.length-1];if(e==='"'&&r==='"'||e==="'"&&r==="'")return t.slice(1,-1)}return t},lDt=t=>/^[A-Za-z_][A-Za-z0-9_]*=.*/.test(t),uDt=t=>{let e=KJ(t);return e==="node"||e.endsWith("/node")},nl=t=>{if(typeof t!="string")return!1;let e=t.match(cDt)||[];if(e.length<2)return!1;let r=0;for(;r<e.length&&lDt(KJ(e[r]));)r+=1;if(r>=e.length||!uDt(e[r]))return!1;let n=e[r+1];return n?KJ(n).includes(aDt):!1},_y=ye("create_stage"),ZDe="Do not run local validation or dev-server commands to check your work \u2014 specifically `tsc`, `npx tsc`, `vite build`, `vite dev`, or any equivalent build/start/test command. The build pipeline installs and validates the project automatically after your edits. Verify your changes by reading the files you edited.",dDt=`${ZDe}
591
591
 
592
592
  Commands that generate or modify project files are fine to run when the task requires them \u2014 for example \`drizzle-kit generate\` to write a database migration after a schema change, or other code-generation utilities documented in the skills.`,fDt=`${ZDe}
593
593
 
@@ -649,11 +649,11 @@ Replace \`<template-id>\` with the matching template \`id\`. Include \`--package
649
649
  ${r}
650
650
  `)}catch{await yy.writeFile(e,`${r}
651
651
  `)}xi.log("Added @AGENTS.md import to CLAUDE.local.md")}async function ZJ({config:t,netlify:e,persistSteps:r,aiGateway:n,continueSession:i,priorAgentSessionId:s,cwd:o=Sy.cwd(),cliPath:a="netlify",abortSignal:c,onSessionId:l,effortOverride:u}){let d=t,{prompt:f}=d,{model:p}=t,h="";await TDt();let m=bDt({aiGateway:n}),_=await vDt({config:t,aiGateway:n,model:p}),y=[],v=[],S={},g=new Set,T=[],I=H=>H?.match(/task\s+#([\w-]+)\s+created/i)?.[1],x=H=>{if(typeof H=="string")return H;if(Array.isArray(H))return H.filter(K=>K?.type==="text"&&typeof K.text=="string").map(K=>K.text).join(`
652
- `)||void 0},R=(H,z)=>{let K=H.input||{};if(H.name==="TaskCreate"){T.push({id:I(z),subject:typeof K.subject=="string"?K.subject:"",activeForm:typeof K.activeForm=="string"?K.activeForm:void 0,status:"pending"});return}let re=typeof K.taskId=="string"?K.taskId:void 0,Oe=re===void 0?void 0:T.find(ut=>ut.id===re);if(!Oe&&typeof K.subject=="string"){let ut=T.filter(ze=>ze.subject===K.subject);ut.length===1&&(Oe=ut[0])}if(K.status==="deleted"){Oe&&T.splice(T.indexOf(Oe),1);return}if(!Oe){if(re===void 0||typeof K.subject!="string"&&typeof K.activeForm!="string")return;Oe={id:re,subject:"",status:"pending"},T.push(Oe)}typeof K.status=="string"&&(Oe.status=K.status),typeof K.subject=="string"&&(Oe.subject=K.subject),typeof K.activeForm=="string"&&(Oe.activeForm=K.activeForm)},O=()=>T.map(H=>({name:H.status==="in_progress"&&H.activeForm||H.subject,value:H.status})),A=0,b=0,L,C,w,P,N="",j="mode"in t&&t.mode==="create"&&t.accountType===Al,V="mode"in t&&t.mode==="ask",de=Be().questionsEnabled,Te=j&&!Be().creditWrapUpEnabled,Ie=["ExitPlanMode","EnterPlanMode","AskUserQuestion"];Te&&Ie.push("TodoWrite","TaskCreate","TaskUpdate","TaskList","TaskGet"),V&&(Ie.push("Edit","Write","NotebookEdit","EnterWorktree","Bash(git push:*)","Bash(netlify deploy:*)"),ng(t)||Ie.push(...YI(a).map(H=>`Bash(${H}:*)`)));let $e=eg("claude",t.effort);t.effort&&!$e&&xi.log(`Effort '${t.effort}' is not available on ${r0}; using its default`);let oe=u??(Te?"low":$e??"high"),Ee=ca(o,"claude");if(!Ee)throw new Error("Claude CLI binary not found");let he=de?await Yge():void 0,k=["--permission-mode","bypassPermissions","--dangerously-skip-permissions","--output-format","stream-json","--verbose","--disallowed-tools",Ie.join(","),...he?.args??[],"--effort",oe,..._?["--model",_]:[],...i?s?["--resume",s]:["--continue"]:[],"-p"];xi.log(`Running ${Ee} ${k.join(" ")}`);let U=e.utils.run(Ee,k,{all:!0,env:m,cwd:o,idleTimeout:Wa,cancelSignal:c});U.stdin?.end(f);let ne=xl(()=>{r?.({steps:y,duration:b})},250),F=(H,z)=>{let{wrapMessage:K,...re}=H,Oe=TA({...re,id:A});Oe.message&&(Oe.message=Oe.message.replace(/\n?<system-reminder>.+?<\/system-reminder>\n?/gs,"").trim(),K&&Oe.message&&(Oe.message=`\`\`\`
652
+ `)||void 0},R=(H,z)=>{let K=H.input||{};if(H.name==="TaskCreate"){T.push({id:I(z),subject:typeof K.subject=="string"?K.subject:"",activeForm:typeof K.activeForm=="string"?K.activeForm:void 0,status:"pending"});return}let re=typeof K.taskId=="string"?K.taskId:void 0,Oe=re===void 0?void 0:T.find(ut=>ut.id===re);if(!Oe&&typeof K.subject=="string"){let ut=T.filter(ze=>ze.subject===K.subject);ut.length===1&&(Oe=ut[0])}if(K.status==="deleted"){Oe&&T.splice(T.indexOf(Oe),1);return}if(!Oe){if(re===void 0||typeof K.subject!="string"&&typeof K.activeForm!="string")return;Oe={id:re,subject:"",status:"pending"},T.push(Oe)}typeof K.status=="string"&&(Oe.status=K.status),typeof K.subject=="string"&&(Oe.subject=K.subject),typeof K.activeForm=="string"&&(Oe.activeForm=K.activeForm)},O=()=>T.map(H=>({name:H.status==="in_progress"&&H.activeForm||H.subject,value:H.status})),A=0,b=0,L,C,w,P,N="",F="mode"in t&&t.mode==="create"&&t.accountType===Al,V="mode"in t&&t.mode==="ask",de=Be().questionsEnabled,Te=F&&!Be().creditWrapUpEnabled,Ie=["ExitPlanMode","EnterPlanMode","AskUserQuestion"];Te&&Ie.push("TodoWrite","TaskCreate","TaskUpdate","TaskList","TaskGet"),V&&(Ie.push("Edit","Write","NotebookEdit","EnterWorktree","Bash(git push:*)","Bash(netlify deploy:*)"),ng(t)||Ie.push(...YI(a).map(H=>`Bash(${H}:*)`)));let $e=eg("claude",t.effort);t.effort&&!$e&&xi.log(`Effort '${t.effort}' is not available on ${r0}; using its default`);let oe=u??(Te?"low":$e??"high"),Ee=ca(o,"claude");if(!Ee)throw new Error("Claude CLI binary not found");let he=de?await Yge():void 0,k=["--permission-mode","bypassPermissions","--dangerously-skip-permissions","--output-format","stream-json","--verbose","--disallowed-tools",Ie.join(","),...he?.args??[],"--effort",oe,..._?["--model",_]:[],...i?s?["--resume",s]:["--continue"]:[],"-p"];xi.log(`Running ${Ee} ${k.join(" ")}`);let U=e.utils.run(Ee,k,{all:!0,env:m,cwd:o,idleTimeout:Wa,cancelSignal:c});U.stdin?.end(f);let ne=xl(()=>{r?.({steps:y,duration:b})},250),j=(H,z)=>{let{wrapMessage:K,...re}=H,Oe=TA({...re,id:A});Oe.message&&(Oe.message=Oe.message.replace(/\n?<system-reminder>.+?<\/system-reminder>\n?/gs,"").trim(),K&&Oe.message&&(Oe.message=`\`\`\`
653
653
  ${Oe.message}
654
- \`\`\``)),A+=1,v.push(Oe),y.push(Oe),z||ne.flush(),ne(),z&&ne.flush()},se=_||rMe,M=Te?`Using ${r0} in low credit usage mode due to low remaining credits. Setting model to ${se} and extra effort to low`:`Using ${r0} with ${se}`;F({title:M,category:Q.Environment},!0);let D=SDt.createInterface({input:U.all});D.on("error",H=>{xi.error("Readline interface error",{error:H.message,stack:H.stack})}),D.on("line",H=>{let z=null;try{z=JSON.parse(H)}catch{xi.log("Could not parse line",H)}z?.session_id&&z.session_id!==h&&(h=z.session_id,l?.(h)),Array.isArray(z?.message?.content)?z.message.content.forEach(K=>{switch(K.type){case"text":{if(K.text){if(K.text.startsWith("Base directory for this skill:"))break;z.message?.role!=="user"&&(N=K.text),F({message:K.text,category:z.message?.role==="user"?Q.SubagentPrompt:Q.AgentMessage,parentGroupId:z.parent_tool_use_id||void 0})}break}case"image":{typeof K.source=="object"&&K.source&&K.source.type==="base64"&&K.source.media_type?F({message:`![](data:${K.source.media_type};base64,${K.source.data})`,category:Q.AgentMessage,parentGroupId:z.parent_tool_use_id||void 0}):xi.log(`Unsupported image type ${K.source?.type}`,K.source);break}case"tool_use":{if(K.name&&!il[K.name]&&!g.has(K.name)&&(g.add(K.name),xi.log(`Unmapped tool in stream: ${K.name}`)),JJ(K.name)){let re=K.input?.description&&`\`${K.input.description}\``;F({title:[t0(K.name),re].filter(Boolean).join(" "),category:il[K.name]?.category,groupId:K.id,parentGroupId:z.parent_tool_use_id||void 0})}else K.name==="Bash"&&nl(K.input?.command)&&F({title:"Generating the site",category:Q.SiteGeneration,groupId:K.id,parentGroupId:z.parent_tool_use_id||void 0});if(K.name===xz&&K.id&&!P){let re=yu.safeParse(K.input);re.success?(P={questions:re.data.questions},U.kill()):(xi.warn("Ignoring malformed ask tool input",{toolUseId:K.id}),ge.inc("inference.malformed_ask",1))}K.id&&(S[K.id]=K),ne.flush();break}case"tool_result":{let re=K.tool_use_id?S[K.tool_use_id]:void 0;if(re?.name===xz)break;let Oe=JJ(re?.name),ut=re?.name==="Bash"&&nl(re?.input?.command);if(re?.name==="Skill"&&re?.input?.skill){let at=Mo(re.input.skill?.toString());Ka(xi,at),F({title:`Use ${at}`,category:Q.Skill,type:re.input.skill?.toString(),parentGroupId:z.parent_tool_use_id||void 0},!0);break}if(re?.name==="TodoWrite"){let{name:at,category:Mt}=il.TodoWrite;F({title:at,category:Mt,parentGroupId:z.parent_tool_use_id||void 0,tasks:z.tool_use_result?.newTodos?.map(Bs=>({name:Bs.status==="in_progress"?Bs.activeForm:Bs.content,value:Bs.status}))},!0);break}if(re?.name==="TaskCreate"||re?.name==="TaskUpdate"){K.is_error||R(re,x(K.content)),F({title:t0(re.name),category:Q.Todo,parentGroupId:z.parent_tool_use_id||void 0,tasks:O()},!0);break}if(re?.name&&eMe.has(re.name)){let at=il[re.name]?.category||Q.Tool,Mt=at===Q.Todo&&T.length>0;F({title:t0(re.name),category:at===Q.Todo&&!Mt?Q.Tool:at,parentGroupId:z.parent_tool_use_id||void 0,...Mt?{tasks:O()}:{}},!0);break}let ze=!!(re?.name&&il[re.name]),Qr;if(!Oe&&!ut&&re){let at=re.input?.file_path&&n0.relative(o,re.input.file_path);at||(at=re.input?.pattern||re.input?.command);let Mt=at&&`\`${at}\``;Qr=[t0(re.name||""),Mt].filter(Boolean).join(" ")}else!Oe&&!ut&&!re&&(Qr="Tool result");let qs=["Bash","Glob","Grep","LS","Read","Edit","Write","TaskOutput"].includes(re?.name||"")||!Oe&&!ut&&!ze,Ni=z.parent_tool_use_id||void 0;!Ni&&(Oe||ut)&&(Ni=K.tool_use_id);let Ha,Sh=Oe&&z.tool_use_result?.content||K.content;if(typeof Sh=="string")Ha=Sh;else if(Array.isArray(Sh)){let at=[];Sh.forEach(Mt=>{Mt?.type==="text"&&typeof Mt.text=="string"?at.push(Mt.text):Mt?.type==="image"&&typeof Mt.source=="object"&&Mt.source?Mt.source.type==="base64"&&Mt.source.media_type?at.push(`![](data:${Mt.source.media_type};base64,${Mt.source.data})`):xi.log(`Unsupported image type ${Mt.source.type}`,Mt.source):xi.log(`Unsupported block type ${Mt?.type}`)}),Ha=at.join(`
654
+ \`\`\``)),A+=1,v.push(Oe),y.push(Oe),z||ne.flush(),ne(),z&&ne.flush()},se=_||rMe,M=Te?`Using ${r0} in low credit usage mode due to low remaining credits. Setting model to ${se} and extra effort to low`:`Using ${r0} with ${se}`;t.answeredInteraction||j({title:M,category:Q.Environment},!0);let D=SDt.createInterface({input:U.all});D.on("error",H=>{xi.error("Readline interface error",{error:H.message,stack:H.stack})}),D.on("line",H=>{let z=null;try{z=JSON.parse(H)}catch{xi.log("Could not parse line",H)}z?.session_id&&z.session_id!==h&&(h=z.session_id,l?.(h)),Array.isArray(z?.message?.content)?z.message.content.forEach(K=>{switch(K.type){case"text":{if(K.text){if(K.text.startsWith("Base directory for this skill:"))break;z.message?.role!=="user"&&(N=K.text),j({message:K.text,category:z.message?.role==="user"?Q.SubagentPrompt:Q.AgentMessage,parentGroupId:z.parent_tool_use_id||void 0})}break}case"image":{typeof K.source=="object"&&K.source&&K.source.type==="base64"&&K.source.media_type?j({message:`![](data:${K.source.media_type};base64,${K.source.data})`,category:Q.AgentMessage,parentGroupId:z.parent_tool_use_id||void 0}):xi.log(`Unsupported image type ${K.source?.type}`,K.source);break}case"tool_use":{if(K.name&&!il[K.name]&&!g.has(K.name)&&(g.add(K.name),xi.log(`Unmapped tool in stream: ${K.name}`)),JJ(K.name)){let re=K.input?.description&&`\`${K.input.description}\``;j({title:[t0(K.name),re].filter(Boolean).join(" "),category:il[K.name]?.category,groupId:K.id,parentGroupId:z.parent_tool_use_id||void 0})}else K.name==="Bash"&&nl(K.input?.command)&&j({title:"Generating the site",category:Q.SiteGeneration,groupId:K.id,parentGroupId:z.parent_tool_use_id||void 0});if(K.name===xz&&K.id&&!P){let re=yu.safeParse(K.input);re.success?(P={questions:re.data.questions},U.kill()):(xi.warn("Ignoring malformed ask tool input",{toolUseId:K.id}),ge.inc("inference.malformed_ask",1))}K.id&&(S[K.id]=K),ne.flush();break}case"tool_result":{let re=K.tool_use_id?S[K.tool_use_id]:void 0;if(re?.name===xz)break;let Oe=JJ(re?.name),ut=re?.name==="Bash"&&nl(re?.input?.command);if(re?.name==="Skill"&&re?.input?.skill){let at=Mo(re.input.skill?.toString());Ka(xi,at),j({title:`Use ${at}`,category:Q.Skill,type:re.input.skill?.toString(),parentGroupId:z.parent_tool_use_id||void 0},!0);break}if(re?.name==="TodoWrite"){let{name:at,category:Mt}=il.TodoWrite;j({title:at,category:Mt,parentGroupId:z.parent_tool_use_id||void 0,tasks:z.tool_use_result?.newTodos?.map(Bs=>({name:Bs.status==="in_progress"?Bs.activeForm:Bs.content,value:Bs.status}))},!0);break}if(re?.name==="TaskCreate"||re?.name==="TaskUpdate"){K.is_error||R(re,x(K.content)),j({title:t0(re.name),category:Q.Todo,parentGroupId:z.parent_tool_use_id||void 0,tasks:O()},!0);break}if(re?.name&&eMe.has(re.name)){let at=il[re.name]?.category||Q.Tool,Mt=at===Q.Todo&&T.length>0;j({title:t0(re.name),category:at===Q.Todo&&!Mt?Q.Tool:at,parentGroupId:z.parent_tool_use_id||void 0,...Mt?{tasks:O()}:{}},!0);break}let ze=!!(re?.name&&il[re.name]),Qr;if(!Oe&&!ut&&re){let at=re.input?.file_path&&n0.relative(o,re.input.file_path);at||(at=re.input?.pattern||re.input?.command);let Mt=at&&`\`${at}\``;Qr=[t0(re.name||""),Mt].filter(Boolean).join(" ")}else!Oe&&!ut&&!re&&(Qr="Tool result");let qs=["Bash","Glob","Grep","LS","Read","Edit","Write","TaskOutput"].includes(re?.name||"")||!Oe&&!ut&&!ze,Ni=z.parent_tool_use_id||void 0;!Ni&&(Oe||ut)&&(Ni=K.tool_use_id);let Ha,Sh=Oe&&z.tool_use_result?.content||K.content;if(typeof Sh=="string")Ha=Sh;else if(Array.isArray(Sh)){let at=[];Sh.forEach(Mt=>{Mt?.type==="text"&&typeof Mt.text=="string"?at.push(Mt.text):Mt?.type==="image"&&typeof Mt.source=="object"&&Mt.source?Mt.source.type==="base64"&&Mt.source.media_type?at.push(`![](data:${Mt.source.media_type};base64,${Mt.source.data})`):xi.log(`Unsupported image type ${Mt.source.type}`,Mt.source):xi.log(`Unsupported block type ${Mt?.type}`)}),Ha=at.join(`
655
655
 
656
- `)}if(Oe&&Ha&&QDe(Ha)){F({title:"Running in background",category:Q.Task,parentGroupId:Ni},!0);break}F({title:Qr,message:Ha,wrapMessage:qs,category:Oe?Q.AgentMessage:ut?Q.SiteGeneration:il[re?.name??""]?.category||Q.Tool,parentGroupId:Ni},!0);break}case"thinking":{K.thinking&&F({title:"Reasoning",message:K.thinking,category:Q.Reasoning,parentGroupId:z.parent_tool_use_id||void 0},!0);break}default:xi.log(`Message content type is not supported ${K.type}`,K)}}):z?.type==="result"&&(b=z.duration_ms||0,z.is_error?P||(C=z.result):L=z.result,z.usage&&(Su(z.usage,_?{model:_}:{}),w=z.usage),[v,y].forEach(K=>{K[K.length-1]?.message===L&&K.pop()}))});let B=!1;if(await U.catch(H=>{B=tg(H,c),{error:C,result:L}=rg({catchError:H,runCmd:U,error:C,result:L,runnerName:"Claude"})}),he&&await yy.rm(he.mcpConfigPath,{force:!0}).catch(()=>{}),D.close(),ne.flush(),P)return{steps:v,duration:b,agentSessionId:h,resolvedModel:_,effort:oe,usage:w,pendingInteraction:P};let J=B;return J&&(!L&&N.trim()&&(L=N.trim()),C=void 0),{steps:v,duration:b,result:await Eu({initialResult:L,agentName:r0,hasError:!!C}),error:vu({error:C,agentName:r0}),isRetryableError:bu(C),isProviderUnavailableError:Tu(C),agentSessionId:h,resolvedModel:_,effort:oe,usage:w,...J?{aborted:!0}:{}}}var nMe=async()=>{let t=n0.join(tMe.homedir(),".claude");await yy.rm(t,{recursive:!0,force:!0})},iMe={baseDir:n0.join(tMe.homedir(),".claude"),include:["projects"]};import R0 from"fs/promises";import x0 from"os";import bd from"path";import hl from"process";import YMt from"readline";function Ue(t,e,r,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(t,r):i?i.value=r:e.set(t,r),r}function Y(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)}var XJ=function(){let{crypto:t}=globalThis;if(t?.randomUUID)return XJ=t.randomUUID.bind(t),t.randomUUID();let e=new Uint8Array(1),r=t?()=>t.getRandomValues(e)[0]:()=>Math.random()*255&255;return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,n=>(+n^r()&15>>+n/4).toString(16))};function i0(t){return typeof t=="object"&&t!==null&&("name"in t&&t.name==="AbortError"||"message"in t&&String(t.message).includes("FetchRequestCanceledException"))}var s0=t=>{if(t instanceof Error)return t;if(typeof t=="object"&&t!==null){try{if(Object.prototype.toString.call(t)==="[object Error]"){let e=new Error(t.message,t.cause?{cause:t.cause}:{});return t.stack&&(e.stack=t.stack),t.cause&&!e.cause&&(e.cause=t.cause),t.name&&(e.name=t.name),e}}catch{}try{return new Error(JSON.stringify(t))}catch{}}return new Error(t)};var Re=class extends Error{},hr=class t extends Re{constructor(e,r,n,i){super(`${t.makeMessage(e,r,n)}`),this.status=e,this.headers=i,this.requestID=i?.get("x-request-id"),this.error=r;let s=r;this.code=s?.code,this.param=s?.param,this.type=s?.type}static makeMessage(e,r,n){let i=r?.message?typeof r.message=="string"?r.message:JSON.stringify(r.message):r?JSON.stringify(r):n;return e&&i?`${e} ${i}`:e?`${e} status code (no body)`:i||"(no status code or body)"}static generate(e,r,n,i){if(!e||!i)return new sd({message:n,cause:s0(r)});let s=r?.error;return e===400?new Ey(e,s,n,i):e===401?new vy(e,s,n,i):e===403?new by(e,s,n,i):e===404?new Ty(e,s,n,i):e===409?new wy(e,s,n,i):e===422?new Ay(e,s,n,i):e===429?new Ry(e,s,n,i):e>=500?new xy(e,s,n,i):new t(e,s,n,i)}},Ir=class extends hr{constructor({message:e}={}){super(void 0,void 0,e||"Request was aborted.",void 0)}},sd=class extends hr{constructor({message:e,cause:r}){super(void 0,void 0,e||"Connection error.",void 0),r&&(this.cause=r)}},od=class extends sd{constructor({message:e}={}){super({message:e??"Request timed out."})}},Ey=class extends hr{},vy=class extends hr{},by=class extends hr{},Ty=class extends hr{},wy=class extends hr{},Ay=class extends hr{},Ry=class extends hr{},xy=class extends hr{},Iy=class extends Re{constructor(){super("Could not parse response content as the length limit was reached")}},Oy=class extends Re{constructor(){super("Could not parse response content as the request was rejected by the content filter")}},Na=class extends Error{constructor(e){super(e)}},$p=class extends hr{constructor(e,r,n){let i="OAuth2 authentication error",s;if(r&&typeof r=="object"){let o=r;s=o.error;let a=o.error_description;a&&typeof a=="string"?i=a:s&&(i=s)}super(e,r,i,n),this.error_code=s}},o0=class extends Re{constructor(e,r,n){super(e),this.provider=r,this.cause=n}};var ADt=/^[a-z][a-z0-9+.-]*:/i,sMe=t=>ADt.test(t),Nn=t=>(Nn=Array.isArray,Nn(t)),QJ=Nn;function eZ(t){return typeof t!="object"?{}:t??{}}function tZ(t){if(!t)return!0;for(let e in t)return!1;return!0}function oMe(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function a0(t){return t!=null&&typeof t=="object"&&!Array.isArray(t)}var aMe=(t,e)=>{if(typeof e!="number"||!Number.isInteger(e))throw new Re(`${t} must be an integer`);if(e<0)throw new Re(`${t} must be a positive integer`);return e};var cMe=t=>{try{return JSON.parse(t)}catch{return}};var ka=t=>new Promise(e=>setTimeout(e,t));var ad="6.34.0";var fMe=()=>typeof window<"u"&&typeof window.document<"u"&&typeof navigator<"u";function RDt(){return typeof Deno<"u"&&Deno.build!=null?"deno":typeof EdgeRuntime<"u"?"edge":Object.prototype.toString.call(typeof globalThis.process<"u"?globalThis.process:0)==="[object process]"?"node":"unknown"}var xDt=()=>{let t=RDt();if(t==="deno")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":ad,"X-Stainless-OS":uMe(Deno.build.os),"X-Stainless-Arch":lMe(Deno.build.arch),"X-Stainless-Runtime":"deno","X-Stainless-Runtime-Version":typeof Deno.version=="string"?Deno.version:Deno.version?.deno??"unknown"};if(typeof EdgeRuntime<"u")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":ad,"X-Stainless-OS":"Unknown","X-Stainless-Arch":`other:${EdgeRuntime}`,"X-Stainless-Runtime":"edge","X-Stainless-Runtime-Version":globalThis.process.version};if(t==="node")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":ad,"X-Stainless-OS":uMe(globalThis.process.platform??"unknown"),"X-Stainless-Arch":lMe(globalThis.process.arch??"unknown"),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":globalThis.process.version??"unknown"};let e=IDt();return e?{"X-Stainless-Lang":"js","X-Stainless-Package-Version":ad,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":`browser:${e.browser}`,"X-Stainless-Runtime-Version":e.version}:{"X-Stainless-Lang":"js","X-Stainless-Package-Version":ad,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}};function IDt(){if(typeof navigator>"u"||!navigator)return null;let t=[{key:"edge",pattern:/Edge(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/MSIE(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/Trident(?:.*rv\:(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"chrome",pattern:/Chrome(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"firefox",pattern:/Firefox(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"safari",pattern:/(?:Version\W+(\d+)\.(\d+)(?:\.(\d+))?)?(?:\W+Mobile\S*)?\W+Safari/}];for(let{key:e,pattern:r}of t){let n=r.exec(navigator.userAgent);if(n){let i=n[1]||0,s=n[2]||0,o=n[3]||0;return{browser:e,version:`${i}.${s}.${o}`}}}return null}var lMe=t=>t==="x32"?"x32":t==="x86_64"||t==="x64"?"x64":t==="arm"?"arm":t==="aarch64"||t==="arm64"?"arm64":t?`other:${t}`:"unknown",uMe=t=>(t=t.toLowerCase(),t.includes("ios")?"iOS":t==="android"?"Android":t==="darwin"?"MacOS":t==="win32"?"Windows":t==="freebsd"?"FreeBSD":t==="openbsd"?"OpenBSD":t==="linux"?"Linux":t?`Other:${t}`:"Unknown"),dMe,pMe=()=>dMe??(dMe=xDt());function hD(){if(typeof fetch<"u")return fetch;throw new Error("`fetch` is not defined as a global; Either pass `fetch` to the client, `new OpenAI({ fetch })` or polyfill the global, `globalThis.fetch = fetch`")}function rZ(...t){let e=globalThis.ReadableStream;if(typeof e>"u")throw new Error("`ReadableStream` is not defined as a global; You will need to polyfill it, `globalThis.ReadableStream = ReadableStream`");return new e(...t)}function mD(t){let e=Symbol.asyncIterator in t?t[Symbol.asyncIterator]():t[Symbol.iterator]();return rZ({start(){},async pull(r){let{done:n,value:i}=await e.next();n?r.close():r.enqueue(i)},async cancel(){await e.return?.()}})}function nZ(t){if(t[Symbol.asyncIterator])return t;let e=t.getReader();return{async next(){try{let r=await e.read();return r?.done&&e.releaseLock(),r}catch(r){throw e.releaseLock(),r}},async return(){let r=e.cancel();return e.releaseLock(),await r,{done:!0,value:void 0}},[Symbol.asyncIterator](){return this}}}async function iZ(t){if(t===null||typeof t!="object")return;if(t[Symbol.asyncIterator]){await t[Symbol.asyncIterator]().return?.();return}let e=t.getReader(),r=e.cancel();e.releaseLock(),await r}var mMe=({headers:t,body:e})=>({bodyHeaders:{"content-type":"application/json"},body:JSON.stringify(e)});var sZ="RFC3986",oZ=t=>String(t),aZ={RFC1738:t=>String(t).replace(/%20/g,"+"),RFC3986:oZ},gMe="RFC1738";var gD=(t,e)=>(gD=Object.hasOwn??Function.prototype.call.bind(Object.prototype.hasOwnProperty),gD(t,e)),$a=(()=>{let t=[];for(let e=0;e<256;++e)t.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return t})();var cZ=1024,_Me=(t,e,r,n,i)=>{if(t.length===0)return t;let s=t;if(typeof t=="symbol"?s=Symbol.prototype.toString.call(t):typeof t!="string"&&(s=String(t)),r==="iso-8859-1")return escape(s).replace(/%u[0-9a-f]{4}/gi,function(a){return"%26%23"+parseInt(a.slice(2),16)+"%3B"});let o="";for(let a=0;a<s.length;a+=cZ){let c=s.length>=cZ?s.slice(a,a+cZ):s,l=[];for(let u=0;u<c.length;++u){let d=c.charCodeAt(u);if(d===45||d===46||d===95||d===126||d>=48&&d<=57||d>=65&&d<=90||d>=97&&d<=122||i===gMe&&(d===40||d===41)){l[l.length]=c.charAt(u);continue}if(d<128){l[l.length]=$a[d];continue}if(d<2048){l[l.length]=$a[192|d>>6]+$a[128|d&63];continue}if(d<55296||d>=57344){l[l.length]=$a[224|d>>12]+$a[128|d>>6&63]+$a[128|d&63];continue}u+=1,d=65536+((d&1023)<<10|c.charCodeAt(u)&1023),l[l.length]=$a[240|d>>18]+$a[128|d>>12&63]+$a[128|d>>6&63]+$a[128|d&63]}o+=l.join("")}return o};function yMe(t){return!t||typeof t!="object"?!1:!!(t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer(t))}function lZ(t,e){if(Nn(t)){let r=[];for(let n=0;n<t.length;n+=1)r.push(e(t[n]));return r}return e(t)}var EMe={brackets(t){return String(t)+"[]"},comma:"comma",indices(t,e){return String(t)+"["+e+"]"},repeat(t){return String(t)}},vMe=function(t,e){Array.prototype.push.apply(t,Nn(e)?e:[e])},SMe,Dr={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:_Me,encodeValuesOnly:!1,format:sZ,formatter:oZ,indices:!1,serializeDate(t){return(SMe??(SMe=Function.prototype.call.bind(Date.prototype.toISOString)))(t)},skipNulls:!1,strictNullHandling:!1};function PDt(t){return typeof t=="string"||typeof t=="number"||typeof t=="boolean"||typeof t=="symbol"||typeof t=="bigint"}var uZ={};function bMe(t,e,r,n,i,s,o,a,c,l,u,d,f,p,h,m,_,y){let v=t,S=y,g=0,T=!1;for(;(S=S.get(uZ))!==void 0&&!T;){let A=S.get(t);if(g+=1,typeof A<"u"){if(A===g)throw new RangeError("Cyclic object value");T=!0}typeof S.get(uZ)>"u"&&(g=0)}if(typeof l=="function"?v=l(e,v):v instanceof Date?v=f?.(v):r==="comma"&&Nn(v)&&(v=lZ(v,function(A){return A instanceof Date?f?.(A):A})),v===null){if(s)return c&&!m?c(e,Dr.encoder,_,"key",p):e;v=""}if(PDt(v)||yMe(v)){if(c){let A=m?e:c(e,Dr.encoder,_,"key",p);return[h?.(A)+"="+h?.(c(v,Dr.encoder,_,"value",p))]}return[h?.(e)+"="+h?.(String(v))]}let I=[];if(typeof v>"u")return I;let x;if(r==="comma"&&Nn(v))m&&c&&(v=lZ(v,c)),x=[{value:v.length>0?v.join(",")||null:void 0}];else if(Nn(l))x=l;else{let A=Object.keys(v);x=u?A.sort(u):A}let R=a?String(e).replace(/\./g,"%2E"):String(e),O=n&&Nn(v)&&v.length===1?R+"[]":R;if(i&&Nn(v)&&v.length===0)return O+"[]";for(let A=0;A<x.length;++A){let b=x[A],L=typeof b=="object"&&typeof b.value<"u"?b.value:v[b];if(o&&L===null)continue;let C=d&&a?b.replace(/\./g,"%2E"):b,w=Nn(v)?typeof r=="function"?r(O,C):O:O+(d?"."+C:"["+C+"]");y.set(t,g);let P=new WeakMap;P.set(uZ,y),vMe(I,bMe(L,w,r,n,i,s,o,a,r==="comma"&&m&&Nn(v)?null:c,l,u,d,f,p,h,m,_,P))}return I}function CDt(t=Dr){if(typeof t.allowEmptyArrays<"u"&&typeof t.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof t.encodeDotInKeys<"u"&&typeof t.encodeDotInKeys!="boolean")throw new TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if(t.encoder!==null&&typeof t.encoder<"u"&&typeof t.encoder!="function")throw new TypeError("Encoder has to be a function.");let e=t.charset||Dr.charset;if(typeof t.charset<"u"&&t.charset!=="utf-8"&&t.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");let r=sZ;if(typeof t.format<"u"){if(!gD(aZ,t.format))throw new TypeError("Unknown format option provided.");r=t.format}let n=aZ[r],i=Dr.filter;(typeof t.filter=="function"||Nn(t.filter))&&(i=t.filter);let s;if(t.arrayFormat&&t.arrayFormat in EMe?s=t.arrayFormat:"indices"in t?s=t.indices?"indices":"repeat":s=Dr.arrayFormat,"commaRoundTrip"in t&&typeof t.commaRoundTrip!="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");let o=typeof t.allowDots>"u"?t.encodeDotInKeys?!0:Dr.allowDots:!!t.allowDots;return{addQueryPrefix:typeof t.addQueryPrefix=="boolean"?t.addQueryPrefix:Dr.addQueryPrefix,allowDots:o,allowEmptyArrays:typeof t.allowEmptyArrays=="boolean"?!!t.allowEmptyArrays:Dr.allowEmptyArrays,arrayFormat:s,charset:e,charsetSentinel:typeof t.charsetSentinel=="boolean"?t.charsetSentinel:Dr.charsetSentinel,commaRoundTrip:!!t.commaRoundTrip,delimiter:typeof t.delimiter>"u"?Dr.delimiter:t.delimiter,encode:typeof t.encode=="boolean"?t.encode:Dr.encode,encodeDotInKeys:typeof t.encodeDotInKeys=="boolean"?t.encodeDotInKeys:Dr.encodeDotInKeys,encoder:typeof t.encoder=="function"?t.encoder:Dr.encoder,encodeValuesOnly:typeof t.encodeValuesOnly=="boolean"?t.encodeValuesOnly:Dr.encodeValuesOnly,filter:i,format:r,formatter:n,serializeDate:typeof t.serializeDate=="function"?t.serializeDate:Dr.serializeDate,skipNulls:typeof t.skipNulls=="boolean"?t.skipNulls:Dr.skipNulls,sort:typeof t.sort=="function"?t.sort:null,strictNullHandling:typeof t.strictNullHandling=="boolean"?t.strictNullHandling:Dr.strictNullHandling}}function TMe(t,e={}){let r=t,n=CDt(e),i,s;typeof n.filter=="function"?(s=n.filter,r=s("",r)):Nn(n.filter)&&(s=n.filter,i=s);let o=[];if(typeof r!="object"||r===null)return"";let a=EMe[n.arrayFormat],c=a==="comma"&&n.commaRoundTrip;i||(i=Object.keys(r)),n.sort&&i.sort(n.sort);let l=new WeakMap;for(let f=0;f<i.length;++f){let p=i[f];n.skipNulls&&r[p]===null||vMe(o,bMe(r[p],p,a,c,n.allowEmptyArrays,n.strictNullHandling,n.skipNulls,n.encodeDotInKeys,n.encode?n.encoder:null,n.filter,n.sort,n.allowDots,n.serializeDate,n.format,n.formatter,n.encodeValuesOnly,n.charset,l))}let u=o.join(n.delimiter),d=n.addQueryPrefix===!0?"?":"";return n.charsetSentinel&&(n.charset==="iso-8859-1"?d+="utf8=%26%2310003%3B&":d+="utf8=%E2%9C%93&"),u.length>0?d+u:""}function wMe(t){return TMe(t,{arrayFormat:"brackets"})}function xMe(t){let e=0;for(let i of t)e+=i.length;let r=new Uint8Array(e),n=0;for(let i of t)r.set(i,n),n+=i.length;return r}var AMe;function Py(t){let e;return(AMe??(e=new globalThis.TextEncoder,AMe=e.encode.bind(e)))(t)}var RMe;function dZ(t){let e;return(RMe??(e=new globalThis.TextDecoder,RMe=e.decode.bind(e)))(t)}var Ki,Ji,Lp=class{constructor(){Ki.set(this,void 0),Ji.set(this,void 0),Ue(this,Ki,new Uint8Array,"f"),Ue(this,Ji,null,"f")}decode(e){if(e==null)return[];let r=e instanceof ArrayBuffer?new Uint8Array(e):typeof e=="string"?Py(e):e;Ue(this,Ki,xMe([Y(this,Ki,"f"),r]),"f");let n=[],i;for(;(i=kDt(Y(this,Ki,"f"),Y(this,Ji,"f")))!=null;){if(i.carriage&&Y(this,Ji,"f")==null){Ue(this,Ji,i.index,"f");continue}if(Y(this,Ji,"f")!=null&&(i.index!==Y(this,Ji,"f")+1||i.carriage)){n.push(dZ(Y(this,Ki,"f").subarray(0,Y(this,Ji,"f")-1))),Ue(this,Ki,Y(this,Ki,"f").subarray(Y(this,Ji,"f")),"f"),Ue(this,Ji,null,"f");continue}let s=Y(this,Ji,"f")!==null?i.preceding-1:i.preceding,o=dZ(Y(this,Ki,"f").subarray(0,s));n.push(o),Ue(this,Ki,Y(this,Ki,"f").subarray(i.index),"f"),Ue(this,Ji,null,"f")}return n}flush(){return Y(this,Ki,"f").length?this.decode(`
656
+ `)}if(Oe&&Ha&&QDe(Ha)){j({title:"Running in background",category:Q.Task,parentGroupId:Ni},!0);break}j({title:Qr,message:Ha,wrapMessage:qs,category:Oe?Q.AgentMessage:ut?Q.SiteGeneration:il[re?.name??""]?.category||Q.Tool,parentGroupId:Ni},!0);break}case"thinking":{K.thinking&&j({title:"Reasoning",message:K.thinking,category:Q.Reasoning,parentGroupId:z.parent_tool_use_id||void 0},!0);break}default:xi.log(`Message content type is not supported ${K.type}`,K)}}):z?.type==="result"&&(b=z.duration_ms||0,z.is_error?P||(C=z.result):L=z.result,z.usage&&(Su(z.usage,_?{model:_}:{}),w=z.usage),[v,y].forEach(K=>{K[K.length-1]?.message===L&&K.pop()}))});let B=!1;if(await U.catch(H=>{B=tg(H,c),{error:C,result:L}=rg({catchError:H,runCmd:U,error:C,result:L,runnerName:"Claude"})}),he&&await yy.rm(he.mcpConfigPath,{force:!0}).catch(()=>{}),D.close(),ne.flush(),P)return{steps:v,duration:b,agentSessionId:h,resolvedModel:_,effort:oe,usage:w,pendingInteraction:P};let J=B;return J&&(!L&&N.trim()&&(L=N.trim()),C=void 0),{steps:v,duration:b,result:await Eu({initialResult:L,agentName:r0,hasError:!!C}),error:vu({error:C,agentName:r0}),isRetryableError:bu(C),isProviderUnavailableError:Tu(C),agentSessionId:h,resolvedModel:_,effort:oe,usage:w,...J?{aborted:!0}:{}}}var nMe=async()=>{let t=n0.join(tMe.homedir(),".claude");await yy.rm(t,{recursive:!0,force:!0})},iMe={baseDir:n0.join(tMe.homedir(),".claude"),include:["projects"]};import R0 from"fs/promises";import x0 from"os";import bd from"path";import hl from"process";import YMt from"readline";function Ue(t,e,r,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(t,r):i?i.value=r:e.set(t,r),r}function Y(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)}var XJ=function(){let{crypto:t}=globalThis;if(t?.randomUUID)return XJ=t.randomUUID.bind(t),t.randomUUID();let e=new Uint8Array(1),r=t?()=>t.getRandomValues(e)[0]:()=>Math.random()*255&255;return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,n=>(+n^r()&15>>+n/4).toString(16))};function i0(t){return typeof t=="object"&&t!==null&&("name"in t&&t.name==="AbortError"||"message"in t&&String(t.message).includes("FetchRequestCanceledException"))}var s0=t=>{if(t instanceof Error)return t;if(typeof t=="object"&&t!==null){try{if(Object.prototype.toString.call(t)==="[object Error]"){let e=new Error(t.message,t.cause?{cause:t.cause}:{});return t.stack&&(e.stack=t.stack),t.cause&&!e.cause&&(e.cause=t.cause),t.name&&(e.name=t.name),e}}catch{}try{return new Error(JSON.stringify(t))}catch{}}return new Error(t)};var Re=class extends Error{},hr=class t extends Re{constructor(e,r,n,i){super(`${t.makeMessage(e,r,n)}`),this.status=e,this.headers=i,this.requestID=i?.get("x-request-id"),this.error=r;let s=r;this.code=s?.code,this.param=s?.param,this.type=s?.type}static makeMessage(e,r,n){let i=r?.message?typeof r.message=="string"?r.message:JSON.stringify(r.message):r?JSON.stringify(r):n;return e&&i?`${e} ${i}`:e?`${e} status code (no body)`:i||"(no status code or body)"}static generate(e,r,n,i){if(!e||!i)return new sd({message:n,cause:s0(r)});let s=r?.error;return e===400?new Ey(e,s,n,i):e===401?new vy(e,s,n,i):e===403?new by(e,s,n,i):e===404?new Ty(e,s,n,i):e===409?new wy(e,s,n,i):e===422?new Ay(e,s,n,i):e===429?new Ry(e,s,n,i):e>=500?new xy(e,s,n,i):new t(e,s,n,i)}},Ir=class extends hr{constructor({message:e}={}){super(void 0,void 0,e||"Request was aborted.",void 0)}},sd=class extends hr{constructor({message:e,cause:r}){super(void 0,void 0,e||"Connection error.",void 0),r&&(this.cause=r)}},od=class extends sd{constructor({message:e}={}){super({message:e??"Request timed out."})}},Ey=class extends hr{},vy=class extends hr{},by=class extends hr{},Ty=class extends hr{},wy=class extends hr{},Ay=class extends hr{},Ry=class extends hr{},xy=class extends hr{},Iy=class extends Re{constructor(){super("Could not parse response content as the length limit was reached")}},Oy=class extends Re{constructor(){super("Could not parse response content as the request was rejected by the content filter")}},Na=class extends Error{constructor(e){super(e)}},$p=class extends hr{constructor(e,r,n){let i="OAuth2 authentication error",s;if(r&&typeof r=="object"){let o=r;s=o.error;let a=o.error_description;a&&typeof a=="string"?i=a:s&&(i=s)}super(e,r,i,n),this.error_code=s}},o0=class extends Re{constructor(e,r,n){super(e),this.provider=r,this.cause=n}};var ADt=/^[a-z][a-z0-9+.-]*:/i,sMe=t=>ADt.test(t),Nn=t=>(Nn=Array.isArray,Nn(t)),QJ=Nn;function eZ(t){return typeof t!="object"?{}:t??{}}function tZ(t){if(!t)return!0;for(let e in t)return!1;return!0}function oMe(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function a0(t){return t!=null&&typeof t=="object"&&!Array.isArray(t)}var aMe=(t,e)=>{if(typeof e!="number"||!Number.isInteger(e))throw new Re(`${t} must be an integer`);if(e<0)throw new Re(`${t} must be a positive integer`);return e};var cMe=t=>{try{return JSON.parse(t)}catch{return}};var ka=t=>new Promise(e=>setTimeout(e,t));var ad="6.34.0";var fMe=()=>typeof window<"u"&&typeof window.document<"u"&&typeof navigator<"u";function RDt(){return typeof Deno<"u"&&Deno.build!=null?"deno":typeof EdgeRuntime<"u"?"edge":Object.prototype.toString.call(typeof globalThis.process<"u"?globalThis.process:0)==="[object process]"?"node":"unknown"}var xDt=()=>{let t=RDt();if(t==="deno")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":ad,"X-Stainless-OS":uMe(Deno.build.os),"X-Stainless-Arch":lMe(Deno.build.arch),"X-Stainless-Runtime":"deno","X-Stainless-Runtime-Version":typeof Deno.version=="string"?Deno.version:Deno.version?.deno??"unknown"};if(typeof EdgeRuntime<"u")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":ad,"X-Stainless-OS":"Unknown","X-Stainless-Arch":`other:${EdgeRuntime}`,"X-Stainless-Runtime":"edge","X-Stainless-Runtime-Version":globalThis.process.version};if(t==="node")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":ad,"X-Stainless-OS":uMe(globalThis.process.platform??"unknown"),"X-Stainless-Arch":lMe(globalThis.process.arch??"unknown"),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":globalThis.process.version??"unknown"};let e=IDt();return e?{"X-Stainless-Lang":"js","X-Stainless-Package-Version":ad,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":`browser:${e.browser}`,"X-Stainless-Runtime-Version":e.version}:{"X-Stainless-Lang":"js","X-Stainless-Package-Version":ad,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}};function IDt(){if(typeof navigator>"u"||!navigator)return null;let t=[{key:"edge",pattern:/Edge(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/MSIE(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/Trident(?:.*rv\:(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"chrome",pattern:/Chrome(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"firefox",pattern:/Firefox(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"safari",pattern:/(?:Version\W+(\d+)\.(\d+)(?:\.(\d+))?)?(?:\W+Mobile\S*)?\W+Safari/}];for(let{key:e,pattern:r}of t){let n=r.exec(navigator.userAgent);if(n){let i=n[1]||0,s=n[2]||0,o=n[3]||0;return{browser:e,version:`${i}.${s}.${o}`}}}return null}var lMe=t=>t==="x32"?"x32":t==="x86_64"||t==="x64"?"x64":t==="arm"?"arm":t==="aarch64"||t==="arm64"?"arm64":t?`other:${t}`:"unknown",uMe=t=>(t=t.toLowerCase(),t.includes("ios")?"iOS":t==="android"?"Android":t==="darwin"?"MacOS":t==="win32"?"Windows":t==="freebsd"?"FreeBSD":t==="openbsd"?"OpenBSD":t==="linux"?"Linux":t?`Other:${t}`:"Unknown"),dMe,pMe=()=>dMe??(dMe=xDt());function hD(){if(typeof fetch<"u")return fetch;throw new Error("`fetch` is not defined as a global; Either pass `fetch` to the client, `new OpenAI({ fetch })` or polyfill the global, `globalThis.fetch = fetch`")}function rZ(...t){let e=globalThis.ReadableStream;if(typeof e>"u")throw new Error("`ReadableStream` is not defined as a global; You will need to polyfill it, `globalThis.ReadableStream = ReadableStream`");return new e(...t)}function mD(t){let e=Symbol.asyncIterator in t?t[Symbol.asyncIterator]():t[Symbol.iterator]();return rZ({start(){},async pull(r){let{done:n,value:i}=await e.next();n?r.close():r.enqueue(i)},async cancel(){await e.return?.()}})}function nZ(t){if(t[Symbol.asyncIterator])return t;let e=t.getReader();return{async next(){try{let r=await e.read();return r?.done&&e.releaseLock(),r}catch(r){throw e.releaseLock(),r}},async return(){let r=e.cancel();return e.releaseLock(),await r,{done:!0,value:void 0}},[Symbol.asyncIterator](){return this}}}async function iZ(t){if(t===null||typeof t!="object")return;if(t[Symbol.asyncIterator]){await t[Symbol.asyncIterator]().return?.();return}let e=t.getReader(),r=e.cancel();e.releaseLock(),await r}var mMe=({headers:t,body:e})=>({bodyHeaders:{"content-type":"application/json"},body:JSON.stringify(e)});var sZ="RFC3986",oZ=t=>String(t),aZ={RFC1738:t=>String(t).replace(/%20/g,"+"),RFC3986:oZ},gMe="RFC1738";var gD=(t,e)=>(gD=Object.hasOwn??Function.prototype.call.bind(Object.prototype.hasOwnProperty),gD(t,e)),$a=(()=>{let t=[];for(let e=0;e<256;++e)t.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return t})();var cZ=1024,_Me=(t,e,r,n,i)=>{if(t.length===0)return t;let s=t;if(typeof t=="symbol"?s=Symbol.prototype.toString.call(t):typeof t!="string"&&(s=String(t)),r==="iso-8859-1")return escape(s).replace(/%u[0-9a-f]{4}/gi,function(a){return"%26%23"+parseInt(a.slice(2),16)+"%3B"});let o="";for(let a=0;a<s.length;a+=cZ){let c=s.length>=cZ?s.slice(a,a+cZ):s,l=[];for(let u=0;u<c.length;++u){let d=c.charCodeAt(u);if(d===45||d===46||d===95||d===126||d>=48&&d<=57||d>=65&&d<=90||d>=97&&d<=122||i===gMe&&(d===40||d===41)){l[l.length]=c.charAt(u);continue}if(d<128){l[l.length]=$a[d];continue}if(d<2048){l[l.length]=$a[192|d>>6]+$a[128|d&63];continue}if(d<55296||d>=57344){l[l.length]=$a[224|d>>12]+$a[128|d>>6&63]+$a[128|d&63];continue}u+=1,d=65536+((d&1023)<<10|c.charCodeAt(u)&1023),l[l.length]=$a[240|d>>18]+$a[128|d>>12&63]+$a[128|d>>6&63]+$a[128|d&63]}o+=l.join("")}return o};function yMe(t){return!t||typeof t!="object"?!1:!!(t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer(t))}function lZ(t,e){if(Nn(t)){let r=[];for(let n=0;n<t.length;n+=1)r.push(e(t[n]));return r}return e(t)}var EMe={brackets(t){return String(t)+"[]"},comma:"comma",indices(t,e){return String(t)+"["+e+"]"},repeat(t){return String(t)}},vMe=function(t,e){Array.prototype.push.apply(t,Nn(e)?e:[e])},SMe,Dr={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:_Me,encodeValuesOnly:!1,format:sZ,formatter:oZ,indices:!1,serializeDate(t){return(SMe??(SMe=Function.prototype.call.bind(Date.prototype.toISOString)))(t)},skipNulls:!1,strictNullHandling:!1};function PDt(t){return typeof t=="string"||typeof t=="number"||typeof t=="boolean"||typeof t=="symbol"||typeof t=="bigint"}var uZ={};function bMe(t,e,r,n,i,s,o,a,c,l,u,d,f,p,h,m,_,y){let v=t,S=y,g=0,T=!1;for(;(S=S.get(uZ))!==void 0&&!T;){let A=S.get(t);if(g+=1,typeof A<"u"){if(A===g)throw new RangeError("Cyclic object value");T=!0}typeof S.get(uZ)>"u"&&(g=0)}if(typeof l=="function"?v=l(e,v):v instanceof Date?v=f?.(v):r==="comma"&&Nn(v)&&(v=lZ(v,function(A){return A instanceof Date?f?.(A):A})),v===null){if(s)return c&&!m?c(e,Dr.encoder,_,"key",p):e;v=""}if(PDt(v)||yMe(v)){if(c){let A=m?e:c(e,Dr.encoder,_,"key",p);return[h?.(A)+"="+h?.(c(v,Dr.encoder,_,"value",p))]}return[h?.(e)+"="+h?.(String(v))]}let I=[];if(typeof v>"u")return I;let x;if(r==="comma"&&Nn(v))m&&c&&(v=lZ(v,c)),x=[{value:v.length>0?v.join(",")||null:void 0}];else if(Nn(l))x=l;else{let A=Object.keys(v);x=u?A.sort(u):A}let R=a?String(e).replace(/\./g,"%2E"):String(e),O=n&&Nn(v)&&v.length===1?R+"[]":R;if(i&&Nn(v)&&v.length===0)return O+"[]";for(let A=0;A<x.length;++A){let b=x[A],L=typeof b=="object"&&typeof b.value<"u"?b.value:v[b];if(o&&L===null)continue;let C=d&&a?b.replace(/\./g,"%2E"):b,w=Nn(v)?typeof r=="function"?r(O,C):O:O+(d?"."+C:"["+C+"]");y.set(t,g);let P=new WeakMap;P.set(uZ,y),vMe(I,bMe(L,w,r,n,i,s,o,a,r==="comma"&&m&&Nn(v)?null:c,l,u,d,f,p,h,m,_,P))}return I}function CDt(t=Dr){if(typeof t.allowEmptyArrays<"u"&&typeof t.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof t.encodeDotInKeys<"u"&&typeof t.encodeDotInKeys!="boolean")throw new TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if(t.encoder!==null&&typeof t.encoder<"u"&&typeof t.encoder!="function")throw new TypeError("Encoder has to be a function.");let e=t.charset||Dr.charset;if(typeof t.charset<"u"&&t.charset!=="utf-8"&&t.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");let r=sZ;if(typeof t.format<"u"){if(!gD(aZ,t.format))throw new TypeError("Unknown format option provided.");r=t.format}let n=aZ[r],i=Dr.filter;(typeof t.filter=="function"||Nn(t.filter))&&(i=t.filter);let s;if(t.arrayFormat&&t.arrayFormat in EMe?s=t.arrayFormat:"indices"in t?s=t.indices?"indices":"repeat":s=Dr.arrayFormat,"commaRoundTrip"in t&&typeof t.commaRoundTrip!="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");let o=typeof t.allowDots>"u"?t.encodeDotInKeys?!0:Dr.allowDots:!!t.allowDots;return{addQueryPrefix:typeof t.addQueryPrefix=="boolean"?t.addQueryPrefix:Dr.addQueryPrefix,allowDots:o,allowEmptyArrays:typeof t.allowEmptyArrays=="boolean"?!!t.allowEmptyArrays:Dr.allowEmptyArrays,arrayFormat:s,charset:e,charsetSentinel:typeof t.charsetSentinel=="boolean"?t.charsetSentinel:Dr.charsetSentinel,commaRoundTrip:!!t.commaRoundTrip,delimiter:typeof t.delimiter>"u"?Dr.delimiter:t.delimiter,encode:typeof t.encode=="boolean"?t.encode:Dr.encode,encodeDotInKeys:typeof t.encodeDotInKeys=="boolean"?t.encodeDotInKeys:Dr.encodeDotInKeys,encoder:typeof t.encoder=="function"?t.encoder:Dr.encoder,encodeValuesOnly:typeof t.encodeValuesOnly=="boolean"?t.encodeValuesOnly:Dr.encodeValuesOnly,filter:i,format:r,formatter:n,serializeDate:typeof t.serializeDate=="function"?t.serializeDate:Dr.serializeDate,skipNulls:typeof t.skipNulls=="boolean"?t.skipNulls:Dr.skipNulls,sort:typeof t.sort=="function"?t.sort:null,strictNullHandling:typeof t.strictNullHandling=="boolean"?t.strictNullHandling:Dr.strictNullHandling}}function TMe(t,e={}){let r=t,n=CDt(e),i,s;typeof n.filter=="function"?(s=n.filter,r=s("",r)):Nn(n.filter)&&(s=n.filter,i=s);let o=[];if(typeof r!="object"||r===null)return"";let a=EMe[n.arrayFormat],c=a==="comma"&&n.commaRoundTrip;i||(i=Object.keys(r)),n.sort&&i.sort(n.sort);let l=new WeakMap;for(let f=0;f<i.length;++f){let p=i[f];n.skipNulls&&r[p]===null||vMe(o,bMe(r[p],p,a,c,n.allowEmptyArrays,n.strictNullHandling,n.skipNulls,n.encodeDotInKeys,n.encode?n.encoder:null,n.filter,n.sort,n.allowDots,n.serializeDate,n.format,n.formatter,n.encodeValuesOnly,n.charset,l))}let u=o.join(n.delimiter),d=n.addQueryPrefix===!0?"?":"";return n.charsetSentinel&&(n.charset==="iso-8859-1"?d+="utf8=%26%2310003%3B&":d+="utf8=%E2%9C%93&"),u.length>0?d+u:""}function wMe(t){return TMe(t,{arrayFormat:"brackets"})}function xMe(t){let e=0;for(let i of t)e+=i.length;let r=new Uint8Array(e),n=0;for(let i of t)r.set(i,n),n+=i.length;return r}var AMe;function Py(t){let e;return(AMe??(e=new globalThis.TextEncoder,AMe=e.encode.bind(e)))(t)}var RMe;function dZ(t){let e;return(RMe??(e=new globalThis.TextDecoder,RMe=e.decode.bind(e)))(t)}var Ki,Ji,Lp=class{constructor(){Ki.set(this,void 0),Ji.set(this,void 0),Ue(this,Ki,new Uint8Array,"f"),Ue(this,Ji,null,"f")}decode(e){if(e==null)return[];let r=e instanceof ArrayBuffer?new Uint8Array(e):typeof e=="string"?Py(e):e;Ue(this,Ki,xMe([Y(this,Ki,"f"),r]),"f");let n=[],i;for(;(i=kDt(Y(this,Ki,"f"),Y(this,Ji,"f")))!=null;){if(i.carriage&&Y(this,Ji,"f")==null){Ue(this,Ji,i.index,"f");continue}if(Y(this,Ji,"f")!=null&&(i.index!==Y(this,Ji,"f")+1||i.carriage)){n.push(dZ(Y(this,Ki,"f").subarray(0,Y(this,Ji,"f")-1))),Ue(this,Ki,Y(this,Ki,"f").subarray(Y(this,Ji,"f")),"f"),Ue(this,Ji,null,"f");continue}let s=Y(this,Ji,"f")!==null?i.preceding-1:i.preceding,o=dZ(Y(this,Ki,"f").subarray(0,s));n.push(o),Ue(this,Ki,Y(this,Ki,"f").subarray(i.index),"f"),Ue(this,Ji,null,"f")}return n}flush(){return Y(this,Ki,"f").length?this.decode(`
657
657
  `):[]}};Ki=new WeakMap,Ji=new WeakMap;Lp.NEWLINE_CHARS=new Set([`
658
658
  `,"\r"]);Lp.NEWLINE_REGEXP=/\r\n|[\n\r]/g;function kDt(t,e){for(let i=e??0;i<t.length;i++){if(t[i]===10)return{preceding:i,index:i+1,carriage:!1};if(t[i]===13)return{preceding:i,index:i+1,carriage:!0}}return null}function IMe(t){for(let n=0;n<t.length-1;n++){if(t[n]===10&&t[n+1]===10||t[n]===13&&t[n+1]===13)return n+2;if(t[n]===13&&t[n+1]===10&&n+3<t.length&&t[n+2]===13&&t[n+3]===10)return n+4}return-1}var yD={off:0,error:200,warn:300,info:400,debug:500},fZ=(t,e,r)=>{if(t){if(oMe(yD,t))return t;Tr(r).warn(`${e} was set to ${JSON.stringify(t)}, expected one of ${JSON.stringify(Object.keys(yD))}`)}};function c0(){}function _D(t,e,r){return!e||yD[t]>yD[r]?c0:e[t].bind(e)}var $Dt={error:c0,warn:c0,info:c0,debug:c0},OMe=new WeakMap;function Tr(t){let e=t.logger,r=t.logLevel??"off";if(!e)return $Dt;let n=OMe.get(e);if(n&&n[0]===r)return n[1];let i={error:_D("error",e,r),warn:_D("warn",e,r),info:_D("info",e,r),debug:_D("debug",e,r)};return OMe.set(e,[r,i]),i}var sl=t=>(t.options&&(t.options={...t.options},delete t.options.headers),t.headers&&(t.headers=Object.fromEntries((t.headers instanceof Headers?[...t.headers]:Object.entries(t.headers)).map(([e,r])=>[e,e.toLowerCase()==="authorization"||e.toLowerCase()==="cookie"||e.toLowerCase()==="set-cookie"?"***":r]))),"retryOfRequestLogID"in t&&(t.retryOfRequestLogID&&(t.retryOf=t.retryOfRequestLogID),delete t.retryOfRequestLogID),t);var l0,La=class t{constructor(e,r,n){this.iterator=e,l0.set(this,void 0),this.controller=r,Ue(this,l0,n,"f")}static fromSSEResponse(e,r,n,i){let s=!1,o=n?Tr(n):console;async function*a(){if(s)throw new Re("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");s=!0;let c=!1;try{for await(let l of LDt(e,r))if(!c){if(l.data.startsWith("[DONE]")){c=!0;continue}if(l.event===null||!l.event.startsWith("thread.")){let u;try{u=JSON.parse(l.data)}catch(d){throw o.error("Could not parse message into JSON:",l.data),o.error("From chunk:",l.raw),d}if(u&&u.error)throw new hr(void 0,u.error,void 0,e.headers);yield i?{event:l.event,data:u}:u}else{let u;try{u=JSON.parse(l.data)}catch(d){throw console.error("Could not parse message into JSON:",l.data),console.error("From chunk:",l.raw),d}if(l.event=="error")throw new hr(void 0,u.error,u.message,void 0);yield{event:l.event,data:u}}}c=!0}catch(l){if(i0(l))return;throw l}finally{c||r.abort()}}return new t(a,r,n)}static fromReadableStream(e,r,n){let i=!1;async function*s(){let a=new Lp,c=nZ(e);for await(let l of c)for(let u of a.decode(l))yield u;for(let l of a.flush())yield l}async function*o(){if(i)throw new Re("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");i=!0;let a=!1;try{for await(let c of s())a||c&&(yield JSON.parse(c));a=!0}catch(c){if(i0(c))return;throw c}finally{a||r.abort()}}return new t(o,r,n)}[(l0=new WeakMap,Symbol.asyncIterator)](){return this.iterator()}tee(){let e=[],r=[],n=this.iterator(),i=s=>({next:()=>{if(s.length===0){let o=n.next();e.push(o),r.push(o)}return s.shift()}});return[new t(()=>i(e),this.controller,Y(this,l0,"f")),new t(()=>i(r),this.controller,Y(this,l0,"f"))]}toReadableStream(){let e=this,r;return rZ({async start(){r=e[Symbol.asyncIterator]()},async pull(n){try{let{value:i,done:s}=await r.next();if(s)return n.close();let o=Py(JSON.stringify(i)+`
659
659
  `);n.enqueue(o)}catch(i){n.error(i)}},async cancel(){await r.return?.()}})}};async function*LDt(t,e){if(!t.body)throw e.abort(),typeof globalThis.navigator<"u"&&globalThis.navigator.product==="ReactNative"?new Re("The default react-native fetch implementation does not support streaming. Please use expo/fetch: https://docs.expo.dev/versions/latest/sdk/expo/#expofetch-api"):new Re("Attempted to iterate over a response with no body");let r=new pZ,n=new Lp,i=nZ(t.body);for await(let s of DDt(i))for(let o of n.decode(s)){let a=r.decode(o);a&&(yield a)}for(let s of n.flush()){let o=r.decode(s);o&&(yield o)}}async function*DDt(t){let e=new Uint8Array;for await(let r of t){if(r==null)continue;let n=r instanceof ArrayBuffer?new Uint8Array(r):typeof r=="string"?Py(r):r,i=new Uint8Array(e.length+n.length);i.set(e),i.set(n,e.length),e=i;let s;for(;(s=IMe(e))!==-1;)yield e.slice(0,s),e=e.slice(s)}e.length>0&&(yield e)}var pZ=class{constructor(){this.event=null,this.data=[],this.chunks=[]}decode(e){if(e.endsWith("\r")&&(e=e.substring(0,e.length-1)),!e){if(!this.event&&!this.data.length)return null;let s={event:this.event,data:this.data.join(`
@@ -678,9 +678,9 @@ https://help.openai.com/en/articles/5112595-best-practices-for-api-key-safety
678
678
  `);this.baseURL=c.baseURL,this.timeout=c.timeout??UZ.DEFAULT_TIMEOUT,this.logger=c.logger??console;let l="warn";this.logLevel=l,this.logLevel=fZ(c.logLevel,"ClientOptions.logLevel",this)??fZ(hd("OPENAI_LOG"),"process.env['OPENAI_LOG']",this)??l,this.fetchOptions=c.fetchOptions,this.maxRetries=c.maxRetries??2,this.fetch=c.fetch??hD(),Ue(this,BD,mMe,"f"),this._options=c,o&&(this._workloadIdentityAuth=new vD(o,this.fetch)),this.apiKey=typeof r=="string"?r:"Missing Key",this.organization=n,this.project=i,this.webhookSecret=s}withOptions(e){return new this.constructor({...this._options,baseURL:this.baseURL,maxRetries:this.maxRetries,timeout:this.timeout,logger:this.logger,logLevel:this.logLevel,fetch:this.fetch,fetchOptions:this.fetchOptions,apiKey:this.apiKey,workloadIdentity:this._options.workloadIdentity,organization:this.organization,project:this.project,webhookSecret:this.webhookSecret,...e})}defaultQuery(){return this._options.defaultQuery}validateHeaders({values:e,nulls:r}){}async authHeaders(e){return fe([{Authorization:`Bearer ${this.apiKey}`}])}stringifyQuery(e){return wMe(e)}getUserAgent(){return`${this.constructor.name}/JS ${ad}`}defaultIdempotencyKey(){return`stainless-node-retry-${XJ()}`}makeStatusError(e,r,n,i){return hr.generate(e,r,n,i)}async _callApiKey(){let e=this._options.apiKey;if(typeof e!="function")return!1;let r;try{r=await e()}catch(n){throw n instanceof Re?n:new Re(`Failed to get token from 'apiKey' function: ${n.message}`,{cause:n})}if(typeof r!="string"||!r)throw new Re(`Expected 'apiKey' function argument to return a string but it returned ${r}`);return this.apiKey=r,!0}buildURL(e,r,n){let i=!Y(this,MZ,"m",a1e).call(this)&&n||this.baseURL,s=sMe(e)?new URL(e):new URL(i+(i.endsWith("/")&&e.startsWith("/")?e.slice(1):e)),o=this.defaultQuery(),a=Object.fromEntries(s.searchParams);return(!tZ(o)||!tZ(a))&&(r={...a,...o,...r}),typeof r=="object"&&r&&!Array.isArray(r)&&(s.search=this.stringifyQuery(r)),s.toString()}async prepareOptions(e){await this._callApiKey()}async prepareRequest(e,{url:r,options:n}){}get(e,r){return this.methodRequest("get",e,r)}post(e,r){return this.methodRequest("post",e,r)}patch(e,r){return this.methodRequest("patch",e,r)}put(e,r){return this.methodRequest("put",e,r)}delete(e,r){return this.methodRequest("delete",e,r)}methodRequest(e,r,n){return this.request(Promise.resolve(n).then(i=>({method:e,path:r,...i})))}request(e,r=null){return new Dp(this,this.makeRequest(e,r,void 0))}async makeRequest(e,r,n){let i=await e,s=i.maxRetries??this.maxRetries;r==null&&(r=s),await this.prepareOptions(i);let{req:o,url:a,timeout:c}=await this.buildRequest(i,{retryCount:s-r});await this.prepareRequest(o,{url:a,options:i});let l="log_"+(Math.random()*(1<<24)|0).toString(16).padStart(6,"0"),u=n===void 0?"":`, retryOf: ${n}`,d=Date.now();if(Tr(this).debug(`[${l}] sending request`,sl({retryOfRequestLogID:n,method:i.method,url:a,options:i,headers:o.headers})),i.signal?.aborted)throw new Ir;let f=new AbortController,p=await this.fetchWithAuth(a,o,c,f).catch(s0),h=Date.now();if(p instanceof globalThis.Error){let y=`retrying, ${r} attempts remaining`;if(i.signal?.aborted)throw new Ir;let v=i0(p)||/timed? ?out/i.test(String(p)+("cause"in p?String(p.cause):""));if(r)return Tr(this).info(`[${l}] connection ${v?"timed out":"failed"} - ${y}`),Tr(this).debug(`[${l}] connection ${v?"timed out":"failed"} (${y})`,sl({retryOfRequestLogID:n,url:a,durationMs:h-d,message:p.message})),this.retryRequest(i,r,n??l);throw Tr(this).info(`[${l}] connection ${v?"timed out":"failed"} - error; no more retries left`),Tr(this).debug(`[${l}] connection ${v?"timed out":"failed"} (error; no more retries left)`,sl({retryOfRequestLogID:n,url:a,durationMs:h-d,message:p.message})),p instanceof $p||p instanceof o0?p:v?new od:new sd({cause:p})}let m=[...p.headers.entries()].filter(([y])=>y==="x-request-id").map(([y,v])=>", "+y+": "+JSON.stringify(v)).join(""),_=`[${l}${u}${m}] ${o.method} ${a} ${p.ok?"succeeded":"failed"} with status ${p.status} in ${h-d}ms`;if(!p.ok){if(p.status===401&&this._workloadIdentityAuth&&!i.__metadata?.hasStreamingBody&&!i.__metadata?.workloadIdentityTokenRefreshed)return await iZ(p.body),this._workloadIdentityAuth.invalidateToken(),this.makeRequest({...i,__metadata:{...i.__metadata,workloadIdentityTokenRefreshed:!0}},r,n??l);let y=await this.shouldRetry(p);if(r&&y){let x=`retrying, ${r} attempts remaining`;return await iZ(p.body),Tr(this).info(`${_} - ${x}`),Tr(this).debug(`[${l}] response error (${x})`,sl({retryOfRequestLogID:n,url:p.url,status:p.status,headers:p.headers,durationMs:h-d})),this.retryRequest(i,r,n??l,p.headers)}let v=y?"error; no more retries left":"error; not retryable";Tr(this).info(`${_} - ${v}`);let S=await p.text().catch(x=>s0(x).message),g=cMe(S),T=g?void 0:S;throw Tr(this).debug(`[${l}] response error (${v})`,sl({retryOfRequestLogID:n,url:p.url,status:p.status,headers:p.headers,message:T,durationMs:Date.now()-d})),this.makeStatusError(p.status,g,T,p.headers)}return Tr(this).info(_),Tr(this).debug(`[${l}] response start`,sl({retryOfRequestLogID:n,url:p.url,status:p.status,headers:p.headers,durationMs:h-d})),{response:p,options:i,controller:f,requestLogID:l,retryOfRequestLogID:n,startTime:d}}getAPIList(e,r,n){return this.requestAPIList(r,n&&"then"in n?n.then(i=>({method:"get",path:e,...i})):{method:"get",path:e,...n})}requestAPIList(e,r){let n=this.makeRequest(r,null,void 0);return new f0(this,n,e)}async fetchWithAuth(e,r,n,i){if(this._workloadIdentityAuth){let o=r.headers,a=o.get("Authorization");if(!a||a===`Bearer ${DZ}`){let c=await this._workloadIdentityAuth.getToken();o.set("Authorization",`Bearer ${c}`)}}return await this.fetchWithTimeout(e,r,n,i)}async fetchWithTimeout(e,r,n,i){let{signal:s,method:o,...a}=r||{},c=this._makeAbort(i);s&&s.addEventListener("abort",c,{once:!0});let l=setTimeout(c,n),u=globalThis.ReadableStream&&a.body instanceof globalThis.ReadableStream||typeof a.body=="object"&&a.body!==null&&Symbol.asyncIterator in a.body,d={signal:i.signal,...u?{duplex:"half"}:{},method:"GET",...a};o&&(d.method=o.toUpperCase());try{return await this.fetch.call(void 0,e,d)}finally{clearTimeout(l)}}async shouldRetry(e){let r=e.headers.get("x-should-retry");return r==="true"?!0:r==="false"?!1:e.status===408||e.status===409||e.status===429||e.status>=500}async retryRequest(e,r,n,i){let s,o=i?.get("retry-after-ms");if(o){let c=parseFloat(o);Number.isNaN(c)||(s=c)}let a=i?.get("retry-after");if(a&&!s){let c=parseFloat(a);Number.isNaN(c)?s=Date.parse(a)-Date.now():s=c*1e3}if(s===void 0){let c=e.maxRetries??this.maxRetries;s=this.calculateDefaultRetryTimeoutMillis(r,c)}return await ka(s),this.makeRequest(e,r-1,n)}calculateDefaultRetryTimeoutMillis(e,r){let s=r-e,o=Math.min(.5*Math.pow(2,s),8),a=1-Math.random()*.25;return o*a*1e3}async buildRequest(e,{retryCount:r=0}={}){let n={...e},{method:i,path:s,query:o,defaultBaseURL:a}=n,c=this.buildURL(s,o,a);"timeout"in n&&aMe("timeout",n.timeout),n.timeout=n.timeout??this.timeout;let{bodyHeaders:l,body:u,isStreamingBody:d}=this.buildBody({options:n});d&&(e.__metadata={...e.__metadata,hasStreamingBody:!0});let f=await this.buildHeaders({options:e,method:i,bodyHeaders:l,retryCount:r});return{req:{method:i,headers:f,...n.signal&&{signal:n.signal},...globalThis.ReadableStream&&u instanceof globalThis.ReadableStream&&{duplex:"half"},...u&&{body:u},...this.fetchOptions??{},...n.fetchOptions??{}},url:c,timeout:n.timeout}}async buildHeaders({options:e,method:r,bodyHeaders:n,retryCount:i}){let s={};this.idempotencyHeader&&r!=="get"&&(e.idempotencyKey||(e.idempotencyKey=this.defaultIdempotencyKey()),s[this.idempotencyHeader]=e.idempotencyKey);let o=fe([s,{Accept:"application/json","User-Agent":this.getUserAgent(),"X-Stainless-Retry-Count":String(i),...e.timeout?{"X-Stainless-Timeout":String(Math.trunc(e.timeout/1e3))}:{},...pMe(),"OpenAI-Organization":this.organization,"OpenAI-Project":this.project},await this.authHeaders(e),this._options.defaultHeaders,n,e.headers]);return this.validateHeaders(o),o.values}_makeAbort(e){return()=>e.abort()}buildBody({options:{body:e,headers:r}}){if(!e)return{bodyHeaders:void 0,body:void 0,isStreamingBody:!1};let n=fe([r]),i=typeof globalThis.ReadableStream<"u"&&e instanceof globalThis.ReadableStream,s=!i&&(typeof e=="string"||e instanceof ArrayBuffer||ArrayBuffer.isView(e)||typeof globalThis.Blob<"u"&&e instanceof globalThis.Blob||e instanceof URLSearchParams||e instanceof FormData);return ArrayBuffer.isView(e)||e instanceof ArrayBuffer||e instanceof DataView||typeof e=="string"&&n.values.has("content-type")||globalThis.Blob&&e instanceof globalThis.Blob||e instanceof FormData||e instanceof URLSearchParams||i?{bodyHeaders:void 0,body:e,isStreamingBody:!s}:typeof e=="object"&&(Symbol.asyncIterator in e||Symbol.iterator in e&&"next"in e&&typeof e.next=="function")?{bodyHeaders:void 0,body:mD(e),isStreamingBody:!0}:typeof e=="object"&&n.values.get("content-type")==="application/x-www-form-urlencoded"?{bodyHeaders:{"content-type":"application/x-www-form-urlencoded"},body:this.stringifyQuery(e),isStreamingBody:!1}:{...Y(this,BD,"f").call(this,{body:e,headers:n}),isStreamingBody:!1}}};UZ=Ge,BD=new WeakMap,MZ=new WeakSet,a1e=function(){return this.baseURL!=="https://api.openai.com/v1"};Ge.OpenAI=UZ;Ge.DEFAULT_TIMEOUT=6e5;Ge.OpenAIError=Re;Ge.APIError=hr;Ge.APIConnectionError=sd;Ge.APIConnectionTimeoutError=od;Ge.APIUserAbortError=Ir;Ge.NotFoundError=Ty;Ge.ConflictError=wy;Ge.RateLimitError=Ry;Ge.BadRequestError=Ey;Ge.AuthenticationError=vy;Ge.InternalServerError=xy;Ge.PermissionDeniedError=by;Ge.UnprocessableEntityError=Ay;Ge.InvalidWebhookSignatureError=Na;Ge.toFile=TD;Ge.Completions=Hp;Ge.Chat=dd;Ge.Embeddings=Wp;Ge.Files=Kp;Ge.Images=Qp;Ge.Audio=Ma;Ge.Moderations=th;Ge.Models=eh;Ge.FineTuning=Oo;Ge.Graders=Sd;Ge.VectorStores=pl;Ge.Webhooks=ih;Ge.Beta=Io;Ge.Batches=jp;Ge.Uploads=vd;Ge.Responses=dl;Ge.Realtime=ul;Ge.Conversations=_d;Ge.Evals=yd;Ge.Containers=gd;Ge.Skills=fl;Ge.Videos=nh;var Xi=ye("runner_codex"),zD="Codex CLI",fS="gpt-5.6-sol";async function KMt({aiGateway:t,config:e,model:r}){let n=r;if(t)if(e.modelVersionOverrides?.codex){let i=e.modelVersionOverrides?.codex?.[e.accountType];if(i){if(!await t.isModelAvailableForProvider("openai",i))throw new Error(`Model override '${i}' is not available for openai provider`);n=i}}else if(r){if(!await t.isModelAvailableForProvider("openai",r))throw new Error(`Model '${r}' is not available for openai provider`)}else!!fS&&await t.isModelAvailableForProvider("openai",fS)?(n=fS,Xi.log(`Using default model: ${fS}`)):fS&&Xi.log(`Default model ${fS} is not available, proceeding without model specification`);return n}var VD="netlify-ask-db",JMt=`default_permissions = "${VD}"`,ZMt=()=>bd.join(hl.env.XDG_CONFIG_HOME??bd.join(x0.homedir(),".config"),"netlify"),XMt=t=>["",`[permissions.${VD}]`,'description = "Ask mode: read-only filesystem, network access for database reads"','extends = ":read-only"',"",`[permissions.${VD}.filesystem]`,'":minimal" = "read"','"/" = "read"',`"${t}" = "write"`,"",`[permissions.${VD}.network]`,"enabled = true"];function QMt({aiGateway:t}){if(t){let{token:e,url:r}=t;if(!e||!r)throw new Error("No token or url provided from AI Gateway");hl.env.OPENAI_API_KEY=e,hl.env.OPENAI_BASE_URL=r}else if(!hl.env.OPENAI_API_KEY)throw new Error("OPENAI_API_KEY is not provided")}async function FZ({config:t,netlify:e,persistSteps:r,sendSteps:n,aiGateway:i,continueSession:s,priorAgentSessionId:o,cwd:a=hl.cwd(),abortSignal:c,onSessionId:l,effortOverride:u}){let{prompt:d}=t,{model:f}=t;QMt({aiGateway:i});let p=await KMt({config:t,aiGateway:i,model:f}),h=[],m=[],_=[],y={},v=new Set,S=0,g=0,T,I,x,R,O,A=ng(t),b=`${hl.env.NVM_BIN}/node`,L=bd.join(x0.homedir(),".codex"),C=bd.join(L,"config.toml"),w=bd.join(L,"auth.json");try{await R0.mkdir(L,{recursive:!0});let se={OPENAI_API_KEY:hl.env.OPENAI_API_KEY};await R0.writeFile(w,JSON.stringify(se,null,2),"utf-8"),Xi.log("Created Codex auth.json file");let M=hl.env.OPENAI_BASE_URL,D=['forced_login_method = "api"'],B=Be().questionsEnabled;A&&D.push(JMt),M&&D.push('model_provider = "openai_proxy"',"","[model_providers.openai_proxy]",'name = "OpenAI Proxy"',`base_url = "${M}"`,'env_key = "OPENAI_API_KEY"','wire_api = "responses"',"supports_websockets = false","requires_openai_auth = true"),B&&D.push(...Wge());let J=[];A&&(J=XMt(ZMt()),D.push(...J)),await R0.writeFile(C,`${D.join(`
679
679
  `)}
680
680
  `,"utf-8"),Xi.log("Wrote Codex config.toml",...J.length?[J.join(`
681
- `)]:[])}catch(se){let M=se instanceof Error?se.message:String(se);throw Xi.warn("Failed to setup Codex config and credentials",{error:M}),new Error(`Codex setup failed: ${M}`)}let P=p==="gpt-5.6-sol",N=eg("codex",t.effort);t.effort&&!N&&Xi.log(`Effort '${t.effort}' is not available on ${zD}; using its default`);let j=u??N??(P?"low":void 0),V=j??"high",de=!!(s&&o),Te="mode"in t&&t.mode==="ask",Ie=!!A,$e=[ca(a,"codex"),"exec",...Te&&!Ie?["--sandbox","read-only"]:[],...de?["resume",o]:[],...Te?[]:["--yolo"],"--json",...j?["-c",`model_reasoning_effort="${j}"`]:[],...p?["--model",p]:[]].filter(Boolean);Xi.log(`Running ${b} ${$e.join(" ")}`);let oe=e.utils.run(b,$e,{all:!0,cwd:a,env:{...hl.env},stdin:"pipe",idleTimeout:Wa,cancelSignal:c});oe.stdin?.end(d);let Ee=xl(()=>{r?.({steps:h,duration:g}),n?.({steps:m,duration:g}),m=[]},250),he=(se,M)=>{let D={...se,id:S};S+=1,_.push(D),h.push(D),m.push(D),M||Ee.flush(),Ee(),M&&Ee.flush()};he({title:`Using ${zD} with ${p||"default"}`,category:Q.Environment},!0);let U=YMt.createInterface({input:oe.all});U.on("error",se=>{Xi.error("Readline interface error",{error:se.message,stack:se.stack})}),U.on("line",se=>{let M;try{M=JSON.parse(se)}catch{Xi.log("Could not parse line",se);return}if(M?.duration_ms&&(g=M.duration_ms),M?.type==="thread.started"&&typeof M?.thread_id=="string"&&(x=M.thread_id,l?.(x)),M?.type==="item.started"&&M?.item?.type==="command_execution")y[M.item.id]=M.item;else if(M?.type==="item.completed"&&M?.item?.type==="command_execution"){let D=M.item,B=r1t(D);B&&he(B,!0);let J=D.command?.match(/\.agents\/skills\/([^\s/]+)/)?.[1];if(J&&!v.has(J)){v.add(J);let H=Mo(J);Ka(Xi,H),he({title:`Use ${H}`,category:Q.Skill,type:J},!0)}}else if(M?.type==="item.completed"&&M?.item?.type==="reasoning"){let D={title:"Reasoning",message:M.item.text,category:Q.Reasoning};he(D,!0)}else if(M?.type==="item.completed"&&M?.item?.type==="agent_message")T=M.item.text;else if(M?.type==="item.started"&&M?.item?.type==="mcp_tool_call"){let D=M.item;if(D.server===au&&D.tool==="ask"&&!O){let B=yu.safeParse(D.arguments);B.success?(O={questions:B.data.questions},oe.kill()):(Xi.warn("Ignoring malformed ask tool input",{toolUseId:D.id}),ge.inc("inference.malformed_ask",1))}}else if(M?.type==="turn.completed"&&M.usage)R={input_tokens:M.usage.input_tokens,output_tokens:M.usage.output_tokens},Su(R,p?{model:p}:{});else if(M?.type==="turn.failed"&&M?.error?.message)I=M.error.message;else if(M?.type==="local_shell_call"){let D=M;y[D.call_id]=D}else if(M?.type==="local_shell_call_output"){let D=M,B=y[D.call_id],J=n1t(B,D);J&&he(J,!0);let z=(B?.action?.command?.join(" ")??"").match(/\.agents\/skills\/([^\s/]+)/)?.[1];if(z&&!v.has(z)){v.add(z);let K=Mo(z);Ka(Xi,K),he({title:`Use ${K}`,category:Q.Skill,type:z},!0)}}else M?.type==="message"&&M.role==="assistant"?T=M.content?.map(D=>D.text).join(`
681
+ `)]:[])}catch(se){let M=se instanceof Error?se.message:String(se);throw Xi.warn("Failed to setup Codex config and credentials",{error:M}),new Error(`Codex setup failed: ${M}`)}let P=p==="gpt-5.6-sol",N=eg("codex",t.effort);t.effort&&!N&&Xi.log(`Effort '${t.effort}' is not available on ${zD}; using its default`);let F=u??N??(P?"low":void 0),V=F??"high",de=!!(s&&o),Te="mode"in t&&t.mode==="ask",Ie=!!A,$e=[ca(a,"codex"),"exec",...Te&&!Ie?["--sandbox","read-only"]:[],...de?["resume",o]:[],...Te?[]:["--yolo"],"--json",...F?["-c",`model_reasoning_effort="${F}"`]:[],...p?["--model",p]:[]].filter(Boolean);Xi.log(`Running ${b} ${$e.join(" ")}`);let oe=e.utils.run(b,$e,{all:!0,cwd:a,env:{...hl.env},stdin:"pipe",idleTimeout:Wa,cancelSignal:c});oe.stdin?.end(d);let Ee=xl(()=>{r?.({steps:h,duration:g}),n?.({steps:m,duration:g}),m=[]},250),he=(se,M)=>{let D={...se,id:S};S+=1,_.push(D),h.push(D),m.push(D),M||Ee.flush(),Ee(),M&&Ee.flush()},k=p||"default";t.answeredInteraction||he({title:`Using ${zD} with ${k}`,category:Q.Environment},!0);let U=YMt.createInterface({input:oe.all});U.on("error",se=>{Xi.error("Readline interface error",{error:se.message,stack:se.stack})}),U.on("line",se=>{let M;try{M=JSON.parse(se)}catch{Xi.log("Could not parse line",se);return}if(M?.duration_ms&&(g=M.duration_ms),M?.type==="thread.started"&&typeof M?.thread_id=="string"&&(x=M.thread_id,l?.(x)),M?.type==="item.started"&&M?.item?.type==="command_execution")y[M.item.id]=M.item;else if(M?.type==="item.completed"&&M?.item?.type==="command_execution"){let D=M.item,B=r1t(D);B&&he(B,!0);let J=D.command?.match(/\.agents\/skills\/([^\s/]+)/)?.[1];if(J&&!v.has(J)){v.add(J);let H=Mo(J);Ka(Xi,H),he({title:`Use ${H}`,category:Q.Skill,type:J},!0)}}else if(M?.type==="item.completed"&&M?.item?.type==="reasoning"){let D={title:"Reasoning",message:M.item.text,category:Q.Reasoning};he(D,!0)}else if(M?.type==="item.completed"&&M?.item?.type==="agent_message")T=M.item.text;else if(M?.type==="item.started"&&M?.item?.type==="mcp_tool_call"){let D=M.item;if(D.server===au&&D.tool==="ask"&&!O){let B=yu.safeParse(D.arguments);B.success?(O={questions:B.data.questions},oe.kill()):(Xi.warn("Ignoring malformed ask tool input",{toolUseId:D.id}),ge.inc("inference.malformed_ask",1))}}else if(M?.type==="turn.completed"&&M.usage)R={input_tokens:M.usage.input_tokens,output_tokens:M.usage.output_tokens},Su(R,p?{model:p}:{});else if(M?.type==="turn.failed"&&M?.error?.message)I=M.error.message;else if(M?.type==="local_shell_call"){let D=M;y[D.call_id]=D}else if(M?.type==="local_shell_call_output"){let D=M,B=y[D.call_id],J=n1t(B,D);J&&he(J,!0);let z=(B?.action?.command?.join(" ")??"").match(/\.agents\/skills\/([^\s/]+)/)?.[1];if(z&&!v.has(z)){v.add(z);let K=Mo(z);Ka(Xi,K),he({title:`Use ${K}`,category:Q.Skill,type:z},!0)}}else M?.type==="message"&&M.role==="assistant"?T=M.content?.map(D=>D.text).join(`
682
682
  `):M?.type==="message"&&M.role==="system"&&(I=M.content?.map(D=>D.text).join(`
683
- `))});let ne=!1;if(await oe.catch(se=>{ne=tg(se,c);let M=rg({catchError:se,runCmd:oe,error:I,result:T,runnerName:"Codex"});I=M.error,T=M.result}),U.close(),Ee.flush(),O)return{steps:_,duration:g,agentSessionId:x,resolvedModel:p,effort:V,usage:R,pendingInteraction:O};let F=ne;return F&&(I=void 0),{steps:_,duration:g,result:await Eu({initialResult:T,agentName:zD,hasError:!!I}),error:vu({error:I,agentName:zD}),isRetryableError:bu(I),isProviderUnavailableError:Tu(I),resolvedModel:p,effort:V,agentSessionId:x,usage:R,...F?{aborted:!0}:{}}}var c1e=async()=>{let t=bd.join(x0.homedir(),".codex");await R0.rm(t,{recursive:!0,force:!0});let e=bd.join(x0.homedir(),".agents","skills");await R0.rm(e,{recursive:!0,force:!0})},l1e={baseDir:bd.join(x0.homedir(),".codex"),include:["sessions"]},e1t=new Set(["bash","-lc"]),t1t=/^sed\s+-n\s+(?:'[^']*'|"[^"]*"|\S+)\s+(\S+)\s*$/,u1e=t=>{if(nl(t))return{title:"Generating the site",category:Q.SiteGeneration};let e=t.match(t1t);return e?{title:`Reading \`${e[1]}\``,category:Q.FileRead}:{title:`Running \`${t}\``,category:Q.RunCommand}},r1t=t=>{if(!t||t.type!=="command_execution")return null;let e=t.command;e=e.replace(/^(\/usr\/bin\/)?bash -lc ['"]/,"").replace(/['"]$/,"");let{command:r,heredocContent:n}=B1(e),{title:i,category:s}=u1e(r),o=t.aggregated_output?.trim();return n?o=`\`\`\`
683
+ `))});let ne=!1;if(await oe.catch(se=>{ne=tg(se,c);let M=rg({catchError:se,runCmd:oe,error:I,result:T,runnerName:"Codex"});I=M.error,T=M.result}),U.close(),Ee.flush(),O)return{steps:_,duration:g,agentSessionId:x,resolvedModel:p,effort:V,usage:R,pendingInteraction:O};let j=ne;return j&&(I=void 0),{steps:_,duration:g,result:await Eu({initialResult:T,agentName:zD,hasError:!!I}),error:vu({error:I,agentName:zD}),isRetryableError:bu(I),isProviderUnavailableError:Tu(I),resolvedModel:p,effort:V,agentSessionId:x,usage:R,...j?{aborted:!0}:{}}}var c1e=async()=>{let t=bd.join(x0.homedir(),".codex");await R0.rm(t,{recursive:!0,force:!0});let e=bd.join(x0.homedir(),".agents","skills");await R0.rm(e,{recursive:!0,force:!0})},l1e={baseDir:bd.join(x0.homedir(),".codex"),include:["sessions"]},e1t=new Set(["bash","-lc"]),t1t=/^sed\s+-n\s+(?:'[^']*'|"[^"]*"|\S+)\s+(\S+)\s*$/,u1e=t=>{if(nl(t))return{title:"Generating the site",category:Q.SiteGeneration};let e=t.match(t1t);return e?{title:`Reading \`${e[1]}\``,category:Q.FileRead}:{title:`Running \`${t}\``,category:Q.RunCommand}},r1t=t=>{if(!t||t.type!=="command_execution")return null;let e=t.command;e=e.replace(/^(\/usr\/bin\/)?bash -lc ['"]/,"").replace(/['"]$/,"");let{command:r,heredocContent:n}=B1(e),{title:i,category:s}=u1e(r),o=t.aggregated_output?.trim();return n?o=`\`\`\`
684
684
  ${n}
685
685
  \`\`\`${o?`
686
686
 
@@ -711,15 +711,15 @@ commandPrefix = [${i}]
711
711
  decision = "allow"
712
712
  priority = 20
713
713
  `),En.log("Ask policy allows the read-only database query command",{allowedPrefixes:i})}let n=Td.join(P0.homedir(),".gemini","ask-policy.toml");return await sh.mkdir(Td.dirname(n),{recursive:!0}),await sh.writeFile(n,r.join(`
714
- `),"utf-8"),n};async function BZ({config:t,netlify:e,persistSteps:r=void 0,sendSteps:n=void 0,aiGateway:i,continueSession:s=!1,priorAgentSessionId:o=void 0,cwd:a=hS.cwd(),cliPath:c="netlify",abortSignal:l=void 0,onSessionId:u=void 0,effortOverride:d=void 0}){let{prompt:f}=t,p=eg("gemini",t.effort);t.effort&&!p&&En.log(`Effort '${t.effort}' is not available on ${GD}; using its default`);let h=d??p;h1t({aiGateway:i});let m=await m1t({aiGateway:i,config:t,model:t.model});await f1t({model:m,effort:h});let _=[],y=[],v=[],S={},g=0,T=0,I,x,R,O,A,b=!!(s&&o),L=!1;b&&(L=await O0(o)),b&&!L&&(En.log(`Gemini resume requested for session ${o} but it was not resumable; starting a fresh session`),ge.inc("inference.native_resume",1,{outcome:"sanitize_failed"}));let C=t.mode==="ask",w=C?await g1t({config:t,cliPath:c}):void 0,P=[ca(a,"gemini"),...m?["--model",m]:[],...C?["--approval-mode","default","--policy",w]:["--yolo"],"--skip-trust","--output-format","stream-json",...L?["-r",o]:[],"-p",""],N=`${hS.env.NVM_BIN}/node`;En.log(`Running ${N} ${P.join(" ")}`);let j=e.utils.run(N,P,{all:!0,env:{...hS.env,GEMINI_CLI_NO_RELAUNCH:"1"},cwd:a,idleTimeout:Wa,cancelSignal:l});j.stdin?.end(f);let V=xl(()=>{r?.({steps:_,duration:T}),n?.({steps:y,duration:T}),y=[]},250),de=(k,U)=>{k.id=g,g+=1,v.push(k),_.push(k),y.push(k),U||V.flush(),V(),U&&V.flush()};de({title:`Using ${GD} with ${m||"default"}`,category:Q.Environment},!0);let Ie=c1t.createInterface({input:j.all});Ie.on("error",k=>{En.error("Readline interface error",{error:k.message,stack:k.stack})});let $e="",oe=()=>{$e&&de({message:$e.trim(),category:Q.AgentMessage}),$e=""};Ie.on("line",k=>{let U;try{if(k.startsWith("[API Error")){let ne=k.match(/\[api error: (.+?)]$/i)?.[1];U={type:"error",value:eE(ne,!1)?.error?.message||ne||"Gemini encountered error"}}else U=JSON.parse(k)}catch{return}if(U)switch(U.type==="init"&&typeof U.session_id=="string"&&(O=U.session_id,u?.(O)),["message","result"].includes(U.type)||oe(),U.type){case"message":{U.role!=="user"&&U.content&&($e+=U.content);break}case"tool_use":{if(U.tool_name===zge){if(U.tool_id&&!A){let z=yu.safeParse(U.parameters);z.success?(A={questions:z.data.questions},j.kill()):(En.warn("Ignoring malformed ask tool input",{toolUseId:U.tool_id}),ge.inc("inference.malformed_ask",1))}break}let ne=qZ[U.tool_name]?.name??U.tool_name,F=U.parameters?.file_path,se=F&&Td.relative(a,F),M=U.parameters?.command,D=U.tool_name==="activate_skill"&&U.parameters?.name,B=U.tool_name==="run_shell_command"&&nl(M),J=[ne,se&&`\`${se}\``,M&&`\`${M}\``].filter(Boolean).join(" ");if(D)J=`Use ${Mo(D)}`;else if(B)J="Generating the site";else if(U.tool_name==="grep_search"){let{dir_path:z,pattern:K}=U.parameters||{};z&&K?J=`Search in \`${z}\` for \`${K}\``:z?J=`Search in \`${z}\``:K&&(J=`Search for \`${K}\``)}else if(U.tool_name==="update_topic"){let z=U.parameters?.title;z&&(J=`${ne} \`${z}\``)}let H={title:J,category:B?Q.SiteGeneration:qZ[U.tool_name]?.category,...D&&{type:D}};S[U.tool_id]=H,V.flush();break}case"tool_result":{let ne=S[U.tool_id];ne&&(U.output&&(ne.message=`\`\`\`
714
+ `),"utf-8"),n};async function BZ({config:t,netlify:e,persistSteps:r=void 0,sendSteps:n=void 0,aiGateway:i,continueSession:s=!1,priorAgentSessionId:o=void 0,cwd:a=hS.cwd(),cliPath:c="netlify",abortSignal:l=void 0,onSessionId:u=void 0,effortOverride:d=void 0}){let{prompt:f}=t,p=eg("gemini",t.effort);t.effort&&!p&&En.log(`Effort '${t.effort}' is not available on ${GD}; using its default`);let h=d??p;h1t({aiGateway:i});let m=await m1t({aiGateway:i,config:t,model:t.model});await f1t({model:m,effort:h});let _=[],y=[],v=[],S={},g=0,T=0,I,x,R,O,A,b=!!(s&&o),L=!1;b&&(L=await O0(o)),b&&!L&&(En.log(`Gemini resume requested for session ${o} but it was not resumable; starting a fresh session`),ge.inc("inference.native_resume",1,{outcome:"sanitize_failed"}));let C=t.mode==="ask",w=C?await g1t({config:t,cliPath:c}):void 0,P=[ca(a,"gemini"),...m?["--model",m]:[],...C?["--approval-mode","default","--policy",w]:["--yolo"],"--skip-trust","--output-format","stream-json",...L?["-r",o]:[],"-p",""],N=`${hS.env.NVM_BIN}/node`;En.log(`Running ${N} ${P.join(" ")}`);let F=e.utils.run(N,P,{all:!0,env:{...hS.env,GEMINI_CLI_NO_RELAUNCH:"1"},cwd:a,idleTimeout:Wa,cancelSignal:l});F.stdin?.end(f);let V=xl(()=>{r?.({steps:_,duration:T}),n?.({steps:y,duration:T}),y=[]},250),de=(k,U)=>{k.id=g,g+=1,v.push(k),_.push(k),y.push(k),U||V.flush(),V(),U&&V.flush()},Te=m||"default";t.answeredInteraction||de({title:`Using ${GD} with ${Te}`,category:Q.Environment},!0);let Ie=c1t.createInterface({input:F.all});Ie.on("error",k=>{En.error("Readline interface error",{error:k.message,stack:k.stack})});let $e="",oe=()=>{$e&&de({message:$e.trim(),category:Q.AgentMessage}),$e=""};Ie.on("line",k=>{let U;try{if(k.startsWith("[API Error")){let ne=k.match(/\[api error: (.+?)]$/i)?.[1];U={type:"error",value:eE(ne,!1)?.error?.message||ne||"Gemini encountered error"}}else U=JSON.parse(k)}catch{return}if(U)switch(U.type==="init"&&typeof U.session_id=="string"&&(O=U.session_id,u?.(O)),["message","result"].includes(U.type)||oe(),U.type){case"message":{U.role!=="user"&&U.content&&($e+=U.content);break}case"tool_use":{if(U.tool_name===zge){if(U.tool_id&&!A){let z=yu.safeParse(U.parameters);z.success?(A={questions:z.data.questions},F.kill()):(En.warn("Ignoring malformed ask tool input",{toolUseId:U.tool_id}),ge.inc("inference.malformed_ask",1))}break}let ne=qZ[U.tool_name]?.name??U.tool_name,j=U.parameters?.file_path,se=j&&Td.relative(a,j),M=U.parameters?.command,D=U.tool_name==="activate_skill"&&U.parameters?.name,B=U.tool_name==="run_shell_command"&&nl(M),J=[ne,se&&`\`${se}\``,M&&`\`${M}\``].filter(Boolean).join(" ");if(D)J=`Use ${Mo(D)}`;else if(B)J="Generating the site";else if(U.tool_name==="grep_search"){let{dir_path:z,pattern:K}=U.parameters||{};z&&K?J=`Search in \`${z}\` for \`${K}\``:z?J=`Search in \`${z}\``:K&&(J=`Search for \`${K}\``)}else if(U.tool_name==="update_topic"){let z=U.parameters?.title;z&&(J=`${ne} \`${z}\``)}let H={title:J,category:B?Q.SiteGeneration:qZ[U.tool_name]?.category,...D&&{type:D}};S[U.tool_id]=H,V.flush();break}case"tool_result":{let ne=S[U.tool_id];ne&&(U.output&&(ne.message=`\`\`\`
715
715
  ${U.output.trim()}
716
- \`\`\``),de(ne,!0),p1t(ne));break}case"result":{T=U.stats?.duration_ms,U.stats&&(Su(U.stats,m?{model:m}:{}),R=U.stats),U.status==="error"?x=U.error?.message:I=$e.trim();break}case"error":{x=U.error;break}case"finished":break;case"init":break;default:{En.warn("Unhandled message type:",U.type);break}}});let Ee=!1;if(await j.catch(k=>{Ee=tg(k,l),{error:x,result:I}=l1t({catchError:k,runCmd:j,error:x,result:I,runnerName:"Gemini"})}),Ie.close(),A)return V.flush(),{steps:v,duration:T,agentSessionId:O,resolvedModel:m,usage:R,pendingInteraction:A};let he=Ee;return he&&(!I&&$e.trim()&&(I=$e.trim()),x=void 0),V.flush(),{steps:v,duration:T,result:await Eu({initialResult:I,agentName:GD,hasError:!!x}),error:vu({error:x,agentName:GD}),isRetryableError:bu(x),isProviderUnavailableError:Tu(x),resolvedModel:m,usage:R,agentSessionId:O,...h&&f1e(m)?{effort:h}:{},...he?{aborted:!0}:{}}}var p1e=async()=>{let t=Td.join(P0.homedir(),".gemini");await sh.rm(t,{recursive:!0,force:!0});let e=Td.join(P0.homedir(),".agents","skills");await sh.rm(e,{recursive:!0,force:!0})},h1e={baseDir:Td.join(P0.homedir(),".gemini"),include:["tmp"]};import VZ from"fs/promises";import S1e from"os";import C0 from"path";import GZ from"process";import S1t from"readline";import _1t from"os";import _1e from"path";import zZ from"fs";var m1e=ye("opencode_install"),g1e="1.17.19",y1t=()=>_1e.join(_1t.homedir(),".netlify-agent-runner","opencode"),WD=async t=>{let e=ca(t,"opencode");if(e)return e;let r=y1t(),n=_1e.join(r,"node_modules",".bin","opencode");if(zZ.existsSync(n))return n;zZ.mkdirSync(r,{recursive:!0}),m1e.log(`Installing opencode-ai@${g1e} on demand`);let i=Date.now();await hn("npm",["install","--no-save","--no-audit","--no-fund","--prefix",r,`opencode-ai@${g1e}`],{cwd:r});let s=Date.now()-i;if(ge.timing("opencode.install_duration",s),m1e.log(`Installed opencode-ai in ${s}ms`),!zZ.existsSync(n))throw new Error("OpenCode CLI binary not found after installing opencode-ai");return n};var ml=ye("runner_opencode"),YD="OpenCode",E1e="gateway",E1t="z-ai/glm-5.2",v1t=new Set(["z-ai/glm-5.2","deepseek/deepseek-v4-pro","x-ai/grok-4.6"]),b1t=(t,e)=>!t||!EA.includes(t)?t:e&&v1t.has(e)?"xhigh":"max",HZ={bash:{name:"Run command",category:Q.RunCommand},read:{name:"Read file",category:Q.FileRead},write:{name:"Edit file",category:Q.FileWrite},edit:{name:"Edit file",category:Q.FileWrite},glob:{name:"Find files",category:Q.Explore},grep:{name:"Search files",category:Q.Explore},list:{name:"List directory",category:Q.Explore},task:{name:"Task",category:Q.Task},todowrite:{name:"Update task list",category:Q.Todo},webfetch:{name:"Fetch web",category:Q.Web},websearch:{name:"Search web",category:Q.Web},skill:{name:"Use Skill",category:Q.Skill}},y1e=t=>HZ[t]?.name||t,T1t=t=>Array.isArray(t)?t.flatMap(e=>{let{content:r,status:n}=e??{};return typeof r!="string"||!r?[]:[{name:r,value:typeof n=="string"&&n?n:"pending"}]}):[],w1t=250,A1t=t=>{try{let e=yu.safeParse(JSON.parse(t));return e.success?e.data.questions:void 0}catch{return}},R1t=(t,e)=>{let r=!0,n=setInterval(async()=>{let i=await VZ.readFile(t,"utf-8").catch(()=>{});if(i===void 0)return;clearInterval(n),await VZ.rm(t,{force:!0}).catch(()=>{});let s=A1t(i);if(!s){ml.warn("Ignoring malformed ask tool questions file",{filePath:t}),ge.inc("inference.malformed_ask",1);return}r&&e(s)},w1t);return n.unref(),{stop:()=>{r=!1,clearInterval(n)}}};async function x1t({aiGateway:t,config:e,model:r}){let n=r;if(t){let i=t.isModelAvailable;if(!i)throw new Error("OpenCode runner requires a gateway with isModelAvailable support");let s=e.modelVersionOverrides?.opencode?.[e.accountType];s?n=s:r||(n=Be().opencodeDefaultModel||E1t),n&&(await i(n)||ml.log(`Model '${n}' not found in gateway catalog; proceeding anyway (gateway is authoritative, e.g. flag-gated OpenRouter models)`))}return n}function I1t({aiGateway:t,model:e,effort:r,questionsFilePath:n}){if(!t)throw new Error("OpenCode runner requires the AI gateway");let{token:i,url:s}=t;if(!i||!s)throw new Error("No token or url provided from AI Gateway");let o=e?{[e]:{id:e,name:e,tool_call:!0,reasoning:!0,interleaved:{field:"reasoning_details"},...r?{options:{reasoningEffort:r}}:{}}}:{},a={$schema:"https://opencode.ai/config.json",provider:{[E1e]:{api:"openai",name:"Netlify AI Gateway",options:{apiKey:i,baseURL:s},...Object.keys(o).length>0?{models:o}:{}}},...n?{mcp:Hge(n)}:{}};return{...GZ.env,OPENCODE_CONFIG_CONTENT:JSON.stringify(a),OPENCODE_DISABLE_AUTOUPDATE:"1"}}async function WZ({config:t,netlify:e,persistSteps:r,aiGateway:n,continueSession:i,priorAgentSessionId:s,cwd:o=GZ.cwd(),effortOverride:a}){let{prompt:c}=t,{model:l}=t,u=a??t.effort,d="",f,p,h,m,_=0,y=0,v,S=await x1t({config:t,aiGateway:n,model:l}),g=b1t(u,S);ml.log(u?`Requesting reasoning effort '${u}' for model '${S}'${g===u?"":` (sent as '${g}')`}; ignored if unsupported`:`No reasoning effort requested for model '${S}'; running at its own default`);let T=Be().questionsEnabled?await Gge():void 0,I=I1t({aiGateway:n,model:S,effort:g,questionsFilePath:T?.filePath}),x=[],R=[],O=0,A=Date.now(),b=await WD(o),L=["run","--format","json","--dangerously-skip-permissions","--agent","build",...S?["--model",`${E1e}/${S}`]:[],...i?s?["--session",s]:["--continue"]:[]];ml.log(`Running ${b} ${L.join(" ")}`);let C=e.utils.run(b,L,{all:!0,env:I,cwd:o,idleTimeout:Wa});C.stdin?.end(c);let w=T?R1t(T.filePath,Ee=>{v||(v={questions:Ee},C.kill())}):void 0,P=xl(()=>{r?.({steps:R,duration:Date.now()-A})},250),N=(Ee,he)=>{let{wrapMessage:k,...U}=Ee,ne=TA({...U,id:O});ne.message&&k&&(ne.message=`\`\`\`
716
+ \`\`\``),de(ne,!0),p1t(ne));break}case"result":{T=U.stats?.duration_ms,U.stats&&(Su(U.stats,m?{model:m}:{}),R=U.stats),U.status==="error"?x=U.error?.message:I=$e.trim();break}case"error":{x=U.error;break}case"finished":break;case"init":break;default:{En.warn("Unhandled message type:",U.type);break}}});let Ee=!1;if(await F.catch(k=>{Ee=tg(k,l),{error:x,result:I}=l1t({catchError:k,runCmd:F,error:x,result:I,runnerName:"Gemini"})}),Ie.close(),A)return V.flush(),{steps:v,duration:T,agentSessionId:O,resolvedModel:m,usage:R,pendingInteraction:A};let he=Ee;return he&&(!I&&$e.trim()&&(I=$e.trim()),x=void 0),V.flush(),{steps:v,duration:T,result:await Eu({initialResult:I,agentName:GD,hasError:!!x}),error:vu({error:x,agentName:GD}),isRetryableError:bu(x),isProviderUnavailableError:Tu(x),resolvedModel:m,usage:R,agentSessionId:O,...h&&f1e(m)?{effort:h}:{},...he?{aborted:!0}:{}}}var p1e=async()=>{let t=Td.join(P0.homedir(),".gemini");await sh.rm(t,{recursive:!0,force:!0});let e=Td.join(P0.homedir(),".agents","skills");await sh.rm(e,{recursive:!0,force:!0})},h1e={baseDir:Td.join(P0.homedir(),".gemini"),include:["tmp"]};import VZ from"fs/promises";import S1e from"os";import C0 from"path";import GZ from"process";import S1t from"readline";import _1t from"os";import _1e from"path";import zZ from"fs";var m1e=ye("opencode_install"),g1e="1.17.19",y1t=()=>_1e.join(_1t.homedir(),".netlify-agent-runner","opencode"),WD=async t=>{let e=ca(t,"opencode");if(e)return e;let r=y1t(),n=_1e.join(r,"node_modules",".bin","opencode");if(zZ.existsSync(n))return n;zZ.mkdirSync(r,{recursive:!0}),m1e.log(`Installing opencode-ai@${g1e} on demand`);let i=Date.now();await hn("npm",["install","--no-save","--no-audit","--no-fund","--prefix",r,`opencode-ai@${g1e}`],{cwd:r});let s=Date.now()-i;if(ge.timing("opencode.install_duration",s),m1e.log(`Installed opencode-ai in ${s}ms`),!zZ.existsSync(n))throw new Error("OpenCode CLI binary not found after installing opencode-ai");return n};var ml=ye("runner_opencode"),YD="OpenCode",E1e="gateway",E1t="z-ai/glm-5.2",v1t=new Set(["z-ai/glm-5.2","deepseek/deepseek-v4-pro","x-ai/grok-4.6"]),b1t=(t,e)=>!t||!EA.includes(t)?t:e&&v1t.has(e)?"xhigh":"max",HZ={bash:{name:"Run command",category:Q.RunCommand},read:{name:"Read file",category:Q.FileRead},write:{name:"Edit file",category:Q.FileWrite},edit:{name:"Edit file",category:Q.FileWrite},glob:{name:"Find files",category:Q.Explore},grep:{name:"Search files",category:Q.Explore},list:{name:"List directory",category:Q.Explore},task:{name:"Task",category:Q.Task},todowrite:{name:"Update task list",category:Q.Todo},webfetch:{name:"Fetch web",category:Q.Web},websearch:{name:"Search web",category:Q.Web},skill:{name:"Use Skill",category:Q.Skill}},y1e=t=>HZ[t]?.name||t,T1t=t=>Array.isArray(t)?t.flatMap(e=>{let{content:r,status:n}=e??{};return typeof r!="string"||!r?[]:[{name:r,value:typeof n=="string"&&n?n:"pending"}]}):[],w1t=250,A1t=t=>{try{let e=yu.safeParse(JSON.parse(t));return e.success?e.data.questions:void 0}catch{return}},R1t=(t,e)=>{let r=!0,n=setInterval(async()=>{let i=await VZ.readFile(t,"utf-8").catch(()=>{});if(i===void 0)return;clearInterval(n),await VZ.rm(t,{force:!0}).catch(()=>{});let s=A1t(i);if(!s){ml.warn("Ignoring malformed ask tool questions file",{filePath:t}),ge.inc("inference.malformed_ask",1);return}r&&e(s)},w1t);return n.unref(),{stop:()=>{r=!1,clearInterval(n)}}};async function x1t({aiGateway:t,config:e,model:r}){let n=r;if(t){let i=t.isModelAvailable;if(!i)throw new Error("OpenCode runner requires a gateway with isModelAvailable support");let s=e.modelVersionOverrides?.opencode?.[e.accountType];s?n=s:r||(n=Be().opencodeDefaultModel||E1t),n&&(await i(n)||ml.log(`Model '${n}' not found in gateway catalog; proceeding anyway (gateway is authoritative, e.g. flag-gated OpenRouter models)`))}return n}function I1t({aiGateway:t,model:e,effort:r,questionsFilePath:n}){if(!t)throw new Error("OpenCode runner requires the AI gateway");let{token:i,url:s}=t;if(!i||!s)throw new Error("No token or url provided from AI Gateway");let o=e?{[e]:{id:e,name:e,tool_call:!0,reasoning:!0,interleaved:{field:"reasoning_details"},...r?{options:{reasoningEffort:r}}:{}}}:{},a={$schema:"https://opencode.ai/config.json",provider:{[E1e]:{api:"openai",name:"Netlify AI Gateway",options:{apiKey:i,baseURL:s},...Object.keys(o).length>0?{models:o}:{}}},...n?{mcp:Hge(n)}:{}};return{...GZ.env,OPENCODE_CONFIG_CONTENT:JSON.stringify(a),OPENCODE_DISABLE_AUTOUPDATE:"1"}}async function WZ({config:t,netlify:e,persistSteps:r,aiGateway:n,continueSession:i,priorAgentSessionId:s,cwd:o=GZ.cwd(),effortOverride:a}){let{prompt:c}=t,{model:l}=t,u=a??t.effort,d="",f,p,h,m,_=0,y=0,v,S=await x1t({config:t,aiGateway:n,model:l}),g=b1t(u,S);ml.log(u?`Requesting reasoning effort '${u}' for model '${S}'${g===u?"":` (sent as '${g}')`}; ignored if unsupported`:`No reasoning effort requested for model '${S}'; running at its own default`);let T=Be().questionsEnabled?await Gge():void 0,I=I1t({aiGateway:n,model:S,effort:g,questionsFilePath:T?.filePath}),x=[],R=[],O=0,A=Date.now(),b=await WD(o),L=["run","--format","json","--dangerously-skip-permissions","--agent","build",...S?["--model",`${E1e}/${S}`]:[],...i?s?["--session",s]:["--continue"]:[]];ml.log(`Running ${b} ${L.join(" ")}`);let C=e.utils.run(b,L,{all:!0,env:I,cwd:o,idleTimeout:Wa});C.stdin?.end(c);let w=T?R1t(T.filePath,Ee=>{v||(v={questions:Ee},C.kill())}):void 0,P=xl(()=>{r?.({steps:R,duration:Date.now()-A})},250),N=(Ee,he)=>{let{wrapMessage:k,...U}=Ee,ne=TA({...U,id:O});ne.message&&k&&(ne.message=`\`\`\`
717
717
  ${ne.message}
718
- \`\`\``),O+=1,x.push(ne),R.push(ne),he||P.flush(),P(),he&&P.flush()};N({title:`Using ${YD} with ${S||"default"}`,category:Q.Environment},!0);let V=S1t.createInterface({input:C.all});V.on("error",Ee=>{ml.error("Readline interface error",{error:Ee.message,stack:Ee.stack})});let de="",Te,Ie=new Set,$e=()=>{de&&(N({message:de,category:Q.AgentMessage}),Te=de,de="")};V.on("line",Ee=>{let he;try{he=JSON.parse(Ee)}catch{ml.log("Could not parse line",Ee);return}switch(he.sessionID&&he.sessionID!==d&&(d=he.sessionID),he.type){case"step_start":{$e();break}case"text":{let k=he.part?.text;k&&(de+=k);break}case"reasoning":{$e();let k=he.part?.text;k&&N({title:"Reasoning",message:k,category:Q.Reasoning},!0);break}case"tool_use":{$e();let k=he.part?.tool;if(!k)break;let U=he.part?.state?.input??{},ne=he.part?.state?.status,F=he.part?.state?.output,se=he.part?.state?.error;if(k===Vge){ne==="error"&&ml.warn("Ask tool call rejected before it could pause the run",{error:se});break}if(ne==="error"&&(_+=1),(ne==="completed"||ne==="error")&&(y+=1),k==="skill"){let re=typeof U.name=="string"?U.name:void 0;if(re){let Oe=Mo(re);Ka(ml,Oe),N({title:`Use ${Oe}`,category:Q.Skill,type:re},!0);break}}if(k==="todowrite"){let re=T1t(U.todos);N({title:y1e(k),category:re.length>0?HZ.todowrite.category:Q.Tool,...re.length>0?{tasks:re}:{}},!0);break}let M=typeof U.command=="string"?U.command:void 0,D=M?nl(M):!1,B=typeof U.path=="string"&&U.path||typeof U.file_path=="string"&&U.file_path||typeof U.pattern=="string"&&U.pattern||void 0,J,H;if(D)J="Generating the site",H=Q.SiteGeneration;else if(M&&k==="bash")J=`Running \`${M}\``,H=Q.RunCommand;else{let re=B&&`\`${C0.relative(o,B)}\``;J=[y1e(k),re].filter(Boolean).join(" "),H=HZ[k]?.category||Q.AgentMessage}let z,K=["bash","read","glob","grep","list","webfetch","websearch"].includes(k);se?z=`\`\`\`
718
+ \`\`\``),O+=1,x.push(ne),R.push(ne),he||P.flush(),P(),he&&P.flush()},F=S||"default";t.answeredInteraction||N({title:`Using ${YD} with ${F}`,category:Q.Environment},!0);let V=S1t.createInterface({input:C.all});V.on("error",Ee=>{ml.error("Readline interface error",{error:Ee.message,stack:Ee.stack})});let de="",Te,Ie=new Set,$e=()=>{de&&(N({message:de,category:Q.AgentMessage}),Te=de,de="")};V.on("line",Ee=>{let he;try{he=JSON.parse(Ee)}catch{ml.log("Could not parse line",Ee);return}switch(he.sessionID&&he.sessionID!==d&&(d=he.sessionID),he.type){case"step_start":{$e();break}case"text":{let k=he.part?.text;k&&(de+=k);break}case"reasoning":{$e();let k=he.part?.text;k&&N({title:"Reasoning",message:k,category:Q.Reasoning},!0);break}case"tool_use":{$e();let k=he.part?.tool;if(!k)break;let U=he.part?.state?.input??{},ne=he.part?.state?.status,j=he.part?.state?.output,se=he.part?.state?.error;if(k===Vge){ne==="error"&&ml.warn("Ask tool call rejected before it could pause the run",{error:se});break}if(ne==="error"&&(_+=1),(ne==="completed"||ne==="error")&&(y+=1),k==="skill"){let re=typeof U.name=="string"?U.name:void 0;if(re){let Oe=Mo(re);Ka(ml,Oe),N({title:`Use ${Oe}`,category:Q.Skill,type:re},!0);break}}if(k==="todowrite"){let re=T1t(U.todos);N({title:y1e(k),category:re.length>0?HZ.todowrite.category:Q.Tool,...re.length>0?{tasks:re}:{}},!0);break}let M=typeof U.command=="string"?U.command:void 0,D=M?nl(M):!1,B=typeof U.path=="string"&&U.path||typeof U.file_path=="string"&&U.file_path||typeof U.pattern=="string"&&U.pattern||void 0,J,H;if(D)J="Generating the site",H=Q.SiteGeneration;else if(M&&k==="bash")J=`Running \`${M}\``,H=Q.RunCommand;else{let re=B&&`\`${C0.relative(o,B)}\``;J=[y1e(k),re].filter(Boolean).join(" "),H=HZ[k]?.category||Q.AgentMessage}let z,K=["bash","read","glob","grep","list","webfetch","websearch"].includes(k);se?z=`\`\`\`
719
719
  ${se.trim()}
720
- \`\`\``:F&&(z=K?`\`\`\`
721
- ${F.trim()}
722
- \`\`\``:F.trim()),ne==="error"&&se&&(z=z?`${z}
720
+ \`\`\``:j&&(z=K?`\`\`\`
721
+ ${j.trim()}
722
+ \`\`\``:j.trim()),ne==="error"&&se&&(z=z?`${z}
723
723
 
724
724
  *Command failed*`:`*Command failed: ${se.trim()}*`),N({title:J,message:z,category:H},!0);break}case"step_finish":{$e();let k=he.part?.tokens;k&&(h={input_tokens:(h?.input_tokens??0)+(k.input??0),output_tokens:(h?.output_tokens??0)+(k.output??0),reasoning_output_tokens:(h?.reasoning_output_tokens??0)+(k.reasoning??0),cache_creation_input_tokens:(h?.cache_creation_input_tokens??0)+(k.cache?.write??0),cache_read_input_tokens:(h?.cache_read_input_tokens??0)+(k.cache?.read??0)}),he.part?.cost!=null&&(m=(m??0)+he.part.cost);break}case"error":{$e();let U=he.error?.data?.message??he.error?.message??he.part?.state?.error??(he.error?JSON.stringify(he.error).slice(0,500):"unknown error");p=p?`${p}
725
725
  ${U}`:U;break}default:he.type&&!Ie.has(he.type)&&(Ie.add(he.type),ml.log(`Unhandled opencode event type: ${he.type}`))}}),await C.catch(Ee=>{$e();let he=rg({catchError:Ee,runCmd:C,error:p,result:f??Te,runnerName:YD});p=he.error,f=he.result}),w?.stop(),await T?.remove();let oe=Date.now()-A;return $e(),V.close(),P.flush(),!p&&!f&&Te&&(f=Te),h&&Su(h,S?{model:S}:{}),v?{steps:x,duration:oe,agentSessionId:d,resolvedModel:S,effort:u,resolvedProviderEffort:g,usage:h,costUsd:m,toolErrorCount:_,toolCallCount:y,pendingInteraction:v}:{steps:x,duration:oe,result:await Eu({initialResult:f,agentName:YD,hasError:!!p}),error:vu({error:p,agentName:YD}),isRetryableError:bu(p),isProviderUnavailableError:Tu(p),agentSessionId:d,resolvedModel:S,effort:u,resolvedProviderEffort:g,usage:h,costUsd:m,toolErrorCount:_,toolCallCount:y}}var O1t=()=>C0.join(S1e.homedir(),".config","opencode"),v1e=()=>{let t=GZ.env.XDG_DATA_HOME,e=t&&C0.isAbsolute(t)?t:C0.join(S1e.homedir(),".local","share");return C0.join(e,"opencode")},b1e=async()=>{let t=[O1t(),v1e()];await Promise.all(t.map(e=>VZ.rm(e,{recursive:!0,force:!0})))},T1e={baseDir:v1e(),include:["opencode.db","opencode.db-shm","opencode.db-wal"]};var YZ={codex:{runner:FZ,clean:c1e,nativeSessionArchive:l1e},claude:{runner:ZJ,clean:nMe,nativeSessionArchive:iMe},gemini:{runner:BZ,clean:p1e,nativeSessionArchive:h1e},opencode:{runner:WZ,clean:b1e,nativeSessionArchive:T1e}},KZ=Object.keys(YZ),gl=t=>YZ[t]?.nativeSessionArchive,mS=YZ;import{readFileSync as S3t}from"fs";import E3t from"path";import{createRequire as v3t}from"module";var P1t=["error","failed","exception","fatal","panic","abort","crash"];function w1e(t){let e=t.split(`
@@ -754,7 +754,7 @@ case "$1" in
754
754
  exit 1
755
755
  ;;
756
756
  esac
757
- `,lUe=async()=>{let t="/tmp/netlify-git-wrapper",e=bUt.join(t,"git"),r="/usr/bin/git";try{let n=(gS.env.PATH||"").split(":").filter(i=>i!==t).join(":");r=vUt("which git",{env:{...gS.env,PATH:n}}).toString().trim()||r}catch{}try{await aUe.mkdir(t,{recursive:!0}),await aUe.writeFile(e,wUt(r),{mode:493}),gS.env.PATH?.split(":").includes(t)||(gS.env.PATH=`${t}:${gS.env.PATH}`),gS.env.NETLIFY_INTERNAL_GIT="0",cUe.info("Installed git wrapper to restrict the agent to read-only git commands")}catch(n){cUe.warn("Failed to install git wrapper",{error:n?.message||n}),ge.inc("context.degraded",1,{component:"git_wrapper"})}};var U0=ye("init_stage"),xUt=async(t,e)=>{let r=RUt.join(e,rn,zs,t);try{return(await AUt.readdir(r,{withFileTypes:!0})).filter(i=>i.isFile()&&!i.name.endsWith(".part")).length}catch{return 0}},IUt=async(t,e)=>{if(!(!Be().fetchAssetsEnabled||!t.assetMap))try{await W1e({assetMap:t.assetMap,cwd:e})}catch(r){let n=Rl(r)?r.kind:"unknown";throw n==="unknown"&&U0.error("Failed to fetch session assets",{error:r?.message||r}),ge.inc("assets.fetch_failed",1,{kind:n}),new Error("Failed to download the attachments uploaded for this session. Please try again.")}},uUe=async({config:t,apiThrottle:e,apiToken:r,cwd:n,runnerVersion:i})=>await Gt(mt(),"init-stage",async s=>{let o=performance.now();s?.setAttributes({"init.runner":t.runner,"init.id":t.id,"init.sessionId":t.sessionId,"init.hasRepo":t.hasRepo,"init.useGateway":t.useGateway,"init.runnerVersion":i||"unknown"});let a=mS[t.runner];if(!a)throw s?.setAttributes({"init.error":"unsupported_runner"}),new Error(`${t.runner} is not supported`);if(t.runner==="opencode"&&!Be().opencodeEnabled)throw s?.setAttributes({"init.error":"opencode_disabled"}),new Error("opencode runner is not enabled on this environment");let c=OUt({apiToken:r,config:t});if(x1e(c),t.siteId)try{t.site=await P1e(t.siteId)}catch(y){U0.error("Failed to get the site information",{error:y})}let l=t.useGateway?await V1e({config:t}):void 0;s?.setAttributes({"init.aiGateway.created":!!l}),await Ln(t.id,t.sessionId,{steps:[{title:"Environment ready",category:Q.Environment,type:"ready"}]});let u=5*1024,d=1e4,f=bA(async({steps:y=[],duration:v})=>{let S=y.map(g=>{let T=g.title?z1(ws(g.title),u):void 0,I=g.category===Q.AgentMessage||g.category===Q.SubagentPrompt,x=g.message?ws(g.message):void 0,R=x&&!I?z1(x,d):x,O=g.category===Q.SubagentPrompt,A=R&&!O?$P(R):R;return A!==R&&U0.info("Sanitized internal error from step message",{original:R}),{...g,title:T,message:A}});y.length=0;try{return await Ln(t.id,t.sessionId,{steps:S,duration:v})}catch(g){U0.error("persistSteps failed",{error:g?.message||g})}},e);U0.info("Adding build files to stage");let p=await iX();await tX(p),F0.env.NETLIFY_LOCAL_MODE||await lUe();let h;t.hasRepo?t.sha?(h=t.sha,s?.setAttributes({"init.sha.source":"provided"})):(h=await nX(),t.mode!=="redeploy"&&await ZD(t.id,{sha:h}),s?.setAttributes({"init.sha.source":"current_commit"})):(h=await nUe(),s?.setAttributes({"init.sha.source":"first_commit","init.source":"zip"})),t.runSha=await nX(),await IUt(t,n);let m=await xUt(t.sessionId,n??F0.cwd());ge.inc("assets.session",1,{has_assets:m>0}),m>0&&ge.distribution("assets.session.count",m);let _=performance.now()-o;return s?.setAttributes({"init.sha":h||"unknown","init.duration.ms":_,"init.status":"success","init.assetCount":m}),{aiGateway:l,context:c,persistSteps:f,runner:a,sha:h}}),OUt=({apiToken:t,config:e})=>({constants:{NETLIFY_API_HOST:F0.env.NETLIFY_API_HOST||"api.netlify.com",NETLIFY_API_TOKEN:t||F0.env.NETLIFY_API_TOKEN,SITE_ID:e.siteId,FUNCTIONS_DIST:F0.env.FUNCTIONS_DIST||"netlify/functions"},utils:{run:hn}});Ne();import MUt from"crypto";import Or from"fs/promises";import sM from"os";import wt from"path";import ja from"process";import{fileURLToPath as UUt}from"url";import PUt from"path";var dUe={ask:'"Ask mode", which can explore and answer questions but not edit or deploy',build:'"Build mode", which can edit files and deploy'},CUt=t=>t==="ask"?"build":"ask",sX=t=>`This run is in ${dUe[t]}; the other mode is ${dUe[CUt(t)]}. Use these exact names when you refer to the modes, e.g. "switch to Build mode" \u2014 never "write mode", "execution mode", "read-only mode" or any other wording.`,NUt=`<responses>
757
+ `,lUe=async()=>{let t="/tmp/netlify-git-wrapper",e=bUt.join(t,"git"),r="/usr/bin/git";try{let n=(gS.env.PATH||"").split(":").filter(i=>i!==t).join(":");r=vUt("which git",{env:{...gS.env,PATH:n}}).toString().trim()||r}catch{}try{await aUe.mkdir(t,{recursive:!0}),await aUe.writeFile(e,wUt(r),{mode:493}),gS.env.PATH?.split(":").includes(t)||(gS.env.PATH=`${t}:${gS.env.PATH}`),gS.env.NETLIFY_INTERNAL_GIT="0",cUe.info("Installed git wrapper to restrict the agent to read-only git commands")}catch(n){cUe.warn("Failed to install git wrapper",{error:n?.message||n}),ge.inc("context.degraded",1,{component:"git_wrapper"})}};var U0=ye("init_stage"),xUt=async(t,e)=>{let r=RUt.join(e,rn,zs,t);try{return(await AUt.readdir(r,{withFileTypes:!0})).filter(i=>i.isFile()&&!i.name.endsWith(".part")).length}catch{return 0}},IUt=async(t,e)=>{if(!(!Be().fetchAssetsEnabled||!t.assetMap))try{await W1e({assetMap:t.assetMap,cwd:e})}catch(r){let n=Rl(r)?r.kind:"unknown";throw n==="unknown"&&U0.error("Failed to fetch session assets",{error:r?.message||r}),ge.inc("assets.fetch_failed",1,{kind:n}),new Error("Failed to download the attachments uploaded for this session. Please try again.")}},uUe=async({config:t,apiThrottle:e,apiToken:r,cwd:n,runnerVersion:i})=>await Gt(mt(),"init-stage",async s=>{let o=performance.now();s?.setAttributes({"init.runner":t.runner,"init.id":t.id,"init.sessionId":t.sessionId,"init.hasRepo":t.hasRepo,"init.useGateway":t.useGateway,"init.runnerVersion":i||"unknown"});let a=mS[t.runner];if(!a)throw s?.setAttributes({"init.error":"unsupported_runner"}),new Error(`${t.runner} is not supported`);if(t.runner==="opencode"&&!Be().opencodeEnabled)throw s?.setAttributes({"init.error":"opencode_disabled"}),new Error("opencode runner is not enabled on this environment");let c=OUt({apiToken:r,config:t});if(x1e(c),t.siteId)try{t.site=await P1e(t.siteId)}catch(y){U0.error("Failed to get the site information",{error:y})}let l=t.useGateway?await V1e({config:t}):void 0;s?.setAttributes({"init.aiGateway.created":!!l}),t.answeredInteraction||await Ln(t.id,t.sessionId,{steps:[{title:"Environment ready",category:Q.Environment,type:"ready"}]});let u=5*1024,d=1e4,f=bA(async({steps:y=[],duration:v})=>{let S=y.map(g=>{let T=g.title?z1(ws(g.title),u):void 0,I=g.category===Q.AgentMessage||g.category===Q.SubagentPrompt,x=g.message?ws(g.message):void 0,R=x&&!I?z1(x,d):x,O=g.category===Q.SubagentPrompt,A=R&&!O?$P(R):R;return A!==R&&U0.info("Sanitized internal error from step message",{original:R}),{...g,title:T,message:A}});y.length=0;try{return await Ln(t.id,t.sessionId,{steps:S,duration:v})}catch(g){U0.error("persistSteps failed",{error:g?.message||g})}},e);U0.info("Adding build files to stage");let p=await iX();await tX(p),F0.env.NETLIFY_LOCAL_MODE||await lUe();let h;t.hasRepo?t.sha?(h=t.sha,s?.setAttributes({"init.sha.source":"provided"})):(h=await nX(),t.mode!=="redeploy"&&await ZD(t.id,{sha:h}),s?.setAttributes({"init.sha.source":"current_commit"})):(h=await nUe(),s?.setAttributes({"init.sha.source":"first_commit","init.source":"zip"})),t.runSha=await nX(),await IUt(t,n);let m=await xUt(t.sessionId,n??F0.cwd());ge.inc("assets.session",1,{has_assets:m>0}),m>0&&ge.distribution("assets.session.count",m);let _=performance.now()-o;return s?.setAttributes({"init.sha":h||"unknown","init.duration.ms":_,"init.status":"success","init.assetCount":m}),{aiGateway:l,context:c,persistSteps:f,runner:a,sha:h}}),OUt=({apiToken:t,config:e})=>({constants:{NETLIFY_API_HOST:F0.env.NETLIFY_API_HOST||"api.netlify.com",NETLIFY_API_TOKEN:t||F0.env.NETLIFY_API_TOKEN,SITE_ID:e.siteId,FUNCTIONS_DIST:F0.env.FUNCTIONS_DIST||"netlify/functions"},utils:{run:hn}});Ne();import MUt from"crypto";import Or from"fs/promises";import sM from"os";import wt from"path";import ja from"process";import{fileURLToPath as UUt}from"url";import PUt from"path";var dUe={ask:'"Ask mode", which can explore and answer questions but not edit or deploy',build:'"Build mode", which can edit files and deploy'},CUt=t=>t==="ask"?"build":"ask",sX=t=>`This run is in ${dUe[t]}; the other mode is ${dUe[CUt(t)]}. Use these exact names when you refer to the modes, e.g. "switch to Build mode" \u2014 never "write mode", "execution mode", "read-only mode" or any other wording.`,NUt=`<responses>
758
758
  - ${sX("ask")}
759
759
  - Write progress updates in concise, present-tense language describing what is happening now (e.g. "Reading the routing setup", "Checking the deploy configuration"). Avoid third-person self-reference (e.g. "the agent"), and avoid future-tense phrasing like "will".
760
760
  - Answer the user's question by exploring the project (read files, search, browse the web). Do NOT modify project files, run mutating commands, or attempt to build or deploy. No deploy is created for this run.
@@ -868,7 +868,7 @@ ${r.siteContext.filter(I=>I.site_context).map(I=>typeof I.site_context=="string"
868
868
 
869
869
  `)}
870
870
  </project_rules>
871
- `);let m="";if(r.sessionHistoryContext?.length){let T=wt.join(ja.cwd(),rn,k1);await Or.mkdir(T,{recursive:!0});let I=await Promise.all(r.sessionHistoryContext.map(async(x,R)=>{let O=R+1,A=`attempt-${O}.md`,b=wt.join(T,A),L=wt.join(rn,k1,A),C=aM(x.id),w=C?` ID ${C}`:"",P="";if(C){let j=wt.resolve(c,zs),V=wt.resolve(j,C);V.startsWith(j+wt.sep)&&await oM(V)&&(P=`
871
+ `);let m="";if(r.sessionHistoryContext?.length){let T=wt.join(ja.cwd(),rn,k1);await Or.mkdir(T,{recursive:!0});let I=await Promise.all(r.sessionHistoryContext.map(async(x,R)=>{let O=R+1,A=`attempt-${O}.md`,b=wt.join(T,A),L=wt.join(rn,k1,A),C=aM(x.id),w=C?` ID ${C}`:"",P="";if(C){let F=wt.resolve(c,zs),V=wt.resolve(F,C);V.startsWith(F+wt.sep)&&await oM(V)&&(P=`
872
872
  ---
873
873
 
874
874
  ## Assets: ${V}/
@@ -907,10 +907,10 @@ Use the following file for the complete context of the ask, the environment, and
907
907
  `);return[t,WSe(n,{skipNote:r&&!i?'A "(skipped)" answer means the user chose not to answer; proceed with your best judgment there.':"",overrideInstruction:i||void 0})].filter(Boolean).join(`
908
908
 
909
909
  `)};import El from"fs/promises";import $Be from"os";import vl from"path";import{rm as jQ}from"fs/promises";import{resolve as nFt}from"path";var iFt=".netlify/cache/",ch=function({cacheDir:t=iFt,cwd:e="."}={}){return nFt(e,t)};import{promises as lVt}from"fs";import{basename as sBe,dirname as oBe,join as uVt}from"path";import Azt from"process";import Rzt from"events";import Rt from"path";import xzt from"os";async function q0(t,e,{concurrency:r=Number.POSITIVE_INFINITY,stopOnError:n=!0,signal:i}={}){return new Promise((s,o)=>{if(t[Symbol.iterator]===void 0&&t[Symbol.asyncIterator]===void 0)throw new TypeError(`Expected \`input\` to be either an \`Iterable\` or \`AsyncIterable\`, got (${typeof t})`);if(typeof e!="function")throw new TypeError("Mapper function is required");if(!(Number.isSafeInteger(r)&&r>=1||r===Number.POSITIVE_INFINITY))throw new TypeError(`Expected \`concurrency\` to be an integer from 1 and up or \`Infinity\`, got \`${r}\` (${typeof r})`);let a=[],c=[],l=new Map,u=!1,d=!1,f=!1,p=0,h=0,m=t[Symbol.iterator]===void 0?t[Symbol.asyncIterator]():t[Symbol.iterator](),_=()=>{S(i.reason)},y=()=>{i?.removeEventListener("abort",_)},v=T=>{s(T),y()},S=T=>{u=!0,d=!0,o(T),y()};i&&(i.aborted&&S(i.reason),i.addEventListener("abort",_,{once:!0}));let g=async()=>{if(d)return;let T=await m.next(),I=h;if(h++,T.done){if(f=!0,p===0&&!d){if(!n&&c.length>0){S(new AggregateError(c));return}if(d=!0,l.size===0){v(a);return}let x=[];for(let[R,O]of a.entries())l.get(R)!==kUe&&x.push(O);v(x)}return}p++,(async()=>{try{let x=await T.value;if(d)return;let R=await e(x,I);R===kUe&&l.set(I,R),a[I]=R,p--,await g()}catch(x){if(n)S(x);else{c.push(x),p--;try{await g()}catch(R){S(R)}}}})()};(async()=>{for(let T=0;T<r;T++){try{await g()}catch(I){S(I);break}if(f||u)break}})()})}var kUe=Symbol("skip");import uh from"path";import BFr,{constants as gX}from"fs";import _X from"fs/promises";var cX=class extends Error{constructor(e){super(e),this.name="TimeoutError"}},lX=class extends Error{constructor(e){super(),this.name="AbortError",this.message=e}},$Ue=t=>globalThis.DOMException===void 0?new lX(t):new DOMException(t),LUe=t=>{let e=t.reason===void 0?$Ue("This operation was aborted."):t.reason;return e instanceof Error?e:$Ue(e)};function uX(t,e){let{milliseconds:r,fallback:n,message:i,customTimers:s={setTimeout,clearTimeout}}=e,o,a,l=new Promise((u,d)=>{if(typeof r!="number"||Math.sign(r)!==1)throw new TypeError(`Expected \`milliseconds\` to be a positive number, got \`${r}\``);if(e.signal){let{signal:p}=e;p.aborted&&d(LUe(p)),a=()=>{d(LUe(p))},p.addEventListener("abort",a,{once:!0})}if(r===Number.POSITIVE_INFINITY){t.then(u,d);return}let f=new cX;o=s.setTimeout.call(void 0,()=>{if(n){try{u(n())}catch(p){d(p)}return}typeof t.cancel=="function"&&t.cancel(),i===!1?u():i instanceof Error?d(i):(f.message=i??`Promise timed out after ${r} milliseconds`,d(f))},r),(async()=>{try{u(await t)}catch(p){d(p)}})()}).finally(()=>{l.clear(),a&&e.signal&&e.signal.removeEventListener("abort",a)});return l.clear=()=>{s.clearTimeout.call(void 0,o),o=void 0},l}var sFt=t=>{let e=t.addEventListener||t.on||t.addListener,r=t.removeEventListener||t.off||t.removeListener;if(!e||!r)throw new TypeError("Emitter is not compatible");return{addListener:e.bind(t),removeListener:r.bind(t)}};function oFt(t,e,r){let n,i=new Promise((s,o)=>{if(r={rejectionEvents:["error"],multiArgs:!1,resolveImmediately:!1,...r},!(r.count>=0&&(r.count===Number.POSITIVE_INFINITY||Number.isInteger(r.count))))throw new TypeError("The `count` option should be at least 0 or more");r.signal?.throwIfAborted();let a=[e].flat(),c=[],{addListener:l,removeListener:u}=sFt(t),d=(...p)=>{let h=r.multiArgs?p:p[0];r.filter&&!r.filter(h)||(c.push(h),r.count===c.length&&(n(),s(c)))},f=p=>{n(),o(p)};n=()=>{for(let p of a)u(p,d);for(let p of r.rejectionEvents)u(p,f)};for(let p of a)l(p,d);for(let p of r.rejectionEvents)l(p,f);r.signal&&r.signal.addEventListener("abort",()=>{f(r.signal.reason)},{once:!0}),r.resolveImmediately&&s(c)});if(i.cancel=n,typeof r.timeout=="number"){let s=uX(i,{milliseconds:r.timeout});return s.cancel=n,s}return i}function cM(t,e,r){typeof r=="function"&&(r={filter:r}),r={...r,count:1,resolveImmediately:!1};let n=oFt(t,e,r),i=n.then(s=>s[0]);return i.cancel=n.cancel,i}var si=class extends Error{constructor(e,{cause:r}={}){super(e,{cause:r}),Object.assign(this,r),this.name="CopyFileError"}};var Po=jn(GUe(),1);import{promisify as B0}from"util";var LFr=B0(Po.default.stat),_Ft=B0(Po.default.lstat),yFt=B0(Po.default.utimes),SFt=B0(Po.default.chmod),EFt=B0(Po.default.mkdir),DFr=Po.default.closeSync.bind(Po.default),WUe=Po.default.createWriteStream.bind(Po.default);async function YUe(t,e){let r=Po.default.createReadStream(t,e);try{await cM(r,["readable","end"])}catch(n){throw new si(`Cannot read from \`${t}\`: ${n.message}`,{cause:n})}return r}var mX=t=>_Ft(t).catch(e=>{throw new si(`lstat \`${t}\` failed: ${e.message}`,{cause:e})}),KUe=(t,e,r)=>yFt(t,e,r).catch(n=>{throw new si(`utimes \`${t}\` failed: ${n.message}`,{cause:n})}),JUe=(t,e)=>SFt(t,e).catch(r=>{throw new si(`chmod \`${t}\` failed: ${r.message}`,{cause:r})});var ZUe=(t,e)=>EFt(t,{...e,recursive:!0}).catch(r=>{throw new si(`Cannot create directory \`${t}\`: ${r.message}`,{cause:r})});var bFt=(t,e,r)=>({sourcePath:uh.resolve(t,e),destinationPath:uh.resolve(t,r)}),TFt=(t,e)=>{if(!t.isFile())throw Object.assign(new si(`EISDIR: illegal operation on a directory '${e}'`),{errno:-21,code:"EISDIR",source:e})};async function XUe(t,e,r={}){if(!t||!e)throw new si("`source` and `destination` required");r.cwd&&({sourcePath:t,destinationPath:e}=bFt(r.cwd,t,e)),r={overwrite:!0,...r};let n=await mX(t),{size:i}=n;TFt(n,t);let s=uh.dirname(e);if(uh.parse(s).root===s||await ZUe(uh.dirname(e),{mode:r.directoryMode}),typeof r.onProgress=="function"){let a=await YUe(t),c=WUe(e,{flags:r.overwrite?"w":"wx"}),l=p=>{r.onProgress({sourcePath:uh.resolve(t),destinationPath:uh.resolve(e),size:i,writtenBytes:p,percent:p===i?1:p/i})},u=-1;a.on("data",()=>{let p=c.bytesWritten,h=p===i?1:p/i;(h===1||h-u>=.01)&&(u=h,l(p))});let d;a.once("error",p=>{d=new si(`Cannot read from \`${t}\`: ${p.message}`,{cause:p})});let f=!1;try{let p=cM(c,"close");a.pipe(c),await p,l(i),f=!0}catch(p){throw new si(`Cannot write to \`${e}\`: ${p.message}`,{cause:p})}if(d)throw d;if(f){let p=await mX(t);return Promise.all([KUe(e,p.atime,p.mtime).catch(h=>{if(h.code!=="EPERM")throw h}),JUe(e,p.mode)])}}else{let a=r.overwrite?gX.COPYFILE_FICLONE:gX.COPYFILE_FICLONE|gX.COPYFILE_EXCL;try{await _X.copyFile(t,e,a),await Promise.all([_X.utimes(e,n.atime,n.mtime).catch(c=>{if(c.code!=="EPERM")throw c}),_X.chmod(e,n.mode)])}catch(c){throw new si(c.message,{cause:c})}}}async function yX(t,e,r){return(await q0(t,(i,s)=>Promise.all([e(i,s),i]),r)).filter(i=>!!i[0]).map(i=>i[1])}import d2e from"process";import yzt from"fs";import OS from"path";import{on as wFt,once as AFt}from"events";import{PassThrough as RFt}from"stream";import{finished as tFe}from"stream/promises";function bX(t){if(!Array.isArray(t))throw new TypeError(`Expected an array, got \`${typeof t}\`.`);for(let i of t)EX(i);let e=t.some(({readableObjectMode:i})=>i),r=xFt(t,e),n=new SX({objectMode:e,writableHighWaterMark:r,readableHighWaterMark:r});for(let i of t)n.add(i);return t.length===0&&iFe(n),n}var xFt=(t,e)=>{if(t.length===0)return 16384;let r=t.filter(({readableObjectMode:n})=>n===e).map(({readableHighWaterMark:n})=>n);return Math.max(...r)},SX=class extends RFt{#e=new Set([]);#r=new Set([]);#t=new Set([]);#n;add(e){EX(e),!this.#e.has(e)&&(this.#e.add(e),this.#n??=IFt(this,this.#e),CFt({passThroughStream:this,stream:e,streams:this.#e,ended:this.#r,aborted:this.#t,onFinished:this.#n}),e.pipe(this,{end:!1}))}remove(e){return EX(e),this.#e.has(e)?(e.unpipe(this),!0):!1}},IFt=async(t,e)=>{pM(t,QUe);let r=new AbortController;try{await Promise.race([OFt(t,r),PFt(t,e,r)])}finally{r.abort(),pM(t,-QUe)}},OFt=async(t,{signal:e})=>{await tFe(t,{signal:e,cleanup:!0})},PFt=async(t,e,{signal:r})=>{for await(let[n]of wFt(t,"unpipe",{signal:r}))e.has(n)&&n.emit(nFe)},EX=t=>{if(typeof t?.pipe!="function")throw new TypeError(`Expected a readable stream, got: \`${typeof t}\`.`)},CFt=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,onFinished:s})=>{pM(t,eFe);let o=new AbortController;try{await Promise.race([NFt(s,e),kFt({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:o}),$Ft({stream:e,streams:r,ended:n,aborted:i,controller:o})])}finally{o.abort(),pM(t,-eFe)}r.size===n.size+i.size&&(n.size===0&&i.size>0?vX(t):iFe(t))},rFe=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",NFt=async(t,e)=>{try{await t,vX(e)}catch(r){rFe(r)?vX(e):sFe(e,r)}},kFt=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:{signal:s}})=>{try{await tFe(e,{signal:s,cleanup:!0,readable:!0,writable:!1}),r.has(e)&&n.add(e)}catch(o){if(s.aborted||!r.has(e))return;rFe(o)?i.add(e):sFe(t,o)}},$Ft=async({stream:t,streams:e,ended:r,aborted:n,controller:{signal:i}})=>{await AFt(t,nFe,{signal:i}),e.delete(t),r.delete(t),n.delete(t)},nFe=Symbol("unpipe"),iFe=t=>{t.writable&&t.end()},vX=t=>{(t.readable||t.writable)&&t.destroy()},sFe=(t,e)=>{t.destroyed||(t.once("error",LFt),t.destroy(e))},LFt=()=>{},pM=(t,e)=>{let r=t.getMaxListeners();r!==0&&r!==Number.POSITIVE_INFINITY&&t.setMaxListeners(r+e)},QUe=2,eFe=1;var PS=jn(K0(),1);import zBt from"fs";import VBt from"fs/promises";async function aQ(t,e,r){if(typeof r!="string")throw new TypeError(`Expected a string, got ${typeof r}`);try{return(await VBt[t](r))[e]()}catch(n){if(n.code==="ENOENT")return!1;throw n}}function cQ(t,e,r){if(typeof r!="string")throw new TypeError(`Expected a string, got ${typeof r}`);try{return zBt[t](r)[e]()}catch(n){if(n.code==="ENOENT")return!1;throw n}}var Sqr=aQ.bind(void 0,"stat","isFile"),Gqe=aQ.bind(void 0,"stat","isDirectory"),Eqr=aQ.bind(void 0,"lstat","isSymbolicLink"),vqr=cQ.bind(void 0,"statSync","isFile"),Wqe=cQ.bind(void 0,"statSync","isDirectory"),bqr=cQ.bind(void 0,"lstatSync","isSymbolicLink");var gQ=jn(K0(),1),r2e=jn(mQ(),1);import dzt from"process";import fzt from"fs";import pzt from"fs/promises";import IS from"path";function xS(t){return t.startsWith("\\\\?\\")?t:t.replace(/\\/g,"/")}var Z0=t=>t[0]==="!";var hzt=["**/node_modules","**/flow-typed","**/coverage","**/.git"],n2e={absolute:!0,dot:!0},i2e="**/.gitignore",mzt=(t,e)=>Z0(t)?"!"+IS.posix.join(e,t.slice(1)):IS.posix.join(e,t),gzt=(t,e)=>{let r=xS(IS.relative(e,IS.dirname(t.filePath)));return t.content.split(/\r?\n/).filter(n=>n&&!n.startsWith("#")).map(n=>mzt(n,r))},_zt=(t,e)=>{if(e=xS(e),IS.isAbsolute(t)){if(xS(t).startsWith(e))return IS.relative(e,t);throw new Error(`Path ${t} is not in cwd ${e}`)}return t},s2e=(t,e)=>{let r=t.flatMap(i=>gzt(i,e)),n=(0,r2e.default)().add(r);return i=>(i=yi(i),i=_zt(i,e),i?n.ignores(xS(i)):!1)},o2e=(t={})=>({cwd:yi(t.cwd)??dzt.cwd(),suppressErrors:!!t.suppressErrors,deep:typeof t.deep=="number"?t.deep:Number.POSITIVE_INFINITY,ignore:[...t.ignore??[],...hzt]}),a2e=async(t,e)=>{let{cwd:r,suppressErrors:n,deep:i,ignore:s}=o2e(e),o=await(0,gQ.default)(t,{cwd:r,suppressErrors:n,deep:i,ignore:s,...n2e}),a=await Promise.all(o.map(async c=>({filePath:c,content:await pzt.readFile(c,"utf8")})));return s2e(a,r)},c2e=(t,e)=>{let{cwd:r,suppressErrors:n,deep:i,ignore:s}=o2e(e),a=gQ.default.sync(t,{cwd:r,suppressErrors:n,deep:i,ignore:s,...n2e}).map(c=>({filePath:c,content:fzt.readFileSync(c,"utf8")}));return s2e(a,r)};var Szt=t=>{if(t.some(e=>typeof e!="string"))throw new TypeError("Patterns must be a string or an array of strings")},f2e=(t,e)=>{let r=Z0(t)?t.slice(1):t;return OS.isAbsolute(r)?r:OS.join(e,r)},p2e=({directoryPath:t,files:e,extensions:r})=>{let n=r?.length>0?`.${r.length>1?`{${r.join(",")}}`:r[0]}`:"";return e?e.map(i=>OS.posix.join(t,`**/${OS.extname(i)?i:`${i}${n}`}`)):[OS.posix.join(t,`**${n?`/*${n}`:""}`)]},l2e=async(t,{cwd:e=d2e.cwd(),files:r,extensions:n}={})=>(await Promise.all(t.map(async s=>await Gqe(f2e(s,e))?p2e({directoryPath:s,files:r,extensions:n}):s))).flat(),u2e=(t,{cwd:e=d2e.cwd(),files:r,extensions:n}={})=>t.flatMap(i=>Wqe(f2e(i,e))?p2e({directoryPath:i,files:r,extensions:n}):i),_Q=t=>(t=[...new Set([t].flat())],Szt(t),t),Ezt=t=>{if(!t)return;let e;try{e=yzt.statSync(t)}catch{return}if(!e.isDirectory())throw new Error("The `cwd` option must be a path to a directory")},h2e=(t={})=>(t={...t,ignore:t.ignore??[],expandDirectories:t.expandDirectories??!0,cwd:yi(t.cwd)},Ezt(t.cwd),t),m2e=t=>async(e,r)=>t(_Q(e),h2e(r)),HM=t=>(e,r)=>t(_Q(e),h2e(r)),g2e=t=>{let{ignoreFiles:e,gitignore:r}=t,n=e?_Q(e):[];return r&&n.push(i2e),n},vzt=async t=>{let e=g2e(t);return y2e(e.length>0&&await a2e(e,t))},_2e=t=>{let e=g2e(t);return y2e(e.length>0&&c2e(e,t))},y2e=t=>{let e=new Set;return r=>{let n=OS.normalize(r.path??r);return e.has(n)||t&&t(n)?!1:(e.add(n),!0)}},S2e=(t,e)=>t.flat().filter(r=>e(r)),E2e=(t,e)=>{let r=[];for(;t.length>0;){let n=t.findIndex(s=>Z0(s));if(n===-1){r.push({patterns:t,options:e});break}let i=t[n].slice(1);for(let s of r)s.options.ignore.push(i);n!==0&&r.push({patterns:t.slice(0,n),options:{...e,ignore:[...e.ignore,i]}}),t=t.slice(n+1)}return r},v2e=(t,e)=>({...e?{cwd:e}:{},...Array.isArray(t)?{files:t}:t}),b2e=async(t,e)=>{let r=E2e(t,e),{cwd:n,expandDirectories:i}=e;if(!i)return r;let s=v2e(i,n);return Promise.all(r.map(async o=>{let{patterns:a,options:c}=o;return[a,c.ignore]=await Promise.all([l2e(a,s),l2e(c.ignore,{cwd:n})]),{patterns:a,options:c}}))},yQ=(t,e)=>{let r=E2e(t,e),{cwd:n,expandDirectories:i}=e;if(!i)return r;let s=v2e(i,n);return r.map(o=>{let{patterns:a,options:c}=o;return a=u2e(a,s),c.ignore=u2e(c.ignore,{cwd:n}),{patterns:a,options:c}})},zqr=m2e(async(t,e)=>{let[r,n]=await Promise.all([b2e(t,e),vzt(e)]),i=await Promise.all(r.map(s=>(0,PS.default)(s.patterns,s.options)));return S2e(i,n)}),T2e=HM((t,e)=>{let r=yQ(t,e),n=_2e(e),i=r.map(s=>PS.default.sync(s.patterns,s.options));return S2e(i,n)}),Vqr=HM((t,e)=>{let r=yQ(t,e),n=_2e(e),i=r.map(o=>PS.default.stream(o.patterns,o.options));return bX(i).filter(o=>n(o))}),hh=HM((t,e)=>t.some(r=>PS.default.isDynamicPattern(r,e))),Hqr=m2e(b2e),Gqr=HM(yQ),{convertPathToPattern:Wqr}=PS.default;var A2e=jn(VX(),1);var Nd=class extends Error{constructor(e,{cause:r}={}){super(e,{cause:r}),Object.assign(this,r),this.name="CpyError"}};import WM from"path";import w2e from"fs";var bzt=["^npm-debug\\.log$","^\\..*\\.swp$","^\\.DS_Store$","^\\.AppleDouble$","^\\.LSOverride$","^Icon\\r$","^\\._.*","^\\.Spotlight-V100(?:$|\\/)","\\.Trashes","^__MACOSX$","~$","^Thumbs\\.db$","^ehthumbs\\.db$","^[Dd]esktop\\.ini$","@eaDir$"],Tzt=new RegExp(bzt.join("|"));function wzt(t){return Tzt.test(t)}function GM(t){return!wzt(t)}var X0=class{constructor(e,r,n){this.path=e,this.originalPath=e,this.destination=r,this.options=n,this.isDirectory=!1,!hh(e)&&w2e.existsSync(e)&&w2e.lstatSync(e).isDirectory()&&(this.path=[e,"**"].join("/"),this.isDirectory=!0)}get name(){return WM.basename(this.originalPath)}get normalizedPath(){let e=this.originalPath.split("/"),r=e.findIndex(i=>i?hh(i):!1),n=e.slice(0,r).join("/");return n?WM.isAbsolute(n)?n:WM.join(this.options.cwd,n):this.destination}hasMagic(){return hh(this.options.flat?this.path:this.originalPath)}getMatches(){let e=T2e(this.path,{...this.options,dot:!0,absolute:!0,onlyFiles:!0});return this.options.ignoreJunk&&(e=e.filter(r=>GM(WM.basename(r)))),e}};var Izt={ignoreJunk:!0,flat:!1,cwd:Azt.cwd()},SQ=class{constructor(e,r,n){this.path=e.split("/").join(Rt.sep),this.relativePath=r.split("/").join(Rt.sep),this.pattern=n,Object.freeze(this)}get name(){return Rt.basename(this.path)}get nameWithoutExtension(){return Rt.basename(this.path,Rt.extname(this.path))}get extension(){return Rt.extname(this.path).slice(1)}},Ozt=t=>t.flatMap(e=>A2e.default.braces(e,{expand:!0,nodupes:!0})),Pzt=({entry:t,destination:e,options:r})=>t.pattern.hasMagic()?r.flat?Rt.isAbsolute(e)?Rt.join(e,t.name):Rt.join(r.cwd,e,t.name):Rt.join(e,Rt.relative(t.pattern.normalizedPath,t.path)):Rt.isAbsolute(e)?Rt.join(e,t.name):t.pattern.isDirectory&&Rt.relative(r.cwd,t.path).startsWith("..")?Rt.join(r.cwd,e,Rt.basename(t.pattern.originalPath),Rt.relative(t.pattern.originalPath,t.path)):!t.pattern.isDirectory&&t.path===t.relativePath?Rt.join(r.cwd,e,Rt.basename(t.pattern.originalPath),Rt.relative(t.pattern.originalPath,t.path)):!t.pattern.isDirectory&&r.flat?Rt.join(r.cwd,e,Rt.basename(t.pattern.originalPath)):Rt.join(r.cwd,e,Rt.relative(r.cwd,t.path)),Czt=(t,e)=>{let r=Rt.dirname(t);if(typeof e=="string")return Rt.join(r,e);if(typeof e=="function"){let n=Rt.basename(t);return Rt.join(r,e(n))}return t};function EQ(t,e,{concurrency:r=xzt.availableParallelism(),...n}={}){let i=new Map,s=new Rzt;n={...Izt,...n};let o=(async()=>{let a=[],c=0,l=0,u=Ozt([t??[]].flat()).map(h=>h.replaceAll("\\","/")),d=u.filter(h=>!h.startsWith("!")),f=u.filter(h=>h.startsWith("!"));if(d.length===0||!e)throw new Nd("`source` and `destination` required");u=u.map(h=>new X0(h,e,{...n,ignore:f}));for(let h of u){let m=[];try{m=h.getMatches()}catch(_){throw new Nd(`Cannot glob \`${h.originalPath}\`: ${_.message}`,{cause:_})}if(m.length===0&&!hh(h.originalPath)&&!hh(f))throw new Nd(`Cannot copy \`${h.originalPath}\`: the file doesn't exist`);a=[...a,...m.map(_=>new SQ(_,Rt.relative(n.cwd,_),h))]}n.filter!==void 0&&(a=await yX(a,n.filter,{concurrency:1024})),a.length===0&&s.emit("progress",{totalFiles:0,percent:1,completedFiles:0,completedSize:0});let p=h=>{let m=i.get(h.sourcePath)||{writtenBytes:0,percent:0};(m.writtenBytes!==h.writtenBytes||m.percent!==h.percent)&&(l-=m.writtenBytes,l+=h.writtenBytes,h.percent===1&&m.percent!==1&&c++,i.set(h.sourcePath,{writtenBytes:h.writtenBytes,percent:h.percent}),s.emit("progress",{totalFiles:a.length,percent:c/a.length,completedFiles:c,completedSize:l,sourcePath:h.sourcePath,destinationPath:h.destinationPath}))};return q0(a,async h=>{let m=Czt(Pzt({entry:h,destination:e,options:n}),n.rename);try{await XUe(h.path,m,{...n,onProgress:p})}catch(_){throw new Nd(`Cannot copy from \`${h.relativePath}\` to \`${m}\`: ${_.message}`,{cause:_})}return m},{concurrency:r})})();return o.on=(...a)=>(s.on(...a),o),o}import V2e from"process";import Qzt from"fs";import kS from"path";import{on as Nzt,once as kzt}from"events";import{PassThrough as $zt}from"stream";import{finished as I2e}from"stream/promises";function wQ(t){if(!Array.isArray(t))throw new TypeError(`Expected an array, got \`${typeof t}\`.`);for(let i of t)bQ(i);let e=t.some(({readableObjectMode:i})=>i),r=Lzt(t,e),n=new vQ({objectMode:e,writableHighWaterMark:r,readableHighWaterMark:r});for(let i of t)n.add(i);return t.length===0&&C2e(n),n}var Lzt=(t,e)=>{if(t.length===0)return 16384;let r=t.filter(({readableObjectMode:n})=>n===e).map(({readableHighWaterMark:n})=>n);return Math.max(...r)},vQ=class extends $zt{#e=new Set([]);#r=new Set([]);#t=new Set([]);#n;add(e){bQ(e),!this.#e.has(e)&&(this.#e.add(e),this.#n??=Dzt(this,this.#e),Fzt({passThroughStream:this,stream:e,streams:this.#e,ended:this.#r,aborted:this.#t,onFinished:this.#n}),e.pipe(this,{end:!1}))}remove(e){return bQ(e),this.#e.has(e)?(e.unpipe(this),!0):!1}},Dzt=async(t,e)=>{YM(t,R2e);let r=new AbortController;try{await Promise.race([Mzt(t,r),Uzt(t,e,r)])}finally{r.abort(),YM(t,-R2e)}},Mzt=async(t,{signal:e})=>{await I2e(t,{signal:e,cleanup:!0})},Uzt=async(t,e,{signal:r})=>{for await(let[n]of Nzt(t,"unpipe",{signal:r}))e.has(n)&&n.emit(P2e)},bQ=t=>{if(typeof t?.pipe!="function")throw new TypeError(`Expected a readable stream, got: \`${typeof t}\`.`)},Fzt=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,onFinished:s})=>{YM(t,x2e);let o=new AbortController;try{await Promise.race([jzt(s,e),qzt({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:o}),Bzt({stream:e,streams:r,ended:n,aborted:i,controller:o})])}finally{o.abort(),YM(t,-x2e)}r.size===n.size+i.size&&(n.size===0&&i.size>0?TQ(t):C2e(t))},O2e=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",jzt=async(t,e)=>{try{await t,TQ(e)}catch(r){O2e(r)?TQ(e):N2e(e,r)}},qzt=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:{signal:s}})=>{try{await I2e(e,{signal:s,cleanup:!0,readable:!0,writable:!1}),r.has(e)&&n.add(e)}catch(o){if(s.aborted||!r.has(e))return;O2e(o)?i.add(e):N2e(t,o)}},Bzt=async({stream:t,streams:e,ended:r,aborted:n,controller:{signal:i}})=>{await kzt(t,P2e,{signal:i}),e.delete(t),r.delete(t),n.delete(t)},P2e=Symbol("unpipe"),C2e=t=>{t.writable&&t.end()},TQ=t=>{(t.readable||t.writable)&&t.destroy()},N2e=(t,e)=>{t.destroyed||(t.once("error",zzt),t.destroy(e))},zzt=()=>{},YM=(t,e)=>{let r=t.getMaxListeners();r!==0&&r!==Number.POSITIVE_INFINITY&&t.setMaxListeners(r+e)},R2e=2,x2e=1;var $S=jn(K0(),1);import Vzt from"fs";import Hzt from"fs/promises";async function AQ(t,e,r){if(typeof r!="string")throw new TypeError(`Expected a string, got ${typeof r}`);try{return(await Hzt[t](r))[e]()}catch(n){if(n.code==="ENOENT")return!1;throw n}}function RQ(t,e,r){if(typeof r!="string")throw new TypeError(`Expected a string, got ${typeof r}`);try{return Vzt[t](r)[e]()}catch(n){if(n.code==="ENOENT")return!1;throw n}}var S2r=AQ.bind(void 0,"stat","isFile"),k2e=AQ.bind(void 0,"stat","isDirectory"),E2r=AQ.bind(void 0,"lstat","isSymbolicLink"),v2r=RQ.bind(void 0,"statSync","isFile"),$2e=RQ.bind(void 0,"statSync","isDirectory"),b2r=RQ.bind(void 0,"lstatSync","isSymbolicLink");var xQ=jn(K0(),1),L2e=jn(mQ(),1);import Gzt from"process";import Wzt from"fs";import Yzt from"fs/promises";import NS from"path";function CS(t){return t.startsWith("\\\\?\\")?t:t.replace(/\\/g,"/")}var Q0=t=>t[0]==="!";var Kzt=["**/node_modules","**/flow-typed","**/coverage","**/.git"],D2e={absolute:!0,dot:!0},M2e="**/.gitignore",Jzt=(t,e)=>Q0(t)?"!"+NS.posix.join(e,t.slice(1)):NS.posix.join(e,t),Zzt=(t,e)=>{let r=CS(NS.relative(e,NS.dirname(t.filePath)));return t.content.split(/\r?\n/).filter(n=>n&&!n.startsWith("#")).map(n=>Jzt(n,r))},Xzt=(t,e)=>{if(e=CS(e),NS.isAbsolute(t)){if(CS(t).startsWith(e))return NS.relative(e,t);throw new Error(`Path ${t} is not in cwd ${e}`)}return t},U2e=(t,e)=>{let r=t.flatMap(i=>Zzt(i,e)),n=(0,L2e.default)().add(r);return i=>(i=yi(i),i=Xzt(i,e),i?n.ignores(CS(i)):!1)},F2e=(t={})=>({cwd:yi(t.cwd)??Gzt.cwd(),suppressErrors:!!t.suppressErrors,deep:typeof t.deep=="number"?t.deep:Number.POSITIVE_INFINITY,ignore:[...t.ignore??[],...Kzt]}),j2e=async(t,e)=>{let{cwd:r,suppressErrors:n,deep:i,ignore:s}=F2e(e),o=await(0,xQ.default)(t,{cwd:r,suppressErrors:n,deep:i,ignore:s,...D2e}),a=await Promise.all(o.map(async c=>({filePath:c,content:await Yzt.readFile(c,"utf8")})));return U2e(a,r)},q2e=(t,e)=>{let{cwd:r,suppressErrors:n,deep:i,ignore:s}=F2e(e),a=xQ.default.sync(t,{cwd:r,suppressErrors:n,deep:i,ignore:s,...D2e}).map(c=>({filePath:c,content:Wzt.readFileSync(c,"utf8")}));return U2e(a,r)};var eVt=t=>{if(t.some(e=>typeof e!="string"))throw new TypeError("Patterns must be a string or an array of strings")},H2e=(t,e)=>{let r=Q0(t)?t.slice(1):t;return kS.isAbsolute(r)?r:kS.join(e,r)},G2e=({directoryPath:t,files:e,extensions:r})=>{let n=r?.length>0?`.${r.length>1?`{${r.join(",")}}`:r[0]}`:"";return e?e.map(i=>kS.posix.join(t,`**/${kS.extname(i)?i:`${i}${n}`}`)):[kS.posix.join(t,`**${n?`/*${n}`:""}`)]},B2e=async(t,{cwd:e=V2e.cwd(),files:r,extensions:n}={})=>(await Promise.all(t.map(async s=>await k2e(H2e(s,e))?G2e({directoryPath:s,files:r,extensions:n}):s))).flat(),z2e=(t,{cwd:e=V2e.cwd(),files:r,extensions:n}={})=>t.flatMap(i=>$2e(H2e(i,e))?G2e({directoryPath:i,files:r,extensions:n}):i),IQ=t=>(t=[...new Set([t].flat())],eVt(t),t),tVt=t=>{if(!t)return;let e;try{e=Qzt.statSync(t)}catch{return}if(!e.isDirectory())throw new Error("The `cwd` option must be a path to a directory")},W2e=(t={})=>(t={...t,ignore:t.ignore??[],expandDirectories:t.expandDirectories??!0,cwd:yi(t.cwd)},tVt(t.cwd),t),Y2e=t=>async(e,r)=>t(IQ(e),W2e(r)),KM=t=>(e,r)=>t(IQ(e),W2e(r)),K2e=t=>{let{ignoreFiles:e,gitignore:r}=t,n=e?IQ(e):[];return r&&n.push(M2e),n},rVt=async t=>{let e=K2e(t);return Z2e(e.length>0&&await j2e(e,t))},J2e=t=>{let e=K2e(t);return Z2e(e.length>0&&q2e(e,t))},Z2e=t=>{let e=new Set;return r=>{let n=kS.normalize(r.path??r);return e.has(n)||t&&t(n)?!1:(e.add(n),!0)}},X2e=(t,e)=>t.flat().filter(r=>e(r)),Q2e=(t,e)=>{let r=[];for(;t.length>0;){let n=t.findIndex(s=>Q0(s));if(n===-1){r.push({patterns:t,options:e});break}let i=t[n].slice(1);for(let s of r)s.options.ignore.push(i);n!==0&&r.push({patterns:t.slice(0,n),options:{...e,ignore:[...e.ignore,i]}}),t=t.slice(n+1)}return r},eBe=(t,e)=>({...e?{cwd:e}:{},...Array.isArray(t)?{files:t}:t}),tBe=async(t,e)=>{let r=Q2e(t,e),{cwd:n,expandDirectories:i}=e;if(!i)return r;let s=eBe(i,n);return Promise.all(r.map(async o=>{let{patterns:a,options:c}=o;return[a,c.ignore]=await Promise.all([B2e(a,s),B2e(c.ignore,{cwd:n})]),{patterns:a,options:c}}))},OQ=(t,e)=>{let r=Q2e(t,e),{cwd:n,expandDirectories:i}=e;if(!i)return r;let s=eBe(i,n);return r.map(o=>{let{patterns:a,options:c}=o;return a=z2e(a,s),c.ignore=z2e(c.ignore,{cwd:n}),{patterns:a,options:c}})},rBe=Y2e(async(t,e)=>{let[r,n]=await Promise.all([tBe(t,e),rVt(e)]),i=await Promise.all(r.map(s=>(0,$S.default)(s.patterns,s.options)));return X2e(i,n)}),B2r=KM((t,e)=>{let r=OQ(t,e),n=J2e(e),i=r.map(s=>$S.default.sync(s.patterns,s.options));return X2e(i,n)}),z2r=KM((t,e)=>{let r=OQ(t,e),n=J2e(e),i=r.map(o=>$S.default.stream(o.patterns,o.options));return wQ(i).filter(o=>n(o))}),V2r=KM((t,e)=>t.some(r=>$S.default.isDynamicPattern(r,e))),H2r=Y2e(tBe),G2r=KM(OQ),{convertPathToPattern:W2r}=$S.default;import iVt from"process";import eA from"path";import tBr,{promises as JM}from"fs";import J2r,{promises as nVt}from"fs";async function nBe(t){try{return await nVt.access(t),!0}catch{return!1}}var sVt=(t,e,r)=>(e=eA.resolve(t,e),r=eA.resolve(t,r),{sourcePath:e,destinationPath:r}),oVt=(t,e,r="Path")=>{if(!t||!e)throw new TypeError(`\`source${r}\` and \`destination${r}\` required`)},aVt=(t,e)=>{if(eA.dirname(t)!==eA.dirname(e))throw new Error("`source` and `destination` must be in the same directory")},cVt=async(t,e,{overwrite:r=!0,cwd:n=iVt.cwd(),directoryMode:i,validateDirectory:s=!1}={})=>{if(n&&({sourcePath:t,destinationPath:e}=sVt(n,t,e)),s&&aVt(t,e),!r&&await nBe(e))throw new Error(`The destination file exists: ${e}`);await JM.mkdir(eA.dirname(e),{recursive:!0,mode:i});try{await JM.rename(t,e)}catch(o){if(o.code==="EXDEV")await JM.copyFile(t,e),await JM.unlink(t);else throw o}};async function iBe(t,e,r){return oVt(t,e),cVt(t,e,r)}var PQ=async function(t,e,r=!1){if(r)return iBe(t,e,{overwrite:!1});let{srcGlob:n,dest:i,...s}=await aBe(t,oBe(e));if(n&&i)return EQ(n,i,{...s,overwrite:!1})},tA=async function(t){let{srcGlob:e,isDir:r,dest:n,...i}=await aBe(t,"");return e!==void 0&&!await dVt(e,r,i)},dVt=async function(t,e,r){return e?(await rBe(t,r)).filter(s=>GM(sBe(s))).length===0:!1},aBe=async function(t,e){let r=await fVt(t);if(r===void 0)return{srcGlob:void 0,isDir:!1,cwd:""};let n=r.isDirectory(),i=sBe(t),s=oBe(t),o={srcGlob:i,dest:e,isDir:n,cwd:s,dot:!0};return n?{...o,srcGlob:`${i}/**`,dest:uVt(e,i)}:o},fVt=async t=>{try{return await lVt.stat(t)}catch{return}};import{join as aHt}from"path";import{stat as pVt,lstat as cBe,readdir as hVt,realpath as mVt}from"fs/promises";import{Readable as gVt}from"stream";import{resolve as lBe,relative as _Vt,join as yVt,sep as SVt}from"path";var es={FILE_TYPE:"files",DIR_TYPE:"directories",FILE_DIR_TYPE:"files_directories",EVERYTHING_TYPE:"all"},CQ={root:".",fileFilter:t=>!0,directoryFilter:t=>!0,type:es.FILE_TYPE,lstat:!1,depth:2147483648,alwaysStat:!1,highWaterMark:4096};Object.freeze(CQ);var pBe="READDIRP_RECURSIVE_ERROR",EVt=new Set(["ENOENT","EPERM","EACCES","ELOOP",pBe]),uBe=[es.DIR_TYPE,es.EVERYTHING_TYPE,es.FILE_DIR_TYPE,es.FILE_TYPE],vVt=new Set([es.DIR_TYPE,es.EVERYTHING_TYPE,es.FILE_DIR_TYPE]),bVt=new Set([es.EVERYTHING_TYPE,es.FILE_DIR_TYPE,es.FILE_TYPE]),TVt=t=>EVt.has(t.code),wVt=process.platform==="win32",dBe=t=>!0,fBe=t=>{if(t===void 0)return dBe;if(typeof t=="function")return t;if(typeof t=="string"){let e=t.trim();return r=>r.basename===e}if(Array.isArray(t)){let e=t.map(r=>r.trim());return r=>e.some(n=>r.basename===n)}return dBe},NQ=class extends gVt{constructor(e={}){super({objectMode:!0,autoDestroy:!0,highWaterMark:e.highWaterMark});let r={...CQ,...e},{root:n,type:i}=r;this._fileFilter=fBe(r.fileFilter),this._directoryFilter=fBe(r.directoryFilter);let s=r.lstat?cBe:pVt;wVt?this._stat=o=>s(o,{bigint:!0}):this._stat=s,this._maxDepth=r.depth??CQ.depth,this._wantsDir=i?vVt.has(i):!1,this._wantsFile=i?bVt.has(i):!1,this._wantsEverything=i===es.EVERYTHING_TYPE,this._root=lBe(n),this._isDirent=!r.alwaysStat,this._statsProp=this._isDirent?"dirent":"stats",this._rdOptions={encoding:"utf8",withFileTypes:this._isDirent},this.parents=[this._exploreDir(n,1)],this.reading=!1,this.parent=void 0}async _read(e){if(!this.reading){this.reading=!0;try{for(;!this.destroyed&&e>0;){let r=this.parent,n=r&&r.files;if(n&&n.length>0){let{path:i,depth:s}=r,o=n.splice(0,e).map(c=>this._formatEntry(c,i)),a=await Promise.all(o);for(let c of a){if(!c)continue;if(this.destroyed)return;let l=await this._getEntryType(c);l==="directory"&&this._directoryFilter(c)?(s<=this._maxDepth&&this.parents.push(this._exploreDir(c.fullPath,s+1)),this._wantsDir&&(this.push(c),e--)):(l==="file"||this._includeAsFile(c))&&this._fileFilter(c)&&this._wantsFile&&(this.push(c),e--)}}else{let i=this.parents.pop();if(!i){this.push(null);break}if(this.parent=await i,this.destroyed)return}}}catch(r){this.destroy(r)}finally{this.reading=!1}}}async _exploreDir(e,r){let n;try{n=await hVt(e,this._rdOptions)}catch(i){this._onError(i)}return{files:n,depth:r,path:e}}async _formatEntry(e,r){let n,i=this._isDirent?e.name:e;try{let s=lBe(yVt(r,i));n={path:_Vt(this._root,s),fullPath:s,basename:i},n[this._statsProp]=this._isDirent?e:await this._stat(s)}catch(s){this._onError(s);return}return n}_onError(e){TVt(e)&&!this.destroyed?this.emit("warn",e):this.destroy(e)}async _getEntryType(e){if(!e&&this._statsProp in e)return"";let r=e[this._statsProp];if(r.isFile())return"file";if(r.isDirectory())return"directory";if(r&&r.isSymbolicLink()){let n=e.fullPath;try{let i=await mVt(n),s=await cBe(i);if(s.isFile())return"file";if(s.isDirectory()){let o=i.length;if(n.startsWith(i)&&n.substr(o,1)===SVt){let a=new Error(`Circular symlink detected: "${n}" points to "${i}"`);return a.code=pBe,this._onError(a)}return"directory"}}catch(i){return this._onError(i),""}}}_includeAsFile(e){let r=e&&e[this._statsProp];return r&&this._wantsEverything&&!r.isDirectory()}};function AVt(t,e={}){let r=e.entryType||e.type;if(r==="both"&&(r=es.FILE_DIR_TYPE),r&&(e.type=r),t){if(typeof t!="string")throw new TypeError("readdirp: root argument must be a string. Usage: readdirp(root, options)");if(r&&!uBe.includes(r))throw new Error(`readdirp: Invalid type passed. Use one of ${uBe.join(", ")}`)}else throw new Error("readdirp: root argument is required. Usage: readdirp(root, options)");return e.root=t,new NQ(e)}function hBe(t,e={}){return new Promise((r,n)=>{let i=[];AVt(t,e).on("data",s=>i.push(s)).on("end",()=>r(i)).on("error",s=>n(s))})}import{mkdir as UVt,readFile as vBe,rm as FVt,writeFile as jVt}from"fs/promises";import{existsSync as bBe}from"fs";import{dirname as qVt}from"path";var mBe=t=>{if(!(!Number.isInteger(t)||t<1))return Date.now()+t*1e3},gBe=t=>t!==void 0&&Date.now()>t;import{createHash as $Vt}from"crypto";import{createReadStream as LVt}from"fs";import IVt from"process";import OVt from"path";import wBr,{promises as _Be}from"fs";import{fileURLToPath as PVt}from"url";var kQ=class{value;next;constructor(e){this.value=e}},rA=class{#e;#r;#t;constructor(){this.clear()}enqueue(e){let r=new kQ(e);this.#e?(this.#r.next=r,this.#r=r):(this.#e=r,this.#r=r),this.#t++}dequeue(){let e=this.#e;if(e)return this.#e=this.#e.next,this.#t--,this.#e||(this.#r=void 0),e.value}peek(){if(this.#e)return this.#e.value}clear(){this.#e=void 0,this.#r=void 0,this.#t=0}get size(){return this.#t}*[Symbol.iterator](){let e=this.#e;for(;e;)yield e.value,e=e.next}*drain(){for(;this.#e;)yield this.dequeue()}};function ZM(t){if(!((Number.isInteger(t)||t===Number.POSITIVE_INFINITY)&&t>0))throw new TypeError("Expected `concurrency` to be a number from 1 and up");let e=new rA,r=0,n=()=>{r--,e.size>0&&e.dequeue()()},i=async(a,c,l)=>{r++;let u=(async()=>a(...l))();c(u);try{await u}catch{}n()},s=(a,c,l)=>{e.enqueue(i.bind(void 0,a,c,l)),(async()=>(await Promise.resolve(),r<t&&e.size>0&&e.dequeue()()))()},o=(a,...c)=>new Promise(l=>{s(a,l,c)});return Object.defineProperties(o,{activeCount:{get:()=>r},pendingCount:{get:()=>e.size},clearQueue:{value:()=>{e.clear()}}}),o}var XM=class extends Error{constructor(e){super(),this.value=e}},RVt=async(t,e)=>e(await t),xVt=async t=>{let e=await Promise.all(t);if(e[1]===!0)throw new XM(e[0]);return!1};async function $Q(t,e,{concurrency:r=Number.POSITIVE_INFINITY,preserveOrder:n=!0}={}){let i=ZM(r),s=[...t].map(a=>[a,i(RVt,a,e)]),o=ZM(n?1:Number.POSITIVE_INFINITY);try{await Promise.all(s.map(a=>o(xVt,a)))}catch(a){if(a instanceof XM)return a.value;throw a}}var yBe={directory:"isDirectory",file:"isFile"};function CVt(t){if(!Object.hasOwnProperty.call(yBe,t))throw new Error(`Invalid type specified: ${t}`)}var NVt=(t,e)=>e[yBe[t]](),kVt=t=>t instanceof URL?PVt(t):t;async function SBe(t,{cwd:e=IVt.cwd(),type:r="file",allowSymlinks:n=!0,concurrency:i,preserveOrder:s}={}){CVt(r),e=kVt(e);let o=n?_Be.stat:_Be.lstat;return $Q(t,async a=>{try{let c=await o(OVt.resolve(e,a));return NVt(r,c)}catch{return!1}},{concurrency:i,preserveOrder:s})}var DVt="sha1",EBe=async function(t,e){if(e||t.length===0)return;let r=await SBe(t);return r===void 0?void 0:await MVt(r)},MVt=async function(t){let e=LVt(t,"utf8"),r=$Vt(DVt,{encoding:"hex"});return e.pipe(r),await Hg(r)};var TBe=async function({cachePath:t,move:e,ttl:r,digests:n}){let i=QM(t),s=mBe(r),o=await EBe(n,e),c=`${JSON.stringify({expires:s,hash:o},null,2)}
910
- `,l=await BVt({hash:o,manifestPath:i,manifestString:c});return{manifestInfo:{manifestPath:i,manifestString:c},identical:l}},BVt=async function({hash:t,manifestPath:e,manifestString:r}){return t===void 0||!bBe(e)?!1:await vBe(e,"utf8")===r},wBe=async function({manifestPath:t,manifestString:e}){await UVt(qVt(t),{recursive:!0}),await jVt(t,e)},ABe=async function(t){let e=QM(t);await FVt(e,{force:!0,recursive:!0,maxRetries:3})},QM=function(t){return`${t}${xBe}`},RBe=function(t){return t.endsWith(xBe)},xBe=".netlify.cache.json",LQ=async function(t){let e=QM(t);if(!bBe(e))return!1;let{expires:r}=await zVt(t);return gBe(r)},zVt=async function(t){let e=QM(t),r=await vBe(e,"utf-8");return JSON.parse(r)};import{homedir as YVt}from"os";import{resolve as IBe,isAbsolute as KVt,join as JVt,sep as MQ}from"path";import{normalize as VVt}from"path";import{existsSync as HVt}from"fs";import GVt from"process";var DQ=function(t){try{let e=WVt(t);return HVt(e)?Promise.resolve(e):Promise.resolve("")}catch{return Promise.resolve("")}},WVt=function(t=GVt.cwd()){return VVt(t)};var nA=async function({path:t,cacheDir:e,cwdOpt:r}){let n=await ZVt(t,r),i=await tHt({srcPath:n,cacheDir:e,cwdOpt:r});return{srcPath:n,cachePath:i}},ZVt=async function(t,e){let r=await DQ(e),n=XVt(t,r);return QVt(n,r),n},XVt=function(t,e){if(KVt(t))return IBe(t);if(e!=="")return IBe(e,t);throw new Error(`Current directory does not exist: ${e}`)},QVt=function(t,e){if(e!==""&&eHt(t,e))throw new Error(`Cannot cache ${t} because it is the current directory (${e}) or a parent directory`)},eHt=function(t,e){return`${e}${MQ}`.startsWith(`${t}${MQ}`)},tHt=async function({srcPath:t,cacheDir:e,cwdOpt:r}){let n=ch({cacheDir:e,cwd:r}),{name:i,relPath:s}=await rHt(t,r);return JVt(n,i,s)},rHt=async function(t,e){let r=await UQ(e),n=nHt(t);return r.map(({name:i,base:s})=>sHt(i,s,n)).find(Boolean)},nHt=function(t){return t.replace(iHt,"\\")},iHt=/^[a-zA-Z]:\\/,sHt=function(t,e,r){if(r===e||!r.startsWith(e))return;let n=r.replace(e,"");return{name:t,relPath:n}},UQ=async function(t){return[...await oHt(t),{name:"home",base:YVt()},{name:"root",base:MQ}]},oHt=async function(t){let e=await DQ(t);return e===""?[]:[{name:"cwd",base:e}]};var cHt=1,FQ=async function({cacheDir:t,cwd:e,depth:r=cHt}={}){let n=await UQ(e),i=ch({cacheDir:t,cwd:e});return(await Promise.all(n.map(({name:a,base:c})=>lHt({name:a,base:c,cacheDir:i,depth:r})))).flat()},lHt=async function({name:t,base:e,cacheDir:r,depth:n}){return(await hBe(`${r}/${t}`,{fileFilter:uHt,depth:n,type:"files_directories"})).map(({path:o})=>aHt(e,o))},uHt=function({basename:t}){return!RBe(t)};var dHt=async function(t,{move:e=OBe,ttl:r=mHt,digests:n=[],cacheDir:i,cwd:s}={}){let{srcPath:o,cachePath:a}=await nA({path:t,cacheDir:i,cwdOpt:s});if(!await tA(o))return!1;let{manifestInfo:c,identical:l}=await TBe({cachePath:a,move:e,ttl:r,digests:n});return l||(await jQ(a,{force:!0,recursive:!0,maxRetries:3}),await PQ(o,a,e),await wBe(c)),!0},fHt=async function(t,{move:e=OBe,cacheDir:r,cwd:n}={}){let{srcPath:i,cachePath:s}=await nA({path:t,cacheDir:r,cwdOpt:n});return!await tA(s)||await LQ(s)?!1:(await jQ(i,{force:!0,recursive:!0,maxRetries:3}),await PQ(s,i,e),!0)},pHt=async function(t,{cacheDir:e,cwd:r}={}){let{cachePath:n}=await nA({path:t,cacheDir:e,cwdOpt:r});return await tA(n)?(await jQ(n,{force:!0,recursive:!0,maxRetries:3}),await ABe(n),!0):!1},hHt=async function(t,{cacheDir:e,cwd:r}={}){let{cachePath:n}=await nA({path:t,cacheDir:e,cwdOpt:r});return await tA(n)&&!await LQ(n)},OBe=!1,mHt=void 0,e1=async function(t,e,...r){return Array.isArray(e)?(await Promise.all(e.map(i=>t(i,...r)))).some(Boolean):t(e,...r)},gHt=e1.bind(null,dHt),_Ht=e1.bind(null,fHt),yHt=e1.bind(null,pHt),SHt=e1.bind(null,hHt),PBe=function(t){return{save:(e,r)=>gHt(e,{...t,...r}),restore:(e,r)=>_Ht(e,{...t,...r}),remove:(e,r)=>yHt(e,{...t,...r}),has:(e,r)=>SHt(e,{...t,...r}),list:e=>FQ({...t,...e}),getCacheDir:e=>ch({...t,...e})}};var EHt=ye("opencode_session"),vHt=async t=>{try{let e=await WD(t),{stdout:r}=await hn(e,["session","list","--format","json"],{cwd:t,env:{...process.env,OPENCODE_DISABLE_AUTOUPDATE:"1"}}),n=String(r??"").trim();if(!n)return[];let i=JSON.parse(n);return Array.isArray(i)?i:[]}catch(e){return EHt.warn("Could not list opencode sessions",{error:e?.message}),[]}},qQ=new Map,CBe=t=>{let e=qQ.get(t);if(e)return e;let r=vHt(t).finally(()=>qQ.delete(t));return qQ.set(t,r),r},NBe=async t=>(await CBe(t)).length>0,kBe=async(t,e)=>e?(await CBe(t)).some(r=>r.id===e):!1;var Zr=ye("native_session"),BQ=async(t,e)=>(await Promise.all(e.map(async n=>{try{return await El.stat(vl.join(t,n)),n}catch{return null}}))).filter(n=>n!==null),mh=async({runnerId:t,sessionId:e,archive:r,nativeSessionId:n})=>{if(!r)return Zr.log("No native session archive descriptor for this runner, skipping"),null;let{baseDir:i,include:s}=r,o=!1;try{o=(await El.stat(i)).isDirectory()}catch{}if(!o)return Zr.log(`Native session base dir ${i} not found, skipping`),null;let a=await BQ(i,s);if(a.length===0)return Zr.log(`No native session history found under ${i}, skipping`),null;let c=vl.join($Be.tmpdir(),`native-session-${e}.zip`);try{await hn("zip",["-r","-q","-X",c,...a],{cwd:i});let l=await El.readFile(c);Zr.log(`Zipped native session (${l.length} bytes) from ${a.join(", ")}`,{nativeSessionId:n});let{upload_url:u,s3_key:d}=await $1e(t,e);return await B1e(u,l,{contentType:"application/zip"}),Zr.log("Successfully uploaded native session to S3"),d}catch(l){return Zr.error("Failed to archive/upload native session, continuing without it:",l),null}finally{await El.rm(c,{force:!0}).catch(()=>{})}},LBe=async(t,e,r=process.cwd())=>{if(e==="opencode")return NBe(r);if(!t)return!1;let{baseDir:n,include:i}=t,s=await BQ(n,i);for(let o of s)if((await El.readdir(vl.join(n,o)).catch(()=>[])).length>0)return!0;return!1},bHt=t=>t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),DBe=async(t,e)=>{let r=await El.readdir(t,{withFileTypes:!0}).catch(()=>[]);for(let n of r)if(n.isDirectory()){if(await DBe(vl.join(t,n.name),e))return!0}else if(e.test(n.name))return!0;return!1},MBe=async(t,e,r,n=process.cwd())=>{if(r==="opencode")return kBe(n,e);if(!t||!e)return!1;let i=new RegExp(`(^|[^a-zA-Z0-9])${bHt(e)}([^a-zA-Z0-9]|$)`),{baseDir:s,include:o}=t,a=await BQ(s,o);for(let c of a)if(await DBe(vl.join(s,c),i))return!0;return!1},UBe=async({runnerId:t,sessionId:e,archive:r})=>{if(!r)return Zr.log("No native session archive descriptor for this runner, skipping restore"),!1;let{baseDir:n}=r,i=vl.join($Be.tmpdir(),`native-session-restore-${e}.zip`);try{let s=await L1e(t,e);if(!s?.download_url)return Zr.log("No native session available to restore, skipping"),!1;let o=await q1e(s.download_url);return await El.writeFile(i,o),Zr.log(`Downloaded native session (${o.length} bytes) to ${i}`),await El.mkdir(n,{recursive:!0}),await hn("unzip",["-o","-q",i,"-d",n]),Zr.log(`Restored native session into ${n}`),!0}catch(s){return Zr.error("Failed to fetch/restore native session, continuing without it:",s),!1}finally{await El.rm(i,{force:!0}).catch(()=>{})}},THt="native-sessions",FBe=(t,e)=>PBe({cacheDir:vl.join(e.dir,THt),cwd:t}),jBe=async({archive:t,cache:e})=>{if(!e?.dir||!t)return!1;let{baseDir:r,include:n}=t;try{return await FBe(r,e).restore(n.map(s=>vl.join(r,s)),{})?(Zr.log(`Restored native session from buildbot cache into ${r}`),!0):(Zr.log("No native session in buildbot cache, skipping restore"),!1)}catch(i){return Zr.error("Failed to restore native session from buildbot cache, continuing without it:",i),!1}},LS=async({archive:t,cache:e,nativeSessionId:r})=>{if(!e?.dir||!t)return Zr.log("No buildbot cache configured for the native session, skipping cache seed",{nativeSessionId:r}),!1;let{baseDir:n,include:i}=t;try{return await FBe(n,e).save(i.map(o=>vl.join(n,o)),{})?(Zr.log(`Saved native session to buildbot cache under ${e.dir}`,{nativeSessionId:r}),!0):(Zr.log("No native session history to save to buildbot cache, skipping"),!1)}catch(s){return Zr.error("Failed to save native session to buildbot cache, continuing:",s),!1}};var DS=ye("inference_stage"),qBe=5,kd=async t=>{let{additionalContext:e,cliPath:r,config:n,context:i,buildErrors:s,runner:o,persistSteps:a,aiGateway:c,attempt:l,contextPrefix:u,priorAgentSessionId:d,cwd:f,abortSignal:p,onSessionId:h,resumeSession:m,effortOverride:_,answerFold:y}=t;if(Si())throw new Error("Shutdown in progress, aborting inference stage");DS.log(`Running inference stage, attempt ${l} of ${qBe}`);let v=!1,S=await Gt(mt(),"inference-stage",async g=>{g?.setAttributes({"inference.attempt":l||1}),a0e();let T=!!(l&&l>1),I=await wHt(n,T,f),x=!!m&&!!d;x&&n.runner==="gemini"&&!await O0(d)&&(x=!1);let R=I.viable||x;v=R,I.outcome!=="not_eligible"&&ge.inc("inference.native_resume",1,{outcome:I.outcome,...I.source?{source:I.source}:{}});let O=n;if("prompt"in n&&n.answeredInteraction&&Be().questionsEnabled){let P=n.answeredInteraction,N=R||T&&!!d,j=[P];if(!N){y.allAnswered??=OUe(n);let V=await y.allAnswered;V===null&&(y.allAnswered=void 0),V&&V.length>0&&(j=V.some(de=>de.refId===P.refId)?V:[...V,P])}O={...n,prompt:NUe(n.prompt,j)},!T&&!y.counted&&(y.counted=!0,DS.log("Resuming session with answered questions",{sessionId:n.sessionId,interactionCount:j.length}),ge.inc("inference.answer_resume",1,{fold:N?"latest":"all"}),CUe(P))}let{prompt:A}=await Gt(mt(),"compose-prompt",async()=>await RUe({cliPath:r,config:O,buildErrorContext:AHt(s),netlify:i,additionalContext:e,resumePrompt:R})),b=`
910
+ `,l=await BVt({hash:o,manifestPath:i,manifestString:c});return{manifestInfo:{manifestPath:i,manifestString:c},identical:l}},BVt=async function({hash:t,manifestPath:e,manifestString:r}){return t===void 0||!bBe(e)?!1:await vBe(e,"utf8")===r},wBe=async function({manifestPath:t,manifestString:e}){await UVt(qVt(t),{recursive:!0}),await jVt(t,e)},ABe=async function(t){let e=QM(t);await FVt(e,{force:!0,recursive:!0,maxRetries:3})},QM=function(t){return`${t}${xBe}`},RBe=function(t){return t.endsWith(xBe)},xBe=".netlify.cache.json",LQ=async function(t){let e=QM(t);if(!bBe(e))return!1;let{expires:r}=await zVt(t);return gBe(r)},zVt=async function(t){let e=QM(t),r=await vBe(e,"utf-8");return JSON.parse(r)};import{homedir as YVt}from"os";import{resolve as IBe,isAbsolute as KVt,join as JVt,sep as MQ}from"path";import{normalize as VVt}from"path";import{existsSync as HVt}from"fs";import GVt from"process";var DQ=function(t){try{let e=WVt(t);return HVt(e)?Promise.resolve(e):Promise.resolve("")}catch{return Promise.resolve("")}},WVt=function(t=GVt.cwd()){return VVt(t)};var nA=async function({path:t,cacheDir:e,cwdOpt:r}){let n=await ZVt(t,r),i=await tHt({srcPath:n,cacheDir:e,cwdOpt:r});return{srcPath:n,cachePath:i}},ZVt=async function(t,e){let r=await DQ(e),n=XVt(t,r);return QVt(n,r),n},XVt=function(t,e){if(KVt(t))return IBe(t);if(e!=="")return IBe(e,t);throw new Error(`Current directory does not exist: ${e}`)},QVt=function(t,e){if(e!==""&&eHt(t,e))throw new Error(`Cannot cache ${t} because it is the current directory (${e}) or a parent directory`)},eHt=function(t,e){return`${e}${MQ}`.startsWith(`${t}${MQ}`)},tHt=async function({srcPath:t,cacheDir:e,cwdOpt:r}){let n=ch({cacheDir:e,cwd:r}),{name:i,relPath:s}=await rHt(t,r);return JVt(n,i,s)},rHt=async function(t,e){let r=await UQ(e),n=nHt(t);return r.map(({name:i,base:s})=>sHt(i,s,n)).find(Boolean)},nHt=function(t){return t.replace(iHt,"\\")},iHt=/^[a-zA-Z]:\\/,sHt=function(t,e,r){if(r===e||!r.startsWith(e))return;let n=r.replace(e,"");return{name:t,relPath:n}},UQ=async function(t){return[...await oHt(t),{name:"home",base:YVt()},{name:"root",base:MQ}]},oHt=async function(t){let e=await DQ(t);return e===""?[]:[{name:"cwd",base:e}]};var cHt=1,FQ=async function({cacheDir:t,cwd:e,depth:r=cHt}={}){let n=await UQ(e),i=ch({cacheDir:t,cwd:e});return(await Promise.all(n.map(({name:a,base:c})=>lHt({name:a,base:c,cacheDir:i,depth:r})))).flat()},lHt=async function({name:t,base:e,cacheDir:r,depth:n}){return(await hBe(`${r}/${t}`,{fileFilter:uHt,depth:n,type:"files_directories"})).map(({path:o})=>aHt(e,o))},uHt=function({basename:t}){return!RBe(t)};var dHt=async function(t,{move:e=OBe,ttl:r=mHt,digests:n=[],cacheDir:i,cwd:s}={}){let{srcPath:o,cachePath:a}=await nA({path:t,cacheDir:i,cwdOpt:s});if(!await tA(o))return!1;let{manifestInfo:c,identical:l}=await TBe({cachePath:a,move:e,ttl:r,digests:n});return l||(await jQ(a,{force:!0,recursive:!0,maxRetries:3}),await PQ(o,a,e),await wBe(c)),!0},fHt=async function(t,{move:e=OBe,cacheDir:r,cwd:n}={}){let{srcPath:i,cachePath:s}=await nA({path:t,cacheDir:r,cwdOpt:n});return!await tA(s)||await LQ(s)?!1:(await jQ(i,{force:!0,recursive:!0,maxRetries:3}),await PQ(s,i,e),!0)},pHt=async function(t,{cacheDir:e,cwd:r}={}){let{cachePath:n}=await nA({path:t,cacheDir:e,cwdOpt:r});return await tA(n)?(await jQ(n,{force:!0,recursive:!0,maxRetries:3}),await ABe(n),!0):!1},hHt=async function(t,{cacheDir:e,cwd:r}={}){let{cachePath:n}=await nA({path:t,cacheDir:e,cwdOpt:r});return await tA(n)&&!await LQ(n)},OBe=!1,mHt=void 0,e1=async function(t,e,...r){return Array.isArray(e)?(await Promise.all(e.map(i=>t(i,...r)))).some(Boolean):t(e,...r)},gHt=e1.bind(null,dHt),_Ht=e1.bind(null,fHt),yHt=e1.bind(null,pHt),SHt=e1.bind(null,hHt),PBe=function(t){return{save:(e,r)=>gHt(e,{...t,...r}),restore:(e,r)=>_Ht(e,{...t,...r}),remove:(e,r)=>yHt(e,{...t,...r}),has:(e,r)=>SHt(e,{...t,...r}),list:e=>FQ({...t,...e}),getCacheDir:e=>ch({...t,...e})}};var EHt=ye("opencode_session"),vHt=async t=>{try{let e=await WD(t),{stdout:r}=await hn(e,["session","list","--format","json"],{cwd:t,env:{...process.env,OPENCODE_DISABLE_AUTOUPDATE:"1"}}),n=String(r??"").trim();if(!n)return[];let i=JSON.parse(n);return Array.isArray(i)?i:[]}catch(e){return EHt.warn("Could not list opencode sessions",{error:e?.message}),[]}},qQ=new Map,CBe=t=>{let e=qQ.get(t);if(e)return e;let r=vHt(t).finally(()=>qQ.delete(t));return qQ.set(t,r),r},NBe=async t=>(await CBe(t)).length>0,kBe=async(t,e)=>e?(await CBe(t)).some(r=>r.id===e):!1;var Zr=ye("native_session"),BQ=async(t,e)=>(await Promise.all(e.map(async n=>{try{return await El.stat(vl.join(t,n)),n}catch{return null}}))).filter(n=>n!==null),mh=async({runnerId:t,sessionId:e,archive:r,nativeSessionId:n})=>{if(!r)return Zr.log("No native session archive descriptor for this runner, skipping"),null;let{baseDir:i,include:s}=r,o=!1;try{o=(await El.stat(i)).isDirectory()}catch{}if(!o)return Zr.log(`Native session base dir ${i} not found, skipping`),null;let a=await BQ(i,s);if(a.length===0)return Zr.log(`No native session history found under ${i}, skipping`),null;let c=vl.join($Be.tmpdir(),`native-session-${e}.zip`);try{await hn("zip",["-r","-q","-X",c,...a],{cwd:i});let l=await El.readFile(c);Zr.log(`Zipped native session (${l.length} bytes) from ${a.join(", ")}`,{nativeSessionId:n});let{upload_url:u,s3_key:d}=await $1e(t,e);return await B1e(u,l,{contentType:"application/zip"}),Zr.log("Successfully uploaded native session to S3"),d}catch(l){return Zr.error("Failed to archive/upload native session, continuing without it:",l),null}finally{await El.rm(c,{force:!0}).catch(()=>{})}},LBe=async(t,e,r=process.cwd())=>{if(e==="opencode")return NBe(r);if(!t)return!1;let{baseDir:n,include:i}=t,s=await BQ(n,i);for(let o of s)if((await El.readdir(vl.join(n,o)).catch(()=>[])).length>0)return!0;return!1},bHt=t=>t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),DBe=async(t,e)=>{let r=await El.readdir(t,{withFileTypes:!0}).catch(()=>[]);for(let n of r)if(n.isDirectory()){if(await DBe(vl.join(t,n.name),e))return!0}else if(e.test(n.name))return!0;return!1},MBe=async(t,e,r,n=process.cwd())=>{if(r==="opencode")return kBe(n,e);if(!t||!e)return!1;let i=new RegExp(`(^|[^a-zA-Z0-9])${bHt(e)}([^a-zA-Z0-9]|$)`),{baseDir:s,include:o}=t,a=await BQ(s,o);for(let c of a)if(await DBe(vl.join(s,c),i))return!0;return!1},UBe=async({runnerId:t,sessionId:e,archive:r})=>{if(!r)return Zr.log("No native session archive descriptor for this runner, skipping restore"),!1;let{baseDir:n}=r,i=vl.join($Be.tmpdir(),`native-session-restore-${e}.zip`);try{let s=await L1e(t,e);if(!s?.download_url)return Zr.log("No native session available to restore, skipping"),!1;let o=await q1e(s.download_url);return await El.writeFile(i,o),Zr.log(`Downloaded native session (${o.length} bytes) to ${i}`),await El.mkdir(n,{recursive:!0}),await hn("unzip",["-o","-q",i,"-d",n]),Zr.log(`Restored native session into ${n}`),!0}catch(s){return Zr.error("Failed to fetch/restore native session, continuing without it:",s),!1}finally{await El.rm(i,{force:!0}).catch(()=>{})}},THt="native-sessions",FBe=(t,e)=>PBe({cacheDir:vl.join(e.dir,THt),cwd:t}),jBe=async({archive:t,cache:e})=>{if(!e?.dir||!t)return!1;let{baseDir:r,include:n}=t;try{return await FBe(r,e).restore(n.map(s=>vl.join(r,s)),{})?(Zr.log(`Restored native session from buildbot cache into ${r}`),!0):(Zr.log("No native session in buildbot cache, skipping restore"),!1)}catch(i){return Zr.error("Failed to restore native session from buildbot cache, continuing without it:",i),!1}},LS=async({archive:t,cache:e,nativeSessionId:r})=>{if(!e?.dir||!t)return Zr.log("No buildbot cache configured for the native session, skipping cache seed",{nativeSessionId:r}),!1;let{baseDir:n,include:i}=t;try{return await FBe(n,e).save(i.map(o=>vl.join(n,o)),{})?(Zr.log(`Saved native session to buildbot cache under ${e.dir}`,{nativeSessionId:r}),!0):(Zr.log("No native session history to save to buildbot cache, skipping"),!1)}catch(s){return Zr.error("Failed to save native session to buildbot cache, continuing:",s),!1}};var DS=ye("inference_stage"),qBe=5,kd=async t=>{let{additionalContext:e,cliPath:r,config:n,context:i,buildErrors:s,runner:o,persistSteps:a,aiGateway:c,attempt:l,contextPrefix:u,priorAgentSessionId:d,cwd:f,abortSignal:p,onSessionId:h,resumeSession:m,effortOverride:_,answerFold:y}=t;if(Si())throw new Error("Shutdown in progress, aborting inference stage");DS.log(`Running inference stage, attempt ${l} of ${qBe}`);let v=!1,S=await Gt(mt(),"inference-stage",async g=>{g?.setAttributes({"inference.attempt":l||1}),a0e();let T=!!(l&&l>1),I=await wHt(n,T,f),x=!!m&&!!d;x&&n.runner==="gemini"&&!await O0(d)&&(x=!1);let R=I.viable||x;v=R,I.outcome!=="not_eligible"&&ge.inc("inference.native_resume",1,{outcome:I.outcome,...I.source?{source:I.source}:{}});let O=n;if("prompt"in n&&n.answeredInteraction&&Be().questionsEnabled){let P=n.answeredInteraction,N=R||T&&!!d,F=[P];if(!N){y.allAnswered??=OUe(n);let V=await y.allAnswered;V===null&&(y.allAnswered=void 0),V&&V.length>0&&(F=V.some(de=>de.refId===P.refId)?V:[...V,P])}O={...n,prompt:NUe(n.prompt,F)},!T&&!y.counted&&(y.counted=!0,DS.log("Resuming session with answered questions",{sessionId:n.sessionId,interactionCount:F.length}),ge.inc("inference.answer_resume",1,{fold:N?"latest":"all"}),CUe(P))}let{prompt:A}=await Gt(mt(),"compose-prompt",async()=>await RUe({cliPath:r,config:O,buildErrorContext:AHt(s),netlify:i,additionalContext:e,resumePrompt:R})),b=`
911
911
  ${u||""}
912
912
  ${A}
913
- `.trim(),L={...n,prompt:b},C=d??(R?I.sessionId:void 0),w=await Gt(mt(),`run-${n.runner}`,async P=>{let N=YJ();P?.setAttributes({"gen_ai.operation.name":"chat","gen_ai.capability.name":n.mode,"gen_ai.provider.name":GDe(n.runner),"gen_ai.system":n.runner,...N?{"gen_ai.input.messages":dD("user",b)}:{}});let j=Date.now(),V=await o({aiGateway:c,config:L,netlify:i,persistSteps:a,continueSession:T||R,priorAgentSessionId:C,cwd:f,cliPath:r,abortSignal:p,onSessionId:h,..._?{effortOverride:_}:{}}),de=Date.now(),Te=V.resolvedModel||n.model||"unknown",Ie=V.error?"error":"stop";return P?.setAttributes({...N?{"gen_ai.output.messages":dD("assistant",V.result??V.error??"",Ie)}:{},"gen_ai.response.finish_reasons":[Ie],"gen_ai.request.model":Te,"gen_ai.response.model":Te,"gen_ai.request.effort":V.effort??"auto",...V.usage?.input_tokens!=null?{"gen_ai.usage.input_tokens":V.usage.input_tokens}:{},...V.usage?.output_tokens!=null?{"gen_ai.usage.output_tokens":V.usage.output_tokens}:{},...V.usage?.cache_creation_input_tokens!=null?{"gen_ai.usage.cache_creation.input_tokens":V.usage.cache_creation_input_tokens}:{},...V.usage?.cache_read_input_tokens!=null?{"gen_ai.usage.cache_read.input_tokens":V.usage.cache_read_input_tokens}:{},...V.usage?.reasoning_output_tokens!=null?{"gen_ai.usage.reasoning.output_tokens":V.usage.reasoning_output_tokens}:{}}),WDe(V.steps??[],n.mode,j,de),V});return w.result&&(w.result=ws(w.result)),w.error&&(w.error=ws(w.error)),await a.flush(),w});if(S.aborted)return DS.log("Inference turn was interrupted (credit wrap-up); skipping retry/error handling",{agentSessionId:S.agentSessionId}),{runnerResult:S,nativeResume:v};if(S.error){if(Si()){let g=new Error("Shutdown in progress, aborting inference stage");throw Object.assign(g,{agentSessionId:S.agentSessionId}),g}if(DS.error("Runner failed",{stepsCount:S.steps.length,duration:S.duration,error:S.error,isRetryableError:S.isRetryableError,attempt:l||1,agentSessionId:S.agentSessionId}),ge.inc("inference.failed",1,{attempt:l||1,is_retryable:!!S.isRetryableError,is_provider_unavailable:!!S.isProviderUnavailableError,is_answer_resume:!!n.answeredInteraction}),S.isRetryableError&&(!l||l<qBe))return DS.log("Retrying inference stage"),await new Promise(T=>setTimeout(T,5e3)),{runnerResult:(await kd({...t,attempt:(l||1)+1,priorAgentSessionId:S.agentSessionId,contextPrefix:S.agentSessionId?"":"<important> The agent has already started on this work but ran into networking errors trying to complete it. Please continue from where it left off (you can use git commands to see what's currently changed thus far) and do not start over. Here is the full prompt for context: </important>"})).runnerResult,nativeResume:v};{if(DS.log("Do not retry inference stage"),S.error.toLowerCase().includes("usage exceeded")){let T=new Vs(S.error,503,"Credit limit reached. Please add more credits to continue using Agent Runners.",!0);throw Object.assign(T,{agentSessionId:S.agentSessionId}),T}let g=S.isRetryableError||S.isProviderUnavailableError?new Fd(S.error):new Error(S.error);throw Object.assign(g,{agentSessionId:S.agentSessionId}),g}}return{runnerResult:S,nativeResume:v}},wHt=async(t,e,r=process.cwd())=>{if(e)return{viable:!1,outcome:"not_eligible"};let n=t.previousSession,{viable:i,outcome:s}=xUe(t);if(!i)return{viable:i,outcome:s};let o=n?.nativeSessionId,a=gl(t.runner),c=async()=>o?t.runner==="gemini"?!!await jZ(o):MBe(a,o,t.runner,r):!1,l;if(BBe(t)&&await LBe(a,t.runner,r))l="local";else if(t.fastInit&&Be().warmNativeResumeEnabled&&await jBe({archive:a,cache:t.cache})&&await c())l="cache_restore";else{if(l="fetch",!Be().coldResumeFromS3Enabled)return{viable:!1,outcome:"cold_resume_disabled",source:l};if(!await UBe({runnerId:t.id,sessionId:t.sessionId,archive:a}))return{viable:!1,outcome:"fetch_failed",source:l}}return t.runner==="gemini"&&o&&!await O0(o)?{viable:!1,outcome:"sanitize_failed",source:l}:{viable:!0,sessionId:o,outcome:"resumed",source:l}},AHt=t=>!t||t.length===0?"":`
913
+ `.trim(),L={...n,prompt:b},C=d??(R?I.sessionId:void 0),w=await Gt(mt(),`run-${n.runner}`,async P=>{let N=YJ();P?.setAttributes({"gen_ai.operation.name":"chat","gen_ai.capability.name":n.mode,"gen_ai.provider.name":GDe(n.runner),"gen_ai.system":n.runner,...N?{"gen_ai.input.messages":dD("user",b)}:{}});let F=Date.now(),V=await o({aiGateway:c,config:L,netlify:i,persistSteps:a,continueSession:T||R,priorAgentSessionId:C,cwd:f,cliPath:r,abortSignal:p,onSessionId:h,..._?{effortOverride:_}:{}}),de=Date.now(),Te=V.resolvedModel||n.model||"unknown",Ie=V.error?"error":"stop";return P?.setAttributes({...N?{"gen_ai.output.messages":dD("assistant",V.result??V.error??"",Ie)}:{},"gen_ai.response.finish_reasons":[Ie],"gen_ai.request.model":Te,"gen_ai.response.model":Te,"gen_ai.request.effort":V.effort??"auto",...V.usage?.input_tokens!=null?{"gen_ai.usage.input_tokens":V.usage.input_tokens}:{},...V.usage?.output_tokens!=null?{"gen_ai.usage.output_tokens":V.usage.output_tokens}:{},...V.usage?.cache_creation_input_tokens!=null?{"gen_ai.usage.cache_creation.input_tokens":V.usage.cache_creation_input_tokens}:{},...V.usage?.cache_read_input_tokens!=null?{"gen_ai.usage.cache_read.input_tokens":V.usage.cache_read_input_tokens}:{},...V.usage?.reasoning_output_tokens!=null?{"gen_ai.usage.reasoning.output_tokens":V.usage.reasoning_output_tokens}:{}}),WDe(V.steps??[],n.mode,F,de),V});return w.result&&(w.result=ws(w.result)),w.error&&(w.error=ws(w.error)),await a.flush(),w});if(S.aborted)return DS.log("Inference turn was interrupted (credit wrap-up); skipping retry/error handling",{agentSessionId:S.agentSessionId}),{runnerResult:S,nativeResume:v};if(S.error){if(Si()){let g=new Error("Shutdown in progress, aborting inference stage");throw Object.assign(g,{agentSessionId:S.agentSessionId}),g}if(DS.error("Runner failed",{stepsCount:S.steps.length,duration:S.duration,error:S.error,isRetryableError:S.isRetryableError,attempt:l||1,agentSessionId:S.agentSessionId}),ge.inc("inference.failed",1,{attempt:l||1,is_retryable:!!S.isRetryableError,is_provider_unavailable:!!S.isProviderUnavailableError,is_answer_resume:!!n.answeredInteraction}),S.isRetryableError&&(!l||l<qBe))return DS.log("Retrying inference stage"),await new Promise(T=>setTimeout(T,5e3)),{runnerResult:(await kd({...t,attempt:(l||1)+1,priorAgentSessionId:S.agentSessionId,contextPrefix:S.agentSessionId?"":"<important> The agent has already started on this work but ran into networking errors trying to complete it. Please continue from where it left off (you can use git commands to see what's currently changed thus far) and do not start over. Here is the full prompt for context: </important>"})).runnerResult,nativeResume:v};{if(DS.log("Do not retry inference stage"),S.error.toLowerCase().includes("usage exceeded")){let T=new Vs(S.error,503,"Credit limit reached. Please add more credits to continue using Agent Runners.",!0);throw Object.assign(T,{agentSessionId:S.agentSessionId}),T}let g=S.isRetryableError||S.isProviderUnavailableError?new Fd(S.error):new Error(S.error);throw Object.assign(g,{agentSessionId:S.agentSessionId}),g}}return{runnerResult:S,nativeResume:v}},wHt=async(t,e,r=process.cwd())=>{if(e)return{viable:!1,outcome:"not_eligible"};let n=t.previousSession,{viable:i,outcome:s}=xUe(t);if(!i)return{viable:i,outcome:s};let o=n?.nativeSessionId,a=gl(t.runner),c=async()=>o?t.runner==="gemini"?!!await jZ(o):MBe(a,o,t.runner,r):!1,l;if(BBe(t)&&await LBe(a,t.runner,r))l="local";else if(t.fastInit&&Be().warmNativeResumeEnabled&&await jBe({archive:a,cache:t.cache})&&await c())l="cache_restore";else{if(l="fetch",!Be().coldResumeFromS3Enabled)return{viable:!1,outcome:"cold_resume_disabled",source:l};if(!await UBe({runnerId:t.id,sessionId:t.sessionId,archive:a}))return{viable:!1,outcome:"fetch_failed",source:l}}return t.runner==="gemini"&&o&&!await O0(o)?{viable:!1,outcome:"sanitize_failed",source:l}:{viable:!0,sessionId:o,outcome:"resumed",source:l}},AHt=t=>!t||t.length===0?"":`
914
914
  Deploy failed. Here are the errors to review on the latest build:
915
915
 
916
916
  Below are all of the logs with potential issues that we extracted. Some of them may be false positives, discern them carefully and ensure fixes are relevant.
@@ -923,17 +923,17 @@ Preview deploy created successfully:`,{deployId:f.deploy_id,deployUrl:f.deploy_u
923
923
  `)},JBe=t=>{let e=[];return t.missingOnDisk.length>0&&e.push("You deleted the following migration file(s) that are already applied to the preview database branch:",...t.missingOnDisk.map(r=>`- ${r.name}`),"","Applied migrations cannot be removed \u2014 the deploy will fail because the platform requires every applied","migration to exist on disk with its original content. Please revise your work:","","1. Restore the deleted file(s) by running `netlify db migrations pull --force`, which overwrites the"," local migrations directory with the authoritative state of the branch. Note this also wipes any"," unapplied migration files you generated this session \u2014 regenerate them via `npx drizzle-kit generate`"," afterwards if you still need them (your `db/schema.ts` edits aren't affected by the pull).","2. If the underlying problem is that an applied migration is wrong, add a NEW migration on top that"," corrects whatever it did (drop a column, rename a table, etc.). Do not touch the original."),t.outOfOrder.length>0&&(e.length>0&&e.push(""),e.push("The following pending migration file(s) have a version prefix that sorts BEFORE migrations already","applied to the branch, so the platform will reject them on deploy:",...t.outOfOrder.map(r=>`- ${r.name} (version ${r.version} \u2264 applied max ${r.maxApplied})`),"","Delete these out-of-order files (use `netlify db migrations reset` \u2014 it only removes unapplied files),","then run `npx drizzle-kit generate` to produce a replacement whose version sorts after the applied","migrations.")),e.length===0?null:e.join(`
924
924
  `)},ZBe=t=>t.missingOnDisk.length>0||t.outOfOrder.length>0;var XBe=ye("db_migrations_verify"),QBe=async t=>await Gt(mt(),"db-migrations-verify-stage",async e=>{let r;try{r=await i1({cliPath:t.cliPath,cwd:t.cwd})}catch(i){return XBe.warn("Skipping migration verification \u2014 failed to read status",{error:i}),e?.setAttributes({"verify.skipped":!0,"verify.skip_reason":"status_error"}),{}}if(!ZBe(r))return e?.setAttributes({"verify.drift":!1}),{};let n=JBe(r);return e?.setAttributes({"verify.drift":!0,"verify.missing_on_disk_count":r.missingOnDisk.length,"verify.out_of_order_count":r.outOfOrder.length}),XBe.log("Detected post-inference migration drift",{missingOnDisk:r.missingOnDisk.map(i=>i.name),outOfOrder:r.outOfOrder.map(i=>i.name)}),{error:n??void 0}});import Zee from"process";import n3t from"net";var ns=jn(Yee(),1),_Hr=ns.default.Client,yHr=ns.default.Pool,SHr=ns.default.Connection,EHr=ns.default.types,vHr=ns.default.Query,bHr=ns.default.DatabaseError,THr=ns.default.escapeIdentifier,wHr=ns.default.escapeLiteral,AHr=ns.default.Result,RHr=ns.default.TypeOverrides,xHr=ns.default.defaults,zVe=ns.default;var i3t=80877103,s3t=196608,o3t=Buffer.from([78]);function a3t(){let t=Buffer.alloc(9);t.writeUInt8(82,0),t.writeInt32BE(8,1),t.writeInt32BE(0,5);let e=Buffer.alloc(6);return e.writeUInt8(90,0),e.writeInt32BE(5,1),e.writeUInt8(73,5),Buffer.concat([t,e])}function b1(t){let e=Buffer.from("SERROR\0","utf8"),r=Buffer.concat([Buffer.from("M","utf8"),Buffer.from(t+"\0","utf8")]),n=Buffer.from("CXX000\0","utf8"),i=Buffer.from([0]),s=e.length+r.length+n.length+i.length,o=Buffer.alloc(5);return o.writeUInt8(69,0),o.writeInt32BE(s+4,1),Buffer.concat([o,e,n,r,i])}async function c3t(t){let{clientSocket:e,provision:r,logger:n,cleanup:i}=t,s;try{s=await r()}catch(f){let p=f instanceof Error?f.message:"Provisioning failed";throw n("Provisioning error:",p),e.end(b1(p)),i(),f}let o=u3t(s),a=new zVe.Client({host:o.host,port:o.port,user:o.user,password:o.password,database:o.database,ssl:o.ssl,options:o.options});a.on("error",()=>{});try{await a.connect()}catch(f){let p=f instanceof Error?f.message:"Remote connection failed";throw n("Remote connection error:",p),e.end(b1(p)),i(),f}let c=a.connection,l=c.stream;c.removeAllListeners(),l.removeAllListeners();let u=l,d=f=>p=>{p.code!=="ECONNRESET"&&n(`${f} socket error:`,p.message),i()};return u.on("error",d("Remote")),u.on("close",i),e.on("error",d("Client")),e.on("close",i),e.write(a3t()),e.on("data",f=>{u.destroyed||u.write(f)}),u.on("data",f=>{e.destroyed||e.write(f)}),e.resume(),u}function l3t(t,e){let{provision:r,logger:n,onCleanup:i}=e,s,o="ssl",a=!1;function c(){a||(a=!0,t.destroy(),s?.destroy(),i())}t.on("error",l=>{l.code!=="ECONNRESET"&&n("Client socket error:",l.message),c()}),t.on("data",l=>{if(o==="ssl"){if(l.length>=8&&l.readInt32BE(4)===i3t){t.write(o3t),o="startup";return}o="startup"}if(o==="startup"){if(l.length<8){t.end(b1("Invalid startup message")),c();return}if(l.readInt32BE(4)!==s3t){t.end(b1("Unsupported protocol version")),c();return}t.pause(),t.removeAllListeners("data"),c3t({clientSocket:t,provision:r,logger:n,cleanup:c}).then(d=>{s=d},d=>{n("Startup error:",d),c()})}})}function u3t(t){let e=new URL(t);return{host:e.hostname,port:Number(e.port)||5432,user:decodeURIComponent(e.username),password:decodeURIComponent(e.password),database:e.pathname.slice(1)||"postgres",ssl:e.searchParams.get("sslmode")==="require"?!0:void 0,options:e.searchParams.get("options")??void 0}}var VVe=class{server;sockets=new Set;host;port;logger;provision;constructor(t){this.host=t.host??"127.0.0.1",this.port=t.port??0,this.logger=t.logger??(()=>{}),this.provision=t.provision}async start(){return new Promise((t,e)=>{let r=n3t.createServer(n=>{this.sockets.add(n),n.on("close",()=>{this.sockets.delete(n)}),l3t(n,{provision:this.provision,logger:this.logger,onCleanup:()=>{this.sockets.delete(n)}})});r.on("error",n=>{e(n)}),r.listen(this.port,this.host,()=>{this.server=r;let n=r.address(),i=`postgres://${this.host}:${String(n.port)}`;this.logger("Proxy listening on",i),t(i)})})}async stop(){for(let t of this.sockets)t.destroy();return this.sockets.clear(),new Promise(t=>{if(!this.server){t();return}this.server.close(()=>{this.server=void 0,t()})})}};var T1=ye("db_setup"),HVe=async({siteId:t,isProd:e,alias:r,connectionString:n})=>await Gt(mt(),"db-setup-stage",async i=>{i?.setAttributes({"db_setup.site_id":t,"db_setup.is_prod":e,...r&&{"db_setup.alias":r}});let s;if(e?s="production":r&&(s=r),Zee.env.NETLIFY_DB_BRANCH=s,n)return i?.setAttributes({"db_setup.source":"config","db_setup.has_proxy":!1}),T1.log("Using database connection string provided by the API"),Zee.env.NETLIFY_DB_URL=n,{connectionString:n,wasProvisioned:()=>!1};let o=!1,a=new VVe({logger:(...l)=>T1.log("db-proxy:",...l),provision:async()=>(o=!0,T1.log("Provisioning database for site via API"),await F1e(t),await d3t(t,e,r))}),c=await a.start();return i?.setAttributes({"db_setup.source":"proxy","db_setup.has_proxy":!0}),T1.log("Local DB proxy started",{connectionString:c}),Zee.env.NETLIFY_DB_URL=c,{connectionString:c,proxy:a,wasProvisioned:()=>o}}),d3t=async(t,e,r)=>e||!r?(await D1e(t)).connection_string:(await j1e(t,r),(await U1e(t,r)).connection_string);var f3t=({isHotFollowUp:t,enqueuedAt:e})=>t?e===void 0?[]:[["request",e]]:[["spawn",Number(process.env.NETLIFY_AGENT_RUNNER_SPAWN_AT_MS)],["enqueue",Number(process.env.NETLIFY_AGENT_RUNNER_ENQUEUED_AT_MS)]],Xee=(t,e,r,n)=>{for(let[i,s]of f3t(r))Number.isFinite(s)&&s>0&&s<=n&&t.timing(e,n-s,{from:i})},GVe=(t,e=Date.now(),r=ge)=>Xee(r,"startup.duration",t,e),WVe=(t,e=Date.now(),r=ge)=>Xee(r,"startup.time_to_prompt",t,e),YVe=(t,e=Date.now(),r=ge)=>Xee(r,"startup.time_to_first_output",t,e),w1=(t,e=ge)=>e.inc("startup.failed",1,{reason:t}),KVe=(t,e=Date.now(),r=ge)=>{let n={outcome:t.outcome,native_resume:t.nativeResume,is_answer_resume:t.isAnswerResume};r.timing("session.duration",e-t.startedAt,{hot_follow_up:t.isHotFollowUp,...n}),t.creditsCost!=null&&r.distribution("session.credits_cost",t.creditsCost,{...n,...t.model?{model:t.model}:{},...t.effort?{effort:t.effort}:{}})};function JVe(t){return["One or more AI functions use the legacy **v1** syntax (`exports.handler` / `module.exports.handler`):","",t.map(r=>`- ${r}`).join(`
925
925
  `),"",'Netlify AI Gateway credentials (`ANTHROPIC_API_KEY`, `OPENAI_API_KEY`, `GEMINI_API_KEY` and the matching `*_BASE_URL` variables) are injected ONLY into the modern v2/v3 function runtime. A v1 function builds and deploys successfully but throws "missing API key" at runtime \u2014 this will NOT appear as a build error.',"","Rewrite each listed function using **v2** syntax \u2014 `export default async (req: Request) => Response` \u2014 or **v3** object export (`satisfies NetlifyFunction`), preserving its existing behavior and route. Do not set your own API keys; rely on the injected gateway credentials. See the `netlify-ai-gateway` skill for examples."].join(`
926
- `)}var Md=ye("usage_tracker"),p3t=4e3,h3t=5e3,ZVe=()=>new Vs("AI credit usage exceeded enforced limit.",503,"Credit limit reached. Check credit limits to continue using Agent Runners.",!0),m3t=(t,e,r)=>t===!0||r!=null&&e!=null&&e>=r,g3t=(t,e,r)=>e!=null&&e>0&&r!=null&&t!=null&&t>=r*e,A1=(t,e,r,{softLimitRatio:n,onSoftLimit:i,followPolledCap:s=!1,onHardLimit:o,shouldPollOnTimer:a=!1}={})=>{let c=!1,l=!1,u=!1,d=!1,f,p,h,m=r,_,y=i!=null&&n!=null,v=()=>{_&&(clearInterval(_),_=void 0)},S=async()=>{try{let O=await QD(t,e);Md.log("Usage update response",{usage:O?.usage});let A=O?.usage?.total_credits_cost;A!=null&&(f=A);let b=O?.enforced_credits_cap;if(s&&b!=null&&b!==m){let C=m==null;m=b,Md.log("Took enforced credit cap from usage poll",{enforcedCap:m,totalCreditsCost:A,isFirstCap:C}),C&&ge.inc("session.credit_cap_late_arrival",1)}let L=m3t(O?.credit_limit_exceeded,A,m);if(L){if(Md.log("Credit limit exceeded",{totalCreditsCost:A,enforcedCap:m}),!u){p=Date.now(),h=A??f??0,u=!0;try{o?.(ZVe())}catch(C){Md.warn("onHardLimit callback threw",{error:C?.message||C})}}u=!0,v(),g.cancel()}if(y&&!d&&!L&&g3t(A,m,n)){d=!0,Md.log("Soft credit limit reached",{totalCreditsCost:A,enforcedCap:m,softLimitRatio:n});try{i()}catch(C){Md.warn("onSoftLimit callback threw",{error:C?.message||C})}}}catch(O){Md.warn("Failed to update usage",{error:O?.message||O})}},g=bA(S,p3t);return{onAgentOutput:()=>{if(u)throw ZVe();if(!l){if(c=!0,!a){g();return}_||(_=setInterval(()=>{g()},h3t),_.unref?.())}},stop:async()=>{l||(l=!0,v(),c&&(g.cancel(),Md.log("Sending final usage update"),await S(),p!==void 0&&(ge.timing("credit_limit.overage_duration",Date.now()-p),ge.distribution("credit_limit.overage_credits",Math.max(0,(f??h??0)-(h??0))))))},getCreditsCost:()=>f,getEnforcedCap:()=>m}};var XVe=ye("credit_cap"),_3t=async t=>{if(t.enforcedAICreditsRemaining!=null)return{cap:t.enforcedAICreditsRemaining,source:"env"};if(!Be().fetchCreditCapEnabled)return{source:"unchecked"};try{let e=(await QD(t.id,t.sessionId))?.enforced_credits_cap;if(e!=null)return XVe.log("Resolved enforced credit cap from the usage endpoint",{cap:e}),{cap:e,source:"usage"}}catch(e){XVe.warn("Usage call for the enforced credit cap failed",{error:e?.message||e})}return{source:"none"}},QVe=async(t,e=!1)=>{let{cap:r,source:n}=await _3t(t);t.enforcedAICreditsRemaining=r,ge.inc("session.credit_cap_source",1,{source:n,hot_follow_up:e})};var R1=ye("credit_wrapup"),eHe=(t,e)=>e?t.mode==="create":!1,tHe=async({runnerResult:t,interruptedSessionId:e,originalBudget:r,costAtSoftLimit:n,cliPath:i,config:s,context:o,runner:a,aiGateway:c,cwd:l,persistSteps:u,withStageTimer:d,answerFold:f})=>{let p=Math.max(0,r-n),h=Math.max(1,Math.min(p,r*.15)),m=n+h,_=new AbortController,y=!1,v=A1(s.id,s.sessionId,m),S=Object.assign(async g=>{try{v.onAgentOutput()}catch(T){Ya(T)&&!y&&(y=!0,R1.log("Wrap-up turn hit its hard budget limit \u2014 stopping wrap-up",{wrapUpBudget:h,wrapUpHardLimit:m}),ge.inc("session.credit_wrapup_aborted",1),_.abort())}return u(g)},{flush:u.flush.bind(u)});R1.log("Running credit wrap-up inference turn",{wrapUpBudget:h,wrapUpHardLimit:m,costAtSoftLimit:n,remainingAtSoftLimit:p});try{await u({steps:[{category:Q.Environment,message:"\u26A0\uFE0F You are running low on credits \u2014 wrapping up your project now."}],duration:0})}catch{}try{let{runnerResult:g}=await d("inference-credit-wrapup",()=>kd({cliPath:i,config:s,context:o,runner:a,persistSteps:S,aiGateway:c,cwd:l,contextPrefix:N1,priorAgentSessionId:e,resumeSession:!0,answerFold:f,effortOverride:"low",abortSignal:_.signal}));return y&&R1.log("Wrap-up turn was aborted due to budget limit"),sb(t,g)}catch(g){return R1.warn("Credit wrap-up turn failed \u2014 proceeding with pre-wrap-up result",{error:g?.message||g}),ge.inc("session.credit_wrapup_failed",1),t}finally{await v.stop()}};import hA from"process";var x1=ye("shutdown"),rHe=!1,nHe,Qee=async t=>{if(rHe)return;if(rHe=!0,x1.info("Shutting down...",{signal:t}),l0e(),ge.distribution("session.hot_followups",aHe()),!oHe()){let r=Date.now(),n=cHe(),i=lHe();n!==void 0&&ge.timing("session.last_linger",r-n),i!==void 0&&ge.timing("session.total_linger",r-i)}let e=nHe?.close().catch(r=>{x1.error("Error closing server during graceful shutdown",r)});await uHe(),await e,await e0(),x1.info("Shutdown complete"),hA.exit(0)},iHe=t=>{nHe=t,hA.on("SIGINT",()=>{Qee("SIGINT")}),hA.on("SIGTERM",()=>{Qee("SIGTERM")}),hA.on("unhandledRejection",e=>{x1.error("Unhandled promise rejection \u2014 exiting",e),hA.exit(1)})},sHe=t=>{Qee(t)};var fHe=4e3,y3t=3e4,dHe=ye("credit_limit_preservation"),pHe=async(t,e)=>{let r=null,n={},i=[];if(e){WS(e);let s=gl(t.runner);i.push(Promise.all([mh({runnerId:t.id,sessionId:t.sessionId,archive:s,nativeSessionId:e}).then(o=>{r=o}),LS({archive:s,cache:t.cache,nativeSessionId:e})]).catch(o=>{dHe.warn("Failed to preserve native session on credit-limit shutdown",{error:o?.message||o})}))}if(t.mode!=="ask"&&i.push(iM({config:t}).then(s=>s.hasChanges?HQ({config:t,diff:s.diff,diffBinary:s.diffBinary,resultDiff:s.resultDiff,resultDiffBinary:s.resultDiffBinary}):{}).then(s=>{n=s}).catch(s=>{dHe.warn("Failed to preserve working-tree diff on credit-limit shutdown",{error:s?.message||s})})),i.length>0){let s=!1;await Promise.race([Promise.all(i).then(()=>{s=!0}),new Promise(o=>{setTimeout(o,y3t).unref()})]),s||ge.inc("credit_preservation.timed_out",1)}return{nativeSessionS3Key:r,diffFields:n}};var b3t=v3t(import.meta.url),mA=b3t("../package.json"),Wt=ye("pipeline_index"),YS=3,T3t=["codex","gemini"],hHe=async({config:t,apiToken:e,cliPath:r="netlify",cwd:n,filter:i,isHotFollowUp:s=!1,enqueuedAt:o,tracing:a={}})=>{let c,l,u,d=null,f=Date.now(),p="success",h=!1,m,_,{withStageTimer:y}=u0e(Ic.timeUnits.hours(4)),v=await HDe(mA.version,t.id,a),S=async I=>{let x=async(O,A)=>{try{await A()}catch(b){Wt.warn(`Teardown step failed: ${O}`,{state:I,error:b?.message||b}),ge.inc("teardown.step_failed",1,{step:O,state:I})}},R=I==="completed"&&!process.env.NETLIFY_LOCAL_MODE;await x("usage-tracker",()=>l?.stop()),(I==="errored"||R)&&await x("runner-cleanup",()=>c?.()),await x("db-proxy",()=>u?.stop()),R&&await x("reset-repo",()=>iUe(n))};Wt.log(`Agent runner orchestrator v${mA.version}`,{featureFlags:Be().raw,metrics:JSe()});let g={agent:t.runner,mode:t.mode,is_follow_up:t.sessionHistoryContext.length>0,version:mA.version,fast_init:t.fastInit};$6(g);let T=!!t.answeredInteraction;GVe({isHotFollowUp:s,enqueuedAt:o}),tUe(t.sessionId);try{await Yf(mt(),"run-pipeline",{},v,async I=>{await tte(ete(),t.runner),I?.setAttributes({"gen_ai.capability.name":t.mode,"session.id":t.sessionId,...process.env.NETLIFY_DEV_SERVER_ID?{"dev_server.id":process.env.NETLIFY_DEV_SERVER_ID}:{}});let{aiGateway:x,context:R,persistSteps:O,runner:A,sha:b}=await y("init",()=>uUe({config:t,apiToken:e,cliPath:r,cwd:n,filter:i,runnerVersion:mA.version}),Ic.timeUnits.minutes(10)),L=A.runner;Be().idleTimeoutEnabled||(c=A.clean),await QVe(t,s);let C=eHe(t,Be().creditWrapUpEnabled),w=Be().hardLimitAbortEnabled,P=new AbortController,N=C||w?P.signal:void 0,j,V=!1,de=0,Te;l=A1(t.id,t.sessionId,t.enforcedAICreditsRemaining,{followPolledCap:Be().creditCapFromPollEnabled,shouldPollOnTimer:Be().timedUsagePollEnabled,...C?{softLimitRatio:.7,onSoftLimit:()=>{if(!V){if(!Te){Wt.warn("Soft credit limit reached but no session id yet \u2014 skipping wrap-up interrupt"),ge.inc("session.credit_wrapup_skipped_no_session",1);return}V=!0,de=l?.getCreditsCost()??0,Wt.log("Soft credit limit reached \u2014 interrupting agent to wrap up",{costAtSoftLimit:de}),ge.inc("session.credit_wrapup_triggered",1),P.abort()}}}:{},...w?{onHardLimit:ve=>{V||(j??=ve,Wt.log("Hard credit limit reached \u2014 stopping the agent",{creditsCost:l?.getCreditsCost()}),ge.inc("session.hard_limit_aborted",1),O({steps:[{category:Q.Environment,message:C1}],duration:0}).catch(()=>{}),P.abort())}}:{}});let Ie=GI(t.mode),$e;t.deployAlias&&t.deployAlias.length>0?$e=t.deployAlias:(t.deployAlias!==void 0&&!Ie&&Wt.warn("Received empty deploy alias for a non-prod deploy, falling back to local computation"),$e=Tte(t.id,process.env.SITE_NAME,Ie));let oe=!1,Ee=!1,he=Object.assign(async ve=>{oe||(oe=!0,WVe({isHotFollowUp:s,enqueuedAt:o}));try{l?.onAgentOutput()}catch(Et){return Ya(Et)?j??=Et:Wt.warn("Unexpected error in onAgentOutput",{error:Et?.message||Et}),O(ve)}return!Ee&&ve.steps?.some(Et=>Et.category!==Q.Environment&&Et.category!==Q.SubagentPrompt)&&(Ee=!0,YVe({isHotFollowUp:s,enqueuedAt:o})),O(ve)},{flush:O.flush.bind(O)});if(t.sha=b,t.mode==="redeploy"){let ve=await y("deploy",()=>t1({cliPath:r,config:t,context:R,result:"Redeploy completed",filter:i,isRetry:!1,deploySubdomain:$e}));ve.deployError&&(Wt.warn(`Redeploy deploy failed: ${ve.deployError}`),ge.inc("deploy.failed",1,{attempt:1})),L6({previewDeployed:!!ve.previewInfo,hadFailedAttempts:!!ve.deployError});let{diff:Et,resultDiff:xt,previewInfo:ur,diffBinary:Eh,resultDiffBinary:bn,hasNetlifyForm:P1,hasNetlifyIdentity:THe}=ve;await l?.stop(),await y("cleanup",()=>VQ({config:t,diff:Et,result:"Redeploy completed",duration:0,resultDiff:xt,diffBinary:Eh,resultDiffBinary:bn,previewInfo:ur,isProdDeploy:Ie,hasNetlifyForm:P1,hasNetlifyIdentity:THe,nativeSessionArchive:gl(t.runner)}),Ic.timeUnits.minutes(10),{interruptible:!1}),await S("completed");return}let k=PUe(),U=t.mode==="ask",ne;if(t.mode==="create"&&(ne=(await y("create",()=>XDe({config:t,cwd:n}))).additionalContext),U?(d=jge(t,$e),d&&(ne=[gUe({cliPath:r,branch:d.branch}),ne].filter(Boolean).join(`
926
+ `)}var Md=ye("usage_tracker"),p3t=4e3,h3t=5e3,ZVe=()=>new Vs("AI credit usage exceeded enforced limit.",503,"Credit limit reached. Check credit limits to continue using Agent Runners.",!0),m3t=(t,e,r)=>t===!0||r!=null&&e!=null&&e>=r,g3t=(t,e,r)=>e!=null&&e>0&&r!=null&&t!=null&&t>=r*e,A1=(t,e,r,{softLimitRatio:n,onSoftLimit:i,followPolledCap:s=!1,onHardLimit:o,shouldPollOnTimer:a=!1}={})=>{let c=!1,l=!1,u=!1,d=!1,f,p,h,m=r,_,y=i!=null&&n!=null,v=()=>{_&&(clearInterval(_),_=void 0)},S=async()=>{try{let O=await QD(t,e);Md.log("Usage update response",{usage:O?.usage});let A=O?.usage?.total_credits_cost;A!=null&&(f=A);let b=O?.enforced_credits_cap;if(s&&b!=null&&b!==m){let C=m==null;m=b,Md.log("Took enforced credit cap from usage poll",{enforcedCap:m,totalCreditsCost:A,isFirstCap:C}),C&&ge.inc("session.credit_cap_late_arrival",1)}let L=m3t(O?.credit_limit_exceeded,A,m);if(L){if(Md.log("Credit limit exceeded",{totalCreditsCost:A,enforcedCap:m}),!u){p=Date.now(),h=A??f??0,u=!0;try{o?.(ZVe())}catch(C){Md.warn("onHardLimit callback threw",{error:C?.message||C})}}u=!0,v(),g.cancel()}if(y&&!d&&!L&&g3t(A,m,n)){d=!0,Md.log("Soft credit limit reached",{totalCreditsCost:A,enforcedCap:m,softLimitRatio:n});try{i()}catch(C){Md.warn("onSoftLimit callback threw",{error:C?.message||C})}}}catch(O){Md.warn("Failed to update usage",{error:O?.message||O})}},g=bA(S,p3t);return{onAgentOutput:()=>{if(u)throw ZVe();if(!l){if(c=!0,!a){g();return}_||(_=setInterval(()=>{g()},h3t),_.unref?.())}},stop:async()=>{l||(l=!0,v(),c&&(g.cancel(),Md.log("Sending final usage update"),await S(),p!==void 0&&(ge.timing("credit_limit.overage_duration",Date.now()-p),ge.distribution("credit_limit.overage_credits",Math.max(0,(f??h??0)-(h??0))))))},getCreditsCost:()=>f,getEnforcedCap:()=>m}};var XVe=ye("credit_cap"),_3t=async t=>{if(t.enforcedAICreditsRemaining!=null)return{cap:t.enforcedAICreditsRemaining,source:"env"};if(!Be().fetchCreditCapEnabled)return{source:"unchecked"};try{let e=(await QD(t.id,t.sessionId))?.enforced_credits_cap;if(e!=null)return XVe.log("Resolved enforced credit cap from the usage endpoint",{cap:e}),{cap:e,source:"usage"}}catch(e){XVe.warn("Usage call for the enforced credit cap failed",{error:e?.message||e})}return{source:"none"}},QVe=async(t,e=!1)=>{let{cap:r,source:n}=await _3t(t);t.enforcedAICreditsRemaining=r,ge.inc("session.credit_cap_source",1,{source:n,hot_follow_up:e})};var R1=ye("credit_wrapup"),eHe=(t,e)=>e?t.mode==="create":!1,tHe=async({runnerResult:t,interruptedSessionId:e,originalBudget:r,costAtSoftLimit:n,cliPath:i,config:s,context:o,runner:a,aiGateway:c,cwd:l,persistSteps:u,withStageTimer:d,answerFold:f})=>{let p=Math.max(0,r-n),h=Math.max(1,Math.min(p,r*.15)),m=n+h,_=new AbortController,y=!1,v=A1(s.id,s.sessionId,m),S=Object.assign(async g=>{try{v.onAgentOutput()}catch(T){Ya(T)&&!y&&(y=!0,R1.log("Wrap-up turn hit its hard budget limit \u2014 stopping wrap-up",{wrapUpBudget:h,wrapUpHardLimit:m}),ge.inc("session.credit_wrapup_aborted",1),_.abort())}return u(g)},{flush:u.flush.bind(u)});R1.log("Running credit wrap-up inference turn",{wrapUpBudget:h,wrapUpHardLimit:m,costAtSoftLimit:n,remainingAtSoftLimit:p});try{await u({steps:[{category:Q.Environment,message:"\u26A0\uFE0F You are running low on credits \u2014 wrapping up your project now."}],duration:0})}catch{}try{let{runnerResult:g}=await d("inference-credit-wrapup",()=>kd({cliPath:i,config:s,context:o,runner:a,persistSteps:S,aiGateway:c,cwd:l,contextPrefix:N1,priorAgentSessionId:e,resumeSession:!0,answerFold:f,effortOverride:"low",abortSignal:_.signal}));return y&&R1.log("Wrap-up turn was aborted due to budget limit"),sb(t,g)}catch(g){return R1.warn("Credit wrap-up turn failed \u2014 proceeding with pre-wrap-up result",{error:g?.message||g}),ge.inc("session.credit_wrapup_failed",1),t}finally{await v.stop()}};import hA from"process";var x1=ye("shutdown"),rHe=!1,nHe,Qee=async t=>{if(rHe)return;if(rHe=!0,x1.info("Shutting down...",{signal:t}),l0e(),ge.distribution("session.hot_followups",aHe()),!oHe()){let r=Date.now(),n=cHe(),i=lHe();n!==void 0&&ge.timing("session.last_linger",r-n),i!==void 0&&ge.timing("session.total_linger",r-i)}let e=nHe?.close().catch(r=>{x1.error("Error closing server during graceful shutdown",r)});await uHe(),await e,await e0(),x1.info("Shutdown complete"),hA.exit(0)},iHe=t=>{nHe=t,hA.on("SIGINT",()=>{Qee("SIGINT")}),hA.on("SIGTERM",()=>{Qee("SIGTERM")}),hA.on("unhandledRejection",e=>{x1.error("Unhandled promise rejection \u2014 exiting",e),hA.exit(1)})},sHe=t=>{Qee(t)};var fHe=4e3,y3t=3e4,dHe=ye("credit_limit_preservation"),pHe=async(t,e)=>{let r=null,n={},i=[];if(e){WS(e);let s=gl(t.runner);i.push(Promise.all([mh({runnerId:t.id,sessionId:t.sessionId,archive:s,nativeSessionId:e}).then(o=>{r=o}),LS({archive:s,cache:t.cache,nativeSessionId:e})]).catch(o=>{dHe.warn("Failed to preserve native session on credit-limit shutdown",{error:o?.message||o})}))}if(t.mode!=="ask"&&i.push(iM({config:t}).then(s=>s.hasChanges?HQ({config:t,diff:s.diff,diffBinary:s.diffBinary,resultDiff:s.resultDiff,resultDiffBinary:s.resultDiffBinary}):{}).then(s=>{n=s}).catch(s=>{dHe.warn("Failed to preserve working-tree diff on credit-limit shutdown",{error:s?.message||s})})),i.length>0){let s=!1;await Promise.race([Promise.all(i).then(()=>{s=!0}),new Promise(o=>{setTimeout(o,y3t).unref()})]),s||ge.inc("credit_preservation.timed_out",1)}return{nativeSessionS3Key:r,diffFields:n}};var b3t=v3t(import.meta.url),mA=b3t("../package.json"),Wt=ye("pipeline_index"),YS=3,T3t=["codex","gemini"],hHe=async({config:t,apiToken:e,cliPath:r="netlify",cwd:n,filter:i,isHotFollowUp:s=!1,enqueuedAt:o,tracing:a={}})=>{let c,l,u,d=null,f=Date.now(),p="success",h=!1,m,_,{withStageTimer:y}=u0e(Ic.timeUnits.hours(4)),v=await HDe(mA.version,t.id,a),S=async I=>{let x=async(O,A)=>{try{await A()}catch(b){Wt.warn(`Teardown step failed: ${O}`,{state:I,error:b?.message||b}),ge.inc("teardown.step_failed",1,{step:O,state:I})}},R=I==="completed"&&!process.env.NETLIFY_LOCAL_MODE;await x("usage-tracker",()=>l?.stop()),(I==="errored"||R)&&await x("runner-cleanup",()=>c?.()),await x("db-proxy",()=>u?.stop()),R&&await x("reset-repo",()=>iUe(n))};Wt.log(`Agent runner orchestrator v${mA.version}`,{featureFlags:Be().raw,metrics:JSe()});let g={agent:t.runner,mode:t.mode,is_follow_up:t.sessionHistoryContext.length>0,version:mA.version,fast_init:t.fastInit};$6(g);let T=!!t.answeredInteraction;GVe({isHotFollowUp:s,enqueuedAt:o}),tUe(t.sessionId);try{await Yf(mt(),"run-pipeline",{},v,async I=>{await tte(ete(),t.runner),I?.setAttributes({"gen_ai.capability.name":t.mode,"session.id":t.sessionId,...process.env.NETLIFY_DEV_SERVER_ID?{"dev_server.id":process.env.NETLIFY_DEV_SERVER_ID}:{}});let{aiGateway:x,context:R,persistSteps:O,runner:A,sha:b}=await y("init",()=>uUe({config:t,apiToken:e,cliPath:r,cwd:n,filter:i,runnerVersion:mA.version}),Ic.timeUnits.minutes(10)),L=A.runner;Be().idleTimeoutEnabled||(c=A.clean),await QVe(t,s);let C=eHe(t,Be().creditWrapUpEnabled),w=Be().hardLimitAbortEnabled,P=new AbortController,N=C||w?P.signal:void 0,F,V=!1,de=0,Te;l=A1(t.id,t.sessionId,t.enforcedAICreditsRemaining,{followPolledCap:Be().creditCapFromPollEnabled,shouldPollOnTimer:Be().timedUsagePollEnabled,...C?{softLimitRatio:.7,onSoftLimit:()=>{if(!V){if(!Te){Wt.warn("Soft credit limit reached but no session id yet \u2014 skipping wrap-up interrupt"),ge.inc("session.credit_wrapup_skipped_no_session",1);return}V=!0,de=l?.getCreditsCost()??0,Wt.log("Soft credit limit reached \u2014 interrupting agent to wrap up",{costAtSoftLimit:de}),ge.inc("session.credit_wrapup_triggered",1),P.abort()}}}:{},...w?{onHardLimit:ve=>{V||(F??=ve,Wt.log("Hard credit limit reached \u2014 stopping the agent",{creditsCost:l?.getCreditsCost()}),ge.inc("session.hard_limit_aborted",1),O({steps:[{category:Q.Environment,message:C1}],duration:0}).catch(()=>{}),P.abort())}}:{}});let Ie=GI(t.mode),$e;t.deployAlias&&t.deployAlias.length>0?$e=t.deployAlias:(t.deployAlias!==void 0&&!Ie&&Wt.warn("Received empty deploy alias for a non-prod deploy, falling back to local computation"),$e=Tte(t.id,process.env.SITE_NAME,Ie));let oe=!1,Ee=!1,he=Object.assign(async ve=>{oe||(oe=!0,WVe({isHotFollowUp:s,enqueuedAt:o}));try{l?.onAgentOutput()}catch(Et){return Ya(Et)?F??=Et:Wt.warn("Unexpected error in onAgentOutput",{error:Et?.message||Et}),O(ve)}return!Ee&&ve.steps?.some(Et=>Et.category!==Q.Environment&&Et.category!==Q.SubagentPrompt)&&(Ee=!0,YVe({isHotFollowUp:s,enqueuedAt:o})),O(ve)},{flush:O.flush.bind(O)});if(t.sha=b,t.mode==="redeploy"){let ve=await y("deploy",()=>t1({cliPath:r,config:t,context:R,result:"Redeploy completed",filter:i,isRetry:!1,deploySubdomain:$e}));ve.deployError&&(Wt.warn(`Redeploy deploy failed: ${ve.deployError}`),ge.inc("deploy.failed",1,{attempt:1})),L6({previewDeployed:!!ve.previewInfo,hadFailedAttempts:!!ve.deployError});let{diff:Et,resultDiff:xt,previewInfo:ur,diffBinary:Eh,resultDiffBinary:bn,hasNetlifyForm:P1,hasNetlifyIdentity:THe}=ve;await l?.stop(),await y("cleanup",()=>VQ({config:t,diff:Et,result:"Redeploy completed",duration:0,resultDiff:xt,diffBinary:Eh,resultDiffBinary:bn,previewInfo:ur,isProdDeploy:Ie,hasNetlifyForm:P1,hasNetlifyIdentity:THe,nativeSessionArchive:gl(t.runner)}),Ic.timeUnits.minutes(10),{interruptible:!1}),await S("completed");return}let k=PUe(),U=t.mode==="ask",ne;if(t.mode==="create"&&(ne=(await y("create",()=>XDe({config:t,cwd:n}))).additionalContext),U?(d=jge(t,$e),d&&(ne=[gUe({cliPath:r,branch:d.branch}),ne].filter(Boolean).join(`
927
927
 
928
928
  `),ge.inc("ask_mode.db_read_granted",1))):process.env.EXPERIMENTAL_NETLIFY_DB_ENABLED="1",!U&&!process.env.NETLIFY_LOCAL_MODE&&t.siteId){let ve=await y("db-setup",()=>HVe({siteId:t.siteId,isProd:Ie,alias:$e,connectionString:t.dbConnectionString}),Ic.timeUnits.minutes(10));if(u=ve.proxy,n)if(ve.proxy)ne=[YBe(),ne].filter(Boolean).join(`
929
929
 
930
930
  `);else try{let Et=await i1({cliPath:r,cwd:n}),xt=KBe(Et);xt&&(ne=[xt,ne].filter(Boolean).join(`
931
931
 
932
- `))}catch(Et){Wt.warn("Skipping migration context injection \u2014 failed to build state block",{error:Et})}}let F=await y("inference",async()=>{try{return await kd({cliPath:r,config:t,context:R,runner:L,persistSteps:he,aiGateway:x,additionalContext:ne,cwd:n,answerFold:k,abortSignal:N,onSessionId:C?ve=>{Te=ve}:void 0})}catch(ve){if(!(ve instanceof Fd)||t.mode!=="rebase"&&t.mode!=="conflict_resolution")throw ve;for(let Et of T3t){if(j&&Ya(j))throw j;if(Et===t.runner)continue;let xt=mS[Et];if(xt){Wt.log(`Primary runner ${t.runner} failed in ${t.mode} mode, falling back to ${Et}`),$6({...g,agent:Et}),await tte(ete(),Et);try{let ur=await kd({cliPath:r,config:{...t,runner:Et},context:R,runner:xt.runner,persistSteps:he,aiGateway:x,additionalContext:ne,cwd:n,answerFold:k,abortSignal:N});return t.runner=Et,L=xt.runner,Be().idleTimeoutEnabled||(c=xt.clean),ur}catch(ur){if(Ya(ur))throw ur;Wt.error(`Fallback runner ${Et} also failed`,{error:String(ur)})}}}throw ve}}),se=F.runnerResult;h=F.nativeResume??!1,m=se.resolvedModel,_=se.effort;let M=async(ve,Et)=>{let{runnerResult:xt}=await y(ve,()=>kd({cliPath:r,config:t,context:R,runner:L,persistSteps:he,aiGateway:x,buildErrors:Et,priorAgentSessionId:se.agentSessionId,answerFold:k,abortSignal:N}));if(j)throw Object.assign(j,{agentSessionId:xt.agentSessionId??se.agentSessionId}),j;se=sb(se,xt)},D=se.agentSessionId,B=l?.getEnforcedCap();if(C&&V&&se.aborted&&!j&&D&&B!=null&&(se=await tHe({runnerResult:se,interruptedSessionId:D,originalBudget:B,costAtSoftLimit:de,cliPath:r,config:t,context:R,runner:L,aiGateway:x,cwd:n,persistSteps:O,withStageTimer:y,answerFold:k})),t.mode==="create")try{let ve=JSON.parse(S3t(E3t.join(n??process.cwd(),".netlify","scaffold-result.json"),"utf8"));await Yf(mt(),"create-scaffold-telemetry",Et=>{Et?.setAttributes({"create.template":ve.template,"create.packageManager":ve.packageManager})})}catch{await Yf(mt(),"create-scaffold-telemetry",ve=>{ve?.setAttributes({"create.template":"none","create.packageManager":"none"})})}if(j)throw Object.assign(j,{agentSessionId:se.agentSessionId}),j;if(se.pendingInteraction){let ve=se.agentSessionId;ve&&WS(ve);let Et=await mh({runnerId:t.id,sessionId:t.sessionId,archive:gl(t.runner)}),xt;try{xt=await IUe(t,se.pendingInteraction,{nativeSessionId:ve,nativeSessionS3Key:Et??void 0})}catch(ur){throw ge.inc("inference.pause_persist_failed",1),ur}Wt.log("Agent paused on a question; session set to await_input",{sessionId:t.sessionId,refId:xt,questionCount:se.pendingInteraction.questions.length}),ge.inc("inference.pending_question",1),ge.distribution("inference.questions_per_ask",se.pendingInteraction.questions.length),p="awaiting_input",await S("awaiting-input");return}let H=U?{skipped:!0}:await n1({cwd:n});if(H.error&&(Wt.log("Migration generation failed, running inference to fix the issue"),await M("inference-migration-fix",[`Running \`drizzle-kit generate\` to generate database migrations failed with the following error:
932
+ `))}catch(Et){Wt.warn("Skipping migration context injection \u2014 failed to build state block",{error:Et})}}let j=await y("inference",async()=>{try{return await kd({cliPath:r,config:t,context:R,runner:L,persistSteps:he,aiGateway:x,additionalContext:ne,cwd:n,answerFold:k,abortSignal:N,onSessionId:C?ve=>{Te=ve}:void 0})}catch(ve){if(!(ve instanceof Fd)||t.mode!=="rebase"&&t.mode!=="conflict_resolution")throw ve;for(let Et of T3t){if(F&&Ya(F))throw F;if(Et===t.runner)continue;let xt=mS[Et];if(xt){Wt.log(`Primary runner ${t.runner} failed in ${t.mode} mode, falling back to ${Et}`),$6({...g,agent:Et}),await tte(ete(),Et);try{let ur=await kd({cliPath:r,config:{...t,runner:Et},context:R,runner:xt.runner,persistSteps:he,aiGateway:x,additionalContext:ne,cwd:n,answerFold:k,abortSignal:N});return t.runner=Et,L=xt.runner,Be().idleTimeoutEnabled||(c=xt.clean),ur}catch(ur){if(Ya(ur))throw ur;Wt.error(`Fallback runner ${Et} also failed`,{error:String(ur)})}}}throw ve}}),se=j.runnerResult;h=j.nativeResume??!1,m=se.resolvedModel,_=se.effort;let M=async(ve,Et)=>{let{runnerResult:xt}=await y(ve,()=>kd({cliPath:r,config:t,context:R,runner:L,persistSteps:he,aiGateway:x,buildErrors:Et,priorAgentSessionId:se.agentSessionId,answerFold:k,abortSignal:N}));if(F)throw Object.assign(F,{agentSessionId:xt.agentSessionId??se.agentSessionId}),F;se=sb(se,xt)},D=se.agentSessionId,B=l?.getEnforcedCap();if(C&&V&&se.aborted&&!F&&D&&B!=null&&(se=await tHe({runnerResult:se,interruptedSessionId:D,originalBudget:B,costAtSoftLimit:de,cliPath:r,config:t,context:R,runner:L,aiGateway:x,cwd:n,persistSteps:O,withStageTimer:y,answerFold:k})),t.mode==="create")try{let ve=JSON.parse(S3t(E3t.join(n??process.cwd(),".netlify","scaffold-result.json"),"utf8"));await Yf(mt(),"create-scaffold-telemetry",Et=>{Et?.setAttributes({"create.template":ve.template,"create.packageManager":ve.packageManager})})}catch{await Yf(mt(),"create-scaffold-telemetry",ve=>{ve?.setAttributes({"create.template":"none","create.packageManager":"none"})})}if(F)throw Object.assign(F,{agentSessionId:se.agentSessionId}),F;if(se.pendingInteraction){let ve=se.agentSessionId;ve&&WS(ve);let Et=await mh({runnerId:t.id,sessionId:t.sessionId,archive:gl(t.runner)}),xt;try{xt=await IUe(t,se.pendingInteraction,{nativeSessionId:ve,nativeSessionS3Key:Et??void 0})}catch(ur){throw ge.inc("inference.pause_persist_failed",1),ur}Wt.log("Agent paused on a question; session set to await_input",{sessionId:t.sessionId,refId:xt,questionCount:se.pendingInteraction.questions.length}),ge.inc("inference.pending_question",1),ge.distribution("inference.questions_per_ask",se.pendingInteraction.questions.length),p="awaiting_input",await S("awaiting-input");return}let H=U?{skipped:!0}:await n1({cwd:n});if(H.error&&(Wt.log("Migration generation failed, running inference to fix the issue"),await M("inference-migration-fix",[`Running \`drizzle-kit generate\` to generate database migrations failed with the following error:
933
933
 
934
934
  ${H.error}
935
935
 
936
- Please fix the issue and do NOT run \`drizzle-kit generate\` yourself \u2014 it will be run automatically after you're done.`]),await n1({cwd:n})),n&&!H.skipped){let ve=await y("db-migrations-verify",()=>QBe({cliPath:r,cwd:n}));ve.error&&(Wt.log("Migration drift detected, running inference to fix"),await M("inference-migration-drift-fix",[ve.error]))}if(Be().aiFnV1GuardrailEnabled&&n&&!U)try{let ve=await JZ(n);ve.v1>0&&(Wt.log(`Detected ${ve.v1} v1 AI function(s), running inference to fix`),await M("inference-ai-fn-v1-fix",[JVe(ve.v1Files)]))}catch(ve){if(Ya(ve))throw ve;Wt.warn("ai_fn_v1_guardrail failed",{err:ve})}let z=await y("deploy",()=>t1({cliPath:r,config:t,context:R,result:se.result,filter:i,isRetry:!1,deploySubdomain:$e})),K=z.hasChanges?z:void 0,re=se;z.deployError&&ge.inc("deploy.failed",1,{attempt:1});let Oe=[],ut;if(z.hasChanges&&z.deployError){Oe.push(w1e(z.deployError));let ve=1,Et=!1;for(;ve<=YS&&!z.previewInfo&&!Et;)Wt.log(`Deploy attempt had errors. Retrying. ${ve}/${YS}`),await Yf(mt(),"deploy-stage",async xt=>{xt?.setAttributes({"stage.attempt":ve});let ur;try{ur=(await y(`inference-retry-${ve}`,()=>kd({cliPath:r,config:t,context:R,runner:L,persistSteps:he,aiGateway:x,buildErrors:Oe,priorAgentSessionId:se.agentSessionId,answerFold:k,abortSignal:N}))).runnerResult}catch(Eh){if(Ya(Eh))throw Eh;Wt.warn(`Inference retry ${ve} failed, stopping deploy retries:`,Eh),Et=!0;return}if(j)throw Object.assign(j,{agentSessionId:ur.agentSessionId??se.agentSessionId}),j;re=sb(re,ur),U||await n1({cwd:n}),z=await y(`deploy-retry-${ve}`,()=>t1({cliPath:r,config:t,context:R,result:ur.result,filter:i,isRetry:!0,deploySubdomain:$e})),z.hasChanges&&(K=z),z.deployError&&(ge.inc("deploy.failed",1,{attempt:ve+1}),Oe.push(z.deployError)),ve++});ve>YS&&!z.previewInfo&&(ge.inc("deploy.retries_exhausted",1),t.mode==="create"?(console.warn(`Deploy still failing after ${YS} retries, failing the create run`),ut=new Error(`Deploy failed after ${YS} retries`)):console.warn(`Deploy still failing after ${YS} retries, completing run without a preview`))}let ze=z.previewInfo||z.hasChanges?z:K??z,{diff:Qr,resultDiff:qs,previewInfo:Ni,diffBinary:Ha,resultDiffBinary:Sh,hasNetlifyForm:at,hasNetlifyIdentity:Mt}=ze;ze.hasChanges&&L6({previewDeployed:!!ze.previewInfo,hadFailedAttempts:Oe.length>0}),await l?.stop(),I?.setAttributes(R1e(re,l?.getCreditsCost())),m=re.resolvedModel,_=re.effort??_;let Bs=re.agentSessionId??se.agentSessionId;if(Bs&&WS(Bs),await y("cleanup",()=>VQ({config:t,diff:Qr,result:re.result,duration:re.duration,resultDiff:qs,diffBinary:Ha,resultDiffBinary:Sh,previewInfo:Ni,isProdDeploy:Ie,hasNetlifyForm:at,hasNetlifyIdentity:Mt,nativeSessionArchive:gl(t.runner),nativeSessionId:Bs}),Ic.timeUnits.minutes(10),{interruptible:!1}),ut)throw ut;try{let ve=await JZ(n??process.cwd());ve.aiTotal>0&&I?.setAttributes({"agent.fn_ai_total":ve.aiTotal,"agent.fn_ai_v1":ve.v1,"agent.fn_ai_v2":ve.v2,"agent.fn_ai_v3":ve.v3,"agent.fn_ai_unknown":ve.unknown})}catch{}if(await S("completed"),U&&!process.env.NETLIFY_LOCAL_MODE)try{let ve=await sUe(n);ve.length>0&&(Wt.warn(`Removed ${ve.length} leftover untracked change(s) after ask run`,{removed:ve}),ge.inc("ask_mode.leaked_untracked_files",ve.length))}catch(ve){Wt.warn("Failed to remove untracked files after successful ask run",{error:ve?.message||ve})}let zt=t.siteId?await M1e(t.siteId):!1;typeof zt=="boolean"&&I?.setAttributes({"actual.has_db":zt}),await z1e({config:t,hasDb:zt,pipelineSpan:I,resolvedModel:re.resolvedModel??se.resolvedModel,cliVersion:mA.version})})}catch(I){if(Ya(I)){p="gracefulError",Wt.info("Agent run terminated gracefully",{statusCode:I.statusCode,reason:I.message}),await l?.stop();let L=I?.agentSessionId,C=I.isCreditLimitExceeded&&!!L,{nativeSessionS3Key:w,diffFields:P}=I.isCreditLimitExceeded?await pHe(t,L):{nativeSessionS3Key:null,diffFields:{}};await S("errored");try{await Ln(t.id,t.sessionId,{result:I.userMessage,state:I.isCreditLimitExceeded?"cancelled":"error",...I.isCreditLimitExceeded&&{credit_limit_exceeded:!0},...C?{native_session_id:L}:{},...w?{native_session_s3_key:w}:{},...P})}catch{Wt.info("Could not update session (site may have been deleted)")}I.isCreditLimitExceeded&&sHe("credit_limit_cancelled");return}p=Si()?"interrupted":"error",Wt.error("Got error while running pipeline",I),await l?.stop();let x=I?.agentSessionId,R=Si()&&!!x,O=null;if(R){WS(x);let L=gl(t.runner);try{await Promise.race([Promise.all([mh({runnerId:t.id,sessionId:t.sessionId,archive:L,nativeSessionId:x}).then(C=>{O=C}),LS({archive:L,cache:t.cache,nativeSessionId:x})]),new Promise(C=>{setTimeout(C,fHe).unref()})])}catch(C){Wt.warn("Failed to preserve native session before teardown",{error:C?.message||C})}}await S("errored");let A=I instanceof Error?I.shortMessage||I.message:"",b=A?QSe($P(A)):"Encountered error when running agent";try{await Ln(t.id,t.sessionId,{result:b,state:"error",...R?{native_session_id:x}:{},...O?{native_session_s3_key:O}:{}})}catch(L){Wt.error("Failed to update session with error state, retrying with minimal payload:",L);try{await Ln(t.id,t.sessionId,{result:"Encountered error when running agent",state:"error"})}catch(C){Wt.error("Failed to mark session as errored:",C)}}throw I}finally{d&&wz(),KVe({isHotFollowUp:s,startedAt:f,outcome:p,nativeResume:h,isAnswerResume:T,creditsCost:l?.getCreditsCost(),model:m,effort:_})}};var rte=ye("session_manager"),yh=null,nte={},mHe,ste,gHe=0,_He,ite,gA=class extends Error{constructor(){super("A session is already running"),this.name="SessionAlreadyRunningError"}},yHe=t=>{nte=t},I1=t=>{if(yh)throw new gA;let e={...nte,...t,tracing:{...nte.tracing,...t.tracing}};return j1(e.config.sessionId),rte.log(`start agent=${e.config.runner} mode=${e.config.mode}`),e.isHotFollowUp&&!e.config.answeredInteraction&&gHe++,yh=hHe(e).finally(()=>{j1(void 0),yh=null,mHe=e.config.runner,ite=Date.now(),_He??=ite}),yh},ete=()=>mHe,oHe=()=>yh!==null,aHe=()=>gHe,cHe=()=>ite,lHe=()=>_He,tte=async(t,e)=>{if(!Be().idleTimeoutEnabled||!t||t===e)return;let r=mS[t];if(r)try{await r.clean(),rte.info(`Wiped previous agent state (${t}) on switch to ${e}`)}catch(n){rte.warn(`Failed to clean previous agent ${t} on switch`,{error:n?.message||n})}finally{ste=void 0}},WS=t=>{ste=t};var BBe=t=>{let e=t.previousSession?.nativeSessionId;return!!e&&e===ste},uHe=async()=>{if(yh)try{await yh}catch{}};var ote=ye("server"),SHe=8888,w3t={type:"object",required:["prompt","sessionId","sha","mode","context"],properties:{prompt:{type:"string"},sessionId:{type:"string"},sha:{type:"string"},mode:{type:"string",enum:SA},context:{type:"array",items:{type:"object"}},enforcedAICreditsRemaining:{type:"integer"},agent:{type:"string",enum:KZ},model:{type:"string"},effort:{type:"string",enum:[...XS]},enqueuedAt:{type:"integer"},assetMap:{type:"object",additionalProperties:{type:"array",items:{type:"string"}}},previousSession:{type:"object",required:["nativeSessionId","agent"],properties:{nativeSessionId:{type:"string"},agent:{type:"string",enum:KZ},mode:{type:"string"}}},answeredInteraction:{type:"object",required:["refId","questions","responses"],properties:{refId:{type:"string"},questions:{type:"array",items:{type:"object"}},responses:{type:"array",items:{anyOf:[{type:"string"},{type:"array",items:{type:"string"}},{type:"null"}]}},instruction:{type:"string"}}},pendingUndeployedChanges:{type:"boolean"}}},A3t=async(t,e)=>{Si()&&e.code(503).send({error:"shutdown",message:"Server is shutting down"})},R3t=async()=>({ok:!0}),x3t=async(t,e)=>{try{let r=Ite(t.body),n=typeof t.headers.traceparent=="string"?{traceparent:t.headers.traceparent}:void 0;return I1({config:r,tracing:n,isHotFollowUp:!0,enqueuedAt:t.body.enqueuedAt}).catch(i=>{ote.error("Background session failed",i)}),{ok:!0,sessionId:t.body.sessionId}}catch(r){return r instanceof gA?e.code(409).send({error:"session_already_running",message:r.message}):(w1(vA(r)?r.reason:"unknown"),ote.error("Error handling POST /sessions",r),e.code(500).send({error:"internal_server_error",message:"Internal server error"}))}},I3t=()=>{let t=(0,EHe.default)({logger:!1});return t.addHook("onRequest",A3t),t.get("/health",R3t),t.post("/sessions",{schema:{body:w3t}},x3t),t},vHe=async()=>{let t=I3t();return await t.listen({port:SHe,host:"0.0.0.0"}),ote.info(`HTTP server listening on port ${SHe}`),t};var O3t=2,O1=ye("bin_cmd"),KS=(0,bHe.default)(ate.argv.slice(2),{string:["auth","cwd","cli-path","filter","trace-exporter-url","traceparent"]}),_A=null;try{let t=await Rte(),e={apiToken:KS.auth,cwd:KS.cwd,cliPath:KS["cli-path"],filter:KS.filter,tracing:{exporterUrl:KS["trace-exporter-url"]}};yHe(e);let r=I1({config:t,...e,tracing:{...e.tracing,traceparent:KS.traceparent}});Be().idleTimeoutEnabled&&(_A=await vHe()),iHe(_A),await r,O1.info("Finished agent"),_A||(await e0(),ate.exit(0))}catch(t){if(Si())O1.info("Pipeline interrupted by shutdown signal");else{if(w1(vA(t)?t.reason:U1(t)?"provider":"unknown"),O1.error("Error running agent pipeline:",t),_A)try{await _A.close()}catch(e){O1.error("Error closing server during failure exit",e)}await e0(),ate.exit(U1(t)?O3t:1)}}
936
+ Please fix the issue and do NOT run \`drizzle-kit generate\` yourself \u2014 it will be run automatically after you're done.`]),await n1({cwd:n})),n&&!H.skipped){let ve=await y("db-migrations-verify",()=>QBe({cliPath:r,cwd:n}));ve.error&&(Wt.log("Migration drift detected, running inference to fix"),await M("inference-migration-drift-fix",[ve.error]))}if(Be().aiFnV1GuardrailEnabled&&n&&!U)try{let ve=await JZ(n);ve.v1>0&&(Wt.log(`Detected ${ve.v1} v1 AI function(s), running inference to fix`),await M("inference-ai-fn-v1-fix",[JVe(ve.v1Files)]))}catch(ve){if(Ya(ve))throw ve;Wt.warn("ai_fn_v1_guardrail failed",{err:ve})}let z=await y("deploy",()=>t1({cliPath:r,config:t,context:R,result:se.result,filter:i,isRetry:!1,deploySubdomain:$e})),K=z.hasChanges?z:void 0,re=se;z.deployError&&ge.inc("deploy.failed",1,{attempt:1});let Oe=[],ut;if(z.hasChanges&&z.deployError){Oe.push(w1e(z.deployError));let ve=1,Et=!1;for(;ve<=YS&&!z.previewInfo&&!Et;)Wt.log(`Deploy attempt had errors. Retrying. ${ve}/${YS}`),await Yf(mt(),"deploy-stage",async xt=>{xt?.setAttributes({"stage.attempt":ve});let ur;try{ur=(await y(`inference-retry-${ve}`,()=>kd({cliPath:r,config:t,context:R,runner:L,persistSteps:he,aiGateway:x,buildErrors:Oe,priorAgentSessionId:se.agentSessionId,answerFold:k,abortSignal:N}))).runnerResult}catch(Eh){if(Ya(Eh))throw Eh;Wt.warn(`Inference retry ${ve} failed, stopping deploy retries:`,Eh),Et=!0;return}if(F)throw Object.assign(F,{agentSessionId:ur.agentSessionId??se.agentSessionId}),F;re=sb(re,ur),U||await n1({cwd:n}),z=await y(`deploy-retry-${ve}`,()=>t1({cliPath:r,config:t,context:R,result:ur.result,filter:i,isRetry:!0,deploySubdomain:$e})),z.hasChanges&&(K=z),z.deployError&&(ge.inc("deploy.failed",1,{attempt:ve+1}),Oe.push(z.deployError)),ve++});ve>YS&&!z.previewInfo&&(ge.inc("deploy.retries_exhausted",1),t.mode==="create"?(console.warn(`Deploy still failing after ${YS} retries, failing the create run`),ut=new Error(`Deploy failed after ${YS} retries`)):console.warn(`Deploy still failing after ${YS} retries, completing run without a preview`))}let ze=z.previewInfo||z.hasChanges?z:K??z,{diff:Qr,resultDiff:qs,previewInfo:Ni,diffBinary:Ha,resultDiffBinary:Sh,hasNetlifyForm:at,hasNetlifyIdentity:Mt}=ze;ze.hasChanges&&L6({previewDeployed:!!ze.previewInfo,hadFailedAttempts:Oe.length>0}),await l?.stop(),I?.setAttributes(R1e(re,l?.getCreditsCost())),m=re.resolvedModel,_=re.effort??_;let Bs=re.agentSessionId??se.agentSessionId;if(Bs&&WS(Bs),await y("cleanup",()=>VQ({config:t,diff:Qr,result:re.result,duration:re.duration,resultDiff:qs,diffBinary:Ha,resultDiffBinary:Sh,previewInfo:Ni,isProdDeploy:Ie,hasNetlifyForm:at,hasNetlifyIdentity:Mt,nativeSessionArchive:gl(t.runner),nativeSessionId:Bs}),Ic.timeUnits.minutes(10),{interruptible:!1}),ut)throw ut;try{let ve=await JZ(n??process.cwd());ve.aiTotal>0&&I?.setAttributes({"agent.fn_ai_total":ve.aiTotal,"agent.fn_ai_v1":ve.v1,"agent.fn_ai_v2":ve.v2,"agent.fn_ai_v3":ve.v3,"agent.fn_ai_unknown":ve.unknown})}catch{}if(await S("completed"),U&&!process.env.NETLIFY_LOCAL_MODE)try{let ve=await sUe(n);ve.length>0&&(Wt.warn(`Removed ${ve.length} leftover untracked change(s) after ask run`,{removed:ve}),ge.inc("ask_mode.leaked_untracked_files",ve.length))}catch(ve){Wt.warn("Failed to remove untracked files after successful ask run",{error:ve?.message||ve})}let zt=t.siteId?await M1e(t.siteId):!1;typeof zt=="boolean"&&I?.setAttributes({"actual.has_db":zt}),await z1e({config:t,hasDb:zt,pipelineSpan:I,resolvedModel:re.resolvedModel??se.resolvedModel,cliVersion:mA.version})})}catch(I){if(Ya(I)){p="gracefulError",Wt.info("Agent run terminated gracefully",{statusCode:I.statusCode,reason:I.message}),await l?.stop();let L=I?.agentSessionId,C=I.isCreditLimitExceeded&&!!L,{nativeSessionS3Key:w,diffFields:P}=I.isCreditLimitExceeded?await pHe(t,L):{nativeSessionS3Key:null,diffFields:{}};await S("errored");try{await Ln(t.id,t.sessionId,{result:I.userMessage,state:I.isCreditLimitExceeded?"cancelled":"error",...I.isCreditLimitExceeded&&{credit_limit_exceeded:!0},...C?{native_session_id:L}:{},...w?{native_session_s3_key:w}:{},...P})}catch{Wt.info("Could not update session (site may have been deleted)")}I.isCreditLimitExceeded&&sHe("credit_limit_cancelled");return}p=Si()?"interrupted":"error",Wt.error("Got error while running pipeline",I),await l?.stop();let x=I?.agentSessionId,R=Si()&&!!x,O=null;if(R){WS(x);let L=gl(t.runner);try{await Promise.race([Promise.all([mh({runnerId:t.id,sessionId:t.sessionId,archive:L,nativeSessionId:x}).then(C=>{O=C}),LS({archive:L,cache:t.cache,nativeSessionId:x})]),new Promise(C=>{setTimeout(C,fHe).unref()})])}catch(C){Wt.warn("Failed to preserve native session before teardown",{error:C?.message||C})}}await S("errored");let A=I instanceof Error?I.shortMessage||I.message:"",b=A?QSe($P(A)):"Encountered error when running agent";try{await Ln(t.id,t.sessionId,{result:b,state:"error",...R?{native_session_id:x}:{},...O?{native_session_s3_key:O}:{}})}catch(L){Wt.error("Failed to update session with error state, retrying with minimal payload:",L);try{await Ln(t.id,t.sessionId,{result:"Encountered error when running agent",state:"error"})}catch(C){Wt.error("Failed to mark session as errored:",C)}}throw I}finally{d&&wz(),KVe({isHotFollowUp:s,startedAt:f,outcome:p,nativeResume:h,isAnswerResume:T,creditsCost:l?.getCreditsCost(),model:m,effort:_})}};var rte=ye("session_manager"),yh=null,nte={},mHe,ste,gHe=0,_He,ite,gA=class extends Error{constructor(){super("A session is already running"),this.name="SessionAlreadyRunningError"}},yHe=t=>{nte=t},I1=t=>{if(yh)throw new gA;let e={...nte,...t,tracing:{...nte.tracing,...t.tracing}};return j1(e.config.sessionId),rte.log(`start agent=${e.config.runner} mode=${e.config.mode}`),e.isHotFollowUp&&!e.config.answeredInteraction&&gHe++,yh=hHe(e).finally(()=>{j1(void 0),yh=null,mHe=e.config.runner,ite=Date.now(),_He??=ite}),yh},ete=()=>mHe,oHe=()=>yh!==null,aHe=()=>gHe,cHe=()=>ite,lHe=()=>_He,tte=async(t,e)=>{if(!Be().idleTimeoutEnabled||!t||t===e)return;let r=mS[t];if(r)try{await r.clean(),rte.info(`Wiped previous agent state (${t}) on switch to ${e}`)}catch(n){rte.warn(`Failed to clean previous agent ${t} on switch`,{error:n?.message||n})}finally{ste=void 0}},WS=t=>{ste=t};var BBe=t=>{let e=t.previousSession?.nativeSessionId;return!!e&&e===ste},uHe=async()=>{if(yh)try{await yh}catch{}};var ote=ye("server"),SHe=8888,w3t={type:"object",required:["prompt","sessionId","sha","mode","context"],properties:{prompt:{type:"string"},sessionId:{type:"string"},sha:{type:"string"},mode:{type:"string",enum:SA},context:{type:"array",items:{type:"object"}},enforcedAICreditsRemaining:{type:"integer"},agent:{type:"string",enum:KZ},model:{type:"string"},effort:{type:"string",enum:[...XS]},enqueuedAt:{type:"integer"},assetMap:{type:"object",additionalProperties:{type:"array",items:{type:"string"}}},previousSession:{type:"object",required:["nativeSessionId","agent"],properties:{nativeSessionId:{type:"string"},agent:{type:"string",enum:KZ},mode:{type:"string"}}},answeredInteraction:{type:"object",required:["refId","questions","responses"],properties:{refId:{type:"string"},questions:{type:"array",items:{type:"object"}},responses:{type:"array",items:{anyOf:[{type:"string"},{type:"array",items:{type:"string"}},{type:"null"}]}},instruction:{type:"string"}}},pendingUndeployedChanges:{type:"boolean"}}},A3t=async(t,e)=>{Si()&&e.code(503).send({error:"shutdown",message:"Server is shutting down"})},R3t=async()=>({ok:!0}),x3t=async(t,e)=>{try{let r=Ite(t.body),n=typeof t.headers.traceparent=="string"?{traceparent:t.headers.traceparent}:void 0;return I1({config:r,tracing:n,isHotFollowUp:!0,enqueuedAt:t.body.enqueuedAt}).catch(i=>{ote.error("Background session failed",i)}),{ok:!0,sessionId:t.body.sessionId}}catch(r){return r instanceof gA?e.code(409).send({error:"session_already_running",message:r.message}):(w1(vA(r)?r.reason:"unknown"),ote.error("Error handling POST /sessions",r),e.code(500).send({error:"internal_server_error",message:"Internal server error"}))}},I3t=()=>{let t=(0,EHe.default)({logger:!1});return t.addHook("onRequest",A3t),t.get("/health",R3t),t.post("/sessions",{schema:{body:w3t}},x3t),t},vHe=async()=>{let t=I3t();return await t.listen({port:SHe,host:"0.0.0.0"}),ote.info(`HTTP server listening on port ${SHe}`),t};var O3t=2,O1=ye("bin_cmd"),KS=(0,bHe.default)(ate.argv.slice(2),{string:["auth","cwd","cli-path","filter","trace-exporter-url","traceparent"]}),_A=null;try{let t=await Rte(),e={apiToken:KS.auth,cwd:KS.cwd,cliPath:KS["cli-path"],filter:KS.filter,tracing:{exporterUrl:KS["trace-exporter-url"]}};yHe(e);let r=I1({config:t,...e,tracing:{...e.tracing,traceparent:KS.traceparent}});Be().idleTimeoutEnabled&&(_A=await vHe()),iHe(_A),await r,O1.info("Finished agent"),_A||(await e0(),ate.exit(0))}catch(t){if(Si())O1.info("Pipeline interrupted by shutdown signal");else{if(w1(vA(t)?t.reason:U1(t)?"provider":"unknown"),O1.error("Error running agent pipeline:",t),_A)try{await _A.close()}catch(e){O1.error("Error closing server during failure exit",e)}await e0(),ate.exit(U1(t)?O3t:1)}}
937
937
  /*! Bundled license information:
938
938
 
939
939
  @fastify/proxy-addr/index.js: