UNPKG

@directus-labs/tree-view-table-layout

Version:

A tree view layout that allows you to nest items within a table

1 lines 492 kB
import*as e from"vue";import{defineComponent as t,openBlock as n,createBlock as i,Transition as r,withCtx as o,createElementBlock as a,toDisplayString as s,createCommentVNode as l,computed as c,resolveComponent as u,Fragment as d,createVNode as f,createTextVNode as p,createElementVNode as h,unref as m,isRef as _,onMounted as v,onUnmounted as g,ref as y,mergeModels as b,useModel as w,provide as x,renderList as E,renderSlot as $,onBeforeUnmount as A,useSlots as S,resolveDirective as T,normalizeClass as R,mergeProps as k,withDirectives as I,normalizeStyle as L,normalizeProps as O,guardReactiveProps as j,withModifiers as C,useCssVars as N,inject as D,nextTick as M,readonly as P,getCurrentInstance as F,watch as U,getCurrentScope as B,onScopeDispose as q,shallowRef as z,toValue as K,toRef as G,createSlots as V,toRefs as W}from"vue";import{useSync as H,defineLayout as Y,useStores as X,useExtensions as Z,useCollection as Q,useItems as J,useApi as ee}from"@directus/extensions-sdk";import{useI18n as te}from"vue-i18n";import{useRouter as ne}from"vue-router";var ie=(0).constructor;ie.isFinite,ie.isInteger,[].constructor.isArray;new(function(){function e(e){this.size=e,this.reset()}return e.prototype.reset=function(){this.oldestIndex=0,this.map={},this.cachedKeys=new Array(this.size)},e.prototype.get=function(e){return this.map[e]},e.prototype.set=function(e,t){this.map[e]=t;var n=this.cachedKeys[this.oldestIndex];void 0!==n&&delete this.map[n],this.cachedKeys[this.oldestIndex]=e,this.oldestIndex++,this.oldestIndex%=this.size},e}())(1e3);var re="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function oe(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function ae(e){if(e.__esModule)return e;var t=e.default;if("function"==typeof t){var n=function e(){return this instanceof e?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach((function(t){var i=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,i.get?i:{enumerable:!0,get:function(){return e[t]}})})),n}var se,le={exports:{}};se=le,function(e,t){se.exports=t()}(self,(()=>{return e={7629:(e,t,n)=>{const i=n(375),r=n(8571),o=n(9474),a=n(1687),s=n(8652),l=n(8160),c=n(3292),u=n(6354),d=n(8901),f=n(9708),p=n(6914),h=n(2294),m=n(6133),_=n(1152),v=n(8863),g=n(2036),y={Base:class{constructor(e){this.type=e,this.$_root=null,this._definition={},this._reset()}_reset(){this._ids=new h.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 i("function"==typeof f.describe,"Manifest functionality disabled"),f.describe(this)}allow(...e){return l.verifyFlat(e,"allow"),this._values(e,"_valids")}alter(e){i(e&&"object"==typeof e&&!Array.isArray(e),"Invalid targets argument"),i(!this._inRuleset(),"Cannot set alterations inside a ruleset");const t=this.clone();t.$_terms.alterations=t.$_terms.alterations||[];for(const n in e){const r=e[n];i("function"==typeof r,"Alteration adjuster for",n,"must be a function"),t.$_terms.alterations.push({target:n,adjuster:r})}return t.$_temp.ruleset=!1,t}artifact(e){return i(void 0!==e,"Artifact cannot be undefined"),i(!this._cache,"Cannot set an artifact with a rule cache"),this.$_setFlag("artifact",e)}cast(e){return i(!1===e||"string"==typeof e,"Invalid to value"),i(!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 i(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 i(e,"Missing error"),i(e instanceof Error||"function"==typeof e,"Must provide a valid Error object or a function"),this.$_setFlag("error",e)}example(e,t={}){return i(void 0!==e,"Missing example"),l.assertOptions(t,["override"]),this._inner("examples",e,{single:!0,override:t.override})}external(e,t){return"object"==typeof e&&(i(!t,"Cannot combine options with description"),t=e.description,e=e.method),i("function"==typeof e,"Method must be a function"),i(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?(i("string"==typeof e,"id must be a non-empty string"),i(/^[^\.]+$/.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 i(e&&"string"==typeof e,"Label name must be a non-empty string"),this.$_setFlag("label",e)}meta(e){return i(void 0!==e,"Meta cannot be undefined"),this._inner("metas",e,{single:!0})}note(...e){i(e.length,"Missing notes");for(const t of e)i(t&&"string"==typeof t,"Notes must be non-empty strings");return this._inner("notes",e)}only(e=!0){return i("boolean"==typeof e,"Invalid mode:",e),this.$_setFlag("only",e)}optional(){return this.presence("optional")}prefs(e){i(e,"Missing preferences"),i(void 0===e.context,"Cannot override context"),i(void 0===e.externals,"Cannot override externals"),i(void 0===e.warnings,"Cannot override warnings"),i(void 0===e.debug,"Cannot override debug"),l.checkPreferences(e);const t=this.clone();return t._preferences=l.preferences(t._preferences,e),t}presence(e){return i(["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 i(["raw","strip"].includes(e),"Unknown result mode",e),this.$_setFlag("result",e)}required(){return this.presence("required")}strict(e){const t=this.clone(),n=void 0!==e&&!e;return t._preferences=l.preferences(t._preferences,{convert:n}),t}strip(e=!0){return this.$_setFlag("result",e?"strip":void 0)}tag(...e){i(e.length,"Missing tags");for(const t of e)i(t&&"string"==typeof t,"Tags must be non-empty strings");return this._inner("tags",e)}unit(e){return i(e&&"string"==typeof e,"Unit name must be a non-empty string"),this.$_setFlag("unit",e)}valid(...e){l.verifyFlat(e,"valid");const t=this.allow(...e);return t.$_setFlag("only",!!t._valids,{clone:!1}),t}when(e,t){const n=this.clone();n.$_terms.whens||(n.$_terms.whens=[]);const r=c.when(n,e,t);if(!["any","link"].includes(n.type)){const e=r.is?[r]:r.switch;for(const t of e)i(!t.then||"any"===t.then.type||t.then.type===n.type,"Cannot combine",n.type,"with",t.then&&t.then.type),i(!t.otherwise||"any"===t.otherwise.type||t.otherwise.type===n.type,"Cannot combine",n.type,"with",t.otherwise&&t.otherwise.type)}return n.$_terms.whens.push(r),n.$_mutateRebuild()}cache(e){i(!this._inRuleset(),"Cannot set caching inside a ruleset"),i(!this._cache,"Cannot override schema cache"),i(void 0===this._flags.artifact,"Cannot cache a rule with an artifact");const t=this.clone();return t._cache=e||s.provider.provision(),t.$_temp.ruleset=!1,t}clone(){const e=Object.create(Object.getPrototypeOf(this));return this._assign(e)}concat(e){i(l.isSchema(e),"Invalid schema object"),i("any"===this.type||"any"===e.type||e.type===this.type,"Cannot merge type",this.type,"with another type:",e.type),i(!this._inRuleset(),"Cannot concatenate onto a schema with open ruleset"),i(!e._inRuleset(),"Cannot concatenate a schema with open ruleset");let t=this.clone();if("any"===this.type&&"any"!==e.type){const n=e.clone();for(const e of Object.keys(t))"type"!==e&&(n[e]=t[e]);t=n}t._ids.concat(e._ids),t._refs.register(e,m.toSibling),t._preferences=t._preferences?l.preferences(t._preferences,e._preferences):e._preferences,t._valids=g.merge(t._valids,e._valids,e._invalids),t._invalids=g.merge(t._invalids,e._invalids,e._valids);for(const n of e._singleRules.keys())t._singleRules.has(n)&&(t._rules=t._rules.filter((e=>e.keep||e.name!==n)),t._singleRules.delete(n));for(const n of e._rules)e._definition.rules[n.method].multi||t._singleRules.set(n.name,n),t._rules.push(n);if(t._flags.empty&&e._flags.empty){t._flags.empty=t._flags.empty.concat(e._flags.empty);const n=Object.assign({},e._flags);delete n.empty,a(t._flags,n)}else if(e._flags.empty){t._flags.empty=e._flags.empty;const n=Object.assign({},e._flags);delete n.empty,a(t._flags,n)}else a(t._flags,e._flags);for(const n in e.$_terms){const i=e.$_terms[n];i?t.$_terms[n]?t.$_terms[n]=t.$_terms[n].concat(i):t.$_terms[n]=i.slice():t.$_terms[n]||(t.$_terms[n]=i)}return this.$_root._tracer&&this.$_root._tracer._combine(t,[this,e]),t.$_mutateRebuild()}extend(e){return i(!e.base,"Cannot extend type with another base"),d.type(this,e)}extract(e){return e=Array.isArray(e)?e:e.split("."),this._ids.reach(e)}fork(e,t){i(!this._inRuleset(),"Cannot fork inside a ruleset");let n=this;for(let i of[].concat(e))i=Array.isArray(i)?i:i.split("."),n=n._ids.fork(i,t,n);return n.$_temp.ruleset=!1,n}rule(e){const t=this._definition;l.assertOptions(e,Object.keys(t.modifiers)),i(!1!==this.$_temp.ruleset,"Cannot apply rules to empty ruleset or the last rule added does not support rule properties");const n=null===this.$_temp.ruleset?this._rules.length-1:this.$_temp.ruleset;i(n>=0&&n<this._rules.length,"Cannot apply rules to empty ruleset");const o=this.clone();for(let a=n;a<o._rules.length;++a){const n=o._rules[a],s=r(n);for(const r in e)t.modifiers[r](s,e[r]),i(s.name===n.name,"Cannot change rule name");o._rules[a]=s,o._singleRules.get(s.name)===n&&o._singleRules.set(s.name,s)}return o.$_temp.ruleset=!1,o.$_mutateRebuild()}get ruleset(){i(!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),i(!this._inRuleset(),"Cannot tailor inside a ruleset");let t=this;if(this.$_terms.alterations)for(const{target:n,adjuster:r}of this.$_terms.alterations)e.includes(n)&&(t=r(t),i(l.isSchema(t),"Alteration adjuster for",n,"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 _.location?_.location(this):this}validate(e,t){return v.entry(e,this,t)}validateAsync(e,t){return v.entryAsync(e,this,t)}$_addRule(e){"string"==typeof e&&(e={name:e}),i(e&&"object"==typeof e,"Invalid options"),i(e.name&&"string"==typeof e.name,"Invalid rule name");for(const t in e)i("_"!==t[0],"Cannot set private rule properties");const t=Object.assign({},e);t._resolve=[],t.method=t.method||t.name;const n=this._definition.rules[t.method],r=t.args;i(n,"Unknown rule",t.method);const o=this.clone();if(r){i(1===Object.keys(r).length||Object.keys(r).length===this._definition.rules[t.name].args.length,"Invalid rule definition for",this.type,t.name);for(const e in r){let a=r[e];if(n.argsByName){const s=n.argsByName.get(e);if(s.ref&&l.isResolvable(a))t._resolve.push(e),o.$_mutateRegister(a);else if(s.normalize&&(a=s.normalize(a),r[e]=a),s.assert){const t=l.validateArg(a,e,s);i(!t,t,"or reference")}}void 0!==a?r[e]=a:delete r[e]}}return n.multi||(o._ruleRemove(t.name,{clone:!1}),o._singleRules.set(t.name,t)),!1===o.$_temp.ruleset&&(o.$_temp.ruleset=null),n.priority?o._rules.unshift(t):o._rules.push(t),o}$_compile(e,t){return c.schema(this.$_root,e,t)}$_createError(e,t,n,i,r,o={}){const a=!1!==o.flags?this._flags:{},s=o.messages?p.merge(this._definition.messages,o.messages):this._definition.messages;return new u.Report(e,t,n,a,s,i,r)}$_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,n,i){(n=Object.assign({},n)).abortEarly=!0,n._externals=!1,t.snapshot();const r=!v.validate(e,this,t,n,i).errors;return t.restore(),r}$_modify(e){return l.assertOptions(e,["each","once","ref","schema"]),h.schema(this,e)||this}$_mutateRebuild(){return i(!this._inRuleset(),"Cannot add this rule inside a ruleset"),this._refs.reset(),this._ids.reset(),this.$_modify({each:(e,{source:t,name:n,path:i,key:r})=>{const o=this._definition[t][n]&&this._definition[t][n].register;!1!==o&&this.$_mutateRegister(e,{family:o,key:r})}}),this._definition.rebuild&&this._definition.rebuild(this),this.$_temp.ruleset=!1,this}$_mutateRegister(e,{family:t,key:n}={}){this._refs.register(e,t),this._ids.register(e,{key:n})}$_property(e){return this._definition.properties[e]}$_reach(e){return this._ids.reach(e)}$_rootReferences(){return this._refs.roots()}$_setFlag(e,t,n={}){i("_"===e[0]||!this._inRuleset(),"Cannot set flag inside a ruleset");const r=this._definition.flags[e]||{};if(o(t,r.default)&&(t=void 0),o(t,this._flags[e]))return this;const a=!1!==n.clone?this.clone():this;return void 0!==t?(a._flags[e]=t,a.$_mutateRegister(t)):delete a._flags[e],"_"!==e[0]&&(a.$_temp.ruleset=!1),a}$_parent(e,...t){return this[e][l.symbols.parent].call(this,...t)}$_validate(e,t,n){return v.validate(e,this,t,n)}_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=r(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 n in t){const i=t[n];e.$_terms[n]=i.init}return e.$_mutateRebuild()}_default(e,t,n={}){return l.assertOptions(n,"literal"),i(void 0!==t,"Missing",e,"value"),i("function"==typeof t||!n.literal,"Only function value supports literal option"),"function"==typeof t&&n.literal&&(t={[l.symbols.literal]:!0,literal:t}),this.$_setFlag(e,t)}_generate(e,t,n){if(!this.$_terms.whens)return{schema:this};const i=[],r=[];for(let o=0;o<this.$_terms.whens.length;++o){const a=this.$_terms.whens[o];if(a.concat){i.push(a.concat),r.push(`${o}.concat`);continue}const s=a.ref?a.ref.resolve(e,t,n):e,l=a.is?[a]:a.switch,c=r.length;for(let c=0;c<l.length;++c){const{is:u,then:d,otherwise:f}=l[c],p=`${o}${a.switch?"."+c:""}`;if(u.$_match(s,t.nest(u,`${p}.is`),n)){if(d){const o=t.localize([...t.path,`${p}.then`],t.ancestors,t.schemas),{schema:a,id:s}=d._generate(e,o,n);i.push(a),r.push(`${p}.then${s?`(${s})`:""}`);break}}else if(f){const o=t.localize([...t.path,`${p}.otherwise`],t.ancestors,t.schemas),{schema:a,id:s}=f._generate(e,o,n);i.push(a),r.push(`${p}.otherwise${s?`(${s})`:""}`);break}}if(a.break&&r.length>c)break}const o=r.join(", ");if(t.mainstay.tracer.debug(t,"rule","when",o),!o)return{schema:this};if(!t.mainstay.tracer.active&&this.$_temp.whens[o])return{schema:this.$_temp.whens[o],id:o};let a=this;this._definition.generate&&(a=this._definition.generate(this,e,t,n));for(const e of i)a=a.concat(e);return this.$_root._tracer&&this.$_root._tracer._combine(a,[this,...i]),this.$_temp.whens[o]=a,{schema:a,id:o}}_inner(e,t,n={}){i(!this._inRuleset(),`Cannot set ${e} inside a ruleset`);const r=this.clone();return r.$_terms[e]&&!n.override||(r.$_terms[e]=[]),n.single?r.$_terms[e].push(t):r.$_terms[e].push(...t),r.$_temp.ruleset=!1,r}_inRuleset(){return null!==this.$_temp.ruleset&&!1!==this.$_temp.ruleset}_ruleRemove(e,t={}){if(!this._singleRules.has(e))return this;const n=!1!==t.clone?this.clone():this;n._singleRules.delete(e);const i=[];for(let t=0;t<n._rules.length;++t){const r=n._rules[t];r.name!==e||r.keep?i.push(r):n._inRuleset()&&t<n.$_temp.ruleset&&--n.$_temp.ruleset}return n._rules=i,n}_values(e,t){l.verifyFlat(e,t.slice(1,-1));const n=this.clone(),r=e[0]===l.symbols.override;if(r&&(e=e.slice(1)),!n[t]&&e.length?n[t]=new g:r&&(n[t]=e.length?new g:null,n.$_mutateRebuild()),!n[t])return n;r&&n[t].override();for(const r of e){i(void 0!==r,"Cannot call allow/valid/invalid with undefined"),i(r!==l.symbols.override,"Override must be the first value");const e="_invalids"===t?"_valids":"_invalids";n[e]&&(n[e].remove(r),n[e].length||(i("_valids"===t||!n._flags.only,"Setting invalid value",r,"leaves schema rejecting all values due to previous valid rule"),n[e]=null)),n[t].add(r,n._refs)}return n}}};y.Base.prototype[l.symbols.any]={version:l.version,compile:c.compile,root:"$_root"},y.Base.prototype.isImmutable=!0,y.Base.prototype.deny=y.Base.prototype.invalid,y.Base.prototype.disallow=y.Base.prototype.invalid,y.Base.prototype.equal=y.Base.prototype.valid,y.Base.prototype.exist=y.Base.prototype.required,y.Base.prototype.not=y.Base.prototype.invalid,y.Base.prototype.options=y.Base.prototype.prefs,y.Base.prototype.preferences=y.Base.prototype.prefs,e.exports=new y.Base},8652:(e,t,n)=>{const i=n(375),r=n(8571),o=n(8160),a={max:1e3,supported:new Set(["undefined","boolean","number","string"])};t.provider={provision:e=>new a.Cache(e)},a.Cache=class{constructor(e={}){o.assertOptions(e,["max"]),i(void 0===e.max||e.max&&e.max>0&&isFinite(e.max),"Invalid max cache size"),this._max=e.max||a.max,this._map=new Map,this._list=new a.List}get length(){return this._map.size}set(e,t){if(null!==e&&!a.supported.has(typeof e))return;let n=this._map.get(e);if(n)return n.value=t,void this._list.first(n);n=this._list.unshift({key:e,value:t}),this._map.set(e,n),this._compact()}get(e){const t=this._map.get(e);if(t)return this._list.first(t),r(t.value)}_compact(){if(this._map.size>this._max){const e=this._list.pop();this._map.delete(e.key)}}},a.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:n}=e;return t.prev=n,n&&(n.next=t),e===this.tail&&(this.tail=t),e.prev=null,e.next=null,e}}},8160:(e,t,n)=>{const i=n(375),r=n(7916),o=n(5934);let a,s;const l={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=o.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,n="Options"){i(e&&"object"==typeof e&&!Array.isArray(e),"Options must be of type object");const r=Object.keys(e).filter((e=>!t.includes(e)));i(0===r.length,`${n} contain unknown keys: ${r}`)},t.checkPreferences=function(e){s=s||n(3378);const t=s.preferences.validate(e);if(t.error)throw new r([t.error.details[0].message])},t.compare=function(e,t,n){switch(n){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 l.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,n={}){const r=e&&e[t.symbols.any];return!!r&&(i(n.legacy||r.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,i){a=a||n(6914),e=e||{},i=i||{};const r=Object.assign({},e,i);return i.errors&&e.errors&&(r.errors=Object.assign({},e.errors,i.errors),r.errors.wrap=Object.assign({},e.errors.wrap,i.errors.wrap)),i.messages&&(r.messages=a.compile(i.messages,e.messages)),delete r[t.symbols.prefs],r},t.tryWithPath=function(e,t,n={}){try{return e()}catch(e){throw void 0!==e.path?e.path=t+"."+e.path:e.path=t,n.append&&(e.message=`${e.message} (${e.path})`),e}},t.validateArg=function(e,n,{assert:i,message:r}){if(t.isSchema(i)){const t=i.validate(e);if(!t.error)return;return t.error.message}if(!i(e))return n?`${n} ${r}`:r},t.verifyFlat=function(e,t){for(const n of e)i(!Array.isArray(n),"Method no longer accepts array arguments:",t)}},3292:(e,t,n)=>{const i=n(375),r=n(8160),o=n(6133),a={};t.schema=function(e,t,n={}){r.assertOptions(n,["appendPath","override"]);try{return a.schema(e,t,n)}catch(e){throw n.appendPath&&void 0!==e.path&&(e.message=`${e.message} (${e.path})`),e}},a.schema=function(e,t,n){i(void 0!==t,"Invalid undefined schema"),Array.isArray(t)&&(i(t.length,"Invalid empty array schema"),1===t.length&&(t=t[0]));const o=(t,...i)=>!1!==n.override?t.valid(e.override,...i):t.valid(...i);if(a.simple(t))return o(e,t);if("function"==typeof t)return e.custom(t);if(i("object"==typeof t,"Invalid schema content:",typeof t),r.isResolvable(t))return o(e,t);if(r.isSchema(t))return t;if(Array.isArray(t)){for(const n of t)if(!a.simple(n))return e.alternatives().try(...t);return o(e,...t)}return t instanceof RegExp?e.string().regex(t):t instanceof Date?o(e.date(),t):(i(Object.getPrototypeOf(t)===Object.getPrototypeOf({}),"Schema can only contain plain objects"),e.object().keys(t))},t.ref=function(e,t){return o.isRef(e)?e:o.create(e,t)},t.compile=function(e,n,o={}){r.assertOptions(o,["legacy"]);const s=n&&n[r.symbols.any];if(s)return i(o.legacy||s.version===r.version,"Cannot mix different versions of joi schemas:",s.version,r.version),n;if("object"!=typeof n||!o.legacy)return t.schema(e,n,{appendPath:!0});const l=a.walk(n);return l?l.compile(l.root,n):t.schema(e,n,{appendPath:!0})},a.walk=function(e){if("object"!=typeof e)return null;if(Array.isArray(e)){for(const t of e){const e=a.walk(t);if(e)return e}return null}const t=e[r.symbols.any];if(t)return{root:e[t.root],compile:t.compile};i(Object.getPrototypeOf(e)===Object.getPrototypeOf({}),"Schema can only contain plain objects");for(const t in e){const n=a.walk(e[t]);if(n)return n}return null},a.simple=function(e){return null===e||["boolean","string","number"].includes(typeof e)},t.when=function(e,n,s){if(void 0===s&&(i(n&&"object"==typeof n,"Missing options"),s=n,n=o.create(".")),Array.isArray(s)&&(s={switch:s}),r.assertOptions(s,["is","not","then","otherwise","switch","break"]),r.isSchema(n))return i(void 0===s.is,'"is" can not be used with a schema condition'),i(void 0===s.not,'"not" can not be used with a schema condition'),i(void 0===s.switch,'"switch" can not be used with a schema condition'),a.condition(e,{is:n,then:s.then,otherwise:s.otherwise,break:s.break});if(i(o.isRef(n)||"string"==typeof n,"Invalid condition:",n),i(void 0===s.not||void 0===s.is,'Cannot combine "is" with "not"'),void 0===s.switch){let l=s;void 0!==s.not&&(l={is:s.not,then:s.otherwise,otherwise:s.then,break:s.break});let c=void 0!==l.is?e.$_compile(l.is):e.$_root.invalid(null,!1,0,"").required();return i(void 0!==l.then||void 0!==l.otherwise,'options must have at least one of "then", "otherwise", or "switch"'),i(void 0===l.break||void 0===l.then||void 0===l.otherwise,"Cannot specify then, otherwise, and break all together"),void 0===s.is||o.isRef(s.is)||r.isSchema(s.is)||(c=c.required()),a.condition(e,{ref:t.ref(n),is:c,then:l.then,otherwise:l.otherwise,break:l.break})}i(Array.isArray(s.switch),'"switch" must be an array'),i(void 0===s.is,'Cannot combine "switch" with "is"'),i(void 0===s.not,'Cannot combine "switch" with "not"'),i(void 0===s.then,'Cannot combine "switch" with "then"');const l={ref:t.ref(n),switch:[],break:s.break};for(let t=0;t<s.switch.length;++t){const n=s.switch[t],a=t===s.switch.length-1;r.assertOptions(n,a?["is","then","otherwise"]:["is","then"]),i(void 0!==n.is,'Switch statement missing "is"'),i(void 0!==n.then,'Switch statement missing "then"');const c={is:e.$_compile(n.is),then:e.$_compile(n.then)};if(o.isRef(n.is)||r.isSchema(n.is)||(c.is=c.is.required()),a){i(void 0===s.otherwise||void 0===n.otherwise,'Cannot specify "otherwise" inside and outside a "switch"');const t=void 0!==s.otherwise?s.otherwise:n.otherwise;void 0!==t&&(i(void 0===l.break,"Cannot specify both otherwise and break"),c.otherwise=e.$_compile(t))}l.switch.push(c)}return l},a.condition=function(e,t){for(const n of["then","otherwise"])void 0===t[n]?delete t[n]:t[n]=e.$_compile(t[n]);return t}},6354:(e,t,n)=>{const i=n(5688),r=n(8160),o=n(3328);t.Report=class{constructor(e,n,i,r,o,a,s){if(this.code=e,this.flags=r,this.messages=o,this.path=a.path,this.prefs=s,this.state=a,this.value=n,this.message=null,this.template=null,this.local=i||{},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 "${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,n){return t.template(this.value,e,n||this.code,this.state,this.prefs)}},t.path=function(e){let t="";for(const n of e)"object"!=typeof n&&("string"==typeof n?(t&&(t+="."),t+=n):t+=`[${n}]`);return t},t.template=function(e,t,n,i,a){if(!t)return;if(o.isTemplate(t))return"root"!==n?t:null;let s=a.errors.language;if(r.isResolvable(s)&&(s=s.resolve(e,i,a)),s&&t[s]){if(void 0!==t[s][n])return t[s][n];if(void 0!==t[s]["*"])return t[s]["*"]}return t[n]?t[n]:t["*"]},t.label=function(e,n,i,r){if(!i.errors.label)return"";if(e.label)return e.label;let o=n.path;return"key"===i.errors.label&&n.path.length>1&&(o=n.path.slice(-1)),t.path(o)||t.template(null,i.messages,"root",n,i)||r&&t.template(null,r,"root",n,i)||"value"},t.process=function(e,n,i){if(!e)return null;const{override:r,message:o,details:a}=t.details(e);if(r)return r;if(i.errors.stack)return new t.ValidationError(o,a,n);const s=Error.stackTraceLimit;Error.stackTraceLimit=0;const l=new t.ValidationError(o,a,n);return Error.stackTraceLimit=s,l},t.details=function(e,t={}){let n=[];const i=[];for(const r of e){if(r instanceof Error){if(!1!==t.override)return{override:r};const e=r.toString();n.push(e),i.push({message:e,type:"override",context:{error:r}});continue}const e=r.toString();n.push(e),i.push({message:e,path:r.path.filter((e=>"object"!=typeof e)),type:r.code,context:r.local})}return n.length>1&&(n=[...new Set(n)]),{message:n.join(". "),details:i}},t.ValidationError=class extends Error{constructor(e,t,n){super(e),this._original=n,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=i.error},8901:(e,t,n)=>{const i=n(375),r=n(8571),o=n(8160),a=n(6914),s={};t.type=function(e,t){const n=Object.getPrototypeOf(e),l=r(n),c=e._assign(Object.create(l)),u=Object.assign({},t);delete u.base,l._definition=u;const d=n._definition||{};u.messages=a.merge(d.messages,u.messages),u.properties=Object.assign({},d.properties,u.properties),c.type=u.type,u.flags=Object.assign({},d.flags,u.flags);const f=Object.assign({},d.terms);if(u.terms)for(const e in u.terms){const t=u.terms[e];i(void 0===c.$_terms[e],"Invalid term override for",u.type,e),c.$_terms[e]=t.init,f[e]=t}u.terms=f,u.args||(u.args=d.args),u.prepare=s.prepare(u.prepare,d.prepare),u.coerce&&("function"==typeof u.coerce&&(u.coerce={method:u.coerce}),u.coerce.from&&!Array.isArray(u.coerce.from)&&(u.coerce={method:u.coerce.method,from:[].concat(u.coerce.from)})),u.coerce=s.coerce(u.coerce,d.coerce),u.validate=s.validate(u.validate,d.validate);const p=Object.assign({},d.rules);if(u.rules)for(const e in u.rules){const t=u.rules[e];i("object"==typeof t,"Invalid rule definition for",u.type,e);let n=t.method;if(void 0===n&&(n=function(){return this.$_addRule(e)}),n&&(i(!l[e],"Rule conflict in",u.type,e),l[e]=n),i(!p[e],"Rule conflict in",u.type,e),p[e]=t,t.alias){const e=[].concat(t.alias);for(const n of e)l[n]=t.method}t.args&&(t.argsByName=new Map,t.args=t.args.map((e=>("string"==typeof e&&(e={name:e}),i(!t.argsByName.has(e.name),"Duplicated argument name",e.name),o.isSchema(e.assert)&&(e.assert=e.assert.strict().label(e.name)),t.argsByName.set(e.name,e),e))))}u.rules=p;const h=Object.assign({},d.modifiers);if(u.modifiers)for(const e in u.modifiers){i(!l[e],"Rule conflict in",u.type,e);const t=u.modifiers[e];i("function"==typeof t,"Invalid modifier definition for",u.type,e);const n=function(t){return this.rule({[e]:t})};l[e]=n,h[e]=t}if(u.modifiers=h,u.overrides){l._super=n,c.$_super={};for(const e in u.overrides)i(n[e],"Cannot override missing",e),u.overrides[e][o.symbols.parent]=n[e],c.$_super[e]=n[e].bind(c);Object.assign(l,u.overrides)}u.cast=Object.assign({},d.cast,u.cast);const m=Object.assign({},d.manifest,u.manifest);return m.build=s.build(u.manifest&&u.manifest.build,d.manifest&&d.manifest.build),u.manifest=m,u.rebuild=s.rebuild(u.rebuild,d.rebuild),c},s.build=function(e,t){return e&&t?function(n,i){return t(e(n,i),i)}:e||t},s.coerce=function(e,t){return e&&t?{from:e.from&&t.from?[...new Set([...e.from,...t.from])]:null,method(n,i){let r;if((!t.from||t.from.includes(typeof n))&&(r=t.method(n,i),r)){if(r.errors||void 0===r.value)return r;n=r.value}if(!e.from||e.from.includes(typeof n)){const t=e.method(n,i);if(t)return t}return r}}:e||t},s.prepare=function(e,t){return e&&t?function(n,i){const r=e(n,i);if(r){if(r.errors||void 0===r.value)return r;n=r.value}return t(n,i)||r}:e||t},s.rebuild=function(e,t){return e&&t?function(n){t(n),e(n)}:e||t},s.validate=function(e,t){return e&&t?function(n,i){const r=t(n,i);if(r){if(r.errors&&(!Array.isArray(r.errors)||r.errors.length))return r;n=r.value}return e(n,i)||r}:e||t}},5107:(e,t,n)=>{const i=n(375),r=n(8571),o=n(8652),a=n(8160),s=n(3292),l=n(6354),c=n(8901),u=n(9708),d=n(6133),f=n(3328),p=n(1152);let h;const m={types:{alternatives:n(4946),any:n(8068),array:n(546),boolean:n(4937),date:n(7500),function:n(390),link:n(8785),number:n(3832),object:n(8966),string:n(7417),symbol:n(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 i(!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 n=m.aliases[t];e[t]=e[n]}return e.x=e.expression,p.setup&&p.setup(e),e}};m.methods={ValidationError:l.ValidationError,version:a.version,cache:o.provider,assert(e,t,...n){m.assert(e,t,!0,n)},attempt:(e,t,...n)=>m.assert(e,t,!1,n),build(e){return i("function"==typeof u.build,"Manifest functionality disabled"),u.build(this,e)},checkPreferences(e){a.checkPreferences(e)},compile(e,t){return s.compile(this,e,t)},defaults(e){i("function"==typeof e,"modifier must be a function");const t=Object.assign({},this);for(const n of t._types){const r=e(t[n]());i(a.isSchema(r),"modifier must return a valid schema object"),t[n]=function(...e){return m.generate(this,r,e)}}return t},expression:(...e)=>new f(...e),extend(...e){a.verifyFlat(e,"extend"),h=h||n(3378),i(e.length,"You need to provide at least one extension"),this.assert(e,h.extensions);const t=Object.assign({},this);t._types=new Set(t._types);for(let n of e){"function"==typeof n&&(n=n(t)),this.assert(n,h.extension);const e=m.expandExtension(n,t);for(const n of e){i(void 0===t[n.type]||t._types.has(n.type),"Cannot override name",n.type);const e=n.base||this.any(),r=c.type(e,n);t._types.add(n.type),t[n.type]=function(...e){return m.generate(this,r,e)}}}return t},isError:l.ValidationError.isError,isExpression:f.isTemplate,isRef:d.isRef,isSchema:a.isSchema,in:(...e)=>d.in(...e),override:a.symbols.override,ref:(...e)=>d.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,n,i){const o=i[0]instanceof Error||"string"==typeof i[0]?i[0]:null,s=null!==o?i[1]:i[0],c=t.validate(e,a.preferences({errors:{stack:!0}},s||{}));let u=c.error;if(!u)return c.value;if(o instanceof Error)throw o;const d=n&&"function"==typeof u.annotate?u.annotate():u.message;throw u instanceof l.ValidationError==0&&(u=r(u)),u.message=o?`${o} ${d}`:d,u},m.generate=function(e,t,n){return i(e,"Must be invoked on a Joi instance."),t.$_root=e,t._definition.args&&n.length?t._definition.args(t,...n):t},m.expandExtension=function(e,t){if("string"==typeof e.type)return[e];const n=[];for(const i of t._types)if(e.type.test(i)){const r=Object.assign({},e);r.type=i,r.base=t[i](),n.push(r)}return n},e.exports=m.root()},6914:(e,t,n)=>{const i=n(375),r=n(8571),o=n(3328);t.compile=function(e,t){if("string"==typeof e)return i(!t,"Cannot set single message string"),new o(e);if(o.isTemplate(e))return i(!t,"Cannot set single message template"),e;i("object"==typeof e&&!Array.isArray(e),"Invalid message options"),t=t?r(t):{};for(let n in e){const r=e[n];if("root"===n||o.isTemplate(r)){t[n]=r;continue}if("string"==typeof r){t[n]=new o(r);continue}i("object"==typeof r&&!Array.isArray(r),"Invalid message for",n);const a=n;for(n in t[a]=t[a]||{},r){const e=r[n];"root"===n||o.isTemplate(e)?t[a][n]=e:(i("string"==typeof e,"Invalid message for",n,"in",a),t[a][n]=new o(e))}}return t},t.decompile=function(e){const t={};for(let n in e){const i=e[n];if("root"===n){t.root=i;continue}if(o.isTemplate(i)){t[n]=i.describe({compact:!0});continue}const r=n;for(n in t[r]={},i){const e=i[n];"root"!==n?t[r][n]=e.describe({compact:!0}):t[r].root=e}}return t},t.merge=function(e,n){if(!e)return t.compile(n);if(!n)return e;if("string"==typeof n)return new o(n);if(o.isTemplate(n))return n;const a=r(e);for(let e in n){const t=n[e];if("root"===e||o.isTemplate(t)){a[e]=t;continue}if("string"==typeof t){a[e]=new o(t);continue}i("object"==typeof t&&!Array.isArray(t),"Invalid message for",e);const r=e;for(e in a[r]=a[r]||{},t){const n=t[e];"root"===e||o.isTemplate(n)?a[r][e]=n:(i("string"==typeof n,"Invalid message for",e,"in",r),a[r][e]=new o(n))}}return a}},2294:(e,t,n)=>{const i=n(375),r=n(8160),o=n(6133),a={};t.Ids=a.Ids=class{constructor(){this._byId=new Map,this._byKey=new Map,this._schemaChain=!1}clone(){const e=new a.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,n]of e._byId.entries())i(!this._byKey.has(t),"Schema id conflicts with existing key:",t),this._byId.set(t,n);for(const[t,n]of e._byKey.entries())i(!this._byId.has(t),"Schema key conflicts with existing id:",t),this._byKey.set(t,n)}fork(e,t,n){const o=this._collect(e);o.push({schema:n});const s=o.shift();let l={id:s.id,schema:t(s.schema)};i(r.isSchema(l.schema),"adjuster function failed to return a joi schema type");for(const e of o)l={id:e.id,schema:a.fork(e.schema,l.id,l.schema)};return l.schema}labels(e,t=[]){const n=e[0],i=this._get(n);if(!i)return[...t,...e].join(".");const r=e.slice(1);return t=[...t,i.schema._flags.label||n],r.length?i.schema._ids.labels(r,t):t.join(".")}reach(e,t=[]){const n=e[0],r=this._get(n);i(r,"Schema does not contain path",[...t,...e].join("."));const o=e.slice(1);return o.length?r.schema._ids.reach(o,[...t,n]):r.schema}register(e,{key:t}={}){if(!e||!r.isSchema(e))return;(e.$_property("schemaChain")||e._ids._schemaChain)&&(this._schemaChain=!0);const n=e._flags.id;if(n){const t=this._byId.get(n);i(!t||t.schema===e,"Cannot add different schemas with the same id:",n),i(!this._byKey.has(n),"Schema id conflicts with existing key:",n),this._byId.set(n,{schema:e,id:n})}t&&(i(!this._byKey.has(t),"Schema already contains key:",t),i(!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=[],n=[]){const r=e[0],o=this._get(r);i(o,"Schema does not contain path",[...t,...e].join(".")),n=[o,...n];const a=e.slice(1);return a.length?o.schema._ids._collect(a,[...t,r],n):n}_get(e){return this._byId.get(e)||this._byKey.get(e)}},a.fork=function(e,n,i){const r=t.schema(e,{each:(e,{key:t})=>{if(n===(e._flags.id||t))return i},ref:!1});return r?r.$_mutateRebuild():e},t.schema=function(e,t){let n;for(const i in e._flags){if("_"===i[0])continue;const r=a.scan(e._flags[i],{source:"flags",name:i},t);void 0!==r&&(n=n||e.clone(),n._flags[i]=r)}for(let i=0;i<e._rules.length;++i){const r=e._rules[i],o=a.scan(r.args,{source:"rules",name:r.name},t);if(void 0!==o){n=n||e.clone();const t=Object.assign({},r);t.args=o,n._rules[i]=t,n._singleRules.get(r.name)===r&&n._singleRules.set(r.name,t)}}for(const i in e.$_terms){if("_"===i[0])continue;const r=a.scan(e.$_terms[i],{source:"terms",name:i},t);void 0!==r&&(n=n||e.clone(),n.$_terms[i]=r)}return n},a.scan=function(e,t,n,i,s){const l=i||[];if(null===e||"object"!=typeof e)return;let c;if(Array.isArray(e)){for(let i=0;i<e.length;++i){const r="terms"===t.source&&"keys"===t.name&&e[i].key,o=a.scan(e[i],t,n,[i,...l],r);void 0!==o&&(c=c||e.slice(),c[i]=o)}return c}if(!1!==n.schema&&r.isSchema(e)||!1!==n.ref&&o.isRef(e)){const i=n.each(e,{...t,path:l,key:s});if(i===e)return;return i}for(const i in e){if("_"===i[0])continue;const r=a.scan(e[i],t,n,[i,...l],s);void 0!==r&&(c=c||Object.assign({},e),c[i]=r)}return c}},6133:(e,t,n)=>{const i=n(375),r=n(8571),o=n(9621),a=n(8160);let s;const l={symbol:Symbol("ref"),defaults:{adjust:null,in:!1,iterables:null,map:null,separator:".",type:"value"}};t.create=function(e,t={}){i("string"==typeof e,"Invalid reference key:",e),a.assertOptions(t,["adjust","ancestor","in","iterables","map","prefix","render","separator"]),i(!t.prefix||"object"==typeof t.prefix,"options.prefix must be of type object");const n=Object.assign({},l.defaults,t);delete n.prefix;const r=n.separator,o=l.context(e,r,t.prefix);if(n.type=o.type,e=o.key,"value"===n.type)if(o.root&&(i(!r||e[0]!==r,"Cannot specify relative path with root prefix"),n.ancestor="root",e||(e=null)),r&&r===e)e=null,n.ancestor=0;else if(void 0!==n.ancestor)i(!r||!e||e[0]!==r,"Cannot combine prefix with ancestor option");else{const[t,i]=l.ancestor(e,r);i&&""===(e=e.slice(i))&&(e=null),n.ancestor=t}return n.path=r?null===e?[]:e.split(r):[e],new l.Ref(n)},t.in=function(e,n={}){return t.create(e,{...n,in:!0})},t.isRef=function(e){return!!e&&!!e[a.symbols.ref]},l.Ref=class{constructor(e){i("object"==typeof e,"Invalid reference construction"),a.assertOptions(e,["adjust","ancestor","in","iterables","map","path","render","separator","type","depth","key","root","display"]),i([!1,void 0].includes(e.separator)||"string"==typeof e.separator&&1===e.separator.length,"Invalid separator"),i(!e.adjust||"function"==typeof e.adjust,"options.adjust must be a function"),i(!e.map||Array.isArray(e.map),"options.map must be an array"),i(!e.map||!e.adjust,"Cannot set both map and adjust options"),Object.assign(this,l.defaults,e),i("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,n,r,o={}){return i(!this.in||o.in,"Invalid in() reference usage"),"global"===this.type?this._resolve(n.context,t,o):"local"===this.type?this._resolve(r,t,o):this.ancestor?"root"===this.ancestor?this._resolve(t.ancestors[t.ancestors.length-1],t,o):(i(this.ancestor<=t.ancestors.length,"Invalid reference exceeds the schema root:",this.display),this._resolve(t.ancestors[this.ancestor-1],t,o)):this._resolve(e,t,o)}_resolve(e,t,n){let i;if("value"===this.type&&t.mainstay.shadow&&!1!==n.shadow&&(i=t.mainstay.shadow.get(this.absolute(t))),void 0===i&&(i=o(e,this.path,{iterables:this.iterables,functions:!0})),this.adjust&&(i=this.adjust(i)),this.map){const e=this.map.get(i);void 0!==e&&(i=e)}return t.mainstay&&t.mainstay.tracer.resolve(t,this,i),i}toString(){return this.display}absolute(e){return[...e.path.slice(0,-this.ancestor),...this.path]}clone(){return new l.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:${this.type}:${e}`);if(!this.separator)return void(this.display=`ref:${e}`);if(!this.ancestor)return void(this.display=`ref:${this.separator}${e}`);if("root"===this.ancestor)return void(this.display=`ref:root:${e}`);if(1===this.ancestor)return void(this.display=`ref:${e||".."}`);const t=new Array(this.ancestor+1).fill(this.separator).join("");this.display=`ref:${t}${e||""}`}},l.Ref.prototype[a.symbols.ref]=!0,t.build=function(e){return"value"===(e=Object.assign({},l.defaults,e)).type&&void 0===e.ancestor&&(e.ancestor=1),new l.Ref(e)},l.context=function(e,t,n={}){if(e=e.trim(),n){const i=void 0===n.global?"$":n.global;if(i!==t&&e.startsWith(i))return{key:e.slice(i.length),type:"global"};const r=void 0===n.local?"#":n.local;if(r!==t&&e.startsWith(r))return{key:e.slice(r.length),type:"local"};const o=void 0===n.root?"/":n.root;if(o!==t&&e.startsWith(o))return{key:e.slice(o.length),type:"value",root:!0}}return{key:e,type:"value"}},l.ancestor=function(e,t){if(!t)return[1,0];if(e[0]!==t)return[1,0];if(e[1]!==t)return[0,1];let n=2;for(;e[n]===t;)++n;return[n-1,n]},t.toSibling=0,t.toParent=1,t.Manager=class{constructor(){this.refs=[]}register(e,i){if(e)if(i=void 0===i?t.toParent:i,Array.isArray(e))for(const t of e)this.register(t,i);else if(a.isSchema(e))for(const t of e._refs.refs)t.ancestor-i>=0&&this.refs.push({ancestor:t.ancestor-i,root:t.root});else t.isRef(e)&&"value"===e.type&&e.ancestor-i>=0&&this.refs.push({ancestor:e.ancestor-i,root:e.root}),s=s||n(3328),s.isTemplate(e)&&this.register(e.refs(),i)}get length(){return this.refs.length}clone(){const e=new t.Manager;return e.refs=r(this.refs),e}reset(){this.refs=[]}roots(){return this.refs.filter((e=>!e.ancestor)).map((e=>e.root))}}},3378:(e,t,n)=>{const i=n(5107),r={};r.wrap=i.string().min(1).max(2).allow(!1),t.preferences=i.object({allowUnknown:i.boolean(),abortEarly:i.boolean(),artifacts:i.boolean(),cache:i.boolean(),context:i.object(),convert:i.boolean(),dateFormat:i.valid("date","iso","string","time","utc"),debug:i.boolean(),errors:{escapeHtml:i.boolean(),label:i.valid("path","key",!1),language:[i.string(),i.object().ref()],render:i.boolean(),stack:i.boolean(),wrap:{label:r.wrap,array:r.wrap,string:r.wrap}},externals:i.boolean(),messages:i.object(),noDefaults:i.boolean(),nonEnumerables:i.boolean(),presence:i.valid("required","optional","forbidden"),skipFunctions:i.boolean(),stripUnknown:i.object({arrays:i.boolean(),objects:i.boolean()}).or("arrays","objects").allow(!0,!1),warnings:i.boolean()}).strict(),r.nameRx=/^[a-zA-Z0-9]\w*$/,r.rule=i.object({alias:i.array().items(i.string().pattern(r.nameRx)).single(),args:i.array().items(i.string(),i.object({name:i.string().pattern(r.nameRx).required(),ref:i.boolean(),assert:i.alternatives([i.function(),i.object().schema()]).conditional("ref",{is:!0,then:i.required()}),normalize:i.function(),message:i.string().when("assert",{is:i.function(),then:i.required()})})),convert:i.boolean(),manifest:i.boolean(),method:i.function().allow(!1),multi:i.boolean(),validate:i.function()}),t.extension=i.object({type:i.alternatives([i.string(),i.object().regex()]).required(),args:i.function(),cast:i.object().pattern(r.nameRx,i.object({from:i.function().maxArity(1).required(),to:i.function().minArity(1).maxArity(2).required()})),base:i.object().schema().when("type",{is:i.object().regex(),then:i.forbidden()}),coerce:[i.function().maxArity(3),i.object({method:i.function().maxArity(3).required(),from:i.array().items(i.string()).single()})],flags:i.object().pattern(r.nameRx,i.object({setter:i.string(),default:i.any()})),manifest:{build:i.function().arity(2)},messages:[i.object(),i.string()],modifiers:i.object().pattern(r.nameRx,i.function().minArity(1).maxArity(2)),overrides:i.object().pattern(r.nameRx,i.function()),prepare:i.function().maxArity(3),rebuild:i.function().arity(1),rules:i.object().pattern(r.nameRx,r.rule),terms:i.object().pattern(r.nameRx,i.object({init:i.array().allow(null).required(),manifest:i.object().pattern(/.+/,[i.valid("schema","single"),i.object({mapped:i.object({from:i.string().required(),to:i.string().required()}).required()})])})),validate:i.function().maxArity(3)}).strict(),t.extensions=i.array().items(i.object(),i.function().arity(1)).strict(),r.desc={buffer:i.object({buffer:i.string()}),func:i.object({function:i.function().required(),options:{literal:!0}}),override:i.object({override:!0}),ref:i.object({ref:i.object({type:i.valid("value","global","local"),path:i.array().required(),separator:i.string().length(1).allow(!1),ancestor:i.number().min(0).integer().allow("root"),map:i.array().items(i.array().length(2)).min(1),adjust:i.function(),iterables:i.boolean(),in:i.boolean(),render:i.boolean()}).required()}),regex:i.object({regex:i.string().min(3)}),special:i.object({special:i.valid("deep").required()}),template:i.object({template:i.string().required(),options:i.object()}),value:i.object({value:i.alternatives([i.object(),i.array()]).required()})},r.desc.entity=i.alternatives([i.array().items(i.link("...")),i.boolean(),i.function(),i.number(),i.string(),r.desc.buffer,r.desc.func,r.desc.ref,r.desc.regex,r.desc.special,r.desc.template,r.desc.value,i.link("/")]),r.desc.values=i.array().items(null,i.boolean(),i.function(),i.number().allow(1/0,-1/0),i.string().allow(""),i.symbol(),r.desc.buffer,r.desc.func,r.desc.override,r.desc.ref,r.desc.regex,r.desc.template,r.desc.value),r.desc.messages=i.object().pattern(/.+/,[i.string(),r.desc.template,i.object().pattern(/.+/,[i.string(),r.desc.template])]),t.description=i.object({type:i.string().required(),flags:i.object({cast:i.string(),default:i.any(),description:i.string(),empty:i.link("/"),failover:r.desc.entity,id:i.string(),label:i.string(),only:!0,presence:["optional","required","forbidden"],result:["raw","strip"],strip:i.boolean(),unit:i.string()}).unknown(),preferences:{allowUnknown:i.boolean(),abortEarly:i.boolean(),artifacts:i.boolean(),cache:i.boolean(),convert:i.boolean(),dateFormat:["date","iso","string","time","utc"],errors:{escapeHtml:i.boolean(),label:["path","key"],language:[i.string(),r.desc.ref],wrap:{label:r.wrap,array:r.wrap}},externals:i.boolean(),messages:r.desc.messages,noDefaults:i.boolean(),nonEnumerables:i.boolean(),presence:["required","optional","forbidden"],skipFunctions:i.boolean(),stripUnknown:i.object({arrays:i.boolean(),objects:i.boolean()}).or("arrays","objects").allow(!0,!1),warnings:i.boolean()},allow:r.desc.values,invalid:r.desc.values,rules:i.array().min(1).items({name:i.string().required(),args:i.object().min(1),keep:i.boolean(),message:[i.string(),r.desc.messages],warn:i.boolean()}),keys:i.object().pattern(/.*/,i.link("/")),link:r.desc.ref}).pattern(/^[a-z]\w*$/,i.any())},493:(e,t,n)=>{const i=n(8571),r=n(9621),o=n(8160),a={value:Symbol("value")};e.exports=a.State=class{constructor(e,t,n){this.path=e,this.ancestors=t,this.mainstay=n.mainstay,this.schemas=n.schemas,this.debug=null}localize(e,t=null,n=null){const i=new a.State(e,t,this);return n&&i.schemas&&(i.schemas=[a.schemas(n),...i.schemas]),i}nest(e,t){const n=new a.State(this.path,this.ancestors,this);return n.schemas=n.schemas&&[a.schemas(e),...n.schemas],n.debug=t,n}shadow(e,t){this.mainstay.shadow=this.mainstay.shadow||new a.Shadow,this.mainstay.shadow.set(this.path,e,t)}snapshot(){this.mainstay.shadow&&(this._snapshot=i(this.mainstay.shadow.node(this.path))),this.mainstay.snapshot()}restore(){this.mainstay.shadow&&(this.mainstay.shadow.override(this.path,this._snapshot),this._snapshot=void 0),this.mainstay.restore()}commit(){this.mainstay.shadow&&(this.mainstay.shadow.override(this.path,this._snapshot),this._snapshot=void 0),this.mainstay.commit()}},a.schemas=function(e){return o.isSchema(e)?{schema:e}:e},a.Shadow=class{constructor(){this._values=null}set(e,t,n){if(!e.length)return;if("strip"===n&&"number"==typeof e[e.length-1])return;this