@smythos/cli
Version:
SmythOS SRE Command Line Interface
5 lines • 7.81 MB
JavaScript
#!/usr/bin/env node
"use strict";var Z1=Object.defineProperty;var Jr=(Pr,Br)=>Z1(Pr,"name",{value:Br,configurable:!0});var index$1=require("./index2.cjs"),index$2=require("./index3.cjs"),require$$0$6=require("url"),require$$0$7=require("util"),require$$0$8=require("os"),index$3=require("./index4.cjs"),P$6=require("fs"),sysPath=require("path"),zlib=require("zlib"),require$$0$9=require("tty"),require$$1$4=require("string_decoder"),require$$0$a=require("http"),require$$1$5=require("https"),require$$0$b=require("stream"),se$3=require("crypto"),require$$0$c=require("assert"),require$$0$d=require("events"),require$$0$i=require("process"),require$$1$7=require("querystring"),require$$0$f=require("net"),require$$1$6=require("tls"),require$$0$e=require("buffer"),require$$3$3=require("dns"),Wr=require("fs/promises"),require$$0$g=require("node:util"),require$$0$k=require("child_process"),require$$0$j=require("punycode"),fs$2=require("node:fs"),node_stream=require("node:stream"),web=require("node:stream/web"),require$$0$h=require("http2"),require$$0$l=require("node:events"),process$1=require("node:process"),require$$0$m=require("node:fs/promises"),path$1=require("node:path"),require$$1$8=require("timers"),node_crypto=require("node:crypto"),L$5=require("readline"),index$5=require("./index5.cjs"),index$4=require("./index6.cjs");function _interopNamespaceDefault(Pr){var Br=Object.create(null);return Pr&&Object.keys(Pr).forEach(function(Ur){if(Ur!=="default"){var Vr=Object.getOwnPropertyDescriptor(Pr,Ur);Object.defineProperty(Br,Ur,Vr.get?Vr:{enumerable:!0,get:Jr(function(){return Pr[Ur]},"get")})}}),Br.default=Pr,Object.freeze(Br)}Jr(_interopNamespaceDefault,"_interopNamespaceDefault");var P__namespace=_interopNamespaceDefault(P$6),sysPath__namespace=_interopNamespaceDefault(sysPath),zlib__namespace=_interopNamespaceDefault(zlib),error$1={exports:{}},stringify$3,hasRequiredStringify$2;function requireStringify$2(){return hasRequiredStringify$2||(hasRequiredStringify$2=1,stringify$3=Jr(function(...Pr){try{return JSON.stringify(...Pr)}catch(Br){return"[Cannot display object: "+Br.message+"]"}},"stringify$3")),stringify$3}Jr(requireStringify$2,"requireStringify$2");var hasRequiredError$1;function requireError$1(){return hasRequiredError$1||(hasRequiredError$1=1,function(Pr,Br){const Ur=requireStringify$2();Pr.exports=class extends Error{constructor(Vr){const zr=Vr.filter(Kr=>Kr!=="").map(Kr=>typeof Kr=="string"?Kr:Kr instanceof Error?Kr.message:Ur(Kr));super(zr.join(" ")||"Unknown error"),typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,Br.assert)}}}(error$1,error$1.exports)),error$1.exports}Jr(requireError$1,"requireError$1");var assert,hasRequiredAssert;function requireAssert(){if(hasRequiredAssert)return assert;hasRequiredAssert=1;const Pr=requireError$1();return assert=Jr(function(Br,...Ur){if(!Br)throw Ur.length===1&&Ur[0]instanceof Error?Ur[0]:new Pr(Ur)},"assert"),assert}Jr(requireAssert,"requireAssert");var reach,hasRequiredReach;function requireReach(){if(hasRequiredReach)return reach;hasRequiredReach=1;const Pr=requireAssert(),Br={};return reach=Jr(function(Ur,Vr,zr){if(Vr===!1||Vr===null||Vr===void 0)return Ur;zr=zr||{},typeof zr=="string"&&(zr={separator:zr});const Kr=Array.isArray(Vr);Pr(!Kr||!zr.separator,"Separator option is not valid for array-based chain");const tn=Kr?Vr:Vr.split(zr.separator||".");let sn=Ur;for(let dn=0;dn<tn.length;++dn){let pn=tn[dn];const hn=zr.iterables&&Br.iterables(sn);if(Array.isArray(sn)||hn==="set"){const mn=Number(pn);Number.isInteger(mn)&&(pn=mn<0?sn.length+mn:mn)}if(!sn||typeof sn=="function"&&zr.functions===!1||!hn&&sn[pn]===void 0){Pr(!zr.strict||dn+1===tn.length,"Missing segment",pn,"in reach path ",Vr),Pr(typeof sn=="object"||zr.functions===!0||typeof sn!="function","Invalid segment",pn,"in reach path ",Vr),sn=zr.default;break}hn?hn==="set"?sn=[...sn][pn]:sn=sn.get(pn):sn=sn[pn]}return sn},"reach"),Br.iterables=function(Ur){if(Ur instanceof Set)return"set";if(Ur instanceof Map)return"map"},reach}Jr(requireReach,"requireReach");var types$c={exports:{}},hasRequiredTypes$7;function requireTypes$7(){return hasRequiredTypes$7||(hasRequiredTypes$7=1,function(Pr,Br){const Ur={};Br=Pr.exports={array:Array.prototype,buffer:Buffer&&Buffer.prototype,date:Date.prototype,error:Error.prototype,generic:Object.prototype,map:Map.prototype,promise:Promise.prototype,regex:RegExp.prototype,set:Set.prototype,weakMap:WeakMap.prototype,weakSet:WeakSet.prototype},Ur.typeMap=new Map([["[object Error]",Br.error],["[object Map]",Br.map],["[object Promise]",Br.promise],["[object Set]",Br.set],["[object WeakMap]",Br.weakMap],["[object WeakSet]",Br.weakSet]]),Br.getInternalProto=function(Vr){if(Array.isArray(Vr))return Br.array;if(Buffer&&Vr instanceof Buffer)return Br.buffer;if(Vr instanceof Date)return Br.date;if(Vr instanceof RegExp)return Br.regex;if(Vr instanceof Error)return Br.error;const zr=Object.prototype.toString.call(Vr);return Ur.typeMap.get(zr)||Br.generic}}(types$c,types$c.exports)),types$c.exports}Jr(requireTypes$7,"requireTypes$7");var utils$e={},hasRequiredUtils$c;function requireUtils$c(){return hasRequiredUtils$c||(hasRequiredUtils$c=1,utils$e.keys=function(Pr,Br={}){return Br.symbols!==!1?Reflect.ownKeys(Pr):Object.getOwnPropertyNames(Pr)}),utils$e}Jr(requireUtils$c,"requireUtils$c");var clone$2,hasRequiredClone;function requireClone(){if(hasRequiredClone)return clone$2;hasRequiredClone=1;const Pr=requireReach(),Br=requireTypes$7(),Ur=requireUtils$c(),Vr={needsProtoHack:new Set([Br.set,Br.map,Br.weakSet,Br.weakMap])};return clone$2=Vr.clone=function(zr,Kr={},tn=null){if(typeof zr!="object"||zr===null)return zr;let sn=Vr.clone,dn=tn;if(Kr.shallow){if(Kr.shallow!==!0)return Vr.cloneWithShallow(zr,Kr);sn=Jr(kn=>kn,"clone")}else if(dn){const kn=dn.get(zr);if(kn)return kn}else dn=new Map;const pn=Br.getInternalProto(zr);if(pn===Br.buffer)return Buffer&&Buffer.from(zr);if(pn===Br.date)return new Date(zr.getTime());if(pn===Br.regex)return new RegExp(zr);const hn=Vr.base(zr,pn,Kr);if(hn===zr)return zr;if(dn&&dn.set(zr,hn),pn===Br.set)for(const kn of zr)hn.add(sn(kn,Kr,dn));else if(pn===Br.map)for(const[kn,Zn]of zr)hn.set(kn,sn(Zn,Kr,dn));const mn=Ur.keys(zr,Kr);for(const kn of mn){if(kn==="__proto__")continue;if(pn===Br.array&&kn==="length"){hn.length=zr.length;continue}const Zn=Object.getOwnPropertyDescriptor(zr,kn);Zn?Zn.get||Zn.set?Object.defineProperty(hn,kn,Zn):Zn.enumerable?hn[kn]=sn(zr[kn],Kr,dn):Object.defineProperty(hn,kn,{enumerable:!1,writable:!0,configurable:!0,value:sn(zr[kn],Kr,dn)}):Object.defineProperty(hn,kn,{enumerable:!0,writable:!0,configurable:!0,value:sn(zr[kn],Kr,dn)})}return hn},Vr.cloneWithShallow=function(zr,Kr){const tn=Kr.shallow;Kr=Object.assign({},Kr),Kr.shallow=!1;const sn=new Map;for(const dn of tn){const pn=Pr(zr,dn);(typeof pn=="object"||typeof pn=="function")&&sn.set(pn,pn)}return Vr.clone(zr,Kr,sn)},Vr.base=function(zr,Kr,tn){if(tn.prototype===!1)return Vr.needsProtoHack.has(Kr)?new Kr.constructor:Kr===Br.array?[]:{};const sn=Object.getPrototypeOf(zr);if(sn&&sn.isImmutable)return zr;if(Kr===Br.array){const dn=[];return sn!==Kr&&Object.setPrototypeOf(dn,sn),dn}if(Vr.needsProtoHack.has(Kr)){const dn=new sn.constructor;return sn!==Kr&&Object.setPrototypeOf(dn,sn),dn}return Object.create(sn)},clone$2}Jr(requireClone,"requireClone");var cache$6={},common$6={},version$e="17.13.3",require$$2$4={version:version$e},schemas={},hasRequiredSchemas;function requireSchemas(){if(hasRequiredSchemas)return schemas;hasRequiredSchemas=1;const Pr=requireLib$g(),Br={};return Br.wrap=Pr.string().min(1).max(2).allow(!1),schemas.preferences=Pr.object({allowUnknown:Pr.boolean(),abortEarly:Pr.boolean(),artifacts:Pr.boolean(),cache:Pr.boolean(),context:Pr.object(),convert:Pr.boolean(),dateFormat:Pr.valid("date","iso","string","time","utc"),debug:Pr.boolean(),errors:{escapeHtml:Pr.boolean(),label:Pr.valid("path","key",!1),language:[Pr.string(),Pr.object().ref()],render:Pr.boolean(),stack:Pr.boolean(),wrap:{label:Br.wrap,array:Br.wrap,string:Br.wrap}},externals:Pr.boolean(),messages:Pr.object(),noDefaults:Pr.boolean(),nonEnumerables:Pr.boolean(),presence:Pr.valid("required","optional","forbidden"),skipFunctions:Pr.boolean(),stripUnknown:Pr.object({arrays:Pr.boolean(),objects:Pr.boolean()}).or("arrays","objects").allow(!0,!1),warnings:Pr.boolean()}).strict(),Br.nameRx=/^[a-zA-Z0-9]\w*$/,Br.rule=Pr.object({alias:Pr.array().items(Pr.string().pattern(Br.nameRx)).single(),args:Pr.array().items(Pr.string(),Pr.object({name:Pr.string().pattern(Br.nameRx).required(),ref:Pr.boolean(),assert:Pr.alternatives([Pr.function(),Pr.object().schema()]).conditional("ref",{is:!0,then:Pr.required()}),normalize:Pr.function(),message:Pr.string().when("assert",{is:Pr.function(),then:Pr.required()})})),convert:Pr.boolean(),manifest:Pr.boolean(),method:Pr.function().allow(!1),multi:Pr.boolean(),validate:Pr.function()}),schemas.extension=Pr.object({type:Pr.alternatives([Pr.string(),Pr.object().regex()]).required(),args:Pr.function(),cast:Pr.object().pattern(Br.nameRx,Pr.object({from:Pr.function().maxArity(1).required(),to:Pr.function().minArity(1).maxArity(2).required()})),base:Pr.object().schema().when("type",{is:Pr.object().regex(),then:Pr.forbidden()}),coerce:[Pr.function().maxArity(3),Pr.object({method:Pr.function().maxArity(3).required(),from:Pr.array().items(Pr.string()).single()})],flags:Pr.object().pattern(Br.nameRx,Pr.object({setter:Pr.string(),default:Pr.any()})),manifest:{build:Pr.function().arity(2)},messages:[Pr.object(),Pr.string()],modifiers:Pr.object().pattern(Br.nameRx,Pr.function().minArity(1).maxArity(2)),overrides:Pr.object().pattern(Br.nameRx,Pr.function()),prepare:Pr.function().maxArity(3),rebuild:Pr.function().arity(1),rules:Pr.object().pattern(Br.nameRx,Br.rule),terms:Pr.object().pattern(Br.nameRx,Pr.object({init:Pr.array().allow(null).required(),manifest:Pr.object().pattern(/.+/,[Pr.valid("schema","single"),Pr.object({mapped:Pr.object({from:Pr.string().required(),to:Pr.string().required()}).required()})])})),validate:Pr.function().maxArity(3)}).strict(),schemas.extensions=Pr.array().items(Pr.object(),Pr.function().arity(1)).strict(),Br.desc={buffer:Pr.object({buffer:Pr.string()}),func:Pr.object({function:Pr.function().required(),options:{literal:!0}}),override:Pr.object({override:!0}),ref:Pr.object({ref:Pr.object({type:Pr.valid("value","global","local"),path:Pr.array().required(),separator:Pr.string().length(1).allow(!1),ancestor:Pr.number().min(0).integer().allow("root"),map:Pr.array().items(Pr.array().length(2)).min(1),adjust:Pr.function(),iterables:Pr.boolean(),in:Pr.boolean(),render:Pr.boolean()}).required()}),regex:Pr.object({regex:Pr.string().min(3)}),special:Pr.object({special:Pr.valid("deep").required()}),template:Pr.object({template:Pr.string().required(),options:Pr.object()}),value:Pr.object({value:Pr.alternatives([Pr.object(),Pr.array()]).required()})},Br.desc.entity=Pr.alternatives([Pr.array().items(Pr.link("...")),Pr.boolean(),Pr.function(),Pr.number(),Pr.string(),Br.desc.buffer,Br.desc.func,Br.desc.ref,Br.desc.regex,Br.desc.special,Br.desc.template,Br.desc.value,Pr.link("/")]),Br.desc.values=Pr.array().items(null,Pr.boolean(),Pr.function(),Pr.number().allow(1/0,-1/0),Pr.string().allow(""),Pr.symbol(),Br.desc.buffer,Br.desc.func,Br.desc.override,Br.desc.ref,Br.desc.regex,Br.desc.template,Br.desc.value),Br.desc.messages=Pr.object().pattern(/.+/,[Pr.string(),Br.desc.template,Pr.object().pattern(/.+/,[Pr.string(),Br.desc.template])]),schemas.description=Pr.object({type:Pr.string().required(),flags:Pr.object({cast:Pr.string(),default:Pr.any(),description:Pr.string(),empty:Pr.link("/"),failover:Br.desc.entity,id:Pr.string(),label:Pr.string(),only:!0,presence:["optional","required","forbidden"],result:["raw","strip"],strip:Pr.boolean(),unit:Pr.string()}).unknown(),preferences:{allowUnknown:Pr.boolean(),abortEarly:Pr.boolean(),artifacts:Pr.boolean(),cache:Pr.boolean(),convert:Pr.boolean(),dateFormat:["date","iso","string","time","utc"],errors:{escapeHtml:Pr.boolean(),label:["path","key"],language:[Pr.string(),Br.desc.ref],wrap:{label:Br.wrap,array:Br.wrap}},externals:Pr.boolean(),messages:Br.desc.messages,noDefaults:Pr.boolean(),nonEnumerables:Pr.boolean(),presence:["required","optional","forbidden"],skipFunctions:Pr.boolean(),stripUnknown:Pr.object({arrays:Pr.boolean(),objects:Pr.boolean()}).or("arrays","objects").allow(!0,!1),warnings:Pr.boolean()},allow:Br.desc.values,invalid:Br.desc.values,rules:Pr.array().min(1).items({name:Pr.string().required(),args:Pr.object().min(1),keep:Pr.boolean(),message:[Pr.string(),Br.desc.messages],warn:Pr.boolean()}),keys:Pr.object().pattern(/.*/,Pr.link("/")),link:Br.desc.ref}).pattern(/^[a-z]\w*$/,Pr.any()),schemas}Jr(requireSchemas,"requireSchemas");var messages$2={},template$1={exports:{}},escapeHtml,hasRequiredEscapeHtml$1;function requireEscapeHtml$1(){if(hasRequiredEscapeHtml$1)return escapeHtml;hasRequiredEscapeHtml$1=1;const Pr={};return escapeHtml=Jr(function(Br){if(!Br)return"";let Ur="";for(let Vr=0;Vr<Br.length;++Vr){const zr=Br.charCodeAt(Vr);Pr.isSafe(zr)?Ur+=Br[Vr]:Ur+=Pr.escapeHtmlChar(zr)}return Ur},"escapeHtml"),Pr.escapeHtmlChar=function(Br){const Ur=Pr.namedHtml.get(Br);return Ur||(Br>=256?"&#"+Br+";":`&#x${Br.toString(16).padStart(2,"0")};`)},Pr.isSafe=function(Br){return Pr.safeCharCodes.has(Br)},Pr.namedHtml=new Map([[38,"&"],[60,"<"],[62,">"],[34,"""],[160," "],[162,"¢"],[163,"£"],[164,"¤"],[169,"©"],[174,"®"]]),Pr.safeCharCodes=function(){const Br=new Set;for(let Ur=32;Ur<123;++Ur)(Ur>=97||Ur>=65&&Ur<=90||Ur>=48&&Ur<=57||Ur===32||Ur===46||Ur===44||Ur===45||Ur===58||Ur===95)&&Br.add(Ur);return Br}(),escapeHtml}Jr(requireEscapeHtml$1,"requireEscapeHtml$1");var lib$l={},hasRequiredLib$j;function requireLib$j(){return hasRequiredLib$j||(hasRequiredLib$j=1,function(Pr){const Br={operators:["!","^","*","/","%","+","-","<","<=",">",">=","==","!=","&&","||","??"],operatorCharacters:["!","^","*","/","%","+","-","<","=",">","&","|","?"],operatorsOrder:[["^"],["*","/","%"],["+","-"],["<","<=",">",">="],["==","!="],["&&"],["||","??"]],operatorsPrefix:["!","n"],literals:{'"':'"',"`":"`","'":"'","[":"]"},numberRx:/^(?:[0-9]*(\.[0-9]*)?){1}$/,tokenRx:/^[\w\$\#\.\@\:\{\}]+$/,symbol:Symbol("formula"),settings:Symbol("settings")};Pr.Parser=class{constructor(Ur,Vr={}){if(!Vr[Br.settings]&&Vr.constants)for(const zr in Vr.constants){const Kr=Vr.constants[zr];if(Kr!==null&&!["boolean","number","string"].includes(typeof Kr))throw new Error(`Formula constant ${zr} contains invalid ${typeof Kr} value type`)}this.settings=Vr[Br.settings]?Vr:Object.assign({[Br.settings]:!0,constants:{},functions:{}},Vr),this.single=null,this._parts=null,this._parse(Ur)}_parse(Ur){let Vr=[],zr="",Kr=0,tn=!1;const sn=Jr(pn=>{if(Kr)throw new Error("Formula missing closing parenthesis");const hn=Vr.length?Vr[Vr.length-1]:null;if(!(!tn&&!zr&&!pn)){if(hn&&hn.type==="reference"&&pn===")"){hn.type="function",hn.value=this._subFormula(zr,hn.value),zr="";return}if(pn===")"){const mn=new Pr.Parser(zr,this.settings);Vr.push({type:"segment",value:mn})}else if(tn){if(tn==="]"){Vr.push({type:"reference",value:zr}),zr="";return}Vr.push({type:"literal",value:zr})}else if(Br.operatorCharacters.includes(zr))hn&&hn.type==="operator"&&Br.operators.includes(hn.value+zr)?hn.value+=zr:Vr.push({type:"operator",value:zr});else if(zr.match(Br.numberRx))Vr.push({type:"constant",value:parseFloat(zr)});else if(this.settings.constants[zr]!==void 0)Vr.push({type:"constant",value:this.settings.constants[zr]});else{if(!zr.match(Br.tokenRx))throw new Error(`Formula contains invalid token: ${zr}`);Vr.push({type:"reference",value:zr})}zr=""}},"flush");for(const pn of Ur)tn?pn===tn?(sn(),tn=!1):zr+=pn:Kr?pn==="("?(zr+=pn,++Kr):pn===")"?(--Kr,Kr?zr+=pn:sn(pn)):zr+=pn:pn in Br.literals?tn=Br.literals[pn]:pn==="("?(sn(),++Kr):Br.operatorCharacters.includes(pn)?(sn(),zr=pn,sn()):pn!==" "?zr+=pn:sn();sn(),Vr=Vr.map((pn,hn)=>pn.type!=="operator"||pn.value!=="-"||hn&&Vr[hn-1].type!=="operator"?pn:{type:"operator",value:"n"});let dn=!1;for(const pn of Vr){if(pn.type==="operator"){if(Br.operatorsPrefix.includes(pn.value))continue;if(!dn)throw new Error("Formula contains an operator in invalid position");if(!Br.operators.includes(pn.value))throw new Error(`Formula contains an unknown operator ${pn.value}`)}else if(dn)throw new Error("Formula missing expected operator");dn=!dn}if(!dn)throw new Error("Formula contains invalid trailing operator");Vr.length===1&&["reference","literal","constant"].includes(Vr[0].type)&&(this.single={type:Vr[0].type==="reference"?"reference":"value",value:Vr[0].value}),this._parts=Vr.map(pn=>{if(pn.type==="operator")return Br.operatorsPrefix.includes(pn.value)?pn:pn.value;if(pn.type!=="reference")return pn.value;if(this.settings.tokenRx&&!this.settings.tokenRx.test(pn.value))throw new Error(`Formula contains invalid reference ${pn.value}`);return this.settings.reference?this.settings.reference(pn.value):Br.reference(pn.value)})}_subFormula(Ur,Vr){const zr=this.settings.functions[Vr];if(typeof zr!="function")throw new Error(`Formula contains unknown function ${Vr}`);let Kr=[];if(Ur){let tn="",sn=0,dn=!1;const pn=Jr(()=>{if(!tn)throw new Error(`Formula contains function ${Vr} with invalid arguments ${Ur}`);Kr.push(tn),tn=""},"flush");for(let hn=0;hn<Ur.length;++hn){const mn=Ur[hn];dn?(tn+=mn,mn===dn&&(dn=!1)):mn in Br.literals&&!sn?(tn+=mn,dn=Br.literals[mn]):mn===","&&!sn?pn():(tn+=mn,mn==="("?++sn:mn===")"&&--sn)}pn()}return Kr=Kr.map(tn=>new Pr.Parser(tn,this.settings)),function(tn){const sn=[];for(const dn of Kr)sn.push(dn.evaluate(tn));return zr.call(tn,...sn)}}evaluate(Ur){const Vr=this._parts.slice();for(let zr=Vr.length-2;zr>=0;--zr){const Kr=Vr[zr];if(Kr&&Kr.type==="operator"){const tn=Vr[zr+1];Vr.splice(zr+1,1);const sn=Br.evaluate(tn,Ur);Vr[zr]=Br.single(Kr.value,sn)}}return Br.operatorsOrder.forEach(zr=>{for(let Kr=1;Kr<Vr.length-1;)if(zr.includes(Vr[Kr])){const tn=Vr[Kr],sn=Br.evaluate(Vr[Kr-1],Ur),dn=Br.evaluate(Vr[Kr+1],Ur);Vr.splice(Kr,2);const pn=Br.calculate(tn,sn,dn);Vr[Kr-1]=pn===0?0:pn}else Kr+=2}),Br.evaluate(Vr[0],Ur)}},Pr.Parser.prototype[Br.symbol]=!0,Br.reference=function(Ur){return function(Vr){return Vr&&Vr[Ur]!==void 0?Vr[Ur]:null}},Br.evaluate=function(Ur,Vr){return Ur===null?null:typeof Ur=="function"?Ur(Vr):Ur[Br.symbol]?Ur.evaluate(Vr):Ur},Br.single=function(Ur,Vr){if(Ur==="!")return!Vr;const zr=-Vr;return zr===0?0:zr},Br.calculate=function(Ur,Vr,zr){if(Ur==="??")return Br.exists(Vr)?Vr:zr;if(typeof Vr=="string"||typeof zr=="string"){if(Ur==="+")return Vr=Br.exists(Vr)?Vr:"",zr=Br.exists(zr)?zr:"",Vr+zr}else switch(Ur){case"^":return Math.pow(Vr,zr);case"*":return Vr*zr;case"/":return Vr/zr;case"%":return Vr%zr;case"+":return Vr+zr;case"-":return Vr-zr}switch(Ur){case"<":return Vr<zr;case"<=":return Vr<=zr;case">":return Vr>zr;case">=":return Vr>=zr;case"==":return Vr===zr;case"!=":return Vr!==zr;case"&&":return Vr&&zr;case"||":return Vr||zr}return null},Br.exists=function(Ur){return Ur!=null}}(lib$l)),lib$l}Jr(requireLib$j,"requireLib$j");var errors$9={},annotate={},hasRequiredAnnotate;function requireAnnotate(){if(hasRequiredAnnotate)return annotate;hasRequiredAnnotate=1;const Pr=requireClone(),Br=requireCommon$7(),Ur={annotations:Symbol("annotations")};return annotate.error=function(Vr){if(!this._original||typeof this._original!="object")return this.details[0].message;const zr=Vr?"":"\x1B[31m",Kr=Vr?"":"\x1B[41m",tn=Vr?"":"\x1B[0m",sn=Pr(this._original);for(let hn=this.details.length-1;hn>=0;--hn){const mn=hn+1,kn=this.details[hn],Zn=kn.path;let ea=sn;for(let ta=0;;++ta){const ra=Zn[ta];if(Br.isSchema(ea)&&(ea=ea.clone()),ta+1<Zn.length&&typeof ea[ra]!="string")ea=ea[ra];else{const na=ea[Ur.annotations]||{errors:{},missing:{}};ea[Ur.annotations]=na;const sa=ra||kn.context.key;ea[ra]!==void 0?(na.errors[sa]=na.errors[sa]||[],na.errors[sa].push(mn)):na.missing[sa]=mn;break}}}const dn={key:/_\$key\$_([, \d]+)_\$end\$_"/g,missing:/"_\$miss\$_([^|]+)\|(\d+)_\$end\$_": "__missing__"/g,arrayIndex:/\s*"_\$idx\$_([, \d]+)_\$end\$_",?\n(.*)/g,specials:/"\[(NaN|Symbol.*|-?Infinity|function.*|\(.*)]"/g};let pn=Ur.safeStringify(sn,2).replace(dn.key,(hn,mn)=>`" ${zr}[${mn}]${tn}`).replace(dn.missing,(hn,mn,kn)=>`${Kr}"${mn}"${tn}${zr} [${kn}]: -- missing --${tn}`).replace(dn.arrayIndex,(hn,mn,kn)=>`
${kn} ${zr}[${mn}]${tn}`).replace(dn.specials,(hn,mn)=>mn);pn=`${pn}
${zr}`;for(let hn=0;hn<this.details.length;++hn){const mn=hn+1;pn=`${pn}
[${mn}] ${this.details[hn].message}`}return pn=pn+tn,pn},Ur.safeStringify=function(Vr,zr){return JSON.stringify(Vr,Ur.serializer(),zr)},Ur.serializer=function(){const Vr=[],zr=[],Kr=Jr((tn,sn)=>zr[0]===sn?"[Circular ~]":"[Circular ~."+Vr.slice(0,zr.indexOf(sn)).join(".")+"]","cycleReplacer");return function(tn,sn){if(zr.length>0){const dn=zr.indexOf(this);~dn?(zr.length=dn+1,Vr.length=dn+1,Vr[dn]=tn):(zr.push(this),Vr.push(tn)),~zr.indexOf(sn)&&(sn=Kr.call(this,tn,sn))}else zr.push(sn);if(sn){const dn=sn[Ur.annotations];if(dn){if(Array.isArray(sn)){const pn=[];for(let hn=0;hn<sn.length;++hn)dn.errors[hn]&&pn.push(`_$idx$_${dn.errors[hn].sort().join(", ")}_$end$_`),pn.push(sn[hn]);sn=pn}else{for(const pn in dn.errors)sn[`${pn}_$key$_${dn.errors[pn].sort().join(", ")}_$end$_`]=sn[pn],sn[pn]=void 0;for(const pn in dn.missing)sn[`_$miss$_${pn}|${dn.missing[pn]}_$end$_`]="__missing__"}return sn}}return sn===1/0||sn===-1/0||Number.isNaN(sn)||typeof sn=="function"||typeof sn=="symbol"?"["+sn.toString()+"]":sn}},annotate}Jr(requireAnnotate,"requireAnnotate");var hasRequiredErrors$9;function requireErrors$9(){return hasRequiredErrors$9||(hasRequiredErrors$9=1,function(Pr){const Br=requireAnnotate(),Ur=requireCommon$7(),Vr=requireTemplate();Pr.Report=class{constructor(zr,Kr,tn,sn,dn,pn,hn){if(this.code=zr,this.flags=sn,this.messages=dn,this.path=pn.path,this.prefs=hn,this.state=pn,this.value=Kr,this.message=null,this.template=null,this.local=tn||{},this.local.label=Pr.label(this.flags,this.state,this.prefs,this.messages),this.value!==void 0&&!this.local.hasOwnProperty("value")&&(this.local.value=this.value),this.path.length){const mn=this.path[this.path.length-1];typeof mn!="object"&&(this.local.key=mn)}}_setTemplate(zr){if(this.template=zr,!this.flags.label&&this.path.length===0){const Kr=this._template(this.template,"root");Kr&&(this.local.label=Kr)}}toString(){if(this.message)return this.message;const zr=this.code;if(!this.prefs.errors.render)return this.code;const Kr=this._template(this.template)||this._template(this.prefs.messages)||this._template(this.messages);return Kr===void 0?`Error code "${zr}" is not defined, your custom type is missing the correct messages definition`:(this.message=Kr.render(this.value,this.state,this.prefs,this.local,{errors:this.prefs.errors,messages:[this.prefs.messages,this.messages]}),this.prefs.errors.label||(this.message=this.message.replace(/^"" /,"").trim()),this.message)}_template(zr,Kr){return Pr.template(this.value,zr,Kr||this.code,this.state,this.prefs)}},Pr.path=function(zr){let Kr="";for(const tn of zr)typeof tn!="object"&&(typeof tn=="string"?(Kr&&(Kr+="."),Kr+=tn):Kr+=`[${tn}]`);return Kr},Pr.template=function(zr,Kr,tn,sn,dn){if(!Kr)return;if(Vr.isTemplate(Kr))return tn!=="root"?Kr:null;let pn=dn.errors.language;if(Ur.isResolvable(pn)&&(pn=pn.resolve(zr,sn,dn)),pn&&Kr[pn]){if(Kr[pn][tn]!==void 0)return Kr[pn][tn];if(Kr[pn]["*"]!==void 0)return Kr[pn]["*"]}return Kr[tn]?Kr[tn]:Kr["*"]},Pr.label=function(zr,Kr,tn,sn){if(!tn.errors.label)return"";if(zr.label)return zr.label;let dn=Kr.path;tn.errors.label==="key"&&Kr.path.length>1&&(dn=Kr.path.slice(-1));const pn=Pr.path(dn);return pn||Pr.template(null,tn.messages,"root",Kr,tn)||sn&&Pr.template(null,sn,"root",Kr,tn)||"value"},Pr.process=function(zr,Kr,tn){if(!zr)return null;const{override:sn,message:dn,details:pn}=Pr.details(zr);if(sn)return sn;if(tn.errors.stack)return new Pr.ValidationError(dn,pn,Kr);const hn=Error.stackTraceLimit;Error.stackTraceLimit=0;const mn=new Pr.ValidationError(dn,pn,Kr);return Error.stackTraceLimit=hn,mn},Pr.details=function(zr,Kr={}){let tn=[];const sn=[];for(const dn of zr){if(dn instanceof Error){if(Kr.override!==!1)return{override:dn};const hn=dn.toString();tn.push(hn),sn.push({message:hn,type:"override",context:{error:dn}});continue}const pn=dn.toString();tn.push(pn),sn.push({message:pn,path:dn.path.filter(hn=>typeof hn!="object"),type:dn.code,context:dn.local})}return tn.length>1&&(tn=[...new Set(tn)]),{message:tn.join(". "),details:sn}},Pr.ValidationError=class extends Error{constructor(zr,Kr,tn){super(zr),this._original=tn,this.details=Kr}static isError(zr){return zr instanceof Pr.ValidationError}},Pr.ValidationError.prototype.isJoi=!0,Pr.ValidationError.prototype.name="ValidationError",Pr.ValidationError.prototype.annotate=Br.error}(errors$9)),errors$9}Jr(requireErrors$9,"requireErrors$9");var ref$3={},hasRequiredRef$2;function requireRef$2(){return hasRequiredRef$2||(hasRequiredRef$2=1,function(Pr){const Br=requireAssert(),Ur=requireClone(),Vr=requireReach(),zr=requireCommon$7();let Kr;const tn={symbol:Symbol("ref"),defaults:{adjust:null,in:!1,iterables:null,map:null,separator:".",type:"value"}};Pr.create=function(sn,dn={}){Br(typeof sn=="string","Invalid reference key:",sn),zr.assertOptions(dn,["adjust","ancestor","in","iterables","map","prefix","render","separator"]),Br(!dn.prefix||typeof dn.prefix=="object","options.prefix must be of type object");const pn=Object.assign({},tn.defaults,dn);delete pn.prefix;const hn=pn.separator,mn=tn.context(sn,hn,dn.prefix);if(pn.type=mn.type,sn=mn.key,pn.type==="value")if(mn.root&&(Br(!hn||sn[0]!==hn,"Cannot specify relative path with root prefix"),pn.ancestor="root",sn||(sn=null)),hn&&hn===sn)sn=null,pn.ancestor=0;else if(pn.ancestor!==void 0)Br(!hn||!sn||sn[0]!==hn,"Cannot combine prefix with ancestor option");else{const[kn,Zn]=tn.ancestor(sn,hn);Zn&&(sn=sn.slice(Zn),sn===""&&(sn=null)),pn.ancestor=kn}return pn.path=hn?sn===null?[]:sn.split(hn):[sn],new tn.Ref(pn)},Pr.in=function(sn,dn={}){return Pr.create(sn,{...dn,in:!0})},Pr.isRef=function(sn){return sn?!!sn[zr.symbols.ref]:!1},tn.Ref=class{constructor(sn){Br(typeof sn=="object","Invalid reference construction"),zr.assertOptions(sn,["adjust","ancestor","in","iterables","map","path","render","separator","type","depth","key","root","display"]),Br([!1,void 0].includes(sn.separator)||typeof sn.separator=="string"&&sn.separator.length===1,"Invalid separator"),Br(!sn.adjust||typeof sn.adjust=="function","options.adjust must be a function"),Br(!sn.map||Array.isArray(sn.map),"options.map must be an array"),Br(!sn.map||!sn.adjust,"Cannot set both map and adjust options"),Object.assign(this,tn.defaults,sn),Br(this.type==="value"||this.ancestor===void 0,"Non-value references cannot reference ancestors"),Array.isArray(this.map)&&(this.map=new Map(this.map)),this.depth=this.path.length,this.key=this.path.length?this.path.join(this.separator):null,this.root=this.path[0],this.updateDisplay()}resolve(sn,dn,pn,hn,mn={}){return Br(!this.in||mn.in,"Invalid in() reference usage"),this.type==="global"?this._resolve(pn.context,dn,mn):this.type==="local"?this._resolve(hn,dn,mn):this.ancestor?this.ancestor==="root"?this._resolve(dn.ancestors[dn.ancestors.length-1],dn,mn):(Br(this.ancestor<=dn.ancestors.length,"Invalid reference exceeds the schema root:",this.display),this._resolve(dn.ancestors[this.ancestor-1],dn,mn)):this._resolve(sn,dn,mn)}_resolve(sn,dn,pn){let hn;if(this.type==="value"&&dn.mainstay.shadow&&pn.shadow!==!1&&(hn=dn.mainstay.shadow.get(this.absolute(dn))),hn===void 0&&(hn=Vr(sn,this.path,{iterables:this.iterables,functions:!0})),this.adjust&&(hn=this.adjust(hn)),this.map){const mn=this.map.get(hn);mn!==void 0&&(hn=mn)}return dn.mainstay&&dn.mainstay.tracer.resolve(dn,this,hn),hn}toString(){return this.display}absolute(sn){return[...sn.path.slice(0,-this.ancestor),...this.path]}clone(){return new tn.Ref(this)}describe(){const sn={path:this.path};this.type!=="value"&&(sn.type=this.type),this.separator!=="."&&(sn.separator=this.separator),this.type==="value"&&this.ancestor!==1&&(sn.ancestor=this.ancestor),this.map&&(sn.map=[...this.map]);for(const dn of["adjust","iterables","render"])this[dn]!==null&&this[dn]!==void 0&&(sn[dn]=this[dn]);return this.in!==!1&&(sn.in=!0),{ref:sn}}updateDisplay(){const sn=this.key!==null?this.key:"";if(this.type!=="value"){this.display=`ref:${this.type}:${sn}`;return}if(!this.separator){this.display=`ref:${sn}`;return}if(!this.ancestor){this.display=`ref:${this.separator}${sn}`;return}if(this.ancestor==="root"){this.display=`ref:root:${sn}`;return}if(this.ancestor===1){this.display=`ref:${sn||".."}`;return}const dn=new Array(this.ancestor+1).fill(this.separator).join("");this.display=`ref:${dn}${sn||""}`}},tn.Ref.prototype[zr.symbols.ref]=!0,Pr.build=function(sn){return sn=Object.assign({},tn.defaults,sn),sn.type==="value"&&sn.ancestor===void 0&&(sn.ancestor=1),new tn.Ref(sn)},tn.context=function(sn,dn,pn={}){if(sn=sn.trim(),pn){const hn=pn.global===void 0?"$":pn.global;if(hn!==dn&&sn.startsWith(hn))return{key:sn.slice(hn.length),type:"global"};const mn=pn.local===void 0?"#":pn.local;if(mn!==dn&&sn.startsWith(mn))return{key:sn.slice(mn.length),type:"local"};const kn=pn.root===void 0?"/":pn.root;if(kn!==dn&&sn.startsWith(kn))return{key:sn.slice(kn.length),type:"value",root:!0}}return{key:sn,type:"value"}},tn.ancestor=function(sn,dn){if(!dn)return[1,0];if(sn[0]!==dn)return[1,0];if(sn[1]!==dn)return[0,1];let pn=2;for(;sn[pn]===dn;)++pn;return[pn-1,pn]},Pr.toSibling=0,Pr.toParent=1,Pr.Manager=class{constructor(){this.refs=[]}register(sn,dn){if(sn){if(dn=dn===void 0?Pr.toParent:dn,Array.isArray(sn)){for(const pn of sn)this.register(pn,dn);return}if(zr.isSchema(sn)){for(const pn of sn._refs.refs)pn.ancestor-dn>=0&&this.refs.push({ancestor:pn.ancestor-dn,root:pn.root});return}Pr.isRef(sn)&&sn.type==="value"&&sn.ancestor-dn>=0&&this.refs.push({ancestor:sn.ancestor-dn,root:sn.root}),Kr=Kr||requireTemplate(),Kr.isTemplate(sn)&&this.register(sn.refs(),dn)}}get length(){return this.refs.length}clone(){const sn=new Pr.Manager;return sn.refs=Ur(this.refs),sn}reset(){this.refs=[]}roots(){return this.refs.filter(sn=>!sn.ancestor).map(sn=>sn.root)}}}(ref$3)),ref$3}Jr(requireRef$2,"requireRef$2");var hasRequiredTemplate;function requireTemplate(){return hasRequiredTemplate||(hasRequiredTemplate=1,function(Pr,Br){const Ur=requireAssert(),Vr=requireClone(),zr=requireEscapeHtml$1(),Kr=requireLib$j(),tn=requireCommon$7(),sn=requireErrors$9(),dn=requireRef$2(),pn={symbol:Symbol("template"),opens:new Array(1e3).join("\0"),closes:new Array(1e3).join(""),dateFormat:{date:Date.prototype.toDateString,iso:Date.prototype.toISOString,string:Date.prototype.toString,time:Date.prototype.toTimeString,utc:Date.prototype.toUTCString}};Pr.exports=pn.Template=class{constructor(hn,mn){if(Ur(typeof hn=="string","Template source must be a string"),Ur(!hn.includes("\0")&&!hn.includes(""),"Template source cannot contain reserved control characters"),this.source=hn,this.rendered=hn,this._template=null,mn){const{functions:kn,...Zn}=mn;this._settings=Object.keys(Zn).length?Vr(Zn):void 0,this._functions=kn,this._functions&&(Ur(Object.keys(this._functions).every(ea=>typeof ea=="string"),"Functions keys must be strings"),Ur(Object.values(this._functions).every(ea=>typeof ea=="function"),"Functions values must be functions"))}else this._settings=void 0,this._functions=void 0;this._parse()}_parse(){if(!this.source.includes("{"))return;const hn=pn.encode(this.source),mn=pn.split(hn);let kn=!1;const Zn=[],ea=mn.shift();ea&&Zn.push(ea);for(const ta of mn){const ra=ta[0]!=="{",na=ra?"}":"}}",sa=ta.indexOf(na);if(sa===-1||ta[1]==="{"){Zn.push(`{${pn.decode(ta)}`);continue}let $a=ta.slice(ra?0:1,sa);const Rs=$a[0]===":";Rs&&($a=$a.slice(1));const Ts=this._ref(pn.decode($a),{raw:ra,wrapped:Rs});Zn.push(Ts),typeof Ts!="string"&&(kn=!0);const Cs=ta.slice(sa+na.length);Cs&&Zn.push(pn.decode(Cs))}if(!kn){this.rendered=Zn.join("");return}this._template=Zn}static date(hn,mn){return pn.dateFormat[mn.dateFormat].call(hn)}describe(hn={}){if(!this._settings&&hn.compact)return this.source;const mn={template:this.source};return this._settings&&(mn.options=this._settings),this._functions&&(mn.functions=this._functions),mn}static build(hn){return new pn.Template(hn.template,hn.options||hn.functions?{...hn.options,functions:hn.functions}:void 0)}isDynamic(){return!!this._template}static isTemplate(hn){return hn?!!hn[tn.symbols.template]:!1}refs(){if(!this._template)return;const hn=[];for(const mn of this._template)typeof mn!="string"&&hn.push(...mn.refs);return hn}resolve(hn,mn,kn,Zn){return this._template&&this._template.length===1?this._part(this._template[0],hn,mn,kn,Zn,{}):this.render(hn,mn,kn,Zn)}_part(hn,...mn){return hn.ref?hn.ref.resolve(...mn):hn.formula.evaluate(mn)}render(hn,mn,kn,Zn,ea={}){if(!this.isDynamic())return this.rendered;const ta=[];for(const ra of this._template)if(typeof ra=="string")ta.push(ra);else{const na=this._part(ra,hn,mn,kn,Zn,ea),sa=pn.stringify(na,hn,mn,kn,Zn,ea);if(sa!==void 0){const $a=ra.raw||(ea.errors&&ea.errors.escapeHtml)===!1?sa:zr(sa);ta.push(pn.wrap($a,ra.wrapped&&kn.errors.wrap.label))}}return ta.join("")}_ref(hn,{raw:mn,wrapped:kn}){const Zn=[],ea=Jr(ra=>{const na=dn.create(ra,this._settings);return Zn.push(na),sa=>{const $a=na.resolve(...sa);return $a!==void 0?$a:null}},"reference");try{const ra=this._functions?{...pn.functions,...this._functions}:pn.functions;var ta=new Kr.Parser(hn,{reference:ea,functions:ra,constants:pn.constants})}catch(ra){throw ra.message=`Invalid template variable "${hn}" fails due to: ${ra.message}`,ra}if(ta.single){if(ta.single.type==="reference"){const ra=Zn[0];return{ref:ra,raw:mn,refs:Zn,wrapped:kn||ra.type==="local"&&ra.key==="label"}}return pn.stringify(ta.single.value)}return{formula:ta,raw:mn,refs:Zn}}toString(){return this.source}},pn.Template.prototype[tn.symbols.template]=!0,pn.Template.prototype.isImmutable=!0,pn.encode=function(hn){return hn.replace(/\\(\{+)/g,(mn,kn)=>pn.opens.slice(0,kn.length)).replace(/\\(\}+)/g,(mn,kn)=>pn.closes.slice(0,kn.length))},pn.decode=function(hn){return hn.replace(/\u0000/g,"{").replace(/\u0001/g,"}")},pn.split=function(hn){const mn=[];let kn="";for(let Zn=0;Zn<hn.length;++Zn){const ea=hn[Zn];if(ea==="{"){let ta="";for(;Zn+1<hn.length&&hn[Zn+1]==="{";)ta+="{",++Zn;mn.push(kn),kn=ta}else kn+=ea}return mn.push(kn),mn},pn.wrap=function(hn,mn){return mn?mn.length===1?`${mn}${hn}${mn}`:`${mn[0]}${hn}${mn[1]}`:hn},pn.stringify=function(hn,mn,kn,Zn,ea,ta={}){const ra=typeof hn,na=Zn&&Zn.errors&&Zn.errors.wrap||{};let sa=!1;if(dn.isRef(hn)&&hn.render&&(sa=hn.in,hn=hn.resolve(mn,kn,Zn,ea,{in:hn.in,...ta})),hn===null)return"null";if(ra==="string")return pn.wrap(hn,ta.arrayItems&&na.string);if(ra==="number"||ra==="function"||ra==="symbol")return hn.toString();if(ra!=="object")return JSON.stringify(hn);if(hn instanceof Date)return pn.Template.date(hn,Zn);if(hn instanceof Map){const Rs=[];for(const[Ts,Cs]of hn.entries())Rs.push(`${Ts.toString()} -> ${Cs.toString()}`);hn=Rs}if(!Array.isArray(hn))return hn.toString();const $a=[];for(const Rs of hn)$a.push(pn.stringify(Rs,mn,kn,Zn,ea,{arrayItems:!0,...ta}));return pn.wrap($a.join(", "),!sa&&na.array)},pn.constants={true:!0,false:!1,null:null,second:1e3,minute:60*1e3,hour:60*60*1e3,day:24*60*60*1e3},pn.functions={if(hn,mn,kn){return hn?mn:kn},length(hn){return typeof hn=="string"?hn.length:!hn||typeof hn!="object"?null:Array.isArray(hn)?hn.length:Object.keys(hn).length},msg(hn){const[mn,kn,Zn,ea,ta]=this,ra=ta.messages;if(!ra)return"";const na=sn.template(mn,ra[0],hn,kn,Zn)||sn.template(mn,ra[1],hn,kn,Zn);return na?na.render(mn,kn,Zn,ea,ta):""},number(hn){return typeof hn=="number"?hn:typeof hn=="string"?parseFloat(hn):typeof hn=="boolean"?hn?1:0:hn instanceof Date?hn.getTime():null}}}(template$1)),template$1.exports}Jr(requireTemplate,"requireTemplate");var hasRequiredMessages$2;function requireMessages$2(){return hasRequiredMessages$2||(hasRequiredMessages$2=1,function(Pr){const Br=requireAssert(),Ur=requireClone(),Vr=requireTemplate();Pr.compile=function(zr,Kr){if(typeof zr=="string")return Br(!Kr,"Cannot set single message string"),new Vr(zr);if(Vr.isTemplate(zr))return Br(!Kr,"Cannot set single message template"),zr;Br(typeof zr=="object"&&!Array.isArray(zr),"Invalid message options"),Kr=Kr?Ur(Kr):{};for(let tn in zr){const sn=zr[tn];if(tn==="root"||Vr.isTemplate(sn)){Kr[tn]=sn;continue}if(typeof sn=="string"){Kr[tn]=new Vr(sn);continue}Br(typeof sn=="object"&&!Array.isArray(sn),"Invalid message for",tn);const dn=tn;Kr[dn]=Kr[dn]||{};for(tn in sn){const pn=sn[tn];if(tn==="root"||Vr.isTemplate(pn)){Kr[dn][tn]=pn;continue}Br(typeof pn=="string","Invalid message for",tn,"in",dn),Kr[dn][tn]=new Vr(pn)}}return Kr},Pr.decompile=function(zr){const Kr={};for(let tn in zr){const sn=zr[tn];if(tn==="root"){Kr.root=sn;continue}if(Vr.isTemplate(sn)){Kr[tn]=sn.describe({compact:!0});continue}const dn=tn;Kr[dn]={};for(tn in sn){const pn=sn[tn];if(tn==="root"){Kr[dn].root=pn;continue}Kr[dn][tn]=pn.describe({compact:!0})}}return Kr},Pr.merge=function(zr,Kr){if(!zr)return Pr.compile(Kr);if(!Kr)return zr;if(typeof Kr=="string")return new Vr(Kr);if(Vr.isTemplate(Kr))return Kr;const tn=Ur(zr);for(let sn in Kr){const dn=Kr[sn];if(sn==="root"||Vr.isTemplate(dn)){tn[sn]=dn;continue}if(typeof dn=="string"){tn[sn]=new Vr(dn);continue}Br(typeof dn=="object"&&!Array.isArray(dn),"Invalid message for",sn);const pn=sn;tn[pn]=tn[pn]||{};for(sn in dn){const hn=dn[sn];if(sn==="root"||Vr.isTemplate(hn)){tn[pn][sn]=hn;continue}Br(typeof hn=="string","Invalid message for",sn,"in",pn),tn[pn][sn]=new Vr(hn)}}return tn}}(messages$2)),messages$2}Jr(requireMessages$2,"requireMessages$2");var hasRequiredCommon$7;function requireCommon$7(){return hasRequiredCommon$7||(hasRequiredCommon$7=1,function(Pr){const Br=requireAssert(),Ur=requireError$1(),Vr=require$$2$4;let zr,Kr;const tn={isoDate:/^(?:[-+]\d{2})?(?:\d{4}(?!\d{2}\b))(?:(-?)(?:(?:0[1-9]|1[0-2])(?:\1(?:[12]\d|0[1-9]|3[01]))?|W(?:[0-4]\d|5[0-2])(?:-?[1-7])?|(?:00[1-9]|0[1-9]\d|[12]\d{2}|3(?:[0-5]\d|6[1-6])))(?![T]$|[T][\d]+Z$)(?:[T\s](?:(?:(?:[01]\d|2[0-3])(?:(:?)[0-5]\d)?|24\:?00)(?:[.,]\d+(?!:))?)(?:\2[0-5]\d(?:[.,]\d+)?)?(?:[Z]|(?:[+-])(?:[01]\d|2[0-3])(?::?[0-5]\d)?)?)?)?$/};Pr.version=Vr.version,Pr.defaults={abortEarly:!0,allowUnknown:!1,artifacts:!1,cache:!0,context:null,convert:!0,dateFormat:"iso",errors:{escapeHtml:!1,label:"path",language:null,render:!0,stack:!1,wrap:{label:'"',array:"[]"}},externals:!0,messages:{},nonEnumerables:!1,noDefaults:!1,presence:"optional",skipFunctions:!1,stripUnknown:!1,warnings:!1},Pr.symbols={any:Symbol.for("@hapi/joi/schema"),arraySingle:Symbol("arraySingle"),deepDefault:Symbol("deepDefault"),errors:Symbol("errors"),literal:Symbol("literal"),override:Symbol("override"),parent:Symbol("parent"),prefs:Symbol("prefs"),ref:Symbol("ref"),template:Symbol("template"),values:Symbol("values")},Pr.assertOptions=function(sn,dn,pn="Options"){Br(sn&&typeof sn=="object"&&!Array.isArray(sn),"Options must be of type object");const hn=Object.keys(sn).filter(mn=>!dn.includes(mn));Br(hn.length===0,`${pn} contain unknown keys: ${hn}`)},Pr.checkPreferences=function(sn){Kr=Kr||requireSchemas();const dn=Kr.preferences.validate(sn);if(dn.error)throw new Ur([dn.error.details[0].message])},Pr.compare=function(sn,dn,pn){switch(pn){case"=":return sn===dn;case">":return sn>dn;case"<":return sn<dn;case">=":return sn>=dn;case"<=":return sn<=dn}},Pr.default=function(sn,dn){return sn===void 0?dn:sn},Pr.isIsoDate=function(sn){return tn.isoDate.test(sn)},Pr.isNumber=function(sn){return typeof sn=="number"&&!isNaN(sn)},Pr.isResolvable=function(sn){return sn?sn[Pr.symbols.ref]||sn[Pr.symbols.template]:!1},Pr.isSchema=function(sn,dn={}){const pn=sn&&sn[Pr.symbols.any];return pn?(Br(dn.legacy||pn.version===Pr.version,"Cannot mix different versions of joi schemas"),!0):!1},Pr.isValues=function(sn){return sn[Pr.symbols.values]},Pr.limit=function(sn){return Number.isSafeInteger(sn)&&sn>=0},Pr.preferences=function(sn,dn){zr=zr||requireMessages$2(),sn=sn||{},dn=dn||{};const pn=Object.assign({},sn,dn);return dn.errors&&sn.errors&&(pn.errors=Object.assign({},sn.errors,dn.errors),pn.errors.wrap=Object.assign({},sn.errors.wrap,dn.errors.wrap)),dn.messages&&(pn.messages=zr.compile(dn.messages,sn.messages)),delete pn[Pr.symbols.prefs],pn},Pr.tryWithPath=function(sn,dn,pn={}){try{return sn()}catch(hn){throw hn.path!==void 0?hn.path=dn+"."+hn.path:hn.path=dn,pn.append&&(hn.message=`${hn.message} (${hn.path})`),hn}},Pr.validateArg=function(sn,dn,{assert:pn,message:hn}){if(Pr.isSchema(pn)){const mn=pn.validate(sn);return mn.error?mn.error.message:void 0}else if(!pn(sn))return dn?`${dn} ${hn}`:hn},Pr.verifyFlat=function(sn,dn){for(const pn of sn)Br(!Array.isArray(pn),"Method no longer accepts array arguments:",dn)}}(common$6)),common$6}Jr(requireCommon$7,"requireCommon$7");var hasRequiredCache$1;function requireCache$1(){if(hasRequiredCache$1)return cache$6;hasRequiredCache$1=1;const Pr=requireAssert(),Br=requireClone(),Ur=requireCommon$7(),Vr={max:1e3,supported:new Set(["undefined","boolean","number","string"])};return cache$6.provider={provision(zr){return new Vr.Cache(zr)}},Vr.Cache=class{constructor(zr={}){Ur.assertOptions(zr,["max"]),Pr(zr.max===void 0||zr.max&&zr.max>0&&isFinite(zr.max),"Invalid max cache size"),this._max=zr.max||Vr.max,this._map=new Map,this._list=new Vr.List}get length(){return this._map.size}set(zr,Kr){if(zr!==null&&!Vr.supported.has(typeof zr))return;let tn=this._map.get(zr);if(tn){tn.value=Kr,this._list.first(tn);return}tn=this._list.unshift({key:zr,value:Kr}),this._map.set(zr,tn),this._compact()}get(zr){const Kr=this._map.get(zr);if(Kr)return this._list.first(Kr),Br(Kr.value)}_compact(){if(this._map.size>this._max){const zr=this._list.pop();this._map.delete(zr.key)}}},Vr.List=class{constructor(){this.tail=null,this.head=null}unshift(zr){return zr.next=null,zr.prev=this.head,this.head&&(this.head.next=zr),this.head=zr,this.tail||(this.tail=zr),zr}first(zr){zr!==this.head&&(this._remove(zr),this.unshift(zr))}pop(){return this._remove(this.tail)}_remove(zr){const{next:Kr,prev:tn}=zr;return Kr.prev=tn,tn&&(tn.next=Kr),zr===this.tail&&(this.tail=Kr),zr.prev=null,zr.next=null,zr}},cache$6}Jr(requireCache$1,"requireCache$1");var compile={},hasRequiredCompile$1;function requireCompile$1(){return hasRequiredCompile$1||(hasRequiredCompile$1=1,function(Pr){const Br=requireAssert(),Ur=requireCommon$7(),Vr=requireRef$2(),zr={};Pr.schema=function(Kr,tn,sn={}){Ur.assertOptions(sn,["appendPath","override"]);try{return zr.schema(Kr,tn,sn)}catch(dn){throw sn.appendPath&&dn.path!==void 0&&(dn.message=`${dn.message} (${dn.path})`),dn}},zr.schema=function(Kr,tn,sn){Br(tn!==void 0,"Invalid undefined schema"),Array.isArray(tn)&&(Br(tn.length,"Invalid empty array schema"),tn.length===1&&(tn=tn[0]));const dn=Jr((pn,...hn)=>sn.override!==!1?pn.valid(Kr.override,...hn):pn.valid(...hn),"valid");if(zr.simple(tn))return dn(Kr,tn);if(typeof tn=="function")return Kr.custom(tn);if(Br(typeof tn=="object","Invalid schema content:",typeof tn),Ur.isResolvable(tn))return dn(Kr,tn);if(Ur.isSchema(tn))return tn;if(Array.isArray(tn)){for(const pn of tn)if(!zr.simple(pn))return Kr.alternatives().try(...tn);return dn(Kr,...tn)}return tn instanceof RegExp?Kr.string().regex(tn):tn instanceof Date?dn(Kr.date(),tn):(Br(Object.getPrototypeOf(tn)===Object.getPrototypeOf({}),"Schema can only contain plain objects"),Kr.object().keys(tn))},Pr.ref=function(Kr,tn){return Vr.isRef(Kr)?Kr:Vr.create(Kr,tn)},Pr.compile=function(Kr,tn,sn={}){Ur.assertOptions(sn,["legacy"]);const dn=tn&&tn[Ur.symbols.any];if(dn)return Br(sn.legacy||dn.version===Ur.version,"Cannot mix different versions of joi schemas:",dn.version,Ur.version),tn;if(typeof tn!="object"||!sn.legacy)return Pr.schema(Kr,tn,{appendPath:!0});const pn=zr.walk(tn);return pn?pn.compile(pn.root,tn):Pr.schema(Kr,tn,{appendPath:!0})},zr.walk=function(Kr){if(typeof Kr!="object")return null;if(Array.isArray(Kr)){for(const sn of Kr){const dn=zr.walk(sn);if(dn)return dn}return null}const tn=Kr[Ur.symbols.any];if(tn)return{root:Kr[tn.root],compile:tn.compile};Br(Object.getPrototypeOf(Kr)===Object.getPrototypeOf({}),"Schema can only contain plain objects");for(const sn in Kr){const dn=zr.walk(Kr[sn]);if(dn)return dn}return null},zr.simple=function(Kr){return Kr===null||["boolean","string","number"].includes(typeof Kr)},Pr.when=function(Kr,tn,sn){if(sn===void 0&&(Br(tn&&typeof tn=="object","Missing options"),sn=tn,tn=Vr.create(".")),Array.isArray(sn)&&(sn={switch:sn}),Ur.assertOptions(sn,["is","not","then","otherwise","switch","break"]),Ur.isSchema(tn))return Br(sn.is===void 0,'"is" can not be used with a schema condition'),Br(sn.not===void 0,'"not" can not be used with a schema condition'),Br(sn.switch===void 0,'"switch" can not be used with a schema condition'),zr.condition(Kr,{is:tn,then:sn.then,otherwise:sn.otherwise,break:sn.break});if(Br(Vr.isRef(tn)||typeof tn=="string","Invalid condition:",tn),Br(sn.not===void 0||sn.is===void 0,'Cannot combine "is" with "not"'),sn.switch===void 0){let pn=sn;sn.not!==void 0&&(pn={is:sn.not,then:sn.otherwise,otherwise:sn.then,break:sn.break});let hn=pn.is!==void 0?Kr.$_compile(pn.is):Kr.$_root.invalid(null,!1,0,"").required();return Br(pn.then!==void 0||pn.otherwise!==void 0,'options must have at least one of "then", "otherwise", or "switch"'),Br(pn.break===void 0||pn.then===void 0||pn.otherwise===void 0,"Cannot specify then, otherwise, and break all together"),sn.is!==void 0&&!Vr.isRef(sn.is)&&!Ur.isSchema(sn.is)&&(hn=hn.required()),zr.condition(Kr,{ref:Pr.ref(tn),is:hn,then:pn.then,otherwise:pn.otherwise,break:pn.break})}Br(Array.isArray(sn.switch),'"switch" must be an array'),Br(sn.is===void 0,'Cannot combine "switch" with "is"'),Br(sn.not===void 0,'Cannot combine "switch" with "not"'),Br(sn.then===void 0,'Cannot combine "switch" with "then"');const dn={ref:Pr.ref(tn),switch:[],break:sn.break};for(let pn=0;pn<sn.switch.length;++pn){const hn=sn.switch[pn],mn=pn===sn.switch.length-1;Ur.assertOptions(hn,mn?["is","then","otherwise"]:["is","then"]),Br(hn.is!==void 0,'Switch statement missing "is"'),Br(hn.then!==void 0,'Switch statement missing "then"');const kn={is:Kr.$_compile(hn.is),then:Kr.$_compile(hn.then)};if(!Vr.isRef(hn.is)&&!Ur.isSchema(hn.is)&&(kn.is=kn.is.required()),mn){Br(sn.otherwise===void 0||hn.otherwise===void 0,'Cannot specify "otherwise" inside and outside a "switch"');const Zn=sn.otherwise!==void 0?sn.otherwise:hn.otherwise;Zn!==void 0&&(Br(dn.break===void 0,"Cannot specify both otherwise and break"),kn.otherwise=Kr.$_compile(Zn))}dn.switch.push(kn)}return dn},zr.condition=function(Kr,tn){for(const sn of["then","otherwise"])tn[sn]===void 0?delete tn[sn]:tn[sn]=Kr.$_compile(tn[sn]);return tn}}(compile)),compile}Jr(requireCompile$1,"requireCompile$1");var extend$4={},hasRequiredExtend$1;function requireExtend$1(){if(hasRequiredExtend$1)return extend$4;hasRequiredExtend$1=1;const Pr=requireAssert(),Br=requireClone(),Ur=requireCommon$7(),Vr=requireMessages$2(),zr={};return extend$4.type=function(Kr,tn){const sn=Object.getPrototypeOf(Kr),dn=Br(sn),pn=Kr._assign(Object.create(dn)),hn=Object.assign({},tn);delete hn.base,dn._definition=hn;const mn=sn._definition||{};hn.messages=Vr.merge(mn.messages,hn.messages),hn.properties=Object.assign({},mn.properties,hn.properties),pn.type=hn.type,hn.flags=Object.assign({},mn.flags,hn.flags);const kn=Object.assign({},mn.terms);if(hn.terms)for(const ra in hn.terms){const na=hn.terms[ra];Pr(pn.$_terms[ra]===void 0,"Invalid term override for",hn.type,ra),pn.$_terms[ra]=na.init,kn[ra]=na}hn.terms=kn,hn.args||(hn.args=mn.args),hn.prepare=zr.prepare(hn.prepare,mn.prepare),hn.coerce&&(typeof hn.coerce=="function"&&(hn.coerce={method:hn.coerce}),hn.coerce.from&&!Array.isArray(hn.coerce.from)&&(hn.coerce={method:hn.coerce.method,from:[].concat(hn.coerce.from)})),hn.coerce=zr.coerce(hn.coerce,mn.coerce),hn.validate=zr.validate(hn.validate,mn.validate);const Zn=Object.assign({},mn.rules);if(hn.rules)for(const ra in hn.rules){const na=hn.rules[ra];Pr(typeof na=="object","Invalid rule definition for",hn.type,ra);let sa=na.method;if(sa===void 0&&(sa=Jr(function(){return this.$_addRule(ra)},"method")),sa&&(Pr(!dn[ra],"Rule conflict in",hn.type,ra),dn[ra]=sa),Pr(!Zn[ra],"Rule conflict in",hn.type,ra),Zn[ra]=na,na.alias){const $a=[].concat(na.alias);for(const Rs of $a)dn[Rs]=na.method}na.args&&(na.argsByName=new Map,na.args=na.args.map($a=>(typeof $a=="string"&&($a={name:$a}),Pr(!na.argsByName.has($a.name),"Duplicated argument name",$a.name),Ur.isSchema($a.assert)&&($a.assert=$a.assert.strict().label($a.name)),na.argsByName.set($a.name,$a),$a)))}hn.rules=Zn;const ea=Object.assign({},mn.modifiers);if(hn.modifiers)for(const ra in hn.modifiers){Pr(!dn[ra],"Rule conflict in",hn.type,ra);const na=hn.modifiers[ra];Pr(typeof na=="function","Invalid modifier definition for",hn.type,ra);const sa=Jr(function($a){return this.rule({[ra]:$a})},"method");dn[ra]=sa,ea[ra]=na}if(hn.modifiers=ea,hn.overrides){dn._super=sn,pn.$_super={};for(const ra in hn.overrides)Pr(sn[ra],"Cannot override missing",ra),hn.overrides[ra][Ur.symbols.parent]=sn[ra],pn.$_super[ra]=sn[ra].bind(pn);Object.assign(dn,hn.overrides)}hn.cast=Object.assign({},mn.cast,hn.cast);const ta=Object.assign({},mn.manifest,hn.manifest);return ta.build=zr.build(hn.manifest&&hn.manifest.build,mn.manifest&&mn.manifest.build),hn.manifest=ta,hn.rebuild=zr.rebuild(hn.rebuild,mn.rebuild),pn},zr.build=function(Kr,tn){return!Kr||!tn?Kr||tn:function(sn,dn){return tn(Kr(sn,dn),dn)}},zr.coerce=function(Kr,tn){return!Kr||!tn?Kr||tn:{from:Kr.from&&tn.from?[...new Set([...Kr.from,...tn.from])]:null,method(sn,dn){let pn;if((!tn.from||tn.from.includes(typeof sn))&&(pn=tn.method(sn,dn),pn)){if(pn.errors||pn.value===void 0)return pn;sn=pn.value}if(!Kr.fro