directus-extension-api-docs 1.6.5 → 1.6.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +1 -1
  2. package/package.json +10 -10
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";const{findWorkspaceDir:s}=require("@pnpm/find-workspace-dir"),t=require("js-yaml"),e=require("path"),n=require("fs"),o=()=>process.cwd();let a;async function i(s,t){if(a)return JSON.parse(a);const{SpecificationService:e}=s,n=new e({accountability:{admin:!0},schema:t});return a=JSON.stringify(await n.oas.generate()),JSON.parse(a)}function r(s,t){return Object.entries(t).reduce(((s,[t,e])=>(s[t]=e&&"object"==typeof e?r(s[t]=s[t]||(Array.isArray(e)?[]:{}),e):e,s)),s)}const c=require("swagger-ui-express"),p=require("express-openapi-validator"),u=function(){const s=function(){const s={docsPath:"api-docs",info:{},tags:[],publishedTags:[],paths:{},components:{}};try{const a=e.join(o(),"./extensions/endpoints/oasconfig.yaml"),i=t.load(n.readFileSync(a,{encoding:"utf-8"}));return i.docsPath=i.docsPath||s.docsPath,i.info=i.info||s.info,i.tags=i.tags||s.tags,i.paths=i.paths||s.paths,i.components=i.components||s.components,i}catch{return s}}();try{const a=e.join(o(),"./extensions/endpoints"),i=n.readdirSync(a,{withFileTypes:!0});for(const e of i){const o=`${a}/${e.name}/oas.yaml`;if(e.isDirectory()&&n.existsSync(o)){const e=t.load(n.readFileSync(o,{encoding:"utf-8"}));s.tags=[...s.tags,...e.tags||[]],s.paths={...s.paths,...e.paths||{}},s.components=r(s.components||{},e.components||{})}}return s}catch(t){return s}}(),d=u.docsPath;var f={id:d,validate:async function(s,t,e,n){if(null==u?void 0:u.paths){const o=await i(t,e);if(n)for(const s of n)o.paths[s]=u.paths[s];else o.paths=u.paths;u.components?o.components=u.components:(delete o.components.definitions,delete o.components.schemas),s.use(p.middleware({apiSpec:o})),s.use(((s,t,e,n)=>{e.status(s.status||500).json({message:s.message,errors:s.errors})}))}return s},handler:(t,{services:e,exceptions:n,logger:a,getSchema:p})=>{const{ServiceUnavailableException:f}=n,l={swaggerOptions:{url:`/${d}/oas`}};t.use("/",c.serve),t.get("/",c.setup({},l)),t.get("/oas",(async(t,n,c)=>{var d;try{const t=await p(),c=await i(e,t),f=await async function(){try{const t=await s(".");return require(`${t||o()}/package.json`)}catch(s){return{}}}();c.info.title=u.info.title||(null==f?void 0:f.name)||c.info.title,c.info.version=u.info.version||(null==f?void 0:f.version)||c.info.version,c.info.description=u.info.description||(null==f?void 0:f.description)||c.info.description;try{for(const s in u.paths)c.paths[s]=u.paths[s];for(const s of u.tags)c.tags.push(s);c.components=r(u.components,c.components)}catch(s){a.info("No custom definitions")}(null==(d=u.publishedTags)?void 0:d.length)&&function(s,t){for(const e in t.paths)for(const n in t.paths[e]){let o=!1;t.paths[e][n].tags.forEach((t=>{o=o||s.publishedTags.includes(t)})),t.paths[e][n].tags&&(t.paths[e][n].tags=t.paths[e][n].tags.filter((t=>s.publishedTags.includes(t)))),o||delete t.paths[e][n]}t.tags=t.tags.filter((t=>s.publishedTags.includes(t.name)))}(u,c),n.json(c)}catch(s){return c(new f(s.message||s[0].message))}}))}};module.exports=f;
1
+ "use strict";var e,t,r,s=require("url"),n=require("util");!function(e){e.CREATE="create",e.UPDATE="update",e.DELETE="delete",e.REVERT="revert",e.COMMENT="comment",e.UPLOAD="upload",e.LOGIN="login",e.RUN="run"}(e||(e={})),function(e){e.assertEqual=e=>e,e.assertIs=function(e){},e.assertNever=function(e){throw new Error},e.arrayToEnum=e=>{const t={};for(const r of e)t[r]=r;return t},e.getValidEnumValues=t=>{const r=e.objectKeys(t).filter((e=>"number"!=typeof t[t[e]])),s={};for(const e of r)s[e]=t[e];return e.objectValues(s)},e.objectValues=t=>e.objectKeys(t).map((function(e){return t[e]})),e.objectKeys="function"==typeof Object.keys?e=>Object.keys(e):e=>{const t=[];for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.push(r);return t},e.find=(e,t)=>{for(const r of e)if(t(r))return r},e.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&isFinite(e)&&Math.floor(e)===e,e.joinValues=function(e,t=" | "){return e.map((e=>"string"==typeof e?`'${e}'`:e)).join(t)},e.jsonStringifyReplacer=(e,t)=>"bigint"==typeof t?t.toString():t}(t||(t={})),function(e){e.mergeShapes=(e,t)=>({...e,...t})}(r||(r={}));const a=t.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),i=e=>{switch(typeof e){case"undefined":return a.undefined;case"string":return a.string;case"number":return isNaN(e)?a.nan:a.number;case"boolean":return a.boolean;case"function":return a.function;case"bigint":return a.bigint;case"symbol":return a.symbol;case"object":return Array.isArray(e)?a.array:null===e?a.null:e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch?a.promise:"undefined"!=typeof Map&&e instanceof Map?a.map:"undefined"!=typeof Set&&e instanceof Set?a.set:"undefined"!=typeof Date&&e instanceof Date?a.date:a.object;default:return a.unknown}},o=t.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class l extends Error{constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}get errors(){return this.issues}format(e){const t=e||function(e){return e.message},r={_errors:[]},s=e=>{for(const n of e.issues)if("invalid_union"===n.code)n.unionErrors.map(s);else if("invalid_return_type"===n.code)s(n.returnTypeError);else if("invalid_arguments"===n.code)s(n.argumentsError);else if(0===n.path.length)r._errors.push(t(n));else{let e=r,s=0;for(;s<n.path.length;){const r=n.path[s];s===n.path.length-1?(e[r]=e[r]||{_errors:[]},e[r]._errors.push(t(n))):e[r]=e[r]||{_errors:[]},e=e[r],s++}}};return s(this),r}toString(){return this.message}get message(){return JSON.stringify(this.issues,t.jsonStringifyReplacer,2)}get isEmpty(){return 0===this.issues.length}flatten(e=(e=>e.message)){const t={},r=[];for(const s of this.issues)s.path.length>0?(t[s.path[0]]=t[s.path[0]]||[],t[s.path[0]].push(e(s))):r.push(e(s));return{formErrors:r,fieldErrors:t}}get formErrors(){return this.flatten()}}l.create=e=>new l(e);const c=(e,r)=>{let s;switch(e.code){case o.invalid_type:s=e.received===a.undefined?"Required":`Expected ${e.expected}, received ${e.received}`;break;case o.invalid_literal:s=`Invalid literal value, expected ${JSON.stringify(e.expected,t.jsonStringifyReplacer)}`;break;case o.unrecognized_keys:s=`Unrecognized key(s) in object: ${t.joinValues(e.keys,", ")}`;break;case o.invalid_union:s="Invalid input";break;case o.invalid_union_discriminator:s=`Invalid discriminator value. Expected ${t.joinValues(e.options)}`;break;case o.invalid_enum_value:s=`Invalid enum value. Expected ${t.joinValues(e.options)}, received '${e.received}'`;break;case o.invalid_arguments:s="Invalid function arguments";break;case o.invalid_return_type:s="Invalid function return type";break;case o.invalid_date:s="Invalid date";break;case o.invalid_string:"object"==typeof e.validation?"includes"in e.validation?(s=`Invalid input: must include "${e.validation.includes}"`,"number"==typeof e.validation.position&&(s=`${s} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?s=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?s=`Invalid input: must end with "${e.validation.endsWith}"`:t.assertNever(e.validation):s="regex"!==e.validation?`Invalid ${e.validation}`:"Invalid";break;case o.too_small:s="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:"date"===e.type?`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:"Invalid input";break;case o.too_big:s="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"bigint"===e.type?`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"date"===e.type?`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:"Invalid input";break;case o.custom:s="Invalid input";break;case o.invalid_intersection_types:s="Intersection results could not be merged";break;case o.not_multiple_of:s=`Number must be a multiple of ${e.multipleOf}`;break;case o.not_finite:s="Number must be finite";break;default:s=r.defaultError,t.assertNever(e)}return{message:s}};let u=c;function d(){return u}const f=e=>{const{data:t,path:r,errorMaps:s,issueData:n}=e,a=[...r,...n.path||[]],i={...n,path:a};let o="";const l=s.filter((e=>!!e)).slice().reverse();for(const e of l)o=e(i,{data:t,defaultError:o}).message;return{...n,path:a,message:n.message||o}};function h(e,t){const r=f({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,d(),c].filter((e=>!!e))});e.common.issues.push(r)}class p{constructor(){this.value="valid"}dirty(){"valid"===this.value&&(this.value="dirty")}abort(){"aborted"!==this.value&&(this.value="aborted")}static mergeArray(e,t){const r=[];for(const s of t){if("aborted"===s.status)return m;"dirty"===s.status&&e.dirty(),r.push(s.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,t){const r=[];for(const e of t)r.push({key:await e.key,value:await e.value});return p.mergeObjectSync(e,r)}static mergeObjectSync(e,t){const r={};for(const s of t){const{key:t,value:n}=s;if("aborted"===t.status)return m;if("aborted"===n.status)return m;"dirty"===t.status&&e.dirty(),"dirty"===n.status&&e.dirty(),(void 0!==n.value||s.alwaysSet)&&(r[t.value]=n.value)}return{status:e.value,value:r}}}const m=Object.freeze({status:"aborted"}),g=e=>({status:"dirty",value:e}),y=e=>({status:"valid",value:e}),v=e=>"aborted"===e.status,_=e=>"dirty"===e.status,b=e=>"valid"===e.status,A=e=>"undefined"!=typeof Promise&&e instanceof Promise;var E;!function(e){e.errToObj=e=>"string"==typeof e?{message:e}:e||{},e.toString=e=>"string"==typeof e?e:null==e?void 0:e.message}(E||(E={}));class S{constructor(e,t,r,s){this._cachedPath=[],this.parent=e,this.data=t,this._path=r,this._key=s}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const O=(e,t)=>{if(b(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new l(e.common.issues);return this._error=t,this._error}}};function R(e){if(!e)return{};const{errorMap:t,invalid_type_error:r,required_error:s,description:n}=e;if(t&&(r||s))throw new Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');if(t)return{errorMap:t,description:n};return{errorMap:(e,t)=>"invalid_type"!==e.code?{message:t.defaultError}:void 0===t.data?{message:null!=s?s:t.defaultError}:{message:null!=r?r:t.defaultError},description:n}}class w{constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(e){return i(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:i(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new p,ctx:{common:e.parent.common,data:e.data,parsedType:i(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(A(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const r=this.safeParse(e,t);if(r.success)return r.data;throw r.error}safeParse(e,t){var r;const s={common:{issues:[],async:null!==(r=null==t?void 0:t.async)&&void 0!==r&&r,contextualErrorMap:null==t?void 0:t.errorMap},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:i(e)},n=this._parseSync({data:e,path:s.path,parent:s});return O(s,n)}async parseAsync(e,t){const r=await this.safeParseAsync(e,t);if(r.success)return r.data;throw r.error}async safeParseAsync(e,t){const r={common:{issues:[],contextualErrorMap:null==t?void 0:t.errorMap,async:!0},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:i(e)},s=this._parse({data:e,path:r.path,parent:r}),n=await(A(s)?s:Promise.resolve(s));return O(r,n)}refine(e,t){const r=e=>"string"==typeof t||void 0===t?{message:t}:"function"==typeof t?t(e):t;return this._refinement(((t,s)=>{const n=e(t),a=()=>s.addIssue({code:o.custom,...r(t)});return"undefined"!=typeof Promise&&n instanceof Promise?n.then((e=>!!e||(a(),!1))):!!n||(a(),!1)}))}refinement(e,t){return this._refinement(((r,s)=>!!e(r)||(s.addIssue("function"==typeof t?t(r,s):t),!1)))}_refinement(e){return new pe({schema:this,typeName:Re.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return me.create(this,this._def)}nullable(){return ge.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Y.create(this,this._def)}promise(){return he.create(this,this._def)}or(e){return J.create([this,e],this._def)}and(e){return re.create(this,e,this._def)}transform(e){return new pe({...R(this._def),schema:this,typeName:Re.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t="function"==typeof e?e:()=>e;return new ye({...R(this._def),innerType:this,defaultValue:t,typeName:Re.ZodDefault})}brand(){return new Ae({typeName:Re.ZodBranded,type:this,...R(this._def)})}catch(e){const t="function"==typeof e?e:()=>e;return new ve({...R(this._def),innerType:this,catchValue:t,typeName:Re.ZodCatch})}describe(e){return new(0,this.constructor)({...this._def,description:e})}pipe(e){return Ee.create(this,e)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const N=/^c[^\s-]{8,}$/i,I=/^[a-z][a-z0-9]*$/,T=/[0-9A-HJKMNP-TV-Z]{26}/,x=/^([a-f0-9]{8}-[a-f0-9]{4}-[1-5][a-f0-9]{3}-[a-f0-9]{4}-[a-f0-9]{12}|00000000-0000-0000-0000-000000000000)$/i,C=/^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\])|(\[IPv6:(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))\])|([A-Za-z0-9]([A-Za-z0-9-]*[A-Za-z0-9])*(\.[A-Za-z]{2,})+))$/,$=/^(\p{Extended_Pictographic}|\p{Emoji_Component})+$/u,k=/^(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))$/,L=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/;function M(e,t){return!("v4"!==t&&t||!k.test(e))||!("v6"!==t&&t||!L.test(e))}class D extends w{constructor(){super(...arguments),this._regex=(e,t,r)=>this.refinement((t=>e.test(t)),{validation:t,code:o.invalid_string,...E.errToObj(r)}),this.nonempty=e=>this.min(1,E.errToObj(e)),this.trim=()=>new D({...this._def,checks:[...this._def.checks,{kind:"trim"}]}),this.toLowerCase=()=>new D({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]}),this.toUpperCase=()=>new D({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}_parse(e){this._def.coerce&&(e.data=String(e.data));if(this._getType(e)!==a.string){const t=this._getOrReturnCtx(e);return h(t,{code:o.invalid_type,expected:a.string,received:t.parsedType}),m}const r=new p;let s;for(const a of this._def.checks)if("min"===a.kind)e.data.length<a.value&&(s=this._getOrReturnCtx(e,s),h(s,{code:o.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),r.dirty());else if("max"===a.kind)e.data.length>a.value&&(s=this._getOrReturnCtx(e,s),h(s,{code:o.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),r.dirty());else if("length"===a.kind){const t=e.data.length>a.value,n=e.data.length<a.value;(t||n)&&(s=this._getOrReturnCtx(e,s),t?h(s,{code:o.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):n&&h(s,{code:o.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),r.dirty())}else if("email"===a.kind)C.test(e.data)||(s=this._getOrReturnCtx(e,s),h(s,{validation:"email",code:o.invalid_string,message:a.message}),r.dirty());else if("emoji"===a.kind)$.test(e.data)||(s=this._getOrReturnCtx(e,s),h(s,{validation:"emoji",code:o.invalid_string,message:a.message}),r.dirty());else if("uuid"===a.kind)x.test(e.data)||(s=this._getOrReturnCtx(e,s),h(s,{validation:"uuid",code:o.invalid_string,message:a.message}),r.dirty());else if("cuid"===a.kind)N.test(e.data)||(s=this._getOrReturnCtx(e,s),h(s,{validation:"cuid",code:o.invalid_string,message:a.message}),r.dirty());else if("cuid2"===a.kind)I.test(e.data)||(s=this._getOrReturnCtx(e,s),h(s,{validation:"cuid2",code:o.invalid_string,message:a.message}),r.dirty());else if("ulid"===a.kind)T.test(e.data)||(s=this._getOrReturnCtx(e,s),h(s,{validation:"ulid",code:o.invalid_string,message:a.message}),r.dirty());else if("url"===a.kind)try{new URL(e.data)}catch(t){s=this._getOrReturnCtx(e,s),h(s,{validation:"url",code:o.invalid_string,message:a.message}),r.dirty()}else if("regex"===a.kind){a.regex.lastIndex=0;a.regex.test(e.data)||(s=this._getOrReturnCtx(e,s),h(s,{validation:"regex",code:o.invalid_string,message:a.message}),r.dirty())}else if("trim"===a.kind)e.data=e.data.trim();else if("includes"===a.kind)e.data.includes(a.value,a.position)||(s=this._getOrReturnCtx(e,s),h(s,{code:o.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),r.dirty());else if("toLowerCase"===a.kind)e.data=e.data.toLowerCase();else if("toUpperCase"===a.kind)e.data=e.data.toUpperCase();else if("startsWith"===a.kind)e.data.startsWith(a.value)||(s=this._getOrReturnCtx(e,s),h(s,{code:o.invalid_string,validation:{startsWith:a.value},message:a.message}),r.dirty());else if("endsWith"===a.kind)e.data.endsWith(a.value)||(s=this._getOrReturnCtx(e,s),h(s,{code:o.invalid_string,validation:{endsWith:a.value},message:a.message}),r.dirty());else if("datetime"===a.kind){((n=a).precision?n.offset?new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${n.precision}}(([+-]\\d{2}(:?\\d{2})?)|Z)$`):new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${n.precision}}Z$`):0===n.precision?n.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(([+-]\\d{2}(:?\\d{2})?)|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$"):n.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}(:?\\d{2})?)|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$")).test(e.data)||(s=this._getOrReturnCtx(e,s),h(s,{code:o.invalid_string,validation:"datetime",message:a.message}),r.dirty())}else"ip"===a.kind?M(e.data,a.version)||(s=this._getOrReturnCtx(e,s),h(s,{validation:"ip",code:o.invalid_string,message:a.message}),r.dirty()):t.assertNever(a);var n;return{status:r.value,value:e.data}}_addCheck(e){return new D({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...E.errToObj(e)})}url(e){return this._addCheck({kind:"url",...E.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...E.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...E.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...E.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...E.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...E.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...E.errToObj(e)})}datetime(e){var t;return"string"==typeof e?this._addCheck({kind:"datetime",precision:null,offset:!1,message:e}):this._addCheck({kind:"datetime",precision:void 0===(null==e?void 0:e.precision)?null:null==e?void 0:e.precision,offset:null!==(t=null==e?void 0:e.offset)&&void 0!==t&&t,...E.errToObj(null==e?void 0:e.message)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...E.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:null==t?void 0:t.position,...E.errToObj(null==t?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...E.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...E.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...E.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...E.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...E.errToObj(t)})}get isDatetime(){return!!this._def.checks.find((e=>"datetime"===e.kind))}get isEmail(){return!!this._def.checks.find((e=>"email"===e.kind))}get isURL(){return!!this._def.checks.find((e=>"url"===e.kind))}get isEmoji(){return!!this._def.checks.find((e=>"emoji"===e.kind))}get isUUID(){return!!this._def.checks.find((e=>"uuid"===e.kind))}get isCUID(){return!!this._def.checks.find((e=>"cuid"===e.kind))}get isCUID2(){return!!this._def.checks.find((e=>"cuid2"===e.kind))}get isULID(){return!!this._def.checks.find((e=>"ulid"===e.kind))}get isIP(){return!!this._def.checks.find((e=>"ip"===e.kind))}get minLength(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}function j(e,t){const r=(e.toString().split(".")[1]||"").length,s=(t.toString().split(".")[1]||"").length,n=r>s?r:s;return parseInt(e.toFixed(n).replace(".",""))%parseInt(t.toFixed(n).replace(".",""))/Math.pow(10,n)}D.create=e=>{var t;return new D({checks:[],typeName:Re.ZodString,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...R(e)})};class P extends w{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){this._def.coerce&&(e.data=Number(e.data));if(this._getType(e)!==a.number){const t=this._getOrReturnCtx(e);return h(t,{code:o.invalid_type,expected:a.number,received:t.parsedType}),m}let r;const s=new p;for(const n of this._def.checks)if("int"===n.kind)t.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),h(r,{code:o.invalid_type,expected:"integer",received:"float",message:n.message}),s.dirty());else if("min"===n.kind){(n.inclusive?e.data<n.value:e.data<=n.value)&&(r=this._getOrReturnCtx(e,r),h(r,{code:o.too_small,minimum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),s.dirty())}else if("max"===n.kind){(n.inclusive?e.data>n.value:e.data>=n.value)&&(r=this._getOrReturnCtx(e,r),h(r,{code:o.too_big,maximum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),s.dirty())}else"multipleOf"===n.kind?0!==j(e.data,n.value)&&(r=this._getOrReturnCtx(e,r),h(r,{code:o.not_multiple_of,multipleOf:n.value,message:n.message}),s.dirty()):"finite"===n.kind?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),h(r,{code:o.not_finite,message:n.message}),s.dirty()):t.assertNever(n);return{status:s.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,E.toString(t))}gt(e,t){return this.setLimit("min",e,!1,E.toString(t))}lte(e,t){return this.setLimit("max",e,!0,E.toString(t))}lt(e,t){return this.setLimit("max",e,!1,E.toString(t))}setLimit(e,t,r,s){return new P({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:E.toString(s)}]})}_addCheck(e){return new P({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:E.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:E.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:E.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:E.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:E.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:E.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:E.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:E.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:E.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find((e=>"int"===e.kind||"multipleOf"===e.kind&&t.isInteger(e.value)))}get isFinite(){let e=null,t=null;for(const r of this._def.checks){if("finite"===r.kind||"int"===r.kind||"multipleOf"===r.kind)return!0;"min"===r.kind?(null===t||r.value>t)&&(t=r.value):"max"===r.kind&&(null===e||r.value<e)&&(e=r.value)}return Number.isFinite(t)&&Number.isFinite(e)}}P.create=e=>new P({checks:[],typeName:Re.ZodNumber,coerce:(null==e?void 0:e.coerce)||!1,...R(e)});class B extends w{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){this._def.coerce&&(e.data=BigInt(e.data));if(this._getType(e)!==a.bigint){const t=this._getOrReturnCtx(e);return h(t,{code:o.invalid_type,expected:a.bigint,received:t.parsedType}),m}let r;const s=new p;for(const n of this._def.checks)if("min"===n.kind){(n.inclusive?e.data<n.value:e.data<=n.value)&&(r=this._getOrReturnCtx(e,r),h(r,{code:o.too_small,type:"bigint",minimum:n.value,inclusive:n.inclusive,message:n.message}),s.dirty())}else if("max"===n.kind){(n.inclusive?e.data>n.value:e.data>=n.value)&&(r=this._getOrReturnCtx(e,r),h(r,{code:o.too_big,type:"bigint",maximum:n.value,inclusive:n.inclusive,message:n.message}),s.dirty())}else"multipleOf"===n.kind?e.data%n.value!==BigInt(0)&&(r=this._getOrReturnCtx(e,r),h(r,{code:o.not_multiple_of,multipleOf:n.value,message:n.message}),s.dirty()):t.assertNever(n);return{status:s.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,E.toString(t))}gt(e,t){return this.setLimit("min",e,!1,E.toString(t))}lte(e,t){return this.setLimit("max",e,!0,E.toString(t))}lt(e,t){return this.setLimit("max",e,!1,E.toString(t))}setLimit(e,t,r,s){return new B({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:E.toString(s)}]})}_addCheck(e){return new B({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:E.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:E.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:E.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:E.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:E.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}B.create=e=>{var t;return new B({checks:[],typeName:Re.ZodBigInt,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...R(e)})};class U extends w{_parse(e){this._def.coerce&&(e.data=Boolean(e.data));if(this._getType(e)!==a.boolean){const t=this._getOrReturnCtx(e);return h(t,{code:o.invalid_type,expected:a.boolean,received:t.parsedType}),m}return y(e.data)}}U.create=e=>new U({typeName:Re.ZodBoolean,coerce:(null==e?void 0:e.coerce)||!1,...R(e)});class G extends w{_parse(e){this._def.coerce&&(e.data=new Date(e.data));if(this._getType(e)!==a.date){const t=this._getOrReturnCtx(e);return h(t,{code:o.invalid_type,expected:a.date,received:t.parsedType}),m}if(isNaN(e.data.getTime())){return h(this._getOrReturnCtx(e),{code:o.invalid_date}),m}const r=new p;let s;for(const n of this._def.checks)"min"===n.kind?e.data.getTime()<n.value&&(s=this._getOrReturnCtx(e,s),h(s,{code:o.too_small,message:n.message,inclusive:!0,exact:!1,minimum:n.value,type:"date"}),r.dirty()):"max"===n.kind?e.data.getTime()>n.value&&(s=this._getOrReturnCtx(e,s),h(s,{code:o.too_big,message:n.message,inclusive:!0,exact:!1,maximum:n.value,type:"date"}),r.dirty()):t.assertNever(n);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new G({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:E.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:E.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return null!=e?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return null!=e?new Date(e):null}}G.create=e=>new G({checks:[],coerce:(null==e?void 0:e.coerce)||!1,typeName:Re.ZodDate,...R(e)});class F extends w{_parse(e){if(this._getType(e)!==a.symbol){const t=this._getOrReturnCtx(e);return h(t,{code:o.invalid_type,expected:a.symbol,received:t.parsedType}),m}return y(e.data)}}F.create=e=>new F({typeName:Re.ZodSymbol,...R(e)});class Z extends w{_parse(e){if(this._getType(e)!==a.undefined){const t=this._getOrReturnCtx(e);return h(t,{code:o.invalid_type,expected:a.undefined,received:t.parsedType}),m}return y(e.data)}}Z.create=e=>new Z({typeName:Re.ZodUndefined,...R(e)});class H extends w{_parse(e){if(this._getType(e)!==a.null){const t=this._getOrReturnCtx(e);return h(t,{code:o.invalid_type,expected:a.null,received:t.parsedType}),m}return y(e.data)}}H.create=e=>new H({typeName:Re.ZodNull,...R(e)});class X extends w{constructor(){super(...arguments),this._any=!0}_parse(e){return y(e.data)}}X.create=e=>new X({typeName:Re.ZodAny,...R(e)});class K extends w{constructor(){super(...arguments),this._unknown=!0}_parse(e){return y(e.data)}}K.create=e=>new K({typeName:Re.ZodUnknown,...R(e)});class V extends w{_parse(e){const t=this._getOrReturnCtx(e);return h(t,{code:o.invalid_type,expected:a.never,received:t.parsedType}),m}}V.create=e=>new V({typeName:Re.ZodNever,...R(e)});class W extends w{_parse(e){if(this._getType(e)!==a.undefined){const t=this._getOrReturnCtx(e);return h(t,{code:o.invalid_type,expected:a.void,received:t.parsedType}),m}return y(e.data)}}W.create=e=>new W({typeName:Re.ZodVoid,...R(e)});class Y extends w{_parse(e){const{ctx:t,status:r}=this._processInputParams(e),s=this._def;if(t.parsedType!==a.array)return h(t,{code:o.invalid_type,expected:a.array,received:t.parsedType}),m;if(null!==s.exactLength){const e=t.data.length>s.exactLength.value,n=t.data.length<s.exactLength.value;(e||n)&&(h(t,{code:e?o.too_big:o.too_small,minimum:n?s.exactLength.value:void 0,maximum:e?s.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:s.exactLength.message}),r.dirty())}if(null!==s.minLength&&t.data.length<s.minLength.value&&(h(t,{code:o.too_small,minimum:s.minLength.value,type:"array",inclusive:!0,exact:!1,message:s.minLength.message}),r.dirty()),null!==s.maxLength&&t.data.length>s.maxLength.value&&(h(t,{code:o.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),r.dirty()),t.common.async)return Promise.all([...t.data].map(((e,r)=>s.type._parseAsync(new S(t,e,t.path,r))))).then((e=>p.mergeArray(r,e)));const n=[...t.data].map(((e,r)=>s.type._parseSync(new S(t,e,t.path,r))));return p.mergeArray(r,n)}get element(){return this._def.type}min(e,t){return new Y({...this._def,minLength:{value:e,message:E.toString(t)}})}max(e,t){return new Y({...this._def,maxLength:{value:e,message:E.toString(t)}})}length(e,t){return new Y({...this._def,exactLength:{value:e,message:E.toString(t)}})}nonempty(e){return this.min(1,e)}}function z(e){if(e instanceof q){const t={};for(const r in e.shape){const s=e.shape[r];t[r]=me.create(z(s))}return new q({...e._def,shape:()=>t})}return e instanceof Y?new Y({...e._def,type:z(e.element)}):e instanceof me?me.create(z(e.unwrap())):e instanceof ge?ge.create(z(e.unwrap())):e instanceof se?se.create(e.items.map((e=>z(e)))):e}Y.create=(e,t)=>new Y({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Re.ZodArray,...R(t)});class q extends w{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(null!==this._cached)return this._cached;const e=this._def.shape(),r=t.objectKeys(e);return this._cached={shape:e,keys:r}}_parse(e){if(this._getType(e)!==a.object){const t=this._getOrReturnCtx(e);return h(t,{code:o.invalid_type,expected:a.object,received:t.parsedType}),m}const{status:t,ctx:r}=this._processInputParams(e),{shape:s,keys:n}=this._getCached(),i=[];if(!(this._def.catchall instanceof V&&"strip"===this._def.unknownKeys))for(const e in r.data)n.includes(e)||i.push(e);const l=[];for(const e of n){const t=s[e],n=r.data[e];l.push({key:{status:"valid",value:e},value:t._parse(new S(r,n,r.path,e)),alwaysSet:e in r.data})}if(this._def.catchall instanceof V){const e=this._def.unknownKeys;if("passthrough"===e)for(const e of i)l.push({key:{status:"valid",value:e},value:{status:"valid",value:r.data[e]}});else if("strict"===e)i.length>0&&(h(r,{code:o.unrecognized_keys,keys:i}),t.dirty());else if("strip"!==e)throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const e=this._def.catchall;for(const t of i){const s=r.data[t];l.push({key:{status:"valid",value:t},value:e._parse(new S(r,s,r.path,t)),alwaysSet:t in r.data})}}return r.common.async?Promise.resolve().then((async()=>{const e=[];for(const t of l){const r=await t.key;e.push({key:r,value:await t.value,alwaysSet:t.alwaysSet})}return e})).then((e=>p.mergeObjectSync(t,e))):p.mergeObjectSync(t,l)}get shape(){return this._def.shape()}strict(e){return E.errToObj,new q({...this._def,unknownKeys:"strict",...void 0!==e?{errorMap:(t,r)=>{var s,n,a,i;const o=null!==(a=null===(n=(s=this._def).errorMap)||void 0===n?void 0:n.call(s,t,r).message)&&void 0!==a?a:r.defaultError;return"unrecognized_keys"===t.code?{message:null!==(i=E.errToObj(e).message)&&void 0!==i?i:o}:{message:o}}}:{}})}strip(){return new q({...this._def,unknownKeys:"strip"})}passthrough(){return new q({...this._def,unknownKeys:"passthrough"})}extend(e){return new q({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new q({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:Re.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new q({...this._def,catchall:e})}pick(e){const r={};return t.objectKeys(e).forEach((t=>{e[t]&&this.shape[t]&&(r[t]=this.shape[t])})),new q({...this._def,shape:()=>r})}omit(e){const r={};return t.objectKeys(this.shape).forEach((t=>{e[t]||(r[t]=this.shape[t])})),new q({...this._def,shape:()=>r})}deepPartial(){return z(this)}partial(e){const r={};return t.objectKeys(this.shape).forEach((t=>{const s=this.shape[t];e&&!e[t]?r[t]=s:r[t]=s.optional()})),new q({...this._def,shape:()=>r})}required(e){const r={};return t.objectKeys(this.shape).forEach((t=>{if(e&&!e[t])r[t]=this.shape[t];else{let e=this.shape[t];for(;e instanceof me;)e=e._def.innerType;r[t]=e}})),new q({...this._def,shape:()=>r})}keyof(){return ue(t.objectKeys(this.shape))}}q.create=(e,t)=>new q({shape:()=>e,unknownKeys:"strip",catchall:V.create(),typeName:Re.ZodObject,...R(t)}),q.strictCreate=(e,t)=>new q({shape:()=>e,unknownKeys:"strict",catchall:V.create(),typeName:Re.ZodObject,...R(t)}),q.lazycreate=(e,t)=>new q({shape:e,unknownKeys:"strip",catchall:V.create(),typeName:Re.ZodObject,...R(t)});class J extends w{_parse(e){const{ctx:t}=this._processInputParams(e),r=this._def.options;if(t.common.async)return Promise.all(r.map((async e=>{const r={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:r}),ctx:r}}))).then((function(e){for(const t of e)if("valid"===t.result.status)return t.result;for(const r of e)if("dirty"===r.result.status)return t.common.issues.push(...r.ctx.common.issues),r.result;const r=e.map((e=>new l(e.ctx.common.issues)));return h(t,{code:o.invalid_union,unionErrors:r}),m}));{let e;const s=[];for(const n of r){const r={...t,common:{...t.common,issues:[]},parent:null},a=n._parseSync({data:t.data,path:t.path,parent:r});if("valid"===a.status)return a;"dirty"!==a.status||e||(e={result:a,ctx:r}),r.common.issues.length&&s.push(r.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;const n=s.map((e=>new l(e)));return h(t,{code:o.invalid_union,unionErrors:n}),m}}get options(){return this._def.options}}J.create=(e,t)=>new J({options:e,typeName:Re.ZodUnion,...R(t)});const Q=e=>e instanceof le?Q(e.schema):e instanceof pe?Q(e.innerType()):e instanceof ce?[e.value]:e instanceof de?e.options:e instanceof fe?Object.keys(e.enum):e instanceof ye?Q(e._def.innerType):e instanceof Z?[void 0]:e instanceof H?[null]:null;class ee extends w{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==a.object)return h(t,{code:o.invalid_type,expected:a.object,received:t.parsedType}),m;const r=this.discriminator,s=t.data[r],n=this.optionsMap.get(s);return n?t.common.async?n._parseAsync({data:t.data,path:t.path,parent:t}):n._parseSync({data:t.data,path:t.path,parent:t}):(h(t,{code:o.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),m)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,r){const s=new Map;for(const r of t){const t=Q(r.shape[e]);if(!t)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const n of t){if(s.has(n))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(n)}`);s.set(n,r)}}return new ee({typeName:Re.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:s,...R(r)})}}function te(e,r){const s=i(e),n=i(r);if(e===r)return{valid:!0,data:e};if(s===a.object&&n===a.object){const s=t.objectKeys(r),n=t.objectKeys(e).filter((e=>-1!==s.indexOf(e))),a={...e,...r};for(const t of n){const s=te(e[t],r[t]);if(!s.valid)return{valid:!1};a[t]=s.data}return{valid:!0,data:a}}if(s===a.array&&n===a.array){if(e.length!==r.length)return{valid:!1};const t=[];for(let s=0;s<e.length;s++){const n=te(e[s],r[s]);if(!n.valid)return{valid:!1};t.push(n.data)}return{valid:!0,data:t}}return s===a.date&&n===a.date&&+e==+r?{valid:!0,data:e}:{valid:!1}}class re extends w{_parse(e){const{status:t,ctx:r}=this._processInputParams(e),s=(e,s)=>{if(v(e)||v(s))return m;const n=te(e.value,s.value);return n.valid?((_(e)||_(s))&&t.dirty(),{status:t.value,value:n.data}):(h(r,{code:o.invalid_intersection_types}),m)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then((([e,t])=>s(e,t))):s(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}re.create=(e,t,r)=>new re({left:e,right:t,typeName:Re.ZodIntersection,...R(r)});class se extends w{_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==a.array)return h(r,{code:o.invalid_type,expected:a.array,received:r.parsedType}),m;if(r.data.length<this._def.items.length)return h(r,{code:o.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),m;!this._def.rest&&r.data.length>this._def.items.length&&(h(r,{code:o.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const s=[...r.data].map(((e,t)=>{const s=this._def.items[t]||this._def.rest;return s?s._parse(new S(r,e,r.path,t)):null})).filter((e=>!!e));return r.common.async?Promise.all(s).then((e=>p.mergeArray(t,e))):p.mergeArray(t,s)}get items(){return this._def.items}rest(e){return new se({...this._def,rest:e})}}se.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new se({items:e,typeName:Re.ZodTuple,rest:null,...R(t)})};class ne extends w{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==a.object)return h(r,{code:o.invalid_type,expected:a.object,received:r.parsedType}),m;const s=[],n=this._def.keyType,i=this._def.valueType;for(const e in r.data)s.push({key:n._parse(new S(r,e,r.path,e)),value:i._parse(new S(r,r.data[e],r.path,e))});return r.common.async?p.mergeObjectAsync(t,s):p.mergeObjectSync(t,s)}get element(){return this._def.valueType}static create(e,t,r){return new ne(t instanceof w?{keyType:e,valueType:t,typeName:Re.ZodRecord,...R(r)}:{keyType:D.create(),valueType:e,typeName:Re.ZodRecord,...R(t)})}}class ae extends w{_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==a.map)return h(r,{code:o.invalid_type,expected:a.map,received:r.parsedType}),m;const s=this._def.keyType,n=this._def.valueType,i=[...r.data.entries()].map((([e,t],a)=>({key:s._parse(new S(r,e,r.path,[a,"key"])),value:n._parse(new S(r,t,r.path,[a,"value"]))})));if(r.common.async){const e=new Map;return Promise.resolve().then((async()=>{for(const r of i){const s=await r.key,n=await r.value;if("aborted"===s.status||"aborted"===n.status)return m;"dirty"!==s.status&&"dirty"!==n.status||t.dirty(),e.set(s.value,n.value)}return{status:t.value,value:e}}))}{const e=new Map;for(const r of i){const s=r.key,n=r.value;if("aborted"===s.status||"aborted"===n.status)return m;"dirty"!==s.status&&"dirty"!==n.status||t.dirty(),e.set(s.value,n.value)}return{status:t.value,value:e}}}}ae.create=(e,t,r)=>new ae({valueType:t,keyType:e,typeName:Re.ZodMap,...R(r)});class ie extends w{_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==a.set)return h(r,{code:o.invalid_type,expected:a.set,received:r.parsedType}),m;const s=this._def;null!==s.minSize&&r.data.size<s.minSize.value&&(h(r,{code:o.too_small,minimum:s.minSize.value,type:"set",inclusive:!0,exact:!1,message:s.minSize.message}),t.dirty()),null!==s.maxSize&&r.data.size>s.maxSize.value&&(h(r,{code:o.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),t.dirty());const n=this._def.valueType;function i(e){const r=new Set;for(const s of e){if("aborted"===s.status)return m;"dirty"===s.status&&t.dirty(),r.add(s.value)}return{status:t.value,value:r}}const l=[...r.data.values()].map(((e,t)=>n._parse(new S(r,e,r.path,t))));return r.common.async?Promise.all(l).then((e=>i(e))):i(l)}min(e,t){return new ie({...this._def,minSize:{value:e,message:E.toString(t)}})}max(e,t){return new ie({...this._def,maxSize:{value:e,message:E.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}ie.create=(e,t)=>new ie({valueType:e,minSize:null,maxSize:null,typeName:Re.ZodSet,...R(t)});class oe extends w{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==a.function)return h(t,{code:o.invalid_type,expected:a.function,received:t.parsedType}),m;function r(e,r){return f({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,d(),c].filter((e=>!!e)),issueData:{code:o.invalid_arguments,argumentsError:r}})}function s(e,r){return f({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,d(),c].filter((e=>!!e)),issueData:{code:o.invalid_return_type,returnTypeError:r}})}const n={errorMap:t.common.contextualErrorMap},i=t.data;return this._def.returns instanceof he?y((async(...e)=>{const t=new l([]),a=await this._def.args.parseAsync(e,n).catch((s=>{throw t.addIssue(r(e,s)),t})),o=await i(...a);return await this._def.returns._def.type.parseAsync(o,n).catch((e=>{throw t.addIssue(s(o,e)),t}))})):y(((...e)=>{const t=this._def.args.safeParse(e,n);if(!t.success)throw new l([r(e,t.error)]);const a=i(...t.data),o=this._def.returns.safeParse(a,n);if(!o.success)throw new l([s(a,o.error)]);return o.data}))}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new oe({...this._def,args:se.create(e).rest(K.create())})}returns(e){return new oe({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,r){return new oe({args:e||se.create([]).rest(K.create()),returns:t||K.create(),typeName:Re.ZodFunction,...R(r)})}}class le extends w{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}le.create=(e,t)=>new le({getter:e,typeName:Re.ZodLazy,...R(t)});class ce extends w{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return h(t,{received:t.data,code:o.invalid_literal,expected:this._def.value}),m}return{status:"valid",value:e.data}}get value(){return this._def.value}}function ue(e,t){return new de({values:e,typeName:Re.ZodEnum,...R(t)})}ce.create=(e,t)=>new ce({value:e,typeName:Re.ZodLiteral,...R(t)});class de extends w{_parse(e){if("string"!=typeof e.data){const r=this._getOrReturnCtx(e),s=this._def.values;return h(r,{expected:t.joinValues(s),received:r.parsedType,code:o.invalid_type}),m}if(-1===this._def.values.indexOf(e.data)){const t=this._getOrReturnCtx(e),r=this._def.values;return h(t,{received:t.data,code:o.invalid_enum_value,options:r}),m}return y(e.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e){return de.create(e)}exclude(e){return de.create(this.options.filter((t=>!e.includes(t))))}}de.create=ue;class fe extends w{_parse(e){const r=t.getValidEnumValues(this._def.values),s=this._getOrReturnCtx(e);if(s.parsedType!==a.string&&s.parsedType!==a.number){const e=t.objectValues(r);return h(s,{expected:t.joinValues(e),received:s.parsedType,code:o.invalid_type}),m}if(-1===r.indexOf(e.data)){const e=t.objectValues(r);return h(s,{received:s.data,code:o.invalid_enum_value,options:e}),m}return y(e.data)}get enum(){return this._def.values}}fe.create=(e,t)=>new fe({values:e,typeName:Re.ZodNativeEnum,...R(t)});class he extends w{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==a.promise&&!1===t.common.async)return h(t,{code:o.invalid_type,expected:a.promise,received:t.parsedType}),m;const r=t.parsedType===a.promise?t.data:Promise.resolve(t.data);return y(r.then((e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap}))))}}he.create=(e,t)=>new he({type:e,typeName:Re.ZodPromise,...R(t)});class pe extends w{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Re.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:r,ctx:s}=this._processInputParams(e),n=this._def.effect||null;if("preprocess"===n.type){const e=n.transform(s.data);return s.common.async?Promise.resolve(e).then((e=>this._def.schema._parseAsync({data:e,path:s.path,parent:s}))):this._def.schema._parseSync({data:e,path:s.path,parent:s})}const a={addIssue:e=>{h(s,e),e.fatal?r.abort():r.dirty()},get path(){return s.path}};if(a.addIssue=a.addIssue.bind(a),"refinement"===n.type){const e=e=>{const t=n.refinement(e,a);if(s.common.async)return Promise.resolve(t);if(t instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return e};if(!1===s.common.async){const t=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});return"aborted"===t.status?m:("dirty"===t.status&&r.dirty(),e(t.value),{status:r.value,value:t.value})}return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then((t=>"aborted"===t.status?m:("dirty"===t.status&&r.dirty(),e(t.value).then((()=>({status:r.value,value:t.value}))))))}if("transform"===n.type){if(!1===s.common.async){const e=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});if(!b(e))return e;const t=n.transform(e.value,a);if(t instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:t}}return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then((e=>b(e)?Promise.resolve(n.transform(e.value,a)).then((e=>({status:r.value,value:e}))):e))}t.assertNever(n)}}pe.create=(e,t,r)=>new pe({schema:e,typeName:Re.ZodEffects,effect:t,...R(r)}),pe.createWithPreprocess=(e,t,r)=>new pe({schema:t,effect:{type:"preprocess",transform:e},typeName:Re.ZodEffects,...R(r)});class me extends w{_parse(e){return this._getType(e)===a.undefined?y(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}me.create=(e,t)=>new me({innerType:e,typeName:Re.ZodOptional,...R(t)});class ge extends w{_parse(e){return this._getType(e)===a.null?y(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}ge.create=(e,t)=>new ge({innerType:e,typeName:Re.ZodNullable,...R(t)});class ye extends w{_parse(e){const{ctx:t}=this._processInputParams(e);let r=t.data;return t.parsedType===a.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}ye.create=(e,t)=>new ye({innerType:e,typeName:Re.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...R(t)});class ve extends w{_parse(e){const{ctx:t}=this._processInputParams(e),r={...t,common:{...t.common,issues:[]}},s=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return A(s)?s.then((e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new l(r.common.issues)},input:r.data})}))):{status:"valid",value:"valid"===s.status?s.value:this._def.catchValue({get error(){return new l(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}ve.create=(e,t)=>new ve({innerType:e,typeName:Re.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...R(t)});class _e extends w{_parse(e){if(this._getType(e)!==a.nan){const t=this._getOrReturnCtx(e);return h(t,{code:o.invalid_type,expected:a.nan,received:t.parsedType}),m}return{status:"valid",value:e.data}}}_e.create=e=>new _e({typeName:Re.ZodNaN,...R(e)});const be=Symbol("zod_brand");class Ae extends w{_parse(e){const{ctx:t}=this._processInputParams(e),r=t.data;return this._def.type._parse({data:r,path:t.path,parent:t})}unwrap(){return this._def.type}}class Ee extends w{_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.common.async){return(async()=>{const e=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return"aborted"===e.status?m:"dirty"===e.status?(t.dirty(),g(e.value)):this._def.out._parseAsync({data:e.value,path:r.path,parent:r})})()}{const e=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return"aborted"===e.status?m:"dirty"===e.status?(t.dirty(),{status:"dirty",value:e.value}):this._def.out._parseSync({data:e.value,path:r.path,parent:r})}}static create(e,t){return new Ee({in:e,out:t,typeName:Re.ZodPipeline})}}const Se=(e,t={},r)=>e?X.create().superRefine(((s,n)=>{var a,i;if(!e(s)){const e="function"==typeof t?t(s):"string"==typeof t?{message:t}:t,o=null===(i=null!==(a=e.fatal)&&void 0!==a?a:r)||void 0===i||i,l="string"==typeof e?{message:e}:e;n.addIssue({code:"custom",...l,fatal:o})}})):X.create(),Oe={object:q.lazycreate};var Re;!function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline"}(Re||(Re={}));const we=D.create,Ne=P.create,Ie=_e.create,Te=B.create,xe=U.create,Ce=G.create,$e=F.create,ke=Z.create,Le=H.create,Me=X.create,De=K.create,je=V.create,Pe=W.create,Be=Y.create,Ue=q.create,Ge=q.strictCreate,Fe=J.create,Ze=ee.create,He=re.create,Xe=se.create,Ke=ne.create,Ve=ae.create,We=ie.create,Ye=oe.create,ze=le.create,qe=ce.create,Je=de.create,Qe=fe.create,et=he.create,tt=pe.create,rt=me.create,st=ge.create,nt=pe.createWithPreprocess,at=Ee.create,it={string:e=>D.create({...e,coerce:!0}),number:e=>P.create({...e,coerce:!0}),boolean:e=>U.create({...e,coerce:!0}),bigint:e=>B.create({...e,coerce:!0}),date:e=>G.create({...e,coerce:!0})},ot=m;var lt=Object.freeze({__proto__:null,defaultErrorMap:c,setErrorMap:function(e){u=e},getErrorMap:d,makeIssue:f,EMPTY_PATH:[],addIssueToContext:h,ParseStatus:p,INVALID:m,DIRTY:g,OK:y,isAborted:v,isDirty:_,isValid:b,isAsync:A,get util(){return t},get objectUtil(){return r},ZodParsedType:a,getParsedType:i,ZodType:w,ZodString:D,ZodNumber:P,ZodBigInt:B,ZodBoolean:U,ZodDate:G,ZodSymbol:F,ZodUndefined:Z,ZodNull:H,ZodAny:X,ZodUnknown:K,ZodNever:V,ZodVoid:W,ZodArray:Y,ZodObject:q,ZodUnion:J,ZodDiscriminatedUnion:ee,ZodIntersection:re,ZodTuple:se,ZodRecord:ne,ZodMap:ae,ZodSet:ie,ZodFunction:oe,ZodLazy:le,ZodLiteral:ce,ZodEnum:de,ZodNativeEnum:fe,ZodPromise:he,ZodEffects:pe,ZodTransformer:pe,ZodOptional:me,ZodNullable:ge,ZodDefault:ye,ZodCatch:ve,ZodNaN:_e,BRAND:be,ZodBranded:Ae,ZodPipeline:Ee,custom:Se,Schema:w,ZodSchema:w,late:Oe,get ZodFirstPartyTypeKind(){return Re},coerce:it,any:Me,array:Be,bigint:Te,boolean:xe,date:Ce,discriminatedUnion:Ze,effect:tt,enum:Je,function:Ye,instanceof:(e,t={message:`Input not instance of ${e.name}`})=>Se((t=>t instanceof e),t),intersection:He,lazy:ze,literal:qe,map:Ve,nan:Ie,nativeEnum:Qe,never:je,null:Le,nullable:st,number:Ne,object:Ue,oboolean:()=>xe().optional(),onumber:()=>Ne().optional(),optional:rt,ostring:()=>we().optional(),pipeline:at,preprocess:nt,promise:et,record:Ke,set:We,strictObject:Ge,string:we,symbol:$e,transformer:tt,tuple:Xe,undefined:ke,union:Fe,unknown:De,void:Pe,NEVER:ot,ZodIssueCode:o,quotelessJson:e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),ZodError:l});const ct=["interface","display","layout","module","panel"],ut=["hook","endpoint"],dt=["operation"],ft=lt.object({app:lt.string(),api:lt.string()}),ht=lt.union([lt.object({type:lt.union([lt.enum(ct),lt.enum(ut)]),name:lt.string(),source:lt.string()}),lt.object({type:lt.enum(dt),name:lt.string(),source:ft})]),pt=lt.object({host:lt.string(),hidden:lt.boolean().optional()}),mt=lt.object({type:lt.union([lt.enum(ct),lt.enum(ut)]),path:lt.string(),source:lt.string()}),gt=lt.object({type:lt.enum(dt),path:ft,source:ft}),yt=lt.object({type:lt.literal("bundle"),path:ft,entries:lt.array(ht)});lt.array(ht);const vt=pt.and(lt.union([mt,gt,yt]));var _t,bt;lt.object({name:lt.string(),version:lt.string(),dependencies:lt.record(lt.string()).optional(),"directus:extension":vt}),function(e){e.NULL="null",e.UNDEFINED="undefined",e.STRING="string",e.INTEGER="integer",e.FLOAT="float",e.BOOLEAN="boolean",e.EMPTY="empty"}(_t||(_t={})),function(e){e[e.TRUE=-1]="TRUE",e[e.FALSE=-2]="FALSE",e[e.NULL=-3]="NULL",e[e.EMPTY=-4]="EMPTY",e[e.UNDEFINED=-5]="UNDEFINED"}(bt||(bt={}));var At=(0).constructor;At.isFinite,At.isInteger,[].constructor.isArray;function Et(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}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 r=this.cachedKeys[this.oldestIndex];void 0!==r&&delete this.map[r],this.cachedKeys[this.oldestIndex]=e,this.oldestIndex++,this.oldestIndex%=this.size},e}())(1e3);var St={exports:{}},Ot=function(...e){try{return JSON.stringify(...e)}catch(e){return"[Cannot display object: "+e.message+"]"}};!function(e,t){const r=Ot;St.exports=class extends Error{constructor(e){super(e.filter((e=>""!==e)).map((e=>"string"==typeof e?e:e instanceof Error?e.message:r(e))).join(" ")||"Unknown error"),"function"==typeof Error.captureStackTrace&&Error.captureStackTrace(this,t.assert)}}}(0,St.exports);var Rt=St.exports;const wt=Rt;var Nt=function(e,...t){if(!e){if(1===t.length&&t[0]instanceof Error)throw t[0];throw new wt(t)}};const It=Nt,Tt={};var xt=function(e,t,r){if(!1===t||null==t)return e;"string"==typeof(r=r||{})&&(r={separator:r});const s=Array.isArray(t);It(!s||!r.separator,"Separator option is not valid for array-based chain");const n=s?t:t.split(r.separator||".");let a=e;for(let e=0;e<n.length;++e){let s=n[e];const i=r.iterables&&Tt.iterables(a);if(Array.isArray(a)||"set"===i){const e=Number(s);Number.isInteger(e)&&(s=e<0?a.length+e:e)}if(!a||"function"==typeof a&&!1===r.functions||!i&&void 0===a[s]){It(!r.strict||e+1===n.length,"Missing segment",s,"in reach path ",t),It("object"==typeof a||!0===r.functions||"function"!=typeof a,"Invalid segment",s,"in reach path ",t),a=r.default;break}a=i?"set"===i?[...a][s]:a.get(s):a[s]}return a};Tt.iterables=function(e){return e instanceof Set?"set":e instanceof Map?"map":void 0};var Ct={exports:{}};!function(e,t){const r={};t=Ct.exports={array:Array.prototype,buffer:Buffer&&Buffer.prototype,date:Date.prototype,error:Error.prototype,generic:Object.prototype,map:Map.prototype,promise:Promise.prototype,regex:RegExp.prototype,set:Set.prototype,weakMap:WeakMap.prototype,weakSet:WeakSet.prototype},r.typeMap=new Map([["[object Error]",t.error],["[object Map]",t.map],["[object Promise]",t.promise],["[object Set]",t.set],["[object WeakMap]",t.weakMap],["[object WeakSet]",t.weakSet]]),t.getInternalProto=function(e){if(Array.isArray(e))return t.array;if(Buffer&&e instanceof Buffer)return t.buffer;if(e instanceof Date)return t.date;if(e instanceof RegExp)return t.regex;if(e instanceof Error)return t.error;const s=Object.prototype.toString.call(e);return r.typeMap.get(s)||t.generic}}(0,Ct.exports);var $t=Ct.exports,kt={keys:function(e,t={}){return!1!==t.symbols?Reflect.ownKeys(e):Object.getOwnPropertyNames(e)}};const Lt=xt,Mt=$t,Dt=kt,jt={needsProtoHack:new Set([Mt.set,Mt.map,Mt.weakSet,Mt.weakMap])};var Pt=jt.clone=function(e,t={},r=null){if("object"!=typeof e||null===e)return e;let s=jt.clone,n=r;if(t.shallow){if(!0!==t.shallow)return jt.cloneWithShallow(e,t);s=e=>e}else if(n){const t=n.get(e);if(t)return t}else n=new Map;const a=Mt.getInternalProto(e);if(a===Mt.buffer)return Buffer&&Buffer.from(e);if(a===Mt.date)return new Date(e.getTime());if(a===Mt.regex)return new RegExp(e);const i=jt.base(e,a,t);if(i===e)return e;if(n&&n.set(e,i),a===Mt.set)for(const r of e)i.add(s(r,t,n));else if(a===Mt.map)for(const[r,a]of e)i.set(r,s(a,t,n));const o=Dt.keys(e,t);for(const r of o){if("__proto__"===r)continue;if(a===Mt.array&&"length"===r){i.length=e.length;continue}const o=Object.getOwnPropertyDescriptor(e,r);o?o.get||o.set?Object.defineProperty(i,r,o):o.enumerable?i[r]=s(e[r],t,n):Object.defineProperty(i,r,{enumerable:!1,writable:!0,configurable:!0,value:s(e[r],t,n)}):Object.defineProperty(i,r,{enumerable:!0,writable:!0,configurable:!0,value:s(e[r],t,n)})}return i};jt.cloneWithShallow=function(e,t){const r=t.shallow;(t=Object.assign({},t)).shallow=!1;const s=new Map;for(const t of r){const r=Lt(e,t);"object"!=typeof r&&"function"!=typeof r||s.set(r,r)}return jt.clone(e,t,s)},jt.base=function(e,t,r){if(!1===r.prototype)return jt.needsProtoHack.has(t)?new t.constructor:t===Mt.array?[]:{};const s=Object.getPrototypeOf(e);if(s&&s.isImmutable)return e;if(t===Mt.array){const e=[];return s!==t&&Object.setPrototypeOf(e,s),e}if(jt.needsProtoHack.has(t)){const e=new s.constructor;return s!==t&&Object.setPrototypeOf(e,s),e}return Object.create(s)};var Bt,Ut={},Gt={},Ft={name:"joi",description:"Object schema validation",version:"17.9.1",repository:"git://github.com/hapijs/joi",main:"lib/index.js",types:"lib/index.d.ts",browser:"dist/joi-browser.min.js",files:["lib/**/*","dist/*"],keywords:["schema","validation"],dependencies:{"@hapi/hoek":"^9.0.0","@hapi/topo":"^5.0.0","@sideway/address":"^4.1.3","@sideway/formula":"^3.0.1","@sideway/pinpoint":"^2.0.0"},devDependencies:{"@hapi/bourne":"2.x.x","@hapi/code":"8.x.x","@hapi/joi-legacy-test":"npm:@hapi/joi@15.x.x","@hapi/lab":"^25.0.1","@types/node":"^14.18.24",typescript:"4.3.x"},scripts:{prepublishOnly:"cd browser && npm install && npm run build",test:"lab -t 100 -a @hapi/code -L -Y","test-cov-html":"lab -r html -o coverage.html -a @hapi/code"},license:"BSD-3-Clause"},Zt={};function Ht(){if(Bt)return Zt;Bt=1;const e=on(),t={};return t.wrap=e.string().min(1).max(2).allow(!1),Zt.preferences=e.object({allowUnknown:e.boolean(),abortEarly:e.boolean(),artifacts:e.boolean(),cache:e.boolean(),context:e.object(),convert:e.boolean(),dateFormat:e.valid("date","iso","string","time","utc"),debug:e.boolean(),errors:{escapeHtml:e.boolean(),label:e.valid("path","key",!1),language:[e.string(),e.object().ref()],render:e.boolean(),stack:e.boolean(),wrap:{label:t.wrap,array:t.wrap,string:t.wrap}},externals:e.boolean(),messages:e.object(),noDefaults:e.boolean(),nonEnumerables:e.boolean(),presence:e.valid("required","optional","forbidden"),skipFunctions:e.boolean(),stripUnknown:e.object({arrays:e.boolean(),objects:e.boolean()}).or("arrays","objects").allow(!0,!1),warnings:e.boolean()}).strict(),t.nameRx=/^[a-zA-Z0-9]\w*$/,t.rule=e.object({alias:e.array().items(e.string().pattern(t.nameRx)).single(),args:e.array().items(e.string(),e.object({name:e.string().pattern(t.nameRx).required(),ref:e.boolean(),assert:e.alternatives([e.function(),e.object().schema()]).conditional("ref",{is:!0,then:e.required()}),normalize:e.function(),message:e.string().when("assert",{is:e.function(),then:e.required()})})),convert:e.boolean(),manifest:e.boolean(),method:e.function().allow(!1),multi:e.boolean(),validate:e.function()}),Zt.extension=e.object({type:e.alternatives([e.string(),e.object().regex()]).required(),args:e.function(),cast:e.object().pattern(t.nameRx,e.object({from:e.function().maxArity(1).required(),to:e.function().minArity(1).maxArity(2).required()})),base:e.object().schema().when("type",{is:e.object().regex(),then:e.forbidden()}),coerce:[e.function().maxArity(3),e.object({method:e.function().maxArity(3).required(),from:e.array().items(e.string()).single()})],flags:e.object().pattern(t.nameRx,e.object({setter:e.string(),default:e.any()})),manifest:{build:e.function().arity(2)},messages:[e.object(),e.string()],modifiers:e.object().pattern(t.nameRx,e.function().minArity(1).maxArity(2)),overrides:e.object().pattern(t.nameRx,e.function()),prepare:e.function().maxArity(3),rebuild:e.function().arity(1),rules:e.object().pattern(t.nameRx,t.rule),terms:e.object().pattern(t.nameRx,e.object({init:e.array().allow(null).required(),manifest:e.object().pattern(/.+/,[e.valid("schema","single"),e.object({mapped:e.object({from:e.string().required(),to:e.string().required()}).required()})])})),validate:e.function().maxArity(3)}).strict(),Zt.extensions=e.array().items(e.object(),e.function().arity(1)).strict(),t.desc={buffer:e.object({buffer:e.string()}),func:e.object({function:e.function().required(),options:{literal:!0}}),override:e.object({override:!0}),ref:e.object({ref:e.object({type:e.valid("value","global","local"),path:e.array().required(),separator:e.string().length(1).allow(!1),ancestor:e.number().min(0).integer().allow("root"),map:e.array().items(e.array().length(2)).min(1),adjust:e.function(),iterables:e.boolean(),in:e.boolean(),render:e.boolean()}).required()}),regex:e.object({regex:e.string().min(3)}),special:e.object({special:e.valid("deep").required()}),template:e.object({template:e.string().required(),options:e.object()}),value:e.object({value:e.alternatives([e.object(),e.array()]).required()})},t.desc.entity=e.alternatives([e.array().items(e.link("...")),e.boolean(),e.function(),e.number(),e.string(),t.desc.buffer,t.desc.func,t.desc.ref,t.desc.regex,t.desc.special,t.desc.template,t.desc.value,e.link("/")]),t.desc.values=e.array().items(null,e.boolean(),e.function(),e.number().allow(1/0,-1/0),e.string().allow(""),e.symbol(),t.desc.buffer,t.desc.func,t.desc.override,t.desc.ref,t.desc.regex,t.desc.template,t.desc.value),t.desc.messages=e.object().pattern(/.+/,[e.string(),t.desc.template,e.object().pattern(/.+/,[e.string(),t.desc.template])]),Zt.description=e.object({type:e.string().required(),flags:e.object({cast:e.string(),default:e.any(),description:e.string(),empty:e.link("/"),failover:t.desc.entity,id:e.string(),label:e.string(),only:!0,presence:["optional","required","forbidden"],result:["raw","strip"],strip:e.boolean(),unit:e.string()}).unknown(),preferences:{allowUnknown:e.boolean(),abortEarly:e.boolean(),artifacts:e.boolean(),cache:e.boolean(),convert:e.boolean(),dateFormat:["date","iso","string","time","utc"],errors:{escapeHtml:e.boolean(),label:["path","key"],language:[e.string(),t.desc.ref],wrap:{label:t.wrap,array:t.wrap}},externals:e.boolean(),messages:t.desc.messages,noDefaults:e.boolean(),nonEnumerables:e.boolean(),presence:["required","optional","forbidden"],skipFunctions:e.boolean(),stripUnknown:e.object({arrays:e.boolean(),objects:e.boolean()}).or("arrays","objects").allow(!0,!1),warnings:e.boolean()},allow:t.desc.values,invalid:t.desc.values,rules:e.array().min(1).items({name:e.string().required(),args:e.object().min(1),keep:e.boolean(),message:[e.string(),t.desc.messages],warn:e.boolean()}),keys:e.object().pattern(/.*/,e.link("/")),link:t.desc.ref}).pattern(/^[a-z]\w*$/,e.any()),Zt}var Xt={},Kt={exports:{}};const Vt={};var Wt=function(e){if(!e)return"";let t="";for(let r=0;r<e.length;++r){const s=e.charCodeAt(r);Vt.isSafe(s)?t+=e[r]:t+=Vt.escapeHtmlChar(s)}return t};Vt.escapeHtmlChar=function(e){const t=Vt.namedHtml.get(e);if(t)return t;if(e>=256)return"&#"+e+";";return`&#x${e.toString(16).padStart(2,"0")};`},Vt.isSafe=function(e){return Vt.safeCharCodes.has(e)},Vt.namedHtml=new Map([[38,"&amp;"],[60,"&lt;"],[62,"&gt;"],[34,"&quot;"],[160,"&nbsp;"],[162,"&cent;"],[163,"&pound;"],[164,"&curren;"],[169,"&copy;"],[174,"&reg;"]]),Vt.safeCharCodes=function(){const e=new Set;for(let t=32;t<123;++t)(t>=97||t>=65&&t<=90||t>=48&&t<=57||32===t||46===t||44===t||45===t||58===t||95===t)&&e.add(t);return e}();var Yt={};!function(e){const t={operators:["!","^","*","/","%","+","-","<","<=",">",">=","==","!=","&&","||","??"],operatorCharacters:["!","^","*","/","%","+","-","<","=",">","&","|","?"],operatorsOrder:[["^"],["*","/","%"],["+","-"],["<","<=",">",">="],["==","!="],["&&"],["||","??"]],operatorsPrefix:["!","n"],literals:{'"':'"',"`":"`","'":"'","[":"]"},numberRx:/^(?:[0-9]*(\.[0-9]*)?){1}$/,tokenRx:/^[\w\$\#\.\@\:\{\}]+$/,symbol:Symbol("formula"),settings:Symbol("settings")};e.Parser=class{constructor(e,r={}){if(!r[t.settings]&&r.constants)for(const e in r.constants){const t=r.constants[e];if(null!==t&&!["boolean","number","string"].includes(typeof t))throw new Error(`Formula constant ${e} contains invalid ${typeof t} value type`)}this.settings=r[t.settings]?r:Object.assign({[t.settings]:!0,constants:{},functions:{}},r),this.single=null,this._parts=null,this._parse(e)}_parse(r){let s=[],n="",a=0,i=!1;const o=r=>{if(a)throw new Error("Formula missing closing parenthesis");const o=s.length?s[s.length-1]:null;if(i||n||r){if(o&&"reference"===o.type&&")"===r)return o.type="function",o.value=this._subFormula(n,o.value),void(n="");if(")"===r){const t=new e.Parser(n,this.settings);s.push({type:"segment",value:t})}else if(i){if("]"===i)return s.push({type:"reference",value:n}),void(n="");s.push({type:"literal",value:n})}else if(t.operatorCharacters.includes(n))o&&"operator"===o.type&&t.operators.includes(o.value+n)?o.value+=n:s.push({type:"operator",value:n});else if(n.match(t.numberRx))s.push({type:"constant",value:parseFloat(n)});else if(void 0!==this.settings.constants[n])s.push({type:"constant",value:this.settings.constants[n]});else{if(!n.match(t.tokenRx))throw new Error(`Formula contains invalid token: ${n}`);s.push({type:"reference",value:n})}n=""}};for(const e of r)i?e===i?(o(),i=!1):n+=e:a?"("===e?(n+=e,++a):")"===e?(--a,a?n+=e:o(e)):n+=e:e in t.literals?i=t.literals[e]:"("===e?(o(),++a):t.operatorCharacters.includes(e)?(o(),n=e,o()):" "!==e?n+=e:o();o(),s=s.map(((e,t)=>"operator"!==e.type||"-"!==e.value||t&&"operator"!==s[t-1].type?e:{type:"operator",value:"n"}));let l=!1;for(const e of s){if("operator"===e.type){if(t.operatorsPrefix.includes(e.value))continue;if(!l)throw new Error("Formula contains an operator in invalid position");if(!t.operators.includes(e.value))throw new Error(`Formula contains an unknown operator ${e.value}`)}else if(l)throw new Error("Formula missing expected operator");l=!l}if(!l)throw new Error("Formula contains invalid trailing operator");1===s.length&&["reference","literal","constant"].includes(s[0].type)&&(this.single={type:"reference"===s[0].type?"reference":"value",value:s[0].value}),this._parts=s.map((e=>{if("operator"===e.type)return t.operatorsPrefix.includes(e.value)?e:e.value;if("reference"!==e.type)return e.value;if(this.settings.tokenRx&&!this.settings.tokenRx.test(e.value))throw new Error(`Formula contains invalid reference ${e.value}`);return this.settings.reference?this.settings.reference(e.value):t.reference(e.value)}))}_subFormula(r,s){const n=this.settings.functions[s];if("function"!=typeof n)throw new Error(`Formula contains unknown function ${s}`);let a=[];if(r){let e="",n=0,i=!1;const o=()=>{if(!e)throw new Error(`Formula contains function ${s} with invalid arguments ${r}`);a.push(e),e=""};for(let s=0;s<r.length;++s){const a=r[s];i?(e+=a,a===i&&(i=!1)):a in t.literals&&!n?(e+=a,i=t.literals[a]):","!==a||n?(e+=a,"("===a?++n:")"===a&&--n):o()}o()}return a=a.map((t=>new e.Parser(t,this.settings))),function(e){const t=[];for(const r of a)t.push(r.evaluate(e));return n.call(e,...t)}}evaluate(e){const r=this._parts.slice();for(let s=r.length-2;s>=0;--s){const n=r[s];if(n&&"operator"===n.type){const a=r[s+1];r.splice(s+1,1);const i=t.evaluate(a,e);r[s]=t.single(n.value,i)}}return t.operatorsOrder.forEach((s=>{for(let n=1;n<r.length-1;)if(s.includes(r[n])){const s=r[n],a=t.evaluate(r[n-1],e),i=t.evaluate(r[n+1],e);r.splice(n,2);const o=t.calculate(s,a,i);r[n-1]=0===o?0:o}else n+=2})),t.evaluate(r[0],e)}},e.Parser.prototype[t.symbol]=!0,t.reference=function(e){return function(t){return t&&void 0!==t[e]?t[e]:null}},t.evaluate=function(e,r){return null===e?null:"function"==typeof e?e(r):e[t.symbol]?e.evaluate(r):e},t.single=function(e,t){if("!"===e)return!t;const r=-t;return 0===r?0:r},t.calculate=function(e,r,s){if("??"===e)return t.exists(r)?r:s;if("string"==typeof r||"string"==typeof s){if("+"===e)return(r=t.exists(r)?r:"")+(s=t.exists(s)?s:"")}else switch(e){case"^":return Math.pow(r,s);case"*":return r*s;case"/":return r/s;case"%":return r%s;case"+":return r+s;case"-":return r-s}switch(e){case"<":return r<s;case"<=":return r<=s;case">":return r>s;case">=":return r>=s;case"==":return r===s;case"!=":return r!==s;case"&&":return r&&s;case"||":return r||s}return null},t.exists=function(e){return null!=e}}(Yt);var zt,qt,Jt={},Qt={};function er(){if(zt)return Qt;zt=1;const e=Pt,t=dr(),r={annotations:Symbol("annotations")};return Qt.error=function(s){if(!this._original||"object"!=typeof this._original)return this.details[0].message;const n=s?"":"",a=s?"":"",i=s?"":"",o=e(this._original);for(let e=this.details.length-1;e>=0;--e){const s=e+1,n=this.details[e],a=n.path;let i=o;for(let e=0;;++e){const o=a[e];if(t.isSchema(i)&&(i=i.clone()),!(e+1<a.length&&"string"!=typeof i[o])){const e=i[r.annotations]||{errors:{},missing:{}};i[r.annotations]=e;const t=o||n.context.key;void 0!==i[o]?(e.errors[t]=e.errors[t]||[],e.errors[t].push(s)):e.missing[t]=s;break}i=i[o]}}const l=/_\$key\$_([, \d]+)_\$end\$_"/g,c=/"_\$miss\$_([^|]+)\|(\d+)_\$end\$_": "__missing__"/g,u=/\s*"_\$idx\$_([, \d]+)_\$end\$_",?\n(.*)/g,d=/"\[(NaN|Symbol.*|-?Infinity|function.*|\(.*)]"/g;let f=r.safeStringify(o,2).replace(l,((e,t)=>`" ${n}[${t}]${i}`)).replace(c,((e,t,r)=>`${a}"${t}"${i}${n} [${r}]: -- missing --${i}`)).replace(u,((e,t,r)=>`\n${r} ${n}[${t}]${i}`)).replace(d,((e,t)=>t));f=`${f}\n${n}`;for(let e=0;e<this.details.length;++e){f=`${f}\n[${e+1}] ${this.details[e].message}`}return f+=i,f},r.safeStringify=function(e,t){return JSON.stringify(e,r.serializer(),t)},r.serializer=function(){const e=[],t=[],s=(r,s)=>t[0]===s?"[Circular ~]":"[Circular ~."+e.slice(0,t.indexOf(s)).join(".")+"]";return function(n,a){if(t.length>0){const r=t.indexOf(this);~r?(t.length=r+1,e.length=r+1,e[r]=n):(t.push(this),e.push(n)),~t.indexOf(a)&&(a=s.call(this,n,a))}else t.push(a);if(a){const e=a[r.annotations];if(e){if(Array.isArray(a)){const t=[];for(let r=0;r<a.length;++r)e.errors[r]&&t.push(`_$idx$_${e.errors[r].sort().join(", ")}_$end$_`),t.push(a[r]);a=t}else{for(const t in e.errors)a[`${t}_$key$_${e.errors[t].sort().join(", ")}_$end$_`]=a[t],a[t]=void 0;for(const t in e.missing)a[`_$miss$_${t}|${e.missing[t]}_$end$_`]="__missing__"}return a}}return a===1/0||a===-1/0||Number.isNaN(a)||"function"==typeof a||"symbol"==typeof a?"["+a.toString()+"]":a}},Qt}function tr(){return qt||(qt=1,function(e){const t=er(),r=dr(),s=cr();e.Report=class{constructor(t,r,s,n,a,i,o){if(this.code=t,this.flags=n,this.messages=a,this.path=i.path,this.prefs=o,this.state=i,this.value=r,this.message=null,this.template=null,this.local=s||{},this.local.label=e.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(t,r){return e.template(this.value,t,r||this.code,this.state,this.prefs)}},e.path=function(e){let t="";for(const r of e)"object"!=typeof r&&("string"==typeof r?(t&&(t+="."),t+=r):t+=`[${r}]`);return t},e.template=function(e,t,n,a,i){if(!t)return;if(s.isTemplate(t))return"root"!==n?t:null;let o=i.errors.language;if(r.isResolvable(o)&&(o=o.resolve(e,a,i)),o&&t[o]){if(void 0!==t[o][n])return t[o][n];if(void 0!==t[o]["*"])return t[o]["*"]}return t[n]?t[n]:t["*"]},e.label=function(t,r,s,n){if(t.label)return t.label;if(!s.errors.label)return"";let a=r.path;"key"===s.errors.label&&r.path.length>1&&(a=r.path.slice(-1));const i=e.path(a);return i||(e.template(null,s.messages,"root",r,s)||n&&e.template(null,n,"root",r,s)||"value")},e.process=function(t,r,s){if(!t)return null;const{override:n,message:a,details:i}=e.details(t);if(n)return n;if(s.errors.stack)return new e.ValidationError(a,i,r);const o=Error.stackTraceLimit;Error.stackTraceLimit=0;const l=new e.ValidationError(a,i,r);return Error.stackTraceLimit=o,l},e.details=function(e,t={}){let r=[];const s=[];for(const n of e){if(n instanceof Error){if(!1!==t.override)return{override:n};const e=n.toString();r.push(e),s.push({message:e,type:"override",context:{error:n}});continue}const e=n.toString();r.push(e),s.push({message:e,path:n.path.filter((e=>"object"!=typeof e)),type:n.code,context:n.local})}return r.length>1&&(r=[...new Set(r)]),{message:r.join(". "),details:s}},e.ValidationError=class extends Error{constructor(e,t,r){super(e),this._original=r,this.details=t}static isError(t){return t instanceof e.ValidationError}},e.ValidationError.prototype.isJoi=!0,e.ValidationError.prototype.name="ValidationError",e.ValidationError.prototype.annotate=t.error}(Jt)),Jt}var rr,sr,nr,ar,ir,or={};function lr(){return rr||(rr=1,function(e){const t=Nt,r=Pt,s=xt,n=dr();let a;const i={symbol:Symbol("ref"),defaults:{adjust:null,in:!1,iterables:null,map:null,separator:".",type:"value"}};e.create=function(e,r={}){t("string"==typeof e,"Invalid reference key:",e),n.assertOptions(r,["adjust","ancestor","in","iterables","map","prefix","render","separator"]),t(!r.prefix||"object"==typeof r.prefix,"options.prefix must be of type object");const s=Object.assign({},i.defaults,r);delete s.prefix;const a=s.separator,o=i.context(e,a,r.prefix);if(s.type=o.type,e=o.key,"value"===s.type)if(o.root&&(t(!a||e[0]!==a,"Cannot specify relative path with root prefix"),s.ancestor="root",e||(e=null)),a&&a===e)e=null,s.ancestor=0;else if(void 0!==s.ancestor)t(!a||!e||e[0]!==a,"Cannot combine prefix with ancestor option");else{const[t,r]=i.ancestor(e,a);r&&""===(e=e.slice(r))&&(e=null),s.ancestor=t}return s.path=a?null===e?[]:e.split(a):[e],new i.Ref(s)},e.in=function(t,r={}){return e.create(t,{...r,in:!0})},e.isRef=function(e){return!!e&&!!e[n.symbols.ref]},i.Ref=class{constructor(e){t("object"==typeof e,"Invalid reference construction"),n.assertOptions(e,["adjust","ancestor","in","iterables","map","path","render","separator","type","depth","key","root","display"]),t([!1,void 0].includes(e.separator)||"string"==typeof e.separator&&1===e.separator.length,"Invalid separator"),t(!e.adjust||"function"==typeof e.adjust,"options.adjust must be a function"),t(!e.map||Array.isArray(e.map),"options.map must be an array"),t(!e.map||!e.adjust,"Cannot set both map and adjust options"),Object.assign(this,i.defaults,e),t("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,r,s,n,a={}){return t(!this.in||a.in,"Invalid in() reference usage"),"global"===this.type?this._resolve(s.context,r,a):"local"===this.type?this._resolve(n,r,a):this.ancestor?"root"===this.ancestor?this._resolve(r.ancestors[r.ancestors.length-1],r,a):(t(this.ancestor<=r.ancestors.length,"Invalid reference exceeds the schema root:",this.display),this._resolve(r.ancestors[this.ancestor-1],r,a)):this._resolve(e,r,a)}_resolve(e,t,r){let n;if("value"===this.type&&t.mainstay.shadow&&!1!==r.shadow&&(n=t.mainstay.shadow.get(this.absolute(t))),void 0===n&&(n=s(e,this.path,{iterables:this.iterables,functions:!0})),this.adjust&&(n=this.adjust(n)),this.map){const e=this.map.get(n);void 0!==e&&(n=e)}return t.mainstay&&t.mainstay.tracer.resolve(t,this,n),n}toString(){return this.display}absolute(e){return[...e.path.slice(0,-this.ancestor),...this.path]}clone(){return new i.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||""}`}},i.Ref.prototype[n.symbols.ref]=!0,e.build=function(e){return"value"===(e=Object.assign({},i.defaults,e)).type&&void 0===e.ancestor&&(e.ancestor=1),new i.Ref(e)},i.context=function(e,t,r={}){if(e=e.trim(),r){const s=void 0===r.global?"$":r.global;if(s!==t&&e.startsWith(s))return{key:e.slice(s.length),type:"global"};const n=void 0===r.local?"#":r.local;if(n!==t&&e.startsWith(n))return{key:e.slice(n.length),type:"local"};const a=void 0===r.root?"/":r.root;if(a!==t&&e.startsWith(a))return{key:e.slice(a.length),type:"value",root:!0}}return{key:e,type:"value"}},i.ancestor=function(e,t){if(!t)return[1,0];if(e[0]!==t)return[1,0];if(e[1]!==t)return[0,1];let r=2;for(;e[r]===t;)++r;return[r-1,r]},e.toSibling=0,e.toParent=1,e.Manager=class{constructor(){this.refs=[]}register(t,r){if(t)if(r=void 0===r?e.toParent:r,Array.isArray(t))for(const e of t)this.register(e,r);else if(n.isSchema(t))for(const e of t._refs.refs)e.ancestor-r>=0&&this.refs.push({ancestor:e.ancestor-r,root:e.root});else e.isRef(t)&&"value"===t.type&&t.ancestor-r>=0&&this.refs.push({ancestor:t.ancestor-r,root:t.root}),a=a||cr(),a.isTemplate(t)&&this.register(t.refs(),r)}get length(){return this.refs.length}clone(){const t=new e.Manager;return t.refs=r(this.refs),t}reset(){this.refs=[]}roots(){return this.refs.filter((e=>!e.ancestor)).map((e=>e.root))}}}(or)),or}function cr(){return sr||(sr=1,function(e,t){const r=Nt,s=Pt,n=Wt,a=Yt,i=dr(),o=tr(),l=lr(),c={symbol:Symbol("template"),opens:new Array(1e3).join("\0"),closes:new Array(1e3).join(""),dateFormat:{date:Date.prototype.toDateString,iso:Date.prototype.toISOString,string:Date.prototype.toString,time:Date.prototype.toTimeString,utc:Date.prototype.toUTCString}};e.exports=c.Template=class{constructor(e,t){r("string"==typeof e,"Template source must be a string"),r(!e.includes("\0")&&!e.includes(""),"Template source cannot contain reserved control characters"),this.source=e,this.rendered=e,this._template=null,this._settings=s(t),this._parse()}_parse(){if(!this.source.includes("{"))return;const e=c.encode(this.source),t=c.split(e);let r=!1;const s=[],n=t.shift();n&&s.push(n);for(const e of t){const t="{"!==e[0],n=t?"}":"}}",a=e.indexOf(n);if(-1===a||"{"===e[1]){s.push(`{${c.decode(e)}`);continue}let i=e.slice(t?0:1,a);const o=":"===i[0];o&&(i=i.slice(1));const l=this._ref(c.decode(i),{raw:t,wrapped:o});s.push(l),"string"!=typeof l&&(r=!0);const u=e.slice(a+n.length);u&&s.push(c.decode(u))}r?this._template=s:this.rendered=s.join("")}static date(e,t){return c.dateFormat[t.dateFormat].call(e)}describe(e={}){if(!this._settings&&e.compact)return this.source;const t={template:this.source};return this._settings&&(t.options=this._settings),t}static build(e){return new c.Template(e.template,e.options)}isDynamic(){return!!this._template}static isTemplate(e){return!!e&&!!e[i.symbols.template]}refs(){if(!this._template)return;const e=[];for(const t of this._template)"string"!=typeof t&&e.push(...t.refs);return e}resolve(e,t,r,s){return this._template&&1===this._template.length?this._part(this._template[0],e,t,r,s,{}):this.render(e,t,r,s)}_part(e,...t){return e.ref?e.ref.resolve(...t):e.formula.evaluate(t)}render(e,t,r,s,a={}){if(!this.isDynamic())return this.rendered;const i=[];for(const o of this._template)if("string"==typeof o)i.push(o);else{const l=this._part(o,e,t,r,s,a),u=c.stringify(l,e,t,r,s,a);if(void 0!==u){const e=o.raw||!1===(a.errors&&a.errors.escapeHtml)?u:n(u);i.push(c.wrap(e,o.wrapped&&r.errors.wrap.label))}}return i.join("")}_ref(e,{raw:t,wrapped:r}){const s=[],n=e=>{const t=l.create(e,this._settings);return s.push(t),e=>t.resolve(...e)};try{var i=new a.Parser(e,{reference:n,functions:c.functions,constants:c.constants})}catch(t){throw t.message=`Invalid template variable "${e}" fails due to: ${t.message}`,t}if(i.single){if("reference"===i.single.type){const e=s[0];return{ref:e,raw:t,refs:s,wrapped:r||"local"===e.type&&"label"===e.key}}return c.stringify(i.single.value)}return{formula:i,raw:t,refs:s}}toString(){return this.source}},c.Template.prototype[i.symbols.template]=!0,c.Template.prototype.isImmutable=!0,c.encode=function(e){return e.replace(/\\(\{+)/g,((e,t)=>c.opens.slice(0,t.length))).replace(/\\(\}+)/g,((e,t)=>c.closes.slice(0,t.length)))},c.decode=function(e){return e.replace(/\u0000/g,"{").replace(/\u0001/g,"}")},c.split=function(e){const t=[];let r="";for(let s=0;s<e.length;++s){const n=e[s];if("{"===n){let n="";for(;s+1<e.length&&"{"===e[s+1];)n+="{",++s;t.push(r),r=n}else r+=n}return t.push(r),t},c.wrap=function(e,t){return t?1===t.length?`${t}${e}${t}`:`${t[0]}${e}${t[1]}`:e},c.stringify=function(e,t,r,s,n,a={}){const i=typeof e,o=s&&s.errors&&s.errors.wrap||{};let u=!1;if(l.isRef(e)&&e.render&&(u=e.in,e=e.resolve(t,r,s,n,{in:e.in,...a})),null===e)return"null";if("string"===i)return c.wrap(e,a.arrayItems&&o.string);if("number"===i||"function"===i||"symbol"===i)return e.toString();if("object"!==i)return JSON.stringify(e);if(e instanceof Date)return c.Template.date(e,s);if(e instanceof Map){const t=[];for(const[r,s]of e.entries())t.push(`${r.toString()} -> ${s.toString()}`);e=t}if(!Array.isArray(e))return e.toString();const d=[];for(const i of e)d.push(c.stringify(i,t,r,s,n,{arrayItems:!0,...a}));return c.wrap(d.join(", "),!u&&o.array)},c.constants={true:!0,false:!1,null:null,second:1e3,minute:6e4,hour:36e5,day:864e5},c.functions={if:(e,t,r)=>e?t:r,length:e=>"string"==typeof e?e.length:e&&"object"==typeof e?Array.isArray(e)?e.length:Object.keys(e).length:null,msg(e){const[t,r,s,n,a]=this,i=a.messages;if(!i)return"";const l=o.template(t,i[0],e,r,s)||o.template(t,i[1],e,r,s);return l?l.render(t,r,s,n,a):""},number:e=>"number"==typeof e?e:"string"==typeof e?parseFloat(e):"boolean"==typeof e?e?1:0:e instanceof Date?e.getTime():null}}(Kt)),Kt.exports}function ur(){return nr||(nr=1,function(e){const t=Nt,r=Pt,s=cr();e.compile=function(e,n){if("string"==typeof e)return t(!n,"Cannot set single message string"),new s(e);if(s.isTemplate(e))return t(!n,"Cannot set single message template"),e;t("object"==typeof e&&!Array.isArray(e),"Invalid message options"),n=n?r(n):{};for(let r in e){const a=e[r];if("root"===r||s.isTemplate(a)){n[r]=a;continue}if("string"==typeof a){n[r]=new s(a);continue}t("object"==typeof a&&!Array.isArray(a),"Invalid message for",r);const i=r;for(r in n[i]=n[i]||{},a){const e=a[r];"root"===r||s.isTemplate(e)?n[i][r]=e:(t("string"==typeof e,"Invalid message for",r,"in",i),n[i][r]=new s(e))}}return n},e.decompile=function(e){const t={};for(let r in e){const n=e[r];if("root"===r){t.root=n;continue}if(s.isTemplate(n)){t[r]=n.describe({compact:!0});continue}const a=r;for(r in t[a]={},n){const e=n[r];"root"!==r?t[a][r]=e.describe({compact:!0}):t[a].root=e}}return t},e.merge=function(n,a){if(!n)return e.compile(a);if(!a)return n;if("string"==typeof a)return new s(a);if(s.isTemplate(a))return a;const i=r(n);for(let e in a){const r=a[e];if("root"===e||s.isTemplate(r)){i[e]=r;continue}if("string"==typeof r){i[e]=new s(r);continue}t("object"==typeof r&&!Array.isArray(r),"Invalid message for",e);const n=e;for(e in i[n]=i[n]||{},r){const a=r[e];"root"===e||s.isTemplate(a)?i[n][e]=a:(t("string"==typeof a,"Invalid message for",e,"in",n),i[n][e]=new s(a))}}return i}}(Xt)),Xt}function dr(){return ar||(ar=1,function(e){const t=Nt,r=Rt,s=Ft;let n,a;const i={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)?)?)?)?$/};e.version=s.version,e.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},e.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")},e.assertOptions=function(e,r,s="Options"){t(e&&"object"==typeof e&&!Array.isArray(e),"Options must be of type object");const n=Object.keys(e).filter((e=>!r.includes(e)));t(0===n.length,`${s} contain unknown keys: ${n}`)},e.checkPreferences=function(e){a=a||Ht();const t=a.preferences.validate(e);if(t.error)throw new r([t.error.details[0].message])},e.compare=function(e,t,r){switch(r){case"=":return e===t;case">":return e>t;case"<":return e<t;case">=":return e>=t;case"<=":return e<=t}},e.default=function(e,t){return void 0===e?t:e},e.isIsoDate=function(e){return i.isoDate.test(e)},e.isNumber=function(e){return"number"==typeof e&&!isNaN(e)},e.isResolvable=function(t){return!!t&&(t[e.symbols.ref]||t[e.symbols.template])},e.isSchema=function(r,s={}){const n=r&&r[e.symbols.any];return!!n&&(t(s.legacy||n.version===e.version,"Cannot mix different versions of joi schemas"),!0)},e.isValues=function(t){return t[e.symbols.values]},e.limit=function(e){return Number.isSafeInteger(e)&&e>=0},e.preferences=function(t,r){n=n||ur(),t=t||{},r=r||{};const s=Object.assign({},t,r);return r.errors&&t.errors&&(s.errors=Object.assign({},t.errors,r.errors),s.errors.wrap=Object.assign({},t.errors.wrap,r.errors.wrap)),r.messages&&(s.messages=n.compile(r.messages,t.messages)),delete s[e.symbols.prefs],s},e.tryWithPath=function(e,t,r={}){try{return e()}catch(e){throw void 0!==e.path?e.path=t+"."+e.path:e.path=t,r.append&&(e.message=`${e.message} (${e.path})`),e}},e.validateArg=function(t,r,{assert:s,message:n}){if(e.isSchema(s)){const e=s.validate(t);if(!e.error)return;return e.error.message}if(!s(t))return r?`${r} ${n}`:n},e.verifyFlat=function(e,r){for(const s of e)t(!Array.isArray(s),"Method no longer accepts array arguments:",r)}}(Gt)),Gt}function fr(){if(ir)return Ut;ir=1;const e=Nt,t=Pt,r=dr(),s={max:1e3,supported:new Set(["undefined","boolean","number","string"])};return Ut.provider={provision:e=>new s.Cache(e)},s.Cache=class{constructor(t={}){r.assertOptions(t,["max"]),e(void 0===t.max||t.max&&t.max>0&&isFinite(t.max),"Invalid max cache size"),this._max=t.max||s.max,this._map=new Map,this._list=new s.List}get length(){return this._map.size}set(e,t){if(null!==e&&!s.supported.has(typeof e))return;let r=this._map.get(e);if(r)return r.value=t,void this._list.first(r);r=this._list.unshift({key:e,value:t}),this._map.set(e,r),this._compact()}get(e){const r=this._map.get(e);if(r)return this._list.first(r),t(r.value)}_compact(){if(this._map.size>this._max){const e=this._list.pop();this._map.delete(e.key)}}},s.List=class{constructor(){this.tail=null,this.head=null}unshift(e){return e.next=null,e.prev=this.head,this.head&&(this.head.next=e),this.head=e,this.tail||(this.tail=e),e}first(e){e!==this.head&&(this._remove(e),this.unshift(e))}pop(){return this._remove(this.tail)}_remove(e){const{next:t,prev:r}=e;return t.prev=r,r&&(r.next=t),e===this.tail&&(this.tail=t),e.prev=null,e.next=null,e}},Ut}var hr,pr={};function mr(){return hr||(hr=1,function(e){const t=Nt,r=dr(),s=lr(),n={};e.schema=function(e,t,s={}){r.assertOptions(s,["appendPath","override"]);try{return n.schema(e,t,s)}catch(e){throw s.appendPath&&void 0!==e.path&&(e.message=`${e.message} (${e.path})`),e}},n.schema=function(e,s,a){t(void 0!==s,"Invalid undefined schema"),Array.isArray(s)&&(t(s.length,"Invalid empty array schema"),1===s.length&&(s=s[0]));const i=(t,...r)=>!1!==a.override?t.valid(e.override,...r):t.valid(...r);if(n.simple(s))return i(e,s);if("function"==typeof s)return e.custom(s);if(t("object"==typeof s,"Invalid schema content:",typeof s),r.isResolvable(s))return i(e,s);if(r.isSchema(s))return s;if(Array.isArray(s)){for(const t of s)if(!n.simple(t))return e.alternatives().try(...s);return i(e,...s)}return s instanceof RegExp?e.string().regex(s):s instanceof Date?i(e.date(),s):(t(Object.getPrototypeOf(s)===Object.getPrototypeOf({}),"Schema can only contain plain objects"),e.object().keys(s))},e.ref=function(e,t){return s.isRef(e)?e:s.create(e,t)},e.compile=function(s,a,i={}){r.assertOptions(i,["legacy"]);const o=a&&a[r.symbols.any];if(o)return t(i.legacy||o.version===r.version,"Cannot mix different versions of joi schemas:",o.version,r.version),a;if("object"!=typeof a||!i.legacy)return e.schema(s,a,{appendPath:!0});const l=n.walk(a);return l?l.compile(l.root,a):e.schema(s,a,{appendPath:!0})},n.walk=function(e){if("object"!=typeof e)return null;if(Array.isArray(e)){for(const t of e){const e=n.walk(t);if(e)return e}return null}const s=e[r.symbols.any];if(s)return{root:e[s.root],compile:s.compile};t(Object.getPrototypeOf(e)===Object.getPrototypeOf({}),"Schema can only contain plain objects");for(const t in e){const r=n.walk(e[t]);if(r)return r}return null},n.simple=function(e){return null===e||["boolean","string","number"].includes(typeof e)},e.when=function(a,i,o){if(void 0===o&&(t(i&&"object"==typeof i,"Missing options"),o=i,i=s.create(".")),Array.isArray(o)&&(o={switch:o}),r.assertOptions(o,["is","not","then","otherwise","switch","break"]),r.isSchema(i))return t(void 0===o.is,'"is" can not be used with a schema condition'),t(void 0===o.not,'"not" can not be used with a schema condition'),t(void 0===o.switch,'"switch" can not be used with a schema condition'),n.condition(a,{is:i,then:o.then,otherwise:o.otherwise,break:o.break});if(t(s.isRef(i)||"string"==typeof i,"Invalid condition:",i),t(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?a.$_compile(l.is):a.$_root.invalid(null,!1,0,"").required();return t(void 0!==l.then||void 0!==l.otherwise,'options must have at least one of "then", "otherwise", or "switch"'),t(void 0===l.break||void 0===l.then||void 0===l.otherwise,"Cannot specify then, otherwise, and break all together"),void 0===o.is||s.isRef(o.is)||r.isSchema(o.is)||(c=c.required()),n.condition(a,{ref:e.ref(i),is:c,then:l.then,otherwise:l.otherwise,break:l.break})}t(Array.isArray(o.switch),'"switch" must be an array'),t(void 0===o.is,'Cannot combine "switch" with "is"'),t(void 0===o.not,'Cannot combine "switch" with "not"'),t(void 0===o.then,'Cannot combine "switch" with "then"');const l={ref:e.ref(i),switch:[],break:o.break};for(let e=0;e<o.switch.length;++e){const n=o.switch[e],i=e===o.switch.length-1;r.assertOptions(n,i?["is","then","otherwise"]:["is","then"]),t(void 0!==n.is,'Switch statement missing "is"'),t(void 0!==n.then,'Switch statement missing "then"');const c={is:a.$_compile(n.is),then:a.$_compile(n.then)};if(s.isRef(n.is)||r.isSchema(n.is)||(c.is=c.is.required()),i){t(void 0===o.otherwise||void 0===n.otherwise,'Cannot specify "otherwise" inside and outside a "switch"');const e=void 0!==o.otherwise?o.otherwise:n.otherwise;void 0!==e&&(t(void 0===l.break,"Cannot specify both otherwise and break"),c.otherwise=a.$_compile(e))}l.switch.push(c)}return l},n.condition=function(e,t){for(const r of["then","otherwise"])void 0===t[r]?delete t[r]:t[r]=e.$_compile(t[r]);return t}}(pr)),pr}var gr,yr={};function vr(){if(gr)return yr;gr=1;const e=Nt,t=Pt,r=dr(),s=ur(),n={};return yr.type=function(a,i){const o=Object.getPrototypeOf(a),l=t(o),c=a._assign(Object.create(l)),u=Object.assign({},i);delete u.base,l._definition=u;const d=o._definition||{};u.messages=s.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 t in u.terms){const r=u.terms[t];e(void 0===c.$_terms[t],"Invalid term override for",u.type,t),c.$_terms[t]=r.init,f[t]=r}u.terms=f,u.args||(u.args=d.args),u.prepare=n.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=n.coerce(u.coerce,d.coerce),u.validate=n.validate(u.validate,d.validate);const h=Object.assign({},d.rules);if(u.rules)for(const t in u.rules){const s=u.rules[t];e("object"==typeof s,"Invalid rule definition for",u.type,t);let n=s.method;if(void 0===n&&(n=function(){return this.$_addRule(t)}),n&&(e(!l[t],"Rule conflict in",u.type,t),l[t]=n),e(!h[t],"Rule conflict in",u.type,t),h[t]=s,s.alias){const e=[].concat(s.alias);for(const t of e)l[t]=s.method}s.args&&(s.argsByName=new Map,s.args=s.args.map((t=>("string"==typeof t&&(t={name:t}),e(!s.argsByName.has(t.name),"Duplicated argument name",t.name),r.isSchema(t.assert)&&(t.assert=t.assert.strict().label(t.name)),s.argsByName.set(t.name,t),t))))}u.rules=h;const p=Object.assign({},d.modifiers);if(u.modifiers)for(const t in u.modifiers){e(!l[t],"Rule conflict in",u.type,t);const r=u.modifiers[t];e("function"==typeof r,"Invalid modifier definition for",u.type,t);const s=function(e){return this.rule({[t]:e})};l[t]=s,p[t]=r}if(u.modifiers=p,u.overrides){l._super=o,c.$_super={};for(const t in u.overrides)e(o[t],"Cannot override missing",t),u.overrides[t][r.symbols.parent]=o[t],c.$_super[t]=o[t].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=n.build(u.manifest&&u.manifest.build,d.manifest&&d.manifest.build),u.manifest=m,u.rebuild=n.rebuild(u.rebuild,d.rebuild),c},n.build=function(e,t){return e&&t?function(r,s){return t(e(r,s),s)}:e||t},n.coerce=function(e,t){return e&&t?{from:e.from&&t.from?[...new Set([...e.from,...t.from])]:null,method(r,s){let n;if((!t.from||t.from.includes(typeof r))&&(n=t.method(r,s),n)){if(n.errors||void 0===n.value)return n;r=n.value}if(!e.from||e.from.includes(typeof r)){const t=e.method(r,s);if(t)return t}return n}}:e||t},n.prepare=function(e,t){return e&&t?function(r,s){const n=e(r,s);if(n){if(n.errors||void 0===n.value)return n;r=n.value}return t(r,s)||n}:e||t},n.rebuild=function(e,t){return e&&t?function(r){t(r),e(r)}:e||t},n.validate=function(e,t){return e&&t?function(r,s){const n=t(r,s);if(n){if(n.errors&&(!Array.isArray(n.errors)||n.errors.length))return n;r=n.value}return e(r,s)||n}:e||t},yr}var _r,br={};function Ar(){if(_r)return br;_r=1;const e=Nt,t=Pt,r=dr(),s=ur(),n=lr(),a=cr();let i;const o={};return br.describe=function(n){const a=n._definition,i={type:n.type,flags:{},rules:[]};for(const e in n._flags)"_"!==e[0]&&(i.flags[e]=o.describe(n._flags[e]));Object.keys(i.flags).length||delete i.flags,n._preferences&&(i.preferences=t(n._preferences,{shallow:["messages"]}),delete i.preferences[r.symbols.prefs],i.preferences.messages&&(i.preferences.messages=s.decompile(i.preferences.messages))),n._valids&&(i.allow=n._valids.describe()),n._invalids&&(i.invalid=n._invalids.describe());for(const e of n._rules){if(!1===a.rules[e.name].manifest)continue;const t={name:e.name};for(const r in a.modifiers)void 0!==e[r]&&(t[r]=o.describe(e[r]));if(e.args){t.args={};for(const r in e.args){const s=e.args[r];("options"!==r||Object.keys(s).length)&&(t.args[r]=o.describe(s,{assign:r}))}Object.keys(t.args).length||delete t.args}i.rules.push(t)}i.rules.length||delete i.rules;for(const t in n.$_terms){if("_"===t[0])continue;e(!i[t],"Cannot describe schema due to internal name conflict with",t);const s=n.$_terms[t];if(!s)continue;if(s instanceof Map){s.size&&(i[t]=[...s.entries()]);continue}if(r.isValues(s)){i[t]=s.describe();continue}e(a.terms[t],"Term",t,"missing configuration");const l=a.terms[t].manifest,c="object"==typeof l;if(!s.length&&!c)continue;const u=[];for(const e of s)u.push(o.describe(e));if(c){const{from:e,to:r}=l.mapped;i[t]={};for(const s of u)i[t][s[r]]=s[e]}else"single"!==l?i[t]=u:(e(1===u.length,"Term",t,"contains more than one item"),i[t]=u[0])}return o.validate(n.$_root,i),i},o.describe=function(e,s={}){if(Array.isArray(e))return e.map(o.describe);if(e===r.symbols.deepDefault)return{special:"deep"};if("object"!=typeof e||null===e)return e;if("options"===s.assign)return t(e);if(Buffer&&Buffer.isBuffer(e))return{buffer:e.toString("binary")};if(e instanceof Date)return e.toISOString();if(e instanceof Error)return e;if(e instanceof RegExp)return"regex"===s.assign?e.toString():{regex:e.toString()};if(e[r.symbols.literal])return{function:e.literal};if("function"==typeof e.describe)return"ref"===s.assign?e.describe().ref:e.describe();const n={};for(const t in e){const r=e[t];void 0!==r&&(n[t]=o.describe(r,{assign:t}))}return n},br.build=function(e,t){return new o.Builder(e).parse(t)},o.Builder=class{constructor(e){this.joi=e}parse(t){o.validate(this.joi,t);let r=this.joi[t.type]()._bare();const s=r._definition;if(t.flags)for(const n in t.flags){const a=s.flags[n]&&s.flags[n].setter||n;e("function"==typeof r[a],"Invalid flag",n,"for type",t.type),r=r[a](this.build(t.flags[n]))}if(t.preferences&&(r=r.preferences(this.build(t.preferences))),t.allow&&(r=r.allow(...this.build(t.allow))),t.invalid&&(r=r.invalid(...this.build(t.invalid))),t.rules)for(const n of t.rules){e("function"==typeof r[n.name],"Invalid rule",n.name,"for type",t.type);const a=[];if(n.args){const r={};for(const e in n.args)r[e]=this.build(n.args[e],{assign:e});const i=Object.keys(r),o=s.rules[n.name].args;if(o){e(i.length<=o.length,"Invalid number of arguments for",t.type,n.name,"(expected up to",o.length,", found",i.length,")");for(const{name:e}of o)a.push(r[e])}else e(1===i.length,"Invalid number of arguments for",t.type,n.name,"(expected up to 1, found",i.length,")"),a.push(r[i[0]])}r=r[n.name](...a);const i={};for(const e in s.modifiers)void 0!==n[e]&&(i[e]=this.build(n[e]));Object.keys(i).length&&(r=r.rule(i))}const n={};for(const r in t){if(["allow","flags","invalid","whens","preferences","rules","type"].includes(r))continue;e(s.terms[r],"Term",r,"missing configuration");const a=s.terms[r].manifest;if("schema"!==a)if("values"!==a)if("single"!==a)if("object"!=typeof a)n[r]=this.build(t[r]);else{n[r]={};for(const e in t[r]){const s=t[r][e];n[r][e]=this.parse(s)}}else n[r]=this.build(t[r]);else n[r]=t[r].map((e=>this.build(e)));else n[r]=t[r].map((e=>this.parse(e)))}return t.whens&&(n.whens=t.whens.map((e=>this.build(e)))),r=s.manifest.build(r,n),r.$_temp.ruleset=!1,r}build(s,i={}){if(null===s)return null;if(Array.isArray(s))return s.map((e=>this.build(e)));if(s instanceof Error)return s;if("options"===i.assign)return t(s);if("regex"===i.assign)return o.regex(s);if("ref"===i.assign)return n.build(s);if("object"!=typeof s)return s;if(1===Object.keys(s).length){if(s.buffer)return e(Buffer,"Buffers are not supported"),Buffer&&Buffer.from(s.buffer,"binary");if(s.function)return{[r.symbols.literal]:!0,literal:s.function};if(s.override)return r.symbols.override;if(s.ref)return n.build(s.ref);if(s.regex)return o.regex(s.regex);if(s.special)return e(["deep"].includes(s.special),"Unknown special value",s.special),r.symbols.deepDefault;if(s.value)return t(s.value)}if(s.type)return this.parse(s);if(s.template)return a.build(s);const l={};for(const e in s)l[e]=this.build(s[e],{assign:e});return l}},o.regex=function(e){const t=e.lastIndexOf("/"),r=e.slice(1,t),s=e.slice(t+1);return new RegExp(r,s)},o.validate=function(e,t){i=i||Ht(),e.assert(t,i.description)},br}var Er={};const Sr=$t,Or={mismatched:null};var Rr=function(e,t,r){return r=Object.assign({prototype:!0},r),!!Or.isDeepEqual(e,t,r,[])};Or.isDeepEqual=function(e,t,r,s){if(e===t)return 0!==e||1/e==1/t;const n=typeof e;if(n!==typeof t)return!1;if(null===e||null===t)return!1;if("function"===n){if(!r.deepFunction||e.toString()!==t.toString())return!1}else if("object"!==n)return e!=e&&t!=t;const a=Or.getSharedType(e,t,!!r.prototype);switch(a){case Sr.buffer:return Buffer&&Buffer.prototype.equals.call(e,t);case Sr.promise:return e===t;case Sr.regex:return e.toString()===t.toString();case Or.mismatched:return!1}for(let r=s.length-1;r>=0;--r)if(s[r].isSame(e,t))return!0;s.push(new Or.SeenEntry(e,t));try{return!!Or.isDeepEqualObj(a,e,t,r,s)}finally{s.pop()}},Or.getSharedType=function(e,t,r){if(r)return Object.getPrototypeOf(e)!==Object.getPrototypeOf(t)?Or.mismatched:Sr.getInternalProto(e);const s=Sr.getInternalProto(e);return s!==Sr.getInternalProto(t)?Or.mismatched:s},Or.valueOf=function(e){const t=e.valueOf;if(void 0===t)return e;try{return t.call(e)}catch(e){return e}},Or.hasOwnEnumerableProperty=function(e,t){return Object.prototype.propertyIsEnumerable.call(e,t)},Or.isSetSimpleEqual=function(e,t){for(const r of Set.prototype.values.call(e))if(!Set.prototype.has.call(t,r))return!1;return!0},Or.isDeepEqualObj=function(e,t,r,s,n){const{isDeepEqual:a,valueOf:i,hasOwnEnumerableProperty:o}=Or,{keys:l,getOwnPropertySymbols:c}=Object;if(e===Sr.array){if(!s.part){if(t.length!==r.length)return!1;for(let e=0;e<t.length;++e)if(!a(t[e],r[e],s,n))return!1;return!0}for(const e of t)for(const t of r)if(a(e,t,s,n))return!0}else if(e===Sr.set){if(t.size!==r.size)return!1;if(!Or.isSetSimpleEqual(t,r)){const e=new Set(Set.prototype.values.call(r));for(const r of Set.prototype.values.call(t)){if(e.delete(r))continue;let t=!1;for(const i of e)if(a(r,i,s,n)){e.delete(i),t=!0;break}if(!t)return!1}}}else if(e===Sr.map){if(t.size!==r.size)return!1;for(const[e,i]of Map.prototype.entries.call(t)){if(void 0===i&&!Map.prototype.has.call(r,e))return!1;if(!a(i,Map.prototype.get.call(r,e),s,n))return!1}}else if(e===Sr.error&&(t.name!==r.name||t.message!==r.message))return!1;const u=i(t),d=i(r);if((t!==u||r!==d)&&!a(u,d,s,n))return!1;const f=l(t);if(!s.part&&f.length!==l(r).length&&!s.skip)return!1;let h=0;for(const e of f)if(s.skip&&s.skip.includes(e))void 0===r[e]&&++h;else{if(!o(r,e))return!1;if(!a(t[e],r[e],s,n))return!1}if(!s.part&&f.length-h!==l(r).length)return!1;if(!1!==s.symbols){const e=c(t),i=new Set(c(r));for(const l of e){if(!s.skip||!s.skip.includes(l))if(o(t,l)){if(!o(r,l))return!1;if(!a(t[l],r[l],s,n))return!1}else if(o(r,l))return!1;i.delete(l)}for(const e of i)if(o(r,e))return!1}return!0},Or.SeenEntry=class{constructor(e,t){this.obj=e,this.ref=t}isSame(e,t){return this.obj===e&&this.ref===t}};var wr,Nr={};function Ir(){if(wr)return Er;wr=1;const e=Rr,t=Nr,r=tr(),s={codes:{error:1,pass:2,full:3},labels:{0:"never used",1:"always error",2:"always pass"}};return Er.setup=function(e){const t=function(){return e._tracer=e._tracer||new s.Tracer,e._tracer};e.trace=t,e[Symbol.for("@hapi/lab/coverage/initialize")]=t,e.untrace=()=>{e._tracer=null}},Er.location=function(e){return e.$_setFlag("_tracerLocation",t.location(2))},s.Tracer=class{constructor(){this.name="Joi",this._schemas=new Map}_register(e){const r=this._schemas.get(e);if(r)return r.store;const n=new s.Store(e),{filename:a,line:i}=e._flags._tracerLocation||t.location(5);return this._schemas.set(e,{filename:a,line:i,store:n}),n}_combine(e,t){for(const{store:r}of this._schemas.values())r._combine(e,t)}report(e){const t=[];for(const{filename:r,line:n,store:a}of this._schemas.values()){if(e&&e!==r)continue;const i=[],o=[];for(const[e,t]of a._sources.entries()){if(s.sub(t.paths,o))continue;if(!t.entry){i.push({status:"never reached",paths:[...t.paths]}),o.push(...t.paths);continue}for(const r of["valid","invalid"]){const s=e[`_${r}s`];if(!s)continue;const n=new Set(s._values),a=new Set(s._refs);for(const{value:e,ref:s}of t[r])n.delete(e),a.delete(s);(n.size||a.size)&&i.push({status:[...n,...[...a].map((e=>e.display))],rule:`${r}s`})}const r=e._rules.map((e=>e.name));for(const t of["default","failover"])void 0!==e._flags[t]&&r.push(t);for(const e of r){const r=s.labels[t.rule[e]||0];if(r){const s={rule:e,status:r};t.paths.size&&(s.paths=[...t.paths]),i.push(s)}}}i.length&&t.push({filename:r,line:n,missing:i,severity:"error",message:`Schema missing tests for ${i.map(s.message).join(", ")}`})}return t.length?t:null}},s.Store=class{constructor(e){this.active=!0,this._sources=new Map,this._combos=new Map,this._scan(e)}debug(e,t,r,s){e.mainstay.debug&&e.mainstay.debug.push({type:t,name:r,result:s,path:e.path})}entry(e,t){s.debug(t,{type:"entry"}),this._record(e,(e=>{e.entry=!0}))}filter(e,t,r,n){s.debug(t,{type:r,...n}),this._record(e,(e=>{e[r].add(n)}))}log(e,t,r,n,a){s.debug(t,{type:r,name:n,result:"full"===a?"pass":a}),this._record(e,(e=>{e[r][n]=e[r][n]||0,e[r][n]|=s.codes[a]}))}resolve(e,t,r){if(!e.mainstay.debug)return;const s={type:"resolve",ref:t.display,to:r,path:e.path};e.mainstay.debug.push(s)}value(t,r,s,n,a){if(!t.mainstay.debug||e(s,n))return;const i={type:"value",by:r,from:s,to:n,path:t.path};a&&(i.name=a),t.mainstay.debug.push(i)}_record(e,t){const r=this._sources.get(e);if(r)return void t(r);const s=this._combos.get(e);for(const e of s)this._record(e,t)}_scan(e,t){const r=t||[];let n=this._sources.get(e);n||(n={paths:new Set,entry:!1,rule:{},valid:new Set,invalid:new Set},this._sources.set(e,n)),r.length&&n.paths.add(r);e.$_modify({each:(e,t)=>{const n=s.id(e,t);this._scan(e,r.concat(n))},ref:!1})}_combine(e,t){this._combos.set(e,t)}},s.message=function(e){return`${e.paths?r.path(e.paths[0])+(e.rule?":":""):""}${e.rule||""} (${e.status})`},s.id=function(e,{source:t,name:r,path:s,key:n}){return e._flags.id?e._flags.id:n||(r=`@${r}`,"terms"===t?[r,s[Math.min(s.length-1,1)]]:r)},s.sub=function(t,r){for(const s of t)for(const t of r)if(e(s.slice(0,t.length),t))return!0;return!1},s.debug=function(e,t){e.mainstay.debug&&(t.path=e.debug?[...e.path,e.debug]:e.path,e.mainstay.debug.push(t))},Er}Nr.location=function(e=0){const t=Error.prepareStackTrace;Error.prepareStackTrace=(e,t)=>t;const r={};Error.captureStackTrace(r,this);const s=r.stack[e+1];return Error.prepareStackTrace=t,{filename:s.getFileName(),line:s.getLineNumber()}};const Tr=Nt,xr=Pt,Cr=kt,$r={};var kr,Lr=$r.merge=function(e,t,r){if(Tr(e&&"object"==typeof e,"Invalid target value: must be an object"),Tr(null==t||"object"==typeof t,"Invalid source value: must be null, undefined, or an object"),!t)return e;if(r=Object.assign({nullOverride:!0,mergeArrays:!0},r),Array.isArray(t)){Tr(Array.isArray(e),"Cannot merge array onto an object"),r.mergeArrays||(e.length=0);for(let s=0;s<t.length;++s)e.push(xr(t[s],{symbols:r.symbols}));return e}const s=Cr.keys(t,r);for(let n=0;n<s.length;++n){const a=s[n];if("__proto__"===a||!Object.prototype.propertyIsEnumerable.call(t,a))continue;const i=t[a];if(i&&"object"==typeof i){if(e[a]===i)continue;!e[a]||"object"!=typeof e[a]||Array.isArray(e[a])!==Array.isArray(i)||i instanceof Date||Buffer&&Buffer.isBuffer(i)||i instanceof RegExp?e[a]=xr(i,{symbols:r.symbols}):$r.merge(e[a],i,r)}else(null!=i||r.nullOverride)&&(e[a]=i)}return e},Mr={};var Dr,jr,Pr,Br,Ur,Gr,Fr,Zr,Hr,Xr,Kr,Vr,Wr,Yr,zr,qr,Jr,Qr={},es=function(){};function ts(){return Pr||(Pr=1,function(e){const t=Nt,r=Pt,s=es,n=xt,a=dr(),i=tr(),o=function(){if(jr)return Dr;jr=1;const e=Pt,t=xt,r=dr(),s={value:Symbol("value")};return Dr=s.State=class{constructor(e,t,r){this.path=e,this.ancestors=t,this.mainstay=r.mainstay,this.schemas=r.schemas,this.debug=null}localize(e,t=null,r=null){const n=new s.State(e,t,this);return r&&n.schemas&&(n.schemas=[s.schemas(r),...n.schemas]),n}nest(e,t){const r=new s.State(this.path,this.ancestors,this);return r.schemas=r.schemas&&[s.schemas(e),...r.schemas],r.debug=t,r}shadow(e,t){this.mainstay.shadow=this.mainstay.shadow||new s.Shadow,this.mainstay.shadow.set(this.path,e,t)}snapshot(){this.mainstay.shadow&&(this._snapshot=e(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()}},s.schemas=function(e){return r.isSchema(e)?{schema:e}:e},s.Shadow=class{constructor(){this._values=null}set(e,t,r){if(!e.length)return;if("strip"===r&&"number"==typeof e[e.length-1])return;this._values=this._values||new Map;let n=this._values;for(let t=0;t<e.length;++t){const r=e[t];let s=n.get(r);s||(s=new Map,n.set(r,s)),n=s}n[s.value]=t}get(e){const t=this.node(e);if(t)return t[s.value]}node(e){if(this._values)return t(this._values,e,{iterables:!0})}override(e,r){if(!this._values)return;const s=e.slice(0,-1),n=e[e.length-1],a=t(this._values,s,{iterables:!0});r?a.set(n,r):a&&a.delete(n)}},Dr}(),l={result:Symbol("result")};e.entry=function(e,r,s){let n=a.defaults;s&&(t(void 0===s.warnings,"Cannot override warnings preference in synchronous validation"),t(void 0===s.artifacts,"Cannot override artifacts preference in synchronous validation"),n=a.preferences(a.defaults,s));const o=l.entry(e,r,n);t(!o.mainstay.externals.length,"Schema with external rules must use validateAsync()");const c={value:o.value};return o.error&&(c.error=o.error),o.mainstay.warnings.length&&(c.warning=i.details(o.mainstay.warnings)),o.mainstay.debug&&(c.debug=o.mainstay.debug),o.mainstay.artifacts&&(c.artifacts=o.mainstay.artifacts),c},e.entryAsync=async function(e,t,r){let s=a.defaults;r&&(s=a.preferences(a.defaults,r));const o=l.entry(e,t,s),c=o.mainstay;if(o.error)throw c.debug&&(o.error.debug=c.debug),o.error;if(c.externals.length){let t=o.value;const u=[];for(const o of c.externals){const d=o.state.path,f="link"===o.schema.type?c.links.get(o.schema):null;let h,p,m=t;const g=d.length?[t]:[],y=d.length?n(e,d):e;if(d.length){h=d[d.length-1];let e=t;for(const t of d.slice(0,-1))e=e[t],g.unshift(e);p=g[0],m=p[h]}try{const e=(e,t)=>(f||o.schema).$_createError(e,m,t,o.state,s),n=await o.method(m,{schema:o.schema,linked:f,state:o.state,prefs:r,original:y,error:e,errorsArray:l.errorsArray,warn:(e,t)=>c.warnings.push((f||o.schema).$_createError(e,m,t,o.state,s)),message:(e,t)=>(f||o.schema).$_createError("external",m,t,o.state,s,{messages:e})});if(void 0===n||n===m)continue;if(n instanceof i.Report){if(c.tracer.log(o.schema,o.state,"rule","external","error"),u.push(n),s.abortEarly)break;continue}if(Array.isArray(n)&&n[a.symbols.errors]){if(c.tracer.log(o.schema,o.state,"rule","external","error"),u.push(...n),s.abortEarly)break;continue}p?(c.tracer.value(o.state,"rule",m,n,"external"),p[h]=n):(c.tracer.value(o.state,"rule",t,n,"external"),t=n)}catch(e){throw s.errors.label&&(e.message+=` (${o.label})`),e}}if(o.value=t,u.length)throw o.error=i.process(u,e,s),c.debug&&(o.error.debug=c.debug),o.error}if(!s.warnings&&!s.debug&&!s.artifacts)return o.value;const u={value:o.value};return c.warnings.length&&(u.warning=i.details(c.warnings)),c.debug&&(u.debug=c.debug),c.artifacts&&(u.artifacts=c.artifacts),u},l.Mainstay=class{constructor(e,t,r){this.externals=[],this.warnings=[],this.tracer=e,this.debug=t,this.links=r,this.shadow=null,this.artifacts=null,this._snapshots=[]}snapshot(){this._snapshots.push({externals:this.externals.slice(),warnings:this.warnings.slice()})}restore(){const e=this._snapshots.pop();this.externals=e.externals,this.warnings=e.warnings}},l.entry=function(t,r,s){const{tracer:n,cleanup:a}=l.tracer(r,s),c=s.debug?[]:null,u=r._ids._schemaChain?new Map:null,d=new l.Mainstay(n,c,u),f=r._ids._schemaChain?[{schema:r}]:null,h=new o([],[],{mainstay:d,schemas:f}),p=e.validate(t,r,h,s);a&&r.$_root.untrace();const m=i.process(p.errors,t,s);return{value:p.value,error:m,mainstay:d}},l.tracer=function(e,r){return e.$_root._tracer?{tracer:e.$_root._tracer._register(e)}:r.debug?(t(e.$_root.trace,"Debug mode not supported"),{tracer:e.$_root.trace()._register(e),cleanup:!0}):{tracer:l.ignore}},e.validate=function(e,t,r,s,n={}){if(t.$_terms.whens&&(t=t._generate(e,r,s).schema),t._preferences&&(s=l.prefs(t,s)),t._cache&&s.cache){const s=t._cache.get(e);if(r.mainstay.tracer.debug(r,"validate","cached",!!s),s)return s}const i=(n,a,i)=>t.$_createError(n,e,a,i||r,s),o={original:e,prefs:s,schema:t,state:r,error:i,errorsArray:l.errorsArray,warn:(e,t,s)=>r.mainstay.warnings.push(i(e,t,s)),message:(n,a)=>t.$_createError("custom",e,a,r,s,{messages:n})};r.mainstay.tracer.entry(t,r);const c=t._definition;if(c.prepare&&void 0!==e&&s.convert){const t=c.prepare(e,o);if(t){if(r.mainstay.tracer.value(r,"prepare",e,t.value),t.errors)return l.finalize(t.value,[].concat(t.errors),o);e=t.value}}if(c.coerce&&void 0!==e&&s.convert&&(!c.coerce.from||c.coerce.from.includes(typeof e))){const t=c.coerce.method(e,o);if(t){if(r.mainstay.tracer.value(r,"coerced",e,t.value),t.errors)return l.finalize(t.value,[].concat(t.errors),o);e=t.value}}const u=t._flags.empty;u&&u.$_match(l.trim(e,t),r.nest(u),a.defaults)&&(r.mainstay.tracer.value(r,"empty",e,void 0),e=void 0);const d=n.presence||t._flags.presence||(t._flags._endedSwitch?null:s.presence);if(void 0===e){if("forbidden"===d)return l.finalize(e,null,o);if("required"===d)return l.finalize(e,[t.$_createError("any.required",e,null,r,s)],o);if("optional"===d){if(t._flags.default!==a.symbols.deepDefault)return l.finalize(e,null,o);r.mainstay.tracer.value(r,"default",e,{}),e={}}}else if("forbidden"===d)return l.finalize(e,[t.$_createError("any.unknown",e,null,r,s)],o);const f=[];if(t._valids){const n=t._valids.get(e,r,s,t._flags.insensitive);if(n)return s.convert&&(r.mainstay.tracer.value(r,"valids",e,n.value),e=n.value),r.mainstay.tracer.filter(t,r,"valid",n),l.finalize(e,null,o);if(t._flags.only){const n=t.$_createError("any.only",e,{valids:t._valids.values({display:!0})},r,s);if(s.abortEarly)return l.finalize(e,[n],o);f.push(n)}}if(t._invalids){const n=t._invalids.get(e,r,s,t._flags.insensitive);if(n){r.mainstay.tracer.filter(t,r,"invalid",n);const a=t.$_createError("any.invalid",e,{invalids:t._invalids.values({display:!0})},r,s);if(s.abortEarly)return l.finalize(e,[a],o);f.push(a)}}if(c.validate){const t=c.validate(e,o);if(t&&(r.mainstay.tracer.value(r,"base",e,t.value),e=t.value,t.errors)){if(!Array.isArray(t.errors))return f.push(t.errors),l.finalize(e,f,o);if(t.errors.length)return f.push(...t.errors),l.finalize(e,f,o)}}return t._rules.length?l.rules(e,f,o):l.finalize(e,f,o)},l.rules=function(e,t,r){const{schema:s,state:n,prefs:i}=r;for(const o of s._rules){const c=s._definition.rules[o.method];if(c.convert&&i.convert){n.mainstay.tracer.log(s,n,"rule",o.name,"full");continue}let u,d=o.args;if(o._resolve.length){d=Object.assign({},d);for(const t of o._resolve){const r=c.argsByName.get(t),o=d[t].resolve(e,n,i),l=r.normalize?r.normalize(o):o,f=a.validateArg(l,null,r);if(f){u=s.$_createError("any.ref",o,{arg:t,ref:d[t],reason:f},n,i);break}d[t]=l}}u=u||c.validate(e,r,d,o);const f=l.rule(u,o);if(f.errors){if(n.mainstay.tracer.log(s,n,"rule",o.name,"error"),o.warn){n.mainstay.warnings.push(...f.errors);continue}if(i.abortEarly)return l.finalize(e,f.errors,r);t.push(...f.errors)}else n.mainstay.tracer.log(s,n,"rule",o.name,"pass"),n.mainstay.tracer.value(n,"rule",e,f.value,o.name),e=f.value}return l.finalize(e,t,r)},l.rule=function(e,t){return e instanceof i.Report?(l.error(e,t),{errors:[e],value:null}):Array.isArray(e)&&e[a.symbols.errors]?(e.forEach((e=>l.error(e,t))),{errors:e,value:null}):{errors:null,value:e}},l.error=function(e,t){return t.message&&e._setTemplate(t.message),e},l.finalize=function(e,r,s){r=r||[];const{schema:n,state:a,prefs:o}=s;if(r.length){const t=l.default("failover",void 0,r,s);void 0!==t&&(a.mainstay.tracer.value(a,"failover",e,t),e=t,r=[])}if(r.length&&n._flags.error)if("function"==typeof n._flags.error){r=n._flags.error(r),Array.isArray(r)||(r=[r]);for(const e of r)t(e instanceof Error||e instanceof i.Report,"error() must return an Error object")}else r=[n._flags.error];if(void 0===e){const t=l.default("default",e,r,s);a.mainstay.tracer.value(a,"default",e,t),e=t}if(n._flags.cast&&void 0!==e){const t=n._definition.cast[n._flags.cast];if(t.from(e)){const r=t.to(e,s);a.mainstay.tracer.value(a,"cast",e,r,n._flags.cast),e=r}}if(n.$_terms.externals&&o.externals&&!1!==o._externals)for(const{method:e}of n.$_terms.externals)a.mainstay.externals.push({method:e,schema:n,state:a,label:i.label(n._flags,a,o)});const c={value:e,errors:r.length?r:null};return n._flags.result&&(c.value="strip"===n._flags.result?void 0:s.original,a.mainstay.tracer.value(a,n._flags.result,e,c.value),a.shadow(e,n._flags.result)),n._cache&&!1!==o.cache&&!n._refs.length&&n._cache.set(s.original,c),void 0===e||c.errors||void 0===n._flags.artifact||(a.mainstay.artifacts=a.mainstay.artifacts||new Map,a.mainstay.artifacts.has(n._flags.artifact)||a.mainstay.artifacts.set(n._flags.artifact,[]),a.mainstay.artifacts.get(n._flags.artifact).push(a.path)),c},l.prefs=function(e,t){const r=t===a.defaults;return r&&e._preferences[a.symbols.prefs]?e._preferences[a.symbols.prefs]:(t=a.preferences(t,e._preferences),r&&(e._preferences[a.symbols.prefs]=t),t)},l.default=function(e,t,s,n){const{schema:i,state:o,prefs:l}=n,c=i._flags[e];if(l.noDefaults||void 0===c)return t;if(o.mainstay.tracer.log(i,o,"rule",e,"full"),!c)return c;if("function"==typeof c){const t=c.length?[r(o.ancestors[0]),n]:[];try{return c(...t)}catch(t){return void s.push(i.$_createError(`any.${e}`,null,{error:t},o,l))}}return"object"!=typeof c?c:c[a.symbols.literal]?c.literal:a.isResolvable(c)?c.resolve(t,o,l):r(c)},l.trim=function(e,t){if("string"!=typeof e)return e;const r=t.$_getRule("trim");return r&&r.args.enabled?e.trim():e},l.ignore={active:!1,debug:s,entry:s,filter:s,log:s,resolve:s,value:s},l.errorsArray=function(){const e=[];return e[a.symbols.errors]=!0,e}}(Qr)),Qr}function rs(){if(Ur)return Br;Ur=1;const e=Nt,t=Rr,r=dr(),s={};return Br=s.Values=class{constructor(e,t){this._values=new Set(e),this._refs=new Set(t),this._lowercase=s.lowercases(e),this._override=!1}get length(){return this._values.size+this._refs.size}add(e,t){r.isResolvable(e)?this._refs.has(e)||(this._refs.add(e),t&&t.register(e)):this.has(e,null,null,!1)||(this._values.add(e),"string"==typeof e&&this._lowercase.set(e.toLowerCase(),e))}static merge(e,t,r){if(e=e||new s.Values,t){if(t._override)return t.clone();for(const r of[...t._values,...t._refs])e.add(r)}if(r)for(const t of[...r._values,...r._refs])e.remove(t);return e.length?e:null}remove(e){r.isResolvable(e)?this._refs.delete(e):(this._values.delete(e),"string"==typeof e&&this._lowercase.delete(e.toLowerCase()))}has(e,t,r,s){return!!this.get(e,t,r,s)}get(e,r,s,n){if(!this.length)return!1;if(this._values.has(e))return{value:e};if("string"==typeof e&&e&&n){const t=this._lowercase.get(e.toLowerCase());if(t)return{value:t}}if(!this._refs.size&&"object"!=typeof e)return!1;if("object"==typeof e)for(const r of this._values)if(t(r,e))return{value:r};if(r)for(const a of this._refs){const i=a.resolve(e,r,s,null,{in:!0});if(void 0===i)continue;const o=a.in&&"object"==typeof i?Array.isArray(i)?i:Object.keys(i):[i];for(const r of o)if(typeof r==typeof e)if(n&&e&&"string"==typeof e){if(r.toLowerCase()===e.toLowerCase())return{value:r,ref:a}}else if(t(r,e))return{value:r,ref:a}}return!1}override(){this._override=!0}values(e){if(e&&e.display){const e=[];for(const t of[...this._values,...this._refs])void 0!==t&&e.push(t);return e}return Array.from([...this._values,...this._refs])}clone(){const e=new s.Values(this._values,this._refs);return e._override=this._override,e}concat(t){e(!t._override,"Cannot concat override set of values");const r=new s.Values([...this._values,...t._values],[...this._refs,...t._refs]);return r._override=this._override,r}describe(){const e=[];this._override&&e.push({override:!0});for(const t of this._values.values())e.push(t&&"object"==typeof t?{value:t}:t);for(const t of this._refs.values())e.push(t.describe());return e}},s.Values.prototype[r.symbols.values]=!0,s.Values.prototype.slice=s.Values.prototype.clone,s.lowercases=function(e){const t=new Map;if(e)for(const r of e)"string"==typeof r&&t.set(r.toLowerCase(),r);return t},Br}function ss(){if(Fr)return Gr;Fr=1;const e=Nt,t=Pt,r=Rr,s=Lr,n=fr(),a=dr(),i=mr(),o=tr(),l=vr(),c=Ar(),u=ur(),d=(kr||(kr=1,function(e){const t=Nt,r=dr(),s=lr(),n={};e.Ids=n.Ids=class{constructor(){this._byId=new Map,this._byKey=new Map,this._schemaChain=!1}clone(){const e=new n.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[r,s]of e._byId.entries())t(!this._byKey.has(r),"Schema id conflicts with existing key:",r),this._byId.set(r,s);for(const[r,s]of e._byKey.entries())t(!this._byId.has(r),"Schema key conflicts with existing id:",r),this._byKey.set(r,s)}fork(e,s,a){const i=this._collect(e);i.push({schema:a});const o=i.shift();let l={id:o.id,schema:s(o.schema)};t(r.isSchema(l.schema),"adjuster function failed to return a joi schema type");for(const e of i)l={id:e.id,schema:n.fork(e.schema,l.id,l.schema)};return l.schema}labels(e,t=[]){const r=e[0],s=this._get(r);if(!s)return[...t,...e].join(".");const n=e.slice(1);return t=[...t,s.schema._flags.label||r],n.length?s.schema._ids.labels(n,t):t.join(".")}reach(e,r=[]){const s=e[0],n=this._get(s);t(n,"Schema does not contain path",[...r,...e].join("."));const a=e.slice(1);return a.length?n.schema._ids.reach(a,[...r,s]):n.schema}register(e,{key:s}={}){if(!e||!r.isSchema(e))return;(e.$_property("schemaChain")||e._ids._schemaChain)&&(this._schemaChain=!0);const n=e._flags.id;if(n){const r=this._byId.get(n);t(!r||r.schema===e,"Cannot add different schemas with the same id:",n),t(!this._byKey.has(n),"Schema id conflicts with existing key:",n),this._byId.set(n,{schema:e,id:n})}s&&(t(!this._byKey.has(s),"Schema already contains key:",s),t(!this._byId.has(s),"Schema key conflicts with existing id:",s),this._byKey.set(s,{schema:e,id:s}))}reset(){this._byId=new Map,this._byKey=new Map,this._schemaChain=!1}_collect(e,r=[],s=[]){const n=e[0],a=this._get(n);t(a,"Schema does not contain path",[...r,...e].join(".")),s=[a,...s];const i=e.slice(1);return i.length?a.schema._ids._collect(i,[...r,n],s):s}_get(e){return this._byId.get(e)||this._byKey.get(e)}},n.fork=function(t,r,s){const n=e.schema(t,{each:(e,{key:t})=>{if(r===(e._flags.id||t))return s},ref:!1});return n?n.$_mutateRebuild():t},e.schema=function(e,t){let r;for(const s in e._flags){if("_"===s[0])continue;const a=n.scan(e._flags[s],{source:"flags",name:s},t);void 0!==a&&(r=r||e.clone(),r._flags[s]=a)}for(let s=0;s<e._rules.length;++s){const a=e._rules[s],i=n.scan(a.args,{source:"rules",name:a.name},t);if(void 0!==i){r=r||e.clone();const t=Object.assign({},a);t.args=i,r._rules[s]=t,r._singleRules.get(a.name)===a&&r._singleRules.set(a.name,t)}}for(const s in e.$_terms){if("_"===s[0])continue;const a=n.scan(e.$_terms[s],{source:"terms",name:s},t);void 0!==a&&(r=r||e.clone(),r.$_terms[s]=a)}return r},n.scan=function(e,t,a,i,o){const l=i||[];if(null===e||"object"!=typeof e)return;let c;if(Array.isArray(e)){for(let r=0;r<e.length;++r){const s="terms"===t.source&&"keys"===t.name&&e[r].key,i=n.scan(e[r],t,a,[r,...l],s);void 0!==i&&(c=c||e.slice(),c[r]=i)}return c}if(!1!==a.schema&&r.isSchema(e)||!1!==a.ref&&s.isRef(e)){const r=a.each(e,{...t,path:l,key:o});if(r===e)return;return r}for(const r in e){if("_"===r[0])continue;const s=n.scan(e[r],t,a,[r,...l],o);void 0!==s&&(c=c||Object.assign({},e),c[r]=s)}return c}}(Mr)),Mr),f=lr(),h=Ir(),p=ts(),m=rs(),g={Base:class{constructor(e){this.type=e,this.$_root=null,this._definition={},this._reset()}_reset(){this._ids=new d.Ids,this._preferences=null,this._refs=new f.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 e("function"==typeof c.describe,"Manifest functionality disabled"),c.describe(this)}allow(...e){return a.verifyFlat(e,"allow"),this._values(e,"_valids")}alter(t){e(t&&"object"==typeof t&&!Array.isArray(t),"Invalid targets argument"),e(!this._inRuleset(),"Cannot set alterations inside a ruleset");const r=this.clone();r.$_terms.alterations=r.$_terms.alterations||[];for(const s in t){const n=t[s];e("function"==typeof n,"Alteration adjuster for",s,"must be a function"),r.$_terms.alterations.push({target:s,adjuster:n})}return r.$_temp.ruleset=!1,r}artifact(t){return e(void 0!==t,"Artifact cannot be undefined"),e(!this._cache,"Cannot set an artifact with a rule cache"),this.$_setFlag("artifact",t)}cast(t){return e(!1===t||"string"==typeof t,"Invalid to value"),e(!1===t||this._definition.cast[t],"Type",this.type,"does not support casting to",t),this.$_setFlag("cast",!1===t?void 0:t)}default(e,t){return this._default("default",e,t)}description(t){return e(t&&"string"==typeof t,"Description must be a non-empty string"),this.$_setFlag("description",t)}empty(e){const t=this.clone();return void 0!==e&&(e=t.$_compile(e,{override:!1})),t.$_setFlag("empty",e,{clone:!1})}error(t){return e(t,"Missing error"),e(t instanceof Error||"function"==typeof t,"Must provide a valid Error object or a function"),this.$_setFlag("error",t)}example(t,r={}){return e(void 0!==t,"Missing example"),a.assertOptions(r,["override"]),this._inner("examples",t,{single:!0,override:r.override})}external(t,r){return"object"==typeof t&&(e(!r,"Cannot combine options with description"),r=t.description,t=t.method),e("function"==typeof t,"Method must be a function"),e(void 0===r||r&&"string"==typeof r,"Description must be a non-empty string"),this._inner("externals",{method:t,description:r},{single:!0})}failover(e,t){return this._default("failover",e,t)}forbidden(){return this.presence("forbidden")}id(t){return t?(e("string"==typeof t,"id must be a non-empty string"),e(/^[^\.]+$/.test(t),"id cannot contain period character"),this.$_setFlag("id",t)):this.$_setFlag("id",void 0)}invalid(...e){return this._values(e,"_invalids")}label(t){return e(t&&"string"==typeof t,"Label name must be a non-empty string"),this.$_setFlag("label",t)}meta(t){return e(void 0!==t,"Meta cannot be undefined"),this._inner("metas",t,{single:!0})}note(...t){e(t.length,"Missing notes");for(const r of t)e(r&&"string"==typeof r,"Notes must be non-empty strings");return this._inner("notes",t)}only(t=!0){return e("boolean"==typeof t,"Invalid mode:",t),this.$_setFlag("only",t)}optional(){return this.presence("optional")}prefs(t){e(t,"Missing preferences"),e(void 0===t.context,"Cannot override context"),e(void 0===t.externals,"Cannot override externals"),e(void 0===t.warnings,"Cannot override warnings"),e(void 0===t.debug,"Cannot override debug"),a.checkPreferences(t);const r=this.clone();return r._preferences=a.preferences(r._preferences,t),r}presence(t){return e(["optional","required","forbidden"].includes(t),"Unknown presence mode",t),this.$_setFlag("presence",t)}raw(e=!0){return this.$_setFlag("result",e?"raw":void 0)}result(t){return e(["raw","strip"].includes(t),"Unknown result mode",t),this.$_setFlag("result",t)}required(){return this.presence("required")}strict(e){const t=this.clone(),r=void 0!==e&&!e;return t._preferences=a.preferences(t._preferences,{convert:r}),t}strip(e=!0){return this.$_setFlag("result",e?"strip":void 0)}tag(...t){e(t.length,"Missing tags");for(const r of t)e(r&&"string"==typeof r,"Tags must be non-empty strings");return this._inner("tags",t)}unit(t){return e(t&&"string"==typeof t,"Unit name must be a non-empty string"),this.$_setFlag("unit",t)}valid(...e){a.verifyFlat(e,"valid");const t=this.allow(...e);return t.$_setFlag("only",!!t._valids,{clone:!1}),t}when(t,r){const s=this.clone();s.$_terms.whens||(s.$_terms.whens=[]);const n=i.when(s,t,r);if(!["any","link"].includes(s.type)){const t=n.is?[n]:n.switch;for(const r of t)e(!r.then||"any"===r.then.type||r.then.type===s.type,"Cannot combine",s.type,"with",r.then&&r.then.type),e(!r.otherwise||"any"===r.otherwise.type||r.otherwise.type===s.type,"Cannot combine",s.type,"with",r.otherwise&&r.otherwise.type)}return s.$_terms.whens.push(n),s.$_mutateRebuild()}cache(t){e(!this._inRuleset(),"Cannot set caching inside a ruleset"),e(!this._cache,"Cannot override schema cache"),e(void 0===this._flags.artifact,"Cannot cache a rule with an artifact");const r=this.clone();return r._cache=t||n.provider.provision(),r.$_temp.ruleset=!1,r}clone(){const e=Object.create(Object.getPrototypeOf(this));return this._assign(e)}concat(t){e(a.isSchema(t),"Invalid schema object"),e("any"===this.type||"any"===t.type||t.type===this.type,"Cannot merge type",this.type,"with another type:",t.type),e(!this._inRuleset(),"Cannot concatenate onto a schema with open ruleset"),e(!t._inRuleset(),"Cannot concatenate a schema with open ruleset");let r=this.clone();if("any"===this.type&&"any"!==t.type){const e=t.clone();for(const t of Object.keys(r))"type"!==t&&(e[t]=r[t]);r=e}r._ids.concat(t._ids),r._refs.register(t,f.toSibling),r._preferences=r._preferences?a.preferences(r._preferences,t._preferences):t._preferences,r._valids=m.merge(r._valids,t._valids,t._invalids),r._invalids=m.merge(r._invalids,t._invalids,t._valids);for(const e of t._singleRules.keys())r._singleRules.has(e)&&(r._rules=r._rules.filter((t=>t.keep||t.name!==e)),r._singleRules.delete(e));for(const e of t._rules)t._definition.rules[e.method].multi||r._singleRules.set(e.name,e),r._rules.push(e);if(r._flags.empty&&t._flags.empty){r._flags.empty=r._flags.empty.concat(t._flags.empty);const e=Object.assign({},t._flags);delete e.empty,s(r._flags,e)}else if(t._flags.empty){r._flags.empty=t._flags.empty;const e=Object.assign({},t._flags);delete e.empty,s(r._flags,e)}else s(r._flags,t._flags);for(const e in t.$_terms){const s=t.$_terms[e];s?r.$_terms[e]?r.$_terms[e]=r.$_terms[e].concat(s):r.$_terms[e]=s.slice():r.$_terms[e]||(r.$_terms[e]=s)}return this.$_root._tracer&&this.$_root._tracer._combine(r,[this,t]),r.$_mutateRebuild()}extend(t){return e(!t.base,"Cannot extend type with another base"),l.type(this,t)}extract(e){return e=Array.isArray(e)?e:e.split("."),this._ids.reach(e)}fork(t,r){e(!this._inRuleset(),"Cannot fork inside a ruleset");let s=this;for(let e of[].concat(t))e=Array.isArray(e)?e:e.split("."),s=s._ids.fork(e,r,s);return s.$_temp.ruleset=!1,s}rule(r){const s=this._definition;a.assertOptions(r,Object.keys(s.modifiers)),e(!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;e(n>=0&&n<this._rules.length,"Cannot apply rules to empty ruleset");const i=this.clone();for(let a=n;a<i._rules.length;++a){const n=i._rules[a],o=t(n);for(const t in r)s.modifiers[t](o,r[t]),e(o.name===n.name,"Cannot change rule name");i._rules[a]=o,i._singleRules.get(o.name)===n&&i._singleRules.set(o.name,o)}return i.$_temp.ruleset=!1,i.$_mutateRebuild()}get ruleset(){e(!this._inRuleset(),"Cannot start a new ruleset without closing the previous one");const t=this.clone();return t.$_temp.ruleset=t._rules.length,t}get $(){return this.ruleset}tailor(t){t=[].concat(t),e(!this._inRuleset(),"Cannot tailor inside a ruleset");let r=this;if(this.$_terms.alterations)for(const{target:s,adjuster:n}of this.$_terms.alterations)t.includes(s)&&(r=n(r),e(a.isSchema(r),"Alteration adjuster for",s,"failed to return a schema object"));return r=r.$_modify({each:e=>e.tailor(t),ref:!1}),r.$_temp.ruleset=!1,r.$_mutateRebuild()}tracer(){return h.location?h.location(this):this}validate(e,t){return p.entry(e,this,t)}validateAsync(e,t){return p.entryAsync(e,this,t)}$_addRule(t){"string"==typeof t&&(t={name:t}),e(t&&"object"==typeof t,"Invalid options"),e(t.name&&"string"==typeof t.name,"Invalid rule name");for(const r in t)e("_"!==r[0],"Cannot set private rule properties");const r=Object.assign({},t);r._resolve=[],r.method=r.method||r.name;const s=this._definition.rules[r.method],n=r.args;e(s,"Unknown rule",r.method);const i=this.clone();if(n){e(1===Object.keys(n).length||Object.keys(n).length===this._definition.rules[r.name].args.length,"Invalid rule definition for",this.type,r.name);for(const t in n){let o=n[t];if(s.argsByName){const l=s.argsByName.get(t);if(l.ref&&a.isResolvable(o))r._resolve.push(t),i.$_mutateRegister(o);else if(l.normalize&&(o=l.normalize(o),n[t]=o),l.assert){const r=a.validateArg(o,t,l);e(!r,r,"or reference")}}void 0!==o?n[t]=o:delete n[t]}}return s.multi||(i._ruleRemove(r.name,{clone:!1}),i._singleRules.set(r.name,r)),!1===i.$_temp.ruleset&&(i.$_temp.ruleset=null),s.priority?i._rules.unshift(r):i._rules.push(r),i}$_compile(e,t){return i.schema(this.$_root,e,t)}$_createError(e,t,r,s,n,a={}){const i=!1!==a.flags?this._flags:{},l=a.messages?u.merge(this._definition.messages,a.messages):this._definition.messages;return new o.Report(e,t,r,i,l,s,n)}$_getFlag(e){return this._flags[e]}$_getRule(e){return this._singleRules.get(e)}$_mapLabels(e){return e=Array.isArray(e)?e:e.split("."),this._ids.labels(e)}$_match(e,t,r,s){(r=Object.assign({},r)).abortEarly=!0,r._externals=!1,t.snapshot();const n=!p.validate(e,this,t,r,s).errors;return t.restore(),n}$_modify(e){return a.assertOptions(e,["each","once","ref","schema"]),d.schema(this,e)||this}$_mutateRebuild(){e(!this._inRuleset(),"Cannot add this rule inside a ruleset"),this._refs.reset(),this._ids.reset();return this.$_modify({each:(e,{source:t,name:r,path:s,key:n})=>{const a=this._definition[t][r]&&this._definition[t][r].register;!1!==a&&this.$_mutateRegister(e,{family:a,key:n})}}),this._definition.rebuild&&this._definition.rebuild(this),this.$_temp.ruleset=!1,this}$_mutateRegister(e,{family:t,key:r}={}){this._refs.register(e,t),this._ids.register(e,{key:r})}$_property(e){return this._definition.properties[e]}$_reach(e){return this._ids.reach(e)}$_rootReferences(){return this._refs.roots()}$_setFlag(t,s,n={}){e("_"===t[0]||!this._inRuleset(),"Cannot set flag inside a ruleset");const a=this._definition.flags[t]||{};if(r(s,a.default)&&(s=void 0),r(s,this._flags[t]))return this;const i=!1!==n.clone?this.clone():this;return void 0!==s?(i._flags[t]=s,i.$_mutateRegister(s)):delete i._flags[t],"_"!==t[0]&&(i.$_temp.ruleset=!1),i}$_parent(e,...t){return this[e][a.symbols.parent].call(this,...t)}$_validate(e,t,r){return p.validate(e,this,t,r)}_assign(e){e.type=this.type,e.$_root=this.$_root,e.$_temp=Object.assign({},this.$_temp),e.$_temp.whens={},e._ids=this._ids.clone(),e._preferences=this._preferences,e._valids=this._valids&&this._valids.clone(),e._invalids=this._invalids&&this._invalids.clone(),e._rules=this._rules.slice(),e._singleRules=t(this._singleRules,{shallow:!0}),e._refs=this._refs.clone(),e._flags=Object.assign({},this._flags),e._cache=null,e.$_terms={};for(const t in this.$_terms)e.$_terms[t]=this.$_terms[t]?this.$_terms[t].slice():null;e.$_super={};for(const t in this.$_super)e.$_super[t]=this._super[t].bind(e);return e}_bare(){const e=this.clone();e._reset();const t=e._definition.terms;for(const r in t){const s=t[r];e.$_terms[r]=s.init}return e.$_mutateRebuild()}_default(t,r,s={}){a.assertOptions(s,"literal"),e(void 0!==r,"Missing",t,"value"),e("function"==typeof r||!s.literal,"Only function value supports literal option"),"function"==typeof r&&s.literal&&(r={[a.symbols.literal]:!0,literal:r});return this.$_setFlag(t,r)}_generate(e,t,r){if(!this.$_terms.whens)return{schema:this};const s=[],n=[];for(let a=0;a<this.$_terms.whens.length;++a){const i=this.$_terms.whens[a];if(i.concat){s.push(i.concat),n.push(`${a}.concat`);continue}const o=i.ref?i.ref.resolve(e,t,r):e,l=i.is?[i]:i.switch,c=n.length;for(let c=0;c<l.length;++c){const{is:u,then:d,otherwise:f}=l[c],h=`${a}${i.switch?"."+c:""}`;if(u.$_match(o,t.nest(u,`${h}.is`),r)){if(d){const a=t.localize([...t.path,`${h}.then`],t.ancestors,t.schemas),{schema:i,id:o}=d._generate(e,a,r);s.push(i),n.push(`${h}.then${o?`(${o})`:""}`);break}}else if(f){const a=t.localize([...t.path,`${h}.otherwise`],t.ancestors,t.schemas),{schema:i,id:o}=f._generate(e,a,r);s.push(i),n.push(`${h}.otherwise${o?`(${o})`:""}`);break}}if(i.break&&n.length>c)break}const a=n.join(", ");if(t.mainstay.tracer.debug(t,"rule","when",a),!a)return{schema:this};if(!t.mainstay.tracer.active&&this.$_temp.whens[a])return{schema:this.$_temp.whens[a],id:a};let i=this;this._definition.generate&&(i=this._definition.generate(this,e,t,r));for(const e of s)i=i.concat(e);return this.$_root._tracer&&this.$_root._tracer._combine(i,[this,...s]),this.$_temp.whens[a]=i,{schema:i,id:a}}_inner(t,r,s={}){e(!this._inRuleset(),`Cannot set ${t} inside a ruleset`);const n=this.clone();return n.$_terms[t]&&!s.override||(n.$_terms[t]=[]),s.single?n.$_terms[t].push(r):n.$_terms[t].push(...r),n.$_temp.ruleset=!1,n}_inRuleset(){return null!==this.$_temp.ruleset&&!1!==this.$_temp.ruleset}_ruleRemove(e,t={}){if(!this._singleRules.has(e))return this;const r=!1!==t.clone?this.clone():this;r._singleRules.delete(e);const s=[];for(let t=0;t<r._rules.length;++t){const n=r._rules[t];n.name!==e||n.keep?s.push(n):r._inRuleset()&&t<r.$_temp.ruleset&&--r.$_temp.ruleset}return r._rules=s,r}_values(t,r){a.verifyFlat(t,r.slice(1,-1));const s=this.clone(),n=t[0]===a.symbols.override;if(n&&(t=t.slice(1)),!s[r]&&t.length?s[r]=new m:n&&(s[r]=t.length?new m:null,s.$_mutateRebuild()),!s[r])return s;n&&s[r].override();for(const n of t){e(void 0!==n,"Cannot call allow/valid/invalid with undefined"),e(n!==a.symbols.override,"Override must be the first value");const t="_invalids"===r?"_valids":"_invalids";s[t]&&(s[t].remove(n),s[t].length||(e("_valids"===r||!s._flags.only,"Setting invalid value",n,"leaves schema rejecting all values due to previous valid rule"),s[t]=null)),s[r].add(n,s._refs)}return s}}};return g.Base.prototype[a.symbols.any]={version:a.version,compile:i.compile,root:"$_root"},g.Base.prototype.isImmutable=!0,g.Base.prototype.deny=g.Base.prototype.invalid,g.Base.prototype.disallow=g.Base.prototype.invalid,g.Base.prototype.equal=g.Base.prototype.valid,g.Base.prototype.exist=g.Base.prototype.required,g.Base.prototype.not=g.Base.prototype.invalid,g.Base.prototype.options=g.Base.prototype.prefs,g.Base.prototype.preferences=g.Base.prototype.prefs,Gr=new g.Base}function ns(){if(Hr)return Zr;Hr=1;const e=Nt,t=ss(),r=dr(),s=ur();return Zr=t.extend({type:"any",flags:{only:{default:!1}},terms:{alterations:{init:null},examples:{init:null},externals:{init:null},metas:{init:[]},notes:{init:[]},shared:{init:null},tags:{init:[]},whens:{init:null}},rules:{custom:{method(t,r){return e("function"==typeof t,"Method must be a function"),e(void 0===r||r&&"string"==typeof r,"Description must be a non-empty string"),this.$_addRule({name:"custom",args:{method:t,description:r}})},validate(e,t,{method:r}){try{return r(e,t)}catch(e){return t.error("any.custom",{error:e})}},args:["method","description"],multi:!0},messages:{method(e){return this.prefs({messages:e})}},shared:{method(t){e(r.isSchema(t)&&t._flags.id,"Schema must be a schema with an id");const s=this.clone();return s.$_terms.shared=s.$_terms.shared||[],s.$_terms.shared.push(t),s.$_mutateRegister(t),s}},warning:{method(t,r){return e(t&&"string"==typeof t,"Invalid warning code"),this.$_addRule({name:"warning",args:{code:t,local:r},warn:!0})},validate:(e,t,{code:r,local:s})=>t.error(r,s),args:["code","local"],multi:!0}},modifiers:{keep(e,t=!0){e.keep=t},message(e,t){e.message=s.compile(t)},warn(e,t=!0){e.warn=t}},manifest:{build(e,t){for(const r in t){const s=t[r];if(["examples","externals","metas","notes","tags"].includes(r))for(const t of s)e=e[r.slice(0,-1)](t);else if("alterations"!==r)if("whens"!==r){if("shared"===r)for(const t of s)e=e.shared(t)}else for(const t of s){const{ref:r,is:s,not:n,then:a,otherwise:i,concat:o}=t;e=o?e.concat(o):r?e.when(r,{is:s,not:n,then:a,otherwise:i,switch:t.switch,break:t.break}):e.when(s,{then:a,otherwise:i,break:t.break})}else{const t={};for(const{target:e,adjuster:r}of s)t[e]=r;e=e.alter(t)}}return e}},messages:{"any.custom":"{{#label}} failed custom validation because {{#error.message}}","any.default":"{{#label}} threw an error when running default method","any.failover":"{{#label}} threw an error when running failover method","any.invalid":"{{#label}} contains an invalid value","any.only":'{{#label}} must be {if(#valids.length == 1, "", "one of ")}{{#valids}}',"any.ref":"{{#label}} {{#arg}} references {{:#ref}} which {{#reason}}","any.required":"{{#label}} is required","any.unknown":"{{#label}} is not allowed"}}),Zr}function as(){if(Kr)return Xr;Kr=1;const e=Nt,t=Lr,r=ns(),s=dr(),n=mr(),a=tr(),i=lr(),o={};return Xr=r.extend({type:"alternatives",flags:{match:{default:"any"}},terms:{matches:{init:[],register:i.toSibling}},args:(e,...t)=>1===t.length&&Array.isArray(t[0])?e.try(...t[0]):e.try(...t),validate(e,r){const{schema:s,error:n,state:i,prefs:l}=r;if(s._flags.match){const r=[],o=[];for(let t=0;t<s.$_terms.matches.length;++t){const n=s.$_terms.matches[t],a=i.nest(n.schema,`match.${t}`);a.snapshot();const c=n.schema.$_validate(e,a,l);c.errors?(o.push(c.errors),a.restore()):r.push(c.value)}if(0===r.length){return{errors:n("alternatives.any",{details:o.map((e=>a.details(e,{override:!1})))})}}if("one"===s._flags.match)return 1===r.length?{value:r[0]}:{errors:n("alternatives.one")};if(r.length!==s.$_terms.matches.length){return{errors:n("alternatives.all",{details:o.map((e=>a.details(e,{override:!1})))})}}const c=e=>e.$_terms.matches.some((e=>"object"===e.schema.type||"alternatives"===e.schema.type&&c(e.schema)));return c(s)?{value:r.reduce(((e,r)=>t(e,r,{mergeArrays:!1})))}:{value:r[r.length-1]}}const c=[];for(let t=0;t<s.$_terms.matches.length;++t){const r=s.$_terms.matches[t];if(r.schema){const s=i.nest(r.schema,`match.${t}`);s.snapshot();const n=r.schema.$_validate(e,s,l);if(!n.errors)return n;s.restore(),c.push({schema:r.schema,reports:n.errors});continue}const n=r.ref?r.ref.resolve(e,i,l):e,a=r.is?[r]:r.switch;for(let s=0;s<a.length;++s){const o=a[s],{is:c,then:u,otherwise:d}=o,f=`match.${t}${r.switch?"."+s:""}`;if(c.$_match(n,i.nest(c,`${f}.is`),l)){if(u)return u.$_validate(e,i.nest(u,`${f}.then`),l)}else if(d)return d.$_validate(e,i.nest(d,`${f}.otherwise`),l)}}return o.errors(c,r)},rules:{conditional:{method(t,r){e(!this._flags._endedSwitch,"Unreachable condition"),e(!this._flags.match,"Cannot combine match mode",this._flags.match,"with conditional rule"),e(void 0===r.break,"Cannot use break option with alternatives conditional");const s=this.clone(),a=n.when(s,t,r),i=a.is?[a]:a.switch;for(const e of i)if(e.then&&e.otherwise){s.$_setFlag("_endedSwitch",!0,{clone:!1});break}return s.$_terms.matches.push(a),s.$_mutateRebuild()}},match:{method(t){if(e(["any","one","all"].includes(t),"Invalid alternatives match mode",t),"any"!==t)for(const r of this.$_terms.matches)e(r.schema,"Cannot combine match mode",t,"with conditional rules");return this.$_setFlag("match",t)}},try:{method(...t){e(t.length,"Missing alternative schemas"),s.verifyFlat(t,"try"),e(!this._flags._endedSwitch,"Unreachable condition");const r=this.clone();for(const e of t)r.$_terms.matches.push({schema:r.$_compile(e)});return r.$_mutateRebuild()}}},overrides:{label(e){return this.$_parent("label",e).$_modify({each:(t,r)=>"is"!==r.path[0]?t.label(e):void 0,ref:!1})}},rebuild(e){e.$_modify({each:t=>{s.isSchema(t)&&"array"===t.type&&e.$_setFlag("_arrayItems",!0,{clone:!1})}})},manifest:{build(e,t){if(t.matches)for(const r of t.matches){const{schema:t,ref:s,is:n,not:a,then:i,otherwise:o}=r;e=t?e.try(t):s?e.conditional(s,{is:n,then:i,not:a,otherwise:o,switch:r.switch}):e.conditional(n,{then:i,otherwise:o})}return e}},messages:{"alternatives.all":"{{#label}} does not match all of the required types","alternatives.any":"{{#label}} does not match any of the allowed types","alternatives.match":"{{#label}} does not match any of the allowed types","alternatives.one":"{{#label}} matches more than one allowed type","alternatives.types":"{{#label}} must be one of {{#types}}"}}),o.errors=function(e,{error:t,state:r}){if(!e.length)return{errors:t("alternatives.any")};if(1===e.length)return{errors:e[0].reports};const s=new Set,n=[];for(const{reports:i,schema:l}of e){if(i.length>1)return o.unmatched(e,t);const c=i[0];if(c instanceof a.Report==!1)return o.unmatched(e,t);if(c.state.path.length!==r.path.length){n.push({type:l.type,report:c});continue}if("any.only"===c.code){for(const e of c.local.valids)s.add(e);continue}const[u,d]=c.code.split(".");"base"===d?s.add(u):n.push({type:l.type,report:c})}return n.length?1===n.length?{errors:n[0].report}:o.unmatched(e,t):{errors:t("alternatives.types",{types:[...s]})}},o.unmatched=function(e,t){const r=[];for(const t of e)r.push(...t.reports);return{errors:t("alternatives.match",a.details(r,{override:!1}))}},Xr}function is(){if(Wr)return Vr;Wr=1;const e=Nt,t=Rr,r=xt,s=ns(),n=dr(),a=mr(),i={};return Vr=s.extend({type:"array",flags:{single:{default:!1},sparse:{default:!1}},terms:{items:{init:[],manifest:"schema"},ordered:{init:[],manifest:"schema"},_exclusions:{init:[]},_inclusions:{init:[]},_requireds:{init:[]}},coerce:{from:"object",method(e,{schema:t,state:r,prefs:s}){if(!Array.isArray(e))return;const n=t.$_getRule("sort");return n?i.sort(t,e,n.args.options,r,s):void 0}},validate(e,{schema:t,error:r}){if(!Array.isArray(e)){if(t._flags.single){const t=[e];return t[n.symbols.arraySingle]=!0,{value:t}}return{errors:r("array.base")}}if(t.$_getRule("items")||t.$_terms.externals)return{value:e.slice()}},rules:{has:{method(e){e=this.$_compile(e,{appendPath:!0});const t=this.$_addRule({name:"has",args:{schema:e}});return t.$_mutateRegister(e),t},validate(e,{state:t,prefs:r,error:s},{schema:n}){const a=[e,...t.ancestors];for(let s=0;s<e.length;++s){const i=t.localize([...t.path,s],a,n);if(n.$_match(e[s],i,r))return e}const i=n._flags.label;return i?s("array.hasKnown",{patternLabel:i}):s("array.hasUnknown",null)},multi:!0},items:{method(...e){n.verifyFlat(e,"items");const t=this.$_addRule("items");for(let r=0;r<e.length;++r){const s=n.tryWithPath((()=>this.$_compile(e[r])),r,{append:!0});t.$_terms.items.push(s)}return t.$_mutateRebuild()},validate(e,{schema:t,error:r,state:s,prefs:a,errorsArray:o}){const l=t.$_terms._requireds.slice(),c=t.$_terms.ordered.slice(),u=[...t.$_terms._inclusions,...l],d=!e[n.symbols.arraySingle];delete e[n.symbols.arraySingle];const f=o();let h=e.length;for(let n=0;n<h;++n){const o=e[n];let p=!1,m=!1;const g=d?n:new Number(n),y=[...s.path,g];if(!t._flags.sparse&&void 0===o){if(f.push(r("array.sparse",{key:g,path:y,pos:n,value:void 0},s.localize(y))),a.abortEarly)return f;c.shift();continue}const v=[e,...s.ancestors];for(const e of t.$_terms._exclusions)if(e.$_match(o,s.localize(y,v,e),a,{presence:"ignore"})){if(f.push(r("array.excludes",{pos:n,value:o},s.localize(y))),a.abortEarly)return f;p=!0,c.shift();break}if(p)continue;if(t.$_terms.ordered.length){if(c.length){const l=c.shift(),u=l.$_validate(o,s.localize(y,v,l),a);if(u.errors){if(f.push(...u.errors),a.abortEarly)return f}else if("strip"===l._flags.result)i.fastSplice(e,n),--n,--h;else{if(!t._flags.sparse&&void 0===u.value){if(f.push(r("array.sparse",{key:g,path:y,pos:n,value:void 0},s.localize(y))),a.abortEarly)return f;continue}e[n]=u.value}continue}if(!t.$_terms.items.length){if(f.push(r("array.orderedLength",{pos:n,limit:t.$_terms.ordered.length})),a.abortEarly)return f;break}}const _=[];let b=l.length;for(let c=0;c<b;++c){const u=s.localize(y,v,l[c]);u.snapshot();const d=l[c].$_validate(o,u,a);if(_[c]=d,!d.errors){if(e[n]=d.value,m=!0,i.fastSplice(l,c),--c,--b,!t._flags.sparse&&void 0===d.value&&(f.push(r("array.sparse",{key:g,path:y,pos:n,value:void 0},s.localize(y))),a.abortEarly))return f;break}u.restore()}if(m)continue;const A=a.stripUnknown&&!!a.stripUnknown.arrays||!1;b=u.length;for(const c of u){let u;const d=l.indexOf(c);if(-1!==d)u=_[d];else{const l=s.localize(y,v,c);if(l.snapshot(),u=c.$_validate(o,l,a),!u.errors){"strip"===c._flags.result?(i.fastSplice(e,n),--n,--h):t._flags.sparse||void 0!==u.value?e[n]=u.value:(f.push(r("array.sparse",{key:g,path:y,pos:n,value:void 0},s.localize(y))),p=!0),m=!0;break}l.restore()}if(1===b){if(A){i.fastSplice(e,n),--n,--h,m=!0;break}if(f.push(...u.errors),a.abortEarly)return f;p=!0;break}}if(!p&&((t.$_terms._inclusions.length||t.$_terms._requireds.length)&&!m)){if(A){i.fastSplice(e,n),--n,--h;continue}if(f.push(r("array.includes",{pos:n,value:o},s.localize(y))),a.abortEarly)return f}}return l.length&&i.fillMissedErrors(t,f,l,e,s,a),c.length&&(i.fillOrderedErrors(t,f,c,e,s,a),f.length||i.fillDefault(c,e,s,a)),f.length?f:e},priority:!0,manifest:!1},length:{method(e){return this.$_addRule({name:"length",args:{limit:e},operator:"="})},validate:(e,t,{limit:r},{name:s,operator:a,args:i})=>n.compare(e.length,r,a)?e:t.error("array."+s,{limit:i.limit,value:e}),args:[{name:"limit",ref:!0,assert:n.limit,message:"must be a positive integer"}]},max:{method(e){return this.$_addRule({name:"max",method:"length",args:{limit:e},operator:"<="})}},min:{method(e){return this.$_addRule({name:"min",method:"length",args:{limit:e},operator:">="})}},ordered:{method(...e){n.verifyFlat(e,"ordered");const t=this.$_addRule("items");for(let r=0;r<e.length;++r){const s=n.tryWithPath((()=>this.$_compile(e[r])),r,{append:!0});i.validateSingle(s,t),t.$_mutateRegister(s),t.$_terms.ordered.push(s)}return t.$_mutateRebuild()}},single:{method(t){const r=void 0===t||!!t;return e(!r||!this._flags._arrayItems,"Cannot specify single rule when array has array items"),this.$_setFlag("single",r)}},sort:{method(t={}){n.assertOptions(t,["by","order"]);const r={order:t.order||"ascending"};return t.by&&(r.by=a.ref(t.by,{ancestor:0}),e(!r.by.ancestor,"Cannot sort by ancestor")),this.$_addRule({name:"sort",args:{options:r}})},validate(e,{error:t,state:r,prefs:s,schema:n},{options:a}){const{value:o,errors:l}=i.sort(n,e,a,r,s);if(l)return l;for(let r=0;r<e.length;++r)if(e[r]!==o[r])return t("array.sort",{order:a.order,by:a.by?a.by.key:"value"});return e},convert:!0},sparse:{method(e){const t=void 0===e||!!e;if(this._flags.sparse===t)return this;return(t?this.clone():this.$_addRule("items")).$_setFlag("sparse",t,{clone:!1})}},unique:{method(t,r={}){e(!t||"function"==typeof t||"string"==typeof t,"comparator must be a function or a string"),n.assertOptions(r,["ignoreUndefined","separator"]);const s={name:"unique",args:{options:r,comparator:t}};if(t)if("string"==typeof t){const e=n.default(r.separator,".");s.path=e?t.split(e):[t]}else s.comparator=t;return this.$_addRule(s)},validate(s,{state:n,error:a,schema:i},{comparator:o,options:l},{comparator:c,path:u}){const d={string:Object.create(null),number:Object.create(null),undefined:Object.create(null),boolean:Object.create(null),object:new Map,function:new Map,custom:new Map},f=c||t,h=l.ignoreUndefined;for(let t=0;t<s.length;++t){const i=u?r(s[t],u):s[t],l=c?d.custom:d[typeof i];if(e(l,"Failed to find unique map container for type",typeof i),l instanceof Map){const e=l.entries();let r;for(;!(r=e.next()).done;)if(f(r.value[0],i)){const e=n.localize([...n.path,t],[s,...n.ancestors]),i={pos:t,value:s[t],dupePos:r.value[1],dupeValue:s[r.value[1]]};return u&&(i.path=o),a("array.unique",i,e)}l.set(i,t)}else{if((!h||void 0!==i)&&void 0!==l[i]){const e={pos:t,value:s[t],dupePos:l[i],dupeValue:s[l[i]]};u&&(e.path=o);return a("array.unique",e,n.localize([...n.path,t],[s,...n.ancestors]))}l[i]=t}}return s},args:["comparator","options"],multi:!0}},cast:{set:{from:Array.isArray,to:(e,t)=>new Set(e)}},rebuild(e){e.$_terms._inclusions=[],e.$_terms._exclusions=[],e.$_terms._requireds=[];for(const t of e.$_terms.items)i.validateSingle(t,e),"required"===t._flags.presence?e.$_terms._requireds.push(t):"forbidden"===t._flags.presence?e.$_terms._exclusions.push(t):e.$_terms._inclusions.push(t);for(const t of e.$_terms.ordered)i.validateSingle(t,e)},manifest:{build:(e,t)=>(t.items&&(e=e.items(...t.items)),t.ordered&&(e=e.ordered(...t.ordered)),e)},messages:{"array.base":"{{#label}} must be an array","array.excludes":"{{#label}} contains an excluded value","array.hasKnown":"{{#label}} does not contain at least one required match for type {:#patternLabel}","array.hasUnknown":"{{#label}} does not contain at least one required match","array.includes":"{{#label}} does not match any of the allowed types","array.includesRequiredBoth":"{{#label}} does not contain {{#knownMisses}} and {{#unknownMisses}} other required value(s)","array.includesRequiredKnowns":"{{#label}} does not contain {{#knownMisses}}","array.includesRequiredUnknowns":"{{#label}} does not contain {{#unknownMisses}} required value(s)","array.length":"{{#label}} must contain {{#limit}} items","array.max":"{{#label}} must contain less than or equal to {{#limit}} items","array.min":"{{#label}} must contain at least {{#limit}} items","array.orderedLength":"{{#label}} must contain at most {{#limit}} items","array.sort":"{{#label}} must be sorted in {#order} order by {{#by}}","array.sort.mismatching":"{{#label}} cannot be sorted due to mismatching types","array.sort.unsupported":"{{#label}} cannot be sorted due to unsupported type {#type}","array.sparse":"{{#label}} must not be a sparse array item","array.unique":"{{#label}} contains a duplicate value"}}),i.fillMissedErrors=function(e,t,r,s,n,a){const i=[];let o=0;for(const e of r){const t=e._flags.label;t?i.push(t):++o}i.length?o?t.push(e.$_createError("array.includesRequiredBoth",s,{knownMisses:i,unknownMisses:o},n,a)):t.push(e.$_createError("array.includesRequiredKnowns",s,{knownMisses:i},n,a)):t.push(e.$_createError("array.includesRequiredUnknowns",s,{unknownMisses:o},n,a))},i.fillOrderedErrors=function(e,t,r,s,n,a){const o=[];for(const e of r)"required"===e._flags.presence&&o.push(e);o.length&&i.fillMissedErrors(e,t,o,s,n,a)},i.fillDefault=function(e,t,r,s){const n=[];let a=!0;for(let i=e.length-1;i>=0;--i){const o=e[i],l=[t,...r.ancestors],c=o.$_validate(void 0,r.localize(r.path,l,o),s).value;if(a){if(void 0===c)continue;a=!1}n.unshift(c)}n.length&&t.push(...n)},i.fastSplice=function(e,t){let r=t;for(;r<e.length;)e[r++]=e[r];--e.length},i.validateSingle=function(t,r){("array"===t.type||t._flags._arrayItems)&&(e(!r._flags.single,"Cannot specify array item with single rule enabled"),r.$_setFlag("_arrayItems",!0,{clone:!1}))},i.sort=function(e,t,r,s,n){const a="ascending"===r.order?1:-1,o=-1*a,l=a,c=(c,u)=>{let d=i.compare(c,u,o,l);if(null!==d)return d;if(r.by&&(c=r.by.resolve(c,s,n),u=r.by.resolve(u,s,n)),d=i.compare(c,u,o,l),null!==d)return d;const f=typeof c;if(f!==typeof u)throw e.$_createError("array.sort.mismatching",t,null,s,n);if("number"!==f&&"string"!==f)throw e.$_createError("array.sort.unsupported",t,{type:f},s,n);return"number"===f?(c-u)*a:c<u?o:l};try{return{value:t.slice().sort(c)}}catch(e){return{errors:e}}},i.compare=function(e,t,r,s){return e===t?0:void 0===e?1:void 0===t?-1:null===e?s:null===t?r:null},Vr}function os(){if(zr)return Yr;zr=1;const e=Nt,t=ns(),r=dr(),s=rs(),n={isBool:function(e){return"boolean"==typeof e}};return Yr=t.extend({type:"boolean",flags:{sensitive:{default:!1}},terms:{falsy:{init:null,manifest:"values"},truthy:{init:null,manifest:"values"}},coerce(e,{schema:t}){if("boolean"!=typeof e){if("string"==typeof e){const r=t._flags.sensitive?e:e.toLowerCase();e="true"===r||"false"!==r&&e}return"boolean"!=typeof e&&(e=t.$_terms.truthy&&t.$_terms.truthy.has(e,null,null,!t._flags.sensitive)||(!t.$_terms.falsy||!t.$_terms.falsy.has(e,null,null,!t._flags.sensitive))&&e),{value:e}}},validate(e,{error:t}){if("boolean"!=typeof e)return{value:e,errors:t("boolean.base")}},rules:{truthy:{method(...t){r.verifyFlat(t,"truthy");const n=this.clone();n.$_terms.truthy=n.$_terms.truthy||new s;for(let r=0;r<t.length;++r){const s=t[r];e(void 0!==s,"Cannot call truthy with undefined"),n.$_terms.truthy.add(s)}return n}},falsy:{method(...t){r.verifyFlat(t,"falsy");const n=this.clone();n.$_terms.falsy=n.$_terms.falsy||new s;for(let r=0;r<t.length;++r){const s=t[r];e(void 0!==s,"Cannot call falsy with undefined"),n.$_terms.falsy.add(s)}return n}},sensitive:{method(e=!0){return this.$_setFlag("sensitive",e)}}},cast:{number:{from:n.isBool,to:(e,t)=>e?1:0},string:{from:n.isBool,to:(e,t)=>e?"true":"false"}},manifest:{build:(e,t)=>(t.truthy&&(e=e.truthy(...t.truthy)),t.falsy&&(e=e.falsy(...t.falsy)),e)},messages:{"boolean.base":"{{#label}} must be a boolean"}}),Yr}function ls(){if(Jr)return qr;Jr=1;const e=Nt,t=ns(),r=dr(),s=cr(),n={isDate:function(e){return e instanceof Date}};return qr=t.extend({type:"date",coerce:{from:["number","string"],method:(e,{schema:t})=>({value:n.parse(e,t._flags.format)||e})},validate(e,{schema:t,error:r,prefs:s}){if(e instanceof Date&&!isNaN(e.getTime()))return;const n=t._flags.format;return s.convert&&n&&"string"==typeof e?{value:e,errors:r("date.format",{format:n})}:{value:e,errors:r("date.base")}},rules:{compare:{method:!1,validate(e,t,{date:s},{name:n,operator:a,args:i}){const o="now"===s?Date.now():s.getTime();return r.compare(e.getTime(),o,a)?e:t.error("date."+n,{limit:i.date,value:e})},args:[{name:"date",ref:!0,normalize:e=>"now"===e?e:n.parse(e),assert:e=>null!==e,message:"must have a valid date format"}]},format:{method(t){return e(["iso","javascript","unix"].includes(t),"Unknown date format",t),this.$_setFlag("format",t)}},greater:{method(e){return this.$_addRule({name:"greater",method:"compare",args:{date:e},operator:">"})}},iso:{method(){return this.format("iso")}},less:{method(e){return this.$_addRule({name:"less",method:"compare",args:{date:e},operator:"<"})}},max:{method(e){return this.$_addRule({name:"max",method:"compare",args:{date:e},operator:"<="})}},min:{method(e){return this.$_addRule({name:"min",method:"compare",args:{date:e},operator:">="})}},timestamp:{method(t="javascript"){return e(["javascript","unix"].includes(t),'"type" must be one of "javascript, unix"'),this.format(t)}}},cast:{number:{from:n.isDate,to:(e,t)=>e.getTime()},string:{from:n.isDate,to:(e,{prefs:t})=>s.date(e,t)}},messages:{"date.base":"{{#label}} must be a valid date","date.format":'{{#label}} must be in {msg("date.format." + #format) || #format} format',"date.greater":"{{#label}} must be greater than {{:#limit}}","date.less":"{{#label}} must be less than {{:#limit}}","date.max":"{{#label}} must be less than or equal to {{:#limit}}","date.min":"{{#label}} must be greater than or equal to {{:#limit}}","date.format.iso":"ISO 8601 date","date.format.javascript":"timestamp or number of milliseconds","date.format.unix":"timestamp or number of seconds"}}),n.parse=function(e,t){if(e instanceof Date)return e;if("string"!=typeof e&&(isNaN(e)||!isFinite(e)))return null;if(/^\s*$/.test(e))return null;if("iso"===t)return r.isIsoDate(e)?n.date(e.toString()):null;const s=e;if("string"==typeof e&&/^[+-]?\d+(\.\d+)?$/.test(e)&&(e=parseFloat(e)),t){if("javascript"===t)return n.date(1*e);if("unix"===t)return n.date(1e3*e);if("string"==typeof s)return null}return n.date(e)},n.date=function(e){const t=new Date(e);return isNaN(t.getTime())?null:t},qr}const cs=Nt,us=Pt,ds=Lr,fs=xt,hs={};var ps=function(e,t,r={}){if(cs(e&&"object"==typeof e,"Invalid defaults value: must be an object"),cs(!t||!0===t||"object"==typeof t,"Invalid source value: must be true, falsy or an object"),cs("object"==typeof r,"Invalid options: must be an object"),!t)return null;if(r.shallow)return hs.applyToDefaultsWithShallow(e,t,r);const s=us(e);if(!0===t)return s;const n=void 0!==r.nullOverride&&r.nullOverride;return ds(s,t,{nullOverride:n,mergeArrays:!1})};hs.applyToDefaultsWithShallow=function(e,t,r){const s=r.shallow;cs(Array.isArray(s),"Invalid keys");const n=new Map,a=!0===t?null:new Set;for(let r of s){r=Array.isArray(r)?r:r.split(".");const s=fs(e,r);s&&"object"==typeof s?n.set(s,a&&fs(t,r)||s):a&&a.add(r)}const i=us(e,{},n);if(!a)return i;for(const e of a)hs.reachCopy(i,t,e);const o=void 0!==r.nullOverride&&r.nullOverride;return ds(i,t,{nullOverride:o,mergeArrays:!1})},hs.reachCopy=function(e,t,r){for(const e of r){if(!(e in t))return;const r=t[e];if("object"!=typeof r||null===r)return;t=r}const s=t;let n=e;for(let e=0;e<r.length-1;++e){const t=r[e];"object"!=typeof n[t]&&(n[t]={}),n=n[t]}n[r[r.length-1]]=s};var ms={};const gs=Nt,ys={};var vs,_s,bs,As,Es,Ss,Os,Rs,ws,Ns;function Is(){if(_s)return vs;_s=1;const e=ps,t=Nt,r=Pt,s=ms,n=ns(),a=dr(),i=mr(),o=tr(),l=lr(),c=cr(),u={renameDefaults:{alias:!1,multiple:!1,override:!1}};return vs=n.extend({type:"_keys",properties:{typeof:"object"},flags:{unknown:{default:!1}},terms:{dependencies:{init:null},keys:{init:null,manifest:{mapped:{from:"schema",to:"key"}}},patterns:{init:null},renames:{init:null}},args:(e,t)=>e.keys(t),validate(e,{schema:t,error:r,state:s,prefs:n}){if(!e||typeof e!==t.$_property("typeof")||Array.isArray(e))return{value:e,errors:r("object.base",{type:t.$_property("typeof")})};if(!(t.$_terms.renames||t.$_terms.dependencies||t.$_terms.keys||t.$_terms.patterns||t.$_terms.externals))return;e=u.clone(e,n);const a=[];if(t.$_terms.renames&&!u.rename(t,e,s,n,a))return{value:e,errors:a};if(!t.$_terms.keys&&!t.$_terms.patterns&&!t.$_terms.dependencies)return{value:e,errors:a};const i=new Set(Object.keys(e));if(t.$_terms.keys){const r=[e,...s.ancestors];for(const o of t.$_terms.keys){const t=o.key,l=e[t];i.delete(t);const c=s.localize([...s.path,t],r,o),u=o.schema.$_validate(l,c,n);if(u.errors){if(n.abortEarly)return{value:e,errors:u.errors};void 0!==u.value&&(e[t]=u.value),a.push(...u.errors)}else"strip"===o.schema._flags.result||void 0===u.value&&void 0!==l?delete e[t]:void 0!==u.value&&(e[t]=u.value)}}if(i.size||t._flags._hasPatternMatch){const r=u.unknown(t,e,i,a,s,n);if(r)return r}if(t.$_terms.dependencies)for(const r of t.$_terms.dependencies){if(null!==r.key&&!1===u.isPresent(r.options)(r.key.resolve(e,s,n,null,{shadow:!1})))continue;const i=u.dependencies[r.rel](t,r,e,s,n);if(i){const r=t.$_createError(i.code,e,i.context,s,n);if(n.abortEarly)return{value:e,errors:r};a.push(r)}}return{value:e,errors:a}},rules:{and:{method(...e){return a.verifyFlat(e,"and"),u.dependency(this,"and",null,e)}},append:{method(e){return null==e||0===Object.keys(e).length?this:this.keys(e)}},assert:{method(e,r,s){c.isTemplate(e)||(e=i.ref(e)),t(void 0===s||"string"==typeof s,"Message must be a string"),r=this.$_compile(r,{appendPath:!0});const n=this.$_addRule({name:"assert",args:{subject:e,schema:r,message:s}});return n.$_mutateRegister(e),n.$_mutateRegister(r),n},validate(e,{error:t,prefs:r,state:s},{subject:n,schema:a,message:i}){const o=n.resolve(e,s,r),c=l.isRef(n)?n.absolute(s):[];return a.$_match(o,s.localize(c,[e,...s.ancestors],a),r)?e:t("object.assert",{subject:n,message:i})},args:["subject","schema","message"],multi:!0},instance:{method(e,r){return t("function"==typeof e,"constructor must be a function"),r=r||e.name,this.$_addRule({name:"instance",args:{constructor:e,name:r}})},validate:(e,t,{constructor:r,name:s})=>e instanceof r?e:t.error("object.instance",{type:s,value:e}),args:["constructor","name"]},keys:{method(e){t(void 0===e||"object"==typeof e,"Object schema must be a valid object"),t(!a.isSchema(e),"Object schema cannot be a joi schema");const r=this.clone();if(e)if(Object.keys(e).length){r.$_terms.keys=r.$_terms.keys?r.$_terms.keys.filter((t=>!e.hasOwnProperty(t.key))):new u.Keys;for(const t in e)a.tryWithPath((()=>r.$_terms.keys.push({key:t,schema:this.$_compile(e[t])})),t)}else r.$_terms.keys=new u.Keys;else r.$_terms.keys=null;return r.$_mutateRebuild()}},length:{method(e){return this.$_addRule({name:"length",args:{limit:e},operator:"="})},validate:(e,t,{limit:r},{name:s,operator:n,args:i})=>a.compare(Object.keys(e).length,r,n)?e:t.error("object."+s,{limit:i.limit,value:e}),args:[{name:"limit",ref:!0,assert:a.limit,message:"must be a positive integer"}]},max:{method(e){return this.$_addRule({name:"max",method:"length",args:{limit:e},operator:"<="})}},min:{method(e){return this.$_addRule({name:"min",method:"length",args:{limit:e},operator:">="})}},nand:{method(...e){return a.verifyFlat(e,"nand"),u.dependency(this,"nand",null,e)}},or:{method(...e){return a.verifyFlat(e,"or"),u.dependency(this,"or",null,e)}},oxor:{method(...e){return u.dependency(this,"oxor",null,e)}},pattern:{method(e,r,s={}){const n=e instanceof RegExp;n||(e=this.$_compile(e,{appendPath:!0})),t(void 0!==r,"Invalid rule"),a.assertOptions(s,["fallthrough","matches"]),n&&t(!e.flags.includes("g")&&!e.flags.includes("y"),"pattern should not use global or sticky mode"),r=this.$_compile(r,{appendPath:!0});const i=this.clone();i.$_terms.patterns=i.$_terms.patterns||[];const o={[n?"regex":"schema"]:e,rule:r};return s.matches&&(o.matches=this.$_compile(s.matches),"array"!==o.matches.type&&(o.matches=o.matches.$_root.array().items(o.matches)),i.$_mutateRegister(o.matches),i.$_setFlag("_hasPatternMatch",!0,{clone:!1})),s.fallthrough&&(o.fallthrough=!0),i.$_terms.patterns.push(o),i.$_mutateRegister(r),i}},ref:{method(){return this.$_addRule("ref")},validate:(e,t)=>l.isRef(e)?e:t.error("object.refType",{value:e})},regex:{method(){return this.$_addRule("regex")},validate:(e,t)=>e instanceof RegExp?e:t.error("object.regex",{value:e})},rename:{method(r,s,n={}){t("string"==typeof r||r instanceof RegExp,"Rename missing the from argument"),t("string"==typeof s||s instanceof c,"Invalid rename to argument"),t(s!==r,"Cannot rename key to same name:",r),a.assertOptions(n,["alias","ignoreUndefined","override","multiple"]);const i=this.clone();i.$_terms.renames=i.$_terms.renames||[];for(const e of i.$_terms.renames)t(e.from!==r,"Cannot rename the same key multiple times");return s instanceof c&&i.$_mutateRegister(s),i.$_terms.renames.push({from:r,to:s,options:e(u.renameDefaults,n)}),i}},schema:{method(e="any"){return this.$_addRule({name:"schema",args:{type:e}})},validate:(e,t,{type:r})=>!a.isSchema(e)||"any"!==r&&e.type!==r?t.error("object.schema",{type:r}):e},unknown:{method(e){return this.$_setFlag("unknown",!1!==e)}},with:{method(e,t,r={}){return u.dependency(this,"with",e,t,r)}},without:{method(e,t,r={}){return u.dependency(this,"without",e,t,r)}},xor:{method(...e){return a.verifyFlat(e,"xor"),u.dependency(this,"xor",null,e)}}},overrides:{default(e,t){return void 0===e&&(e=a.symbols.deepDefault),this.$_parent("default",e,t)}},rebuild(e){if(e.$_terms.keys){const t=new s.Sorter;for(const r of e.$_terms.keys)a.tryWithPath((()=>t.add(r,{after:r.schema.$_rootReferences(),group:r.key})),r.key);e.$_terms.keys=new u.Keys(...t.nodes)}},manifest:{build(e,t){if(t.keys&&(e=e.keys(t.keys)),t.dependencies)for(const{rel:r,key:s=null,peers:n,options:a}of t.dependencies)e=u.dependency(e,r,s,n,a);if(t.patterns)for(const{regex:r,schema:s,rule:n,fallthrough:a,matches:i}of t.patterns)e=e.pattern(r||s,n,{fallthrough:a,matches:i});if(t.renames)for(const{from:r,to:s,options:n}of t.renames)e=e.rename(r,s,n);return e}},messages:{"object.and":"{{#label}} contains {{#presentWithLabels}} without its required peers {{#missingWithLabels}}","object.assert":'{{#label}} is invalid because {if(#subject.key, `"` + #subject.key + `" failed to ` + (#message || "pass the assertion test"), #message || "the assertion failed")}',"object.base":"{{#label}} must be of type {{#type}}","object.instance":"{{#label}} must be an instance of {{:#type}}","object.length":'{{#label}} must have {{#limit}} key{if(#limit == 1, "", "s")}',"object.max":'{{#label}} must have less than or equal to {{#limit}} key{if(#limit == 1, "", "s")}',"object.min":'{{#label}} must have at least {{#limit}} key{if(#limit == 1, "", "s")}',"object.missing":"{{#label}} must contain at least one of {{#peersWithLabels}}","object.nand":"{{:#mainWithLabel}} must not exist simultaneously with {{#peersWithLabels}}","object.oxor":"{{#label}} contains a conflict between optional exclusive peers {{#peersWithLabels}}","object.pattern.match":"{{#label}} keys failed to match pattern requirements","object.refType":"{{#label}} must be a Joi reference","object.regex":"{{#label}} must be a RegExp object","object.rename.multiple":"{{#label}} cannot rename {{:#from}} because multiple renames are disabled and another key was already renamed to {{:#to}}","object.rename.override":"{{#label}} cannot rename {{:#from}} because override is disabled and target {{:#to}} exists","object.schema":"{{#label}} must be a Joi schema of {{#type}} type","object.unknown":"{{#label}} is not allowed","object.with":"{{:#mainWithLabel}} missing required peer {{:#peerWithLabel}}","object.without":"{{:#mainWithLabel}} conflict with forbidden peer {{:#peerWithLabel}}","object.xor":"{{#label}} contains a conflict between exclusive peers {{#peersWithLabels}}"}}),u.clone=function(e,t){if("object"==typeof e){if(t.nonEnumerables)return r(e,{shallow:!0});const s=Object.create(Object.getPrototypeOf(e));return Object.assign(s,e),s}const s=function(...t){return e.apply(this,t)};return s.prototype=r(e.prototype),Object.defineProperty(s,"name",{value:e.name,writable:!1}),Object.defineProperty(s,"length",{value:e.length,writable:!1}),Object.assign(s,e),s},u.dependency=function(e,r,s,n,o){t(null===s||"string"==typeof s,r,"key must be a strings"),o||(o=n.length>1&&"object"==typeof n[n.length-1]?n.pop():{}),a.assertOptions(o,["separator","isPresent"]),n=[].concat(n);const l=a.default(o.separator,"."),c=[];for(const e of n)t("string"==typeof e,r,"peers must be strings"),c.push(i.ref(e,{separator:l,ancestor:0,prefix:!1}));null!==s&&(s=i.ref(s,{separator:l,ancestor:0,prefix:!1}));const d=e.clone();return d.$_terms.dependencies=d.$_terms.dependencies||[],d.$_terms.dependencies.push(new u.Dependency(r,s,c,n,o)),d},u.dependencies={and(e,t,r,s,n){const a=[],i=[],o=t.peers.length,l=u.isPresent(t.options);for(const e of t.peers)!1===l(e.resolve(r,s,n,null,{shadow:!1}))?a.push(e.key):i.push(e.key);if(a.length!==o&&i.length!==o)return{code:"object.and",context:{present:i,presentWithLabels:u.keysToLabels(e,i),missing:a,missingWithLabels:u.keysToLabels(e,a)}}},nand(e,t,r,s,n){const a=[],i=u.isPresent(t.options);for(const e of t.peers)i(e.resolve(r,s,n,null,{shadow:!1}))&&a.push(e.key);if(a.length!==t.peers.length)return;const o=t.paths[0],l=t.paths.slice(1);return{code:"object.nand",context:{main:o,mainWithLabel:u.keysToLabels(e,o),peers:l,peersWithLabels:u.keysToLabels(e,l)}}},or(e,t,r,s,n){const a=u.isPresent(t.options);for(const e of t.peers)if(a(e.resolve(r,s,n,null,{shadow:!1})))return;return{code:"object.missing",context:{peers:t.paths,peersWithLabels:u.keysToLabels(e,t.paths)}}},oxor(e,t,r,s,n){const a=[],i=u.isPresent(t.options);for(const e of t.peers)i(e.resolve(r,s,n,null,{shadow:!1}))&&a.push(e.key);if(!a.length||1===a.length)return;const o={peers:t.paths,peersWithLabels:u.keysToLabels(e,t.paths)};return o.present=a,o.presentWithLabels=u.keysToLabels(e,a),{code:"object.oxor",context:o}},with(e,t,r,s,n){const a=u.isPresent(t.options);for(const i of t.peers)if(!1===a(i.resolve(r,s,n,null,{shadow:!1})))return{code:"object.with",context:{main:t.key.key,mainWithLabel:u.keysToLabels(e,t.key.key),peer:i.key,peerWithLabel:u.keysToLabels(e,i.key)}}},without(e,t,r,s,n){const a=u.isPresent(t.options);for(const i of t.peers)if(a(i.resolve(r,s,n,null,{shadow:!1})))return{code:"object.without",context:{main:t.key.key,mainWithLabel:u.keysToLabels(e,t.key.key),peer:i.key,peerWithLabel:u.keysToLabels(e,i.key)}}},xor(e,t,r,s,n){const a=[],i=u.isPresent(t.options);for(const e of t.peers)i(e.resolve(r,s,n,null,{shadow:!1}))&&a.push(e.key);if(1===a.length)return;const o={peers:t.paths,peersWithLabels:u.keysToLabels(e,t.paths)};return 0===a.length?{code:"object.missing",context:o}:(o.present=a,o.presentWithLabels=u.keysToLabels(e,a),{code:"object.xor",context:o})}},u.keysToLabels=function(e,t){return Array.isArray(t)?t.map((t=>e.$_mapLabels(t))):e.$_mapLabels(t)},u.isPresent=function(e){return"function"==typeof e.isPresent?e.isPresent:e=>void 0!==e},u.rename=function(e,t,r,s,n){const a={};for(const i of e.$_terms.renames){const o=[],l="string"!=typeof i.from;if(l)for(const e in t){if(void 0===t[e]&&i.options.ignoreUndefined)continue;if(e===i.to)continue;const r=i.from.exec(e);r&&o.push({from:e,to:i.to,match:r})}else!Object.prototype.hasOwnProperty.call(t,i.from)||void 0===t[i.from]&&i.options.ignoreUndefined||o.push(i);for(const u of o){const o=u.from;let d=u.to;if(d instanceof c&&(d=d.render(t,r,s,u.match)),o!==d){if(!i.options.multiple&&a[d]&&(n.push(e.$_createError("object.rename.multiple",t,{from:o,to:d,pattern:l},r,s)),s.abortEarly))return!1;if(Object.prototype.hasOwnProperty.call(t,d)&&!i.options.override&&!a[d]&&(n.push(e.$_createError("object.rename.override",t,{from:o,to:d,pattern:l},r,s)),s.abortEarly))return!1;void 0===t[o]?delete t[d]:t[d]=t[o],a[d]=!0,i.options.alias||delete t[o]}}}return!0},u.unknown=function(e,t,r,s,n,i){if(e.$_terms.patterns){let a=!1;const l=e.$_terms.patterns.map((e=>{if(e.matches)return a=!0,[]})),c=[t,...n.ancestors];for(const a of r){const o=t[a],u=[...n.path,a];for(let d=0;d<e.$_terms.patterns.length;++d){const f=e.$_terms.patterns[d];if(f.regex){const e=f.regex.test(a);if(n.mainstay.tracer.debug(n,"rule",`pattern.${d}`,e?"pass":"error"),!e)continue}else if(!f.schema.$_match(a,n.nest(f.schema,`pattern.${d}`),i))continue;r.delete(a);const h=n.localize(u,c,{schema:f.rule,key:a}),p=f.rule.$_validate(o,h,i);if(p.errors){if(i.abortEarly)return{value:t,errors:p.errors};s.push(...p.errors)}if(f.matches&&l[d].push(a),t[a]=p.value,!f.fallthrough)break}}if(a)for(let r=0;r<l.length;++r){const a=l[r];if(!a)continue;const u=e.$_terms.patterns[r].matches,d=n.localize(n.path,c,u),f=u.$_validate(a,d,i);if(f.errors){const r=o.details(f.errors,{override:!1});r.matches=a;const l=e.$_createError("object.pattern.match",t,r,n,i);if(i.abortEarly)return{value:t,errors:l};s.push(l)}}}if(!r.size||!e.$_terms.keys&&!e.$_terms.patterns)return;if(i.stripUnknown&&!e._flags.unknown||i.skipFunctions){const e=!!i.stripUnknown&&(!0===i.stripUnknown||!!i.stripUnknown.objects);for(const s of r)e?(delete t[s],r.delete(s)):"function"==typeof t[s]&&r.delete(s)}if(!a.default(e._flags.unknown,i.allowUnknown))for(const a of r){const r=n.localize([...n.path,a],[]),o=e.$_createError("object.unknown",t[a],{child:a},r,i,{flags:!1});if(i.abortEarly)return{value:t,errors:o};s.push(o)}},u.Dependency=class{constructor(e,t,r,s,n){this.rel=e,this.key=t,this.peers=r,this.paths=s,this.options=n}describe(){const e={rel:this.rel,peers:this.paths};return null!==this.key&&(e.key=this.key.key),"."!==this.peers[0].separator&&(e.options={...e.options,separator:this.peers[0].separator}),this.options.isPresent&&(e.options={...e.options,isPresent:this.options.isPresent}),e}},u.Keys=class extends Array{concat(e){const t=this.slice(),r=new Map;for(let e=0;e<t.length;++e)r.set(t[e].key,e);for(const s of e){const e=s.key,n=r.get(e);void 0!==n?t[n]={key:e,schema:t[n].schema.concat(s.schema)}:t.push(s)}return t}},vs}function Ts(){if(As)return bs;As=1;const e=Nt,t=Is();return bs=t.extend({type:"function",properties:{typeof:"function"},rules:{arity:{method(t){return e(Number.isSafeInteger(t)&&t>=0,"n must be a positive integer"),this.$_addRule({name:"arity",args:{n:t}})},validate:(e,t,{n:r})=>e.length===r?e:t.error("function.arity",{n:r})},class:{method(){return this.$_addRule("class")},validate:(e,t)=>/^\s*class\s/.test(e.toString())?e:t.error("function.class",{value:e})},minArity:{method(t){return e(Number.isSafeInteger(t)&&t>0,"n must be a strict positive integer"),this.$_addRule({name:"minArity",args:{n:t}})},validate:(e,t,{n:r})=>e.length>=r?e:t.error("function.minArity",{n:r})},maxArity:{method(t){return e(Number.isSafeInteger(t)&&t>=0,"n must be a positive integer"),this.$_addRule({name:"maxArity",args:{n:t}})},validate:(e,t,{n:r})=>e.length<=r?e:t.error("function.maxArity",{n:r})}},messages:{"function.arity":"{{#label}} must have an arity of {{#n}}","function.class":"{{#label}} must be a class","function.maxArity":"{{#label}} must have an arity lesser or equal to {{#n}}","function.minArity":"{{#label}} must have an arity greater or equal to {{#n}}"}})}function xs(){if(Ss)return Es;Ss=1;const e=Nt,t=ns(),r=dr(),s=mr(),n=tr(),a={};return Es=t.extend({type:"link",properties:{schemaChain:!0},terms:{link:{init:null,manifest:"single",register:!1}},args:(e,t)=>e.ref(t),validate(t,{schema:r,state:s,prefs:n}){e(r.$_terms.link,"Uninitialized link schema");const i=a.generate(r,t,s,n),o=r.$_terms.link[0].ref;return i.$_validate(t,s.nest(i,`link:${o.display}:${i.type}`),n)},generate:(e,t,r,s)=>a.generate(e,t,r,s),rules:{ref:{method(t){e(!this.$_terms.link,"Cannot reinitialize schema"),t=s.ref(t),e("value"===t.type||"local"===t.type,"Invalid reference type:",t.type),e("local"===t.type||"root"===t.ancestor||t.ancestor>0,"Link cannot reference itself");const r=this.clone();return r.$_terms.link=[{ref:t}],r}},relative:{method(e=!0){return this.$_setFlag("relative",e)}}},overrides:{concat(t){e(this.$_terms.link,"Uninitialized link schema"),e(r.isSchema(t),"Invalid schema object"),e("link"!==t.type,"Cannot merge type link with another link");const s=this.clone();return s.$_terms.whens||(s.$_terms.whens=[]),s.$_terms.whens.push({concat:t}),s.$_mutateRebuild()}},manifest:{build:(t,r)=>(e(r.link,"Invalid link description missing link"),t.ref(r.link))}}),a.generate=function(e,t,r,s){let n=r.mainstay.links.get(e);if(n)return n._generate(t,r,s).schema;const i=e.$_terms.link[0].ref,{perspective:o,path:l}=a.perspective(i,r);a.assert(o,"which is outside of schema boundaries",i,e,r,s);try{n=l.length?o.$_reach(l):o}catch(t){a.assert(!1,"to non-existing schema",i,e,r,s)}return a.assert("link"!==n.type,"which is another link",i,e,r,s),e._flags.relative||r.mainstay.links.set(e,n),n._generate(t,r,s).schema},a.perspective=function(e,t){if("local"===e.type){for(const{schema:r,key:s}of t.schemas){if((r._flags.id||s)===e.path[0])return{perspective:r,path:e.path.slice(1)};if(r.$_terms.shared)for(const t of r.$_terms.shared)if(t._flags.id===e.path[0])return{perspective:t,path:e.path.slice(1)}}return{perspective:null,path:null}}return"root"===e.ancestor?{perspective:t.schemas[t.schemas.length-1].schema,path:e.path}:{perspective:t.schemas[e.ancestor]&&t.schemas[e.ancestor].schema,path:e.path}},a.assert=function(t,r,s,a,i,o){t||e(!1,`"${n.label(a._flags,i,o)}" contains link reference "${s.display}" ${r}`)},Es}function Cs(){if(Rs)return Os;Rs=1;const e=Nt,t=ns(),r=dr(),s={numberRx:/^\s*[+-]?(?:(?:\d+(?:\.\d*)?)|(?:\.\d+))(?:e([+-]?\d+))?\s*$/i,precisionRx:/(?:\.(\d+))?(?:[eE]([+-]?\d+))?$/,exponentialPartRegex:/[eE][+-]?\d+$/,leadingSignAndZerosRegex:/^[+-]?(0*)?/,dotRegex:/\./,trailingZerosRegex:/0+$/};return Os=t.extend({type:"number",flags:{unsafe:{default:!1}},coerce:{from:"string",method(e,{schema:t,error:r}){if(!e.match(s.numberRx))return;e=e.trim();const n={value:parseFloat(e)};if(0===n.value&&(n.value=0),!t._flags.unsafe)if(e.match(/e/i)){if(s.extractSignificantDigits(e)!==s.extractSignificantDigits(String(n.value)))return n.errors=r("number.unsafe"),n}else{const t=n.value.toString();if(t.match(/e/i))return n;if(t!==s.normalizeDecimal(e))return n.errors=r("number.unsafe"),n}return n}},validate(e,{schema:t,error:s,prefs:n}){if(e===1/0||e===-1/0)return{value:e,errors:s("number.infinity")};if(!r.isNumber(e))return{value:e,errors:s("number.base")};const a={value:e};if(n.convert){const e=t.$_getRule("precision");if(e){const t=Math.pow(10,e.args.limit);a.value=Math.round(a.value*t)/t}}return 0===a.value&&(a.value=0),!t._flags.unsafe&&(e>Number.MAX_SAFE_INTEGER||e<Number.MIN_SAFE_INTEGER)&&(a.errors=s("number.unsafe")),a},rules:{compare:{method:!1,validate:(e,t,{limit:s},{name:n,operator:a,args:i})=>r.compare(e,s,a)?e:t.error("number."+n,{limit:i.limit,value:e}),args:[{name:"limit",ref:!0,assert:r.isNumber,message:"must be a number"}]},greater:{method(e){return this.$_addRule({name:"greater",method:"compare",args:{limit:e},operator:">"})}},integer:{method(){return this.$_addRule("integer")},validate:(e,t)=>Math.trunc(e)-e==0?e:t.error("number.integer")},less:{method(e){return this.$_addRule({name:"less",method:"compare",args:{limit:e},operator:"<"})}},max:{method(e){return this.$_addRule({name:"max",method:"compare",args:{limit:e},operator:"<="})}},min:{method(e){return this.$_addRule({name:"min",method:"compare",args:{limit:e},operator:">="})}},multiple:{method(e){return this.$_addRule({name:"multiple",args:{base:e}})},validate:(e,t,{base:r},s)=>e*(1/r)%1==0?e:t.error("number.multiple",{multiple:s.args.base,value:e}),args:[{name:"base",ref:!0,assert:e=>"number"==typeof e&&isFinite(e)&&e>0,message:"must be a positive number"}],multi:!0},negative:{method(){return this.sign("negative")}},port:{method(){return this.$_addRule("port")},validate:(e,t)=>Number.isSafeInteger(e)&&e>=0&&e<=65535?e:t.error("number.port")},positive:{method(){return this.sign("positive")}},precision:{method(t){return e(Number.isSafeInteger(t),"limit must be an integer"),this.$_addRule({name:"precision",args:{limit:t}})},validate(e,t,{limit:r}){const n=e.toString().match(s.precisionRx);return Math.max((n[1]?n[1].length:0)-(n[2]?parseInt(n[2],10):0),0)<=r?e:t.error("number.precision",{limit:r,value:e})},convert:!0},sign:{method(t){return e(["negative","positive"].includes(t),"Invalid sign",t),this.$_addRule({name:"sign",args:{sign:t}})},validate:(e,t,{sign:r})=>"negative"===r&&e<0||"positive"===r&&e>0?e:t.error(`number.${r}`)},unsafe:{method(t=!0){return e("boolean"==typeof t,"enabled must be a boolean"),this.$_setFlag("unsafe",t)}}},cast:{string:{from:e=>"number"==typeof e,to:(e,t)=>e.toString()}},messages:{"number.base":"{{#label}} must be a number","number.greater":"{{#label}} must be greater than {{#limit}}","number.infinity":"{{#label}} cannot be infinity","number.integer":"{{#label}} must be an integer","number.less":"{{#label}} must be less than {{#limit}}","number.max":"{{#label}} must be less than or equal to {{#limit}}","number.min":"{{#label}} must be greater than or equal to {{#limit}}","number.multiple":"{{#label}} must be a multiple of {{#multiple}}","number.negative":"{{#label}} must be a negative number","number.port":"{{#label}} must be a valid port","number.positive":"{{#label}} must be a positive number","number.precision":"{{#label}} must have no more than {{#limit}} decimal places","number.unsafe":"{{#label}} must be a safe number"}}),s.extractSignificantDigits=function(e){return e.replace(s.exponentialPartRegex,"").replace(s.dotRegex,"").replace(s.trailingZerosRegex,"").replace(s.leadingSignAndZerosRegex,"")},s.normalizeDecimal=function(e){return(e=e.replace(/^\+/,"").replace(/\.0*$/,"").replace(/^(-?)\.([^\.]*)$/,"$10.$2").replace(/^(-?)0+([0-9])/,"$1$2")).includes(".")&&e.endsWith("0")&&(e=e.replace(/0+$/,"")),"-0"===e?"0":e},Os}function $s(){if(Ns)return ws;Ns=1;const e=Is();return ws=e.extend({type:"object",cast:{map:{from:e=>e&&"object"==typeof e,to:(e,t)=>new Map(Object.entries(e))}}})}ms.Sorter=class{constructor(){this._items=[],this.nodes=[]}add(e,t){const r=[].concat((t=t||{}).before||[]),s=[].concat(t.after||[]),n=t.group||"?",a=t.sort||0;gs(!r.includes(n),`Item cannot come before itself: ${n}`),gs(!r.includes("?"),"Item cannot come before unassociated items"),gs(!s.includes(n),`Item cannot come after itself: ${n}`),gs(!s.includes("?"),"Item cannot come after unassociated items"),Array.isArray(e)||(e=[e]);for(const t of e){const e={seq:this._items.length,sort:a,before:r,after:s,group:n,node:t};this._items.push(e)}if(!t.manual){const e=this._sort();gs(e,"item","?"!==n?`added into group ${n}`:"","created a dependencies error")}return this.nodes}merge(e){Array.isArray(e)||(e=[e]);for(const t of e)if(t)for(const e of t._items)this._items.push(Object.assign({},e));this._items.sort(ys.mergeSort);for(let e=0;e<this._items.length;++e)this._items[e].seq=e;const t=this._sort();return gs(t,"merge created a dependencies error"),this.nodes}sort(){const e=this._sort();return gs(e,"sort created a dependencies error"),this.nodes}_sort(){const e={},t=Object.create(null),r=Object.create(null);for(const s of this._items){const n=s.seq,a=s.group;r[a]=r[a]||[],r[a].push(n),e[n]=s.before;for(const e of s.after)t[e]=t[e]||[],t[e].push(n)}for(const t in e){const s=[];for(const n in e[t]){const a=e[t][n];r[a]=r[a]||[],s.push(...r[a])}e[t]=s}for(const s in t)if(r[s])for(const n of r[s])e[n].push(...t[s]);const s={};for(const t in e){const r=e[t];for(const e of r)s[e]=s[e]||[],s[e].push(t)}const n={},a=[];for(let e=0;e<this._items.length;++e){let t=e;if(s[e]){t=null;for(let e=0;e<this._items.length;++e){if(!0===n[e])continue;s[e]||(s[e]=[]);const r=s[e].length;let a=0;for(let t=0;t<r;++t)n[s[e][t]]&&++a;if(a===r){t=e;break}}}null!==t&&(n[t]=!0,a.push(t))}if(a.length!==this._items.length)return!1;const i={};for(const e of this._items)i[e.seq]=e;this._items=[],this.nodes=[];for(const e of a){const t=i[e];this.nodes.push(t.node),this._items.push(t)}return!0}},ys.mergeSort=(e,t)=>e.sort===t.sort?0:e.sort<t.sort?-1:1;var ks,Ls={},Ms={};(ks=Ms).codes={EMPTY_STRING:"Address must be a non-empty string",FORBIDDEN_UNICODE:"Address contains forbidden Unicode characters",MULTIPLE_AT_CHAR:"Address cannot contain more than one @ character",MISSING_AT_CHAR:"Address must contain one @ character",EMPTY_LOCAL:"Address local part cannot be empty",ADDRESS_TOO_LONG:"Address too long",LOCAL_TOO_LONG:"Address local part too long",EMPTY_LOCAL_SEGMENT:"Address local part contains empty dot-separated segment",INVALID_LOCAL_CHARS:"Address local part contains invalid character",DOMAIN_NON_EMPTY_STRING:"Domain must be a non-empty string",DOMAIN_TOO_LONG:"Domain too long",DOMAIN_INVALID_UNICODE_CHARS:"Domain contains forbidden Unicode characters",DOMAIN_INVALID_CHARS:"Domain contains invalid character",DOMAIN_INVALID_TLDS_CHARS:"Domain contains invalid tld character",DOMAIN_SEGMENTS_COUNT:"Domain lacks the minimum required number of segments",DOMAIN_SEGMENTS_COUNT_MAX:"Domain contains too many segments",DOMAIN_FORBIDDEN_TLDS:"Domain uses forbidden TLD",DOMAIN_EMPTY_SEGMENT:"Domain contains empty dot-separated segment",DOMAIN_LONG_SEGMENT:"Domain contains dot-separated segment that is too long"},ks.code=function(e){return{code:e,error:ks.codes[e]}},function(e){const t=Ms,r={minDomainSegments:2,nonAsciiRx:/[^\x00-\x7f]/,domainControlRx:/[\x00-\x20@\:\/\\#!\$&\'\(\)\*\+,;=\?]/,tldSegmentRx:/^[a-zA-Z](?:[a-zA-Z0-9\-]*[a-zA-Z0-9])?$/,domainSegmentRx:/^[a-zA-Z0-9](?:[a-zA-Z0-9\-]*[a-zA-Z0-9])?$/,URL:s.URL||URL};e.analyze=function(e,s={}){if(!e)return t.code("DOMAIN_NON_EMPTY_STRING");if("string"!=typeof e)throw new Error("Invalid input: domain must be a string");if(e.length>256)return t.code("DOMAIN_TOO_LONG");if(!!r.nonAsciiRx.test(e)){if(!1===s.allowUnicode)return t.code("DOMAIN_INVALID_UNICODE_CHARS");e=e.normalize("NFC")}if(r.domainControlRx.test(e))return t.code("DOMAIN_INVALID_CHARS");e=r.punycode(e),s.allowFullyQualified&&"."===e[e.length-1]&&(e=e.slice(0,-1));const n=s.minDomainSegments||r.minDomainSegments,a=e.split(".");if(a.length<n)return t.code("DOMAIN_SEGMENTS_COUNT");if(s.maxDomainSegments&&a.length>s.maxDomainSegments)return t.code("DOMAIN_SEGMENTS_COUNT_MAX");const i=s.tlds;if(i){const e=a[a.length-1].toLowerCase();if(i.deny&&i.deny.has(e)||i.allow&&!i.allow.has(e))return t.code("DOMAIN_FORBIDDEN_TLDS")}for(let e=0;e<a.length;++e){const s=a[e];if(!s.length)return t.code("DOMAIN_EMPTY_SEGMENT");if(s.length>63)return t.code("DOMAIN_LONG_SEGMENT");if(e<a.length-1){if(!r.domainSegmentRx.test(s))return t.code("DOMAIN_INVALID_CHARS")}else if(!r.tldSegmentRx.test(s))return t.code("DOMAIN_INVALID_TLDS_CHARS")}return null},e.isValid=function(t,r){return!e.analyze(t,r)},r.punycode=function(e){e.includes("%")&&(e=e.replace(/%/g,"%25"));try{return new r.URL(`http://${e}`).host}catch(t){return e}}}(Ls);var Ds={};const js=Ls,Ps=Ms,Bs={nonAsciiRx:/[^\x00-\x7f]/,encoder:new(n.TextEncoder||TextEncoder)};Ds.analyze=function(e,t){return Bs.email(e,t)},Ds.isValid=function(e,t){return!Bs.email(e,t)},Bs.email=function(e,t={}){if("string"!=typeof e)throw new Error("Invalid input: email must be a string");if(!e)return Ps.code("EMPTY_STRING");const r=!Bs.nonAsciiRx.test(e);if(!r){if(!1===t.allowUnicode)return Ps.code("FORBIDDEN_UNICODE");e=e.normalize("NFC")}const s=e.split("@");if(2!==s.length)return s.length>2?Ps.code("MULTIPLE_AT_CHAR"):Ps.code("MISSING_AT_CHAR");const[n,a]=s;if(!n)return Ps.code("EMPTY_LOCAL");if(!t.ignoreLength){if(e.length>254)return Ps.code("ADDRESS_TOO_LONG");if(Bs.encoder.encode(n).length>64)return Ps.code("LOCAL_TOO_LONG")}return Bs.local(n,r)||js.analyze(a,t)},Bs.local=function(e,t){const r=e.split(".");for(const e of r){if(!e.length)return Ps.code("EMPTY_LOCAL_SEGMENT");if(t){if(!Bs.atextRx.test(e))return Ps.code("INVALID_LOCAL_CHARS")}else for(const t of e){if(Bs.atextRx.test(t))continue;const e=Bs.binary(t);if(!Bs.atomRx.test(e))return Ps.code("INVALID_LOCAL_CHARS")}}},Bs.binary=function(e){return Array.from(Bs.encoder.encode(e)).map((e=>String.fromCharCode(e))).join("")},Bs.atextRx=/^[\w!#\$%&'\*\+\-/=\?\^`\{\|\}~]+$/,Bs.atomRx=new RegExp(["(?:[\\xc2-\\xdf][\\x80-\\xbf])","(?:\\xe0[\\xa0-\\xbf][\\x80-\\xbf])|(?:[\\xe1-\\xec][\\x80-\\xbf]{2})|(?:\\xed[\\x80-\\x9f][\\x80-\\xbf])|(?:[\\xee-\\xef][\\x80-\\xbf]{2})","(?:\\xf0[\\x90-\\xbf][\\x80-\\xbf]{2})|(?:[\\xf1-\\xf3][\\x80-\\xbf]{3})|(?:\\xf4[\\x80-\\x8f][\\x80-\\xbf]{2})"].join("|"));var Us={},Gs={},Fs=function(e){return e.replace(/[\^\$\.\*\+\-\?\=\!\:\|\\\/\(\)\[\]\{\}\,]/g,"\\$&")};const Zs=Nt,Hs=Fs,Xs={generate:function(){const e={},t="\\dA-Fa-f",r="["+t+"]",s="\\w-\\.~",n="!\\$&'\\(\\)\\*\\+,;=",a="%"+t,i=s+a+n+":@",o="["+i+"]",l="(?:0{0,2}\\d|0?[1-9]\\d|1\\d\\d|2[0-4]\\d|25[0-5])";e.ipv4address="(?:"+l+"\\.){3}"+l;const c=r+"{1,4}",u="(?:"+c+":"+c+"|"+e.ipv4address+")",d="(?:"+c+":){6}"+u,f="::(?:"+c+":){5}"+u,h="(?:"+c+")?::(?:"+c+":){4}"+u,p="(?:(?:"+c+":){0,1}"+c+")?::(?:"+c+":){3}"+u,m="(?:(?:"+c+":){0,2}"+c+")?::(?:"+c+":){2}"+u,g="(?:(?:"+c+":){0,3}"+c+")?::"+c+":"+u,y="(?:(?:"+c+":){0,4}"+c+")?::"+u,v="(?:(?:"+c+":){0,5}"+c+")?::"+c,_="(?:(?:"+c+":){0,6}"+c+")?::";e.ipv4Cidr="(?:\\d|[1-2]\\d|3[0-2])",e.ipv6Cidr="(?:0{0,2}\\d|0?[1-9]\\d|1[01]\\d|12[0-8])",e.ipv6address="(?:"+d+"|"+f+"|"+h+"|"+p+"|"+m+"|"+g+"|"+y+"|"+v+"|"+_+")",e.ipvFuture="v"+r+"+\\.["+s+n+":]+",e.scheme="[a-zA-Z][a-zA-Z\\d+-\\.]*",e.schemeRegex=new RegExp(e.scheme);const b="["+s+a+n+":]*",A="["+s+a+n+"]{1,255}",E="(?:"+("\\[(?:"+e.ipv6address+"|"+e.ipvFuture+")\\]")+"|"+e.ipv4address+"|"+A+")",S="(?:"+b+"@)?"+E+"(?::\\d*)?",O="(?:"+b+"@)?("+E+")(?::\\d*)?",R=o+"*",w=o+"+",N="(?:\\/"+R+")*",I="\\/(?:"+w+N+")?",T=w+N,x="["+s+a+n+"@]+"+N,C="(?:\\/\\/\\/"+R+N+")";return e.hierPart="(?:(?:\\/\\/"+S+N+")|"+I+"|"+T+"|"+C+")",e.hierPartCapture="(?:(?:\\/\\/"+O+N+")|"+I+"|"+T+")",e.relativeRef="(?:(?:\\/\\/"+S+N+")|"+I+"|"+x+"|)",e.relativeRefCapture="(?:(?:\\/\\/"+O+N+")|"+I+"|"+x+"|)",e.query="["+i+"\\/\\?]*(?=#|$)",e.queryWithSquareBrackets="["+i+"\\[\\]\\/\\?]*(?=#|$)",e.fragment="["+i+"\\/\\?]*",e}};Xs.rfc3986=Xs.generate(),Gs.ip={v4Cidr:Xs.rfc3986.ipv4Cidr,v6Cidr:Xs.rfc3986.ipv6Cidr,ipv4:Xs.rfc3986.ipv4address,ipv6:Xs.rfc3986.ipv6address,ipvfuture:Xs.rfc3986.ipvFuture},Xs.createRegex=function(e){const t=Xs.rfc3986,r="(?:\\?"+(e.allowQuerySquareBrackets?t.queryWithSquareBrackets:t.query)+")?(?:#"+t.fragment+")?",s=e.domain?t.relativeRefCapture:t.relativeRef;if(e.relativeOnly)return Xs.wrap(s+r);let n="";if(e.scheme){Zs(e.scheme instanceof RegExp||"string"==typeof e.scheme||Array.isArray(e.scheme),"scheme must be a RegExp, String, or Array");const r=[].concat(e.scheme);Zs(r.length>=1,"scheme must have at least 1 scheme specified");const s=[];for(let e=0;e<r.length;++e){const n=r[e];Zs(n instanceof RegExp||"string"==typeof n,"scheme at position "+e+" must be a RegExp or String"),n instanceof RegExp?s.push(n.source.toString()):(Zs(t.schemeRegex.test(n),"scheme at position "+e+" must be a valid scheme"),s.push(Hs(n)))}n=s.join("|")}const a="(?:"+(n?"(?:"+n+")":t.scheme)+":"+(e.domain?t.hierPartCapture:t.hierPart)+")",i=e.allowRelative?"(?:"+a+"|"+s+")":a;return Xs.wrap(i+r,n)},Xs.wrap=function(e,t){return{raw:e=`(?=.)(?!https?:/(?:$|[^/]))(?!https?:///)(?!https?:[^/])${e}`,regex:new RegExp(`^${e}$`),scheme:t}},Xs.uriRegex=Xs.createRegex({}),Gs.regex=function(e={}){return e.scheme||e.allowRelative||e.relativeOnly||e.allowQuerySquareBrackets||e.domain?Xs.createRegex(e):Xs.uriRegex};const Ks=Nt,Vs=Gs;Us.regex=function(e={}){Ks(void 0===e.cidr||"string"==typeof e.cidr,"options.cidr must be a string");const t=e.cidr?e.cidr.toLowerCase():"optional";Ks(["required","optional","forbidden"].includes(t),"options.cidr must be one of required, optional, forbidden"),Ks(void 0===e.version||"string"==typeof e.version||Array.isArray(e.version),"options.version must be a string or an array of string");let r=e.version||["ipv4","ipv6","ipvfuture"];Array.isArray(r)||(r=[r]),Ks(r.length>=1,"options.version must have at least 1 version specified");for(let e=0;e<r.length;++e)Ks("string"==typeof r[e],"options.version must only contain strings"),r[e]=r[e].toLowerCase(),Ks(["ipv4","ipv6","ipvfuture"].includes(r[e]),"options.version contains unknown version "+r[e]+" - must be one of ipv4, ipv6, ipvfuture");r=Array.from(new Set(r));const s=r.map((e=>{if("forbidden"===t)return Vs.ip[e];const r=`\\/${"ipv4"===e?Vs.ip.v4Cidr:Vs.ip.v6Cidr}`;return"required"===t?`${Vs.ip[e]}${r}`:`${Vs.ip[e]}(?:${r})?`})),n=`(?:${s.join("|")})`,a=new RegExp(`^${n}$`);return{cidr:t,versions:r,regex:a,raw:n}};const Ws={tlds:["AAA","AARP","ABARTH","ABB","ABBOTT","ABBVIE","ABC","ABLE","ABOGADO","ABUDHABI","AC","ACADEMY","ACCENTURE","ACCOUNTANT","ACCOUNTANTS","ACO","ACTOR","AD","ADAC","ADS","ADULT","AE","AEG","AERO","AETNA","AF","AFL","AFRICA","AG","AGAKHAN","AGENCY","AI","AIG","AIRBUS","AIRFORCE","AIRTEL","AKDN","AL","ALFAROMEO","ALIBABA","ALIPAY","ALLFINANZ","ALLSTATE","ALLY","ALSACE","ALSTOM","AM","AMAZON","AMERICANEXPRESS","AMERICANFAMILY","AMEX","AMFAM","AMICA","AMSTERDAM","ANALYTICS","ANDROID","ANQUAN","ANZ","AO","AOL","APARTMENTS","APP","APPLE","AQ","AQUARELLE","AR","ARAB","ARAMCO","ARCHI","ARMY","ARPA","ART","ARTE","AS","ASDA","ASIA","ASSOCIATES","AT","ATHLETA","ATTORNEY","AU","AUCTION","AUDI","AUDIBLE","AUDIO","AUSPOST","AUTHOR","AUTO","AUTOS","AVIANCA","AW","AWS","AX","AXA","AZ","AZURE","BA","BABY","BAIDU","BANAMEX","BANANAREPUBLIC","BAND","BANK","BAR","BARCELONA","BARCLAYCARD","BARCLAYS","BAREFOOT","BARGAINS","BASEBALL","BASKETBALL","BAUHAUS","BAYERN","BB","BBC","BBT","BBVA","BCG","BCN","BD","BE","BEATS","BEAUTY","BEER","BENTLEY","BERLIN","BEST","BESTBUY","BET","BF","BG","BH","BHARTI","BI","BIBLE","BID","BIKE","BING","BINGO","BIO","BIZ","BJ","BLACK","BLACKFRIDAY","BLOCKBUSTER","BLOG","BLOOMBERG","BLUE","BM","BMS","BMW","BN","BNPPARIBAS","BO","BOATS","BOEHRINGER","BOFA","BOM","BOND","BOO","BOOK","BOOKING","BOSCH","BOSTIK","BOSTON","BOT","BOUTIQUE","BOX","BR","BRADESCO","BRIDGESTONE","BROADWAY","BROKER","BROTHER","BRUSSELS","BS","BT","BUGATTI","BUILD","BUILDERS","BUSINESS","BUY","BUZZ","BV","BW","BY","BZ","BZH","CA","CAB","CAFE","CAL","CALL","CALVINKLEIN","CAM","CAMERA","CAMP","CANCERRESEARCH","CANON","CAPETOWN","CAPITAL","CAPITALONE","CAR","CARAVAN","CARDS","CARE","CAREER","CAREERS","CARS","CASA","CASE","CASH","CASINO","CAT","CATERING","CATHOLIC","CBA","CBN","CBRE","CBS","CC","CD","CENTER","CEO","CERN","CF","CFA","CFD","CG","CH","CHANEL","CHANNEL","CHARITY","CHASE","CHAT","CHEAP","CHINTAI","CHRISTMAS","CHROME","CHURCH","CI","CIPRIANI","CIRCLE","CISCO","CITADEL","CITI","CITIC","CITY","CITYEATS","CK","CL","CLAIMS","CLEANING","CLICK","CLINIC","CLINIQUE","CLOTHING","CLOUD","CLUB","CLUBMED","CM","CN","CO","COACH","CODES","COFFEE","COLLEGE","COLOGNE","COM","COMCAST","COMMBANK","COMMUNITY","COMPANY","COMPARE","COMPUTER","COMSEC","CONDOS","CONSTRUCTION","CONSULTING","CONTACT","CONTRACTORS","COOKING","COOKINGCHANNEL","COOL","COOP","CORSICA","COUNTRY","COUPON","COUPONS","COURSES","CPA","CR","CREDIT","CREDITCARD","CREDITUNION","CRICKET","CROWN","CRS","CRUISE","CRUISES","CU","CUISINELLA","CV","CW","CX","CY","CYMRU","CYOU","CZ","DABUR","DAD","DANCE","DATA","DATE","DATING","DATSUN","DAY","DCLK","DDS","DE","DEAL","DEALER","DEALS","DEGREE","DELIVERY","DELL","DELOITTE","DELTA","DEMOCRAT","DENTAL","DENTIST","DESI","DESIGN","DEV","DHL","DIAMONDS","DIET","DIGITAL","DIRECT","DIRECTORY","DISCOUNT","DISCOVER","DISH","DIY","DJ","DK","DM","DNP","DO","DOCS","DOCTOR","DOG","DOMAINS","DOT","DOWNLOAD","DRIVE","DTV","DUBAI","DUNLOP","DUPONT","DURBAN","DVAG","DVR","DZ","EARTH","EAT","EC","ECO","EDEKA","EDU","EDUCATION","EE","EG","EMAIL","EMERCK","ENERGY","ENGINEER","ENGINEERING","ENTERPRISES","EPSON","EQUIPMENT","ER","ERICSSON","ERNI","ES","ESQ","ESTATE","ET","ETISALAT","EU","EUROVISION","EUS","EVENTS","EXCHANGE","EXPERT","EXPOSED","EXPRESS","EXTRASPACE","FAGE","FAIL","FAIRWINDS","FAITH","FAMILY","FAN","FANS","FARM","FARMERS","FASHION","FAST","FEDEX","FEEDBACK","FERRARI","FERRERO","FI","FIAT","FIDELITY","FIDO","FILM","FINAL","FINANCE","FINANCIAL","FIRE","FIRESTONE","FIRMDALE","FISH","FISHING","FIT","FITNESS","FJ","FK","FLICKR","FLIGHTS","FLIR","FLORIST","FLOWERS","FLY","FM","FO","FOO","FOOD","FOODNETWORK","FOOTBALL","FORD","FOREX","FORSALE","FORUM","FOUNDATION","FOX","FR","FREE","FRESENIUS","FRL","FROGANS","FRONTDOOR","FRONTIER","FTR","FUJITSU","FUN","FUND","FURNITURE","FUTBOL","FYI","GA","GAL","GALLERY","GALLO","GALLUP","GAME","GAMES","GAP","GARDEN","GAY","GB","GBIZ","GD","GDN","GE","GEA","GENT","GENTING","GEORGE","GF","GG","GGEE","GH","GI","GIFT","GIFTS","GIVES","GIVING","GL","GLASS","GLE","GLOBAL","GLOBO","GM","GMAIL","GMBH","GMO","GMX","GN","GODADDY","GOLD","GOLDPOINT","GOLF","GOO","GOODYEAR","GOOG","GOOGLE","GOP","GOT","GOV","GP","GQ","GR","GRAINGER","GRAPHICS","GRATIS","GREEN","GRIPE","GROCERY","GROUP","GS","GT","GU","GUARDIAN","GUCCI","GUGE","GUIDE","GUITARS","GURU","GW","GY","HAIR","HAMBURG","HANGOUT","HAUS","HBO","HDFC","HDFCBANK","HEALTH","HEALTHCARE","HELP","HELSINKI","HERE","HERMES","HGTV","HIPHOP","HISAMITSU","HITACHI","HIV","HK","HKT","HM","HN","HOCKEY","HOLDINGS","HOLIDAY","HOMEDEPOT","HOMEGOODS","HOMES","HOMESENSE","HONDA","HORSE","HOSPITAL","HOST","HOSTING","HOT","HOTELES","HOTELS","HOTMAIL","HOUSE","HOW","HR","HSBC","HT","HU","HUGHES","HYATT","HYUNDAI","IBM","ICBC","ICE","ICU","ID","IE","IEEE","IFM","IKANO","IL","IM","IMAMAT","IMDB","IMMO","IMMOBILIEN","IN","INC","INDUSTRIES","INFINITI","INFO","ING","INK","INSTITUTE","INSURANCE","INSURE","INT","INTERNATIONAL","INTUIT","INVESTMENTS","IO","IPIRANGA","IQ","IR","IRISH","IS","ISMAILI","IST","ISTANBUL","IT","ITAU","ITV","JAGUAR","JAVA","JCB","JE","JEEP","JETZT","JEWELRY","JIO","JLL","JM","JMP","JNJ","JO","JOBS","JOBURG","JOT","JOY","JP","JPMORGAN","JPRS","JUEGOS","JUNIPER","KAUFEN","KDDI","KE","KERRYHOTELS","KERRYLOGISTICS","KERRYPROPERTIES","KFH","KG","KH","KI","KIA","KIM","KINDER","KINDLE","KITCHEN","KIWI","KM","KN","KOELN","KOMATSU","KOSHER","KP","KPMG","KPN","KR","KRD","KRED","KUOKGROUP","KW","KY","KYOTO","KZ","LA","LACAIXA","LAMBORGHINI","LAMER","LANCASTER","LANCIA","LAND","LANDROVER","LANXESS","LASALLE","LAT","LATINO","LATROBE","LAW","LAWYER","LB","LC","LDS","LEASE","LECLERC","LEFRAK","LEGAL","LEGO","LEXUS","LGBT","LI","LIDL","LIFE","LIFEINSURANCE","LIFESTYLE","LIGHTING","LIKE","LILLY","LIMITED","LIMO","LINCOLN","LINDE","LINK","LIPSY","LIVE","LIVING","LK","LLC","LLP","LOAN","LOANS","LOCKER","LOCUS","LOFT","LOL","LONDON","LOTTE","LOTTO","LOVE","LPL","LPLFINANCIAL","LR","LS","LT","LTD","LTDA","LU","LUNDBECK","LUXE","LUXURY","LV","LY","MA","MACYS","MADRID","MAIF","MAISON","MAKEUP","MAN","MANAGEMENT","MANGO","MAP","MARKET","MARKETING","MARKETS","MARRIOTT","MARSHALLS","MASERATI","MATTEL","MBA","MC","MCKINSEY","MD","ME","MED","MEDIA","MEET","MELBOURNE","MEME","MEMORIAL","MEN","MENU","MERCKMSD","MG","MH","MIAMI","MICROSOFT","MIL","MINI","MINT","MIT","MITSUBISHI","MK","ML","MLB","MLS","MM","MMA","MN","MO","MOBI","MOBILE","MODA","MOE","MOI","MOM","MONASH","MONEY","MONSTER","MORMON","MORTGAGE","MOSCOW","MOTO","MOTORCYCLES","MOV","MOVIE","MP","MQ","MR","MS","MSD","MT","MTN","MTR","MU","MUSEUM","MUSIC","MUTUAL","MV","MW","MX","MY","MZ","NA","NAB","NAGOYA","NAME","NATURA","NAVY","NBA","NC","NE","NEC","NET","NETBANK","NETFLIX","NETWORK","NEUSTAR","NEW","NEWS","NEXT","NEXTDIRECT","NEXUS","NF","NFL","NG","NGO","NHK","NI","NICO","NIKE","NIKON","NINJA","NISSAN","NISSAY","NL","NO","NOKIA","NORTHWESTERNMUTUAL","NORTON","NOW","NOWRUZ","NOWTV","NP","NR","NRA","NRW","NTT","NU","NYC","NZ","OBI","OBSERVER","OFFICE","OKINAWA","OLAYAN","OLAYANGROUP","OLDNAVY","OLLO","OM","OMEGA","ONE","ONG","ONL","ONLINE","OOO","OPEN","ORACLE","ORANGE","ORG","ORGANIC","ORIGINS","OSAKA","OTSUKA","OTT","OVH","PA","PAGE","PANASONIC","PARIS","PARS","PARTNERS","PARTS","PARTY","PASSAGENS","PAY","PCCW","PE","PET","PF","PFIZER","PG","PH","PHARMACY","PHD","PHILIPS","PHONE","PHOTO","PHOTOGRAPHY","PHOTOS","PHYSIO","PICS","PICTET","PICTURES","PID","PIN","PING","PINK","PIONEER","PIZZA","PK","PL","PLACE","PLAY","PLAYSTATION","PLUMBING","PLUS","PM","PN","PNC","POHL","POKER","POLITIE","PORN","POST","PR","PRAMERICA","PRAXI","PRESS","PRIME","PRO","PROD","PRODUCTIONS","PROF","PROGRESSIVE","PROMO","PROPERTIES","PROPERTY","PROTECTION","PRU","PRUDENTIAL","PS","PT","PUB","PW","PWC","PY","QA","QPON","QUEBEC","QUEST","RACING","RADIO","RE","READ","REALESTATE","REALTOR","REALTY","RECIPES","RED","REDSTONE","REDUMBRELLA","REHAB","REISE","REISEN","REIT","RELIANCE","REN","RENT","RENTALS","REPAIR","REPORT","REPUBLICAN","REST","RESTAURANT","REVIEW","REVIEWS","REXROTH","RICH","RICHARDLI","RICOH","RIL","RIO","RIP","RO","ROCHER","ROCKS","RODEO","ROGERS","ROOM","RS","RSVP","RU","RUGBY","RUHR","RUN","RW","RWE","RYUKYU","SA","SAARLAND","SAFE","SAFETY","SAKURA","SALE","SALON","SAMSCLUB","SAMSUNG","SANDVIK","SANDVIKCOROMANT","SANOFI","SAP","SARL","SAS","SAVE","SAXO","SB","SBI","SBS","SC","SCA","SCB","SCHAEFFLER","SCHMIDT","SCHOLARSHIPS","SCHOOL","SCHULE","SCHWARZ","SCIENCE","SCOT","SD","SE","SEARCH","SEAT","SECURE","SECURITY","SEEK","SELECT","SENER","SERVICES","SES","SEVEN","SEW","SEX","SEXY","SFR","SG","SH","SHANGRILA","SHARP","SHAW","SHELL","SHIA","SHIKSHA","SHOES","SHOP","SHOPPING","SHOUJI","SHOW","SHOWTIME","SI","SILK","SINA","SINGLES","SITE","SJ","SK","SKI","SKIN","SKY","SKYPE","SL","SLING","SM","SMART","SMILE","SN","SNCF","SO","SOCCER","SOCIAL","SOFTBANK","SOFTWARE","SOHU","SOLAR","SOLUTIONS","SONG","SONY","SOY","SPA","SPACE","SPORT","SPOT","SR","SRL","SS","ST","STADA","STAPLES","STAR","STATEBANK","STATEFARM","STC","STCGROUP","STOCKHOLM","STORAGE","STORE","STREAM","STUDIO","STUDY","STYLE","SU","SUCKS","SUPPLIES","SUPPLY","SUPPORT","SURF","SURGERY","SUZUKI","SV","SWATCH","SWISS","SX","SY","SYDNEY","SYSTEMS","SZ","TAB","TAIPEI","TALK","TAOBAO","TARGET","TATAMOTORS","TATAR","TATTOO","TAX","TAXI","TC","TCI","TD","TDK","TEAM","TECH","TECHNOLOGY","TEL","TEMASEK","TENNIS","TEVA","TF","TG","TH","THD","THEATER","THEATRE","TIAA","TICKETS","TIENDA","TIFFANY","TIPS","TIRES","TIROL","TJ","TJMAXX","TJX","TK","TKMAXX","TL","TM","TMALL","TN","TO","TODAY","TOKYO","TOOLS","TOP","TORAY","TOSHIBA","TOTAL","TOURS","TOWN","TOYOTA","TOYS","TR","TRADE","TRADING","TRAINING","TRAVEL","TRAVELCHANNEL","TRAVELERS","TRAVELERSINSURANCE","TRUST","TRV","TT","TUBE","TUI","TUNES","TUSHU","TV","TVS","TW","TZ","UA","UBANK","UBS","UG","UK","UNICOM","UNIVERSITY","UNO","UOL","UPS","US","UY","UZ","VA","VACATIONS","VANA","VANGUARD","VC","VE","VEGAS","VENTURES","VERISIGN","VERSICHERUNG","VET","VG","VI","VIAJES","VIDEO","VIG","VIKING","VILLAS","VIN","VIP","VIRGIN","VISA","VISION","VIVA","VIVO","VLAANDEREN","VN","VODKA","VOLKSWAGEN","VOLVO","VOTE","VOTING","VOTO","VOYAGE","VU","VUELOS","WALES","WALMART","WALTER","WANG","WANGGOU","WATCH","WATCHES","WEATHER","WEATHERCHANNEL","WEBCAM","WEBER","WEBSITE","WED","WEDDING","WEIBO","WEIR","WF","WHOSWHO","WIEN","WIKI","WILLIAMHILL","WIN","WINDOWS","WINE","WINNERS","WME","WOLTERSKLUWER","WOODSIDE","WORK","WORKS","WORLD","WOW","WS","WTC","WTF","XBOX","XEROX","XFINITY","XIHUAN","XIN","XN--11B4C3D","XN--1CK2E1B","XN--1QQW23A","XN--2SCRJ9C","XN--30RR7Y","XN--3BST00M","XN--3DS443G","XN--3E0B707E","XN--3HCRJ9C","XN--3PXU8K","XN--42C2D9A","XN--45BR5CYL","XN--45BRJ9C","XN--45Q11C","XN--4DBRK0CE","XN--4GBRIM","XN--54B7FTA0CC","XN--55QW42G","XN--55QX5D","XN--5SU34J936BGSG","XN--5TZM5G","XN--6FRZ82G","XN--6QQ986B3XL","XN--80ADXHKS","XN--80AO21A","XN--80AQECDR1A","XN--80ASEHDB","XN--80ASWG","XN--8Y0A063A","XN--90A3AC","XN--90AE","XN--90AIS","XN--9DBQ2A","XN--9ET52U","XN--9KRT00A","XN--B4W605FERD","XN--BCK1B9A5DRE4C","XN--C1AVG","XN--C2BR7G","XN--CCK2B3B","XN--CCKWCXETD","XN--CG4BKI","XN--CLCHC0EA0B2G2A9GCD","XN--CZR694B","XN--CZRS0T","XN--CZRU2D","XN--D1ACJ3B","XN--D1ALF","XN--E1A4C","XN--ECKVDTC9D","XN--EFVY88H","XN--FCT429K","XN--FHBEI","XN--FIQ228C5HS","XN--FIQ64B","XN--FIQS8S","XN--FIQZ9S","XN--FJQ720A","XN--FLW351E","XN--FPCRJ9C3D","XN--FZC2C9E2C","XN--FZYS8D69UVGM","XN--G2XX48C","XN--GCKR3F0F","XN--GECRJ9C","XN--GK3AT1E","XN--H2BREG3EVE","XN--H2BRJ9C","XN--H2BRJ9C8C","XN--HXT814E","XN--I1B6B1A6A2E","XN--IMR513N","XN--IO0A7I","XN--J1AEF","XN--J1AMH","XN--J6W193G","XN--JLQ480N2RG","XN--JLQ61U9W7B","XN--JVR189M","XN--KCRX77D1X4A","XN--KPRW13D","XN--KPRY57D","XN--KPUT3I","XN--L1ACC","XN--LGBBAT1AD8J","XN--MGB9AWBF","XN--MGBA3A3EJT","XN--MGBA3A4F16A","XN--MGBA7C0BBN0A","XN--MGBAAKC7DVF","XN--MGBAAM7A8H","XN--MGBAB2BD","XN--MGBAH1A3HJKRD","XN--MGBAI9AZGQP6J","XN--MGBAYH7GPA","XN--MGBBH1A","XN--MGBBH1A71E","XN--MGBC0A9AZCG","XN--MGBCA7DZDO","XN--MGBCPQ6GPA1A","XN--MGBERP4A5D4AR","XN--MGBGU82A","XN--MGBI4ECEXP","XN--MGBPL2FH","XN--MGBT3DHD","XN--MGBTX2B","XN--MGBX4CD0AB","XN--MIX891F","XN--MK1BU44C","XN--MXTQ1M","XN--NGBC5AZD","XN--NGBE9E0A","XN--NGBRX","XN--NODE","XN--NQV7F","XN--NQV7FS00EMA","XN--NYQY26A","XN--O3CW4H","XN--OGBPF8FL","XN--OTU796D","XN--P1ACF","XN--P1AI","XN--PGBS0DH","XN--PSSY2U","XN--Q7CE6A","XN--Q9JYB4C","XN--QCKA1PMC","XN--QXA6A","XN--QXAM","XN--RHQV96G","XN--ROVU88B","XN--RVC1E0AM3E","XN--S9BRJ9C","XN--SES554G","XN--T60B56A","XN--TCKWE","XN--TIQ49XQYJ","XN--UNUP4Y","XN--VERMGENSBERATER-CTB","XN--VERMGENSBERATUNG-PWB","XN--VHQUV","XN--VUQ861B","XN--W4R85EL8FHU5DNRA","XN--W4RS40L","XN--WGBH1C","XN--WGBL6A","XN--XHQ521B","XN--XKC2AL3HYE2A","XN--XKC2DL3A5EE0H","XN--Y9A3AQ","XN--YFRO4I67O","XN--YGBI2AMMX","XN--ZFR164B","XXX","XYZ","YACHTS","YAHOO","YAMAXUN","YANDEX","YE","YODOBASHI","YOGA","YOKOHAMA","YOU","YOUTUBE","YT","YUN","ZA","ZAPPOS","ZARA","ZERO","ZIP","ZM","ZONE","ZUERICH","ZW"]};var Ys,zs,qs,Js,Qs,en,tn,rn,sn=new Set(Ws.tlds.map((e=>e.toLowerCase())));function nn(){if(zs)return Ys;zs=1;const e=Nt,t=Ls,r=Ds,s=Us,n=Fs,a=sn,i=Gs,o=ns(),l=dr(),c={tlds:a instanceof Set&&{tlds:{allow:a,deny:null}},base64Regex:{true:{true:/^(?:[\w\-]{2}[\w\-]{2})*(?:[\w\-]{2}==|[\w\-]{3}=)?$/,false:/^(?:[A-Za-z0-9+\/]{2}[A-Za-z0-9+\/]{2})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/},false:{true:/^(?:[\w\-]{2}[\w\-]{2})*(?:[\w\-]{2}(==)?|[\w\-]{3}=?)?$/,false:/^(?:[A-Za-z0-9+\/]{2}[A-Za-z0-9+\/]{2})*(?:[A-Za-z0-9+\/]{2}(==)?|[A-Za-z0-9+\/]{3}=?)?$/}},dataUriRegex:/^data:[\w+.-]+\/[\w+.-]+;((charset=[\w-]+|base64),)?(.*)$/,hexRegex:/^[a-f0-9]+$/i,ipRegex:s.regex({cidr:"forbidden"}).regex,isoDurationRegex:/^P(?!$)(\d+Y)?(\d+M)?(\d+W)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?$/,guidBrackets:{"{":"}","[":"]","(":")","":""},guidVersions:{uuidv1:"1",uuidv2:"2",uuidv3:"3",uuidv4:"4",uuidv5:"5"},guidSeparators:new Set([void 0,!0,!1,"-",":"]),normalizationForms:["NFC","NFD","NFKC","NFKD"]};return Ys=o.extend({type:"string",flags:{insensitive:{default:!1},truncate:{default:!1}},terms:{replacements:{init:null}},coerce:{from:"string",method(e,{schema:t,state:r,prefs:s}){const n=t.$_getRule("normalize");n&&(e=e.normalize(n.args.form));const a=t.$_getRule("case");a&&(e="upper"===a.args.direction?e.toLocaleUpperCase():e.toLocaleLowerCase());const i=t.$_getRule("trim");if(i&&i.args.enabled&&(e=e.trim()),t.$_terms.replacements)for(const r of t.$_terms.replacements)e=e.replace(r.pattern,r.replacement);const o=t.$_getRule("hex");if(o&&o.args.options.byteAligned&&e.length%2!=0&&(e=`0${e}`),t.$_getRule("isoDate")){const t=c.isoDate(e);t&&(e=t)}if(t._flags.truncate){const n=t.$_getRule("max");if(n){let a=n.args.limit;if(l.isResolvable(a)&&(a=a.resolve(e,r,s),!l.limit(a)))return{value:e,errors:t.$_createError("any.ref",a,{ref:n.args.limit,arg:"limit",reason:"must be a positive integer"},r,s)};e=e.slice(0,a)}}return{value:e}}},validate(e,{schema:t,error:r}){if("string"!=typeof e)return{value:e,errors:r("string.base")};if(""===e){const s=t.$_getRule("min");if(s&&0===s.args.limit)return;return{value:e,errors:r("string.empty")}}},rules:{alphanum:{method(){return this.$_addRule("alphanum")},validate:(e,t)=>/^[a-zA-Z0-9]+$/.test(e)?e:t.error("string.alphanum")},base64:{method(t={}){return l.assertOptions(t,["paddingRequired","urlSafe"]),t={urlSafe:!1,paddingRequired:!0,...t},e("boolean"==typeof t.paddingRequired,"paddingRequired must be boolean"),e("boolean"==typeof t.urlSafe,"urlSafe must be boolean"),this.$_addRule({name:"base64",args:{options:t}})},validate:(e,t,{options:r})=>c.base64Regex[r.paddingRequired][r.urlSafe].test(e)?e:t.error("string.base64")},case:{method(t){return e(["lower","upper"].includes(t),"Invalid case:",t),this.$_addRule({name:"case",args:{direction:t}})},validate:(e,t,{direction:r})=>"lower"===r&&e===e.toLocaleLowerCase()||"upper"===r&&e===e.toLocaleUpperCase()?e:t.error(`string.${r}case`),convert:!0},creditCard:{method(){return this.$_addRule("creditCard")},validate(e,t){let r=e.length,s=0,n=1;for(;r--;){const t=e.charAt(r)*n;s+=t-9*(t>9),n^=3}return s>0&&s%10==0?e:t.error("string.creditCard")}},dataUri:{method(t={}){return l.assertOptions(t,["paddingRequired"]),t={paddingRequired:!0,...t},e("boolean"==typeof t.paddingRequired,"paddingRequired must be boolean"),this.$_addRule({name:"dataUri",args:{options:t}})},validate(e,t,{options:r}){const s=e.match(c.dataUriRegex);if(s){if(!s[2])return e;if("base64"!==s[2])return e;if(c.base64Regex[r.paddingRequired].false.test(s[3]))return e}return t.error("string.dataUri")}},domain:{method(e){e&&l.assertOptions(e,["allowFullyQualified","allowUnicode","maxDomainSegments","minDomainSegments","tlds"]);const t=c.addressOptions(e);return this.$_addRule({name:"domain",args:{options:e},address:t})},validate:(e,r,s,{address:n})=>t.isValid(e,n)?e:r.error("string.domain")},email:{method(t={}){l.assertOptions(t,["allowFullyQualified","allowUnicode","ignoreLength","maxDomainSegments","minDomainSegments","multiple","separator","tlds"]),e(void 0===t.multiple||"boolean"==typeof t.multiple,"multiple option must be an boolean");const r=c.addressOptions(t),s=new RegExp(`\\s*[${t.separator?n(t.separator):","}]\\s*`);return this.$_addRule({name:"email",args:{options:t},regex:s,address:r})},validate(e,t,{options:s},{regex:n,address:a}){const i=s.multiple?e.split(n):[e],o=[];for(const e of i)r.isValid(e,a)||o.push(e);return o.length?t.error("string.email",{value:e,invalids:o}):e}},guid:{alias:"uuid",method(t={}){l.assertOptions(t,["version","separator"]);let r="";if(t.version){const s=[].concat(t.version);e(s.length>=1,"version must have at least 1 valid version specified");const n=new Set;for(let t=0;t<s.length;++t){const a=s[t];e("string"==typeof a,"version at position "+t+" must be a string");const i=c.guidVersions[a.toLowerCase()];e(i,"version at position "+t+" must be one of "+Object.keys(c.guidVersions).join(", ")),e(!n.has(i),"version at position "+t+" must not be a duplicate"),r+=i,n.add(i)}}e(c.guidSeparators.has(t.separator),'separator must be one of true, false, "-", or ":"');const s=void 0===t.separator?"[:-]?":!0===t.separator?"[:-]":!1===t.separator?"[]?":`\\${t.separator}`,n=new RegExp(`^([\\[{\\(]?)[0-9A-F]{8}(${s})[0-9A-F]{4}\\2?[${r||"0-9A-F"}][0-9A-F]{3}\\2?[${r?"89AB":"0-9A-F"}][0-9A-F]{3}\\2?[0-9A-F]{12}([\\]}\\)]?)$`,"i");return this.$_addRule({name:"guid",args:{options:t},regex:n})},validate(e,t,r,{regex:s}){const n=s.exec(e);return n?c.guidBrackets[n[1]]!==n[n.length-1]?t.error("string.guid"):e:t.error("string.guid")}},hex:{method(t={}){return l.assertOptions(t,["byteAligned"]),t={byteAligned:!1,...t},e("boolean"==typeof t.byteAligned,"byteAligned must be boolean"),this.$_addRule({name:"hex",args:{options:t}})},validate:(e,t,{options:r})=>c.hexRegex.test(e)?r.byteAligned&&e.length%2!=0?t.error("string.hexAlign"):e:t.error("string.hex")},hostname:{method(){return this.$_addRule("hostname")},validate:(e,r)=>t.isValid(e,{minDomainSegments:1})||c.ipRegex.test(e)?e:r.error("string.hostname")},insensitive:{method(){return this.$_setFlag("insensitive",!0)}},ip:{method(e={}){l.assertOptions(e,["cidr","version"]);const{cidr:t,versions:r,regex:n}=s.regex(e),a=e.version?r:void 0;return this.$_addRule({name:"ip",args:{options:{cidr:t,version:a}},regex:n})},validate:(e,t,{options:r},{regex:s})=>s.test(e)?e:r.version?t.error("string.ipVersion",{value:e,cidr:r.cidr,version:r.version}):t.error("string.ip",{value:e,cidr:r.cidr})},isoDate:{method(){return this.$_addRule("isoDate")},validate:(e,{error:t})=>c.isoDate(e)?e:t("string.isoDate")},isoDuration:{method(){return this.$_addRule("isoDuration")},validate:(e,t)=>c.isoDurationRegex.test(e)?e:t.error("string.isoDuration")},length:{method(e,t){return c.length(this,"length",e,"=",t)},validate(e,t,{limit:r,encoding:s},{name:n,operator:a,args:i}){const o=s?Buffer&&Buffer.byteLength(e,s):e.length;return l.compare(o,r,a)?e:t.error("string."+n,{limit:i.limit,value:e,encoding:s})},args:[{name:"limit",ref:!0,assert:l.limit,message:"must be a positive integer"},"encoding"]},lowercase:{method(){return this.case("lower")}},max:{method(e,t){return c.length(this,"max",e,"<=",t)},args:["limit","encoding"]},min:{method(e,t){return c.length(this,"min",e,">=",t)},args:["limit","encoding"]},normalize:{method(t="NFC"){return e(c.normalizationForms.includes(t),"normalization form must be one of "+c.normalizationForms.join(", ")),this.$_addRule({name:"normalize",args:{form:t}})},validate:(e,{error:t},{form:r})=>e===e.normalize(r)?e:t("string.normalize",{value:e,form:r}),convert:!0},pattern:{alias:"regex",method(t,r={}){e(t instanceof RegExp,"regex must be a RegExp"),e(!t.flags.includes("g")&&!t.flags.includes("y"),"regex should not use global or sticky mode"),"string"==typeof r&&(r={name:r}),l.assertOptions(r,["invert","name"]);const s=["string.pattern",r.invert?".invert":"",r.name?".name":".base"].join("");return this.$_addRule({name:"pattern",args:{regex:t,options:r},errorCode:s})},validate:(e,t,{regex:r,options:s},{errorCode:n})=>r.test(e)^s.invert?e:t.error(n,{name:s.name,regex:r,value:e}),args:["regex","options"],multi:!0},replace:{method(t,r){"string"==typeof t&&(t=new RegExp(n(t),"g")),e(t instanceof RegExp,"pattern must be a RegExp"),e("string"==typeof r,"replacement must be a String");const s=this.clone();return s.$_terms.replacements||(s.$_terms.replacements=[]),s.$_terms.replacements.push({pattern:t,replacement:r}),s}},token:{method(){return this.$_addRule("token")},validate:(e,t)=>/^\w+$/.test(e)?e:t.error("string.token")},trim:{method(t=!0){return e("boolean"==typeof t,"enabled must be a boolean"),this.$_addRule({name:"trim",args:{enabled:t}})},validate:(e,t,{enabled:r})=>r&&e!==e.trim()?t.error("string.trim"):e,convert:!0},truncate:{method(t=!0){return e("boolean"==typeof t,"enabled must be a boolean"),this.$_setFlag("truncate",t)}},uppercase:{method(){return this.case("upper")}},uri:{method(e={}){l.assertOptions(e,["allowRelative","allowQuerySquareBrackets","domain","relativeOnly","scheme"]),e.domain&&l.assertOptions(e.domain,["allowFullyQualified","allowUnicode","maxDomainSegments","minDomainSegments","tlds"]);const{regex:t,scheme:r}=i.regex(e),s=e.domain?c.addressOptions(e.domain):null;return this.$_addRule({name:"uri",args:{options:e},regex:t,domain:s,scheme:r})},validate(e,r,{options:s},{regex:n,domain:a,scheme:i}){if(["http:/","https:/"].includes(e))return r.error("string.uri");const o=n.exec(e);if(o){const n=o[1]||o[2];return!a||s.allowRelative&&!n||t.isValid(n,a)?e:r.error("string.domain",{value:n})}return s.relativeOnly?r.error("string.uriRelativeOnly"):s.scheme?r.error("string.uriCustomScheme",{scheme:i,value:e}):r.error("string.uri")}}},manifest:{build(e,t){if(t.replacements)for(const{pattern:r,replacement:s}of t.replacements)e=e.replace(r,s);return e}},messages:{"string.alphanum":"{{#label}} must only contain alpha-numeric characters","string.base":"{{#label}} must be a string","string.base64":"{{#label}} must be a valid base64 string","string.creditCard":"{{#label}} must be a credit card","string.dataUri":"{{#label}} must be a valid dataUri string","string.domain":"{{#label}} must contain a valid domain name","string.email":"{{#label}} must be a valid email","string.empty":"{{#label}} is not allowed to be empty","string.guid":"{{#label}} must be a valid GUID","string.hex":"{{#label}} must only contain hexadecimal characters","string.hexAlign":"{{#label}} hex decoded representation must be byte aligned","string.hostname":"{{#label}} must be a valid hostname","string.ip":"{{#label}} must be a valid ip address with a {{#cidr}} CIDR","string.ipVersion":"{{#label}} must be a valid ip address of one of the following versions {{#version}} with a {{#cidr}} CIDR","string.isoDate":"{{#label}} must be in iso format","string.isoDuration":"{{#label}} must be a valid ISO 8601 duration","string.length":"{{#label}} length must be {{#limit}} characters long","string.lowercase":"{{#label}} must only contain lowercase characters","string.max":"{{#label}} length must be less than or equal to {{#limit}} characters long","string.min":"{{#label}} length must be at least {{#limit}} characters long","string.normalize":"{{#label}} must be unicode normalized in the {{#form}} form","string.token":"{{#label}} must only contain alpha-numeric and underscore characters","string.pattern.base":"{{#label}} with value {:[.]} fails to match the required pattern: {{#regex}}","string.pattern.name":"{{#label}} with value {:[.]} fails to match the {{#name}} pattern","string.pattern.invert.base":"{{#label}} with value {:[.]} matches the inverted pattern: {{#regex}}","string.pattern.invert.name":"{{#label}} with value {:[.]} matches the inverted {{#name}} pattern","string.trim":"{{#label}} must not have leading or trailing whitespace","string.uri":"{{#label}} must be a valid uri","string.uriCustomScheme":"{{#label}} must be a valid uri with a scheme matching the {{#scheme}} pattern","string.uriRelativeOnly":"{{#label}} must be a valid relative uri","string.uppercase":"{{#label}} must only contain uppercase characters"}}),c.addressOptions=function(t){if(!t)return t;if(e(void 0===t.minDomainSegments||Number.isSafeInteger(t.minDomainSegments)&&t.minDomainSegments>0,"minDomainSegments must be a positive integer"),e(void 0===t.maxDomainSegments||Number.isSafeInteger(t.maxDomainSegments)&&t.maxDomainSegments>0,"maxDomainSegments must be a positive integer"),!1===t.tlds)return t;if(!0===t.tlds||void 0===t.tlds)return e(c.tlds,"Built-in TLD list disabled"),Object.assign({},t,c.tlds);e("object"==typeof t.tlds,"tlds must be true, false, or an object");const r=t.tlds.deny;if(r)return Array.isArray(r)&&(t=Object.assign({},t,{tlds:{deny:new Set(r)}})),e(t.tlds.deny instanceof Set,"tlds.deny must be an array, Set, or boolean"),e(!t.tlds.allow,"Cannot specify both tlds.allow and tlds.deny lists"),c.validateTlds(t.tlds.deny,"tlds.deny"),t;const s=t.tlds.allow;return s?!0===s?(e(c.tlds,"Built-in TLD list disabled"),Object.assign({},t,c.tlds)):(Array.isArray(s)&&(t=Object.assign({},t,{tlds:{allow:new Set(s)}})),e(t.tlds.allow instanceof Set,"tlds.allow must be an array, Set, or boolean"),c.validateTlds(t.tlds.allow,"tlds.allow"),t):t},c.validateTlds=function(r,s){for(const n of r)e(t.isValid(n,{minDomainSegments:1,maxDomainSegments:1}),`${s} must contain valid top level domain names`)},c.isoDate=function(e){if(!l.isIsoDate(e))return null;/.*T.*[+-]\d\d$/.test(e)&&(e+="00");const t=new Date(e);return isNaN(t.getTime())?null:t.toISOString()},c.length=function(t,r,s,n,a){return e(!a||Buffer&&Buffer.isEncoding(a),"Invalid encoding:",a),t.$_addRule({name:r,method:"length",args:{limit:s,encoding:a},operator:n})},Ys}function an(){if(Js)return qs;Js=1;const e=Nt,t=ns(),r={};return r.Map=class extends Map{slice(){return new r.Map(this)}},qs=t.extend({type:"symbol",terms:{map:{init:new r.Map}},coerce:{method(e,{schema:t,error:r}){const s=t.$_terms.map.get(e);return s&&(e=s),t._flags.only&&"symbol"!=typeof e?{value:e,errors:r("symbol.map",{map:t.$_terms.map})}:{value:e}}},validate(e,{error:t}){if("symbol"!=typeof e)return{value:e,errors:t("symbol.base")}},rules:{map:{method(t){t&&!t[Symbol.iterator]&&"object"==typeof t&&(t=Object.entries(t)),e(t&&t[Symbol.iterator],"Iterable must be an iterable or object");const r=this.clone(),s=[];for(const n of t){e(n&&n[Symbol.iterator],"Entry must be an iterable");const[t,a]=n;e("object"!=typeof t&&"function"!=typeof t&&"symbol"!=typeof t,"Key must not be of type object, function, or Symbol"),e("symbol"==typeof a,"Value must be a Symbol"),r.$_terms.map.set(t,a),s.push(a)}return r.valid(...s)}}},manifest:{build:(e,t)=>(t.map&&(e=e.map(t.map)),e)},messages:{"symbol.base":"{{#label}} must be a symbol","symbol.map":"{{#label}} must be one of {{#map}}"}}),qs}function on(){if(rn)return tn;rn=1;const e=Nt,t=Pt,r=fr(),s=dr(),n=mr(),a=tr(),i=vr(),o=Ar(),l=lr(),c=cr(),u=Ir();let d;const f={types:{alternatives:as(),any:ns(),array:is(),boolean:os(),date:ls(),function:Ts(),link:xs(),number:Cs(),object:$s(),string:nn(),symbol:an()},aliases:{alt:"alternatives",bool:"boolean",func:"function"}};return Buffer&&(f.types.binary=function(){if(en)return Qs;en=1;const e=Nt,t=ns(),r=dr();return Qs=t.extend({type:"binary",coerce:{from:"string",method(e,{schema:t}){try{return{value:Buffer.from(e,t._flags.encoding)}}catch(e){}}},validate(e,{error:t}){if(!Buffer.isBuffer(e))return{value:e,errors:t("binary.base")}},rules:{encoding:{method(t){return e(Buffer.isEncoding(t),"Invalid encoding:",t),this.$_setFlag("encoding",t)}},length:{method(e){return this.$_addRule({name:"length",method:"length",args:{limit:e},operator:"="})},validate:(e,t,{limit:s},{name:n,operator:a,args:i})=>r.compare(e.length,s,a)?e:t.error("binary."+n,{limit:i.limit,value:e}),args:[{name:"limit",ref:!0,assert:r.limit,message:"must be a positive integer"}]},max:{method(e){return this.$_addRule({name:"max",method:"length",args:{limit:e},operator:"<="})}},min:{method(e){return this.$_addRule({name:"min",method:"length",args:{limit:e},operator:">="})}}},cast:{string:{from:e=>Buffer.isBuffer(e),to:(e,t)=>e.toString()}},messages:{"binary.base":"{{#label}} must be a buffer or a string","binary.length":"{{#label}} must be {{#limit}} bytes","binary.max":"{{#label}} must be less than or equal to {{#limit}} bytes","binary.min":"{{#label}} must be at least {{#limit}} bytes"}}),Qs}()),f.root=function(){const t={_types:new Set(Object.keys(f.types))};for(const r of t._types)t[r]=function(...t){return e(!t.length||["alternatives","link","object"].includes(r),"The",r,"type does not allow arguments"),f.generate(this,f.types[r],t)};for(const e of["allow","custom","disallow","equal","exist","forbidden","invalid","not","only","optional","options","prefs","preferences","required","strip","valid","when"])t[e]=function(...t){return this.any()[e](...t)};Object.assign(t,f.methods);for(const e in f.aliases){const r=f.aliases[e];t[e]=t[r]}return t.x=t.expression,u.setup&&u.setup(t),t},f.methods={ValidationError:a.ValidationError,version:s.version,cache:r.provider,assert(e,t,...r){f.assert(e,t,!0,r)},attempt:(e,t,...r)=>f.assert(e,t,!1,r),build(t){return e("function"==typeof o.build,"Manifest functionality disabled"),o.build(this,t)},checkPreferences(e){s.checkPreferences(e)},compile(e,t){return n.compile(this,e,t)},defaults(t){e("function"==typeof t,"modifier must be a function");const r=Object.assign({},this);for(const n of r._types){const a=t(r[n]());e(s.isSchema(a),"modifier must return a valid schema object"),r[n]=function(...e){return f.generate(this,a,e)}}return r},expression:(...e)=>new c(...e),extend(...t){s.verifyFlat(t,"extend"),d=d||Ht(),e(t.length,"You need to provide at least one extension"),this.assert(t,d.extensions);const r=Object.assign({},this);r._types=new Set(r._types);for(let s of t){"function"==typeof s&&(s=s(r)),this.assert(s,d.extension);const t=f.expandExtension(s,r);for(const s of t){e(void 0===r[s.type]||r._types.has(s.type),"Cannot override name",s.type);const t=s.base||this.any(),n=i.type(t,s);r._types.add(s.type),r[s.type]=function(...e){return f.generate(this,n,e)}}}return r},isError:a.ValidationError.isError,isExpression:c.isTemplate,isRef:l.isRef,isSchema:s.isSchema,in:(...e)=>l.in(...e),override:s.symbols.override,ref:(...e)=>l.create(...e),types(){const e={};for(const t of this._types)e[t]=this[t]();for(const t in f.aliases)e[t]=this[t]();return e}},f.assert=function(e,r,n,i){const o=i[0]instanceof Error||"string"==typeof i[0]?i[0]:null,l=null!==o?i[1]:i[0],c=r.validate(e,s.preferences({errors:{stack:!0}},l||{}));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 a.ValidationError==!1&&(u=t(u)),u.message=o?`${o} ${d}`:d,u},f.generate=function(t,r,s){return e(t,"Must be invoked on a Joi instance."),r.$_root=t,r._definition.args&&s.length?r._definition.args(r,...s):r},f.expandExtension=function(e,t){if("string"==typeof e.type)return[e];const r=[];for(const s of t._types)if(e.type.test(s)){const n=Object.assign({},e);n.type=s,n.base=t[s](),r.push(n)}return r},tn=f.root()}var ln=Et(on());ln.extend({type:"string",base:ln.string(),messages:{"string.contains":"{{#label}} must contain [{{#substring}}]","string.ncontains":"{{#label}} can't contain [{{#substring}}]"},rules:{contains:{args:[{name:"substring",ref:!0,assert:e=>"string"==typeof e,message:"must be a string"}],method(e){return this.$_addRule({name:"contains",args:{substring:e}})},validate:(e,t,{substring:r})=>!1===e.includes(r)?t.error("string.contains",{substring:r}):e},ncontains:{args:[{name:"substring",ref:!0,assert:e=>"string"==typeof e,message:"must be a string"}],method(e){return this.$_addRule({name:"ncontains",args:{substring:e}})},validate:(e,t,{substring:r})=>!0===e.includes(r)?t.error("string.ncontains",{substring:r}):e}}});const{findWorkspaceDir:cn}=require("@pnpm/find-workspace-dir"),un=require("js-yaml"),dn=require("path"),fn=require("fs"),hn=()=>process.cwd();let pn;async function mn(e,t){if(pn)return JSON.parse(pn);const{SpecificationService:r}=e,s=new r({accountability:{admin:!0},schema:t});return pn=JSON.stringify(await s.oas.generate()),JSON.parse(pn)}function gn(e,t){return Object.entries(t).reduce(((e,[t,r])=>(e[t]=r&&"object"==typeof r?gn(e[t]=e[t]||(Array.isArray(r)?[]:{}),r):r,e)),e)}const yn=require("swagger-ui-express"),vn=require("express-openapi-validator"),_n=function(){const e=function(){const e={docsPath:"api-docs",info:{},tags:[],publishedTags:[],paths:{},components:{}};try{const t=dn.join(hn(),"./extensions/endpoints/oasconfig.yaml"),r=un.load(fn.readFileSync(t,{encoding:"utf-8"}));return r.docsPath=r.docsPath||e.docsPath,r.info=r.info||e.info,r.tags=r.tags||e.tags,r.paths=r.paths||e.paths,r.components=r.components||e.components,r}catch{return e}}();try{const t=dn.join(hn(),"./extensions/endpoints"),r=fn.readdirSync(t,{withFileTypes:!0});for(const s of r){const r=`${t}/${s.name}/oas.yaml`;if(s.isDirectory()&&fn.existsSync(r)){const t=un.load(fn.readFileSync(r,{encoding:"utf-8"}));e.tags=[...e.tags,...t.tags||[]],e.paths={...e.paths,...t.paths||{}},e.components=gn(e.components||{},t.components||{})}}return e}catch(t){return e}}(),bn=_n.docsPath;var An={id:bn,validate:async function(e,t,r,s){if(null==_n?void 0:_n.paths){const n=await mn(t,r);if(s)for(const e of s)n.paths[e]=_n.paths[e];else n.paths=_n.paths;_n.components?n.components=_n.components:(delete n.components.definitions,delete n.components.schemas),e.use(vn.middleware({apiSpec:n})),e.use(((e,t,r,s)=>{r.status(e.status||500).json({message:e.message,errors:e.errors})}))}return e},handler:(e,{services:t,exceptions:r,logger:s,getSchema:n})=>{const{ServiceUnavailableException:a}=r,i={swaggerOptions:{url:`/${bn}/oas`}};e.use("/",yn.serve),e.get("/",yn.setup({},i)),e.get("/oas",(async(e,r,i)=>{var o;try{const e=await n(),a=await mn(t,e),i=await async function(){try{const e=await cn(".");return require(`${e||hn()}/package.json`)}catch(e){return{}}}();a.info.title=_n.info.title||(null==i?void 0:i.name)||a.info.title,a.info.version=_n.info.version||(null==i?void 0:i.version)||a.info.version,a.info.description=_n.info.description||(null==i?void 0:i.description)||a.info.description;try{for(const e in _n.paths)a.paths[e]=_n.paths[e];for(const e of _n.tags)a.tags.push(e);a.components=gn(_n.components,a.components)}catch(e){s.info("No custom definitions")}(null==(o=_n.publishedTags)?void 0:o.length)&&function(e,t){for(const r in t.paths)for(const s in t.paths[r]){let n=!1;t.paths[r][s].tags.forEach((t=>{n=n||e.publishedTags.includes(t)})),t.paths[r][s].tags&&(t.paths[r][s].tags=t.paths[r][s].tags.filter((t=>e.publishedTags.includes(t)))),n||delete t.paths[r][s]}t.tags=t.tags.filter((t=>e.publishedTags.includes(t.name)))}(_n,a),r.json(a)}catch(e){return i(new a(e.message||e[0].message))}}))}};module.exports=An;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "directus-extension-api-docs",
3
- "version": "1.6.5",
3
+ "version": "1.6.6",
4
4
  "description": "directus extension for swagger interface and custom endpoints definitions",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -36,17 +36,17 @@
36
36
  "@pnpm/find-workspace-dir": "^5.0.1",
37
37
  "express-openapi-validator": "^4.13.8",
38
38
  "js-yaml": "^4.1.0",
39
- "swagger-ui-express": "^4.6.2"
39
+ "swagger-ui-express": "^4.6.3"
40
40
  },
41
41
  "devDependencies": {
42
- "@directus/extensions-sdk": "^9.24.0",
42
+ "@directus/extensions-sdk": "^9.26.0",
43
43
  "@directus/shared": "^9.24.0",
44
44
  "@types/express": "^4.17.17",
45
- "@types/jest": "^29.5.0",
46
- "@types/node": "^18.15.11",
47
- "@typescript-eslint/eslint-plugin": "^5.57.1",
48
- "@typescript-eslint/parser": "^5.57.1",
49
- "eslint": "^8.37.0",
45
+ "@types/jest": "^29.5.1",
46
+ "@types/node": "^18.16.6",
47
+ "@typescript-eslint/eslint-plugin": "^5.59.5",
48
+ "@typescript-eslint/parser": "^5.59.5",
49
+ "eslint": "^8.40.0",
50
50
  "eslint-config-prettier": "^8.8.0",
51
51
  "eslint-plugin-import": "^2.27.5",
52
52
  "eslint-plugin-prettier": "^4.2.1",
@@ -54,8 +54,8 @@
54
54
  "jest": "^29.5.0",
55
55
  "jest-extended": "^3.2.4",
56
56
  "openapi-schema-validator": "^12.1.0",
57
- "pino": "^8.11.0",
58
- "prettier": "^2.8.7",
57
+ "pino": "^8.14.1",
58
+ "prettier": "^2.8.8",
59
59
  "ts-jest": "^29.1.0",
60
60
  "ts-node": "^10.9.1",
61
61
  "typescript": "^4.9.5"