@ew-did-registry/credentials-interface
Version:
The package provides interfaces for credentials.
2 lines • 233 kB
JavaScript
/*! For license information please see index.esm.js.LICENSE.txt */
(()=>{var e={903:e=>{var t,r;self,e.exports=(t={1238:e=>{"use strict";e.exports={version:"17.6.0"}},7629:(e,t,r)=>{"use strict";const n=r(375),i=r(8571),s=r(9474),o=r(1687),a=r(8652),u=r(8160),l=r(3292),c=r(6354),f=r(8901),p=r(9708),h=r(6914),d=r(2294),m=r(6133),g=r(1152),y=r(8863),v=r(2036),_={Base:class{constructor(e){this.type=e,this.$_root=null,this._definition={},this._reset()}_reset(){this._ids=new d.Ids,this._preferences=null,this._refs=new m.Manager,this._cache=null,this._valids=null,this._invalids=null,this._flags={},this._rules=[],this._singleRules=new Map,this.$_terms={},this.$_temp={ruleset:null,whens:{}}}describe(){return n("function"==typeof p.describe,"Manifest functionality disabled"),p.describe(this)}allow(...e){return u.verifyFlat(e,"allow"),this._values(e,"_valids")}alter(e){n(e&&"object"==typeof e&&!Array.isArray(e),"Invalid targets argument"),n(!this._inRuleset(),"Cannot set alterations inside a ruleset");const t=this.clone();t.$_terms.alterations=t.$_terms.alterations||[];for(const r in e){const i=e[r];n("function"==typeof i,"Alteration adjuster for",r,"must be a function"),t.$_terms.alterations.push({target:r,adjuster:i})}return t.$_temp.ruleset=!1,t}artifact(e){return n(void 0!==e,"Artifact cannot be undefined"),n(!this._cache,"Cannot set an artifact with a rule cache"),this.$_setFlag("artifact",e)}cast(e){return n(!1===e||"string"==typeof e,"Invalid to value"),n(!1===e||this._definition.cast[e],"Type",this.type,"does not support casting to",e),this.$_setFlag("cast",!1===e?void 0:e)}default(e,t){return this._default("default",e,t)}description(e){return n(e&&"string"==typeof e,"Description must be a non-empty string"),this.$_setFlag("description",e)}empty(e){const t=this.clone();return void 0!==e&&(e=t.$_compile(e,{override:!1})),t.$_setFlag("empty",e,{clone:!1})}error(e){return n(e,"Missing error"),n(e instanceof Error||"function"==typeof e,"Must provide a valid Error object or a function"),this.$_setFlag("error",e)}example(e,t={}){return n(void 0!==e,"Missing example"),u.assertOptions(t,["override"]),this._inner("examples",e,{single:!0,override:t.override})}external(e,t){return"object"==typeof e&&(n(!t,"Cannot combine options with description"),t=e.description,e=e.method),n("function"==typeof e,"Method must be a function"),n(void 0===t||t&&"string"==typeof t,"Description must be a non-empty string"),this._inner("externals",{method:e,description:t},{single:!0})}failover(e,t){return this._default("failover",e,t)}forbidden(){return this.presence("forbidden")}id(e){return e?(n("string"==typeof e,"id must be a non-empty string"),n(/^[^\.]+$/.test(e),"id cannot contain period character"),this.$_setFlag("id",e)):this.$_setFlag("id",void 0)}invalid(...e){return this._values(e,"_invalids")}label(e){return n(e&&"string"==typeof e,"Label name must be a non-empty string"),this.$_setFlag("label",e)}meta(e){return n(void 0!==e,"Meta cannot be undefined"),this._inner("metas",e,{single:!0})}note(...e){n(e.length,"Missing notes");for(const t of e)n(t&&"string"==typeof t,"Notes must be non-empty strings");return this._inner("notes",e)}only(e=!0){return n("boolean"==typeof e,"Invalid mode:",e),this.$_setFlag("only",e)}optional(){return this.presence("optional")}prefs(e){n(e,"Missing preferences"),n(void 0===e.context,"Cannot override context"),n(void 0===e.externals,"Cannot override externals"),n(void 0===e.warnings,"Cannot override warnings"),n(void 0===e.debug,"Cannot override debug"),u.checkPreferences(e);const t=this.clone();return t._preferences=u.preferences(t._preferences,e),t}presence(e){return n(["optional","required","forbidden"].includes(e),"Unknown presence mode",e),this.$_setFlag("presence",e)}raw(e=!0){return this.$_setFlag("result",e?"raw":void 0)}result(e){return n(["raw","strip"].includes(e),"Unknown result mode",e),this.$_setFlag("result",e)}required(){return this.presence("required")}strict(e){const t=this.clone(),r=void 0!==e&&!e;return t._preferences=u.preferences(t._preferences,{convert:r}),t}strip(e=!0){return this.$_setFlag("result",e?"strip":void 0)}tag(...e){n(e.length,"Missing tags");for(const t of e)n(t&&"string"==typeof t,"Tags must be non-empty strings");return this._inner("tags",e)}unit(e){return n(e&&"string"==typeof e,"Unit name must be a non-empty string"),this.$_setFlag("unit",e)}valid(...e){u.verifyFlat(e,"valid");const t=this.allow(...e);return t.$_setFlag("only",!!t._valids,{clone:!1}),t}when(e,t){const r=this.clone();r.$_terms.whens||(r.$_terms.whens=[]);const i=l.when(r,e,t);if(!["any","link"].includes(r.type)){const e=i.is?[i]:i.switch;for(const t of e)n(!t.then||"any"===t.then.type||t.then.type===r.type,"Cannot combine",r.type,"with",t.then&&t.then.type),n(!t.otherwise||"any"===t.otherwise.type||t.otherwise.type===r.type,"Cannot combine",r.type,"with",t.otherwise&&t.otherwise.type)}return r.$_terms.whens.push(i),r.$_mutateRebuild()}cache(e){n(!this._inRuleset(),"Cannot set caching inside a ruleset"),n(!this._cache,"Cannot override schema cache"),n(void 0===this._flags.artifact,"Cannot cache a rule with an artifact");const t=this.clone();return t._cache=e||a.provider.provision(),t.$_temp.ruleset=!1,t}clone(){const e=Object.create(Object.getPrototypeOf(this));return this._assign(e)}concat(e){n(u.isSchema(e),"Invalid schema object"),n("any"===this.type||"any"===e.type||e.type===this.type,"Cannot merge type",this.type,"with another type:",e.type),n(!this._inRuleset(),"Cannot concatenate onto a schema with open ruleset"),n(!e._inRuleset(),"Cannot concatenate a schema with open ruleset");let t=this.clone();if("any"===this.type&&"any"!==e.type){const r=e.clone();for(const e of Object.keys(t))"type"!==e&&(r[e]=t[e]);t=r}t._ids.concat(e._ids),t._refs.register(e,m.toSibling),t._preferences=t._preferences?u.preferences(t._preferences,e._preferences):e._preferences,t._valids=v.merge(t._valids,e._valids,e._invalids),t._invalids=v.merge(t._invalids,e._invalids,e._valids);for(const r of e._singleRules.keys())t._singleRules.has(r)&&(t._rules=t._rules.filter((e=>e.keep||e.name!==r)),t._singleRules.delete(r));for(const r of e._rules)e._definition.rules[r.method].multi||t._singleRules.set(r.name,r),t._rules.push(r);if(t._flags.empty&&e._flags.empty){t._flags.empty=t._flags.empty.concat(e._flags.empty);const r=Object.assign({},e._flags);delete r.empty,o(t._flags,r)}else if(e._flags.empty){t._flags.empty=e._flags.empty;const r=Object.assign({},e._flags);delete r.empty,o(t._flags,r)}else o(t._flags,e._flags);for(const r in e.$_terms){const n=e.$_terms[r];n?t.$_terms[r]?t.$_terms[r]=t.$_terms[r].concat(n):t.$_terms[r]=n.slice():t.$_terms[r]||(t.$_terms[r]=n)}return this.$_root._tracer&&this.$_root._tracer._combine(t,[this,e]),t.$_mutateRebuild()}extend(e){return n(!e.base,"Cannot extend type with another base"),f.type(this,e)}extract(e){return e=Array.isArray(e)?e:e.split("."),this._ids.reach(e)}fork(e,t){n(!this._inRuleset(),"Cannot fork inside a ruleset");let r=this;for(let n of[].concat(e))n=Array.isArray(n)?n:n.split("."),r=r._ids.fork(n,t,r);return r.$_temp.ruleset=!1,r}rule(e){const t=this._definition;u.assertOptions(e,Object.keys(t.modifiers)),n(!1!==this.$_temp.ruleset,"Cannot apply rules to empty ruleset or the last rule added does not support rule properties");const r=null===this.$_temp.ruleset?this._rules.length-1:this.$_temp.ruleset;n(r>=0&&r<this._rules.length,"Cannot apply rules to empty ruleset");const s=this.clone();for(let o=r;o<s._rules.length;++o){const r=s._rules[o],a=i(r);for(const i in e)t.modifiers[i](a,e[i]),n(a.name===r.name,"Cannot change rule name");s._rules[o]=a,s._singleRules.get(a.name)===r&&s._singleRules.set(a.name,a)}return s.$_temp.ruleset=!1,s.$_mutateRebuild()}get ruleset(){n(!this._inRuleset(),"Cannot start a new ruleset without closing the previous one");const e=this.clone();return e.$_temp.ruleset=e._rules.length,e}get $(){return this.ruleset}tailor(e){e=[].concat(e),n(!this._inRuleset(),"Cannot tailor inside a ruleset");let t=this;if(this.$_terms.alterations)for(const{target:r,adjuster:i}of this.$_terms.alterations)e.includes(r)&&(t=i(t),n(u.isSchema(t),"Alteration adjuster for",r,"failed to return a schema object"));return t=t.$_modify({each:t=>t.tailor(e),ref:!1}),t.$_temp.ruleset=!1,t.$_mutateRebuild()}tracer(){return g.location?g.location(this):this}validate(e,t){return y.entry(e,this,t)}validateAsync(e,t){return y.entryAsync(e,this,t)}$_addRule(e){"string"==typeof e&&(e={name:e}),n(e&&"object"==typeof e,"Invalid options"),n(e.name&&"string"==typeof e.name,"Invalid rule name");for(const t in e)n("_"!==t[0],"Cannot set private rule properties");const t=Object.assign({},e);t._resolve=[],t.method=t.method||t.name;const r=this._definition.rules[t.method],i=t.args;n(r,"Unknown rule",t.method);const s=this.clone();if(i){n(1===Object.keys(i).length||Object.keys(i).length===this._definition.rules[t.name].args.length,"Invalid rule definition for",this.type,t.name);for(const e in i){let o=i[e];if(void 0!==o){if(r.argsByName){const a=r.argsByName.get(e);if(a.ref&&u.isResolvable(o))t._resolve.push(e),s.$_mutateRegister(o);else if(a.normalize&&(o=a.normalize(o),i[e]=o),a.assert){const t=u.validateArg(o,e,a);n(!t,t,"or reference")}}i[e]=o}else delete i[e]}}return r.multi||(s._ruleRemove(t.name,{clone:!1}),s._singleRules.set(t.name,t)),!1===s.$_temp.ruleset&&(s.$_temp.ruleset=null),r.priority?s._rules.unshift(t):s._rules.push(t),s}$_compile(e,t){return l.schema(this.$_root,e,t)}$_createError(e,t,r,n,i,s={}){const o=!1!==s.flags?this._flags:{},a=s.messages?h.merge(this._definition.messages,s.messages):this._definition.messages;return new c.Report(e,t,r,o,a,n,i)}$_getFlag(e){return this._flags[e]}$_getRule(e){return this._singleRules.get(e)}$_mapLabels(e){return e=Array.isArray(e)?e:e.split("."),this._ids.labels(e)}$_match(e,t,r,n){(r=Object.assign({},r)).abortEarly=!0,r._externals=!1,t.snapshot();const i=!y.validate(e,this,t,r,n).errors;return t.restore(),i}$_modify(e){return u.assertOptions(e,["each","once","ref","schema"]),d.schema(this,e)||this}$_mutateRebuild(){return n(!this._inRuleset(),"Cannot add this rule inside a ruleset"),this._refs.reset(),this._ids.reset(),this.$_modify({each:(e,{source:t,name:r,path:n,key:i})=>{const s=this._definition[t][r]&&this._definition[t][r].register;!1!==s&&this.$_mutateRegister(e,{family:s,key:i})}}),this._definition.rebuild&&this._definition.rebuild(this),this.$_temp.ruleset=!1,this}$_mutateRegister(e,{family:t,key:r}={}){this._refs.register(e,t),this._ids.register(e,{key:r})}$_property(e){return this._definition.properties[e]}$_reach(e){return this._ids.reach(e)}$_rootReferences(){return this._refs.roots()}$_setFlag(e,t,r={}){n("_"===e[0]||!this._inRuleset(),"Cannot set flag inside a ruleset");const i=this._definition.flags[e]||{};if(s(t,i.default)&&(t=void 0),s(t,this._flags[e]))return this;const o=!1!==r.clone?this.clone():this;return void 0!==t?(o._flags[e]=t,o.$_mutateRegister(t)):delete o._flags[e],"_"!==e[0]&&(o.$_temp.ruleset=!1),o}$_parent(e,...t){return this[e][u.symbols.parent].call(this,...t)}$_validate(e,t,r){return y.validate(e,this,t,r)}_assign(e){e.type=this.type,e.$_root=this.$_root,e.$_temp=Object.assign({},this.$_temp),e.$_temp.whens={},e._ids=this._ids.clone(),e._preferences=this._preferences,e._valids=this._valids&&this._valids.clone(),e._invalids=this._invalids&&this._invalids.clone(),e._rules=this._rules.slice(),e._singleRules=i(this._singleRules,{shallow:!0}),e._refs=this._refs.clone(),e._flags=Object.assign({},this._flags),e._cache=null,e.$_terms={};for(const t in this.$_terms)e.$_terms[t]=this.$_terms[t]?this.$_terms[t].slice():null;e.$_super={};for(const t in this.$_super)e.$_super[t]=this._super[t].bind(e);return e}_bare(){const e=this.clone();e._reset();const t=e._definition.terms;for(const r in t){const n=t[r];e.$_terms[r]=n.init}return e.$_mutateRebuild()}_default(e,t,r={}){return u.assertOptions(r,"literal"),n(void 0!==t,"Missing",e,"value"),n("function"==typeof t||!r.literal,"Only function value supports literal option"),"function"==typeof t&&r.literal&&(t={[u.symbols.literal]:!0,literal:t}),this.$_setFlag(e,t)}_generate(e,t,r){if(!this.$_terms.whens)return{schema:this};const n=[],i=[];for(let s=0;s<this.$_terms.whens.length;++s){const o=this.$_terms.whens[s];if(o.concat){n.push(o.concat),i.push("".concat(s,".concat"));continue}const a=o.ref?o.ref.resolve(e,t,r):e,u=o.is?[o]:o.switch,l=i.length;for(let l=0;l<u.length;++l){const{is:c,then:f,otherwise:p}=u[l],h="".concat(s).concat(o.switch?"."+l:"");if(c.$_match(a,t.nest(c,"".concat(h,".is")),r)){if(f){const s=t.localize([...t.path,"".concat(h,".then")],t.ancestors,t.schemas),{schema:o,id:a}=f._generate(e,s,r);n.push(o),i.push("".concat(h,".then").concat(a?"(".concat(a,")"):""));break}}else if(p){const s=t.localize([...t.path,"".concat(h,".otherwise")],t.ancestors,t.schemas),{schema:o,id:a}=p._generate(e,s,r);n.push(o),i.push("".concat(h,".otherwise").concat(a?"(".concat(a,")"):""));break}}if(o.break&&i.length>l)break}const s=i.join(", ");if(t.mainstay.tracer.debug(t,"rule","when",s),!s)return{schema:this};if(!t.mainstay.tracer.active&&this.$_temp.whens[s])return{schema:this.$_temp.whens[s],id:s};let o=this;this._definition.generate&&(o=this._definition.generate(this,e,t,r));for(const e of n)o=o.concat(e);return this.$_root._tracer&&this.$_root._tracer._combine(o,[this,...n]),this.$_temp.whens[s]=o,{schema:o,id:s}}_inner(e,t,r={}){n(!this._inRuleset(),"Cannot set ".concat(e," inside a ruleset"));const i=this.clone();return i.$_terms[e]&&!r.override||(i.$_terms[e]=[]),r.single?i.$_terms[e].push(t):i.$_terms[e].push(...t),i.$_temp.ruleset=!1,i}_inRuleset(){return null!==this.$_temp.ruleset&&!1!==this.$_temp.ruleset}_ruleRemove(e,t={}){if(!this._singleRules.has(e))return this;const r=!1!==t.clone?this.clone():this;r._singleRules.delete(e);const n=[];for(let t=0;t<r._rules.length;++t){const i=r._rules[t];i.name!==e||i.keep?n.push(i):r._inRuleset()&&t<r.$_temp.ruleset&&--r.$_temp.ruleset}return r._rules=n,r}_values(e,t){u.verifyFlat(e,t.slice(1,-1));const r=this.clone(),i=e[0]===u.symbols.override;if(i&&(e=e.slice(1)),!r[t]&&e.length?r[t]=new v:i&&(r[t]=e.length?new v:null,r.$_mutateRebuild()),!r[t])return r;i&&r[t].override();for(const i of e){n(void 0!==i,"Cannot call allow/valid/invalid with undefined"),n(i!==u.symbols.override,"Override must be the first value");const e="_invalids"===t?"_valids":"_invalids";r[e]&&(r[e].remove(i),r[e].length||(n("_valids"===t||!r._flags.only,"Setting invalid value",i,"leaves schema rejecting all values due to previous valid rule"),r[e]=null)),r[t].add(i,r._refs)}return r}}};_.Base.prototype[u.symbols.any]={version:u.version,compile:l.compile,root:"$_root"},_.Base.prototype.isImmutable=!0,_.Base.prototype.deny=_.Base.prototype.invalid,_.Base.prototype.disallow=_.Base.prototype.invalid,_.Base.prototype.equal=_.Base.prototype.valid,_.Base.prototype.exist=_.Base.prototype.required,_.Base.prototype.not=_.Base.prototype.invalid,_.Base.prototype.options=_.Base.prototype.prefs,_.Base.prototype.preferences=_.Base.prototype.prefs,e.exports=new _.Base},8652:(e,t,r)=>{"use strict";const n=r(375),i=r(8571),s=r(8160),o={max:1e3,supported:new Set(["undefined","boolean","number","string"])};t.provider={provision:e=>new o.Cache(e)},o.Cache=class{constructor(e={}){s.assertOptions(e,["max"]),n(void 0===e.max||e.max&&e.max>0&&isFinite(e.max),"Invalid max cache size"),this._max=e.max||o.max,this._map=new Map,this._list=new o.List}get length(){return this._map.size}set(e,t){if(null!==e&&!o.supported.has(typeof e))return;let r=this._map.get(e);if(r)return r.value=t,void this._list.first(r);r=this._list.unshift({key:e,value:t}),this._map.set(e,r),this._compact()}get(e){const t=this._map.get(e);if(t)return this._list.first(t),i(t.value)}_compact(){if(this._map.size>this._max){const e=this._list.pop();this._map.delete(e.key)}}},o.List=class{constructor(){this.tail=null,this.head=null}unshift(e){return e.next=null,e.prev=this.head,this.head&&(this.head.next=e),this.head=e,this.tail||(this.tail=e),e}first(e){e!==this.head&&(this._remove(e),this.unshift(e))}pop(){return this._remove(this.tail)}_remove(e){const{next:t,prev:r}=e;return t.prev=r,r&&(r.next=t),e===this.tail&&(this.tail=t),e.prev=null,e.next=null,e}}},8160:(e,t,r)=>{"use strict";const n=r(375),i=r(7916),s=r(1238);let o,a;const u={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)?)?)?)?$/};t.version=s.version,t.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},t.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")},t.assertOptions=function(e,t,r="Options"){n(e&&"object"==typeof e&&!Array.isArray(e),"Options must be of type object");const i=Object.keys(e).filter((e=>!t.includes(e)));n(0===i.length,"".concat(r," contain unknown keys: ").concat(i))},t.checkPreferences=function(e){a=a||r(3378);const t=a.preferences.validate(e);if(t.error)throw new i([t.error.details[0].message])},t.compare=function(e,t,r){switch(r){case"=":return e===t;case">":return e>t;case"<":return e<t;case">=":return e>=t;case"<=":return e<=t}},t.default=function(e,t){return void 0===e?t:e},t.isIsoDate=function(e){return u.isoDate.test(e)},t.isNumber=function(e){return"number"==typeof e&&!isNaN(e)},t.isResolvable=function(e){return!!e&&(e[t.symbols.ref]||e[t.symbols.template])},t.isSchema=function(e,r={}){const i=e&&e[t.symbols.any];return!!i&&(n(r.legacy||i.version===t.version,"Cannot mix different versions of joi schemas"),!0)},t.isValues=function(e){return e[t.symbols.values]},t.limit=function(e){return Number.isSafeInteger(e)&&e>=0},t.preferences=function(e,n){o=o||r(6914),e=e||{},n=n||{};const i=Object.assign({},e,n);return n.errors&&e.errors&&(i.errors=Object.assign({},e.errors,n.errors),i.errors.wrap=Object.assign({},e.errors.wrap,n.errors.wrap)),n.messages&&(i.messages=o.compile(n.messages,e.messages)),delete i[t.symbols.prefs],i},t.tryWithPath=function(e,t,r={}){try{return e()}catch(e){throw void 0!==e.path?e.path=t+"."+e.path:e.path=t,r.append&&(e.message="".concat(e.message," (").concat(e.path,")")),e}},t.validateArg=function(e,r,{assert:n,message:i}){if(t.isSchema(n)){const t=n.validate(e);if(!t.error)return;return t.error.message}if(!n(e))return r?"".concat(r," ").concat(i):i},t.verifyFlat=function(e,t){for(const r of e)n(!Array.isArray(r),"Method no longer accepts array arguments:",t)}},3292:(e,t,r)=>{"use strict";const n=r(375),i=r(8160),s=r(6133),o={};t.schema=function(e,t,r={}){i.assertOptions(r,["appendPath","override"]);try{return o.schema(e,t,r)}catch(e){throw r.appendPath&&void 0!==e.path&&(e.message="".concat(e.message," (").concat(e.path,")")),e}},o.schema=function(e,t,r){n(void 0!==t,"Invalid undefined schema"),Array.isArray(t)&&(n(t.length,"Invalid empty array schema"),1===t.length&&(t=t[0]));const s=(t,...n)=>!1!==r.override?t.valid(e.override,...n):t.valid(...n);if(o.simple(t))return s(e,t);if("function"==typeof t)return e.custom(t);if(n("object"==typeof t,"Invalid schema content:",typeof t),i.isResolvable(t))return s(e,t);if(i.isSchema(t))return t;if(Array.isArray(t)){for(const r of t)if(!o.simple(r))return e.alternatives().try(...t);return s(e,...t)}return t instanceof RegExp?e.string().regex(t):t instanceof Date?s(e.date(),t):(n(Object.getPrototypeOf(t)===Object.getPrototypeOf({}),"Schema can only contain plain objects"),e.object().keys(t))},t.ref=function(e,t){return s.isRef(e)?e:s.create(e,t)},t.compile=function(e,r,s={}){i.assertOptions(s,["legacy"]);const a=r&&r[i.symbols.any];if(a)return n(s.legacy||a.version===i.version,"Cannot mix different versions of joi schemas:",a.version,i.version),r;if("object"!=typeof r||!s.legacy)return t.schema(e,r,{appendPath:!0});const u=o.walk(r);return u?u.compile(u.root,r):t.schema(e,r,{appendPath:!0})},o.walk=function(e){if("object"!=typeof e)return null;if(Array.isArray(e)){for(const t of e){const e=o.walk(t);if(e)return e}return null}const t=e[i.symbols.any];if(t)return{root:e[t.root],compile:t.compile};n(Object.getPrototypeOf(e)===Object.getPrototypeOf({}),"Schema can only contain plain objects");for(const t in e){const r=o.walk(e[t]);if(r)return r}return null},o.simple=function(e){return null===e||["boolean","string","number"].includes(typeof e)},t.when=function(e,r,a){if(void 0===a&&(n(r&&"object"==typeof r,"Missing options"),a=r,r=s.create(".")),Array.isArray(a)&&(a={switch:a}),i.assertOptions(a,["is","not","then","otherwise","switch","break"]),i.isSchema(r))return n(void 0===a.is,'"is" can not be used with a schema condition'),n(void 0===a.not,'"not" can not be used with a schema condition'),n(void 0===a.switch,'"switch" can not be used with a schema condition'),o.condition(e,{is:r,then:a.then,otherwise:a.otherwise,break:a.break});if(n(s.isRef(r)||"string"==typeof r,"Invalid condition:",r),n(void 0===a.not||void 0===a.is,'Cannot combine "is" with "not"'),void 0===a.switch){let u=a;void 0!==a.not&&(u={is:a.not,then:a.otherwise,otherwise:a.then,break:a.break});let l=void 0!==u.is?e.$_compile(u.is):e.$_root.invalid(null,!1,0,"").required();return n(void 0!==u.then||void 0!==u.otherwise,'options must have at least one of "then", "otherwise", or "switch"'),n(void 0===u.break||void 0===u.then||void 0===u.otherwise,"Cannot specify then, otherwise, and break all together"),void 0===a.is||s.isRef(a.is)||i.isSchema(a.is)||(l=l.required()),o.condition(e,{ref:t.ref(r),is:l,then:u.then,otherwise:u.otherwise,break:u.break})}n(Array.isArray(a.switch),'"switch" must be an array'),n(void 0===a.is,'Cannot combine "switch" with "is"'),n(void 0===a.not,'Cannot combine "switch" with "not"'),n(void 0===a.then,'Cannot combine "switch" with "then"');const u={ref:t.ref(r),switch:[],break:a.break};for(let t=0;t<a.switch.length;++t){const r=a.switch[t],o=t===a.switch.length-1;i.assertOptions(r,o?["is","then","otherwise"]:["is","then"]),n(void 0!==r.is,'Switch statement missing "is"'),n(void 0!==r.then,'Switch statement missing "then"');const l={is:e.$_compile(r.is),then:e.$_compile(r.then)};if(s.isRef(r.is)||i.isSchema(r.is)||(l.is=l.is.required()),o){n(void 0===a.otherwise||void 0===r.otherwise,'Cannot specify "otherwise" inside and outside a "switch"');const t=void 0!==a.otherwise?a.otherwise:r.otherwise;void 0!==t&&(n(void 0===u.break,"Cannot specify both otherwise and break"),l.otherwise=e.$_compile(t))}u.switch.push(l)}return u},o.condition=function(e,t){for(const r of["then","otherwise"])void 0===t[r]?delete t[r]:t[r]=e.$_compile(t[r]);return t}},6354:(e,t,r)=>{"use strict";const n=r(5688),i=r(8160),s=r(3328);t.Report=class{constructor(e,r,n,i,s,o,a){if(this.code=e,this.flags=i,this.messages=s,this.path=o.path,this.prefs=a,this.state=o,this.value=r,this.message=null,this.template=null,this.local=n||{},this.local.label=t.label(this.flags,this.state,this.prefs,this.messages),void 0===this.value||this.local.hasOwnProperty("value")||(this.local.value=this.value),this.path.length){const e=this.path[this.path.length-1];"object"!=typeof e&&(this.local.key=e)}}_setTemplate(e){if(this.template=e,!this.flags.label&&0===this.path.length){const e=this._template(this.template,"root");e&&(this.local.label=e)}}toString(){if(this.message)return this.message;const e=this.code;if(!this.prefs.errors.render)return this.code;const t=this._template(this.template)||this._template(this.prefs.messages)||this._template(this.messages);return void 0===t?'Error code "'.concat(e,'" is not defined, your custom type is missing the correct messages definition'):(this.message=t.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(e,r){return t.template(this.value,e,r||this.code,this.state,this.prefs)}},t.path=function(e){let t="";for(const r of e)"object"!=typeof r&&("string"==typeof r?(t&&(t+="."),t+=r):t+="[".concat(r,"]"));return t},t.template=function(e,t,r,n,o){if(!t)return;if(s.isTemplate(t))return"root"!==r?t:null;let a=o.errors.language;if(i.isResolvable(a)&&(a=a.resolve(e,n,o)),a&&t[a]){if(void 0!==t[a][r])return t[a][r];if(void 0!==t[a]["*"])return t[a]["*"]}return t[r]?t[r]:t["*"]},t.label=function(e,r,n,i){if(e.label)return e.label;if(!n.errors.label)return"";let s=r.path;return"key"===n.errors.label&&r.path.length>1&&(s=r.path.slice(-1)),t.path(s)||t.template(null,n.messages,"root",r,n)||i&&t.template(null,i,"root",r,n)||"value"},t.process=function(e,r,n){if(!e)return null;const{override:i,message:s,details:o}=t.details(e);if(i)return i;if(n.errors.stack)return new t.ValidationError(s,o,r);const a=Error.stackTraceLimit;Error.stackTraceLimit=0;const u=new t.ValidationError(s,o,r);return Error.stackTraceLimit=a,u},t.details=function(e,t={}){let r=[];const n=[];for(const i of e){if(i instanceof Error){if(!1!==t.override)return{override:i};const e=i.toString();r.push(e),n.push({message:e,type:"override",context:{error:i}});continue}const e=i.toString();r.push(e),n.push({message:e,path:i.path.filter((e=>"object"!=typeof e)),type:i.code,context:i.local})}return r.length>1&&(r=[...new Set(r)]),{message:r.join(". "),details:n}},t.ValidationError=class extends Error{constructor(e,t,r){super(e),this._original=r,this.details=t}static isError(e){return e instanceof t.ValidationError}},t.ValidationError.prototype.isJoi=!0,t.ValidationError.prototype.name="ValidationError",t.ValidationError.prototype.annotate=n.error},8901:(e,t,r)=>{"use strict";const n=r(375),i=r(8571),s=r(8160),o=r(6914),a={};t.type=function(e,t){const r=Object.getPrototypeOf(e),u=i(r),l=e._assign(Object.create(u)),c=Object.assign({},t);delete c.base,u._definition=c;const f=r._definition||{};c.messages=o.merge(f.messages,c.messages),c.properties=Object.assign({},f.properties,c.properties),l.type=c.type,c.flags=Object.assign({},f.flags,c.flags);const p=Object.assign({},f.terms);if(c.terms)for(const e in c.terms){const t=c.terms[e];n(void 0===l.$_terms[e],"Invalid term override for",c.type,e),l.$_terms[e]=t.init,p[e]=t}c.terms=p,c.args||(c.args=f.args),c.prepare=a.prepare(c.prepare,f.prepare),c.coerce&&("function"==typeof c.coerce&&(c.coerce={method:c.coerce}),c.coerce.from&&!Array.isArray(c.coerce.from)&&(c.coerce={method:c.coerce.method,from:[].concat(c.coerce.from)})),c.coerce=a.coerce(c.coerce,f.coerce),c.validate=a.validate(c.validate,f.validate);const h=Object.assign({},f.rules);if(c.rules)for(const e in c.rules){const t=c.rules[e];n("object"==typeof t,"Invalid rule definition for",c.type,e);let r=t.method;if(void 0===r&&(r=function(){return this.$_addRule(e)}),r&&(n(!u[e],"Rule conflict in",c.type,e),u[e]=r),n(!h[e],"Rule conflict in",c.type,e),h[e]=t,t.alias){const e=[].concat(t.alias);for(const r of e)u[r]=t.method}t.args&&(t.argsByName=new Map,t.args=t.args.map((e=>("string"==typeof e&&(e={name:e}),n(!t.argsByName.has(e.name),"Duplicated argument name",e.name),s.isSchema(e.assert)&&(e.assert=e.assert.strict().label(e.name)),t.argsByName.set(e.name,e),e))))}c.rules=h;const d=Object.assign({},f.modifiers);if(c.modifiers)for(const e in c.modifiers){n(!u[e],"Rule conflict in",c.type,e);const t=c.modifiers[e];n("function"==typeof t,"Invalid modifier definition for",c.type,e);const r=function(t){return this.rule({[e]:t})};u[e]=r,d[e]=t}if(c.modifiers=d,c.overrides){u._super=r,l.$_super={};for(const e in c.overrides)n(r[e],"Cannot override missing",e),c.overrides[e][s.symbols.parent]=r[e],l.$_super[e]=r[e].bind(l);Object.assign(u,c.overrides)}c.cast=Object.assign({},f.cast,c.cast);const m=Object.assign({},f.manifest,c.manifest);return m.build=a.build(c.manifest&&c.manifest.build,f.manifest&&f.manifest.build),c.manifest=m,c.rebuild=a.rebuild(c.rebuild,f.rebuild),l},a.build=function(e,t){return e&&t?function(r,n){return t(e(r,n),n)}:e||t},a.coerce=function(e,t){return e&&t?{from:e.from&&t.from?[...new Set([...e.from,...t.from])]:null,method(r,n){let i;if((!t.from||t.from.includes(typeof r))&&(i=t.method(r,n),i)){if(i.errors||void 0===i.value)return i;r=i.value}if(!e.from||e.from.includes(typeof r)){const t=e.method(r,n);if(t)return t}return i}}:e||t},a.prepare=function(e,t){return e&&t?function(r,n){const i=e(r,n);if(i){if(i.errors||void 0===i.value)return i;r=i.value}return t(r,n)||i}:e||t},a.rebuild=function(e,t){return e&&t?function(r){t(r),e(r)}:e||t},a.validate=function(e,t){return e&&t?function(r,n){const i=t(r,n);if(i){if(i.errors&&(!Array.isArray(i.errors)||i.errors.length))return i;r=i.value}return e(r,n)||i}:e||t}},5107:(e,t,r)=>{"use strict";const n=r(375),i=r(8571),s=r(8652),o=r(8160),a=r(3292),u=r(6354),l=r(8901),c=r(9708),f=r(6133),p=r(3328),h=r(1152);let d;const m={types:{alternatives:r(4946),any:r(8068),array:r(546),boolean:r(4937),date:r(7500),function:r(390),link:r(8785),number:r(3832),object:r(8966),string:r(7417),symbol:r(8826)},aliases:{alt:"alternatives",bool:"boolean",func:"function"},root:function(){const e={_types:new Set(Object.keys(m.types))};for(const t of e._types)e[t]=function(...e){return n(!e.length||["alternatives","link","object"].includes(t),"The",t,"type does not allow arguments"),m.generate(this,m.types[t],e)};for(const t of["allow","custom","disallow","equal","exist","forbidden","invalid","not","only","optional","options","prefs","preferences","required","strip","valid","when"])e[t]=function(...e){return this.any()[t](...e)};Object.assign(e,m.methods);for(const t in m.aliases){const r=m.aliases[t];e[t]=e[r]}return e.x=e.expression,h.setup&&h.setup(e),e}};m.methods={ValidationError:u.ValidationError,version:o.version,cache:s.provider,assert(e,t,...r){m.assert(e,t,!0,r)},attempt:(e,t,...r)=>m.assert(e,t,!1,r),build(e){return n("function"==typeof c.build,"Manifest functionality disabled"),c.build(this,e)},checkPreferences(e){o.checkPreferences(e)},compile(e,t){return a.compile(this,e,t)},defaults(e){n("function"==typeof e,"modifier must be a function");const t=Object.assign({},this);for(const r of t._types){const i=e(t[r]());n(o.isSchema(i),"modifier must return a valid schema object"),t[r]=function(...e){return m.generate(this,i,e)}}return t},expression:(...e)=>new p(...e),extend(...e){o.verifyFlat(e,"extend"),d=d||r(3378),n(e.length,"You need to provide at least one extension"),this.assert(e,d.extensions);const t=Object.assign({},this);t._types=new Set(t._types);for(let r of e){"function"==typeof r&&(r=r(t)),this.assert(r,d.extension);const e=m.expandExtension(r,t);for(const r of e){n(void 0===t[r.type]||t._types.has(r.type),"Cannot override name",r.type);const e=r.base||this.any(),i=l.type(e,r);t._types.add(r.type),t[r.type]=function(...e){return m.generate(this,i,e)}}}return t},isError:u.ValidationError.isError,isExpression:p.isTemplate,isRef:f.isRef,isSchema:o.isSchema,in:(...e)=>f.in(...e),override:o.symbols.override,ref:(...e)=>f.create(...e),types(){const e={};for(const t of this._types)e[t]=this[t]();for(const t in m.aliases)e[t]=this[t]();return e}},m.assert=function(e,t,r,n){const s=n[0]instanceof Error||"string"==typeof n[0]?n[0]:null,a=s?n[1]:n[0],l=t.validate(e,o.preferences({errors:{stack:!0}},a||{}));let c=l.error;if(!c)return l.value;if(s instanceof Error)throw s;const f=r&&"function"==typeof c.annotate?c.annotate():c.message;throw c instanceof u.ValidationError==0&&(c=i(c)),c.message=s?"".concat(s," ").concat(f):f,c},m.generate=function(e,t,r){return n(e,"Must be invoked on a Joi instance."),t.$_root=e,t._definition.args&&r.length?t._definition.args(t,...r):t},m.expandExtension=function(e,t){if("string"==typeof e.type)return[e];const r=[];for(const n of t._types)if(e.type.test(n)){const i=Object.assign({},e);i.type=n,i.base=t[n](),r.push(i)}return r},e.exports=m.root()},6914:(e,t,r)=>{"use strict";const n=r(375),i=r(8571),s=r(3328);t.compile=function(e,t){if("string"==typeof e)return n(!t,"Cannot set single message string"),new s(e);if(s.isTemplate(e))return n(!t,"Cannot set single message template"),e;n("object"==typeof e&&!Array.isArray(e),"Invalid message options"),t=t?i(t):{};for(let r in e){const i=e[r];if("root"===r||s.isTemplate(i)){t[r]=i;continue}if("string"==typeof i){t[r]=new s(i);continue}n("object"==typeof i&&!Array.isArray(i),"Invalid message for",r);const o=r;for(r in t[o]=t[o]||{},i){const e=i[r];"root"===r||s.isTemplate(e)?t[o][r]=e:(n("string"==typeof e,"Invalid message for",r,"in",o),t[o][r]=new s(e))}}return t},t.decompile=function(e){const t={};for(let r in e){const n=e[r];if("root"===r){t.root=n;continue}if(s.isTemplate(n)){t[r]=n.describe({compact:!0});continue}const i=r;for(r in t[i]={},n){const e=n[r];"root"!==r?t[i][r]=e.describe({compact:!0}):t[i].root=e}}return t},t.merge=function(e,r){if(!e)return t.compile(r);if(!r)return e;if("string"==typeof r)return new s(r);if(s.isTemplate(r))return r;const o=i(e);for(let e in r){const t=r[e];if("root"===e||s.isTemplate(t)){o[e]=t;continue}if("string"==typeof t){o[e]=new s(t);continue}n("object"==typeof t&&!Array.isArray(t),"Invalid message for",e);const i=e;for(e in o[i]=o[i]||{},t){const r=t[e];"root"===e||s.isTemplate(r)?o[i][e]=r:(n("string"==typeof r,"Invalid message for",e,"in",i),o[i][e]=new s(r))}}return o}},2294:(e,t,r)=>{"use strict";function n(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?n(Object(r),!0).forEach((function(t){s(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):n(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function s(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const o=r(375),a=r(8160),u=r(6133),l={};t.Ids=l.Ids=class{constructor(){this._byId=new Map,this._byKey=new Map,this._schemaChain=!1}clone(){const e=new l.Ids;return e._byId=new Map(this._byId),e._byKey=new Map(this._byKey),e._schemaChain=this._schemaChain,e}concat(e){e._schemaChain&&(this._schemaChain=!0);for(const[t,r]of e._byId.entries())o(!this._byKey.has(t),"Schema id conflicts with existing key:",t),this._byId.set(t,r);for(const[t,r]of e._byKey.entries())o(!this._byId.has(t),"Schema key conflicts with existing id:",t),this._byKey.set(t,r)}fork(e,t,r){const n=this._collect(e);n.push({schema:r});const i=n.shift();let s={id:i.id,schema:t(i.schema)};o(a.isSchema(s.schema),"adjuster function failed to return a joi schema type");for(const e of n)s={id:e.id,schema:l.fork(e.schema,s.id,s.schema)};return s.schema}labels(e,t=[]){const r=e[0],n=this._get(r);if(!n)return[...t,...e].join(".");const i=e.slice(1);return t=[...t,n.schema._flags.label||r],i.length?n.schema._ids.labels(i,t):t.join(".")}reach(e,t=[]){const r=e[0],n=this._get(r);o(n,"Schema does not contain path",[...t,...e].join("."));const i=e.slice(1);return i.length?n.schema._ids.reach(i,[...t,r]):n.schema}register(e,{key:t}={}){if(!e||!a.isSchema(e))return;(e.$_property("schemaChain")||e._ids._schemaChain)&&(this._schemaChain=!0);const r=e._flags.id;if(r){const t=this._byId.get(r);o(!t||t.schema===e,"Cannot add different schemas with the same id:",r),o(!this._byKey.has(r),"Schema id conflicts with existing key:",r),this._byId.set(r,{schema:e,id:r})}t&&(o(!this._byKey.has(t),"Schema already contains key:",t),o(!this._byId.has(t),"Schema key conflicts with existing id:",t),this._byKey.set(t,{schema:e,id:t}))}reset(){this._byId=new Map,this._byKey=new Map,this._schemaChain=!1}_collect(e,t=[],r=[]){const n=e[0],i=this._get(n);o(i,"Schema does not contain path",[...t,...e].join(".")),r=[i,...r];const s=e.slice(1);return s.length?i.schema._ids._collect(s,[...t,n],r):r}_get(e){return this._byId.get(e)||this._byKey.get(e)}},l.fork=function(e,r,n){const i=t.schema(e,{each:(e,{key:t})=>{if(r===(e._flags.id||t))return n},ref:!1});return i?i.$_mutateRebuild():e},t.schema=function(e,t){let r;for(const n in e._flags){if("_"===n[0])continue;const i=l.scan(e._flags[n],{source:"flags",name:n},t);void 0!==i&&(r=r||e.clone(),r._flags[n]=i)}for(let n=0;n<e._rules.length;++n){const i=e._rules[n],s=l.scan(i.args,{source:"rules",name:i.name},t);if(void 0!==s){r=r||e.clone();const t=Object.assign({},i);t.args=s,r._rules[n]=t,r._singleRules.get(i.name)===i&&r._singleRules.set(i.name,t)}}for(const n in e.$_terms){if("_"===n[0])continue;const i=l.scan(e.$_terms[n],{source:"terms",name:n},t);void 0!==i&&(r=r||e.clone(),r.$_terms[n]=i)}return r},l.scan=function(e,t,r,n,s){const o=n||[];if(null===e||"object"!=typeof e)return;let c;if(Array.isArray(e)){for(let n=0;n<e.length;++n){const i="terms"===t.source&&"keys"===t.name&&e[n].key,s=l.scan(e[n],t,r,[n,...o],i);void 0!==s&&(c=c||e.slice(),c[n]=s)}return c}if(!1!==r.schema&&a.isSchema(e)||!1!==r.ref&&u.isRef(e)){const n=r.each(e,i(i({},t),{},{path:o,key:s}));if(n===e)return;return n}for(const n in e){if("_"===n[0])continue;const i=l.scan(e[n],t,r,[n,...o],s);void 0!==i&&(c=c||Object.assign({},e),c[n]=i)}return c}},6133:(e,t,r)=>{"use strict";function n(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?n(Object(r),!0).forEach((function(t){s(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):n(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function s(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const o=r(375),a=r(8571),u=r(9621),l=r(8160);let c;const f={symbol:Symbol("ref"),defaults:{adjust:null,in:!1,iterables:null,map:null,separator:".",type:"value"}};t.create=function(e,t={}){o("string"==typeof e,"Invalid reference key:",e),l.assertOptions(t,["adjust","ancestor","in","iterables","map","prefix","render","separator"]),o(!t.prefix||"object"==typeof t.prefix,"options.prefix must be of type object");const r=Object.assign({},f.defaults,t);delete r.prefix;const n=r.separator,i=f.context(e,n,t.prefix);if(r.type=i.type,e=i.key,"value"===r.type)if(i.root&&(o(!n||e[0]!==n,"Cannot specify relative path with root prefix"),r.ancestor="root",e||(e=null)),n&&n===e)e=null,r.ancestor=0;else if(void 0!==r.ancestor)o(!n||!e||e[0]!==n,"Cannot combine prefix with ancestor option");else{const[t,i]=f.ancestor(e,n);i&&""===(e=e.slice(i))&&(e=null),r.ancestor=t}return r.path=n?null===e?[]:e.split(n):[e],new f.Ref(r)},t.in=function(e,r={}){return t.create(e,i(i({},r),{},{in:!0}))},t.isRef=function(e){return!!e&&!!e[l.symbols.ref]},f.Ref=class{constructor(e){o("object"==typeof e,"Invalid reference construction"),l.assertOptions(e,["adjust","ancestor","in","iterables","map","path","render","separator","type","depth","key","root","display"]),o([!1,void 0].includes(e.separator)||"string"==typeof e.separator&&1===e.separator.length,"Invalid separator"),o(!e.adjust||"function"==typeof e.adjust,"options.adjust must be a function"),o(!e.map||Array.isArray(e.map),"options.map must be an array"),o(!e.map||!e.adjust,"Cannot set both map and adjust options"),Object.assign(this,f.defaults,e),o("value"===this.type||void 0===this.ancestor,"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(e,t,r,n,i={}){return o(!this.in||i.in,"Invalid in() reference usage"),"global"===this.type?this._resolve(r.context,t,i):"local"===this.type?this._resolve(n,t,i):this.ancestor?"root"===this.ancestor?this._resolve(t.ancestors[t.ancestors.length-1],t,i):(o(this.ancestor<=t.ancestors.length,"Invalid reference exceeds the schema root:",this.display),this._resolve(t.ancestors[this.ancestor-1],t,i)):this._resolve(e,t,i)}_resolve(e,t,r){let n;if("value"===this.type&&t.mainstay.shadow&&!1!==r.shadow&&(n=t.mainstay.shadow.get(this.absolute(t))),void 0===n&&(n=u(e,this.path,{iterables:this.iterables,functions:!0})),this.adjust&&(n=this.adjust(n)),this.map){const e=this.map.get(n);void 0!==e&&(n=e)}return t.mainstay&&t.mainstay.tracer.resolve(t,this,n),n}toString(){return this.display}absolute(e){return[...e.path.slice(0,-this.ancestor),...this.path]}clone(){return new f.Ref(this)}describe(){const e={path:this.path};"value"!==this.type&&(e.type=this.type),"."!==this.separator&&(e.separator=this.separator),"value"===this.type&&1!==this.ancestor&&(e.ancestor=this.ancestor),this.map&&(e.map=[...this.map]);for(const t of["adjust","iterables","render"])null!==this[t]&&void 0!==this[t]&&(e[t]=this[t]);return!1!==this.in&&(e.in=!0),{ref:e}}updateDisplay(){const e=null!==this.key?this.key:"";if("value"!==this.type)return void(this.display="ref:".concat(this.type,":").concat(e));if(!this.separator)return void(this.display="ref:".concat(e));if(!this.ancestor)return void(this.display="ref:".concat(this.separator).concat(e));if("root"===this.ancestor)return void(this.display="ref:root:".concat(e));if(1===this.ancestor)return void(this.display="ref:".concat(e||".."));const t=new Array(this.ancestor+1).fill(this.separator).join("");this.display="ref:".concat(t).concat(e||"")}},f.Ref.prototype[l.symbols.ref]=!0,t.build=function(e){return"value"===(e=Object.assign({},f.defaults,e)).type&&void 0===e.ancestor&&(e.ancestor=1),new f.Ref(e)},f.context=function(e,t,r={}){if(e=e.trim(),r){const n=void 0===r.global?"$":r.global;if(n!==t&&e.startsWith(n))return{key:e.slice(n.length),type:"global"};const i=void 0===r.local?"#":r.local;if(i!==t&&e.startsWith(i))return{key:e.slice(i.length),type:"local"};const s=void 0===r.root?"/":r.root;if(s!==t&&e.startsWith(s))return{key:e.slice(s.length),type:"value",root:!0}}return{key:e,type:"value"}},f.ancestor=function(e,t){if(!t)return[1,0];if(e[0]!==t)return[1,0];if(e[1]!==t)return[0,1];let r=2;for(;e[r]===t;)++r;return[r-1,r]},t.toSibling=0,t.toParent=1,t.Manager=class{constructor(){this.refs=[]}register(e,n){if(e)if(n=void 0===n?t.toParent:n,Array.isArray(e))for(const t of e)this.register(t,n);else if(l.isSchema(e))for(const t of e._refs.refs)t.ancestor-n>=0&&this.refs.push({ancestor:t.ancestor-n,root:t.root});else t.isRef(e)&&"value"===e.type&&e.ancestor-n>=0&&this.refs.push({ancestor:e.ancestor-n,root:e.root}),c=c||r(3328),c.isTemplate(e)&&this.register(e.refs(),n)}get length(){return this.refs.length}clone(){const e=new t.Manager;return e.refs=a(this.refs),e}reset(){this.refs=[]}roots(){return this.refs.filter((e=>!e.ancestor)).map((e=>e.root))}}},3378:(e,t,r)=>{"use strict";const n=r(5107),i={};i.wrap=n.string().min(1).max(2).allow(!1),t.preferences=n.object({allowUnknown:n.boolean(),abortEarly:n.boolean(),artifacts:n.boolean(),cache:n.boolean(),context:n.object(),convert:n.boolean(),dateFormat:n.valid("date","iso","string","time","utc"),debug:n.boolean(),errors:{escapeHtml:n.boolean(),label:n.valid("path","key",!1),language:[n.string(),n.object().ref()],render:n.boolean(),stack:n.boolean(),wrap:{label:i.wrap,array:i.wrap,string:i.wrap}},externals:n.boolean(),messages:n.object(),noDefaults:n.boolean(),nonEnumerables:n.boolean(),presence:n.valid("required","optional","forbidden"),skipFunctions:n.boolean(),stripUnknown:n.object({arrays:n.boolean(),objects:n.boolean()}).or("arrays","objects").allow(!0,!1),warnings:n.boolean()}).strict(),i.nameRx=/^[a-zA-Z0-9]\w*$/,i.rule=n.object({alias:n.array().items(n.string().pattern(i.nameRx)).single(),args:n.array().items(n.string(),n.object({name:n.string().pattern(i.nameRx).required(),ref:n.boolean(),assert:n.alternatives([n.function(),n.object().schema()]).conditional("ref",{is:!0,then:n.required()}),normalize:n.function(),message:n.string().when("assert",{is:n.function(),then:n.required()})})),convert:n.boolean(),manifest:n.boolean(),method:n.function().allow(!1),multi:n.boolean(),validate:n.function()}),t.extension=n.object({type:n.alternatives([n.string(),n.object().regex()]).required(),args:n.function(),cast:n.object().pattern(i.nameRx,n.object({from:n.function().maxArity(1).required(),to:n.function().minArity(1).maxArity(2).required()})),base:n.object().schema().when("type",{is:n.object().regex(),then:n.forbidden()}),coerce:[n.function().maxArity(3),n.object({method:n.function().maxArity(3).required(),from:n.array().items(n.string()).single()})],flags:n.object().pattern(i.nameRx,n.object({setter:n.string(),default:n.any()})),manifest:{build:n.function().arity(2)},messages:[n.object(),n.string()],modifiers:n.object().pattern(i.nameRx,n.function().minArity(1).maxArity(2)),overrides:n.object().pattern(i.nameRx,n.function()),prepare:n.function().maxArity(3),rebuild:n.function().arity(1),rules:n.object().pattern(i.nameRx,i.rule),terms:n.object().pattern(i.nameRx,n.object({init:n.array().allow(null).required(),manifest:n.object().pattern(/.+/,[n.valid("schema","single"),n.object({mapped:n.object({from:n.string().required(),to:n.string().required()}).required()})])})),validate:n.function().maxArity(3)}).strict(),t.extensions=n.array().items(n.object(),n.function().arity(1)).strict(),i.desc={buffer:n.object({buffer:n.string()}),func:n.object({function:n.function().required(),options:{literal:!0}}),override:n.object({override:!0}),ref:n.object({ref:n.object({type:n.valid("value","global","local"),path:n.array().required(),separator:n.string().length(1).allow(!1),ancestor:n.number().min(0).integer().allow("root"),map:n.array().items(n.array().length(2)).min(1),adjust:n.function(),iterables:n.boolean(),in:n.boolean(),render:n.boolean()}).required()}),regex:n.object({regex:n.string().min(3)}),special:n.object({special:n.valid("deep").required()}),template:n.object({template:n.string().required(),options:n.object()}),value:n.object({value:n.alternatives([n.object(),n.array()]).required()})},i.desc.entity=n.alternatives([n.array().items(n.link("...")),n.boolean(),n.function(),n.number(),n.string(),i.desc.buffer,i.desc.func,i.desc.ref,i.desc.regex,i.desc.special,i.desc.template,i.desc.value,n.link("/")]),i.desc.values=n.array().items(null,n.boolean(),n.function(),n.number().allow(1/0,-1/0),n.string().allow(""),n.symbol(),i.desc.buffer,i.desc.func,i.desc.override,i.desc.ref,i.desc.regex,i.desc.template,i.desc.value),i.desc.messages=n.object().pattern(/.+/,[n.string(),i.desc.template,n.object().pattern(/.+/,[n.string(),i.desc.template])]),t.description=n.object({type:n.string().required(),flags:n.object({cast:n.string(),default:n.any(),description:n.string(),empty:n.link("/"),failover:i.desc.entity,id:n.string(),label:n.string(),only:!0,presence:["optional","required","forbidden"],result:["raw","strip"],strip:n.boolean(),unit:n.string()}).unknown(),preferences:{allowUnknown:n.boolean(),abortEarly:n.boolean(),artifacts:n.boolean(),cache:n.boolean(),convert:n.boolean(),dateFormat:["date","iso","string","time","utc"],errors:{escapeHtml:n.boolean(),label:["path","key"],language:[n.string(),i.desc.ref],wrap:{label:i.wrap,array:i.wrap}},externals:n.boolean(),messages:i.desc.messages,noDefaults:n.boolean(),nonEnumerables:n.boolean(),presence:["required","optional","forbidden"],skipFunctions:n.boolean(),stripUnknown:n.object({arrays:n.boolean(),objects:n.boolean()}).or("arrays","objects").allow(!0,!1),warnings:n.boolean()},allow:i.desc.values,invalid:i.desc.values,rules:n.array().min(1).items({name:n.string().required(),args:n.object().min(1),keep:n.boolean(),message:[n.string(),i.desc.messages],warn:n.boolean()}),keys:n.object().pattern(/.*/,n.link("/")),link:i.desc.ref}).pattern(/^[a-z]\w*$/,n.any())},493:(e,t,r)=>{"use strict";const n=r(8571),i=r(9621),s=r(8160),o={value:Symbol("value")};e.exports=o.State=class{constructor(e,t,r){this.path=e,this.ancestors=t,this.mainstay=r.mainstay,this.schemas=r.schemas,this.debug=null}localize(e,t=null,r=null){const n=new o.State(e,t,this);return r&&n.schemas&&(n.schemas=[o.schemas(r),...n.schemas]),n}nest(e,t){const r=new o.State(this.path,this.ancestors,this);return r.schemas=r.schemas&&[o.schemas(e),...r.schemas],r.debug=t,r}shadow(e,t){this.mainstay.shadow=this.mainstay.shadow||new o.Shadow,this.mainstay.shadow.set(this.path,e,t)}snapshot(){this.mainstay.shadow&&(this._snapshot=n(this.mainstay.shadow.node(this.path)))}restore(){this.mainstay.shadow&&(this.mainstay.shadow.override(this.path,this._snapshot),this._snapshot=void 0)}},o.schemas=function(e){return s.isSchema(e)?{schema:e}:e},o.Shadow=class{constructor(){this._values=null}set(e,t,r){if(!e.length)return;if("strip"===r&&"number"==typeof e[e.length-1])return;this._values=this._values||new Map;let n=this._values;for(let t=0;t<e.length;++t){const r=e[t];let i=n.get(r);i||(i=new Map,n.set(r,i)),n=i}n[o.value]=t}get(e){const t=this.node(e);if(t)return t[o.value]}node(e){if(this._values)return i(this._values,e,{iterables:!0})}override(e,t){if(!this._values)return;const r=e.slice(0,-1),n=e[e.length-1],s=i(this._values,r,{iterables:!0});t?s.set(n,t):s&&s.delete(n)}}},3328:(e,t,r)=>{"use strict";function n(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOw