directus-extension-constrained-file-interface
Version:
Add file upload/select interface that allows for folder, storage, and MIME type constraints.
1 lines • 220 kB
JavaScript
import{useApi as e,defineInterface as t}from"@directus/extensions-sdk";import{defineComponent as i,computed as s,ref as r,watch as n,inject as a,nextTick as o,onMounted as l,resolveComponent as c,resolveDirective as d,createElementBlock as u,openBlock as f,createVNode as p,createBlock as h,createCommentVNode as m,withCtx as _,Fragment as g,unref as y,createTextVNode as v,toDisplayString as b,createElementVNode as w,normalizeClass as $,withDirectives as x,withModifiers as k}from"vue";import{useI18n as j}from"vue-i18n";var R="object"==typeof global&&global&&global.Object===Object&&global,S="object"==typeof self&&self&&self.Object===Object&&self,A=(R||S||Function("return this")()).Symbol,O=Object.prototype,E=O.hasOwnProperty,C=O.toString,I=A?A.toStringTag:void 0;var D=Object.prototype.toString;var T=A?A.toStringTag:void 0;function N(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":T&&T in Object(e)?function(e){var t=E.call(e,I),i=e[I];try{e[I]=void 0;var s=!0}catch(e){}var r=C.call(e);return s&&(t?e[I]=i:delete e[I]),r}(e):function(e){return D.call(e)}(e)}function M(e){return null!=e&&"object"==typeof e}var q,P,L=(q=Object.getPrototypeOf,P=Object,function(e){return q(P(e))}),F=Function.prototype,z=Object.prototype,U=F.toString,V=z.hasOwnProperty,B=U.call(Object);var W=(0).constructor,G=W.isFinite;W.isInteger;var H=[].constructor.isArray;function K(e){return null!==e&&"object"==typeof e}function Z(e,t){return void 0===t&&(t=0),"string"==typeof e&&e.length>=t}function Y(e){return G(e)}function J(e){return H(e)}function Q(e,t){return K(e)&&t in e}var X=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 i=this.cachedKeys[this.oldestIndex];void 0!==i&&delete this.map[i],this.cachedKeys[this.oldestIndex]=e,this.oldestIndex++,this.oldestIndex%=this.size},e}())(1e3);function ee(e){var t=e.charAt(0),i=e.substr(-1);if("'\"`".includes(t)||"'\"`".includes(i)){if(e.length<2||t!==i)throw new SyntaxError('Mismatching string quotation: "'+e+'"');return e.substring(1,e.length-1)}if(e.includes("["))throw new SyntaxError('Missing ] in varName "'+e+'"');return"+"===t?e.substr(1):e}function te(e,t,i){var s=t.trim();if(""===s)return e;if(s.startsWith(".")){if(!i)throw new SyntaxError('Unexpected . at the start of "'+t+'"');if(""===(s=s.substr(1).trim()))return e}else if(i)throw new SyntaxError('Missing . at the start of "'+t+'"');if(s.endsWith("."))throw new SyntaxError('Unexpected "." at the end of "'+t+'"');for(var r=0,n=s.split(".");r<n.length;r++){var a=n[r].trim();if(""===a)throw new SyntaxError('Empty prop name when parsing "'+t+'"');e.push(a)}return e}function ie(e){if(!Z(e))throw new TypeError("Cannot parse path. Expected string. Got a "+typeof e);for(var t,i,s=0,r=!1,n=new Array(0),a=0;a<e.length&&-1!==(t=e.indexOf("[",a));a=s){if(-1===(s=e.indexOf("]",t)))throw new SyntaxError('Missing ] in varName "'+e+'"');if(0===(i=e.substring(t+1,s).trim()).length)throw new SyntaxError("Unexpected token ]");s++,te(n,e.substring(a,t),r),n.push(ee(i)),r=!0}return te(n,e.substring(s),r)}function se(e,t,i){if(void 0===i&&(i={}),!K(i))throw new TypeError("get expects an object option. Got "+typeof i);var s=i.depth,r=void 0===s?10:s;if(!Y(r)||r<=0)throw new RangeError("Expected a positive number for depth. Got "+r);var n=Array.isArray(t)?t:ie.cached(t),a=function(){return n.join(" > ")};if(n.length>r)throw new ReferenceError("The path cannot be deeper than "+r+' levels. Got "'+a()+'"');for(var o=e,l=0,c=n;l<c.length;l++){var d=c[l];if(!Q(o,d)){if(i.propsExist)throw new ReferenceError(d+' is not defined in the scope at path: "'+a()+'"');return}o=o[d]}return o}ie.cached=function(e){var t=X.get(e);return void 0===t&&(t=ie(e),X.set(e,t)),t};var re=function(){function e(e,t){var i=this;if(void 0===t&&(t={}),this.tokens=e,this.options=t,this.render=function(e){void 0===e&&(e={});var t=i.tokens.varNames.length;i.cacheParsedPaths();for(var s=new Array(t),r=0;r<t;r++)s[r]=se(e,i.toPathCache[r],i.options);return i.stringify(s)},this.renderFn=function(e,t){void 0===t&&(t={});var s=i.resolveVarNames(e,t);return i.stringify(s)},this.renderFnAsync=function(e,t){return void 0===t&&(t={}),Promise.all(i.resolveVarNames(e,t)).then(function(e){return i.stringify(e)})},!K(e)||!J(e.strings)||!J(e.varNames)||e.strings.length!==e.varNames.length+1)throw new TypeError("Invalid tokens object");if(!K(t))throw new TypeError("Options should be an object. Got a "+typeof t);t.validateVarNames&&this.cacheParsedPaths()}return e.prototype.cacheParsedPaths=function(){var e=this.tokens.varNames;if(void 0===this.toPathCache){this.toPathCache=new Array(e.length);for(var t=0;t<e.length;t++)this.toPathCache[t]=ie.cached(e[t])}},e.prototype.resolveVarNames=function(e,t){void 0===t&&(t={});var i=this.tokens.varNames;if(!function(e){return"function"==typeof e}(e))throw new TypeError("Expected a resolver function. Got "+String(e));for(var s=i.length,r=new Array(s),n=0;n<s;n++)r[n]=e.call(null,i[n],t);return r},e.prototype.stringify=function(e){for(var t=this.tokens.strings,i=this.options.explicit,s=e.length,r="",n=0;n<s;n++){r+=t[n];var a=e[n];(i||null!=a)&&(r+=a)}return r+=t[s]},e}();function ne(e,t){void 0===t&&(t={});var i=function(e,t){if(void 0===t&&(t={}),!Z(e))throw new TypeError("The template parameter must be a string. Got a "+typeof e);if(!K(t))throw new TypeError("Options should be an object. Got a "+typeof t);var i=t.tags,s=void 0===i?["{{","}}"]:i,r=t.maxVarNameLength,n=void 0===r?1e3:r;if(!J(s)||2!==s.length)throw TypeError("tags should be an array of two elements. Got "+String(s));var a=s[0],o=s[1];if(!Z(a,1)||!Z(o,1)||a===o)throw new TypeError('The open and close symbols should be two distinct non-empty strings. Got "'+a+'" and "'+o+'"');if(!Y(n)||n<=0)throw new Error("Expected a positive number for maxVarNameLength. Got "+n);for(var l,c,d=a.length,u=o.length,f=0,p=[],h=[],m=0;m<e.length&&-1!==(l=e.indexOf(a,m));){var _=l+d;if(-1===(f=e.substr(_,n+u).indexOf(o)))throw new SyntaxError('Missing "'+o+'" in the template for the "'+a+'" at position '+l+" within "+n+" characters");if(f+=_,0===(c=e.substring(_,f).trim()).length)throw new SyntaxError('Unexpected "'+o+'" tag found at position '+l);if(c.includes(a))throw new SyntaxError('Variable names cannot have "'+a+'". But at position '+l+'. Got "'+c+'"');h.push(c),f+=u,p.push(e.substring(m,l)),m=f}return p.push(e.substring(f)),{strings:p,varNames:h}}(e,t);return new re(i,t)}function ae(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var oe,le={exports:{}};var ce,de=(oe||(oe=1,ce=le,function(e,t){ce.exports=t()}(self,()=>{return e={7629:(e,t,i)=>{const s=i(375),r=i(8571),n=i(9474),a=i(1687),o=i(8652),l=i(8160),c=i(3292),d=i(6354),u=i(8901),f=i(9708),p=i(6914),h=i(2294),m=i(6133),_=i(1152),g=i(8863),y=i(2036),v={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 s("function"==typeof f.describe,"Manifest functionality disabled"),f.describe(this)}allow(...e){return l.verifyFlat(e,"allow"),this._values(e,"_valids")}alter(e){s(e&&"object"==typeof e&&!Array.isArray(e),"Invalid targets argument"),s(!this._inRuleset(),"Cannot set alterations inside a ruleset");const t=this.clone();t.$_terms.alterations=t.$_terms.alterations||[];for(const i in e){const r=e[i];s("function"==typeof r,"Alteration adjuster for",i,"must be a function"),t.$_terms.alterations.push({target:i,adjuster:r})}return t.$_temp.ruleset=!1,t}artifact(e){return s(void 0!==e,"Artifact cannot be undefined"),s(!this._cache,"Cannot set an artifact with a rule cache"),this.$_setFlag("artifact",e)}cast(e){return s(!1===e||"string"==typeof e,"Invalid to value"),s(!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 s(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 s(e,"Missing error"),s(e instanceof Error||"function"==typeof e,"Must provide a valid Error object or a function"),this.$_setFlag("error",e)}example(e,t={}){return s(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&&(s(!t,"Cannot combine options with description"),t=e.description,e=e.method),s("function"==typeof e,"Method must be a function"),s(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?(s("string"==typeof e,"id must be a non-empty string"),s(/^[^\.]+$/.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 s(e&&"string"==typeof e,"Label name must be a non-empty string"),this.$_setFlag("label",e)}meta(e){return s(void 0!==e,"Meta cannot be undefined"),this._inner("metas",e,{single:!0})}note(...e){s(e.length,"Missing notes");for(const t of e)s(t&&"string"==typeof t,"Notes must be non-empty strings");return this._inner("notes",e)}only(e=!0){return s("boolean"==typeof e,"Invalid mode:",e),this.$_setFlag("only",e)}optional(){return this.presence("optional")}prefs(e){s(e,"Missing preferences"),s(void 0===e.context,"Cannot override context"),s(void 0===e.externals,"Cannot override externals"),s(void 0===e.warnings,"Cannot override warnings"),s(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 s(["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 s(["raw","strip"].includes(e),"Unknown result mode",e),this.$_setFlag("result",e)}required(){return this.presence("required")}strict(e){const t=this.clone(),i=void 0!==e&&!e;return t._preferences=l.preferences(t._preferences,{convert:i}),t}strip(e=!0){return this.$_setFlag("result",e?"strip":void 0)}tag(...e){s(e.length,"Missing tags");for(const t of e)s(t&&"string"==typeof t,"Tags must be non-empty strings");return this._inner("tags",e)}unit(e){return s(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 i=this.clone();i.$_terms.whens||(i.$_terms.whens=[]);const r=c.when(i,e,t);if(!["any","link"].includes(i.type)){const e=r.is?[r]:r.switch;for(const t of e)s(!t.then||"any"===t.then.type||t.then.type===i.type,"Cannot combine",i.type,"with",t.then&&t.then.type),s(!t.otherwise||"any"===t.otherwise.type||t.otherwise.type===i.type,"Cannot combine",i.type,"with",t.otherwise&&t.otherwise.type)}return i.$_terms.whens.push(r),i.$_mutateRebuild()}cache(e){s(!this._inRuleset(),"Cannot set caching inside a ruleset"),s(!this._cache,"Cannot override schema cache"),s(void 0===this._flags.artifact,"Cannot cache a rule with an artifact");const t=this.clone();return t._cache=e||o.provider.provision(),t.$_temp.ruleset=!1,t}clone(){const e=Object.create(Object.getPrototypeOf(this));return this._assign(e)}concat(e){s(l.isSchema(e),"Invalid schema object"),s("any"===this.type||"any"===e.type||e.type===this.type,"Cannot merge type",this.type,"with another type:",e.type),s(!this._inRuleset(),"Cannot concatenate onto a schema with open ruleset"),s(!e._inRuleset(),"Cannot concatenate a schema with open ruleset");let t=this.clone();if("any"===this.type&&"any"!==e.type){const i=e.clone();for(const e of Object.keys(t))"type"!==e&&(i[e]=t[e]);t=i}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=y.merge(t._valids,e._valids,e._invalids),t._invalids=y.merge(t._invalids,e._invalids,e._valids);for(const i of e._singleRules.keys())t._singleRules.has(i)&&(t._rules=t._rules.filter(e=>e.keep||e.name!==i),t._singleRules.delete(i));for(const i of e._rules)e._definition.rules[i.method].multi||t._singleRules.set(i.name,i),t._rules.push(i);if(t._flags.empty&&e._flags.empty){t._flags.empty=t._flags.empty.concat(e._flags.empty);const i=Object.assign({},e._flags);delete i.empty,a(t._flags,i)}else if(e._flags.empty){t._flags.empty=e._flags.empty;const i=Object.assign({},e._flags);delete i.empty,a(t._flags,i)}else a(t._flags,e._flags);for(const i in e.$_terms){const s=e.$_terms[i];s?t.$_terms[i]?t.$_terms[i]=t.$_terms[i].concat(s):t.$_terms[i]=s.slice():t.$_terms[i]||(t.$_terms[i]=s)}return this.$_root._tracer&&this.$_root._tracer._combine(t,[this,e]),t.$_mutateRebuild()}extend(e){return s(!e.base,"Cannot extend type with another base"),u.type(this,e)}extract(e){return e=Array.isArray(e)?e:e.split("."),this._ids.reach(e)}fork(e,t){s(!this._inRuleset(),"Cannot fork inside a ruleset");let i=this;for(let s of[].concat(e))s=Array.isArray(s)?s:s.split("."),i=i._ids.fork(s,t,i);return i.$_temp.ruleset=!1,i}rule(e){const t=this._definition;l.assertOptions(e,Object.keys(t.modifiers)),s(!1!==this.$_temp.ruleset,"Cannot apply rules to empty ruleset or the last rule added does not support rule properties");const i=null===this.$_temp.ruleset?this._rules.length-1:this.$_temp.ruleset;s(i>=0&&i<this._rules.length,"Cannot apply rules to empty ruleset");const n=this.clone();for(let a=i;a<n._rules.length;++a){const i=n._rules[a],o=r(i);for(const r in e)t.modifiers[r](o,e[r]),s(o.name===i.name,"Cannot change rule name");n._rules[a]=o,n._singleRules.get(o.name)===i&&n._singleRules.set(o.name,o)}return n.$_temp.ruleset=!1,n.$_mutateRebuild()}get ruleset(){s(!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),s(!this._inRuleset(),"Cannot tailor inside a ruleset");let t=this;if(this.$_terms.alterations)for(const{target:i,adjuster:r}of this.$_terms.alterations)e.includes(i)&&(t=r(t),s(l.isSchema(t),"Alteration adjuster for",i,"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 g.entry(e,this,t)}validateAsync(e,t){return g.entryAsync(e,this,t)}$_addRule(e){"string"==typeof e&&(e={name:e}),s(e&&"object"==typeof e,"Invalid options"),s(e.name&&"string"==typeof e.name,"Invalid rule name");for(const t in e)s("_"!==t[0],"Cannot set private rule properties");const t=Object.assign({},e);t._resolve=[],t.method=t.method||t.name;const i=this._definition.rules[t.method],r=t.args;s(i,"Unknown rule",t.method);const n=this.clone();if(r){s(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(i.argsByName){const o=i.argsByName.get(e);if(o.ref&&l.isResolvable(a))t._resolve.push(e),n.$_mutateRegister(a);else if(o.normalize&&(a=o.normalize(a),r[e]=a),o.assert){const t=l.validateArg(a,e,o);s(!t,t,"or reference")}}void 0!==a?r[e]=a:delete r[e]}}return i.multi||(n._ruleRemove(t.name,{clone:!1}),n._singleRules.set(t.name,t)),!1===n.$_temp.ruleset&&(n.$_temp.ruleset=null),i.priority?n._rules.unshift(t):n._rules.push(t),n}$_compile(e,t){return c.schema(this.$_root,e,t)}$_createError(e,t,i,s,r,n={}){const a=!1!==n.flags?this._flags:{},o=n.messages?p.merge(this._definition.messages,n.messages):this._definition.messages;return new d.Report(e,t,i,a,o,s,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,i,s){(i=Object.assign({},i)).abortEarly=!0,i._externals=!1,t.snapshot();const r=!g.validate(e,this,t,i,s).errors;return t.restore(),r}$_modify(e){return l.assertOptions(e,["each","once","ref","schema"]),h.schema(this,e)||this}$_mutateRebuild(){return s(!this._inRuleset(),"Cannot add this rule inside a ruleset"),this._refs.reset(),this._ids.reset(),this.$_modify({each:(e,{source:t,name:i,path:s,key:r})=>{const n=this._definition[t][i]&&this._definition[t][i].register;!1!==n&&this.$_mutateRegister(e,{family:n,key:r})}}),this._definition.rebuild&&this._definition.rebuild(this),this.$_temp.ruleset=!1,this}$_mutateRegister(e,{family:t,key:i}={}){this._refs.register(e,t),this._ids.register(e,{key:i})}$_property(e){return this._definition.properties[e]}$_reach(e){return this._ids.reach(e)}$_rootReferences(){return this._refs.roots()}$_setFlag(e,t,i={}){s("_"===e[0]||!this._inRuleset(),"Cannot set flag inside a ruleset");const r=this._definition.flags[e]||{};if(n(t,r.default)&&(t=void 0),n(t,this._flags[e]))return this;const a=!1!==i.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,i){return g.validate(e,this,t,i)}_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 i in t){const s=t[i];e.$_terms[i]=s.init}return e.$_mutateRebuild()}_default(e,t,i={}){return l.assertOptions(i,"literal"),s(void 0!==t,"Missing",e,"value"),s("function"==typeof t||!i.literal,"Only function value supports literal option"),"function"==typeof t&&i.literal&&(t={[l.symbols.literal]:!0,literal:t}),this.$_setFlag(e,t)}_generate(e,t,i){if(!this.$_terms.whens)return{schema:this};const s=[],r=[];for(let n=0;n<this.$_terms.whens.length;++n){const a=this.$_terms.whens[n];if(a.concat){s.push(a.concat),r.push(`${n}.concat`);continue}const o=a.ref?a.ref.resolve(e,t,i):e,l=a.is?[a]:a.switch,c=r.length;for(let c=0;c<l.length;++c){const{is:d,then:u,otherwise:f}=l[c],p=`${n}${a.switch?"."+c:""}`;if(d.$_match(o,t.nest(d,`${p}.is`),i)){if(u){const n=t.localize([...t.path,`${p}.then`],t.ancestors,t.schemas),{schema:a,id:o}=u._generate(e,n,i);s.push(a),r.push(`${p}.then${o?`(${o})`:""}`);break}}else if(f){const n=t.localize([...t.path,`${p}.otherwise`],t.ancestors,t.schemas),{schema:a,id:o}=f._generate(e,n,i);s.push(a),r.push(`${p}.otherwise${o?`(${o})`:""}`);break}}if(a.break&&r.length>c)break}const n=r.join(", ");if(t.mainstay.tracer.debug(t,"rule","when",n),!n)return{schema:this};if(!t.mainstay.tracer.active&&this.$_temp.whens[n])return{schema:this.$_temp.whens[n],id:n};let a=this;this._definition.generate&&(a=this._definition.generate(this,e,t,i));for(const e of s)a=a.concat(e);return this.$_root._tracer&&this.$_root._tracer._combine(a,[this,...s]),this.$_temp.whens[n]=a,{schema:a,id:n}}_inner(e,t,i={}){s(!this._inRuleset(),`Cannot set ${e} inside a ruleset`);const r=this.clone();return r.$_terms[e]&&!i.override||(r.$_terms[e]=[]),i.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 i=!1!==t.clone?this.clone():this;i._singleRules.delete(e);const s=[];for(let t=0;t<i._rules.length;++t){const r=i._rules[t];r.name!==e||r.keep?s.push(r):i._inRuleset()&&t<i.$_temp.ruleset&&--i.$_temp.ruleset}return i._rules=s,i}_values(e,t){l.verifyFlat(e,t.slice(1,-1));const i=this.clone(),r=e[0]===l.symbols.override;if(r&&(e=e.slice(1)),!i[t]&&e.length?i[t]=new y:r&&(i[t]=e.length?new y:null,i.$_mutateRebuild()),!i[t])return i;r&&i[t].override();for(const r of e){s(void 0!==r,"Cannot call allow/valid/invalid with undefined"),s(r!==l.symbols.override,"Override must be the first value");const e="_invalids"===t?"_valids":"_invalids";i[e]&&(i[e].remove(r),i[e].length||(s("_valids"===t||!i._flags.only,"Setting invalid value",r,"leaves schema rejecting all values due to previous valid rule"),i[e]=null)),i[t].add(r,i._refs)}return i}}};v.Base.prototype[l.symbols.any]={version:l.version,compile:c.compile,root:"$_root"},v.Base.prototype.isImmutable=!0,v.Base.prototype.deny=v.Base.prototype.invalid,v.Base.prototype.disallow=v.Base.prototype.invalid,v.Base.prototype.equal=v.Base.prototype.valid,v.Base.prototype.exist=v.Base.prototype.required,v.Base.prototype.not=v.Base.prototype.invalid,v.Base.prototype.options=v.Base.prototype.prefs,v.Base.prototype.preferences=v.Base.prototype.prefs,e.exports=new v.Base},8652:(e,t,i)=>{const s=i(375),r=i(8571),n=i(8160),a={max:1e3,supported:new Set(["undefined","boolean","number","string"])};t.provider={provision:e=>new a.Cache(e)},a.Cache=class{constructor(e={}){n.assertOptions(e,["max"]),s(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 i=this._map.get(e);if(i)return i.value=t,void this._list.first(i);i=this._list.unshift({key:e,value:t}),this._map.set(e,i),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:i}=e;return t.prev=i,i&&(i.next=t),e===this.tail&&(this.tail=t),e.prev=null,e.next=null,e}}},8160:(e,t,i)=>{const s=i(375),r=i(7916),n=i(5934);let a,o;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=n.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,i="Options"){s(e&&"object"==typeof e&&!Array.isArray(e),"Options must be of type object");const r=Object.keys(e).filter(e=>!t.includes(e));s(0===r.length,`${i} contain unknown keys: ${r}`)},t.checkPreferences=function(e){o=o||i(3378);const t=o.preferences.validate(e);if(t.error)throw new r([t.error.details[0].message])},t.compare=function(e,t,i){switch(i){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,i={}){const r=e&&e[t.symbols.any];return!!r&&(s(i.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,s){a=a||i(6914),e=e||{},s=s||{};const r=Object.assign({},e,s);return s.errors&&e.errors&&(r.errors=Object.assign({},e.errors,s.errors),r.errors.wrap=Object.assign({},e.errors.wrap,s.errors.wrap)),s.messages&&(r.messages=a.compile(s.messages,e.messages)),delete r[t.symbols.prefs],r},t.tryWithPath=function(e,t,i={}){try{return e()}catch(e){throw void 0!==e.path?e.path=t+"."+e.path:e.path=t,i.append&&(e.message=`${e.message} (${e.path})`),e}},t.validateArg=function(e,i,{assert:s,message:r}){if(t.isSchema(s)){const t=s.validate(e);if(!t.error)return;return t.error.message}if(!s(e))return i?`${i} ${r}`:r},t.verifyFlat=function(e,t){for(const i of e)s(!Array.isArray(i),"Method no longer accepts array arguments:",t)}},3292:(e,t,i)=>{const s=i(375),r=i(8160),n=i(6133),a={};t.schema=function(e,t,i={}){r.assertOptions(i,["appendPath","override"]);try{return a.schema(e,t,i)}catch(e){throw i.appendPath&&void 0!==e.path&&(e.message=`${e.message} (${e.path})`),e}},a.schema=function(e,t,i){s(void 0!==t,"Invalid undefined schema"),Array.isArray(t)&&(s(t.length,"Invalid empty array schema"),1===t.length&&(t=t[0]));const n=(t,...s)=>!1!==i.override?t.valid(e.override,...s):t.valid(...s);if(a.simple(t))return n(e,t);if("function"==typeof t)return e.custom(t);if(s("object"==typeof t,"Invalid schema content:",typeof t),r.isResolvable(t))return n(e,t);if(r.isSchema(t))return t;if(Array.isArray(t)){for(const i of t)if(!a.simple(i))return e.alternatives().try(...t);return n(e,...t)}return t instanceof RegExp?e.string().regex(t):t instanceof Date?n(e.date(),t):(s(Object.getPrototypeOf(t)===Object.getPrototypeOf({}),"Schema can only contain plain objects"),e.object().keys(t))},t.ref=function(e,t){return n.isRef(e)?e:n.create(e,t)},t.compile=function(e,i,n={}){r.assertOptions(n,["legacy"]);const o=i&&i[r.symbols.any];if(o)return s(n.legacy||o.version===r.version,"Cannot mix different versions of joi schemas:",o.version,r.version),i;if("object"!=typeof i||!n.legacy)return t.schema(e,i,{appendPath:!0});const l=a.walk(i);return l?l.compile(l.root,i):t.schema(e,i,{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};s(Object.getPrototypeOf(e)===Object.getPrototypeOf({}),"Schema can only contain plain objects");for(const t in e){const i=a.walk(e[t]);if(i)return i}return null},a.simple=function(e){return null===e||["boolean","string","number"].includes(typeof e)},t.when=function(e,i,o){if(void 0===o&&(s(i&&"object"==typeof i,"Missing options"),o=i,i=n.create(".")),Array.isArray(o)&&(o={switch:o}),r.assertOptions(o,["is","not","then","otherwise","switch","break"]),r.isSchema(i))return s(void 0===o.is,'"is" can not be used with a schema condition'),s(void 0===o.not,'"not" can not be used with a schema condition'),s(void 0===o.switch,'"switch" can not be used with a schema condition'),a.condition(e,{is:i,then:o.then,otherwise:o.otherwise,break:o.break});if(s(n.isRef(i)||"string"==typeof i,"Invalid condition:",i),s(void 0===o.not||void 0===o.is,'Cannot combine "is" with "not"'),void 0===o.switch){let l=o;void 0!==o.not&&(l={is:o.not,then:o.otherwise,otherwise:o.then,break:o.break});let c=void 0!==l.is?e.$_compile(l.is):e.$_root.invalid(null,!1,0,"").required();return s(void 0!==l.then||void 0!==l.otherwise,'options must have at least one of "then", "otherwise", or "switch"'),s(void 0===l.break||void 0===l.then||void 0===l.otherwise,"Cannot specify then, otherwise, and break all together"),void 0===o.is||n.isRef(o.is)||r.isSchema(o.is)||(c=c.required()),a.condition(e,{ref:t.ref(i),is:c,then:l.then,otherwise:l.otherwise,break:l.break})}s(Array.isArray(o.switch),'"switch" must be an array'),s(void 0===o.is,'Cannot combine "switch" with "is"'),s(void 0===o.not,'Cannot combine "switch" with "not"'),s(void 0===o.then,'Cannot combine "switch" with "then"');const l={ref:t.ref(i),switch:[],break:o.break};for(let t=0;t<o.switch.length;++t){const i=o.switch[t],a=t===o.switch.length-1;r.assertOptions(i,a?["is","then","otherwise"]:["is","then"]),s(void 0!==i.is,'Switch statement missing "is"'),s(void 0!==i.then,'Switch statement missing "then"');const c={is:e.$_compile(i.is),then:e.$_compile(i.then)};if(n.isRef(i.is)||r.isSchema(i.is)||(c.is=c.is.required()),a){s(void 0===o.otherwise||void 0===i.otherwise,'Cannot specify "otherwise" inside and outside a "switch"');const t=void 0!==o.otherwise?o.otherwise:i.otherwise;void 0!==t&&(s(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 i of["then","otherwise"])void 0===t[i]?delete t[i]:t[i]=e.$_compile(t[i]);return t}},6354:(e,t,i)=>{const s=i(5688),r=i(8160),n=i(3328);t.Report=class{constructor(e,i,s,r,n,a,o){if(this.code=e,this.flags=r,this.messages=n,this.path=a.path,this.prefs=o,this.state=a,this.value=i,this.message=null,this.template=null,this.local=s||{},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,i){return t.template(this.value,e,i||this.code,this.state,this.prefs)}},t.path=function(e){let t="";for(const i of e)"object"!=typeof i&&("string"==typeof i?(t&&(t+="."),t+=i):t+=`[${i}]`);return t},t.template=function(e,t,i,s,a){if(!t)return;if(n.isTemplate(t))return"root"!==i?t:null;let o=a.errors.language;if(r.isResolvable(o)&&(o=o.resolve(e,s,a)),o&&t[o]){if(void 0!==t[o][i])return t[o][i];if(void 0!==t[o]["*"])return t[o]["*"]}return t[i]?t[i]:t["*"]},t.label=function(e,i,s,r){if(!s.errors.label)return"";if(e.label)return e.label;let n=i.path;return"key"===s.errors.label&&i.path.length>1&&(n=i.path.slice(-1)),t.path(n)||t.template(null,s.messages,"root",i,s)||r&&t.template(null,r,"root",i,s)||"value"},t.process=function(e,i,s){if(!e)return null;const{override:r,message:n,details:a}=t.details(e);if(r)return r;if(s.errors.stack)return new t.ValidationError(n,a,i);const o=Error.stackTraceLimit;Error.stackTraceLimit=0;const l=new t.ValidationError(n,a,i);return Error.stackTraceLimit=o,l},t.details=function(e,t={}){let i=[];const s=[];for(const r of e){if(r instanceof Error){if(!1!==t.override)return{override:r};const e=r.toString();i.push(e),s.push({message:e,type:"override",context:{error:r}});continue}const e=r.toString();i.push(e),s.push({message:e,path:r.path.filter(e=>"object"!=typeof e),type:r.code,context:r.local})}return i.length>1&&(i=[...new Set(i)]),{message:i.join(". "),details:s}},t.ValidationError=class extends Error{constructor(e,t,i){super(e),this._original=i,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=s.error},8901:(e,t,i)=>{const s=i(375),r=i(8571),n=i(8160),a=i(6914),o={};t.type=function(e,t){const i=Object.getPrototypeOf(e),l=r(i),c=e._assign(Object.create(l)),d=Object.assign({},t);delete d.base,l._definition=d;const u=i._definition||{};d.messages=a.merge(u.messages,d.messages),d.properties=Object.assign({},u.properties,d.properties),c.type=d.type,d.flags=Object.assign({},u.flags,d.flags);const f=Object.assign({},u.terms);if(d.terms)for(const e in d.terms){const t=d.terms[e];s(void 0===c.$_terms[e],"Invalid term override for",d.type,e),c.$_terms[e]=t.init,f[e]=t}d.terms=f,d.args||(d.args=u.args),d.prepare=o.prepare(d.prepare,u.prepare),d.coerce&&("function"==typeof d.coerce&&(d.coerce={method:d.coerce}),d.coerce.from&&!Array.isArray(d.coerce.from)&&(d.coerce={method:d.coerce.method,from:[].concat(d.coerce.from)})),d.coerce=o.coerce(d.coerce,u.coerce),d.validate=o.validate(d.validate,u.validate);const p=Object.assign({},u.rules);if(d.rules)for(const e in d.rules){const t=d.rules[e];s("object"==typeof t,"Invalid rule definition for",d.type,e);let i=t.method;if(void 0===i&&(i=function(){return this.$_addRule(e)}),i&&(s(!l[e],"Rule conflict in",d.type,e),l[e]=i),s(!p[e],"Rule conflict in",d.type,e),p[e]=t,t.alias){const e=[].concat(t.alias);for(const i of e)l[i]=t.method}t.args&&(t.argsByName=new Map,t.args=t.args.map(e=>("string"==typeof e&&(e={name:e}),s(!t.argsByName.has(e.name),"Duplicated argument name",e.name),n.isSchema(e.assert)&&(e.assert=e.assert.strict().label(e.name)),t.argsByName.set(e.name,e),e)))}d.rules=p;const h=Object.assign({},u.modifiers);if(d.modifiers)for(const e in d.modifiers){s(!l[e],"Rule conflict in",d.type,e);const t=d.modifiers[e];s("function"==typeof t,"Invalid modifier definition for",d.type,e);const i=function(t){return this.rule({[e]:t})};l[e]=i,h[e]=t}if(d.modifiers=h,d.overrides){l._super=i,c.$_super={};for(const e in d.overrides)s(i[e],"Cannot override missing",e),d.overrides[e][n.symbols.parent]=i[e],c.$_super[e]=i[e].bind(c);Object.assign(l,d.overrides)}d.cast=Object.assign({},u.cast,d.cast);const m=Object.assign({},u.manifest,d.manifest);return m.build=o.build(d.manifest&&d.manifest.build,u.manifest&&u.manifest.build),d.manifest=m,d.rebuild=o.rebuild(d.rebuild,u.rebuild),c},o.build=function(e,t){return e&&t?function(i,s){return t(e(i,s),s)}:e||t},o.coerce=function(e,t){return e&&t?{from:e.from&&t.from?[...new Set([...e.from,...t.from])]:null,method(i,s){let r;if((!t.from||t.from.includes(typeof i))&&(r=t.method(i,s),r)){if(r.errors||void 0===r.value)return r;i=r.value}if(!e.from||e.from.includes(typeof i)){const t=e.method(i,s);if(t)return t}return r}}:e||t},o.prepare=function(e,t){return e&&t?function(i,s){const r=e(i,s);if(r){if(r.errors||void 0===r.value)return r;i=r.value}return t(i,s)||r}:e||t},o.rebuild=function(e,t){return e&&t?function(i){t(i),e(i)}:e||t},o.validate=function(e,t){return e&&t?function(i,s){const r=t(i,s);if(r){if(r.errors&&(!Array.isArray(r.errors)||r.errors.length))return r;i=r.value}return e(i,s)||r}:e||t}},5107:(e,t,i)=>{const s=i(375),r=i(8571),n=i(8652),a=i(8160),o=i(3292),l=i(6354),c=i(8901),d=i(9708),u=i(6133),f=i(3328),p=i(1152);let h;const m={types:{alternatives:i(4946),any:i(8068),array:i(546),boolean:i(4937),date:i(7500),function:i(390),link:i(8785),number:i(3832),object:i(8966),string:i(7417),symbol:i(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 s(!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 i=m.aliases[t];e[t]=e[i]}return e.x=e.expression,p.setup&&p.setup(e),e}};m.methods={ValidationError:l.ValidationError,version:a.version,cache:n.provider,assert(e,t,...i){m.assert(e,t,!0,i)},attempt:(e,t,...i)=>m.assert(e,t,!1,i),build(e){return s("function"==typeof d.build,"Manifest functionality disabled"),d.build(this,e)},checkPreferences(e){a.checkPreferences(e)},compile(e,t){return o.compile(this,e,t)},defaults(e){s("function"==typeof e,"modifier must be a function");const t=Object.assign({},this);for(const i of t._types){const r=e(t[i]());s(a.isSchema(r),"modifier must return a valid schema object"),t[i]=function(...e){return m.generate(this,r,e)}}return t},expression:(...e)=>new f(...e),extend(...e){a.verifyFlat(e,"extend"),h=h||i(3378),s(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 i of e){"function"==typeof i&&(i=i(t)),this.assert(i,h.extension);const e=m.expandExtension(i,t);for(const i of e){s(void 0===t[i.type]||t._types.has(i.type),"Cannot override name",i.type);const e=i.base||this.any(),r=c.type(e,i);t._types.add(i.type),t[i.type]=function(...e){return m.generate(this,r,e)}}}return t},isError:l.ValidationError.isError,isExpression:f.isTemplate,isRef:u.isRef,isSchema:a.isSchema,in:(...e)=>u.in(...e),override:a.symbols.override,ref:(...e)=>u.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,i,s){const n=s[0]instanceof Error||"string"==typeof s[0]?s[0]:null,o=null!==n?s[1]:s[0],c=t.validate(e,a.preferences({errors:{stack:!0}},o||{}));let d=c.error;if(!d)return c.value;if(n instanceof Error)throw n;const u=i&&"function"==typeof d.annotate?d.annotate():d.message;throw d instanceof l.ValidationError==0&&(d=r(d)),d.message=n?`${n} ${u}`:u,d},m.generate=function(e,t,i){return s(e,"Must be invoked on a Joi instance."),t.$_root=e,t._definition.args&&i.length?t._definition.args(t,...i):t},m.expandExtension=function(e,t){if("string"==typeof e.type)return[e];const i=[];for(const s of t._types)if(e.type.test(s)){const r=Object.assign({},e);r.type=s,r.base=t[s](),i.push(r)}return i},e.exports=m.root()},6914:(e,t,i)=>{const s=i(375),r=i(8571),n=i(3328);t.compile=function(e,t){if("string"==typeof e)return s(!t,"Cannot set single message string"),new n(e);if(n.isTemplate(e))return s(!t,"Cannot set single message template"),e;s("object"==typeof e&&!Array.isArray(e),"Invalid message options"),t=t?r(t):{};for(let i in e){const r=e[i];if("root"===i||n.isTemplate(r)){t[i]=r;continue}if("string"==typeof r){t[i]=new n(r);continue}s("object"==typeof r&&!Array.isArray(r),"Invalid message for",i);const a=i;for(i in t[a]=t[a]||{},r){const e=r[i];"root"===i||n.isTemplate(e)?t[a][i]=e:(s("string"==typeof e,"Invalid message for",i,"in",a),t[a][i]=new n(e))}}return t},t.decompile=function(e){const t={};for(let i in e){const s=e[i];if("root"===i){t.root=s;continue}if(n.isTemplate(s)){t[i]=s.describe({compact:!0});continue}const r=i;for(i in t[r]={},s){const e=s[i];"root"!==i?t[r][i]=e.describe({compact:!0}):t[r].root=e}}return t},t.merge=function(e,i){if(!e)return t.compile(i);if(!i)return e;if("string"==typeof i)return new n(i);if(n.isTemplate(i))return i;const a=r(e);for(let e in i){const t=i[e];if("root"===e||n.isTemplate(t)){a[e]=t;continue}if("string"==typeof t){a[e]=new n(t);continue}s("object"==typeof t&&!Array.isArray(t),"Invalid message for",e);const r=e;for(e in a[r]=a[r]||{},t){const i=t[e];"root"===e||n.isTemplate(i)?a[r][e]=i:(s("string"==typeof i,"Invalid message for",e,"in",r),a[r][e]=new n(i))}}return a}},2294:(e,t,i)=>{const s=i(375),r=i(8160),n=i(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,i]of e._byId.entries())s(!this._byKey.has(t),"Schema id conflicts with existing key:",t),this._byId.set(t,i);for(const[t,i]of e._byKey.entries())s(!this._byId.has(t),"Schema key conflicts with existing id:",t),this._byKey.set(t,i)}fork(e,t,i){const n=this._collect(e);n.push({schema:i});const o=n.shift();let l={id:o.id,schema:t(o.schema)};s(r.isSchema(l.schema),"adjuster function failed to return a joi schema type");for(const e of n)l={id:e.id,schema:a.fork(e.schema,l.id,l.schema)};return l.schema}labels(e,t=[]){const i=e[0],s=this._get(i);if(!s)return[...t,...e].join(".");const r=e.slice(1);return t=[...t,s.schema._flags.label||i],r.length?s.schema._ids.labels(r,t):t.join(".")}reach(e,t=[]){const i=e[0],r=this._get(i);s(r,"Schema does not contain path",[...t,...e].join("."));const n=e.slice(1);return n.length?r.schema._ids.reach(n,[...t,i]):r.schema}register(e,{key:t}={}){if(!e||!r.isSchema(e))return;(e.$_property("schemaChain")||e._ids._schemaChain)&&(this._schemaChain=!0);const i=e._flags.id;if(i){const t=this._byId.get(i);s(!t||t.schema===e,"Cannot add different schemas with the same id:",i),s(!this._byKey.has(i),"Schema id conflicts with existing key:",i),this._byId.set(i,{schema:e,id:i})}t&&(s(!this._byKey.has(t),"Schema already contains key:",t),s(!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=[],i=[]){const r=e[0],n=this._get(r);s(n,"Schema does not contain path",[...t,...e].join(".")),i=[n,...i];const a=e.slice(1);return a.length?n.schema._ids._collect(a,[...t,r],i):i}_get(e){return this._byId.get(e)||this._byKey.get(e)}},a.fork=function(e,i,s){const r=t.schema(e,{each:(e,{key:t})=>{if(i===(e._flags.id||t))return s},ref:!1});return r?r.$_mutateRebuild():e},t.schema=function(e,t){let i;for(const s in e._flags){if("_"===s[0])continue;const r=a.scan(e._flags[s],{source:"flags",name:s},t);void 0!==r&&(i=i||e.clone(),i._flags[s]=r)}for(let s=0;s<e._rules.length;++s){const r=e._rules[s],n=a.scan(r.args,{source:"rules",name:r.name},t);if(void 0!==n){i=i||e.clone();const t=Object.assign({},r);t.args=n,i._rules[s]=t,i._singleRules.get(r.name)===r&&i._singleRules.set(r.name,t)}}for(const s in e.$_terms){if("_"===s[0])continue;const r=a.scan(e.$_terms[s],{source:"terms",name:s},t);void 0!==r&&(i=i||e.clone(),i.$_terms[s]=r)}return i},a.scan=function(e,t,i,s,o){const l=s||[];if(null===e||"object"!=typeof e)return;let c;if(Array.isArray(e)){for(let s=0;s<e.length;++s){const r="terms"===t.source&&"keys"===t.name&&e[s].key,n=a.scan(e[s],t,i,[s,...l],r);void 0!==n&&(c=c||e.slice(),c[s]=n)}return c}if(!1!==i.schema&&r.isSchema(e)||!1!==i.ref&&n.isRef(e)){const s=i.each(e,{...t,path:l,key:o});if(s===e)return;return s}for(const s in e){if("_"===s[0])continue;const r=a.scan(e[s],t,i,[s,...l],o);void 0!==r&&(c=c||Object.assign({},e),c[s]=r)}return c}},6133:(e,t,i)=>{const s=i(375),r=i(8571),n=i(9621),a=i(8160);let o;const l={symbol:Symbol("ref"),defaults:{adjust:null,in:!1,iterables:null,map:null,separator:".",type:"value"}};t.create=function(e,t={}){s("string"==typeof e,"Invalid reference key:",e),a.assertOptions(t,["adjust","ancestor","in","iterables","map","prefix","render","separator"]),s(!t.prefix||"object"==typeof t.prefix,"options.prefix must be of type object");const i=Object.assign({},l.defaults,t);delete i.prefix;const r=i.separator,n=l.context(e,r,t.prefix);if(i.type=n.type,e=n.key,"value"===i.type)if(n.root&&(s(!r||e[0]!==r,"Cannot specify relative path with root prefix"),i.ancestor="root",e||(e=null)),r&&r===e)e=null,i.ancestor=0;else if(void 0!==i.ancestor)s(!r||!e||e[0]!==r,"Cannot combine prefix with ancestor option");else{const[t,s]=l.ancestor(e,r);s&&""===(e=e.slice(s))&&(e=null),i.ancestor=t}return i.path=r?null===e?[]:e.split(r):[e],new l.Ref(i)},t.in=function(e,i={}){return t.create(e,{...i,in:!0})},t.isRef=function(e){return!!e&&!!e[a.symbols.ref]},l.Ref=class{constructor(e){s("object"==typeof e,"Invalid reference construction"),a.assertOptions(e,["adjust","ancestor","in","iterables","map","path","render","separator","type","depth","key","root","display"]),s([!1,void 0].includes(e.separator)||"string"==typeof e.separator&&1===e.separator.length,"Invalid separator"),s(!e.adjust||"function"==typeof e.adjust,"options.adjust must be a function"),s(!e.map||Array.isArray(e.map),"options.map must be an array"),s(!e.map||!e.adjust,"Cannot set both map and adjust options"),Object.assign(this,l.defaults,e),s("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,i,r,n={}){return s(!this.in||n.in,"Invalid in() reference usage"),"global"===this.type?this._resolve(i.context,t,n):"local"===this.type?this._resolve(r,t,n):this.ancestor?"root"===this.ancestor?this._resolve(t.ancestors[t.ancestors.length-1],t,n):(s(this.ancestor<=t.ancestors.length,"Invalid reference exceeds the schema root:",this.display),this._resolve(t.ancestors[this.ancestor-1],t,n)):this._resolve(e,t,n)}_resolve(e,t,i){let s;if("value"===this.type&&t.mainstay.shadow&&!1!==i.shadow&&(s=t.mainstay.shadow.get(this.absolute(t))),void 0===s&&(s=n(e,this.path,{iterables:this.iterables,functions:!0})),this.adjust&&(s=this.adjust(s)),this.map){const e=this.map.get(s);void 0!==e&&(s=e)}return t.mainstay&&t.mainstay.tracer.resolve(t,this,s),s}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,i={}){if(e=e.trim(),i){const s=void 0===i.global?"$":i.global;if(s!==t&&e.startsWith(s))return{key:e.slice(s.length),type:"global"};const r=void 0===i.local?"#":i.local;if(r!==t&&e.startsWith(r))return{key:e.slice(r.length),type:"local"};const n=void 0===i.root?"/":i.root;if(n!==t&&e.startsWith(n))return{key:e.slice(n.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 i=2;for(;e[i]===t;)++i;return[i-1,i]},t.toSibling=0,t.toParent=1,t.Manager=class{constructor(){this.refs=[]}register(e,s){if(e)if(s=void 0===s?t.toParent:s,Array.isArray(e))for(const t of e)this.register(t,s);else if(a.isSchema(e))for(const t of e._refs.refs)t.ancestor-s>=0&&this.refs.push({ancestor:t.ancestor-s,root:t.root});else t.isRef(e)&&"value"===e.type&&e.ancestor-s>=0&&this.refs.push({ancestor:e.ancestor-s,root:e.root}),o=o||i(3328),o.isTemplate(e)&&this.register(e.refs(),s)}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,i)=>{const s=i(5107),r={};r.wrap=s.string().min(1).max(2).allow(!1),t.preferences=s.object({allowUnknown:s.boolean(),abortEarly:s.boolean(),artifacts:s.boolean(),cache:s.boolean(),context:s.object(),convert:s.boolean(),dateFormat:s.valid("date","iso","string","time","utc"),debug:s.boolean(),errors:{escapeHtml:s.boolean(),label:s.valid("path","key",!1),language:[s.string(),s.object().ref()],render:s.boolean(),stack:s.boolean(),wrap:{label:r.wrap,array:r.wrap,string:r.wrap}},externals:s.boolean(),messages:s.object(),noDefaults:s.boolean(),nonEnumerables:s.boolean(),presence:s.valid("required","optional","forbidden"),skipFunctions:s.boolean(),stripUnknown:s.object({arrays:s.boolean(),objects:s.boolean()}).or("arrays","objects").allow(!0,!1),warnings:s.boolean()}).strict(),r.nameRx=/^[a-zA-Z0-9]\w*$/,r.rule=s.object({alias:s.array().items(s.string().pattern(r.nameRx)).single(),args:s.array().items(s.string(),s.object({name:s.string().pattern(r.nameRx).required(),ref:s.boolean(),assert:s.alternatives([s.function(),s.object().schema()]).conditional("ref",{is:!0,then:s.required()}),normalize:s.function(),message:s.string().when("assert",{is:s.function(),then:s.required()})})),convert:s.boolean(),manifest:s.boolean(),method:s.function().allow(!1),multi:s.boolean(),validate:s.function()}),t.extension=s.object({type:s.alternatives([s.string(),s.object().regex()]).required(),args:s.function(),cast:s.object().pattern(r.nameRx,s.object({from:s.function().maxArity(1).required(),to:s.function().minArity(1).maxArity(2).required()})),base:s.object().schema().when("type",{is:s.object().regex(),then:s.forbidden()}),coerce:[s.function