@likec4/mcp 1.33.0 → 1.34.1

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.
Binary file
package/README.md CHANGED
@@ -20,3 +20,28 @@
20
20
  }
21
21
  }
22
22
  ```
23
+
24
+ ## Getting help
25
+
26
+ We are always happy to help you get started:
27
+
28
+ - [Join Discord community](https://discord.gg/86ZSpjKAdA) – it is the easiest way to get help
29
+ - [GitHub Discussions](https://github.com/likec4/likec4/discussions) – ask anything about the project or give feedback
30
+
31
+ ## Contributors
32
+
33
+ <a href="https://github.com/likec4/likec4/graphs/contributors">
34
+ <img src="https://contrib.rocks/image?repo=likec4/likec4" />
35
+ </a>
36
+
37
+ [Become a contributor](../../CONTRIBUTING.md)
38
+
39
+ ## Support development
40
+
41
+ LikeC4 is a MIT-licensed open source project with its ongoing development made possible entirely by your support.\
42
+ If you like the project, please consider contributing financially to help grow and improve it.\
43
+ You can support us via [OpenCollective](https://opencollective.com/likec4) or [GitHub Sponsors](https://github.com/sponsors/likec4).
44
+
45
+ ## License
46
+
47
+ This project is released under the [MIT License](LICENSE)
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
1
  #!/usr/bin/env node
2
- import bt from"node:process";import{LikeC4 as $n}from"likec4";import{resolve as On}from"node:path";function kn(n){return typeof n=="function"}function xt(n){if(n.__esModule)return n;var e=n.default;if(typeof e=="function"){var a=function t(){return this instanceof t?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};a.prototype=e.prototype}else a={};return Object.defineProperty(a,"__esModule",{value:!0}),Object.keys(n).forEach(function(t){var r=Object.getOwnPropertyDescriptor(n,t);Object.defineProperty(a,t,r.get?r:{enumerable:!0,get:function(){return n[t]}})}),a}function In(n,e){if(!n)throw new Error("Invariant failed")}function Dn(n,e){const a=e??n;In(kn(a));function*t(r){for(const s of r)a(s)&&(yield s)}return e?t(n):t}var me;(function(n){n.assertEqual=r=>{};function e(r){}n.assertIs=e;function a(r){throw new Error}n.assertNever=a,n.arrayToEnum=r=>{const s={};for(const o of r)s[o]=o;return s},n.getValidEnumValues=r=>{const s=n.objectKeys(r).filter(i=>typeof r[r[i]]!="number"),o={};for(const i of s)o[i]=r[i];return n.objectValues(o)},n.objectValues=r=>n.objectKeys(r).map(function(s){return r[s]}),n.objectKeys=typeof Object.keys=="function"?r=>Object.keys(r):r=>{const s=[];for(const o in r)Object.prototype.hasOwnProperty.call(r,o)&&s.push(o);return s},n.find=(r,s)=>{for(const o of r)if(s(o))return o},n.isInteger=typeof Number.isInteger=="function"?r=>Number.isInteger(r):r=>typeof r=="number"&&Number.isFinite(r)&&Math.floor(r)===r;function t(r,s=" | "){return r.map(o=>typeof o=="string"?`'${o}'`:o).join(s)}n.joinValues=t,n.jsonStringifyReplacer=(r,s)=>typeof s=="bigint"?s.toString():s})(me||(me={}));var wt;(function(n){n.mergeShapes=(e,a)=>({...e,...a})})(wt||(wt={}));const Q=me.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),ur=n=>{switch(typeof n){case"undefined":return Q.undefined;case"string":return Q.string;case"number":return Number.isNaN(n)?Q.nan:Q.number;case"boolean":return Q.boolean;case"function":return Q.function;case"bigint":return Q.bigint;case"symbol":return Q.symbol;case"object":return Array.isArray(n)?Q.array:n===null?Q.null:n.then&&typeof n.then=="function"&&n.catch&&typeof n.catch=="function"?Q.promise:typeof Map<"u"&&n instanceof Map?Q.map:typeof Set<"u"&&n instanceof Set?Q.set:typeof Date<"u"&&n instanceof Date?Q.date:Q.object;default:return Q.unknown}},M=me.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 ir extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=t=>{this.issues=[...this.issues,t]},this.addIssues=(t=[])=>{this.issues=[...this.issues,...t]};const a=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,a):this.__proto__=a,this.name="ZodError",this.issues=e}format(e){const a=e||function(s){return s.message},t={_errors:[]},r=s=>{for(const o of s.issues)if(o.code==="invalid_union")o.unionErrors.map(r);else if(o.code==="invalid_return_type")r(o.returnTypeError);else if(o.code==="invalid_arguments")r(o.argumentsError);else if(o.path.length===0)t._errors.push(a(o));else{let i=t,d=0;for(;d<o.path.length;){const f=o.path[d];d===o.path.length-1?(i[f]=i[f]||{_errors:[]},i[f]._errors.push(a(o))):i[f]=i[f]||{_errors:[]},i=i[f],d++}}};return r(this),t}static assert(e){if(!(e instanceof ir))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,me.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=a=>a.message){const a={},t=[];for(const r of this.issues)r.path.length>0?(a[r.path[0]]=a[r.path[0]]||[],a[r.path[0]].push(e(r))):t.push(e(r));return{formErrors:t,fieldErrors:a}}get formErrors(){return this.flatten()}}ir.create=n=>new ir(n);const ta=(n,e)=>{let a;switch(n.code){case M.invalid_type:n.received===Q.undefined?a="Required":a=`Expected ${n.expected}, received ${n.received}`;break;case M.invalid_literal:a=`Invalid literal value, expected ${JSON.stringify(n.expected,me.jsonStringifyReplacer)}`;break;case M.unrecognized_keys:a=`Unrecognized key(s) in object: ${me.joinValues(n.keys,", ")}`;break;case M.invalid_union:a="Invalid input";break;case M.invalid_union_discriminator:a=`Invalid discriminator value. Expected ${me.joinValues(n.options)}`;break;case M.invalid_enum_value:a=`Invalid enum value. Expected ${me.joinValues(n.options)}, received '${n.received}'`;break;case M.invalid_arguments:a="Invalid function arguments";break;case M.invalid_return_type:a="Invalid function return type";break;case M.invalid_date:a="Invalid date";break;case M.invalid_string:typeof n.validation=="object"?"includes"in n.validation?(a=`Invalid input: must include "${n.validation.includes}"`,typeof n.validation.position=="number"&&(a=`${a} at one or more positions greater than or equal to ${n.validation.position}`)):"startsWith"in n.validation?a=`Invalid input: must start with "${n.validation.startsWith}"`:"endsWith"in n.validation?a=`Invalid input: must end with "${n.validation.endsWith}"`:me.assertNever(n.validation):n.validation!=="regex"?a=`Invalid ${n.validation}`:a="Invalid";break;case M.too_small:n.type==="array"?a=`Array must contain ${n.exact?"exactly":n.inclusive?"at least":"more than"} ${n.minimum} element(s)`:n.type==="string"?a=`String must contain ${n.exact?"exactly":n.inclusive?"at least":"over"} ${n.minimum} character(s)`:n.type==="number"?a=`Number must be ${n.exact?"exactly equal to ":n.inclusive?"greater than or equal to ":"greater than "}${n.minimum}`:n.type==="date"?a=`Date must be ${n.exact?"exactly equal to ":n.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(n.minimum))}`:a="Invalid input";break;case M.too_big:n.type==="array"?a=`Array must contain ${n.exact?"exactly":n.inclusive?"at most":"less than"} ${n.maximum} element(s)`:n.type==="string"?a=`String must contain ${n.exact?"exactly":n.inclusive?"at most":"under"} ${n.maximum} character(s)`:n.type==="number"?a=`Number must be ${n.exact?"exactly":n.inclusive?"less than or equal to":"less than"} ${n.maximum}`:n.type==="bigint"?a=`BigInt must be ${n.exact?"exactly":n.inclusive?"less than or equal to":"less than"} ${n.maximum}`:n.type==="date"?a=`Date must be ${n.exact?"exactly":n.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(n.maximum))}`:a="Invalid input";break;case M.custom:a="Invalid input";break;case M.invalid_intersection_types:a="Intersection results could not be merged";break;case M.not_multiple_of:a=`Number must be a multiple of ${n.multipleOf}`;break;case M.not_finite:a="Number must be finite";break;default:a=e.defaultError,me.assertNever(n)}return{message:a}};let An=ta;function Cn(){return An}const Tn=n=>{const{data:e,path:a,errorMaps:t,issueData:r}=n,s=[...a,...r.path||[]],o={...r,path:s};if(r.message!==void 0)return{...r,path:s,message:r.message};let i="";const d=t.filter(f=>!!f).slice().reverse();for(const f of d)i=f(o,{data:e,defaultError:i}).message;return{...r,path:s,message:i}};function U(n,e){const a=Cn(),t=Tn({issueData:e,data:n.data,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,a,a===ta?void 0:ta].filter(r=>!!r)});n.common.issues.push(t)}class Le{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,a){const t=[];for(const r of a){if(r.status==="aborted")return X;r.status==="dirty"&&e.dirty(),t.push(r.value)}return{status:e.value,value:t}}static async mergeObjectAsync(e,a){const t=[];for(const r of a){const s=await r.key,o=await r.value;t.push({key:s,value:o})}return Le.mergeObjectSync(e,t)}static mergeObjectSync(e,a){const t={};for(const r of a){const{key:s,value:o}=r;if(s.status==="aborted"||o.status==="aborted")return X;s.status==="dirty"&&e.dirty(),o.status==="dirty"&&e.dirty(),s.value!=="__proto__"&&(typeof o.value<"u"||r.alwaysSet)&&(t[s.value]=o.value)}return{status:e.value,value:t}}}const X=Object.freeze({status:"aborted"}),Or=n=>({status:"dirty",value:n}),Ze=n=>({status:"valid",value:n}),Rt=n=>n.status==="aborted",$t=n=>n.status==="dirty",Pr=n=>n.status==="valid",Mr=n=>typeof Promise<"u"&&n instanceof Promise;var H;(function(n){n.errToObj=e=>typeof e=="string"?{message:e}:e||{},n.toString=e=>typeof e=="string"?e:e?.message})(H||(H={}));class Xe{constructor(e,a,t,r){this._cachedPath=[],this.parent=e,this.data=a,this._path=t,this._key=r}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const Ot=(n,e)=>{if(Pr(e))return{success:!0,data:e.value};if(!n.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const a=new ir(n.common.issues);return this._error=a,this._error}}};function oe(n){if(!n)return{};const{errorMap:e,invalid_type_error:a,required_error:t,description:r}=n;if(e&&(a||t))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:r}:{errorMap:(o,i)=>{const{message:d}=n;return o.code==="invalid_enum_value"?{message:d??i.defaultError}:typeof i.data>"u"?{message:d??t??i.defaultError}:o.code!=="invalid_type"?{message:i.defaultError}:{message:d??a??i.defaultError}},description:r}}class ce{get description(){return this._def.description}_getType(e){return ur(e.data)}_getOrReturnCtx(e,a){return a||{common:e.parent.common,data:e.data,parsedType:ur(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Le,ctx:{common:e.parent.common,data:e.data,parsedType:ur(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const a=this._parse(e);if(Mr(a))throw new Error("Synchronous parse encountered promise.");return a}_parseAsync(e){const a=this._parse(e);return Promise.resolve(a)}parse(e,a){const t=this.safeParse(e,a);if(t.success)return t.data;throw t.error}safeParse(e,a){const t={common:{issues:[],async:a?.async??!1,contextualErrorMap:a?.errorMap},path:a?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ur(e)},r=this._parseSync({data:e,path:t.path,parent:t});return Ot(t,r)}"~validate"(e){const a={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ur(e)};if(!this["~standard"].async)try{const t=this._parseSync({data:e,path:[],parent:a});return Pr(t)?{value:t.value}:{issues:a.common.issues}}catch(t){t?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),a.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:a}).then(t=>Pr(t)?{value:t.value}:{issues:a.common.issues})}async parseAsync(e,a){const t=await this.safeParseAsync(e,a);if(t.success)return t.data;throw t.error}async safeParseAsync(e,a){const t={common:{issues:[],contextualErrorMap:a?.errorMap,async:!0},path:a?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ur(e)},r=this._parse({data:e,path:t.path,parent:t}),s=await(Mr(r)?r:Promise.resolve(r));return Ot(t,s)}refine(e,a){const t=r=>typeof a=="string"||typeof a>"u"?{message:a}:typeof a=="function"?a(r):a;return this._refinement((r,s)=>{const o=e(r),i=()=>s.addIssue({code:M.custom,...t(r)});return typeof Promise<"u"&&o instanceof Promise?o.then(d=>d?!0:(i(),!1)):o?!0:(i(),!1)})}refinement(e,a){return this._refinement((t,r)=>e(t)?!0:(r.addIssue(typeof a=="function"?a(t,r):a),!1))}_refinement(e){return new mr({schema:this,typeName:Y.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}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.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:a=>this["~validate"](a)}}optional(){return sr.create(this,this._def)}nullable(){return pr.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return er.create(this)}promise(){return Zr.create(this,this._def)}or(e){return zr.create([this,e],this._def)}and(e){return Vr.create(this,e,this._def)}transform(e){return new mr({...oe(this._def),schema:this,typeName:Y.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const a=typeof e=="function"?e:()=>e;return new Qr({...oe(this._def),innerType:this,defaultValue:a,typeName:Y.ZodDefault})}brand(){return new Ft({typeName:Y.ZodBranded,type:this,...oe(this._def)})}catch(e){const a=typeof e=="function"?e:()=>e;return new Br({...oe(this._def),innerType:this,catchValue:a,typeName:Y.ZodCatch})}describe(e){const a=this.constructor;return new a({...this._def,description:e})}pipe(e){return ct.create(this,e)}readonly(){return Hr.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const jn=/^c[^\s-]{8,}$/i,Nn=/^[0-9a-z]+$/,Fn=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Ln=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,qn=/^[a-z0-9_-]{21}$/i,Mn=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,zn=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Vn=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Un="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let sa;const Zn=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Qn=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,Bn=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,Hn=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Kn=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Jn=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,kt="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",Wn=new RegExp(`^${kt}$`);function It(n){let e="[0-5]\\d";n.precision?e=`${e}\\.\\d{${n.precision}}`:n.precision==null&&(e=`${e}(\\.\\d+)?`);const a=n.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${a}`}function Gn(n){return new RegExp(`^${It(n)}$`)}function Xn(n){let e=`${kt}T${It(n)}`;const a=[];return a.push(n.local?"Z?":"Z"),n.offset&&a.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${a.join("|")})`,new RegExp(`^${e}$`)}function Yn(n,e){return!!((e==="v4"||!e)&&Zn.test(n)||(e==="v6"||!e)&&Bn.test(n))}function ei(n,e){if(!Mn.test(n))return!1;try{const[a]=n.split("."),t=a.replace(/-/g,"+").replace(/_/g,"/").padEnd(a.length+(4-a.length%4)%4,"="),r=JSON.parse(atob(t));return!(typeof r!="object"||r===null||"typ"in r&&r?.typ!=="JWT"||!r.alg||e&&r.alg!==e)}catch{return!1}}function ri(n,e){return!!((e==="v4"||!e)&&Qn.test(n)||(e==="v6"||!e)&&Hn.test(n))}class or extends ce{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==Q.string){const s=this._getOrReturnCtx(e);return U(s,{code:M.invalid_type,expected:Q.string,received:s.parsedType}),X}const t=new Le;let r;for(const s of this._def.checks)if(s.kind==="min")e.data.length<s.value&&(r=this._getOrReturnCtx(e,r),U(r,{code:M.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),t.dirty());else if(s.kind==="max")e.data.length>s.value&&(r=this._getOrReturnCtx(e,r),U(r,{code:M.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),t.dirty());else if(s.kind==="length"){const o=e.data.length>s.value,i=e.data.length<s.value;(o||i)&&(r=this._getOrReturnCtx(e,r),o?U(r,{code:M.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):i&&U(r,{code:M.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),t.dirty())}else if(s.kind==="email")Vn.test(e.data)||(r=this._getOrReturnCtx(e,r),U(r,{validation:"email",code:M.invalid_string,message:s.message}),t.dirty());else if(s.kind==="emoji")sa||(sa=new RegExp(Un,"u")),sa.test(e.data)||(r=this._getOrReturnCtx(e,r),U(r,{validation:"emoji",code:M.invalid_string,message:s.message}),t.dirty());else if(s.kind==="uuid")Ln.test(e.data)||(r=this._getOrReturnCtx(e,r),U(r,{validation:"uuid",code:M.invalid_string,message:s.message}),t.dirty());else if(s.kind==="nanoid")qn.test(e.data)||(r=this._getOrReturnCtx(e,r),U(r,{validation:"nanoid",code:M.invalid_string,message:s.message}),t.dirty());else if(s.kind==="cuid")jn.test(e.data)||(r=this._getOrReturnCtx(e,r),U(r,{validation:"cuid",code:M.invalid_string,message:s.message}),t.dirty());else if(s.kind==="cuid2")Nn.test(e.data)||(r=this._getOrReturnCtx(e,r),U(r,{validation:"cuid2",code:M.invalid_string,message:s.message}),t.dirty());else if(s.kind==="ulid")Fn.test(e.data)||(r=this._getOrReturnCtx(e,r),U(r,{validation:"ulid",code:M.invalid_string,message:s.message}),t.dirty());else if(s.kind==="url")try{new URL(e.data)}catch{r=this._getOrReturnCtx(e,r),U(r,{validation:"url",code:M.invalid_string,message:s.message}),t.dirty()}else s.kind==="regex"?(s.regex.lastIndex=0,s.regex.test(e.data)||(r=this._getOrReturnCtx(e,r),U(r,{validation:"regex",code:M.invalid_string,message:s.message}),t.dirty())):s.kind==="trim"?e.data=e.data.trim():s.kind==="includes"?e.data.includes(s.value,s.position)||(r=this._getOrReturnCtx(e,r),U(r,{code:M.invalid_string,validation:{includes:s.value,position:s.position},message:s.message}),t.dirty()):s.kind==="toLowerCase"?e.data=e.data.toLowerCase():s.kind==="toUpperCase"?e.data=e.data.toUpperCase():s.kind==="startsWith"?e.data.startsWith(s.value)||(r=this._getOrReturnCtx(e,r),U(r,{code:M.invalid_string,validation:{startsWith:s.value},message:s.message}),t.dirty()):s.kind==="endsWith"?e.data.endsWith(s.value)||(r=this._getOrReturnCtx(e,r),U(r,{code:M.invalid_string,validation:{endsWith:s.value},message:s.message}),t.dirty()):s.kind==="datetime"?Xn(s).test(e.data)||(r=this._getOrReturnCtx(e,r),U(r,{code:M.invalid_string,validation:"datetime",message:s.message}),t.dirty()):s.kind==="date"?Wn.test(e.data)||(r=this._getOrReturnCtx(e,r),U(r,{code:M.invalid_string,validation:"date",message:s.message}),t.dirty()):s.kind==="time"?Gn(s).test(e.data)||(r=this._getOrReturnCtx(e,r),U(r,{code:M.invalid_string,validation:"time",message:s.message}),t.dirty()):s.kind==="duration"?zn.test(e.data)||(r=this._getOrReturnCtx(e,r),U(r,{validation:"duration",code:M.invalid_string,message:s.message}),t.dirty()):s.kind==="ip"?Yn(e.data,s.version)||(r=this._getOrReturnCtx(e,r),U(r,{validation:"ip",code:M.invalid_string,message:s.message}),t.dirty()):s.kind==="jwt"?ei(e.data,s.alg)||(r=this._getOrReturnCtx(e,r),U(r,{validation:"jwt",code:M.invalid_string,message:s.message}),t.dirty()):s.kind==="cidr"?ri(e.data,s.version)||(r=this._getOrReturnCtx(e,r),U(r,{validation:"cidr",code:M.invalid_string,message:s.message}),t.dirty()):s.kind==="base64"?Kn.test(e.data)||(r=this._getOrReturnCtx(e,r),U(r,{validation:"base64",code:M.invalid_string,message:s.message}),t.dirty()):s.kind==="base64url"?Jn.test(e.data)||(r=this._getOrReturnCtx(e,r),U(r,{validation:"base64url",code:M.invalid_string,message:s.message}),t.dirty()):me.assertNever(s);return{status:t.value,value:e.data}}_regex(e,a,t){return this.refinement(r=>e.test(r),{validation:a,code:M.invalid_string,...H.errToObj(t)})}_addCheck(e){return new or({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...H.errToObj(e)})}url(e){return this._addCheck({kind:"url",...H.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...H.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...H.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...H.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...H.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...H.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...H.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...H.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...H.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...H.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...H.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...H.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...H.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...H.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...H.errToObj(e)})}regex(e,a){return this._addCheck({kind:"regex",regex:e,...H.errToObj(a)})}includes(e,a){return this._addCheck({kind:"includes",value:e,position:a?.position,...H.errToObj(a?.message)})}startsWith(e,a){return this._addCheck({kind:"startsWith",value:e,...H.errToObj(a)})}endsWith(e,a){return this._addCheck({kind:"endsWith",value:e,...H.errToObj(a)})}min(e,a){return this._addCheck({kind:"min",value:e,...H.errToObj(a)})}max(e,a){return this._addCheck({kind:"max",value:e,...H.errToObj(a)})}length(e,a){return this._addCheck({kind:"length",value:e,...H.errToObj(a)})}nonempty(e){return this.min(1,H.errToObj(e))}trim(){return new or({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new or({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new or({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(const a of this._def.checks)a.kind==="min"&&(e===null||a.value>e)&&(e=a.value);return e}get maxLength(){let e=null;for(const a of this._def.checks)a.kind==="max"&&(e===null||a.value<e)&&(e=a.value);return e}}or.create=n=>new or({checks:[],typeName:Y.ZodString,coerce:n?.coerce??!1,...oe(n)});function ai(n,e){const a=(n.toString().split(".")[1]||"").length,t=(e.toString().split(".")[1]||"").length,r=a>t?a:t,s=Number.parseInt(n.toFixed(r).replace(".","")),o=Number.parseInt(e.toFixed(r).replace(".",""));return s%o/10**r}class br extends ce{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==Q.number){const s=this._getOrReturnCtx(e);return U(s,{code:M.invalid_type,expected:Q.number,received:s.parsedType}),X}let t;const r=new Le;for(const s of this._def.checks)s.kind==="int"?me.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),U(t,{code:M.invalid_type,expected:"integer",received:"float",message:s.message}),r.dirty()):s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(t=this._getOrReturnCtx(e,t),U(t,{code:M.too_small,minimum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),r.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(t=this._getOrReturnCtx(e,t),U(t,{code:M.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),r.dirty()):s.kind==="multipleOf"?ai(e.data,s.value)!==0&&(t=this._getOrReturnCtx(e,t),U(t,{code:M.not_multiple_of,multipleOf:s.value,message:s.message}),r.dirty()):s.kind==="finite"?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),U(t,{code:M.not_finite,message:s.message}),r.dirty()):me.assertNever(s);return{status:r.value,value:e.data}}gte(e,a){return this.setLimit("min",e,!0,H.toString(a))}gt(e,a){return this.setLimit("min",e,!1,H.toString(a))}lte(e,a){return this.setLimit("max",e,!0,H.toString(a))}lt(e,a){return this.setLimit("max",e,!1,H.toString(a))}setLimit(e,a,t,r){return new br({...this._def,checks:[...this._def.checks,{kind:e,value:a,inclusive:t,message:H.toString(r)}]})}_addCheck(e){return new br({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:H.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:H.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:H.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:H.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:H.toString(e)})}multipleOf(e,a){return this._addCheck({kind:"multipleOf",value:e,message:H.toString(a)})}finite(e){return this._addCheck({kind:"finite",message:H.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:H.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:H.toString(e)})}get minValue(){let e=null;for(const a of this._def.checks)a.kind==="min"&&(e===null||a.value>e)&&(e=a.value);return e}get maxValue(){let e=null;for(const a of this._def.checks)a.kind==="max"&&(e===null||a.value<e)&&(e=a.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&me.isInteger(e.value))}get isFinite(){let e=null,a=null;for(const t of this._def.checks){if(t.kind==="finite"||t.kind==="int"||t.kind==="multipleOf")return!0;t.kind==="min"?(a===null||t.value>a)&&(a=t.value):t.kind==="max"&&(e===null||t.value<e)&&(e=t.value)}return Number.isFinite(a)&&Number.isFinite(e)}}br.create=n=>new br({checks:[],typeName:Y.ZodNumber,coerce:n?.coerce||!1,...oe(n)});class Tr extends ce{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==Q.bigint)return this._getInvalidInput(e);let t;const r=new Le;for(const s of this._def.checks)s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(t=this._getOrReturnCtx(e,t),U(t,{code:M.too_small,type:"bigint",minimum:s.value,inclusive:s.inclusive,message:s.message}),r.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(t=this._getOrReturnCtx(e,t),U(t,{code:M.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),r.dirty()):s.kind==="multipleOf"?e.data%s.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),U(t,{code:M.not_multiple_of,multipleOf:s.value,message:s.message}),r.dirty()):me.assertNever(s);return{status:r.value,value:e.data}}_getInvalidInput(e){const a=this._getOrReturnCtx(e);return U(a,{code:M.invalid_type,expected:Q.bigint,received:a.parsedType}),X}gte(e,a){return this.setLimit("min",e,!0,H.toString(a))}gt(e,a){return this.setLimit("min",e,!1,H.toString(a))}lte(e,a){return this.setLimit("max",e,!0,H.toString(a))}lt(e,a){return this.setLimit("max",e,!1,H.toString(a))}setLimit(e,a,t,r){return new Tr({...this._def,checks:[...this._def.checks,{kind:e,value:a,inclusive:t,message:H.toString(r)}]})}_addCheck(e){return new Tr({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:H.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:H.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:H.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:H.toString(e)})}multipleOf(e,a){return this._addCheck({kind:"multipleOf",value:e,message:H.toString(a)})}get minValue(){let e=null;for(const a of this._def.checks)a.kind==="min"&&(e===null||a.value>e)&&(e=a.value);return e}get maxValue(){let e=null;for(const a of this._def.checks)a.kind==="max"&&(e===null||a.value<e)&&(e=a.value);return e}}Tr.create=n=>new Tr({checks:[],typeName:Y.ZodBigInt,coerce:n?.coerce??!1,...oe(n)});class na extends ce{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==Q.boolean){const t=this._getOrReturnCtx(e);return U(t,{code:M.invalid_type,expected:Q.boolean,received:t.parsedType}),X}return Ze(e.data)}}na.create=n=>new na({typeName:Y.ZodBoolean,coerce:n?.coerce||!1,...oe(n)});class Xr extends ce{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==Q.date){const s=this._getOrReturnCtx(e);return U(s,{code:M.invalid_type,expected:Q.date,received:s.parsedType}),X}if(Number.isNaN(e.data.getTime())){const s=this._getOrReturnCtx(e);return U(s,{code:M.invalid_date}),X}const t=new Le;let r;for(const s of this._def.checks)s.kind==="min"?e.data.getTime()<s.value&&(r=this._getOrReturnCtx(e,r),U(r,{code:M.too_small,message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),t.dirty()):s.kind==="max"?e.data.getTime()>s.value&&(r=this._getOrReturnCtx(e,r),U(r,{code:M.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),t.dirty()):me.assertNever(s);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Xr({...this._def,checks:[...this._def.checks,e]})}min(e,a){return this._addCheck({kind:"min",value:e.getTime(),message:H.toString(a)})}max(e,a){return this._addCheck({kind:"max",value:e.getTime(),message:H.toString(a)})}get minDate(){let e=null;for(const a of this._def.checks)a.kind==="min"&&(e===null||a.value>e)&&(e=a.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const a of this._def.checks)a.kind==="max"&&(e===null||a.value<e)&&(e=a.value);return e!=null?new Date(e):null}}Xr.create=n=>new Xr({checks:[],coerce:n?.coerce||!1,typeName:Y.ZodDate,...oe(n)});class Dt extends ce{_parse(e){if(this._getType(e)!==Q.symbol){const t=this._getOrReturnCtx(e);return U(t,{code:M.invalid_type,expected:Q.symbol,received:t.parsedType}),X}return Ze(e.data)}}Dt.create=n=>new Dt({typeName:Y.ZodSymbol,...oe(n)});class ia extends ce{_parse(e){if(this._getType(e)!==Q.undefined){const t=this._getOrReturnCtx(e);return U(t,{code:M.invalid_type,expected:Q.undefined,received:t.parsedType}),X}return Ze(e.data)}}ia.create=n=>new ia({typeName:Y.ZodUndefined,...oe(n)});class oa extends ce{_parse(e){if(this._getType(e)!==Q.null){const t=this._getOrReturnCtx(e);return U(t,{code:M.invalid_type,expected:Q.null,received:t.parsedType}),X}return Ze(e.data)}}oa.create=n=>new oa({typeName:Y.ZodNull,...oe(n)});class At extends ce{constructor(){super(...arguments),this._any=!0}_parse(e){return Ze(e.data)}}At.create=n=>new At({typeName:Y.ZodAny,...oe(n)});class la extends ce{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Ze(e.data)}}la.create=n=>new la({typeName:Y.ZodUnknown,...oe(n)});class cr extends ce{_parse(e){const a=this._getOrReturnCtx(e);return U(a,{code:M.invalid_type,expected:Q.never,received:a.parsedType}),X}}cr.create=n=>new cr({typeName:Y.ZodNever,...oe(n)});class Ct extends ce{_parse(e){if(this._getType(e)!==Q.undefined){const t=this._getOrReturnCtx(e);return U(t,{code:M.invalid_type,expected:Q.void,received:t.parsedType}),X}return Ze(e.data)}}Ct.create=n=>new Ct({typeName:Y.ZodVoid,...oe(n)});class er extends ce{_parse(e){const{ctx:a,status:t}=this._processInputParams(e),r=this._def;if(a.parsedType!==Q.array)return U(a,{code:M.invalid_type,expected:Q.array,received:a.parsedType}),X;if(r.exactLength!==null){const o=a.data.length>r.exactLength.value,i=a.data.length<r.exactLength.value;(o||i)&&(U(a,{code:o?M.too_big:M.too_small,minimum:i?r.exactLength.value:void 0,maximum:o?r.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:r.exactLength.message}),t.dirty())}if(r.minLength!==null&&a.data.length<r.minLength.value&&(U(a,{code:M.too_small,minimum:r.minLength.value,type:"array",inclusive:!0,exact:!1,message:r.minLength.message}),t.dirty()),r.maxLength!==null&&a.data.length>r.maxLength.value&&(U(a,{code:M.too_big,maximum:r.maxLength.value,type:"array",inclusive:!0,exact:!1,message:r.maxLength.message}),t.dirty()),a.common.async)return Promise.all([...a.data].map((o,i)=>r.type._parseAsync(new Xe(a,o,a.path,i)))).then(o=>Le.mergeArray(t,o));const s=[...a.data].map((o,i)=>r.type._parseSync(new Xe(a,o,a.path,i)));return Le.mergeArray(t,s)}get element(){return this._def.type}min(e,a){return new er({...this._def,minLength:{value:e,message:H.toString(a)}})}max(e,a){return new er({...this._def,maxLength:{value:e,message:H.toString(a)}})}length(e,a){return new er({...this._def,exactLength:{value:e,message:H.toString(a)}})}nonempty(e){return this.min(1,e)}}er.create=(n,e)=>new er({type:n,minLength:null,maxLength:null,exactLength:null,typeName:Y.ZodArray,...oe(e)});function Er(n){if(n instanceof ke){const e={};for(const a in n.shape){const t=n.shape[a];e[a]=sr.create(Er(t))}return new ke({...n._def,shape:()=>e})}else return n instanceof er?new er({...n._def,type:Er(n.element)}):n instanceof sr?sr.create(Er(n.unwrap())):n instanceof pr?pr.create(Er(n.unwrap())):n instanceof vr?vr.create(n.items.map(e=>Er(e))):n}class ke extends ce{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),a=me.objectKeys(e);return this._cached={shape:e,keys:a},this._cached}_parse(e){if(this._getType(e)!==Q.object){const f=this._getOrReturnCtx(e);return U(f,{code:M.invalid_type,expected:Q.object,received:f.parsedType}),X}const{status:t,ctx:r}=this._processInputParams(e),{shape:s,keys:o}=this._getCached(),i=[];if(!(this._def.catchall instanceof cr&&this._def.unknownKeys==="strip"))for(const f in r.data)o.includes(f)||i.push(f);const d=[];for(const f of o){const m=s[f],p=r.data[f];d.push({key:{status:"valid",value:f},value:m._parse(new Xe(r,p,r.path,f)),alwaysSet:f in r.data})}if(this._def.catchall instanceof cr){const f=this._def.unknownKeys;if(f==="passthrough")for(const m of i)d.push({key:{status:"valid",value:m},value:{status:"valid",value:r.data[m]}});else if(f==="strict")i.length>0&&(U(r,{code:M.unrecognized_keys,keys:i}),t.dirty());else if(f!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const f=this._def.catchall;for(const m of i){const p=r.data[m];d.push({key:{status:"valid",value:m},value:f._parse(new Xe(r,p,r.path,m)),alwaysSet:m in r.data})}}return r.common.async?Promise.resolve().then(async()=>{const f=[];for(const m of d){const p=await m.key,_=await m.value;f.push({key:p,value:_,alwaysSet:m.alwaysSet})}return f}).then(f=>Le.mergeObjectSync(t,f)):Le.mergeObjectSync(t,d)}get shape(){return this._def.shape()}strict(e){return H.errToObj,new ke({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(a,t)=>{const r=this._def.errorMap?.(a,t).message??t.defaultError;return a.code==="unrecognized_keys"?{message:H.errToObj(e).message??r}:{message:r}}}:{}})}strip(){return new ke({...this._def,unknownKeys:"strip"})}passthrough(){return new ke({...this._def,unknownKeys:"passthrough"})}extend(e){return new ke({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new ke({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:Y.ZodObject})}setKey(e,a){return this.augment({[e]:a})}catchall(e){return new ke({...this._def,catchall:e})}pick(e){const a={};for(const t of me.objectKeys(e))e[t]&&this.shape[t]&&(a[t]=this.shape[t]);return new ke({...this._def,shape:()=>a})}omit(e){const a={};for(const t of me.objectKeys(this.shape))e[t]||(a[t]=this.shape[t]);return new ke({...this._def,shape:()=>a})}deepPartial(){return Er(this)}partial(e){const a={};for(const t of me.objectKeys(this.shape)){const r=this.shape[t];e&&!e[t]?a[t]=r:a[t]=r.optional()}return new ke({...this._def,shape:()=>a})}required(e){const a={};for(const t of me.objectKeys(this.shape))if(e&&!e[t])a[t]=this.shape[t];else{let s=this.shape[t];for(;s instanceof sr;)s=s._def.innerType;a[t]=s}return new ke({...this._def,shape:()=>a})}keyof(){return jt(me.objectKeys(this.shape))}}ke.create=(n,e)=>new ke({shape:()=>n,unknownKeys:"strip",catchall:cr.create(),typeName:Y.ZodObject,...oe(e)}),ke.strictCreate=(n,e)=>new ke({shape:()=>n,unknownKeys:"strict",catchall:cr.create(),typeName:Y.ZodObject,...oe(e)}),ke.lazycreate=(n,e)=>new ke({shape:n,unknownKeys:"strip",catchall:cr.create(),typeName:Y.ZodObject,...oe(e)});class zr extends ce{_parse(e){const{ctx:a}=this._processInputParams(e),t=this._def.options;function r(s){for(const i of s)if(i.result.status==="valid")return i.result;for(const i of s)if(i.result.status==="dirty")return a.common.issues.push(...i.ctx.common.issues),i.result;const o=s.map(i=>new ir(i.ctx.common.issues));return U(a,{code:M.invalid_union,unionErrors:o}),X}if(a.common.async)return Promise.all(t.map(async s=>{const o={...a,common:{...a.common,issues:[]},parent:null};return{result:await s._parseAsync({data:a.data,path:a.path,parent:o}),ctx:o}})).then(r);{let s;const o=[];for(const d of t){const f={...a,common:{...a.common,issues:[]},parent:null},m=d._parseSync({data:a.data,path:a.path,parent:f});if(m.status==="valid")return m;m.status==="dirty"&&!s&&(s={result:m,ctx:f}),f.common.issues.length&&o.push(f.common.issues)}if(s)return a.common.issues.push(...s.ctx.common.issues),s.result;const i=o.map(d=>new ir(d));return U(a,{code:M.invalid_union,unionErrors:i}),X}}get options(){return this._def.options}}zr.create=(n,e)=>new zr({options:n,typeName:Y.ZodUnion,...oe(e)});const tr=n=>n instanceof ca?tr(n.schema):n instanceof mr?tr(n.innerType()):n instanceof Ur?[n.value]:n instanceof gr?n.options:n instanceof fa?me.objectValues(n.enum):n instanceof Qr?tr(n._def.innerType):n instanceof ia?[void 0]:n instanceof oa?[null]:n instanceof sr?[void 0,...tr(n.unwrap())]:n instanceof pr?[null,...tr(n.unwrap())]:n instanceof Ft||n instanceof Hr?tr(n.unwrap()):n instanceof Br?tr(n._def.innerType):[];class ut extends ce{_parse(e){const{ctx:a}=this._processInputParams(e);if(a.parsedType!==Q.object)return U(a,{code:M.invalid_type,expected:Q.object,received:a.parsedType}),X;const t=this.discriminator,r=a.data[t],s=this.optionsMap.get(r);return s?a.common.async?s._parseAsync({data:a.data,path:a.path,parent:a}):s._parseSync({data:a.data,path:a.path,parent:a}):(U(a,{code:M.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[t]}),X)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,a,t){const r=new Map;for(const s of a){const o=tr(s.shape[e]);if(!o.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const i of o){if(r.has(i))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(i)}`);r.set(i,s)}}return new ut({typeName:Y.ZodDiscriminatedUnion,discriminator:e,options:a,optionsMap:r,...oe(t)})}}function ua(n,e){const a=ur(n),t=ur(e);if(n===e)return{valid:!0,data:n};if(a===Q.object&&t===Q.object){const r=me.objectKeys(e),s=me.objectKeys(n).filter(i=>r.indexOf(i)!==-1),o={...n,...e};for(const i of s){const d=ua(n[i],e[i]);if(!d.valid)return{valid:!1};o[i]=d.data}return{valid:!0,data:o}}else if(a===Q.array&&t===Q.array){if(n.length!==e.length)return{valid:!1};const r=[];for(let s=0;s<n.length;s++){const o=n[s],i=e[s],d=ua(o,i);if(!d.valid)return{valid:!1};r.push(d.data)}return{valid:!0,data:r}}else return a===Q.date&&t===Q.date&&+n==+e?{valid:!0,data:n}:{valid:!1}}class Vr extends ce{_parse(e){const{status:a,ctx:t}=this._processInputParams(e),r=(s,o)=>{if(Rt(s)||Rt(o))return X;const i=ua(s.value,o.value);return i.valid?(($t(s)||$t(o))&&a.dirty(),{status:a.value,value:i.data}):(U(t,{code:M.invalid_intersection_types}),X)};return t.common.async?Promise.all([this._def.left._parseAsync({data:t.data,path:t.path,parent:t}),this._def.right._parseAsync({data:t.data,path:t.path,parent:t})]).then(([s,o])=>r(s,o)):r(this._def.left._parseSync({data:t.data,path:t.path,parent:t}),this._def.right._parseSync({data:t.data,path:t.path,parent:t}))}}Vr.create=(n,e,a)=>new Vr({left:n,right:e,typeName:Y.ZodIntersection,...oe(a)});class vr extends ce{_parse(e){const{status:a,ctx:t}=this._processInputParams(e);if(t.parsedType!==Q.array)return U(t,{code:M.invalid_type,expected:Q.array,received:t.parsedType}),X;if(t.data.length<this._def.items.length)return U(t,{code:M.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),X;!this._def.rest&&t.data.length>this._def.items.length&&(U(t,{code:M.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),a.dirty());const s=[...t.data].map((o,i)=>{const d=this._def.items[i]||this._def.rest;return d?d._parse(new Xe(t,o,t.path,i)):null}).filter(o=>!!o);return t.common.async?Promise.all(s).then(o=>Le.mergeArray(a,o)):Le.mergeArray(a,s)}get items(){return this._def.items}rest(e){return new vr({...this._def,rest:e})}}vr.create=(n,e)=>{if(!Array.isArray(n))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new vr({items:n,typeName:Y.ZodTuple,rest:null,...oe(e)})};class Yr extends ce{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:a,ctx:t}=this._processInputParams(e);if(t.parsedType!==Q.object)return U(t,{code:M.invalid_type,expected:Q.object,received:t.parsedType}),X;const r=[],s=this._def.keyType,o=this._def.valueType;for(const i in t.data)r.push({key:s._parse(new Xe(t,i,t.path,i)),value:o._parse(new Xe(t,t.data[i],t.path,i)),alwaysSet:i in t.data});return t.common.async?Le.mergeObjectAsync(a,r):Le.mergeObjectSync(a,r)}get element(){return this._def.valueType}static create(e,a,t){return a instanceof ce?new Yr({keyType:e,valueType:a,typeName:Y.ZodRecord,...oe(t)}):new Yr({keyType:or.create(),valueType:e,typeName:Y.ZodRecord,...oe(a)})}}class Tt extends ce{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:a,ctx:t}=this._processInputParams(e);if(t.parsedType!==Q.map)return U(t,{code:M.invalid_type,expected:Q.map,received:t.parsedType}),X;const r=this._def.keyType,s=this._def.valueType,o=[...t.data.entries()].map(([i,d],f)=>({key:r._parse(new Xe(t,i,t.path,[f,"key"])),value:s._parse(new Xe(t,d,t.path,[f,"value"]))}));if(t.common.async){const i=new Map;return Promise.resolve().then(async()=>{for(const d of o){const f=await d.key,m=await d.value;if(f.status==="aborted"||m.status==="aborted")return X;(f.status==="dirty"||m.status==="dirty")&&a.dirty(),i.set(f.value,m.value)}return{status:a.value,value:i}})}else{const i=new Map;for(const d of o){const f=d.key,m=d.value;if(f.status==="aborted"||m.status==="aborted")return X;(f.status==="dirty"||m.status==="dirty")&&a.dirty(),i.set(f.value,m.value)}return{status:a.value,value:i}}}}Tt.create=(n,e,a)=>new Tt({valueType:e,keyType:n,typeName:Y.ZodMap,...oe(a)});class jr extends ce{_parse(e){const{status:a,ctx:t}=this._processInputParams(e);if(t.parsedType!==Q.set)return U(t,{code:M.invalid_type,expected:Q.set,received:t.parsedType}),X;const r=this._def;r.minSize!==null&&t.data.size<r.minSize.value&&(U(t,{code:M.too_small,minimum:r.minSize.value,type:"set",inclusive:!0,exact:!1,message:r.minSize.message}),a.dirty()),r.maxSize!==null&&t.data.size>r.maxSize.value&&(U(t,{code:M.too_big,maximum:r.maxSize.value,type:"set",inclusive:!0,exact:!1,message:r.maxSize.message}),a.dirty());const s=this._def.valueType;function o(d){const f=new Set;for(const m of d){if(m.status==="aborted")return X;m.status==="dirty"&&a.dirty(),f.add(m.value)}return{status:a.value,value:f}}const i=[...t.data.values()].map((d,f)=>s._parse(new Xe(t,d,t.path,f)));return t.common.async?Promise.all(i).then(d=>o(d)):o(i)}min(e,a){return new jr({...this._def,minSize:{value:e,message:H.toString(a)}})}max(e,a){return new jr({...this._def,maxSize:{value:e,message:H.toString(a)}})}size(e,a){return this.min(e,a).max(e,a)}nonempty(e){return this.min(1,e)}}jr.create=(n,e)=>new jr({valueType:n,minSize:null,maxSize:null,typeName:Y.ZodSet,...oe(e)});class ca extends ce{get schema(){return this._def.getter()}_parse(e){const{ctx:a}=this._processInputParams(e);return this._def.getter()._parse({data:a.data,path:a.path,parent:a})}}ca.create=(n,e)=>new ca({getter:n,typeName:Y.ZodLazy,...oe(e)});class Ur extends ce{_parse(e){if(e.data!==this._def.value){const a=this._getOrReturnCtx(e);return U(a,{received:a.data,code:M.invalid_literal,expected:this._def.value}),X}return{status:"valid",value:e.data}}get value(){return this._def.value}}Ur.create=(n,e)=>new Ur({value:n,typeName:Y.ZodLiteral,...oe(e)});function jt(n,e){return new gr({values:n,typeName:Y.ZodEnum,...oe(e)})}class gr extends ce{_parse(e){if(typeof e.data!="string"){const a=this._getOrReturnCtx(e),t=this._def.values;return U(a,{expected:me.joinValues(t),received:a.parsedType,code:M.invalid_type}),X}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){const a=this._getOrReturnCtx(e),t=this._def.values;return U(a,{received:a.data,code:M.invalid_enum_value,options:t}),X}return Ze(e.data)}get options(){return this._def.values}get enum(){const e={};for(const a of this._def.values)e[a]=a;return e}get Values(){const e={};for(const a of this._def.values)e[a]=a;return e}get Enum(){const e={};for(const a of this._def.values)e[a]=a;return e}extract(e,a=this._def){return gr.create(e,{...this._def,...a})}exclude(e,a=this._def){return gr.create(this.options.filter(t=>!e.includes(t)),{...this._def,...a})}}gr.create=jt;class fa extends ce{_parse(e){const a=me.getValidEnumValues(this._def.values),t=this._getOrReturnCtx(e);if(t.parsedType!==Q.string&&t.parsedType!==Q.number){const r=me.objectValues(a);return U(t,{expected:me.joinValues(r),received:t.parsedType,code:M.invalid_type}),X}if(this._cache||(this._cache=new Set(me.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const r=me.objectValues(a);return U(t,{received:t.data,code:M.invalid_enum_value,options:r}),X}return Ze(e.data)}get enum(){return this._def.values}}fa.create=(n,e)=>new fa({values:n,typeName:Y.ZodNativeEnum,...oe(e)});class Zr extends ce{unwrap(){return this._def.type}_parse(e){const{ctx:a}=this._processInputParams(e);if(a.parsedType!==Q.promise&&a.common.async===!1)return U(a,{code:M.invalid_type,expected:Q.promise,received:a.parsedType}),X;const t=a.parsedType===Q.promise?a.data:Promise.resolve(a.data);return Ze(t.then(r=>this._def.type.parseAsync(r,{path:a.path,errorMap:a.common.contextualErrorMap})))}}Zr.create=(n,e)=>new Zr({type:n,typeName:Y.ZodPromise,...oe(e)});class mr extends ce{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Y.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:a,ctx:t}=this._processInputParams(e),r=this._def.effect||null,s={addIssue:o=>{U(t,o),o.fatal?a.abort():a.dirty()},get path(){return t.path}};if(s.addIssue=s.addIssue.bind(s),r.type==="preprocess"){const o=r.transform(t.data,s);if(t.common.async)return Promise.resolve(o).then(async i=>{if(a.value==="aborted")return X;const d=await this._def.schema._parseAsync({data:i,path:t.path,parent:t});return d.status==="aborted"?X:d.status==="dirty"||a.value==="dirty"?Or(d.value):d});{if(a.value==="aborted")return X;const i=this._def.schema._parseSync({data:o,path:t.path,parent:t});return i.status==="aborted"?X:i.status==="dirty"||a.value==="dirty"?Or(i.value):i}}if(r.type==="refinement"){const o=i=>{const d=r.refinement(i,s);if(t.common.async)return Promise.resolve(d);if(d instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return i};if(t.common.async===!1){const i=this._def.schema._parseSync({data:t.data,path:t.path,parent:t});return i.status==="aborted"?X:(i.status==="dirty"&&a.dirty(),o(i.value),{status:a.value,value:i.value})}else return this._def.schema._parseAsync({data:t.data,path:t.path,parent:t}).then(i=>i.status==="aborted"?X:(i.status==="dirty"&&a.dirty(),o(i.value).then(()=>({status:a.value,value:i.value}))))}if(r.type==="transform")if(t.common.async===!1){const o=this._def.schema._parseSync({data:t.data,path:t.path,parent:t});if(!Pr(o))return X;const i=r.transform(o.value,s);if(i instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:a.value,value:i}}else return this._def.schema._parseAsync({data:t.data,path:t.path,parent:t}).then(o=>Pr(o)?Promise.resolve(r.transform(o.value,s)).then(i=>({status:a.value,value:i})):X);me.assertNever(r)}}mr.create=(n,e,a)=>new mr({schema:n,typeName:Y.ZodEffects,effect:e,...oe(a)}),mr.createWithPreprocess=(n,e,a)=>new mr({schema:e,effect:{type:"preprocess",transform:n},typeName:Y.ZodEffects,...oe(a)});class sr extends ce{_parse(e){return this._getType(e)===Q.undefined?Ze(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}sr.create=(n,e)=>new sr({innerType:n,typeName:Y.ZodOptional,...oe(e)});class pr extends ce{_parse(e){return this._getType(e)===Q.null?Ze(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}pr.create=(n,e)=>new pr({innerType:n,typeName:Y.ZodNullable,...oe(e)});class Qr extends ce{_parse(e){const{ctx:a}=this._processInputParams(e);let t=a.data;return a.parsedType===Q.undefined&&(t=this._def.defaultValue()),this._def.innerType._parse({data:t,path:a.path,parent:a})}removeDefault(){return this._def.innerType}}Qr.create=(n,e)=>new Qr({innerType:n,typeName:Y.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...oe(e)});class Br extends ce{_parse(e){const{ctx:a}=this._processInputParams(e),t={...a,common:{...a.common,issues:[]}},r=this._def.innerType._parse({data:t.data,path:t.path,parent:{...t}});return Mr(r)?r.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new ir(t.common.issues)},input:t.data})})):{status:"valid",value:r.status==="valid"?r.value:this._def.catchValue({get error(){return new ir(t.common.issues)},input:t.data})}}removeCatch(){return this._def.innerType}}Br.create=(n,e)=>new Br({innerType:n,typeName:Y.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...oe(e)});class Nt extends ce{_parse(e){if(this._getType(e)!==Q.nan){const t=this._getOrReturnCtx(e);return U(t,{code:M.invalid_type,expected:Q.nan,received:t.parsedType}),X}return{status:"valid",value:e.data}}}Nt.create=n=>new Nt({typeName:Y.ZodNaN,...oe(n)});class Ft extends ce{_parse(e){const{ctx:a}=this._processInputParams(e),t=a.data;return this._def.type._parse({data:t,path:a.path,parent:a})}unwrap(){return this._def.type}}class ct extends ce{_parse(e){const{status:a,ctx:t}=this._processInputParams(e);if(t.common.async)return(async()=>{const s=await this._def.in._parseAsync({data:t.data,path:t.path,parent:t});return s.status==="aborted"?X:s.status==="dirty"?(a.dirty(),Or(s.value)):this._def.out._parseAsync({data:s.value,path:t.path,parent:t})})();{const r=this._def.in._parseSync({data:t.data,path:t.path,parent:t});return r.status==="aborted"?X:r.status==="dirty"?(a.dirty(),{status:"dirty",value:r.value}):this._def.out._parseSync({data:r.value,path:t.path,parent:t})}}static create(e,a){return new ct({in:e,out:a,typeName:Y.ZodPipeline})}}class Hr extends ce{_parse(e){const a=this._def.innerType._parse(e),t=r=>(Pr(r)&&(r.value=Object.freeze(r.value)),r);return Mr(a)?a.then(r=>t(r)):t(a)}unwrap(){return this._def.innerType}}Hr.create=(n,e)=>new Hr({innerType:n,typeName:Y.ZodReadonly,...oe(e)});var Y;(function(n){n.ZodString="ZodString",n.ZodNumber="ZodNumber",n.ZodNaN="ZodNaN",n.ZodBigInt="ZodBigInt",n.ZodBoolean="ZodBoolean",n.ZodDate="ZodDate",n.ZodSymbol="ZodSymbol",n.ZodUndefined="ZodUndefined",n.ZodNull="ZodNull",n.ZodAny="ZodAny",n.ZodUnknown="ZodUnknown",n.ZodNever="ZodNever",n.ZodVoid="ZodVoid",n.ZodArray="ZodArray",n.ZodObject="ZodObject",n.ZodUnion="ZodUnion",n.ZodDiscriminatedUnion="ZodDiscriminatedUnion",n.ZodIntersection="ZodIntersection",n.ZodTuple="ZodTuple",n.ZodRecord="ZodRecord",n.ZodMap="ZodMap",n.ZodSet="ZodSet",n.ZodFunction="ZodFunction",n.ZodLazy="ZodLazy",n.ZodLiteral="ZodLiteral",n.ZodEnum="ZodEnum",n.ZodEffects="ZodEffects",n.ZodNativeEnum="ZodNativeEnum",n.ZodOptional="ZodOptional",n.ZodNullable="ZodNullable",n.ZodDefault="ZodDefault",n.ZodCatch="ZodCatch",n.ZodPromise="ZodPromise",n.ZodBranded="ZodBranded",n.ZodPipeline="ZodPipeline",n.ZodReadonly="ZodReadonly"})(Y||(Y={}));const Z=or.create,Ne=br.create,ze=na.create,kr=la.create;cr.create;const De=er.create,B=ke.create,Fe=zr.create,ti=ut.create;Vr.create,vr.create;const Ir=Yr.create,ne=Ur.create,nr=gr.create;Zr.create;const F=sr.create;pr.create;const Kr="2.0",Lt=Fe([Z(),Ne().int()]),qt=Z(),si=B({progressToken:F(Lt)}).passthrough(),Qe=B({_meta:F(si)}).passthrough(),Me=B({method:Z(),params:F(Qe)}),Dr=B({_meta:F(B({}).passthrough())}).passthrough(),Ye=B({method:Z(),params:F(Dr)}),Be=B({_meta:F(B({}).passthrough())}).passthrough(),Jr=Fe([Z(),Ne().int()]),ni=B({jsonrpc:ne(Kr),id:Jr}).merge(Me).strict(),ii=B({jsonrpc:ne(Kr)}).merge(Ye).strict(),oi=B({jsonrpc:ne(Kr),id:Jr,result:Be}).strict();var Mt;(function(n){n[n.ConnectionClosed=-32e3]="ConnectionClosed",n[n.RequestTimeout=-32001]="RequestTimeout",n[n.ParseError=-32700]="ParseError",n[n.InvalidRequest=-32600]="InvalidRequest",n[n.MethodNotFound=-32601]="MethodNotFound",n[n.InvalidParams=-32602]="InvalidParams",n[n.InternalError=-32603]="InternalError"})(Mt||(Mt={}));const li=B({jsonrpc:ne(Kr),id:Jr,error:B({code:Ne().int(),message:Z(),data:F(kr())})}).strict(),ui=Fe([ni,ii,oi,li]),zt=Be.strict(),Vt=Ye.extend({method:ne("notifications/cancelled"),params:Dr.extend({requestId:Jr,reason:Z().optional()})}),Ar=B({name:Z(),title:F(Z())}).passthrough(),Ut=Ar.extend({version:Z()}),ci=B({experimental:F(B({}).passthrough()),sampling:F(B({}).passthrough()),elicitation:F(B({}).passthrough()),roots:F(B({listChanged:F(ze())}).passthrough())}).passthrough(),fi=Me.extend({method:ne("initialize"),params:Qe.extend({protocolVersion:Z(),capabilities:ci,clientInfo:Ut})}),di=B({experimental:F(B({}).passthrough()),logging:F(B({}).passthrough()),completions:F(B({}).passthrough()),prompts:F(B({listChanged:F(ze())}).passthrough()),resources:F(B({subscribe:F(ze()),listChanged:F(ze())}).passthrough()),tools:F(B({listChanged:F(ze())}).passthrough())}).passthrough(),hi=Be.extend({protocolVersion:Z(),capabilities:di,serverInfo:Ut,instructions:F(Z())}),mi=Ye.extend({method:ne("notifications/initialized")}),Zt=Me.extend({method:ne("ping")}),pi=B({progress:Ne(),total:F(Ne()),message:F(Z())}).passthrough(),Qt=Ye.extend({method:ne("notifications/progress"),params:Dr.merge(pi).extend({progressToken:Lt})}),Wr=Me.extend({params:Qe.extend({cursor:F(qt)}).optional()}),Gr=Be.extend({nextCursor:F(qt)}),Bt=B({uri:Z(),mimeType:F(Z()),_meta:F(B({}).passthrough())}).passthrough(),Ht=Bt.extend({text:Z()}),Kt=Bt.extend({blob:Z().base64()}),Jt=Ar.extend({uri:Z(),description:F(Z()),mimeType:F(Z()),_meta:F(B({}).passthrough())}),vi=Ar.extend({uriTemplate:Z(),description:F(Z()),mimeType:F(Z()),_meta:F(B({}).passthrough())}),gi=Wr.extend({method:ne("resources/list")}),yi=Gr.extend({resources:De(Jt)}),_i=Wr.extend({method:ne("resources/templates/list")}),Pi=Gr.extend({resourceTemplates:De(vi)}),Ei=Me.extend({method:ne("resources/read"),params:Qe.extend({uri:Z()})}),Si=Be.extend({contents:De(Fe([Ht,Kt]))}),bi=Ye.extend({method:ne("notifications/resources/list_changed")}),xi=Me.extend({method:ne("resources/subscribe"),params:Qe.extend({uri:Z()})}),wi=Me.extend({method:ne("resources/unsubscribe"),params:Qe.extend({uri:Z()})}),Ri=Ye.extend({method:ne("notifications/resources/updated"),params:Dr.extend({uri:Z()})}),$i=B({name:Z(),description:F(Z()),required:F(ze())}).passthrough(),Oi=Ar.extend({description:F(Z()),arguments:F(De($i)),_meta:F(B({}).passthrough())}),ki=Wr.extend({method:ne("prompts/list")}),Ii=Gr.extend({prompts:De(Oi)}),Di=Me.extend({method:ne("prompts/get"),params:Qe.extend({name:Z(),arguments:F(Ir(Z()))})}),da=B({type:ne("text"),text:Z(),_meta:F(B({}).passthrough())}).passthrough(),ha=B({type:ne("image"),data:Z().base64(),mimeType:Z(),_meta:F(B({}).passthrough())}).passthrough(),ma=B({type:ne("audio"),data:Z().base64(),mimeType:Z(),_meta:F(B({}).passthrough())}).passthrough(),Ai=B({type:ne("resource"),resource:Fe([Ht,Kt]),_meta:F(B({}).passthrough())}).passthrough(),Ci=Jt.extend({type:ne("resource_link")}),Wt=Fe([da,ha,ma,Ci,Ai]),Ti=B({role:nr(["user","assistant"]),content:Wt}).passthrough(),ji=Be.extend({description:F(Z()),messages:De(Ti)}),Ni=Ye.extend({method:ne("notifications/prompts/list_changed")}),Fi=B({title:F(Z()),readOnlyHint:F(ze()),destructiveHint:F(ze()),idempotentHint:F(ze()),openWorldHint:F(ze())}).passthrough(),Li=Ar.extend({description:F(Z()),inputSchema:B({type:ne("object"),properties:F(B({}).passthrough()),required:F(De(Z()))}).passthrough(),outputSchema:F(B({type:ne("object"),properties:F(B({}).passthrough()),required:F(De(Z()))}).passthrough()),annotations:F(Fi),_meta:F(B({}).passthrough())}),qi=Wr.extend({method:ne("tools/list")}),Mi=Gr.extend({tools:De(Li)}),Gt=Be.extend({content:De(Wt).default([]),structuredContent:B({}).passthrough().optional(),isError:F(ze())});Gt.or(Be.extend({toolResult:kr()}));const zi=Me.extend({method:ne("tools/call"),params:Qe.extend({name:Z(),arguments:F(Ir(kr()))})}),Vi=Ye.extend({method:ne("notifications/tools/list_changed")}),Xt=nr(["debug","info","notice","warning","error","critical","alert","emergency"]),Ui=Me.extend({method:ne("logging/setLevel"),params:Qe.extend({level:Xt})}),Zi=Ye.extend({method:ne("notifications/message"),params:Dr.extend({level:Xt,logger:F(Z()),data:kr()})}),Qi=B({name:Z().optional()}).passthrough(),Bi=B({hints:F(De(Qi)),costPriority:F(Ne().min(0).max(1)),speedPriority:F(Ne().min(0).max(1)),intelligencePriority:F(Ne().min(0).max(1))}).passthrough(),Hi=B({role:nr(["user","assistant"]),content:Fe([da,ha,ma])}).passthrough(),Ki=Me.extend({method:ne("sampling/createMessage"),params:Qe.extend({messages:De(Hi),systemPrompt:F(Z()),includeContext:F(nr(["none","thisServer","allServers"])),temperature:F(Ne()),maxTokens:Ne().int(),stopSequences:F(De(Z())),metadata:F(B({}).passthrough()),modelPreferences:F(Bi)})}),Ji=Be.extend({model:Z(),stopReason:F(nr(["endTurn","stopSequence","maxTokens"]).or(Z())),role:nr(["user","assistant"]),content:ti("type",[da,ha,ma])}),Wi=B({type:ne("boolean"),title:F(Z()),description:F(Z()),default:F(ze())}).passthrough(),Gi=B({type:ne("string"),title:F(Z()),description:F(Z()),minLength:F(Ne()),maxLength:F(Ne()),format:F(nr(["email","uri","date","date-time"]))}).passthrough(),Xi=B({type:nr(["number","integer"]),title:F(Z()),description:F(Z()),minimum:F(Ne()),maximum:F(Ne())}).passthrough(),Yi=B({type:ne("string"),title:F(Z()),description:F(Z()),enum:De(Z()),enumNames:F(De(Z()))}).passthrough(),eo=Fe([Wi,Gi,Xi,Yi]),ro=Me.extend({method:ne("elicitation/create"),params:Qe.extend({message:Z(),requestedSchema:B({type:ne("object"),properties:Ir(Z(),eo),required:F(De(Z()))}).passthrough()})}),ao=Be.extend({action:nr(["accept","reject","cancel"]),content:F(Ir(Z(),kr()))}),to=B({type:ne("ref/resource"),uri:Z()}).passthrough(),so=B({type:ne("ref/prompt"),name:Z()}).passthrough(),no=Me.extend({method:ne("completion/complete"),params:Qe.extend({ref:Fe([so,to]),argument:B({name:Z(),value:Z()}).passthrough(),context:F(B({arguments:F(Ir(Z(),Z()))}))})}),io=Be.extend({completion:B({values:De(Z()).max(100),total:F(Ne().int()),hasMore:F(ze())}).passthrough()}),oo=B({uri:Z().startsWith("file://"),name:F(Z()),_meta:F(B({}).passthrough())}).passthrough(),lo=Me.extend({method:ne("roots/list")}),uo=Be.extend({roots:De(oo)}),co=Ye.extend({method:ne("notifications/roots/list_changed")});Fe([Zt,fi,no,Ui,Di,ki,gi,_i,Ei,xi,wi,zi,qi]),Fe([Vt,Qt,mi,co]),Fe([zt,Ji,ao,uo]),Fe([Zt,Ki,ro,lo]),Fe([Vt,Qt,Zi,Ri,bi,Vi,Ni]),Fe([zt,hi,io,ji,Ii,yi,Pi,Si,Gt,Mi]);var Cr={exports:{}};/** @license URI.js v4.4.1 (c) 2011 Gary Court. License: http://github.com/garycourt/uri-js */var fo=Cr.exports,Yt;function ho(){return Yt||(Yt=1,function(n,e){(function(a,t){t(e)})(fo,function(a){function t(){for(var h=arguments.length,l=Array(h),v=0;v<h;v++)l[v]=arguments[v];if(l.length>1){l[0]=l[0].slice(0,-1);for(var $=l.length-1,R=1;R<$;++R)l[R]=l[R].slice(1,-1);return l[$]=l[$].slice(1),l.join("")}else return l[0]}function r(h){return"(?:"+h+")"}function s(h){return h===void 0?"undefined":h===null?"null":Object.prototype.toString.call(h).split(" ").pop().split("]").shift().toLowerCase()}function o(h){return h.toUpperCase()}function i(h){return h!=null?h instanceof Array?h:typeof h.length!="number"||h.split||h.setInterval||h.call?[h]:Array.prototype.slice.call(h):[]}function d(h,l){var v=h;if(l)for(var $ in l)v[$]=l[$];return v}function f(h){var l="[A-Za-z]",v="[0-9]",$=t(v,"[A-Fa-f]"),R=r(r("%[EFef]"+$+"%"+$+$+"%"+$+$)+"|"+r("%[89A-Fa-f]"+$+"%"+$+$)+"|"+r("%"+$+$)),J="[\\:\\/\\?\\#\\[\\]\\@]",W="[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=]",he=t(J,W),ye=h?"[\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]":"[]",Re=h?"[\\uE000-\\uF8FF]":"[]",de=t(l,v,"[\\-\\.\\_\\~]",ye);r(l+t(l,v,"[\\+\\-\\.]")+"*"),r(r(R+"|"+t(de,W,"[\\:]"))+"*");var ge=r(r("25[0-5]")+"|"+r("2[0-4]"+v)+"|"+r("1"+v+v)+"|"+r("0?[1-9]"+v)+"|0?0?"+v),$e=r(ge+"\\."+ge+"\\."+ge+"\\."+ge),te=r($+"{1,4}"),Pe=r(r(te+"\\:"+te)+"|"+$e),Oe=r(r(te+"\\:")+"{6}"+Pe),Ee=r("\\:\\:"+r(te+"\\:")+"{5}"+Pe),lr=r(r(te)+"?\\:\\:"+r(te+"\\:")+"{4}"+Pe),Je=r(r(r(te+"\\:")+"{0,1}"+te)+"?\\:\\:"+r(te+"\\:")+"{3}"+Pe),We=r(r(r(te+"\\:")+"{0,2}"+te)+"?\\:\\:"+r(te+"\\:")+"{2}"+Pe),_r=r(r(r(te+"\\:")+"{0,3}"+te)+"?\\:\\:"+te+"\\:"+Pe),dr=r(r(r(te+"\\:")+"{0,4}"+te)+"?\\:\\:"+Pe),Ue=r(r(r(te+"\\:")+"{0,5}"+te)+"?\\:\\:"+te),Ge=r(r(r(te+"\\:")+"{0,6}"+te)+"?\\:\\:"),hr=r([Oe,Ee,lr,Je,We,_r,dr,Ue,Ge].join("|")),ar=r(r(de+"|"+R)+"+");r("[vV]"+$+"+\\."+t(de,W,"[\\:]")+"+"),r(r(R+"|"+t(de,W))+"*");var Rr=r(R+"|"+t(de,W,"[\\:\\@]"));return r(r(R+"|"+t(de,W,"[\\@]"))+"+"),r(r(Rr+"|"+t("[\\/\\?]",Re))+"*"),{NOT_SCHEME:new RegExp(t("[^]",l,v,"[\\+\\-\\.]"),"g"),NOT_USERINFO:new RegExp(t("[^\\%\\:]",de,W),"g"),NOT_HOST:new RegExp(t("[^\\%\\[\\]\\:]",de,W),"g"),NOT_PATH:new RegExp(t("[^\\%\\/\\:\\@]",de,W),"g"),NOT_PATH_NOSCHEME:new RegExp(t("[^\\%\\/\\@]",de,W),"g"),NOT_QUERY:new RegExp(t("[^\\%]",de,W,"[\\:\\@\\/\\?]",Re),"g"),NOT_FRAGMENT:new RegExp(t("[^\\%]",de,W,"[\\:\\@\\/\\?]"),"g"),ESCAPE:new RegExp(t("[^]",de,W),"g"),UNRESERVED:new RegExp(de,"g"),OTHER_CHARS:new RegExp(t("[^\\%]",de,he),"g"),PCT_ENCODED:new RegExp(R,"g"),IPV4ADDRESS:new RegExp("^("+$e+")$"),IPV6ADDRESS:new RegExp("^\\[?("+hr+")"+r(r("\\%25|\\%(?!"+$+"{2})")+"("+ar+")")+"?\\]?$")}}var m=f(!1),p=f(!0),_=function(){function h(l,v){var $=[],R=!0,J=!1,W=void 0;try{for(var he=l[Symbol.iterator](),ye;!(R=(ye=he.next()).done)&&($.push(ye.value),!(v&&$.length===v));R=!0);}catch(Re){J=!0,W=Re}finally{try{!R&&he.return&&he.return()}finally{if(J)throw W}}return $}return function(l,v){if(Array.isArray(l))return l;if(Symbol.iterator in Object(l))return h(l,v);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),u=function(h){if(Array.isArray(h)){for(var l=0,v=Array(h.length);l<h.length;l++)v[l]=h[l];return v}else return Array.from(h)},c=2147483647,y=36,g=1,P=26,T=38,O=700,E=72,x=128,k="-",I=/^xn--/,D=/[^\0-\x7E]/,A=/[\x2E\u3002\uFF0E\uFF61]/g,S={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},w=y-g,C=Math.floor,L=String.fromCharCode;function q(h){throw new RangeError(S[h])}function K(h,l){for(var v=[],$=h.length;$--;)v[$]=l(h[$]);return v}function se(h,l){var v=h.split("@"),$="";v.length>1&&($=v[0]+"@",h=v[1]),h=h.replace(A,".");var R=h.split("."),J=K(R,l).join(".");return $+J}function G(h){for(var l=[],v=0,$=h.length;v<$;){var R=h.charCodeAt(v++);if(R>=55296&&R<=56319&&v<$){var J=h.charCodeAt(v++);(J&64512)==56320?l.push(((R&1023)<<10)+(J&1023)+65536):(l.push(R),v--)}else l.push(R)}return l}var le=function(l){return String.fromCodePoint.apply(String,u(l))},re=function(l){return l-48<10?l-22:l-65<26?l-65:l-97<26?l-97:y},ae=function(l,v){return l+22+75*(l<26)-((v!=0)<<5)},Te=function(l,v,$){var R=0;for(l=$?C(l/O):l>>1,l+=C(l/v);l>w*P>>1;R+=y)l=C(l/w);return C(R+(w+1)*l/(l+T))},Ae=function(l){var v=[],$=l.length,R=0,J=x,W=E,he=l.lastIndexOf(k);he<0&&(he=0);for(var ye=0;ye<he;++ye)l.charCodeAt(ye)>=128&&q("not-basic"),v.push(l.charCodeAt(ye));for(var Re=he>0?he+1:0;Re<$;){for(var de=R,ge=1,$e=y;;$e+=y){Re>=$&&q("invalid-input");var te=re(l.charCodeAt(Re++));(te>=y||te>C((c-R)/ge))&&q("overflow"),R+=te*ge;var Pe=$e<=W?g:$e>=W+P?P:$e-W;if(te<Pe)break;var Oe=y-Pe;ge>C(c/Oe)&&q("overflow"),ge*=Oe}var Ee=v.length+1;W=Te(R-de,Ee,de==0),C(R/Ee)>c-J&&q("overflow"),J+=C(R/Ee),R%=Ee,v.splice(R++,0,J)}return String.fromCodePoint.apply(String,v)},Ie=function(l){var v=[];l=G(l);var $=l.length,R=x,J=0,W=E,he=!0,ye=!1,Re=void 0;try{for(var de=l[Symbol.iterator](),ge;!(he=(ge=de.next()).done);he=!0){var $e=ge.value;$e<128&&v.push(L($e))}}catch($r){ye=!0,Re=$r}finally{try{!he&&de.return&&de.return()}finally{if(ye)throw Re}}var te=v.length,Pe=te;for(te&&v.push(k);Pe<$;){var Oe=c,Ee=!0,lr=!1,Je=void 0;try{for(var We=l[Symbol.iterator](),_r;!(Ee=(_r=We.next()).done);Ee=!0){var dr=_r.value;dr>=R&&dr<Oe&&(Oe=dr)}}catch($r){lr=!0,Je=$r}finally{try{!Ee&&We.return&&We.return()}finally{if(lr)throw Je}}var Ue=Pe+1;Oe-R>C((c-J)/Ue)&&q("overflow"),J+=(Oe-R)*Ue,R=Oe;var Ge=!0,hr=!1,ar=void 0;try{for(var Rr=l[Symbol.iterator](),_t;!(Ge=(_t=Rr.next()).done);Ge=!0){var Pt=_t.value;if(Pt<R&&++J>c&&q("overflow"),Pt==R){for(var Fr=J,Lr=y;;Lr+=y){var qr=Lr<=W?g:Lr>=W+P?P:Lr-W;if(Fr<qr)break;var Et=Fr-qr,St=y-qr;v.push(L(ae(qr+Et%St,0))),Fr=C(Et/St)}v.push(L(ae(Fr,0))),W=Te(J,Ue,Pe==te),J=0,++Pe}}}catch($r){hr=!0,ar=$r}finally{try{!Ge&&Rr.return&&Rr.return()}finally{if(hr)throw ar}}++J,++R}return v.join("")},xe=function(l){return se(l,function(v){return I.test(v)?Ae(v.slice(4).toLowerCase()):v})},Ve=function(l){return se(l,function(v){return D.test(v)?"xn--"+Ie(v):v})},b={version:"2.1.0",ucs2:{decode:G,encode:le},decode:Ae,encode:Ie,toASCII:Ve,toUnicode:xe},j={};function V(h){var l=h.charCodeAt(0),v=void 0;return l<16?v="%0"+l.toString(16).toUpperCase():l<128?v="%"+l.toString(16).toUpperCase():l<2048?v="%"+(l>>6|192).toString(16).toUpperCase()+"%"+(l&63|128).toString(16).toUpperCase():v="%"+(l>>12|224).toString(16).toUpperCase()+"%"+(l>>6&63|128).toString(16).toUpperCase()+"%"+(l&63|128).toString(16).toUpperCase(),v}function ee(h){for(var l="",v=0,$=h.length;v<$;){var R=parseInt(h.substr(v+1,2),16);if(R<128)l+=String.fromCharCode(R),v+=3;else if(R>=194&&R<224){if($-v>=6){var J=parseInt(h.substr(v+4,2),16);l+=String.fromCharCode((R&31)<<6|J&63)}else l+=h.substr(v,6);v+=6}else if(R>=224){if($-v>=9){var W=parseInt(h.substr(v+4,2),16),he=parseInt(h.substr(v+7,2),16);l+=String.fromCharCode((R&15)<<12|(W&63)<<6|he&63)}else l+=h.substr(v,9);v+=9}else l+=h.substr(v,3),v+=3}return l}function N(h,l){function v($){var R=ee($);return R.match(l.UNRESERVED)?R:$}return h.scheme&&(h.scheme=String(h.scheme).replace(l.PCT_ENCODED,v).toLowerCase().replace(l.NOT_SCHEME,"")),h.userinfo!==void 0&&(h.userinfo=String(h.userinfo).replace(l.PCT_ENCODED,v).replace(l.NOT_USERINFO,V).replace(l.PCT_ENCODED,o)),h.host!==void 0&&(h.host=String(h.host).replace(l.PCT_ENCODED,v).toLowerCase().replace(l.NOT_HOST,V).replace(l.PCT_ENCODED,o)),h.path!==void 0&&(h.path=String(h.path).replace(l.PCT_ENCODED,v).replace(h.scheme?l.NOT_PATH:l.NOT_PATH_NOSCHEME,V).replace(l.PCT_ENCODED,o)),h.query!==void 0&&(h.query=String(h.query).replace(l.PCT_ENCODED,v).replace(l.NOT_QUERY,V).replace(l.PCT_ENCODED,o)),h.fragment!==void 0&&(h.fragment=String(h.fragment).replace(l.PCT_ENCODED,v).replace(l.NOT_FRAGMENT,V).replace(l.PCT_ENCODED,o)),h}function z(h){return h.replace(/^0*(.*)/,"$1")||"0"}function ie(h,l){var v=h.match(l.IPV4ADDRESS)||[],$=_(v,2),R=$[1];return R?R.split(".").map(z).join("."):h}function fe(h,l){var v=h.match(l.IPV6ADDRESS)||[],$=_(v,3),R=$[1],J=$[2];if(R){for(var W=R.toLowerCase().split("::").reverse(),he=_(W,2),ye=he[0],Re=he[1],de=Re?Re.split(":").map(z):[],ge=ye.split(":").map(z),$e=l.IPV4ADDRESS.test(ge[ge.length-1]),te=$e?7:8,Pe=ge.length-te,Oe=Array(te),Ee=0;Ee<te;++Ee)Oe[Ee]=de[Ee]||ge[Pe+Ee]||"";$e&&(Oe[te-1]=ie(Oe[te-1],l));var lr=Oe.reduce(function(Ue,Ge,hr){if(!Ge||Ge==="0"){var ar=Ue[Ue.length-1];ar&&ar.index+ar.length===hr?ar.length++:Ue.push({index:hr,length:1})}return Ue},[]),Je=lr.sort(function(Ue,Ge){return Ge.length-Ue.length})[0],We=void 0;if(Je&&Je.length>1){var _r=Oe.slice(0,Je.index),dr=Oe.slice(Je.index+Je.length);We=_r.join(":")+"::"+dr.join(":")}else We=Oe.join(":");return J&&(We+="%"+J),We}else return h}var ue=/^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i,_e="".match(/(){0}/)[1]===void 0;function pe(h){var l=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},v={},$=l.iri!==!1?p:m;l.reference==="suffix"&&(h=(l.scheme?l.scheme+":":"")+"//"+h);var R=h.match(ue);if(R){_e?(v.scheme=R[1],v.userinfo=R[3],v.host=R[4],v.port=parseInt(R[5],10),v.path=R[6]||"",v.query=R[7],v.fragment=R[8],isNaN(v.port)&&(v.port=R[5])):(v.scheme=R[1]||void 0,v.userinfo=h.indexOf("@")!==-1?R[3]:void 0,v.host=h.indexOf("//")!==-1?R[4]:void 0,v.port=parseInt(R[5],10),v.path=R[6]||"",v.query=h.indexOf("?")!==-1?R[7]:void 0,v.fragment=h.indexOf("#")!==-1?R[8]:void 0,isNaN(v.port)&&(v.port=h.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/)?R[4]:void 0)),v.host&&(v.host=fe(ie(v.host,$),$)),v.scheme===void 0&&v.userinfo===void 0&&v.host===void 0&&v.port===void 0&&!v.path&&v.query===void 0?v.reference="same-document":v.scheme===void 0?v.reference="relative":v.fragment===void 0?v.reference="absolute":v.reference="uri",l.reference&&l.reference!=="suffix"&&l.reference!==v.reference&&(v.error=v.error||"URI is not a "+l.reference+" reference.");var J=j[(l.scheme||v.scheme||"").toLowerCase()];if(!l.unicodeSupport&&(!J||!J.unicodeSupport)){if(v.host&&(l.domainHost||J&&J.domainHost))try{v.host=b.toASCII(v.host.replace($.PCT_ENCODED,ee).toLowerCase())}catch(W){v.error=v.error||"Host's domain name can not be converted to ASCII via punycode: "+W}N(v,m)}else N(v,$);J&&J.parse&&J.parse(v,l)}else v.error=v.error||"URI can not be parsed.";return v}function ve(h,l){var v=l.iri!==!1?p:m,$=[];return h.userinfo!==void 0&&($.push(h.userinfo),$.push("@")),h.host!==void 0&&$.push(fe(ie(String(h.host),v),v).replace(v.IPV6ADDRESS,function(R,J,W){return"["+J+(W?"%25"+W:"")+"]"})),(typeof h.port=="number"||typeof h.port=="string")&&($.push(":"),$.push(String(h.port))),$.length?$.join(""):void 0}var Ce=/^\.\.?\//,Se=/^\/\.(\/|$)/,He=/^\/\.\.(\/|$)/,je=/^\/?(?:.|\n)*?(?=\/|$)/;function be(h){for(var l=[];h.length;)if(h.match(Ce))h=h.replace(Ce,"");else if(h.match(Se))h=h.replace(Se,"/");else if(h.match(He))h=h.replace(He,"/"),l.pop();else if(h==="."||h==="..")h="";else{var v=h.match(je);if(v){var $=v[0];h=h.slice($.length),l.push($)}else throw new Error("Unexpected dot segment condition")}return l.join("")}function we(h){var l=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},v=l.iri?p:m,$=[],R=j[(l.scheme||h.scheme||"").toLowerCase()];if(R&&R.serialize&&R.serialize(h,l),h.host&&!v.IPV6ADDRESS.test(h.host)){if(l.domainHost||R&&R.domainHost)try{h.host=l.iri?b.toUnicode(h.host):b.toASCII(h.host.replace(v.PCT_ENCODED,ee).toLowerCase())}catch(he){h.error=h.error||"Host's domain name can not be converted to "+(l.iri?"Unicode":"ASCII")+" via punycode: "+he}}N(h,v),l.reference!=="suffix"&&h.scheme&&($.push(h.scheme),$.push(":"));var J=ve(h,l);if(J!==void 0&&(l.reference!=="suffix"&&$.push("//"),$.push(J),h.path&&h.path.charAt(0)!=="/"&&$.push("/")),h.path!==void 0){var W=h.path;!l.absolutePath&&(!R||!R.absolutePath)&&(W=be(W)),J===void 0&&(W=W.replace(/^\/\//,"/%2F")),$.push(W)}return h.query!==void 0&&($.push("?"),$.push(h.query)),h.fragment!==void 0&&($.push("#"),$.push(h.fragment)),$.join("")}function qe(h,l){var v=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},$=arguments[3],R={};return $||(h=pe(we(h,v),v),l=pe(we(l,v),v)),v=v||{},!v.tolerant&&l.scheme?(R.scheme=l.scheme,R.userinfo=l.userinfo,R.host=l.host,R.port=l.port,R.path=be(l.path||""),R.query=l.query):(l.userinfo!==void 0||l.host!==void 0||l.port!==void 0?(R.userinfo=l.userinfo,R.host=l.host,R.port=l.port,R.path=be(l.path||""),R.query=l.query):(l.path?(l.path.charAt(0)==="/"?R.path=be(l.path):((h.userinfo!==void 0||h.host!==void 0||h.port!==void 0)&&!h.path?R.path="/"+l.path:h.path?R.path=h.path.slice(0,h.path.lastIndexOf("/")+1)+l.path:R.path=l.path,R.path=be(R.path)),R.query=l.query):(R.path=h.path,l.query!==void 0?R.query=l.query:R.query=h.query),R.userinfo=h.userinfo,R.host=h.host,R.port=h.port),R.scheme=h.scheme),R.fragment=l.fragment,R}function Nr(h,l,v){var $=d({scheme:"null"},v);return we(qe(pe(h,$),pe(l,$),$,!0),$)}function ea(h,l){return typeof h=="string"?h=we(pe(h,l),l):s(h)==="object"&&(h=pe(we(h,l),l)),h}function ra(h,l,v){return typeof h=="string"?h=we(pe(h,v),v):s(h)==="object"&&(h=we(h,v)),typeof l=="string"?l=we(pe(l,v),v):s(l)==="object"&&(l=we(l,v)),h===l}function pn(h,l){return h&&h.toString().replace(!l||!l.iri?m.ESCAPE:p.ESCAPE,V)}function rr(h,l){return h&&h.toString().replace(!l||!l.iri?m.PCT_ENCODED:p.PCT_ENCODED,ee)}var xr={scheme:"http",domainHost:!0,parse:function(l,v){return l.host||(l.error=l.error||"HTTP URIs must have a host."),l},serialize:function(l,v){var $=String(l.scheme).toLowerCase()==="https";return(l.port===($?443:80)||l.port==="")&&(l.port=void 0),l.path||(l.path="/"),l}},ft={scheme:"https",domainHost:xr.domainHost,parse:xr.parse,serialize:xr.serialize};function dt(h){return typeof h.secure=="boolean"?h.secure:String(h.scheme).toLowerCase()==="wss"}var wr={scheme:"ws",domainHost:!0,parse:function(l,v){var $=l;return $.secure=dt($),$.resourceName=($.path||"/")+($.query?"?"+$.query:""),$.path=void 0,$.query=void 0,$},serialize:function(l,v){if((l.port===(dt(l)?443:80)||l.port==="")&&(l.port=void 0),typeof l.secure=="boolean"&&(l.scheme=l.secure?"wss":"ws",l.secure=void 0),l.resourceName){var $=l.resourceName.split("?"),R=_($,2),J=R[0],W=R[1];l.path=J&&J!=="/"?J:void 0,l.query=W,l.resourceName=void 0}return l.fragment=void 0,l}},ht={scheme:"wss",domainHost:wr.domainHost,parse:wr.parse,serialize:wr.serialize},vn={},mt="[A-Za-z0-9\\-\\.\\_\\~\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]",Ke="[0-9A-Fa-f]",gn=r(r("%[EFef]"+Ke+"%"+Ke+Ke+"%"+Ke+Ke)+"|"+r("%[89A-Fa-f]"+Ke+"%"+Ke+Ke)+"|"+r("%"+Ke+Ke)),yn="[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]",_n="[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]",Pn=t(_n,'[\\"\\\\]'),En="[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]",Sn=new RegExp(mt,"g"),yr=new RegExp(gn,"g"),bn=new RegExp(t("[^]",yn,"[\\.]",'[\\"]',Pn),"g"),pt=new RegExp(t("[^]",mt,En),"g"),xn=pt;function aa(h){var l=ee(h);return l.match(Sn)?l:h}var vt={scheme:"mailto",parse:function(l,v){var $=l,R=$.to=$.path?$.path.split(","):[];if($.path=void 0,$.query){for(var J=!1,W={},he=$.query.split("&"),ye=0,Re=he.length;ye<Re;++ye){var de=he[ye].split("=");switch(de[0]){case"to":for(var ge=de[1].split(","),$e=0,te=ge.length;$e<te;++$e)R.push(ge[$e]);break;case"subject":$.subject=rr(de[1],v);break;case"body":$.body=rr(de[1],v);break;default:J=!0,W[rr(de[0],v)]=rr(de[1],v);break}}J&&($.headers=W)}$.query=void 0;for(var Pe=0,Oe=R.length;Pe<Oe;++Pe){var Ee=R[Pe].split("@");if(Ee[0]=rr(Ee[0]),v.unicodeSupport)Ee[1]=rr(Ee[1],v).toLowerCase();else try{Ee[1]=b.toASCII(rr(Ee[1],v).toLowerCase())}catch(lr){$.error=$.error||"Email address's domain name can not be converted to ASCII via punycode: "+lr}R[Pe]=Ee.join("@")}return $},serialize:function(l,v){var $=l,R=i(l.to);if(R){for(var J=0,W=R.length;J<W;++J){var he=String(R[J]),ye=he.lastIndexOf("@"),Re=he.slice(0,ye).replace(yr,aa).replace(yr,o).replace(bn,V),de=he.slice(ye+1);try{de=v.iri?b.toUnicode(de):b.toASCII(rr(de,v).toLowerCase())}catch(Pe){$.error=$.error||"Email address's domain name can not be converted to "+(v.iri?"Unicode":"ASCII")+" via punycode: "+Pe}R[J]=Re+"@"+de}$.path=R.join(",")}var ge=l.headers=l.headers||{};l.subject&&(ge.subject=l.subject),l.body&&(ge.body=l.body);var $e=[];for(var te in ge)ge[te]!==vn[te]&&$e.push(te.replace(yr,aa).replace(yr,o).replace(pt,V)+"="+ge[te].replace(yr,aa).replace(yr,o).replace(xn,V));return $e.length&&($.query=$e.join("&")),$}},wn=/^([^\:]+)\:(.*)/,gt={scheme:"urn",parse:function(l,v){var $=l.path&&l.path.match(wn),R=l;if($){var J=v.scheme||R.scheme||"urn",W=$[1].toLowerCase(),he=$[2],ye=J+":"+(v.nid||W),Re=j[ye];R.nid=W,R.nss=he,R.path=void 0,Re&&(R=Re.parse(R,v))}else R.error=R.error||"URN can not be parsed.";return R},serialize:function(l,v){var $=v.scheme||l.scheme||"urn",R=l.nid,J=$+":"+(v.nid||R),W=j[J];W&&(l=W.serialize(l,v));var he=l,ye=l.nss;return he.path=(R||v.nid)+":"+ye,he}},Rn=/^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/,yt={scheme:"urn:uuid",parse:function(l,v){var $=l;return $.uuid=$.nss,$.nss=void 0,!v.tolerant&&(!$.uuid||!$.uuid.match(Rn))&&($.error=$.error||"UUID is not valid."),$},serialize:function(l,v){var $=l;return $.nss=(l.uuid||"").toLowerCase(),$}};j[xr.scheme]=xr,j[ft.scheme]=ft,j[wr.scheme]=wr,j[ht.scheme]=ht,j[vt.scheme]=vt,j[gt.scheme]=gt,j[yt.scheme]=yt,a.SCHEMES=j,a.pctEncChar=V,a.pctDecChars=ee,a.parse=pe,a.removeDotSegments=be,a.serialize=we,a.resolveComponents=qe,a.resolve=Nr,a.normalize=ea,a.equal=ra,a.escapeComponent=pn,a.unescapeComponent=rr,Object.defineProperty(a,"__esModule",{value:!0})})}(Cr,Cr.exports)),Cr.exports}var pa,es;function va(){return es||(es=1,pa=function n(e,a){if(e===a)return!0;if(e&&a&&typeof e=="object"&&typeof a=="object"){if(e.constructor!==a.constructor)return!1;var t,r,s;if(Array.isArray(e)){if(t=e.length,t!=a.length)return!1;for(r=t;r--!==0;)if(!n(e[r],a[r]))return!1;return!0}if(e.constructor===RegExp)return e.source===a.source&&e.flags===a.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===a.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===a.toString();if(s=Object.keys(e),t=s.length,t!==Object.keys(a).length)return!1;for(r=t;r--!==0;)if(!Object.prototype.hasOwnProperty.call(a,s[r]))return!1;for(r=t;r--!==0;){var o=s[r];if(!n(e[o],a[o]))return!1}return!0}return e!==e&&a!==a}),pa}var ga,rs;function mo(){return rs||(rs=1,ga=function(e){for(var a=0,t=e.length,r=0,s;r<t;)a++,s=e.charCodeAt(r++),s>=55296&&s<=56319&&r<t&&(s=e.charCodeAt(r),(s&64512)==56320&&r++);return a}),ga}var ya,as;function Sr(){if(as)return ya;as=1,ya={copy:n,checkDataType:e,checkDataTypes:a,coerceToTypes:r,toHash:s,getProperty:d,escapeQuotes:f,equal:va(),ucs2length:mo(),varOccurences:m,varReplace:p,schemaHasRules:_,schemaHasRulesExcept:u,schemaUnknownRules:c,toQuotedString:y,getPathExpr:g,getPath:P,getData:E,unescapeFragment:k,unescapeJsonPointer:A,escapeFragment:I,escapeJsonPointer:D};function n(S,w){w=w||{};for(var C in S)w[C]=S[C];return w}function e(S,w,C,L){var q=L?" !== ":" === ",K=L?" || ":" && ",se=L?"!":"",G=L?"":"!";switch(S){case"null":return w+q+"null";case"array":return se+"Array.isArray("+w+")";case"object":return"("+se+w+K+"typeof "+w+q+'"object"'+K+G+"Array.isArray("+w+"))";case"integer":return"(typeof "+w+q+'"number"'+K+G+"("+w+" % 1)"+K+w+q+w+(C?K+se+"isFinite("+w+")":"")+")";case"number":return"(typeof "+w+q+'"'+S+'"'+(C?K+se+"isFinite("+w+")":"")+")";default:return"typeof "+w+q+'"'+S+'"'}}function a(S,w,C){switch(S.length){case 1:return e(S[0],w,C,!0);default:var L="",q=s(S);q.array&&q.object&&(L=q.null?"(":"(!"+w+" || ",L+="typeof "+w+' !== "object")',delete q.null,delete q.array,delete q.object),q.number&&delete q.integer;for(var K in q)L+=(L?" && ":"")+e(K,w,C,!0);return L}}var t=s(["string","number","integer","boolean","null"]);function r(S,w){if(Array.isArray(w)){for(var C=[],L=0;L<w.length;L++){var q=w[L];(t[q]||S==="array"&&q==="array")&&(C[C.length]=q)}if(C.length)return C}else{if(t[w])return[w];if(S==="array"&&w==="array")return["array"]}}function s(S){for(var w={},C=0;C<S.length;C++)w[S[C]]=!0;return w}var o=/^[a-z$_][a-z$_0-9]*$/i,i=/'|\\/g;function d(S){return typeof S=="number"?"["+S+"]":o.test(S)?"."+S:"['"+f(S)+"']"}function f(S){return S.replace(i,"\\$&").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\f/g,"\\f").replace(/\t/g,"\\t")}function m(S,w){w+="[^0-9]";var C=S.match(new RegExp(w,"g"));return C?C.length:0}function p(S,w,C){return w+="([^0-9])",C=C.replace(/\$/g,"$$$$"),S.replace(new RegExp(w,"g"),C+"$1")}function _(S,w){if(typeof S=="boolean")return!S;for(var C in S)if(w[C])return!0}function u(S,w,C){if(typeof S=="boolean")return!S&&C!="not";for(var L in S)if(L!=C&&w[L])return!0}function c(S,w){if(typeof S!="boolean"){for(var C in S)if(!w[C])return C}}function y(S){return"'"+f(S)+"'"}function g(S,w,C,L){var q=C?"'/' + "+w+(L?"":".replace(/~/g, '~0').replace(/\\//g, '~1')"):L?"'[' + "+w+" + ']'":"'[\\'' + "+w+" + '\\']'";return x(S,q)}function P(S,w,C){var L=y(C?"/"+D(w):d(w));return x(S,L)}var T=/^\/(?:[^~]|~0|~1)*$/,O=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function E(S,w,C){var L,q,K,se;if(S==="")return"rootData";if(S[0]=="/"){if(!T.test(S))throw new Error("Invalid JSON-pointer: "+S);q=S,K="rootData"}else{if(se=S.match(O),!se)throw new Error("Invalid JSON-pointer: "+S);if(L=+se[1],q=se[2],q=="#"){if(L>=w)throw new Error("Cannot access property/index "+L+" levels up, current level is "+w);return C[w-L]}if(L>w)throw new Error("Cannot access data "+L+" levels up, current level is "+w);if(K="data"+(w-L||""),!q)return K}for(var G=K,le=q.split("/"),re=0;re<le.length;re++){var ae=le[re];ae&&(K+=d(A(ae)),G+=" && "+K)}return G}function x(S,w){return S=='""'?w:(S+" + "+w).replace(/([^\\])' \+ '/g,"$1")}function k(S){return A(decodeURIComponent(S))}function I(S){return encodeURIComponent(D(S))}function D(S){return S.replace(/~/g,"~0").replace(/\//g,"~1")}function A(S){return S.replace(/~1/g,"/").replace(/~0/g,"~")}return ya}var _a,ts;function ss(){if(ts)return _a;ts=1;var n=Sr();_a=e;function e(a){n.copy(a,this)}return _a}var Pa={exports:{}},ns;function po(){if(ns)return Pa.exports;ns=1;var n=Pa.exports=function(t,r,s){typeof r=="function"&&(s=r,r={}),s=r.cb||s;var o=typeof s=="function"?s:s.pre||function(){},i=s.post||function(){};e(r,o,i,t,"",t)};n.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0},n.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0},n.propsKeywords={definitions:!0,properties:!0,patternProperties:!0,dependencies:!0},n.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0};function e(t,r,s,o,i,d,f,m,p,_){if(o&&typeof o=="object"&&!Array.isArray(o)){r(o,i,d,f,m,p,_);for(var u in o){var c=o[u];if(Array.isArray(c)){if(u in n.arrayKeywords)for(var y=0;y<c.length;y++)e(t,r,s,c[y],i+"/"+u+"/"+y,d,i,u,o,y)}else if(u in n.propsKeywords){if(c&&typeof c=="object")for(var g in c)e(t,r,s,c[g],i+"/"+u+"/"+a(g),d,i,u,o,g)}else(u in n.keywords||t.allKeys&&!(u in n.skipKeywords))&&e(t,r,s,c,i+"/"+u,d,i,u,o)}s(o,i,d,f,m,p,_)}}function a(t){return t.replace(/~/g,"~0").replace(/\//g,"~1")}return Pa.exports}var Ea,is;function Sa(){if(is)return Ea;is=1;var n=ho(),e=va(),a=Sr(),t=ss(),r=po();Ea=s,s.normalizeId=P,s.fullPath=c,s.url=T,s.ids=O,s.inlineRef=p,s.schema=o;function s(E,x,k){var I=this._refs[k];if(typeof I=="string")if(this._refs[I])I=this._refs[I];else return s.call(this,E,x,I);if(I=I||this._schemas[k],I instanceof t)return p(I.schema,this._opts.inlineRefs)?I.schema:I.validate||this._compile(I);var D=o.call(this,x,k),A,S,w;return D&&(A=D.schema,x=D.root,w=D.baseId),A instanceof t?S=A.validate||E.call(this,A.schema,x,void 0,w):A!==void 0&&(S=p(A,this._opts.inlineRefs)?A:E.call(this,A,x,void 0,w)),S}function o(E,x){var k=n.parse(x),I=y(k),D=c(this._getId(E.schema));if(Object.keys(E.schema).length===0||I!==D){var A=P(I),S=this._refs[A];if(typeof S=="string")return i.call(this,E,S,k);if(S instanceof t)S.validate||this._compile(S),E=S;else if(S=this._schemas[A],S instanceof t){if(S.validate||this._compile(S),A==P(x))return{schema:S,root:E,baseId:D};E=S}else return;if(!E.schema)return;D=c(this._getId(E.schema))}return f.call(this,k,D,E.schema,E)}function i(E,x,k){var I=o.call(this,E,x);if(I){var D=I.schema,A=I.baseId;E=I.root;var S=this._getId(D);return S&&(A=T(A,S)),f.call(this,k,A,D,E)}}var d=a.toHash(["properties","patternProperties","enum","dependencies","definitions"]);function f(E,x,k,I){if(E.fragment=E.fragment||"",E.fragment.slice(0,1)=="/"){for(var D=E.fragment.split("/"),A=1;A<D.length;A++){var S=D[A];if(S){if(S=a.unescapeFragment(S),k=k[S],k===void 0)break;var w;if(!d[S]&&(w=this._getId(k),w&&(x=T(x,w)),k.$ref)){var C=T(x,k.$ref),L=o.call(this,I,C);L&&(k=L.schema,I=L.root,x=L.baseId)}}}if(k!==void 0&&k!==I.schema)return{schema:k,root:I,baseId:x}}}var m=a.toHash(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum"]);function p(E,x){if(x===!1)return!1;if(x===void 0||x===!0)return _(E);if(x)return u(E)<=x}function _(E){var x;if(Array.isArray(E)){for(var k=0;k<E.length;k++)if(x=E[k],typeof x=="object"&&!_(x))return!1}else for(var I in E)if(I=="$ref"||(x=E[I],typeof x=="object"&&!_(x)))return!1;return!0}function u(E){var x=0,k;if(Array.isArray(E)){for(var I=0;I<E.length;I++)if(k=E[I],typeof k=="object"&&(x+=u(k)),x==1/0)return 1/0}else for(var D in E){if(D=="$ref")return 1/0;if(m[D])x++;else if(k=E[D],typeof k=="object"&&(x+=u(k)+1),x==1/0)return 1/0}return x}function c(E,x){x!==!1&&(E=P(E));var k=n.parse(E);return y(k)}function y(E){return n.serialize(E).split("#")[0]+"#"}var g=/#\/?$/;function P(E){return E?E.replace(g,""):""}function T(E,x){return x=P(x),n.resolve(E,x)}function O(E){var x=P(this._getId(E)),k={"":x},I={"":c(x,!1)},D={},A=this;return r(E,{allKeys:!0},function(S,w,C,L,q,K,se){if(w!==""){var G=A._getId(S),le=k[L],re=I[L]+"/"+q;if(se!==void 0&&(re+="/"+(typeof se=="number"?se:a.escapeFragment(se))),typeof G=="string"){G=le=P(le?n.resolve(le,G):G);var ae=A._refs[G];if(typeof ae=="string"&&(ae=A._refs[ae]),ae&&ae.schema){if(!e(S,ae.schema))throw new Error('id "'+G+'" resolves to more than one schema')}else if(G!=P(re))if(G[0]=="#"){if(D[G]&&!e(S,D[G]))throw new Error('id "'+G+'" resolves to more than one schema');D[G]=S}else A._refs[G]=re}k[w]=le,I[w]=re}}),D}return Ea}var ba,os;function xa(){if(os)return ba;os=1;var n=Sa();ba={Validation:t(e),MissingRef:t(a)};function e(r){this.message="validation failed",this.errors=r,this.ajv=this.validation=!0}a.message=function(r,s){return"can't resolve reference "+s+" from id "+r};function a(r,s,o){this.message=o||a.message(r,s),this.missingRef=n.url(r,s),this.missingSchema=n.normalizeId(n.fullPath(this.missingRef))}function t(r){return r.prototype=Object.create(Error.prototype),r.prototype.constructor=r,r}return ba}var wa,ls;function us(){return ls||(ls=1,wa=function(n,e){e||(e={}),typeof e=="function"&&(e={cmp:e});var a=typeof e.cycles=="boolean"?e.cycles:!1,t=e.cmp&&function(s){return function(o){return function(i,d){var f={key:i,value:o[i]},m={key:d,value:o[d]};return s(f,m)}}}(e.cmp),r=[];return function s(o){if(o&&o.toJSON&&typeof o.toJSON=="function"&&(o=o.toJSON()),o!==void 0){if(typeof o=="number")return isFinite(o)?""+o:"null";if(typeof o!="object")return JSON.stringify(o);var i,d;if(Array.isArray(o)){for(d="[",i=0;i<o.length;i++)i&&(d+=","),d+=s(o[i])||"null";return d+"]"}if(o===null)return"null";if(r.indexOf(o)!==-1){if(a)return JSON.stringify("__cycle__");throw new TypeError("Converting circular structure to JSON")}var f=r.push(o)-1,m=Object.keys(o).sort(t&&t(o));for(d="",i=0;i<m.length;i++){var p=m[i],_=s(o[p]);_&&(d&&(d+=","),d+=JSON.stringify(p)+":"+_)}return r.splice(f,1),"{"+d+"}"}}(n)}),wa}var Ra,cs;function fs(){return cs||(cs=1,Ra=function(e,a,t){var r="",s=e.schema.$async===!0,o=e.util.schemaHasRulesExcept(e.schema,e.RULES.all,"$ref"),i=e.self._getId(e.schema);if(e.opts.strictKeywords){var d=e.util.schemaUnknownRules(e.schema,e.RULES.keywords);if(d){var f="unknown keyword: "+d;if(e.opts.strictKeywords==="log")e.logger.warn(f);else throw new Error(f)}}if(e.isTop&&(r+=" var validate = ",s&&(e.async=!0,r+="async "),r+="function(data, dataPath, parentData, parentDataProperty, rootData) { 'use strict'; ",i&&(e.opts.sourceCode||e.opts.processCode)&&(r+=" "+("/*# sourceURL="+i+" */")+" ")),typeof e.schema=="boolean"||!(o||e.schema.$ref)){var a="false schema",m=e.level,p=e.dataLevel,_=e.schema[a],u=e.schemaPath+e.util.getProperty(a),c=e.errSchemaPath+"/"+a,x=!e.opts.allErrors,D,y="data"+(p||""),E="valid"+m;if(e.schema===!1){e.isTop?x=!0:r+=" var "+E+" = false; ";var g=g||[];g.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(D||"false schema")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: {} ",e.opts.messages!==!1&&(r+=" , message: 'boolean schema is false' "),e.opts.verbose&&(r+=" , schema: false , parentSchema: validate.schema"+e.schemaPath+" , data: "+y+" "),r+=" } "):r+=" {} ";var P=r;r=g.pop(),!e.compositeRule&&x?e.async?r+=" throw new ValidationError(["+P+"]); ":r+=" validate.errors = ["+P+"]; return false; ":r+=" var err = "+P+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}else e.isTop?s?r+=" return data; ":r+=" validate.errors = null; return true; ":r+=" var "+E+" = true; ";return e.isTop&&(r+=" }; return validate; "),r}if(e.isTop){var T=e.isTop,m=e.level=0,p=e.dataLevel=0,y="data";if(e.rootId=e.resolve.fullPath(e.self._getId(e.root.schema)),e.baseId=e.baseId||e.rootId,delete e.isTop,e.dataPathArr=[""],e.schema.default!==void 0&&e.opts.useDefaults&&e.opts.strictDefaults){var O="default is ignored in the schema root";if(e.opts.strictDefaults==="log")e.logger.warn(O);else throw new Error(O)}r+=" var vErrors = null; ",r+=" var errors = 0; ",r+=" if (rootData === undefined) rootData = data; "}else{var m=e.level,p=e.dataLevel,y="data"+(p||"");if(i&&(e.baseId=e.resolve.url(e.baseId,i)),s&&!e.async)throw new Error("async schema in sync schema");r+=" var errs_"+m+" = errors;"}var E="valid"+m,x=!e.opts.allErrors,k="",I="",D,A=e.schema.type,S=Array.isArray(A);if(A&&e.opts.nullable&&e.schema.nullable===!0&&(S?A.indexOf("null")==-1&&(A=A.concat("null")):A!="null"&&(A=[A,"null"],S=!0)),S&&A.length==1&&(A=A[0],S=!1),e.schema.$ref&&o){if(e.opts.extendRefs=="fail")throw new Error('$ref: validation keywords used in schema at path "'+e.errSchemaPath+'" (see option extendRefs)');e.opts.extendRefs!==!0&&(o=!1,e.logger.warn('$ref: keywords ignored in schema at path "'+e.errSchemaPath+'"'))}if(e.schema.$comment&&e.opts.$comment&&(r+=" "+e.RULES.all.$comment.code(e,"$comment")),A){if(e.opts.coerceTypes)var w=e.util.coerceToTypes(e.opts.coerceTypes,A);var C=e.RULES.types[A];if(w||S||C===!0||C&&!Se(C)){var u=e.schemaPath+".type",c=e.errSchemaPath+"/type",u=e.schemaPath+".type",c=e.errSchemaPath+"/type",L=S?"checkDataTypes":"checkDataType";if(r+=" if ("+e.util[L](A,y,e.opts.strictNumbers,!0)+") { ",w){var q="dataType"+m,K="coerced"+m;r+=" var "+q+" = typeof "+y+"; var "+K+" = undefined; ",e.opts.coerceTypes=="array"&&(r+=" if ("+q+" == 'object' && Array.isArray("+y+") && "+y+".length == 1) { "+y+" = "+y+"[0]; "+q+" = typeof "+y+"; if ("+e.util.checkDataType(e.schema.type,y,e.opts.strictNumbers)+") "+K+" = "+y+"; } "),r+=" if ("+K+" !== undefined) ; ";var se=w;if(se)for(var G,le=-1,re=se.length-1;le<re;)G=se[le+=1],G=="string"?r+=" else if ("+q+" == 'number' || "+q+" == 'boolean') "+K+" = '' + "+y+"; else if ("+y+" === null) "+K+" = ''; ":G=="number"||G=="integer"?(r+=" else if ("+q+" == 'boolean' || "+y+" === null || ("+q+" == 'string' && "+y+" && "+y+" == +"+y+" ",G=="integer"&&(r+=" && !("+y+" % 1)"),r+=")) "+K+" = +"+y+"; "):G=="boolean"?r+=" else if ("+y+" === 'false' || "+y+" === 0 || "+y+" === null) "+K+" = false; else if ("+y+" === 'true' || "+y+" === 1) "+K+" = true; ":G=="null"?r+=" else if ("+y+" === '' || "+y+" === 0 || "+y+" === false) "+K+" = null; ":e.opts.coerceTypes=="array"&&G=="array"&&(r+=" else if ("+q+" == 'string' || "+q+" == 'number' || "+q+" == 'boolean' || "+y+" == null) "+K+" = ["+y+"]; ");r+=" else { ";var g=g||[];g.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(D||"type")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { type: '",S?r+=""+A.join(","):r+=""+A,r+="' } ",e.opts.messages!==!1&&(r+=" , message: 'should be ",S?r+=""+A.join(","):r+=""+A,r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+u+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+y+" "),r+=" } "):r+=" {} ";var P=r;r=g.pop(),!e.compositeRule&&x?e.async?r+=" throw new ValidationError(["+P+"]); ":r+=" validate.errors = ["+P+"]; return false; ":r+=" var err = "+P+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } if ("+K+" !== undefined) { ";var ae=p?"data"+(p-1||""):"parentData",Te=p?e.dataPathArr[p]:"parentDataProperty";r+=" "+y+" = "+K+"; ",p||(r+="if ("+ae+" !== undefined)"),r+=" "+ae+"["+Te+"] = "+K+"; } "}else{var g=g||[];g.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(D||"type")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { type: '",S?r+=""+A.join(","):r+=""+A,r+="' } ",e.opts.messages!==!1&&(r+=" , message: 'should be ",S?r+=""+A.join(","):r+=""+A,r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+u+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+y+" "),r+=" } "):r+=" {} ";var P=r;r=g.pop(),!e.compositeRule&&x?e.async?r+=" throw new ValidationError(["+P+"]); ":r+=" validate.errors = ["+P+"]; return false; ":r+=" var err = "+P+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}r+=" } "}}if(e.schema.$ref&&!o)r+=" "+e.RULES.all.$ref.code(e,"$ref")+" ",x&&(r+=" } if (errors === ",T?r+="0":r+="errs_"+m,r+=") { ",I+="}");else{var Ae=e.RULES;if(Ae){for(var C,Ie=-1,xe=Ae.length-1;Ie<xe;)if(C=Ae[Ie+=1],Se(C)){if(C.type&&(r+=" if ("+e.util.checkDataType(C.type,y,e.opts.strictNumbers)+") { "),e.opts.useDefaults){if(C.type=="object"&&e.schema.properties){var _=e.schema.properties,Ve=Object.keys(_),b=Ve;if(b)for(var j,V=-1,ee=b.length-1;V<ee;){j=b[V+=1];var N=_[j];if(N.default!==void 0){var z=y+e.util.getProperty(j);if(e.compositeRule){if(e.opts.strictDefaults){var O="default is ignored for: "+z;if(e.opts.strictDefaults==="log")e.logger.warn(O);else throw new Error(O)}}else r+=" if ("+z+" === undefined ",e.opts.useDefaults=="empty"&&(r+=" || "+z+" === null || "+z+" === '' "),r+=" ) "+z+" = ",e.opts.useDefaults=="shared"?r+=" "+e.useDefault(N.default)+" ":r+=" "+JSON.stringify(N.default)+" ",r+="; "}}}else if(C.type=="array"&&Array.isArray(e.schema.items)){var ie=e.schema.items;if(ie){for(var N,le=-1,fe=ie.length-1;le<fe;)if(N=ie[le+=1],N.default!==void 0){var z=y+"["+le+"]";if(e.compositeRule){if(e.opts.strictDefaults){var O="default is ignored for: "+z;if(e.opts.strictDefaults==="log")e.logger.warn(O);else throw new Error(O)}}else r+=" if ("+z+" === undefined ",e.opts.useDefaults=="empty"&&(r+=" || "+z+" === null || "+z+" === '' "),r+=" ) "+z+" = ",e.opts.useDefaults=="shared"?r+=" "+e.useDefault(N.default)+" ":r+=" "+JSON.stringify(N.default)+" ",r+="; "}}}}var ue=C.rules;if(ue){for(var _e,pe=-1,ve=ue.length-1;pe<ve;)if(_e=ue[pe+=1],He(_e)){var Ce=_e.code(e,_e.keyword,C.type);Ce&&(r+=" "+Ce+" ",x&&(k+="}"))}}if(x&&(r+=" "+k+" ",k=""),C.type&&(r+=" } ",A&&A===C.type&&!w)){r+=" else { ";var u=e.schemaPath+".type",c=e.errSchemaPath+"/type",g=g||[];g.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(D||"type")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { type: '",S?r+=""+A.join(","):r+=""+A,r+="' } ",e.opts.messages!==!1&&(r+=" , message: 'should be ",S?r+=""+A.join(","):r+=""+A,r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+u+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+y+" "),r+=" } "):r+=" {} ";var P=r;r=g.pop(),!e.compositeRule&&x?e.async?r+=" throw new ValidationError(["+P+"]); ":r+=" validate.errors = ["+P+"]; return false; ":r+=" var err = "+P+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } "}x&&(r+=" if (errors === ",T?r+="0":r+="errs_"+m,r+=") { ",I+="}")}}}x&&(r+=" "+I+" "),T?(s?(r+=" if (errors === 0) return data; ",r+=" else throw new ValidationError(vErrors); "):(r+=" validate.errors = vErrors; ",r+=" return errors === 0; "),r+=" }; return validate;"):r+=" var "+E+" = errors === errs_"+m+";";function Se(be){for(var we=be.rules,qe=0;qe<we.length;qe++)if(He(we[qe]))return!0}function He(be){return e.schema[be.keyword]!==void 0||be.implements&&je(be)}function je(be){for(var we=be.implements,qe=0;qe<we.length;qe++)if(e.schema[we[qe]]!==void 0)return!0}return r}),Ra}var $a,ds;function vo(){if(ds)return $a;ds=1;var n=Sa(),e=Sr(),a=xa(),t=us(),r=fs(),s=e.ucs2length,o=va(),i=a.Validation;$a=d;function d(P,T,O,E){var x=this,k=this._opts,I=[void 0],D={},A=[],S={},w=[],C={},L=[];T=T||{schema:P,refVal:I,refs:D};var q=f.call(this,P,T,E),K=this._compilations[q.index];if(q.compiling)return K.callValidate=ae;var se=this._formats,G=this.RULES;try{var le=Te(P,T,O,E);K.validate=le;var re=K.callValidate;return re&&(re.schema=le.schema,re.errors=null,re.refs=le.refs,re.refVal=le.refVal,re.root=le.root,re.$async=le.$async,k.sourceCode&&(re.source=le.source)),le}finally{m.call(this,P,T,E)}function ae(){var N=K.validate,z=N.apply(this,arguments);return ae.errors=N.errors,z}function Te(N,z,ie,fe){var ue=!z||z&&z.schema==N;if(z.schema!=T.schema)return d.call(x,N,z,ie,fe);var _e=N.$async===!0,pe=r({isTop:!0,schema:N,isRoot:ue,baseId:fe,root:z,schemaPath:"",errSchemaPath:"#",errorPath:'""',MissingRefError:a.MissingRef,RULES:G,validate:r,util:e,resolve:n,resolveRef:Ae,usePattern:j,useDefault:V,useCustomRule:ee,opts:k,formats:se,logger:x.logger,self:x});pe=g(I,c)+g(A,_)+g(w,u)+g(L,y)+pe,k.processCode&&(pe=k.processCode(pe,N));var ve;try{var Ce=new Function("self","RULES","formats","root","refVal","defaults","customRules","equal","ucs2length","ValidationError",pe);ve=Ce(x,G,se,T,I,w,L,o,s,i),I[0]=ve}catch(Se){throw x.logger.error("Error compiling schema, function code:",pe),Se}return ve.schema=N,ve.errors=null,ve.refs=D,ve.refVal=I,ve.root=ue?ve:z,_e&&(ve.$async=!0),k.sourceCode===!0&&(ve.source={code:pe,patterns:A,defaults:w}),ve}function Ae(N,z,ie){z=n.url(N,z);var fe=D[z],ue,_e;if(fe!==void 0)return ue=I[fe],_e="refVal["+fe+"]",b(ue,_e);if(!ie&&T.refs){var pe=T.refs[z];if(pe!==void 0)return ue=T.refVal[pe],_e=Ie(z,ue),b(ue,_e)}_e=Ie(z);var ve=n.call(x,Te,T,z);if(ve===void 0){var Ce=O&&O[z];Ce&&(ve=n.inlineRef(Ce,k.inlineRefs)?Ce:d.call(x,Ce,T,O,N))}if(ve===void 0)xe(z);else return Ve(z,ve),b(ve,_e)}function Ie(N,z){var ie=I.length;return I[ie]=z,D[N]=ie,"refVal"+ie}function xe(N){delete D[N]}function Ve(N,z){var ie=D[N];I[ie]=z}function b(N,z){return typeof N=="object"||typeof N=="boolean"?{code:z,schema:N,inline:!0}:{code:z,$async:N&&!!N.$async}}function j(N){var z=S[N];return z===void 0&&(z=S[N]=A.length,A[z]=N),"pattern"+z}function V(N){switch(typeof N){case"boolean":case"number":return""+N;case"string":return e.toQuotedString(N);case"object":if(N===null)return"null";var z=t(N),ie=C[z];return ie===void 0&&(ie=C[z]=w.length,w[ie]=N),"default"+ie}}function ee(N,z,ie,fe){if(x._opts.validateSchema!==!1){var ue=N.definition.dependencies;if(ue&&!ue.every(function(we){return Object.prototype.hasOwnProperty.call(ie,we)}))throw new Error("parent schema must have all required keywords: "+ue.join(","));var _e=N.definition.validateSchema;if(_e){var pe=_e(z);if(!pe){var ve="keyword schema is invalid: "+x.errorsText(_e.errors);if(x._opts.validateSchema=="log")x.logger.error(ve);else throw new Error(ve)}}}var Ce=N.definition.compile,Se=N.definition.inline,He=N.definition.macro,je;if(Ce)je=Ce.call(x,z,ie,fe);else if(He)je=He.call(x,z,ie,fe),k.validateSchema!==!1&&x.validateSchema(je,!0);else if(Se)je=Se.call(x,fe,N.keyword,z,ie);else if(je=N.definition.validate,!je)return;if(je===void 0)throw new Error('custom keyword "'+N.keyword+'"failed to compile');var be=L.length;return L[be]=je,{code:"customRule"+be,validate:je}}}function f(P,T,O){var E=p.call(this,P,T,O);return E>=0?{index:E,compiling:!0}:(E=this._compilations.length,this._compilations[E]={schema:P,root:T,baseId:O},{index:E,compiling:!1})}function m(P,T,O){var E=p.call(this,P,T,O);E>=0&&this._compilations.splice(E,1)}function p(P,T,O){for(var E=0;E<this._compilations.length;E++){var x=this._compilations[E];if(x.schema==P&&x.root==T&&x.baseId==O)return E}return-1}function _(P,T){return"var pattern"+P+" = new RegExp("+e.toQuotedString(T[P])+");"}function u(P){return"var default"+P+" = defaults["+P+"];"}function c(P,T){return T[P]===void 0?"":"var refVal"+P+" = refVal["+P+"];"}function y(P){return"var customRule"+P+" = customRules["+P+"];"}function g(P,T){if(!P.length)return"";for(var O="",E=0;E<P.length;E++)O+=T(E,P);return O}return $a}var Oa={exports:{}},hs;function go(){if(hs)return Oa.exports;hs=1;var n=Oa.exports=function(){this._cache={}};return n.prototype.put=function(a,t){this._cache[a]=t},n.prototype.get=function(a){return this._cache[a]},n.prototype.del=function(a){delete this._cache[a]},n.prototype.clear=function(){this._cache={}},Oa.exports}var ka,ms;function yo(){if(ms)return ka;ms=1;var n=Sr(),e=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,a=[0,31,28,31,30,31,30,31,31,30,31,30,31],t=/^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i,r=/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,s=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,o=/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,i=/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,d=/^(?:(?:http[s\u017F]?|ftp):\/\/)(?:(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+(?::(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?@)?(?:(?!10(?:\.[0-9]{1,3}){3})(?!127(?:\.[0-9]{1,3}){3})(?!169\.254(?:\.[0-9]{1,3}){2})(?!192\.168(?:\.[0-9]{1,3}){2})(?!172\.(?:1[6-9]|2[0-9]|3[01])(?:\.[0-9]{1,3}){2})(?:[1-9][0-9]?|1[0-9][0-9]|2[01][0-9]|22[0-3])(?:\.(?:1?[0-9]{1,2}|2[0-4][0-9]|25[0-5])){2}(?:\.(?:[1-9][0-9]?|1[0-9][0-9]|2[0-4][0-9]|25[0-4]))|(?:(?:(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-)*(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)(?:\.(?:(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-)*(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)*(?:\.(?:(?:[a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]){2,})))(?::[0-9]{2,5})?(?:\/(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?$/i,f=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,m=/^(?:\/(?:[^~/]|~0|~1)*)*$/,p=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,_=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/;ka=u;function u(I){return I=I=="full"?"full":"fast",n.copy(u[I])}u.fast={date:/^\d\d\d\d-[0-1]\d-[0-3]\d$/,time:/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,"date-time":/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,"uri-template":i,url:d,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i,hostname:r,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,ipv6:/^\s*(?:(?:(?:[0-9a-f]{1,4}:){7}(?:[0-9a-f]{1,4}|:))|(?:(?:[0-9a-f]{1,4}:){6}(?::[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){5}(?:(?:(?::[0-9a-f]{1,4}){1,2})|:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){4}(?:(?:(?::[0-9a-f]{1,4}){1,3})|(?:(?::[0-9a-f]{1,4})?:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){3}(?:(?:(?::[0-9a-f]{1,4}){1,4})|(?:(?::[0-9a-f]{1,4}){0,2}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){2}(?:(?:(?::[0-9a-f]{1,4}){1,5})|(?:(?::[0-9a-f]{1,4}){0,3}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){1}(?:(?:(?::[0-9a-f]{1,4}){1,6})|(?:(?::[0-9a-f]{1,4}){0,4}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?::(?:(?:(?::[0-9a-f]{1,4}){1,7})|(?:(?::[0-9a-f]{1,4}){0,5}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(?:%.+)?\s*$/i,regex:k,uuid:f,"json-pointer":m,"json-pointer-uri-fragment":p,"relative-json-pointer":_},u.full={date:y,time:g,"date-time":T,uri:E,"uri-reference":o,"uri-template":i,url:d,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:r,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,ipv6:/^\s*(?:(?:(?:[0-9a-f]{1,4}:){7}(?:[0-9a-f]{1,4}|:))|(?:(?:[0-9a-f]{1,4}:){6}(?::[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){5}(?:(?:(?::[0-9a-f]{1,4}){1,2})|:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){4}(?:(?:(?::[0-9a-f]{1,4}){1,3})|(?:(?::[0-9a-f]{1,4})?:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){3}(?:(?:(?::[0-9a-f]{1,4}){1,4})|(?:(?::[0-9a-f]{1,4}){0,2}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){2}(?:(?:(?::[0-9a-f]{1,4}){1,5})|(?:(?::[0-9a-f]{1,4}){0,3}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){1}(?:(?:(?::[0-9a-f]{1,4}){1,6})|(?:(?::[0-9a-f]{1,4}){0,4}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?::(?:(?:(?::[0-9a-f]{1,4}){1,7})|(?:(?::[0-9a-f]{1,4}){0,5}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(?:%.+)?\s*$/i,regex:k,uuid:f,"json-pointer":m,"json-pointer-uri-fragment":p,"relative-json-pointer":_};function c(I){return I%4===0&&(I%100!==0||I%400===0)}function y(I){var D=I.match(e);if(!D)return!1;var A=+D[1],S=+D[2],w=+D[3];return S>=1&&S<=12&&w>=1&&w<=(S==2&&c(A)?29:a[S])}function g(I,D){var A=I.match(t);if(!A)return!1;var S=A[1],w=A[2],C=A[3],L=A[5];return(S<=23&&w<=59&&C<=59||S==23&&w==59&&C==60)&&(!D||L)}var P=/t|\s/i;function T(I){var D=I.split(P);return D.length==2&&y(D[0])&&g(D[1],!0)}var O=/\/|:/;function E(I){return O.test(I)&&s.test(I)}var x=/[^\\]\\Z/;function k(I){if(x.test(I))return!1;try{return new RegExp(I),!0}catch{return!1}}return ka}var Ia,ps;function _o(){return ps||(ps=1,Ia=function(e,a,t){var r=" ",s=e.level,o=e.dataLevel,i=e.schema[a],d=e.errSchemaPath+"/"+a,f=!e.opts.allErrors,m="data"+(o||""),p="valid"+s,_,u;if(i=="#"||i=="#/")e.isRoot?(_=e.async,u="validate"):(_=e.root.schema.$async===!0,u="root.refVal[0]");else{var c=e.resolveRef(e.baseId,i,e.isRoot);if(c===void 0){var y=e.MissingRefError.message(e.baseId,i);if(e.opts.missingRefs=="fail"){e.logger.error(y);var g=g||[];g.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '$ref' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(d)+" , params: { ref: '"+e.util.escapeQuotes(i)+"' } ",e.opts.messages!==!1&&(r+=" , message: 'can\\'t resolve reference "+e.util.escapeQuotes(i)+"' "),e.opts.verbose&&(r+=" , schema: "+e.util.toQuotedString(i)+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var P=r;r=g.pop(),!e.compositeRule&&f?e.async?r+=" throw new ValidationError(["+P+"]); ":r+=" validate.errors = ["+P+"]; return false; ":r+=" var err = "+P+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",f&&(r+=" if (false) { ")}else if(e.opts.missingRefs=="ignore")e.logger.warn(y),f&&(r+=" if (true) { ");else throw new e.MissingRefError(e.baseId,i,y)}else if(c.inline){var T=e.util.copy(e);T.level++;var O="valid"+T.level;T.schema=c.schema,T.schemaPath="",T.errSchemaPath=i;var E=e.validate(T).replace(/validate\.schema/g,c.code);r+=" "+E+" ",f&&(r+=" if ("+O+") { ")}else _=c.$async===!0||e.async&&c.$async!==!1,u=c.code}if(u){var g=g||[];g.push(r),r="",e.opts.passContext?r+=" "+u+".call(this, ":r+=" "+u+"( ",r+=" "+m+", (dataPath || '')",e.errorPath!='""'&&(r+=" + "+e.errorPath);var x=o?"data"+(o-1||""):"parentData",k=o?e.dataPathArr[o]:"parentDataProperty";r+=" , "+x+" , "+k+", rootData) ";var I=r;if(r=g.pop(),_){if(!e.async)throw new Error("async schema referenced by sync schema");f&&(r+=" var "+p+"; "),r+=" try { await "+I+"; ",f&&(r+=" "+p+" = true; "),r+=" } catch (e) { if (!(e instanceof ValidationError)) throw e; if (vErrors === null) vErrors = e.errors; else vErrors = vErrors.concat(e.errors); errors = vErrors.length; ",f&&(r+=" "+p+" = false; "),r+=" } ",f&&(r+=" if ("+p+") { ")}else r+=" if (!"+I+") { if (vErrors === null) vErrors = "+u+".errors; else vErrors = vErrors.concat("+u+".errors); errors = vErrors.length; } ",f&&(r+=" else { ")}return r}),Ia}var Da,vs;function Po(){return vs||(vs=1,Da=function(e,a,t){var r=" ",s=e.schema[a],o=e.schemaPath+e.util.getProperty(a),i=e.errSchemaPath+"/"+a,d=!e.opts.allErrors,f=e.util.copy(e),m="";f.level++;var p="valid"+f.level,_=f.baseId,u=!0,c=s;if(c)for(var y,g=-1,P=c.length-1;g<P;)y=c[g+=1],(e.opts.strictKeywords?typeof y=="object"&&Object.keys(y).length>0||y===!1:e.util.schemaHasRules(y,e.RULES.all))&&(u=!1,f.schema=y,f.schemaPath=o+"["+g+"]",f.errSchemaPath=i+"/"+g,r+=" "+e.validate(f)+" ",f.baseId=_,d&&(r+=" if ("+p+") { ",m+="}"));return d&&(u?r+=" if (true) { ":r+=" "+m.slice(0,-1)+" "),r}),Da}var Aa,gs;function Eo(){return gs||(gs=1,Aa=function(e,a,t){var r=" ",s=e.level,o=e.dataLevel,i=e.schema[a],d=e.schemaPath+e.util.getProperty(a),f=e.errSchemaPath+"/"+a,m=!e.opts.allErrors,p="data"+(o||""),_="valid"+s,u="errs__"+s,c=e.util.copy(e),y="";c.level++;var g="valid"+c.level,P=i.every(function(D){return e.opts.strictKeywords?typeof D=="object"&&Object.keys(D).length>0||D===!1:e.util.schemaHasRules(D,e.RULES.all)});if(P){var T=c.baseId;r+=" var "+u+" = errors; var "+_+" = false; ";var O=e.compositeRule;e.compositeRule=c.compositeRule=!0;var E=i;if(E)for(var x,k=-1,I=E.length-1;k<I;)x=E[k+=1],c.schema=x,c.schemaPath=d+"["+k+"]",c.errSchemaPath=f+"/"+k,r+=" "+e.validate(c)+" ",c.baseId=T,r+=" "+_+" = "+_+" || "+g+"; if (!"+_+") { ",y+="}";e.compositeRule=c.compositeRule=O,r+=" "+y+" if (!"+_+") { var err = ",e.createErrors!==!1?(r+=" { keyword: 'anyOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: {} ",e.opts.messages!==!1&&(r+=" , message: 'should match some schema in anyOf' "),e.opts.verbose&&(r+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&m&&(e.async?r+=" throw new ValidationError(vErrors); ":r+=" validate.errors = vErrors; return false; "),r+=" } else { errors = "+u+"; if (vErrors !== null) { if ("+u+") vErrors.length = "+u+"; else vErrors = null; } ",e.opts.allErrors&&(r+=" } ")}else m&&(r+=" if (true) { ");return r}),Aa}var Ca,ys;function So(){return ys||(ys=1,Ca=function(e,a,t){var r=" ",s=e.schema[a],o=e.errSchemaPath+"/"+a;e.opts.allErrors;var i=e.util.toQuotedString(s);return e.opts.$comment===!0?r+=" console.log("+i+");":typeof e.opts.$comment=="function"&&(r+=" self._opts.$comment("+i+", "+e.util.toQuotedString(o)+", validate.root.schema);"),r}),Ca}var Ta,_s;function bo(){return _s||(_s=1,Ta=function(e,a,t){var r=" ",s=e.level,o=e.dataLevel,i=e.schema[a],d=e.schemaPath+e.util.getProperty(a),f=e.errSchemaPath+"/"+a,m=!e.opts.allErrors,p="data"+(o||""),_="valid"+s,u=e.opts.$data&&i&&i.$data;u&&(r+=" var schema"+s+" = "+e.util.getData(i.$data,o,e.dataPathArr)+"; "),u||(r+=" var schema"+s+" = validate.schema"+d+";"),r+="var "+_+" = equal("+p+", schema"+s+"); if (!"+_+") { ";var c=c||[];c.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'const' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { allowedValue: schema"+s+" } ",e.opts.messages!==!1&&(r+=" , message: 'should be equal to constant' "),e.opts.verbose&&(r+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),r+=" } "):r+=" {} ";var y=r;return r=c.pop(),!e.compositeRule&&m?e.async?r+=" throw new ValidationError(["+y+"]); ":r+=" validate.errors = ["+y+"]; return false; ":r+=" var err = "+y+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" }",m&&(r+=" else { "),r}),Ta}var ja,Ps;function xo(){return Ps||(Ps=1,ja=function(e,a,t){var r=" ",s=e.level,o=e.dataLevel,i=e.schema[a],d=e.schemaPath+e.util.getProperty(a),f=e.errSchemaPath+"/"+a,m=!e.opts.allErrors,p="data"+(o||""),_="valid"+s,u="errs__"+s,c=e.util.copy(e),y="";c.level++;var g="valid"+c.level,P="i"+s,T=c.dataLevel=e.dataLevel+1,O="data"+T,E=e.baseId,x=e.opts.strictKeywords?typeof i=="object"&&Object.keys(i).length>0||i===!1:e.util.schemaHasRules(i,e.RULES.all);if(r+="var "+u+" = errors;var "+_+";",x){var k=e.compositeRule;e.compositeRule=c.compositeRule=!0,c.schema=i,c.schemaPath=d,c.errSchemaPath=f,r+=" var "+g+" = false; for (var "+P+" = 0; "+P+" < "+p+".length; "+P+"++) { ",c.errorPath=e.util.getPathExpr(e.errorPath,P,e.opts.jsonPointers,!0);var I=p+"["+P+"]";c.dataPathArr[T]=P;var D=e.validate(c);c.baseId=E,e.util.varOccurences(D,O)<2?r+=" "+e.util.varReplace(D,O,I)+" ":r+=" var "+O+" = "+I+"; "+D+" ",r+=" if ("+g+") break; } ",e.compositeRule=c.compositeRule=k,r+=" "+y+" if (!"+g+") {"}else r+=" if ("+p+".length == 0) {";var A=A||[];A.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'contains' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: {} ",e.opts.messages!==!1&&(r+=" , message: 'should contain a valid item' "),e.opts.verbose&&(r+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),r+=" } "):r+=" {} ";var S=r;return r=A.pop(),!e.compositeRule&&m?e.async?r+=" throw new ValidationError(["+S+"]); ":r+=" validate.errors = ["+S+"]; return false; ":r+=" var err = "+S+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } else { ",x&&(r+=" errors = "+u+"; if (vErrors !== null) { if ("+u+") vErrors.length = "+u+"; else vErrors = null; } "),e.opts.allErrors&&(r+=" } "),r}),ja}var Na,Es;function wo(){return Es||(Es=1,Na=function(e,a,t){var r=" ",s=e.level,o=e.dataLevel,i=e.schema[a],d=e.schemaPath+e.util.getProperty(a),f=e.errSchemaPath+"/"+a,m=!e.opts.allErrors,p="data"+(o||""),_="errs__"+s,u=e.util.copy(e),c="";u.level++;var y="valid"+u.level,g={},P={},T=e.opts.ownProperties;for(k in i)if(k!="__proto__"){var O=i[k],E=Array.isArray(O)?P:g;E[k]=O}r+="var "+_+" = errors;";var x=e.errorPath;r+="var missing"+s+";";for(var k in P)if(E=P[k],E.length){if(r+=" if ( "+p+e.util.getProperty(k)+" !== undefined ",T&&(r+=" && Object.prototype.hasOwnProperty.call("+p+", '"+e.util.escapeQuotes(k)+"') "),m){r+=" && ( ";var I=E;if(I)for(var D,A=-1,S=I.length-1;A<S;){D=I[A+=1],A&&(r+=" || ");var w=e.util.getProperty(D),C=p+w;r+=" ( ( "+C+" === undefined ",T&&(r+=" || ! Object.prototype.hasOwnProperty.call("+p+", '"+e.util.escapeQuotes(D)+"') "),r+=") && (missing"+s+" = "+e.util.toQuotedString(e.opts.jsonPointers?D:w)+") ) "}r+=")) { ";var L="missing"+s,q="' + "+L+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.opts.jsonPointers?e.util.getPathExpr(x,L,!0):x+" + "+L);var K=K||[];K.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'dependencies' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { property: '"+e.util.escapeQuotes(k)+"', missingProperty: '"+q+"', depsCount: "+E.length+", deps: '"+e.util.escapeQuotes(E.length==1?E[0]:E.join(", "))+"' } ",e.opts.messages!==!1&&(r+=" , message: 'should have ",E.length==1?r+="property "+e.util.escapeQuotes(E[0]):r+="properties "+e.util.escapeQuotes(E.join(", ")),r+=" when property "+e.util.escapeQuotes(k)+" is present' "),e.opts.verbose&&(r+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),r+=" } "):r+=" {} ";var se=r;r=K.pop(),!e.compositeRule&&m?e.async?r+=" throw new ValidationError(["+se+"]); ":r+=" validate.errors = ["+se+"]; return false; ":r+=" var err = "+se+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}else{r+=" ) { ";var G=E;if(G)for(var D,le=-1,re=G.length-1;le<re;){D=G[le+=1];var w=e.util.getProperty(D),q=e.util.escapeQuotes(D),C=p+w;e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPath(x,D,e.opts.jsonPointers)),r+=" if ( "+C+" === undefined ",T&&(r+=" || ! Object.prototype.hasOwnProperty.call("+p+", '"+e.util.escapeQuotes(D)+"') "),r+=") { var err = ",e.createErrors!==!1?(r+=" { keyword: 'dependencies' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { property: '"+e.util.escapeQuotes(k)+"', missingProperty: '"+q+"', depsCount: "+E.length+", deps: '"+e.util.escapeQuotes(E.length==1?E[0]:E.join(", "))+"' } ",e.opts.messages!==!1&&(r+=" , message: 'should have ",E.length==1?r+="property "+e.util.escapeQuotes(E[0]):r+="properties "+e.util.escapeQuotes(E.join(", ")),r+=" when property "+e.util.escapeQuotes(k)+" is present' "),e.opts.verbose&&(r+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } "}}r+=" } ",m&&(c+="}",r+=" else { ")}e.errorPath=x;var ae=u.baseId;for(var k in g){var O=g[k];(e.opts.strictKeywords?typeof O=="object"&&Object.keys(O).length>0||O===!1:e.util.schemaHasRules(O,e.RULES.all))&&(r+=" "+y+" = true; if ( "+p+e.util.getProperty(k)+" !== undefined ",T&&(r+=" && Object.prototype.hasOwnProperty.call("+p+", '"+e.util.escapeQuotes(k)+"') "),r+=") { ",u.schema=O,u.schemaPath=d+e.util.getProperty(k),u.errSchemaPath=f+"/"+e.util.escapeFragment(k),r+=" "+e.validate(u)+" ",u.baseId=ae,r+=" } ",m&&(r+=" if ("+y+") { ",c+="}"))}return m&&(r+=" "+c+" if ("+_+" == errors) {"),r}),Na}var Fa,Ss;function Ro(){return Ss||(Ss=1,Fa=function(e,a,t){var r=" ",s=e.level,o=e.dataLevel,i=e.schema[a],d=e.schemaPath+e.util.getProperty(a),f=e.errSchemaPath+"/"+a,m=!e.opts.allErrors,p="data"+(o||""),_="valid"+s,u=e.opts.$data&&i&&i.$data;u&&(r+=" var schema"+s+" = "+e.util.getData(i.$data,o,e.dataPathArr)+"; ");var c="i"+s,y="schema"+s;u||(r+=" var "+y+" = validate.schema"+d+";"),r+="var "+_+";",u&&(r+=" if (schema"+s+" === undefined) "+_+" = true; else if (!Array.isArray(schema"+s+")) "+_+" = false; else {"),r+=""+_+" = false;for (var "+c+"=0; "+c+"<"+y+".length; "+c+"++) if (equal("+p+", "+y+"["+c+"])) { "+_+" = true; break; }",u&&(r+=" } "),r+=" if (!"+_+") { ";var g=g||[];g.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'enum' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { allowedValues: schema"+s+" } ",e.opts.messages!==!1&&(r+=" , message: 'should be equal to one of the allowed values' "),e.opts.verbose&&(r+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),r+=" } "):r+=" {} ";var P=r;return r=g.pop(),!e.compositeRule&&m?e.async?r+=" throw new ValidationError(["+P+"]); ":r+=" validate.errors = ["+P+"]; return false; ":r+=" var err = "+P+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" }",m&&(r+=" else { "),r}),Fa}var La,bs;function $o(){return bs||(bs=1,La=function(e,a,t){var r=" ",s=e.level,o=e.dataLevel,i=e.schema[a],d=e.schemaPath+e.util.getProperty(a),f=e.errSchemaPath+"/"+a,m=!e.opts.allErrors,p="data"+(o||"");if(e.opts.format===!1)return m&&(r+=" if (true) { "),r;var _=e.opts.$data&&i&&i.$data,u;_?(r+=" var schema"+s+" = "+e.util.getData(i.$data,o,e.dataPathArr)+"; ",u="schema"+s):u=i;var c=e.opts.unknownFormats,y=Array.isArray(c);if(_){var g="format"+s,P="isObject"+s,T="formatType"+s;r+=" var "+g+" = formats["+u+"]; var "+P+" = typeof "+g+" == 'object' && !("+g+" instanceof RegExp) && "+g+".validate; var "+T+" = "+P+" && "+g+".type || 'string'; if ("+P+") { ",e.async&&(r+=" var async"+s+" = "+g+".async; "),r+=" "+g+" = "+g+".validate; } if ( ",_&&(r+=" ("+u+" !== undefined && typeof "+u+" != 'string') || "),r+=" (",c!="ignore"&&(r+=" ("+u+" && !"+g+" ",y&&(r+=" && self._opts.unknownFormats.indexOf("+u+") == -1 "),r+=") || "),r+=" ("+g+" && "+T+" == '"+t+"' && !(typeof "+g+" == 'function' ? ",e.async?r+=" (async"+s+" ? await "+g+"("+p+") : "+g+"("+p+")) ":r+=" "+g+"("+p+") ",r+=" : "+g+".test("+p+"))))) {"}else{var g=e.formats[i];if(!g){if(c=="ignore")return e.logger.warn('unknown format "'+i+'" ignored in schema at path "'+e.errSchemaPath+'"'),m&&(r+=" if (true) { "),r;if(y&&c.indexOf(i)>=0)return m&&(r+=" if (true) { "),r;throw new Error('unknown format "'+i+'" is used in schema at path "'+e.errSchemaPath+'"')}var P=typeof g=="object"&&!(g instanceof RegExp)&&g.validate,T=P&&g.type||"string";if(P){var O=g.async===!0;g=g.validate}if(T!=t)return m&&(r+=" if (true) { "),r;if(O){if(!e.async)throw new Error("async format in sync schema");var E="formats"+e.util.getProperty(i)+".validate";r+=" if (!(await "+E+"("+p+"))) { "}else{r+=" if (! ";var E="formats"+e.util.getProperty(i);P&&(E+=".validate"),typeof g=="function"?r+=" "+E+"("+p+") ":r+=" "+E+".test("+p+") ",r+=") { "}}var x=x||[];x.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'format' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { format: ",_?r+=""+u:r+=""+e.util.toQuotedString(i),r+=" } ",e.opts.messages!==!1&&(r+=` , message: 'should match format "`,_?r+="' + "+u+" + '":r+=""+e.util.escapeQuotes(i),r+=`"' `),e.opts.verbose&&(r+=" , schema: ",_?r+="validate.schema"+d:r+=""+e.util.toQuotedString(i),r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),r+=" } "):r+=" {} ";var k=r;return r=x.pop(),!e.compositeRule&&m?e.async?r+=" throw new ValidationError(["+k+"]); ":r+=" validate.errors = ["+k+"]; return false; ":r+=" var err = "+k+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } ",m&&(r+=" else { "),r}),La}var qa,xs;function Oo(){return xs||(xs=1,qa=function(e,a,t){var r=" ",s=e.level,o=e.dataLevel,i=e.schema[a],d=e.schemaPath+e.util.getProperty(a),f=e.errSchemaPath+"/"+a,m=!e.opts.allErrors,p="data"+(o||""),_="valid"+s,u="errs__"+s,c=e.util.copy(e);c.level++;var y="valid"+c.level,g=e.schema.then,P=e.schema.else,T=g!==void 0&&(e.opts.strictKeywords?typeof g=="object"&&Object.keys(g).length>0||g===!1:e.util.schemaHasRules(g,e.RULES.all)),O=P!==void 0&&(e.opts.strictKeywords?typeof P=="object"&&Object.keys(P).length>0||P===!1:e.util.schemaHasRules(P,e.RULES.all)),E=c.baseId;if(T||O){var x;c.createErrors=!1,c.schema=i,c.schemaPath=d,c.errSchemaPath=f,r+=" var "+u+" = errors; var "+_+" = true; ";var k=e.compositeRule;e.compositeRule=c.compositeRule=!0,r+=" "+e.validate(c)+" ",c.baseId=E,c.createErrors=!0,r+=" errors = "+u+"; if (vErrors !== null) { if ("+u+") vErrors.length = "+u+"; else vErrors = null; } ",e.compositeRule=c.compositeRule=k,T?(r+=" if ("+y+") { ",c.schema=e.schema.then,c.schemaPath=e.schemaPath+".then",c.errSchemaPath=e.errSchemaPath+"/then",r+=" "+e.validate(c)+" ",c.baseId=E,r+=" "+_+" = "+y+"; ",T&&O?(x="ifClause"+s,r+=" var "+x+" = 'then'; "):x="'then'",r+=" } ",O&&(r+=" else { ")):r+=" if (!"+y+") { ",O&&(c.schema=e.schema.else,c.schemaPath=e.schemaPath+".else",c.errSchemaPath=e.errSchemaPath+"/else",r+=" "+e.validate(c)+" ",c.baseId=E,r+=" "+_+" = "+y+"; ",T&&O?(x="ifClause"+s,r+=" var "+x+" = 'else'; "):x="'else'",r+=" } "),r+=" if (!"+_+") { var err = ",e.createErrors!==!1?(r+=" { keyword: 'if' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { failingKeyword: "+x+" } ",e.opts.messages!==!1&&(r+=` , message: 'should match "' + `+x+` + '" schema' `),e.opts.verbose&&(r+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&m&&(e.async?r+=" throw new ValidationError(vErrors); ":r+=" validate.errors = vErrors; return false; "),r+=" } ",m&&(r+=" else { ")}else m&&(r+=" if (true) { ");return r}),qa}var Ma,ws;function ko(){return ws||(ws=1,Ma=function(e,a,t){var r=" ",s=e.level,o=e.dataLevel,i=e.schema[a],d=e.schemaPath+e.util.getProperty(a),f=e.errSchemaPath+"/"+a,m=!e.opts.allErrors,p="data"+(o||""),_="valid"+s,u="errs__"+s,c=e.util.copy(e),y="";c.level++;var g="valid"+c.level,P="i"+s,T=c.dataLevel=e.dataLevel+1,O="data"+T,E=e.baseId;if(r+="var "+u+" = errors;var "+_+";",Array.isArray(i)){var x=e.schema.additionalItems;if(x===!1){r+=" "+_+" = "+p+".length <= "+i.length+"; ";var k=f;f=e.errSchemaPath+"/additionalItems",r+=" if (!"+_+") { ";var I=I||[];I.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'additionalItems' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { limit: "+i.length+" } ",e.opts.messages!==!1&&(r+=" , message: 'should NOT have more than "+i.length+" items' "),e.opts.verbose&&(r+=" , schema: false , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),r+=" } "):r+=" {} ";var D=r;r=I.pop(),!e.compositeRule&&m?e.async?r+=" throw new ValidationError(["+D+"]); ":r+=" validate.errors = ["+D+"]; return false; ":r+=" var err = "+D+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } ",f=k,m&&(y+="}",r+=" else { ")}var A=i;if(A){for(var S,w=-1,C=A.length-1;w<C;)if(S=A[w+=1],e.opts.strictKeywords?typeof S=="object"&&Object.keys(S).length>0||S===!1:e.util.schemaHasRules(S,e.RULES.all)){r+=" "+g+" = true; if ("+p+".length > "+w+") { ";var L=p+"["+w+"]";c.schema=S,c.schemaPath=d+"["+w+"]",c.errSchemaPath=f+"/"+w,c.errorPath=e.util.getPathExpr(e.errorPath,w,e.opts.jsonPointers,!0),c.dataPathArr[T]=w;var q=e.validate(c);c.baseId=E,e.util.varOccurences(q,O)<2?r+=" "+e.util.varReplace(q,O,L)+" ":r+=" var "+O+" = "+L+"; "+q+" ",r+=" } ",m&&(r+=" if ("+g+") { ",y+="}")}}if(typeof x=="object"&&(e.opts.strictKeywords?typeof x=="object"&&Object.keys(x).length>0||x===!1:e.util.schemaHasRules(x,e.RULES.all))){c.schema=x,c.schemaPath=e.schemaPath+".additionalItems",c.errSchemaPath=e.errSchemaPath+"/additionalItems",r+=" "+g+" = true; if ("+p+".length > "+i.length+") { for (var "+P+" = "+i.length+"; "+P+" < "+p+".length; "+P+"++) { ",c.errorPath=e.util.getPathExpr(e.errorPath,P,e.opts.jsonPointers,!0);var L=p+"["+P+"]";c.dataPathArr[T]=P;var q=e.validate(c);c.baseId=E,e.util.varOccurences(q,O)<2?r+=" "+e.util.varReplace(q,O,L)+" ":r+=" var "+O+" = "+L+"; "+q+" ",m&&(r+=" if (!"+g+") break; "),r+=" } } ",m&&(r+=" if ("+g+") { ",y+="}")}}else if(e.opts.strictKeywords?typeof i=="object"&&Object.keys(i).length>0||i===!1:e.util.schemaHasRules(i,e.RULES.all)){c.schema=i,c.schemaPath=d,c.errSchemaPath=f,r+=" for (var "+P+" = 0; "+P+" < "+p+".length; "+P+"++) { ",c.errorPath=e.util.getPathExpr(e.errorPath,P,e.opts.jsonPointers,!0);var L=p+"["+P+"]";c.dataPathArr[T]=P;var q=e.validate(c);c.baseId=E,e.util.varOccurences(q,O)<2?r+=" "+e.util.varReplace(q,O,L)+" ":r+=" var "+O+" = "+L+"; "+q+" ",m&&(r+=" if (!"+g+") break; "),r+=" }"}return m&&(r+=" "+y+" if ("+u+" == errors) {"),r}),Ma}var za,Rs;function $s(){return Rs||(Rs=1,za=function(e,a,t){var r=" ",s=e.level,o=e.dataLevel,i=e.schema[a],d=e.schemaPath+e.util.getProperty(a),f=e.errSchemaPath+"/"+a,m=!e.opts.allErrors,E,p="data"+(o||""),_=e.opts.$data&&i&&i.$data,u;_?(r+=" var schema"+s+" = "+e.util.getData(i.$data,o,e.dataPathArr)+"; ",u="schema"+s):u=i;var c=a=="maximum",y=c?"exclusiveMaximum":"exclusiveMinimum",g=e.schema[y],P=e.opts.$data&&g&&g.$data,T=c?"<":">",O=c?">":"<",E=void 0;if(!(_||typeof i=="number"||i===void 0))throw new Error(a+" must be number");if(!(P||g===void 0||typeof g=="number"||typeof g=="boolean"))throw new Error(y+" must be number or boolean");if(P){var x=e.util.getData(g.$data,o,e.dataPathArr),k="exclusive"+s,I="exclType"+s,D="exclIsNumber"+s,A="op"+s,S="' + "+A+" + '";r+=" var schemaExcl"+s+" = "+x+"; ",x="schemaExcl"+s,r+=" var "+k+"; var "+I+" = typeof "+x+"; if ("+I+" != 'boolean' && "+I+" != 'undefined' && "+I+" != 'number') { ";var E=y,w=w||[];w.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(E||"_exclusiveLimit")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: {} ",e.opts.messages!==!1&&(r+=" , message: '"+y+" should be boolean' "),e.opts.verbose&&(r+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),r+=" } "):r+=" {} ";var C=r;r=w.pop(),!e.compositeRule&&m?e.async?r+=" throw new ValidationError(["+C+"]); ":r+=" validate.errors = ["+C+"]; return false; ":r+=" var err = "+C+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } else if ( ",_&&(r+=" ("+u+" !== undefined && typeof "+u+" != 'number') || "),r+=" "+I+" == 'number' ? ( ("+k+" = "+u+" === undefined || "+x+" "+T+"= "+u+") ? "+p+" "+O+"= "+x+" : "+p+" "+O+" "+u+" ) : ( ("+k+" = "+x+" === true) ? "+p+" "+O+"= "+u+" : "+p+" "+O+" "+u+" ) || "+p+" !== "+p+") { var op"+s+" = "+k+" ? '"+T+"' : '"+T+"='; ",i===void 0&&(E=y,f=e.errSchemaPath+"/"+y,u=x,_=P)}else{var D=typeof g=="number",S=T;if(D&&_){var A="'"+S+"'";r+=" if ( ",_&&(r+=" ("+u+" !== undefined && typeof "+u+" != 'number') || "),r+=" ( "+u+" === undefined || "+g+" "+T+"= "+u+" ? "+p+" "+O+"= "+g+" : "+p+" "+O+" "+u+" ) || "+p+" !== "+p+") { "}else{D&&i===void 0?(k=!0,E=y,f=e.errSchemaPath+"/"+y,u=g,O+="="):(D&&(u=Math[c?"min":"max"](g,i)),g===(D?u:!0)?(k=!0,E=y,f=e.errSchemaPath+"/"+y,O+="="):(k=!1,S+="="));var A="'"+S+"'";r+=" if ( ",_&&(r+=" ("+u+" !== undefined && typeof "+u+" != 'number') || "),r+=" "+p+" "+O+" "+u+" || "+p+" !== "+p+") { "}}E=E||a;var w=w||[];w.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(E||"_limit")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { comparison: "+A+", limit: "+u+", exclusive: "+k+" } ",e.opts.messages!==!1&&(r+=" , message: 'should be "+S+" ",_?r+="' + "+u:r+=""+u+"'"),e.opts.verbose&&(r+=" , schema: ",_?r+="validate.schema"+d:r+=""+i,r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),r+=" } "):r+=" {} ";var C=r;return r=w.pop(),!e.compositeRule&&m?e.async?r+=" throw new ValidationError(["+C+"]); ":r+=" validate.errors = ["+C+"]; return false; ":r+=" var err = "+C+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } ",m&&(r+=" else { "),r}),za}var Va,Os;function ks(){return Os||(Os=1,Va=function(e,a,t){var r=" ",s=e.level,o=e.dataLevel,i=e.schema[a],d=e.schemaPath+e.util.getProperty(a),f=e.errSchemaPath+"/"+a,m=!e.opts.allErrors,y,p="data"+(o||""),_=e.opts.$data&&i&&i.$data,u;if(_?(r+=" var schema"+s+" = "+e.util.getData(i.$data,o,e.dataPathArr)+"; ",u="schema"+s):u=i,!(_||typeof i=="number"))throw new Error(a+" must be number");var c=a=="maxItems"?">":"<";r+="if ( ",_&&(r+=" ("+u+" !== undefined && typeof "+u+" != 'number') || "),r+=" "+p+".length "+c+" "+u+") { ";var y=a,g=g||[];g.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(y||"_limitItems")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { limit: "+u+" } ",e.opts.messages!==!1&&(r+=" , message: 'should NOT have ",a=="maxItems"?r+="more":r+="fewer",r+=" than ",_?r+="' + "+u+" + '":r+=""+i,r+=" items' "),e.opts.verbose&&(r+=" , schema: ",_?r+="validate.schema"+d:r+=""+i,r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),r+=" } "):r+=" {} ";var P=r;return r=g.pop(),!e.compositeRule&&m?e.async?r+=" throw new ValidationError(["+P+"]); ":r+=" validate.errors = ["+P+"]; return false; ":r+=" var err = "+P+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+="} ",m&&(r+=" else { "),r}),Va}var Ua,Is;function Ds(){return Is||(Is=1,Ua=function(e,a,t){var r=" ",s=e.level,o=e.dataLevel,i=e.schema[a],d=e.schemaPath+e.util.getProperty(a),f=e.errSchemaPath+"/"+a,m=!e.opts.allErrors,y,p="data"+(o||""),_=e.opts.$data&&i&&i.$data,u;if(_?(r+=" var schema"+s+" = "+e.util.getData(i.$data,o,e.dataPathArr)+"; ",u="schema"+s):u=i,!(_||typeof i=="number"))throw new Error(a+" must be number");var c=a=="maxLength"?">":"<";r+="if ( ",_&&(r+=" ("+u+" !== undefined && typeof "+u+" != 'number') || "),e.opts.unicode===!1?r+=" "+p+".length ":r+=" ucs2length("+p+") ",r+=" "+c+" "+u+") { ";var y=a,g=g||[];g.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(y||"_limitLength")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { limit: "+u+" } ",e.opts.messages!==!1&&(r+=" , message: 'should NOT be ",a=="maxLength"?r+="longer":r+="shorter",r+=" than ",_?r+="' + "+u+" + '":r+=""+i,r+=" characters' "),e.opts.verbose&&(r+=" , schema: ",_?r+="validate.schema"+d:r+=""+i,r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),r+=" } "):r+=" {} ";var P=r;return r=g.pop(),!e.compositeRule&&m?e.async?r+=" throw new ValidationError(["+P+"]); ":r+=" validate.errors = ["+P+"]; return false; ":r+=" var err = "+P+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+="} ",m&&(r+=" else { "),r}),Ua}var Za,As;function Cs(){return As||(As=1,Za=function(e,a,t){var r=" ",s=e.level,o=e.dataLevel,i=e.schema[a],d=e.schemaPath+e.util.getProperty(a),f=e.errSchemaPath+"/"+a,m=!e.opts.allErrors,y,p="data"+(o||""),_=e.opts.$data&&i&&i.$data,u;if(_?(r+=" var schema"+s+" = "+e.util.getData(i.$data,o,e.dataPathArr)+"; ",u="schema"+s):u=i,!(_||typeof i=="number"))throw new Error(a+" must be number");var c=a=="maxProperties"?">":"<";r+="if ( ",_&&(r+=" ("+u+" !== undefined && typeof "+u+" != 'number') || "),r+=" Object.keys("+p+").length "+c+" "+u+") { ";var y=a,g=g||[];g.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(y||"_limitProperties")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { limit: "+u+" } ",e.opts.messages!==!1&&(r+=" , message: 'should NOT have ",a=="maxProperties"?r+="more":r+="fewer",r+=" than ",_?r+="' + "+u+" + '":r+=""+i,r+=" properties' "),e.opts.verbose&&(r+=" , schema: ",_?r+="validate.schema"+d:r+=""+i,r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),r+=" } "):r+=" {} ";var P=r;return r=g.pop(),!e.compositeRule&&m?e.async?r+=" throw new ValidationError(["+P+"]); ":r+=" validate.errors = ["+P+"]; return false; ":r+=" var err = "+P+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+="} ",m&&(r+=" else { "),r}),Za}var Qa,Ts;function Io(){return Ts||(Ts=1,Qa=function(e,a,t){var r=" ",s=e.level,o=e.dataLevel,i=e.schema[a],d=e.schemaPath+e.util.getProperty(a),f=e.errSchemaPath+"/"+a,m=!e.opts.allErrors,p="data"+(o||""),_=e.opts.$data&&i&&i.$data,u;if(_?(r+=" var schema"+s+" = "+e.util.getData(i.$data,o,e.dataPathArr)+"; ",u="schema"+s):u=i,!(_||typeof i=="number"))throw new Error(a+" must be number");r+="var division"+s+";if (",_&&(r+=" "+u+" !== undefined && ( typeof "+u+" != 'number' || "),r+=" (division"+s+" = "+p+" / "+u+", ",e.opts.multipleOfPrecision?r+=" Math.abs(Math.round(division"+s+") - division"+s+") > 1e-"+e.opts.multipleOfPrecision+" ":r+=" division"+s+" !== parseInt(division"+s+") ",r+=" ) ",_&&(r+=" ) "),r+=" ) { ";var c=c||[];c.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'multipleOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { multipleOf: "+u+" } ",e.opts.messages!==!1&&(r+=" , message: 'should be multiple of ",_?r+="' + "+u:r+=""+u+"'"),e.opts.verbose&&(r+=" , schema: ",_?r+="validate.schema"+d:r+=""+i,r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),r+=" } "):r+=" {} ";var y=r;return r=c.pop(),!e.compositeRule&&m?e.async?r+=" throw new ValidationError(["+y+"]); ":r+=" validate.errors = ["+y+"]; return false; ":r+=" var err = "+y+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+="} ",m&&(r+=" else { "),r}),Qa}var Ba,js;function Do(){return js||(js=1,Ba=function(e,a,t){var r=" ",s=e.level,o=e.dataLevel,i=e.schema[a],d=e.schemaPath+e.util.getProperty(a),f=e.errSchemaPath+"/"+a,m=!e.opts.allErrors,p="data"+(o||""),_="errs__"+s,u=e.util.copy(e);u.level++;var c="valid"+u.level;if(e.opts.strictKeywords?typeof i=="object"&&Object.keys(i).length>0||i===!1:e.util.schemaHasRules(i,e.RULES.all)){u.schema=i,u.schemaPath=d,u.errSchemaPath=f,r+=" var "+_+" = errors; ";var y=e.compositeRule;e.compositeRule=u.compositeRule=!0,u.createErrors=!1;var g;u.opts.allErrors&&(g=u.opts.allErrors,u.opts.allErrors=!1),r+=" "+e.validate(u)+" ",u.createErrors=!0,g&&(u.opts.allErrors=g),e.compositeRule=u.compositeRule=y,r+=" if ("+c+") { ";var P=P||[];P.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'not' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: {} ",e.opts.messages!==!1&&(r+=" , message: 'should NOT be valid' "),e.opts.verbose&&(r+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),r+=" } "):r+=" {} ";var T=r;r=P.pop(),!e.compositeRule&&m?e.async?r+=" throw new ValidationError(["+T+"]); ":r+=" validate.errors = ["+T+"]; return false; ":r+=" var err = "+T+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } else { errors = "+_+"; if (vErrors !== null) { if ("+_+") vErrors.length = "+_+"; else vErrors = null; } ",e.opts.allErrors&&(r+=" } ")}else r+=" var err = ",e.createErrors!==!1?(r+=" { keyword: 'not' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: {} ",e.opts.messages!==!1&&(r+=" , message: 'should NOT be valid' "),e.opts.verbose&&(r+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",m&&(r+=" if (false) { ");return r}),Ba}var Ha,Ns;function Ao(){return Ns||(Ns=1,Ha=function(e,a,t){var r=" ",s=e.level,o=e.dataLevel,i=e.schema[a],d=e.schemaPath+e.util.getProperty(a),f=e.errSchemaPath+"/"+a,m=!e.opts.allErrors,p="data"+(o||""),_="valid"+s,u="errs__"+s,c=e.util.copy(e),y="";c.level++;var g="valid"+c.level,P=c.baseId,T="prevValid"+s,O="passingSchemas"+s;r+="var "+u+" = errors , "+T+" = false , "+_+" = false , "+O+" = null; ";var E=e.compositeRule;e.compositeRule=c.compositeRule=!0;var x=i;if(x)for(var k,I=-1,D=x.length-1;I<D;)k=x[I+=1],(e.opts.strictKeywords?typeof k=="object"&&Object.keys(k).length>0||k===!1:e.util.schemaHasRules(k,e.RULES.all))?(c.schema=k,c.schemaPath=d+"["+I+"]",c.errSchemaPath=f+"/"+I,r+=" "+e.validate(c)+" ",c.baseId=P):r+=" var "+g+" = true; ",I&&(r+=" if ("+g+" && "+T+") { "+_+" = false; "+O+" = ["+O+", "+I+"]; } else { ",y+="}"),r+=" if ("+g+") { "+_+" = "+T+" = true; "+O+" = "+I+"; }";return e.compositeRule=c.compositeRule=E,r+=""+y+"if (!"+_+") { var err = ",e.createErrors!==!1?(r+=" { keyword: 'oneOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { passingSchemas: "+O+" } ",e.opts.messages!==!1&&(r+=" , message: 'should match exactly one schema in oneOf' "),e.opts.verbose&&(r+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&m&&(e.async?r+=" throw new ValidationError(vErrors); ":r+=" validate.errors = vErrors; return false; "),r+="} else { errors = "+u+"; if (vErrors !== null) { if ("+u+") vErrors.length = "+u+"; else vErrors = null; }",e.opts.allErrors&&(r+=" } "),r}),Ha}var Ka,Fs;function Co(){return Fs||(Fs=1,Ka=function(e,a,t){var r=" ",s=e.level,o=e.dataLevel,i=e.schema[a],d=e.schemaPath+e.util.getProperty(a),f=e.errSchemaPath+"/"+a,m=!e.opts.allErrors,p="data"+(o||""),_=e.opts.$data&&i&&i.$data,u;_?(r+=" var schema"+s+" = "+e.util.getData(i.$data,o,e.dataPathArr)+"; ",u="schema"+s):u=i;var c=_?"(new RegExp("+u+"))":e.usePattern(i);r+="if ( ",_&&(r+=" ("+u+" !== undefined && typeof "+u+" != 'string') || "),r+=" !"+c+".test("+p+") ) { ";var y=y||[];y.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'pattern' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { pattern: ",_?r+=""+u:r+=""+e.util.toQuotedString(i),r+=" } ",e.opts.messages!==!1&&(r+=` , message: 'should match pattern "`,_?r+="' + "+u+" + '":r+=""+e.util.escapeQuotes(i),r+=`"' `),e.opts.verbose&&(r+=" , schema: ",_?r+="validate.schema"+d:r+=""+e.util.toQuotedString(i),r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),r+=" } "):r+=" {} ";var g=r;return r=y.pop(),!e.compositeRule&&m?e.async?r+=" throw new ValidationError(["+g+"]); ":r+=" validate.errors = ["+g+"]; return false; ":r+=" var err = "+g+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+="} ",m&&(r+=" else { "),r}),Ka}var Ja,Ls;function To(){return Ls||(Ls=1,Ja=function(e,a,t){var r=" ",s=e.level,o=e.dataLevel,i=e.schema[a],d=e.schemaPath+e.util.getProperty(a),f=e.errSchemaPath+"/"+a,m=!e.opts.allErrors,p="data"+(o||""),_="errs__"+s,u=e.util.copy(e),c="";u.level++;var y="valid"+u.level,g="key"+s,P="idx"+s,T=u.dataLevel=e.dataLevel+1,O="data"+T,E="dataProperties"+s,x=Object.keys(i||{}).filter(le),k=e.schema.patternProperties||{},I=Object.keys(k).filter(le),D=e.schema.additionalProperties,A=x.length||I.length,S=D===!1,w=typeof D=="object"&&Object.keys(D).length,C=e.opts.removeAdditional,L=S||w||C,q=e.opts.ownProperties,K=e.baseId,se=e.schema.required;if(se&&!(e.opts.$data&&se.$data)&&se.length<e.opts.loopRequired)var G=e.util.toHash(se);function le(ra){return ra!=="__proto__"}if(r+="var "+_+" = errors;var "+y+" = true;",q&&(r+=" var "+E+" = undefined;"),L){if(q?r+=" "+E+" = "+E+" || Object.keys("+p+"); for (var "+P+"=0; "+P+"<"+E+".length; "+P+"++) { var "+g+" = "+E+"["+P+"]; ":r+=" for (var "+g+" in "+p+") { ",A){if(r+=" var isAdditional"+s+" = !(false ",x.length)if(x.length>8)r+=" || validate.schema"+d+".hasOwnProperty("+g+") ";else{var re=x;if(re)for(var ae,Te=-1,Ae=re.length-1;Te<Ae;)ae=re[Te+=1],r+=" || "+g+" == "+e.util.toQuotedString(ae)+" "}if(I.length){var Ie=I;if(Ie)for(var xe,Ve=-1,b=Ie.length-1;Ve<b;)xe=Ie[Ve+=1],r+=" || "+e.usePattern(xe)+".test("+g+") "}r+=" ); if (isAdditional"+s+") { "}if(C=="all")r+=" delete "+p+"["+g+"]; ";else{var j=e.errorPath,V="' + "+g+" + '";if(e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(e.errorPath,g,e.opts.jsonPointers)),S)if(C)r+=" delete "+p+"["+g+"]; ";else{r+=" "+y+" = false; ";var ee=f;f=e.errSchemaPath+"/additionalProperties";var N=N||[];N.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'additionalProperties' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { additionalProperty: '"+V+"' } ",e.opts.messages!==!1&&(r+=" , message: '",e.opts._errorDataPathProperty?r+="is an invalid additional property":r+="should NOT have additional properties",r+="' "),e.opts.verbose&&(r+=" , schema: false , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),r+=" } "):r+=" {} ";var z=r;r=N.pop(),!e.compositeRule&&m?e.async?r+=" throw new ValidationError(["+z+"]); ":r+=" validate.errors = ["+z+"]; return false; ":r+=" var err = "+z+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",f=ee,m&&(r+=" break; ")}else if(w)if(C=="failing"){r+=" var "+_+" = errors; ";var ie=e.compositeRule;e.compositeRule=u.compositeRule=!0,u.schema=D,u.schemaPath=e.schemaPath+".additionalProperties",u.errSchemaPath=e.errSchemaPath+"/additionalProperties",u.errorPath=e.opts._errorDataPathProperty?e.errorPath:e.util.getPathExpr(e.errorPath,g,e.opts.jsonPointers);var fe=p+"["+g+"]";u.dataPathArr[T]=g;var ue=e.validate(u);u.baseId=K,e.util.varOccurences(ue,O)<2?r+=" "+e.util.varReplace(ue,O,fe)+" ":r+=" var "+O+" = "+fe+"; "+ue+" ",r+=" if (!"+y+") { errors = "+_+"; if (validate.errors !== null) { if (errors) validate.errors.length = errors; else validate.errors = null; } delete "+p+"["+g+"]; } ",e.compositeRule=u.compositeRule=ie}else{u.schema=D,u.schemaPath=e.schemaPath+".additionalProperties",u.errSchemaPath=e.errSchemaPath+"/additionalProperties",u.errorPath=e.opts._errorDataPathProperty?e.errorPath:e.util.getPathExpr(e.errorPath,g,e.opts.jsonPointers);var fe=p+"["+g+"]";u.dataPathArr[T]=g;var ue=e.validate(u);u.baseId=K,e.util.varOccurences(ue,O)<2?r+=" "+e.util.varReplace(ue,O,fe)+" ":r+=" var "+O+" = "+fe+"; "+ue+" ",m&&(r+=" if (!"+y+") break; ")}e.errorPath=j}A&&(r+=" } "),r+=" } ",m&&(r+=" if ("+y+") { ",c+="}")}var _e=e.opts.useDefaults&&!e.compositeRule;if(x.length){var pe=x;if(pe)for(var ae,ve=-1,Ce=pe.length-1;ve<Ce;){ae=pe[ve+=1];var Se=i[ae];if(e.opts.strictKeywords?typeof Se=="object"&&Object.keys(Se).length>0||Se===!1:e.util.schemaHasRules(Se,e.RULES.all)){var He=e.util.getProperty(ae),fe=p+He,je=_e&&Se.default!==void 0;u.schema=Se,u.schemaPath=d+He,u.errSchemaPath=f+"/"+e.util.escapeFragment(ae),u.errorPath=e.util.getPath(e.errorPath,ae,e.opts.jsonPointers),u.dataPathArr[T]=e.util.toQuotedString(ae);var ue=e.validate(u);if(u.baseId=K,e.util.varOccurences(ue,O)<2){ue=e.util.varReplace(ue,O,fe);var be=fe}else{var be=O;r+=" var "+O+" = "+fe+"; "}if(je)r+=" "+ue+" ";else{if(G&&G[ae]){r+=" if ( "+be+" === undefined ",q&&(r+=" || ! Object.prototype.hasOwnProperty.call("+p+", '"+e.util.escapeQuotes(ae)+"') "),r+=") { "+y+" = false; ";var j=e.errorPath,ee=f,we=e.util.escapeQuotes(ae);e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPath(j,ae,e.opts.jsonPointers)),f=e.errSchemaPath+"/required";var N=N||[];N.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { missingProperty: '"+we+"' } ",e.opts.messages!==!1&&(r+=" , message: '",e.opts._errorDataPathProperty?r+="is a required property":r+="should have required property \\'"+we+"\\'",r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),r+=" } "):r+=" {} ";var z=r;r=N.pop(),!e.compositeRule&&m?e.async?r+=" throw new ValidationError(["+z+"]); ":r+=" validate.errors = ["+z+"]; return false; ":r+=" var err = "+z+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",f=ee,e.errorPath=j,r+=" } else { "}else m?(r+=" if ( "+be+" === undefined ",q&&(r+=" || ! Object.prototype.hasOwnProperty.call("+p+", '"+e.util.escapeQuotes(ae)+"') "),r+=") { "+y+" = true; } else { "):(r+=" if ("+be+" !== undefined ",q&&(r+=" && Object.prototype.hasOwnProperty.call("+p+", '"+e.util.escapeQuotes(ae)+"') "),r+=" ) { ");r+=" "+ue+" } "}}m&&(r+=" if ("+y+") { ",c+="}")}}if(I.length){var qe=I;if(qe)for(var xe,Nr=-1,ea=qe.length-1;Nr<ea;){xe=qe[Nr+=1];var Se=k[xe];if(e.opts.strictKeywords?typeof Se=="object"&&Object.keys(Se).length>0||Se===!1:e.util.schemaHasRules(Se,e.RULES.all)){u.schema=Se,u.schemaPath=e.schemaPath+".patternProperties"+e.util.getProperty(xe),u.errSchemaPath=e.errSchemaPath+"/patternProperties/"+e.util.escapeFragment(xe),q?r+=" "+E+" = "+E+" || Object.keys("+p+"); for (var "+P+"=0; "+P+"<"+E+".length; "+P+"++) { var "+g+" = "+E+"["+P+"]; ":r+=" for (var "+g+" in "+p+") { ",r+=" if ("+e.usePattern(xe)+".test("+g+")) { ",u.errorPath=e.util.getPathExpr(e.errorPath,g,e.opts.jsonPointers);var fe=p+"["+g+"]";u.dataPathArr[T]=g;var ue=e.validate(u);u.baseId=K,e.util.varOccurences(ue,O)<2?r+=" "+e.util.varReplace(ue,O,fe)+" ":r+=" var "+O+" = "+fe+"; "+ue+" ",m&&(r+=" if (!"+y+") break; "),r+=" } ",m&&(r+=" else "+y+" = true; "),r+=" } ",m&&(r+=" if ("+y+") { ",c+="}")}}}return m&&(r+=" "+c+" if ("+_+" == errors) {"),r}),Ja}var Wa,qs;function jo(){return qs||(qs=1,Wa=function(e,a,t){var r=" ",s=e.level,o=e.dataLevel,i=e.schema[a],d=e.schemaPath+e.util.getProperty(a),f=e.errSchemaPath+"/"+a,m=!e.opts.allErrors,p="data"+(o||""),_="errs__"+s,u=e.util.copy(e),c="";u.level++;var y="valid"+u.level;if(r+="var "+_+" = errors;",e.opts.strictKeywords?typeof i=="object"&&Object.keys(i).length>0||i===!1:e.util.schemaHasRules(i,e.RULES.all)){u.schema=i,u.schemaPath=d,u.errSchemaPath=f;var g="key"+s,P="idx"+s,T="i"+s,O="' + "+g+" + '",E=u.dataLevel=e.dataLevel+1,x="data"+E,k="dataProperties"+s,I=e.opts.ownProperties,D=e.baseId;I&&(r+=" var "+k+" = undefined; "),I?r+=" "+k+" = "+k+" || Object.keys("+p+"); for (var "+P+"=0; "+P+"<"+k+".length; "+P+"++) { var "+g+" = "+k+"["+P+"]; ":r+=" for (var "+g+" in "+p+") { ",r+=" var startErrs"+s+" = errors; ";var A=g,S=e.compositeRule;e.compositeRule=u.compositeRule=!0;var w=e.validate(u);u.baseId=D,e.util.varOccurences(w,x)<2?r+=" "+e.util.varReplace(w,x,A)+" ":r+=" var "+x+" = "+A+"; "+w+" ",e.compositeRule=u.compositeRule=S,r+=" if (!"+y+") { for (var "+T+"=startErrs"+s+"; "+T+"<errors; "+T+"++) { vErrors["+T+"].propertyName = "+g+"; } var err = ",e.createErrors!==!1?(r+=" { keyword: 'propertyNames' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { propertyName: '"+O+"' } ",e.opts.messages!==!1&&(r+=" , message: 'property name \\'"+O+"\\' is invalid' "),e.opts.verbose&&(r+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&m&&(e.async?r+=" throw new ValidationError(vErrors); ":r+=" validate.errors = vErrors; return false; "),m&&(r+=" break; "),r+=" } }"}return m&&(r+=" "+c+" if ("+_+" == errors) {"),r}),Wa}var Ga,Ms;function No(){return Ms||(Ms=1,Ga=function(e,a,t){var r=" ",s=e.level,o=e.dataLevel,i=e.schema[a],d=e.schemaPath+e.util.getProperty(a),f=e.errSchemaPath+"/"+a,m=!e.opts.allErrors,p="data"+(o||""),_="valid"+s,u=e.opts.$data&&i&&i.$data;u&&(r+=" var schema"+s+" = "+e.util.getData(i.$data,o,e.dataPathArr)+"; ");var c="schema"+s;if(!u)if(i.length<e.opts.loopRequired&&e.schema.properties&&Object.keys(e.schema.properties).length){var y=[],g=i;if(g)for(var P,T=-1,O=g.length-1;T<O;){P=g[T+=1];var E=e.schema.properties[P];E&&(e.opts.strictKeywords?typeof E=="object"&&Object.keys(E).length>0||E===!1:e.util.schemaHasRules(E,e.RULES.all))||(y[y.length]=P)}}else var y=i;if(u||y.length){var x=e.errorPath,k=u||y.length>=e.opts.loopRequired,I=e.opts.ownProperties;if(m)if(r+=" var missing"+s+"; ",k){u||(r+=" var "+c+" = validate.schema"+d+"; ");var D="i"+s,A="schema"+s+"["+D+"]",S="' + "+A+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(x,A,e.opts.jsonPointers)),r+=" var "+_+" = true; ",u&&(r+=" if (schema"+s+" === undefined) "+_+" = true; else if (!Array.isArray(schema"+s+")) "+_+" = false; else {"),r+=" for (var "+D+" = 0; "+D+" < "+c+".length; "+D+"++) { "+_+" = "+p+"["+c+"["+D+"]] !== undefined ",I&&(r+=" && Object.prototype.hasOwnProperty.call("+p+", "+c+"["+D+"]) "),r+="; if (!"+_+") break; } ",u&&(r+=" } "),r+=" if (!"+_+") { ";var w=w||[];w.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { missingProperty: '"+S+"' } ",e.opts.messages!==!1&&(r+=" , message: '",e.opts._errorDataPathProperty?r+="is a required property":r+="should have required property \\'"+S+"\\'",r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),r+=" } "):r+=" {} ";var C=r;r=w.pop(),!e.compositeRule&&m?e.async?r+=" throw new ValidationError(["+C+"]); ":r+=" validate.errors = ["+C+"]; return false; ":r+=" var err = "+C+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } else { "}else{r+=" if ( ";var L=y;if(L)for(var q,D=-1,K=L.length-1;D<K;){q=L[D+=1],D&&(r+=" || ");var se=e.util.getProperty(q),G=p+se;r+=" ( ( "+G+" === undefined ",I&&(r+=" || ! Object.prototype.hasOwnProperty.call("+p+", '"+e.util.escapeQuotes(q)+"') "),r+=") && (missing"+s+" = "+e.util.toQuotedString(e.opts.jsonPointers?q:se)+") ) "}r+=") { ";var A="missing"+s,S="' + "+A+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.opts.jsonPointers?e.util.getPathExpr(x,A,!0):x+" + "+A);var w=w||[];w.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { missingProperty: '"+S+"' } ",e.opts.messages!==!1&&(r+=" , message: '",e.opts._errorDataPathProperty?r+="is a required property":r+="should have required property \\'"+S+"\\'",r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),r+=" } "):r+=" {} ";var C=r;r=w.pop(),!e.compositeRule&&m?e.async?r+=" throw new ValidationError(["+C+"]); ":r+=" validate.errors = ["+C+"]; return false; ":r+=" var err = "+C+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } else { "}else if(k){u||(r+=" var "+c+" = validate.schema"+d+"; ");var D="i"+s,A="schema"+s+"["+D+"]",S="' + "+A+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(x,A,e.opts.jsonPointers)),u&&(r+=" if ("+c+" && !Array.isArray("+c+")) { var err = ",e.createErrors!==!1?(r+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { missingProperty: '"+S+"' } ",e.opts.messages!==!1&&(r+=" , message: '",e.opts._errorDataPathProperty?r+="is a required property":r+="should have required property \\'"+S+"\\'",r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } else if ("+c+" !== undefined) { "),r+=" for (var "+D+" = 0; "+D+" < "+c+".length; "+D+"++) { if ("+p+"["+c+"["+D+"]] === undefined ",I&&(r+=" || ! Object.prototype.hasOwnProperty.call("+p+", "+c+"["+D+"]) "),r+=") { var err = ",e.createErrors!==!1?(r+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { missingProperty: '"+S+"' } ",e.opts.messages!==!1&&(r+=" , message: '",e.opts._errorDataPathProperty?r+="is a required property":r+="should have required property \\'"+S+"\\'",r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } } ",u&&(r+=" } ")}else{var le=y;if(le)for(var q,re=-1,ae=le.length-1;re<ae;){q=le[re+=1];var se=e.util.getProperty(q),S=e.util.escapeQuotes(q),G=p+se;e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPath(x,q,e.opts.jsonPointers)),r+=" if ( "+G+" === undefined ",I&&(r+=" || ! Object.prototype.hasOwnProperty.call("+p+", '"+e.util.escapeQuotes(q)+"') "),r+=") { var err = ",e.createErrors!==!1?(r+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { missingProperty: '"+S+"' } ",e.opts.messages!==!1&&(r+=" , message: '",e.opts._errorDataPathProperty?r+="is a required property":r+="should have required property \\'"+S+"\\'",r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } "}}e.errorPath=x}else m&&(r+=" if (true) {");return r}),Ga}var Xa,zs;function Fo(){return zs||(zs=1,Xa=function(e,a,t){var r=" ",s=e.level,o=e.dataLevel,i=e.schema[a],d=e.schemaPath+e.util.getProperty(a),f=e.errSchemaPath+"/"+a,m=!e.opts.allErrors,p="data"+(o||""),_="valid"+s,u=e.opts.$data&&i&&i.$data,c;if(u?(r+=" var schema"+s+" = "+e.util.getData(i.$data,o,e.dataPathArr)+"; ",c="schema"+s):c=i,(i||u)&&e.opts.uniqueItems!==!1){u&&(r+=" var "+_+"; if ("+c+" === false || "+c+" === undefined) "+_+" = true; else if (typeof "+c+" != 'boolean') "+_+" = false; else { "),r+=" var i = "+p+".length , "+_+" = true , j; if (i > 1) { ";var y=e.schema.items&&e.schema.items.type,g=Array.isArray(y);if(!y||y=="object"||y=="array"||g&&(y.indexOf("object")>=0||y.indexOf("array")>=0))r+=" outer: for (;i--;) { for (j = i; j--;) { if (equal("+p+"[i], "+p+"[j])) { "+_+" = false; break outer; } } } ";else{r+=" var itemIndices = {}, item; for (;i--;) { var item = "+p+"[i]; ";var P="checkDataType"+(g?"s":"");r+=" if ("+e.util[P](y,"item",e.opts.strictNumbers,!0)+") continue; ",g&&(r+=` if (typeof item == 'string') item = '"' + item; `),r+=" if (typeof itemIndices[item] == 'number') { "+_+" = false; j = itemIndices[item]; break; } itemIndices[item] = i; } "}r+=" } ",u&&(r+=" } "),r+=" if (!"+_+") { ";var T=T||[];T.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'uniqueItems' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { i: i, j: j } ",e.opts.messages!==!1&&(r+=" , message: 'should NOT have duplicate items (items ## ' + j + ' and ' + i + ' are identical)' "),e.opts.verbose&&(r+=" , schema: ",u?r+="validate.schema"+d:r+=""+i,r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),r+=" } "):r+=" {} ";var O=r;r=T.pop(),!e.compositeRule&&m?e.async?r+=" throw new ValidationError(["+O+"]); ":r+=" validate.errors = ["+O+"]; return false; ":r+=" var err = "+O+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } ",m&&(r+=" else { ")}else m&&(r+=" if (true) { ");return r}),Xa}var Ya,Vs;function Lo(){return Vs||(Vs=1,Ya={$ref:_o(),allOf:Po(),anyOf:Eo(),$comment:So(),const:bo(),contains:xo(),dependencies:wo(),enum:Ro(),format:$o(),if:Oo(),items:ko(),maximum:$s(),minimum:$s(),maxItems:ks(),minItems:ks(),maxLength:Ds(),minLength:Ds(),maxProperties:Cs(),minProperties:Cs(),multipleOf:Io(),not:Do(),oneOf:Ao(),pattern:Co(),properties:To(),propertyNames:jo(),required:No(),uniqueItems:Fo(),validate:fs()}),Ya}var et,Us;function qo(){if(Us)return et;Us=1;var n=Lo(),e=Sr().toHash;return et=function(){var t=[{type:"number",rules:[{maximum:["exclusiveMaximum"]},{minimum:["exclusiveMinimum"]},"multipleOf","format"]},{type:"string",rules:["maxLength","minLength","pattern","format"]},{type:"array",rules:["maxItems","minItems","items","contains","uniqueItems"]},{type:"object",rules:["maxProperties","minProperties","required","dependencies","propertyNames",{properties:["additionalProperties","patternProperties"]}]},{rules:["$ref","const","enum","not","anyOf","oneOf","allOf","if"]}],r=["type","$comment"],s=["$schema","$id","id","$data","$async","title","description","default","definitions","examples","readOnly","writeOnly","contentMediaType","contentEncoding","additionalItems","then","else"],o=["number","integer","string","array","object","boolean","null"];return t.all=e(r),t.types=e(o),t.forEach(function(i){i.rules=i.rules.map(function(d){var f;if(typeof d=="object"){var m=Object.keys(d)[0];f=d[m],d=m,f.forEach(function(_){r.push(_),t.all[_]=!0})}r.push(d);var p=t.all[d]={keyword:d,code:n[d],implements:f};return p}),t.all.$comment={keyword:"$comment",code:n.$comment},i.type&&(t.types[i.type]=i)}),t.keywords=e(r.concat(s)),t.custom={},t},et}var rt,Zs;function Mo(){if(Zs)return rt;Zs=1;var n=["multipleOf","maximum","exclusiveMaximum","minimum","exclusiveMinimum","maxLength","minLength","pattern","additionalItems","maxItems","minItems","uniqueItems","maxProperties","minProperties","required","additionalProperties","enum","format","const"];return rt=function(e,a){for(var t=0;t<a.length;t++){e=JSON.parse(JSON.stringify(e));var r=a[t].split("/"),s=e,o;for(o=1;o<r.length;o++)s=s[r[o]];for(o=0;o<n.length;o++){var i=n[o],d=s[i];d&&(s[i]={anyOf:[d,{$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"}]})}}return e},rt}var at,Qs;function zo(){if(Qs)return at;Qs=1;var n=xa().MissingRef;at=e;function e(a,t,r){var s=this;if(typeof this._opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");typeof t=="function"&&(r=t,t=void 0);var o=i(a).then(function(){var f=s._addSchema(a,void 0,t);return f.validate||d(f)});return r&&o.then(function(f){r(null,f)},r),o;function i(f){var m=f.$schema;return m&&!s.getSchema(m)?e.call(s,{$ref:m},!0):Promise.resolve()}function d(f){try{return s._compile(f)}catch(p){if(p instanceof n)return m(p);throw p}function m(p){var _=p.missingSchema;if(y(_))throw new Error("Schema "+_+" is loaded but "+p.missingRef+" cannot be resolved");var u=s._loadingSchemas[_];return u||(u=s._loadingSchemas[_]=s._opts.loadSchema(_),u.then(c,c)),u.then(function(g){if(!y(_))return i(g).then(function(){y(_)||s.addSchema(g,_,void 0,t)})}).then(function(){return d(f)});function c(){delete s._loadingSchemas[_]}function y(g){return s._refs[g]||s._schemas[g]}}}}return at}var tt,Bs;function Vo(){return Bs||(Bs=1,tt=function(e,a,t){var r=" ",s=e.level,o=e.dataLevel,i=e.schema[a],d=e.schemaPath+e.util.getProperty(a),f=e.errSchemaPath+"/"+a,m=!e.opts.allErrors,p,_="data"+(o||""),u="valid"+s,c="errs__"+s,y=e.opts.$data&&i&&i.$data,g;y?(r+=" var schema"+s+" = "+e.util.getData(i.$data,o,e.dataPathArr)+"; ",g="schema"+s):g=i;var P=this,T="definition"+s,O=P.definition,E="",x,k,I,D,A;if(y&&O.$data){A="keywordValidate"+s;var S=O.validateSchema;r+=" var "+T+" = RULES.custom['"+a+"'].definition; var "+A+" = "+T+".validate;"}else{if(D=e.useCustomRule(P,i,e.schema,e),!D)return;g="validate.schema"+d,A=D.code,x=O.compile,k=O.inline,I=O.macro}var w=A+".errors",C="i"+s,L="ruleErr"+s,q=O.async;if(q&&!e.async)throw new Error("async keyword in sync schema");if(k||I||(r+=""+w+" = null;"),r+="var "+c+" = errors;var "+u+";",y&&O.$data&&(E+="}",r+=" if ("+g+" === undefined) { "+u+" = true; } else { ",S&&(E+="}",r+=" "+u+" = "+T+".validateSchema("+g+"); if ("+u+") { ")),k)O.statements?r+=" "+D.validate+" ":r+=" "+u+" = "+D.validate+"; ";else if(I){var K=e.util.copy(e),E="";K.level++;var se="valid"+K.level;K.schema=D.validate,K.schemaPath="";var G=e.compositeRule;e.compositeRule=K.compositeRule=!0;var le=e.validate(K).replace(/validate\.schema/g,A);e.compositeRule=K.compositeRule=G,r+=" "+le}else{var re=re||[];re.push(r),r="",r+=" "+A+".call( ",e.opts.passContext?r+="this":r+="self",x||O.schema===!1?r+=" , "+_+" ":r+=" , "+g+" , "+_+" , validate.schema"+e.schemaPath+" ",r+=" , (dataPath || '')",e.errorPath!='""'&&(r+=" + "+e.errorPath);var ae=o?"data"+(o-1||""):"parentData",Te=o?e.dataPathArr[o]:"parentDataProperty";r+=" , "+ae+" , "+Te+" , rootData ) ";var Ae=r;r=re.pop(),O.errors===!1?(r+=" "+u+" = ",q&&(r+="await "),r+=""+Ae+"; "):q?(w="customErrors"+s,r+=" var "+w+" = null; try { "+u+" = await "+Ae+"; } catch (e) { "+u+" = false; if (e instanceof ValidationError) "+w+" = e.errors; else throw e; } "):r+=" "+w+" = null; "+u+" = "+Ae+"; "}if(O.modifying&&(r+=" if ("+ae+") "+_+" = "+ae+"["+Te+"];"),r+=""+E,O.valid)m&&(r+=" if (true) { ");else{r+=" if ( ",O.valid===void 0?(r+=" !",I?r+=""+se:r+=""+u):r+=" "+!O.valid+" ",r+=") { ",p=P.keyword;var re=re||[];re.push(r),r="";var re=re||[];re.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(p||"custom")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { keyword: '"+P.keyword+"' } ",e.opts.messages!==!1&&(r+=` , message: 'should pass "`+P.keyword+`" keyword validation' `),e.opts.verbose&&(r+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+_+" "),r+=" } "):r+=" {} ";var Ie=r;r=re.pop(),!e.compositeRule&&m?e.async?r+=" throw new ValidationError(["+Ie+"]); ":r+=" validate.errors = ["+Ie+"]; return false; ":r+=" var err = "+Ie+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";var xe=r;r=re.pop(),k?O.errors?O.errors!="full"&&(r+=" for (var "+C+"="+c+"; "+C+"<errors; "+C+"++) { var "+L+" = vErrors["+C+"]; if ("+L+".dataPath === undefined) "+L+".dataPath = (dataPath || '') + "+e.errorPath+"; if ("+L+".schemaPath === undefined) { "+L+'.schemaPath = "'+f+'"; } ',e.opts.verbose&&(r+=" "+L+".schema = "+g+"; "+L+".data = "+_+"; "),r+=" } "):O.errors===!1?r+=" "+xe+" ":(r+=" if ("+c+" == errors) { "+xe+" } else { for (var "+C+"="+c+"; "+C+"<errors; "+C+"++) { var "+L+" = vErrors["+C+"]; if ("+L+".dataPath === undefined) "+L+".dataPath = (dataPath || '') + "+e.errorPath+"; if ("+L+".schemaPath === undefined) { "+L+'.schemaPath = "'+f+'"; } ',e.opts.verbose&&(r+=" "+L+".schema = "+g+"; "+L+".data = "+_+"; "),r+=" } } "):I?(r+=" var err = ",e.createErrors!==!1?(r+=" { keyword: '"+(p||"custom")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { keyword: '"+P.keyword+"' } ",e.opts.messages!==!1&&(r+=` , message: 'should pass "`+P.keyword+`" keyword validation' `),e.opts.verbose&&(r+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+_+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&m&&(e.async?r+=" throw new ValidationError(vErrors); ":r+=" validate.errors = vErrors; return false; ")):O.errors===!1?r+=" "+xe+" ":(r+=" if (Array.isArray("+w+")) { if (vErrors === null) vErrors = "+w+"; else vErrors = vErrors.concat("+w+"); errors = vErrors.length; for (var "+C+"="+c+"; "+C+"<errors; "+C+"++) { var "+L+" = vErrors["+C+"]; if ("+L+".dataPath === undefined) "+L+".dataPath = (dataPath || '') + "+e.errorPath+"; "+L+'.schemaPath = "'+f+'"; ',e.opts.verbose&&(r+=" "+L+".schema = "+g+"; "+L+".data = "+_+"; "),r+=" } } else { "+xe+" } "),r+=" } ",m&&(r+=" else { ")}return r}),tt}const Hs="http://json-schema.org/draft-07/schema#",Ks="http://json-schema.org/draft-07/schema#",Js="Core schema meta-schema",Ws={schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},Gs=["object","boolean"],Xs={$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},Uo={$schema:Hs,$id:Ks,title:Js,definitions:Ws,type:Gs,properties:Xs,default:!0},Zo={__proto__:null,$id:Ks,$schema:Hs,default:Uo,definitions:Ws,properties:Xs,title:Js,type:Gs},Ys=xt(Zo);var st,en;function Qo(){if(en)return st;en=1;var n=Ys;return st={$id:"https://github.com/ajv-validator/ajv/blob/master/lib/definition_schema.js",definitions:{simpleTypes:n.definitions.simpleTypes},type:"object",dependencies:{schema:["validate"],$data:["validate"],statements:["inline"],valid:{not:{required:["macro"]}}},properties:{type:n.properties.type,schema:{type:"boolean"},statements:{type:"boolean"},dependencies:{type:"array",items:{type:"string"}},metaSchema:{type:"object"},modifying:{type:"boolean"},valid:{type:"boolean"},$data:{type:"boolean"},async:{type:"boolean"},errors:{anyOf:[{type:"boolean"},{const:"full"}]}}},st}var nt,rn;function Bo(){if(rn)return nt;rn=1;var n=/^[a-z_$][a-z0-9_$-]*$/i,e=Vo(),a=Qo();nt={add:t,get:r,remove:s,validate:o};function t(i,d){var f=this.RULES;if(f.keywords[i])throw new Error("Keyword "+i+" is already defined");if(!n.test(i))throw new Error("Keyword "+i+" is not a valid identifier");if(d){this.validateKeyword(d,!0);var m=d.type;if(Array.isArray(m))for(var p=0;p<m.length;p++)u(i,m[p],d);else u(i,m,d);var _=d.metaSchema;_&&(d.$data&&this._opts.$data&&(_={anyOf:[_,{$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"}]}),d.validateSchema=this.compile(_,!0))}f.keywords[i]=f.all[i]=!0;function u(c,y,g){for(var P,T=0;T<f.length;T++){var O=f[T];if(O.type==y){P=O;break}}P||(P={type:y,rules:[]},f.push(P));var E={keyword:c,definition:g,custom:!0,code:e,implements:g.implements};P.rules.push(E),f.custom[c]=E}return this}function r(i){var d=this.RULES.custom[i];return d?d.definition:this.RULES.keywords[i]||!1}function s(i){var d=this.RULES;delete d.keywords[i],delete d.all[i],delete d.custom[i];for(var f=0;f<d.length;f++)for(var m=d[f].rules,p=0;p<m.length;p++)if(m[p].keyword==i){m.splice(p,1);break}return this}function o(i,d){o.errors=null;var f=this._validateKeyword=this._validateKeyword||this.compile(a,!0);if(f(i))return!0;if(o.errors=f.errors,d)throw new Error("custom keyword definition is invalid: "+this.errorsText(f.errors));return!1}return nt}const an="http://json-schema.org/draft-07/schema#",tn="https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",sn="Meta-schema for $data reference (JSON Schema extension proposal)",nn="object",on=["$data"],ln={$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},un=!1,Ho={$schema:an,$id:tn,description:sn,type:nn,required:on,properties:ln,additionalProperties:un},Ko={__proto__:null,$id:tn,$schema:an,additionalProperties:un,default:Ho,description:sn,properties:ln,required:on,type:nn},Jo=xt(Ko);var it,cn;function Wo(){if(cn)return it;cn=1;var n=vo(),e=Sa(),a=go(),t=ss(),r=us(),s=yo(),o=qo(),i=Mo(),d=Sr();it=c,c.prototype.validate=y,c.prototype.compile=g,c.prototype.addSchema=P,c.prototype.addMetaSchema=T,c.prototype.validateSchema=O,c.prototype.getSchema=x,c.prototype.removeSchema=D,c.prototype.addFormat=G,c.prototype.errorsText=se,c.prototype._addSchema=S,c.prototype._compile=w,c.prototype.compileAsync=zo();var f=Bo();c.prototype.addKeyword=f.add,c.prototype.getKeyword=f.get,c.prototype.removeKeyword=f.remove,c.prototype.validateKeyword=f.validate;var m=xa();c.ValidationError=m.Validation,c.MissingRefError=m.MissingRef,c.$dataMetaSchema=i;var p="http://json-schema.org/draft-07/schema",_=["removeAdditional","useDefaults","coerceTypes","strictDefaults"],u=["/properties"];function c(b){if(!(this instanceof c))return new c(b);b=this._opts=d.copy(b)||{},xe(this),this._schemas={},this._refs={},this._fragments={},this._formats=s(b.format),this._cache=b.cache||new a,this._loadingSchemas={},this._compilations=[],this.RULES=o(),this._getId=C(b),b.loopRequired=b.loopRequired||1/0,b.errorDataPath=="property"&&(b._errorDataPathProperty=!0),b.serialize===void 0&&(b.serialize=r),this._metaOpts=Ie(this),b.formats&&ae(this),b.keywords&&Te(this),le(this),typeof b.meta=="object"&&this.addMetaSchema(b.meta),b.nullable&&this.addKeyword("nullable",{metaSchema:{type:"boolean"}}),re(this)}function y(b,j){var V;if(typeof b=="string"){if(V=this.getSchema(b),!V)throw new Error('no schema with key or ref "'+b+'"')}else{var ee=this._addSchema(b);V=ee.validate||this._compile(ee)}var N=V(j);return V.$async!==!0&&(this.errors=V.errors),N}function g(b,j){var V=this._addSchema(b,void 0,j);return V.validate||this._compile(V)}function P(b,j,V,ee){if(Array.isArray(b)){for(var N=0;N<b.length;N++)this.addSchema(b[N],void 0,V,ee);return this}var z=this._getId(b);if(z!==void 0&&typeof z!="string")throw new Error("schema id must be string");return j=e.normalizeId(j||z),Ae(this,j),this._schemas[j]=this._addSchema(b,V,ee,!0),this}function T(b,j,V){return this.addSchema(b,j,V,!0),this}function O(b,j){var V=b.$schema;if(V!==void 0&&typeof V!="string")throw new Error("$schema must be a string");if(V=V||this._opts.defaultMeta||E(this),!V)return this.logger.warn("meta-schema not available"),this.errors=null,!0;var ee=this.validate(V,b);if(!ee&&j){var N="schema is invalid: "+this.errorsText();if(this._opts.validateSchema=="log")this.logger.error(N);else throw new Error(N)}return ee}function E(b){var j=b._opts.meta;return b._opts.defaultMeta=typeof j=="object"?b._getId(j)||j:b.getSchema(p)?p:void 0,b._opts.defaultMeta}function x(b){var j=I(this,b);switch(typeof j){case"object":return j.validate||this._compile(j);case"string":return this.getSchema(j);case"undefined":return k(this,b)}}function k(b,j){var V=e.schema.call(b,{schema:{}},j);if(V){var ee=V.schema,N=V.root,z=V.baseId,ie=n.call(b,ee,N,void 0,z);return b._fragments[j]=new t({ref:j,fragment:!0,schema:ee,root:N,baseId:z,validate:ie}),ie}}function I(b,j){return j=e.normalizeId(j),b._schemas[j]||b._refs[j]||b._fragments[j]}function D(b){if(b instanceof RegExp)return A(this,this._schemas,b),A(this,this._refs,b),this;switch(typeof b){case"undefined":return A(this,this._schemas),A(this,this._refs),this._cache.clear(),this;case"string":var j=I(this,b);return j&&this._cache.del(j.cacheKey),delete this._schemas[b],delete this._refs[b],this;case"object":var V=this._opts.serialize,ee=V?V(b):b;this._cache.del(ee);var N=this._getId(b);N&&(N=e.normalizeId(N),delete this._schemas[N],delete this._refs[N])}return this}function A(b,j,V){for(var ee in j){var N=j[ee];!N.meta&&(!V||V.test(ee))&&(b._cache.del(N.cacheKey),delete j[ee])}}function S(b,j,V,ee){if(typeof b!="object"&&typeof b!="boolean")throw new Error("schema should be object or boolean");var N=this._opts.serialize,z=N?N(b):b,ie=this._cache.get(z);if(ie)return ie;ee=ee||this._opts.addUsedSchema!==!1;var fe=e.normalizeId(this._getId(b));fe&&ee&&Ae(this,fe);var ue=this._opts.validateSchema!==!1&&!j,_e;ue&&!(_e=fe&&fe==e.normalizeId(b.$schema))&&this.validateSchema(b,!0);var pe=e.ids.call(this,b),ve=new t({id:fe,schema:b,localRefs:pe,cacheKey:z,meta:V});return fe[0]!="#"&&ee&&(this._refs[fe]=ve),this._cache.put(z,ve),ue&&_e&&this.validateSchema(b,!0),ve}function w(b,j){if(b.compiling)return b.validate=N,N.schema=b.schema,N.errors=null,N.root=j||N,b.schema.$async===!0&&(N.$async=!0),N;b.compiling=!0;var V;b.meta&&(V=this._opts,this._opts=this._metaOpts);var ee;try{ee=n.call(this,b.schema,j,b.localRefs)}catch(z){throw delete b.validate,z}finally{b.compiling=!1,b.meta&&(this._opts=V)}return b.validate=ee,b.refs=ee.refs,b.refVal=ee.refVal,b.root=ee.root,ee;function N(){var z=b.validate,ie=z.apply(this,arguments);return N.errors=z.errors,ie}}function C(b){switch(b.schemaId){case"auto":return K;case"id":return L;default:return q}}function L(b){return b.$id&&this.logger.warn("schema $id ignored",b.$id),b.id}function q(b){return b.id&&this.logger.warn("schema id ignored",b.id),b.$id}function K(b){if(b.$id&&b.id&&b.$id!=b.id)throw new Error("schema $id is different from id");return b.$id||b.id}function se(b,j){if(b=b||this.errors,!b)return"No errors";j=j||{};for(var V=j.separator===void 0?", ":j.separator,ee=j.dataVar===void 0?"data":j.dataVar,N="",z=0;z<b.length;z++){var ie=b[z];ie&&(N+=ee+ie.dataPath+" "+ie.message+V)}return N.slice(0,-V.length)}function G(b,j){return typeof j=="string"&&(j=new RegExp(j)),this._formats[b]=j,this}function le(b){var j;if(b._opts.$data&&(j=Jo,b.addMetaSchema(j,j.$id,!0)),b._opts.meta!==!1){var V=Ys;b._opts.$data&&(V=i(V,u)),b.addMetaSchema(V,p,!0),b._refs["http://json-schema.org/schema"]=p}}function re(b){var j=b._opts.schemas;if(j)if(Array.isArray(j))b.addSchema(j);else for(var V in j)b.addSchema(j[V],V)}function ae(b){for(var j in b._opts.formats){var V=b._opts.formats[j];b.addFormat(j,V)}}function Te(b){for(var j in b._opts.keywords){var V=b._opts.keywords[j];b.addKeyword(j,V)}}function Ae(b,j){if(b._schemas[j]||b._refs[j])throw new Error('schema with key or id "'+j+'" already exists')}function Ie(b){for(var j=d.copy(b._opts),V=0;V<_.length;V++)delete j[_[V]];return j}function xe(b){var j=b._opts.logger;if(j===!1)b.logger={log:Ve,warn:Ve,error:Ve};else{if(j===void 0&&(j=console),!(typeof j=="object"&&j.log&&j.warn&&j.error))throw new Error("logger must implement log, warn and error methods");b.logger=j}}function Ve(){}return it}Wo(),new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");var ot;(function(n){n.Completable="McpCompletable"})(ot||(ot={}));class fn extends ce{_parse(e){const{ctx:a}=this._processInputParams(e),t=a.data;return this._def.type._parse({data:t,path:a.path,parent:a})}unwrap(){return this._def.type}}fn.create=(n,e)=>new fn({type:n,typeName:ot.Completable,complete:e.complete,...Go(e)});function Go(n){if(!n)return{};const{errorMap:e,invalid_type_error:a,required_error:t,description:r}=n;if(e&&(a||t))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:r}:{errorMap:(o,i)=>{var d,f;const{message:m}=n;return o.code==="invalid_enum_value"?{message:m??i.defaultError}:typeof i.data>"u"?{message:(d=m??t)!==null&&d!==void 0?d:i.defaultError}:o.code!=="invalid_type"?{message:i.defaultError}:{message:(f=m??a)!==null&&f!==void 0?f:i.defaultError}},description:r}}const dn=1e6,lt=1e6,hn=1e4,Xo=1e6;class fr{static isTemplate(e){return/\{[^}\s]+\}/.test(e)}static validateLength(e,a,t){if(e.length>a)throw new Error(`${t} exceeds maximum length of ${a} characters (got ${e.length})`)}get variableNames(){return this.parts.flatMap(e=>typeof e=="string"?[]:e.names)}constructor(e){fr.validateLength(e,dn,"Template"),this.template=e,this.parts=this.parse(e)}toString(){return this.template}parse(e){const a=[];let t="",r=0,s=0;for(;r<e.length;)if(e[r]==="{"){t&&(a.push(t),t="");const o=e.indexOf("}",r);if(o===-1)throw new Error("Unclosed template expression");if(s++,s>hn)throw new Error(`Template contains too many expressions (max ${hn})`);const i=e.slice(r+1,o),d=this.getOperator(i),f=i.includes("*"),m=this.getNames(i),p=m[0];for(const _ of m)fr.validateLength(_,lt,"Variable name");a.push({name:p,operator:d,names:m,exploded:f}),r=o+1}else t+=e[r],r++;return t&&a.push(t),a}getOperator(e){return["+","#",".","/","?","&"].find(t=>e.startsWith(t))||""}getNames(e){const a=this.getOperator(e);return e.slice(a.length).split(",").map(t=>t.replace("*","").trim()).filter(t=>t.length>0)}encodeValue(e,a){return fr.validateLength(e,lt,"Variable value"),a==="+"||a==="#"?encodeURI(e):encodeURIComponent(e)}expandPart(e,a){if(e.operator==="?"||e.operator==="&"){const o=e.names.map(d=>{const f=a[d];if(f===void 0)return"";const m=Array.isArray(f)?f.map(p=>this.encodeValue(p,e.operator)).join(","):this.encodeValue(f.toString(),e.operator);return`${d}=${m}`}).filter(d=>d.length>0);return o.length===0?"":(e.operator==="?"?"?":"&")+o.join("&")}if(e.names.length>1){const o=e.names.map(i=>a[i]).filter(i=>i!==void 0);return o.length===0?"":o.map(i=>Array.isArray(i)?i[0]:i).join(",")}const t=a[e.name];if(t===void 0)return"";const s=(Array.isArray(t)?t:[t]).map(o=>this.encodeValue(o,e.operator));switch(e.operator){case"":return s.join(",");case"+":return s.join(",");case"#":return"#"+s.join(",");case".":return"."+s.join(".");case"/":return"/"+s.join("/");default:return s.join(",")}}expand(e){let a="",t=!1;for(const r of this.parts){if(typeof r=="string"){a+=r;continue}const s=this.expandPart(r,e);s&&((r.operator==="?"||r.operator==="&")&&t?a+=s.replace("?","&"):a+=s,(r.operator==="?"||r.operator==="&")&&(t=!0))}return a}escapeRegExp(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}partToRegExp(e){const a=[];for(const s of e.names)fr.validateLength(s,lt,"Variable name");if(e.operator==="?"||e.operator==="&"){for(let s=0;s<e.names.length;s++){const o=e.names[s],i=s===0?"\\"+e.operator:"&";a.push({pattern:i+this.escapeRegExp(o)+"=([^&]+)",name:o})}return a}let t;const r=e.name;switch(e.operator){case"":t=e.exploded?"([^/]+(?:,[^/]+)*)":"([^/,]+)";break;case"+":case"#":t="(.+)";break;case".":t="\\.([^/,]+)";break;case"/":t="/"+(e.exploded?"([^/]+(?:,[^/]+)*)":"([^/,]+)");break;default:t="([^/]+)"}return a.push({pattern:t,name:r}),a}match(e){fr.validateLength(e,dn,"URI");let a="^";const t=[];for(const i of this.parts)if(typeof i=="string")a+=this.escapeRegExp(i);else{const d=this.partToRegExp(i);for(const{pattern:f,name:m}of d)a+=f,t.push({name:m,exploded:i.exploded})}a+="$",fr.validateLength(a,Xo,"Generated regex pattern");const r=new RegExp(a),s=e.match(r);if(!s)return null;const o={};for(let i=0;i<t.length;i++){const{name:d,exploded:f}=t[i],m=s[i+1],p=d.replace("*","");f&&m.includes(",")?o[p]=m.split(","):o[p]=m}return o}}class Yo{constructor(e,a){this._callbacks=a,this._uriTemplate=typeof e=="string"?new fr(e):e}get uriTemplate(){return this._uriTemplate}get listCallback(){return this._callbacks.list}completeCallback(e){var a;return(a=this._callbacks.complete)===null||a===void 0?void 0:a[e]}}class el{append(e){this._buffer=this._buffer?Buffer.concat([this._buffer,e]):e}readMessage(){if(!this._buffer)return null;const e=this._buffer.indexOf(`
3
- `);if(e===-1)return null;const a=this._buffer.toString("utf8",0,e).replace(/\r$/,"");return this._buffer=this._buffer.subarray(e+1),rl(a)}clear(){this._buffer=void 0}}function rl(n){return ui.parse(JSON.parse(n))}function al(n){return JSON.stringify(n)+`
4
- `}class tl{constructor(e=bt.stdin,a=bt.stdout){this._stdin=e,this._stdout=a,this._readBuffer=new el,this._started=!1,this._ondata=t=>{this._readBuffer.append(t),this.processReadBuffer()},this._onerror=t=>{var r;(r=this.onerror)===null||r===void 0||r.call(this,t)}}async start(){if(this._started)throw new Error("StdioServerTransport already started! If using Server class, note that connect() calls start() automatically.");this._started=!0,this._stdin.on("data",this._ondata),this._stdin.on("error",this._onerror)}processReadBuffer(){for(var e,a;;)try{const t=this._readBuffer.readMessage();if(t===null)break;(e=this.onmessage)===null||e===void 0||e.call(this,t)}catch(t){(a=this.onerror)===null||a===void 0||a.call(this,t)}}async close(){var e;this._stdin.off("data",this._ondata),this._stdin.off("error",this._onerror),this._stdin.listenerCount("data")===0&&this._stdin.pause(),this._readBuffer.clear(),(e=this.onclose)===null||e===void 0||e.call(this)}send(e){return new Promise(a=>{const t=al(e);this._stdout.write(t)?a():this._stdout.once("drain",a)})}}const mn=On(process.env.LIKEC4_WORKSPACE||".");async function sl(){console.error(`Loading LikeC4 from workspace ${mn}`);const n=await $n.fromWorkspace(mn,{logger:!1}),e=n.langium.mcp.Tools,a=n.langium.mcp.ServerFactory.create({capabilities:{completions:{},tools:{},resources:{}}});a.resource("likec4 element",new Yo("likec4://projects/{project}/elements/{id}",{list:async()=>{const r=await n.languageServices.projects(),s=[];for(const{id:o}of r){const i=n.computedModel(o);for(const d of i.elements())s.push({uri:`likec4://projects/${o}/elements/${d.id}`,name:d.title,id:d.id,description:`Model element of kind "${d.kind}"`})}return{resources:s}},complete:{project:async r=>{const s=await n.projects(),o=r.toLowerCase();return s.filter(i=>i.toLowerCase().startsWith(o))},id:async r=>{const{id:s}=n.languageServices.projects()[0],o=n.computedModel(s);return[...Dn(o.elements(),i=>i.id.startsWith(r))].map(i=>i.id)}}}),async(r,{project:s,id:o})=>{const i=await e.readElement({id:o,project:s});return{contents:[{uri:r.href,mimeType:"application/json",text:i}]}}),a.server.oninitialized=()=>{a.server.sendLoggingMessage({level:"info",data:{message:"Server initialized",workspace:n.workspace}})};const t=new tl;console.error("Connecting server to transport..."),await a.connect(t),console.error("LikeC4 MCP Server running on stdio")}sl().catch(n=>{console.error(n),process.exit(1)});
2
+ import je from"node:process";import{LikeC4 as ut}from"likec4";import{resolve as lt}from"node:path";var b;(function(s){s.assertEqual=a=>{};function e(a){}s.assertIs=e;function t(a){throw new Error}s.assertNever=t,s.arrayToEnum=a=>{const n={};for(const i of a)n[i]=i;return n},s.getValidEnumValues=a=>{const n=s.objectKeys(a).filter(o=>typeof a[a[o]]!="number"),i={};for(const o of n)i[o]=a[o];return s.objectValues(i)},s.objectValues=a=>s.objectKeys(a).map(function(n){return a[n]}),s.objectKeys=typeof Object.keys=="function"?a=>Object.keys(a):a=>{const n=[];for(const i in a)Object.prototype.hasOwnProperty.call(a,i)&&n.push(i);return n},s.find=(a,n)=>{for(const i of a)if(n(i))return i},s.isInteger=typeof Number.isInteger=="function"?a=>Number.isInteger(a):a=>typeof a=="number"&&Number.isFinite(a)&&Math.floor(a)===a;function r(a,n=" | "){return a.map(i=>typeof i=="string"?`'${i}'`:i).join(n)}s.joinValues=r,s.jsonStringifyReplacer=(a,n)=>typeof n=="bigint"?n.toString():n})(b||(b={}));var Ee;(function(s){s.mergeShapes=(e,t)=>({...e,...t})})(Ee||(Ee={}));const h=b.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),D=s=>{switch(typeof s){case"undefined":return h.undefined;case"string":return h.string;case"number":return Number.isNaN(s)?h.nan:h.number;case"boolean":return h.boolean;case"function":return h.function;case"bigint":return h.bigint;case"symbol":return h.symbol;case"object":return Array.isArray(s)?h.array:s===null?h.null:s.then&&typeof s.then=="function"&&s.catch&&typeof s.catch=="function"?h.promise:typeof Map<"u"&&s instanceof Map?h.map:typeof Set<"u"&&s instanceof Set?h.set:typeof Date<"u"&&s instanceof Date?h.date:h.object;default:return h.unknown}},d=b.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 z extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){const t=e||function(n){return n.message},r={_errors:[]},a=n=>{for(const i of n.issues)if(i.code==="invalid_union")i.unionErrors.map(a);else if(i.code==="invalid_return_type")a(i.returnTypeError);else if(i.code==="invalid_arguments")a(i.argumentsError);else if(i.path.length===0)r._errors.push(t(i));else{let o=r,p=0;for(;p<i.path.length;){const g=i.path[p];p===i.path.length-1?(o[g]=o[g]||{_errors:[]},o[g]._errors.push(t(i))):o[g]=o[g]||{_errors:[]},o=o[g],p++}}};return a(this),r}static assert(e){if(!(e instanceof z))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,b.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){const t={},r=[];for(const a of this.issues)a.path.length>0?(t[a.path[0]]=t[a.path[0]]||[],t[a.path[0]].push(e(a))):r.push(e(a));return{formErrors:r,fieldErrors:t}}get formErrors(){return this.flatten()}}z.create=s=>new z(s);const ve=(s,e)=>{let t;switch(s.code){case d.invalid_type:s.received===h.undefined?t="Required":t=`Expected ${s.expected}, received ${s.received}`;break;case d.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(s.expected,b.jsonStringifyReplacer)}`;break;case d.unrecognized_keys:t=`Unrecognized key(s) in object: ${b.joinValues(s.keys,", ")}`;break;case d.invalid_union:t="Invalid input";break;case d.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${b.joinValues(s.options)}`;break;case d.invalid_enum_value:t=`Invalid enum value. Expected ${b.joinValues(s.options)}, received '${s.received}'`;break;case d.invalid_arguments:t="Invalid function arguments";break;case d.invalid_return_type:t="Invalid function return type";break;case d.invalid_date:t="Invalid date";break;case d.invalid_string:typeof s.validation=="object"?"includes"in s.validation?(t=`Invalid input: must include "${s.validation.includes}"`,typeof s.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${s.validation.position}`)):"startsWith"in s.validation?t=`Invalid input: must start with "${s.validation.startsWith}"`:"endsWith"in s.validation?t=`Invalid input: must end with "${s.validation.endsWith}"`:b.assertNever(s.validation):s.validation!=="regex"?t=`Invalid ${s.validation}`:t="Invalid";break;case d.too_small:s.type==="array"?t=`Array must contain ${s.exact?"exactly":s.inclusive?"at least":"more than"} ${s.minimum} element(s)`:s.type==="string"?t=`String must contain ${s.exact?"exactly":s.inclusive?"at least":"over"} ${s.minimum} character(s)`:s.type==="number"?t=`Number must be ${s.exact?"exactly equal to ":s.inclusive?"greater than or equal to ":"greater than "}${s.minimum}`:s.type==="date"?t=`Date must be ${s.exact?"exactly equal to ":s.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(s.minimum))}`:t="Invalid input";break;case d.too_big:s.type==="array"?t=`Array must contain ${s.exact?"exactly":s.inclusive?"at most":"less than"} ${s.maximum} element(s)`:s.type==="string"?t=`String must contain ${s.exact?"exactly":s.inclusive?"at most":"under"} ${s.maximum} character(s)`:s.type==="number"?t=`Number must be ${s.exact?"exactly":s.inclusive?"less than or equal to":"less than"} ${s.maximum}`:s.type==="bigint"?t=`BigInt must be ${s.exact?"exactly":s.inclusive?"less than or equal to":"less than"} ${s.maximum}`:s.type==="date"?t=`Date must be ${s.exact?"exactly":s.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(s.maximum))}`:t="Invalid input";break;case d.custom:t="Invalid input";break;case d.invalid_intersection_types:t="Intersection results could not be merged";break;case d.not_multiple_of:t=`Number must be a multiple of ${s.multipleOf}`;break;case d.not_finite:t="Number must be finite";break;default:t=e.defaultError,b.assertNever(s)}return{message:t}};let ht=ve;function ft(){return ht}const mt=s=>{const{data:e,path:t,errorMaps:r,issueData:a}=s,n=[...t,...a.path||[]],i={...a,path:n};if(a.message!==void 0)return{...a,path:n,message:a.message};let o="";const p=r.filter(g=>!!g).slice().reverse();for(const g of p)o=g(i,{data:e,defaultError:o}).message;return{...a,path:n,message:o}};function u(s,e){const t=ft(),r=mt({issueData:e,data:s.data,path:s.path,errorMaps:[s.common.contextualErrorMap,s.schemaErrorMap,t,t===ve?void 0:ve].filter(a=>!!a)});s.common.issues.push(r)}class N{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){const r=[];for(const a of t){if(a.status==="aborted")return _;a.status==="dirty"&&e.dirty(),r.push(a.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,t){const r=[];for(const a of t){const n=await a.key,i=await a.value;r.push({key:n,value:i})}return N.mergeObjectSync(e,r)}static mergeObjectSync(e,t){const r={};for(const a of t){const{key:n,value:i}=a;if(n.status==="aborted"||i.status==="aborted")return _;n.status==="dirty"&&e.dirty(),i.status==="dirty"&&e.dirty(),n.value!=="__proto__"&&(typeof i.value<"u"||a.alwaysSet)&&(r[n.value]=i.value)}return{status:e.value,value:r}}}const _=Object.freeze({status:"aborted"}),X=s=>({status:"dirty",value:s}),Z=s=>({status:"valid",value:s}),Pe=s=>s.status==="aborted",Le=s=>s.status==="dirty",H=s=>s.status==="valid",ne=s=>typeof Promise<"u"&&s instanceof Promise;var m;(function(s){s.errToObj=e=>typeof e=="string"?{message:e}:e||{},s.toString=e=>typeof e=="string"?e:e?.message})(m||(m={}));class E{constructor(e,t,r,a){this._cachedPath=[],this.parent=e,this.data=t,this._path=r,this._key=a}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const $e=(s,e)=>{if(H(e))return{success:!0,data:e.value};if(!s.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 z(s.common.issues);return this._error=t,this._error}}};function x(s){if(!s)return{};const{errorMap:e,invalid_type_error:t,required_error:r,description:a}=s;if(e&&(t||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:a}:{errorMap:(i,o)=>{const{message:p}=s;return i.code==="invalid_enum_value"?{message:p??o.defaultError}:typeof o.data>"u"?{message:p??r??o.defaultError}:i.code!=="invalid_type"?{message:o.defaultError}:{message:p??t??o.defaultError}},description:a}}class k{get description(){return this._def.description}_getType(e){return D(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:D(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new N,ctx:{common:e.parent.common,data:e.data,parsedType:D(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(ne(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){const r={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:D(e)},a=this._parseSync({data:e,path:r.path,parent:r});return $e(r,a)}"~validate"(e){const t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:D(e)};if(!this["~standard"].async)try{const r=this._parseSync({data:e,path:[],parent:t});return H(r)?{value:r.value}:{issues:t.common.issues}}catch(r){r?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(r=>H(r)?{value:r.value}:{issues:t.common.issues})}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:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:D(e)},a=this._parse({data:e,path:r.path,parent:r}),n=await(ne(a)?a:Promise.resolve(a));return $e(r,n)}refine(e,t){const r=a=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(a):t;return this._refinement((a,n)=>{const i=e(a),o=()=>n.addIssue({code:d.custom,...r(a)});return typeof Promise<"u"&&i instanceof Promise?i.then(p=>p?!0:(o(),!1)):i?!0:(o(),!1)})}refinement(e,t){return this._refinement((r,a)=>e(r)?!0:(a.addIssue(typeof t=="function"?t(r,a):t),!1))}_refinement(e){return new U({schema:this,typeName:y.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}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.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:t=>this["~validate"](t)}}optional(){return M.create(this,this._def)}nullable(){return F.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return L.create(this)}promise(){return de.create(this,this._def)}or(e){return ie.create([this,e],this._def)}and(e){return oe.create(this,e,this._def)}transform(e){return new U({...x(this._def),schema:this,typeName:y.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t=typeof e=="function"?e:()=>e;return new ue({...x(this._def),innerType:this,defaultValue:t,typeName:y.ZodDefault})}brand(){return new We({typeName:y.ZodBranded,type:this,...x(this._def)})}catch(e){const t=typeof e=="function"?e:()=>e;return new le({...x(this._def),innerType:this,catchValue:t,typeName:y.ZodCatch})}describe(e){const t=this.constructor;return new t({...this._def,description:e})}pipe(e){return Ie.create(this,e)}readonly(){return he.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const pt=/^c[^\s-]{8,}$/i,gt=/^[0-9a-z]+$/,_t=/^[0-9A-HJKMNP-TV-Z]{26}$/i,yt=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,vt=/^[a-z0-9_-]{21}$/i,xt=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,kt=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,bt=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,St="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let xe;const wt=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Tt=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,Rt=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,Ct=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Nt=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Ot=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Me="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",At=new RegExp(`^${Me}$`);function Ve(s){let e="[0-5]\\d";s.precision?e=`${e}\\.\\d{${s.precision}}`:s.precision==null&&(e=`${e}(\\.\\d+)?`);const t=s.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${t}`}function Zt(s){return new RegExp(`^${Ve(s)}$`)}function It(s){let e=`${Me}T${Ve(s)}`;const t=[];return t.push(s.local?"Z?":"Z"),s.offset&&t.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${t.join("|")})`,new RegExp(`^${e}$`)}function jt(s,e){return!!((e==="v4"||!e)&&wt.test(s)||(e==="v6"||!e)&&Rt.test(s))}function Et(s,e){if(!xt.test(s))return!1;try{const[t]=s.split("."),r=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),a=JSON.parse(atob(r));return!(typeof a!="object"||a===null||"typ"in a&&a?.typ!=="JWT"||!a.alg||e&&a.alg!==e)}catch{return!1}}function Pt(s,e){return!!((e==="v4"||!e)&&Tt.test(s)||(e==="v6"||!e)&&Ct.test(s))}class q extends k{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==h.string){const n=this._getOrReturnCtx(e);return u(n,{code:d.invalid_type,expected:h.string,received:n.parsedType}),_}const r=new N;let a;for(const n of this._def.checks)if(n.kind==="min")e.data.length<n.value&&(a=this._getOrReturnCtx(e,a),u(a,{code:d.too_small,minimum:n.value,type:"string",inclusive:!0,exact:!1,message:n.message}),r.dirty());else if(n.kind==="max")e.data.length>n.value&&(a=this._getOrReturnCtx(e,a),u(a,{code:d.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!1,message:n.message}),r.dirty());else if(n.kind==="length"){const i=e.data.length>n.value,o=e.data.length<n.value;(i||o)&&(a=this._getOrReturnCtx(e,a),i?u(a,{code:d.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message}):o&&u(a,{code:d.too_small,minimum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message}),r.dirty())}else if(n.kind==="email")bt.test(e.data)||(a=this._getOrReturnCtx(e,a),u(a,{validation:"email",code:d.invalid_string,message:n.message}),r.dirty());else if(n.kind==="emoji")xe||(xe=new RegExp(St,"u")),xe.test(e.data)||(a=this._getOrReturnCtx(e,a),u(a,{validation:"emoji",code:d.invalid_string,message:n.message}),r.dirty());else if(n.kind==="uuid")yt.test(e.data)||(a=this._getOrReturnCtx(e,a),u(a,{validation:"uuid",code:d.invalid_string,message:n.message}),r.dirty());else if(n.kind==="nanoid")vt.test(e.data)||(a=this._getOrReturnCtx(e,a),u(a,{validation:"nanoid",code:d.invalid_string,message:n.message}),r.dirty());else if(n.kind==="cuid")pt.test(e.data)||(a=this._getOrReturnCtx(e,a),u(a,{validation:"cuid",code:d.invalid_string,message:n.message}),r.dirty());else if(n.kind==="cuid2")gt.test(e.data)||(a=this._getOrReturnCtx(e,a),u(a,{validation:"cuid2",code:d.invalid_string,message:n.message}),r.dirty());else if(n.kind==="ulid")_t.test(e.data)||(a=this._getOrReturnCtx(e,a),u(a,{validation:"ulid",code:d.invalid_string,message:n.message}),r.dirty());else if(n.kind==="url")try{new URL(e.data)}catch{a=this._getOrReturnCtx(e,a),u(a,{validation:"url",code:d.invalid_string,message:n.message}),r.dirty()}else n.kind==="regex"?(n.regex.lastIndex=0,n.regex.test(e.data)||(a=this._getOrReturnCtx(e,a),u(a,{validation:"regex",code:d.invalid_string,message:n.message}),r.dirty())):n.kind==="trim"?e.data=e.data.trim():n.kind==="includes"?e.data.includes(n.value,n.position)||(a=this._getOrReturnCtx(e,a),u(a,{code:d.invalid_string,validation:{includes:n.value,position:n.position},message:n.message}),r.dirty()):n.kind==="toLowerCase"?e.data=e.data.toLowerCase():n.kind==="toUpperCase"?e.data=e.data.toUpperCase():n.kind==="startsWith"?e.data.startsWith(n.value)||(a=this._getOrReturnCtx(e,a),u(a,{code:d.invalid_string,validation:{startsWith:n.value},message:n.message}),r.dirty()):n.kind==="endsWith"?e.data.endsWith(n.value)||(a=this._getOrReturnCtx(e,a),u(a,{code:d.invalid_string,validation:{endsWith:n.value},message:n.message}),r.dirty()):n.kind==="datetime"?It(n).test(e.data)||(a=this._getOrReturnCtx(e,a),u(a,{code:d.invalid_string,validation:"datetime",message:n.message}),r.dirty()):n.kind==="date"?At.test(e.data)||(a=this._getOrReturnCtx(e,a),u(a,{code:d.invalid_string,validation:"date",message:n.message}),r.dirty()):n.kind==="time"?Zt(n).test(e.data)||(a=this._getOrReturnCtx(e,a),u(a,{code:d.invalid_string,validation:"time",message:n.message}),r.dirty()):n.kind==="duration"?kt.test(e.data)||(a=this._getOrReturnCtx(e,a),u(a,{validation:"duration",code:d.invalid_string,message:n.message}),r.dirty()):n.kind==="ip"?jt(e.data,n.version)||(a=this._getOrReturnCtx(e,a),u(a,{validation:"ip",code:d.invalid_string,message:n.message}),r.dirty()):n.kind==="jwt"?Et(e.data,n.alg)||(a=this._getOrReturnCtx(e,a),u(a,{validation:"jwt",code:d.invalid_string,message:n.message}),r.dirty()):n.kind==="cidr"?Pt(e.data,n.version)||(a=this._getOrReturnCtx(e,a),u(a,{validation:"cidr",code:d.invalid_string,message:n.message}),r.dirty()):n.kind==="base64"?Nt.test(e.data)||(a=this._getOrReturnCtx(e,a),u(a,{validation:"base64",code:d.invalid_string,message:n.message}),r.dirty()):n.kind==="base64url"?Ot.test(e.data)||(a=this._getOrReturnCtx(e,a),u(a,{validation:"base64url",code:d.invalid_string,message:n.message}),r.dirty()):b.assertNever(n);return{status:r.value,value:e.data}}_regex(e,t,r){return this.refinement(a=>e.test(a),{validation:t,code:d.invalid_string,...m.errToObj(r)})}_addCheck(e){return new q({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...m.errToObj(e)})}url(e){return this._addCheck({kind:"url",...m.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...m.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...m.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...m.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...m.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...m.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...m.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...m.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...m.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...m.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...m.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...m.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...m.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...m.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...m.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...m.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...m.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...m.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...m.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...m.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...m.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...m.errToObj(t)})}nonempty(e){return this.min(1,m.errToObj(e))}trim(){return new q({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new q({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new q({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}}q.create=s=>new q({checks:[],typeName:y.ZodString,coerce:s?.coerce??!1,...x(s)});function Lt(s,e){const t=(s.toString().split(".")[1]||"").length,r=(e.toString().split(".")[1]||"").length,a=t>r?t:r,n=Number.parseInt(s.toFixed(a).replace(".","")),i=Number.parseInt(e.toFixed(a).replace(".",""));return n%i/10**a}class Y extends k{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==h.number){const n=this._getOrReturnCtx(e);return u(n,{code:d.invalid_type,expected:h.number,received:n.parsedType}),_}let r;const a=new N;for(const n of this._def.checks)n.kind==="int"?b.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),u(r,{code:d.invalid_type,expected:"integer",received:"float",message:n.message}),a.dirty()):n.kind==="min"?(n.inclusive?e.data<n.value:e.data<=n.value)&&(r=this._getOrReturnCtx(e,r),u(r,{code:d.too_small,minimum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),a.dirty()):n.kind==="max"?(n.inclusive?e.data>n.value:e.data>=n.value)&&(r=this._getOrReturnCtx(e,r),u(r,{code:d.too_big,maximum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),a.dirty()):n.kind==="multipleOf"?Lt(e.data,n.value)!==0&&(r=this._getOrReturnCtx(e,r),u(r,{code:d.not_multiple_of,multipleOf:n.value,message:n.message}),a.dirty()):n.kind==="finite"?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),u(r,{code:d.not_finite,message:n.message}),a.dirty()):b.assertNever(n);return{status:a.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,m.toString(t))}gt(e,t){return this.setLimit("min",e,!1,m.toString(t))}lte(e,t){return this.setLimit("max",e,!0,m.toString(t))}lt(e,t){return this.setLimit("max",e,!1,m.toString(t))}setLimit(e,t,r,a){return new Y({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:m.toString(a)}]})}_addCheck(e){return new Y({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:m.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:m.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:m.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:m.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:m.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:m.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:m.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:m.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:m.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&b.isInteger(e.value))}get isFinite(){let e=null,t=null;for(const r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(t===null||r.value>t)&&(t=r.value):r.kind==="max"&&(e===null||r.value<e)&&(e=r.value)}return Number.isFinite(t)&&Number.isFinite(e)}}Y.create=s=>new Y({checks:[],typeName:y.ZodNumber,coerce:s?.coerce||!1,...x(s)});class re extends k{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==h.bigint)return this._getInvalidInput(e);let r;const a=new N;for(const n of this._def.checks)n.kind==="min"?(n.inclusive?e.data<n.value:e.data<=n.value)&&(r=this._getOrReturnCtx(e,r),u(r,{code:d.too_small,type:"bigint",minimum:n.value,inclusive:n.inclusive,message:n.message}),a.dirty()):n.kind==="max"?(n.inclusive?e.data>n.value:e.data>=n.value)&&(r=this._getOrReturnCtx(e,r),u(r,{code:d.too_big,type:"bigint",maximum:n.value,inclusive:n.inclusive,message:n.message}),a.dirty()):n.kind==="multipleOf"?e.data%n.value!==BigInt(0)&&(r=this._getOrReturnCtx(e,r),u(r,{code:d.not_multiple_of,multipleOf:n.value,message:n.message}),a.dirty()):b.assertNever(n);return{status:a.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return u(t,{code:d.invalid_type,expected:h.bigint,received:t.parsedType}),_}gte(e,t){return this.setLimit("min",e,!0,m.toString(t))}gt(e,t){return this.setLimit("min",e,!1,m.toString(t))}lte(e,t){return this.setLimit("max",e,!0,m.toString(t))}lt(e,t){return this.setLimit("max",e,!1,m.toString(t))}setLimit(e,t,r,a){return new re({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:m.toString(a)}]})}_addCheck(e){return new re({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:m.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:m.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:m.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:m.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:m.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}}re.create=s=>new re({checks:[],typeName:y.ZodBigInt,coerce:s?.coerce??!1,...x(s)});class ke extends k{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==h.boolean){const r=this._getOrReturnCtx(e);return u(r,{code:d.invalid_type,expected:h.boolean,received:r.parsedType}),_}return Z(e.data)}}ke.create=s=>new ke({typeName:y.ZodBoolean,coerce:s?.coerce||!1,...x(s)});class _e extends k{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==h.date){const n=this._getOrReturnCtx(e);return u(n,{code:d.invalid_type,expected:h.date,received:n.parsedType}),_}if(Number.isNaN(e.data.getTime())){const n=this._getOrReturnCtx(e);return u(n,{code:d.invalid_date}),_}const r=new N;let a;for(const n of this._def.checks)n.kind==="min"?e.data.getTime()<n.value&&(a=this._getOrReturnCtx(e,a),u(a,{code:d.too_small,message:n.message,inclusive:!0,exact:!1,minimum:n.value,type:"date"}),r.dirty()):n.kind==="max"?e.data.getTime()>n.value&&(a=this._getOrReturnCtx(e,a),u(a,{code:d.too_big,message:n.message,inclusive:!0,exact:!1,maximum:n.value,type:"date"}),r.dirty()):b.assertNever(n);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new _e({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:m.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:m.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e!=null?new Date(e):null}}_e.create=s=>new _e({checks:[],coerce:s?.coerce||!1,typeName:y.ZodDate,...x(s)});class ze extends k{_parse(e){if(this._getType(e)!==h.symbol){const r=this._getOrReturnCtx(e);return u(r,{code:d.invalid_type,expected:h.symbol,received:r.parsedType}),_}return Z(e.data)}}ze.create=s=>new ze({typeName:y.ZodSymbol,...x(s)});class be extends k{_parse(e){if(this._getType(e)!==h.undefined){const r=this._getOrReturnCtx(e);return u(r,{code:d.invalid_type,expected:h.undefined,received:r.parsedType}),_}return Z(e.data)}}be.create=s=>new be({typeName:y.ZodUndefined,...x(s)});class Se extends k{_parse(e){if(this._getType(e)!==h.null){const r=this._getOrReturnCtx(e);return u(r,{code:d.invalid_type,expected:h.null,received:r.parsedType}),_}return Z(e.data)}}Se.create=s=>new Se({typeName:y.ZodNull,...x(s)});class qe extends k{constructor(){super(...arguments),this._any=!0}_parse(e){return Z(e.data)}}qe.create=s=>new qe({typeName:y.ZodAny,...x(s)});class we extends k{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Z(e.data)}}we.create=s=>new we({typeName:y.ZodUnknown,...x(s)});class B extends k{_parse(e){const t=this._getOrReturnCtx(e);return u(t,{code:d.invalid_type,expected:h.never,received:t.parsedType}),_}}B.create=s=>new B({typeName:y.ZodNever,...x(s)});class De extends k{_parse(e){if(this._getType(e)!==h.undefined){const r=this._getOrReturnCtx(e);return u(r,{code:d.invalid_type,expected:h.void,received:r.parsedType}),_}return Z(e.data)}}De.create=s=>new De({typeName:y.ZodVoid,...x(s)});class L extends k{_parse(e){const{ctx:t,status:r}=this._processInputParams(e),a=this._def;if(t.parsedType!==h.array)return u(t,{code:d.invalid_type,expected:h.array,received:t.parsedType}),_;if(a.exactLength!==null){const i=t.data.length>a.exactLength.value,o=t.data.length<a.exactLength.value;(i||o)&&(u(t,{code:i?d.too_big:d.too_small,minimum:o?a.exactLength.value:void 0,maximum:i?a.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:a.exactLength.message}),r.dirty())}if(a.minLength!==null&&t.data.length<a.minLength.value&&(u(t,{code:d.too_small,minimum:a.minLength.value,type:"array",inclusive:!0,exact:!1,message:a.minLength.message}),r.dirty()),a.maxLength!==null&&t.data.length>a.maxLength.value&&(u(t,{code:d.too_big,maximum:a.maxLength.value,type:"array",inclusive:!0,exact:!1,message:a.maxLength.message}),r.dirty()),t.common.async)return Promise.all([...t.data].map((i,o)=>a.type._parseAsync(new E(t,i,t.path,o)))).then(i=>N.mergeArray(r,i));const n=[...t.data].map((i,o)=>a.type._parseSync(new E(t,i,t.path,o)));return N.mergeArray(r,n)}get element(){return this._def.type}min(e,t){return new L({...this._def,minLength:{value:e,message:m.toString(t)}})}max(e,t){return new L({...this._def,maxLength:{value:e,message:m.toString(t)}})}length(e,t){return new L({...this._def,exactLength:{value:e,message:m.toString(t)}})}nonempty(e){return this.min(1,e)}}L.create=(s,e)=>new L({type:s,minLength:null,maxLength:null,exactLength:null,typeName:y.ZodArray,...x(e)});function G(s){if(s instanceof w){const e={};for(const t in s.shape){const r=s.shape[t];e[t]=M.create(G(r))}return new w({...s._def,shape:()=>e})}else return s instanceof L?new L({...s._def,type:G(s.element)}):s instanceof M?M.create(G(s.unwrap())):s instanceof F?F.create(G(s.unwrap())):s instanceof W?W.create(s.items.map(e=>G(e))):s}class w extends k{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),t=b.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==h.object){const g=this._getOrReturnCtx(e);return u(g,{code:d.invalid_type,expected:h.object,received:g.parsedType}),_}const{status:r,ctx:a}=this._processInputParams(e),{shape:n,keys:i}=this._getCached(),o=[];if(!(this._def.catchall instanceof B&&this._def.unknownKeys==="strip"))for(const g in a.data)i.includes(g)||o.push(g);const p=[];for(const g of i){const S=n[g],Q=a.data[g];p.push({key:{status:"valid",value:g},value:S._parse(new E(a,Q,a.path,g)),alwaysSet:g in a.data})}if(this._def.catchall instanceof B){const g=this._def.unknownKeys;if(g==="passthrough")for(const S of o)p.push({key:{status:"valid",value:S},value:{status:"valid",value:a.data[S]}});else if(g==="strict")o.length>0&&(u(a,{code:d.unrecognized_keys,keys:o}),r.dirty());else if(g!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const g=this._def.catchall;for(const S of o){const Q=a.data[S];p.push({key:{status:"valid",value:S},value:g._parse(new E(a,Q,a.path,S)),alwaysSet:S in a.data})}}return a.common.async?Promise.resolve().then(async()=>{const g=[];for(const S of p){const Q=await S.key,dt=await S.value;g.push({key:Q,value:dt,alwaysSet:S.alwaysSet})}return g}).then(g=>N.mergeObjectSync(r,g)):N.mergeObjectSync(r,p)}get shape(){return this._def.shape()}strict(e){return m.errToObj,new w({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,r)=>{const a=this._def.errorMap?.(t,r).message??r.defaultError;return t.code==="unrecognized_keys"?{message:m.errToObj(e).message??a}:{message:a}}}:{}})}strip(){return new w({...this._def,unknownKeys:"strip"})}passthrough(){return new w({...this._def,unknownKeys:"passthrough"})}extend(e){return new w({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new w({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:y.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new w({...this._def,catchall:e})}pick(e){const t={};for(const r of b.objectKeys(e))e[r]&&this.shape[r]&&(t[r]=this.shape[r]);return new w({...this._def,shape:()=>t})}omit(e){const t={};for(const r of b.objectKeys(this.shape))e[r]||(t[r]=this.shape[r]);return new w({...this._def,shape:()=>t})}deepPartial(){return G(this)}partial(e){const t={};for(const r of b.objectKeys(this.shape)){const a=this.shape[r];e&&!e[r]?t[r]=a:t[r]=a.optional()}return new w({...this._def,shape:()=>t})}required(e){const t={};for(const r of b.objectKeys(this.shape))if(e&&!e[r])t[r]=this.shape[r];else{let n=this.shape[r];for(;n instanceof M;)n=n._def.innerType;t[r]=n}return new w({...this._def,shape:()=>t})}keyof(){return Ue(b.objectKeys(this.shape))}}w.create=(s,e)=>new w({shape:()=>s,unknownKeys:"strip",catchall:B.create(),typeName:y.ZodObject,...x(e)}),w.strictCreate=(s,e)=>new w({shape:()=>s,unknownKeys:"strict",catchall:B.create(),typeName:y.ZodObject,...x(e)}),w.lazycreate=(s,e)=>new w({shape:s,unknownKeys:"strip",catchall:B.create(),typeName:y.ZodObject,...x(e)});class ie extends k{_parse(e){const{ctx:t}=this._processInputParams(e),r=this._def.options;function a(n){for(const o of n)if(o.result.status==="valid")return o.result;for(const o of n)if(o.result.status==="dirty")return t.common.issues.push(...o.ctx.common.issues),o.result;const i=n.map(o=>new z(o.ctx.common.issues));return u(t,{code:d.invalid_union,unionErrors:i}),_}if(t.common.async)return Promise.all(r.map(async n=>{const i={...t,common:{...t.common,issues:[]},parent:null};return{result:await n._parseAsync({data:t.data,path:t.path,parent:i}),ctx:i}})).then(a);{let n;const i=[];for(const p of r){const g={...t,common:{...t.common,issues:[]},parent:null},S=p._parseSync({data:t.data,path:t.path,parent:g});if(S.status==="valid")return S;S.status==="dirty"&&!n&&(n={result:S,ctx:g}),g.common.issues.length&&i.push(g.common.issues)}if(n)return t.common.issues.push(...n.ctx.common.issues),n.result;const o=i.map(p=>new z(p));return u(t,{code:d.invalid_union,unionErrors:o}),_}}get options(){return this._def.options}}ie.create=(s,e)=>new ie({options:s,typeName:y.ZodUnion,...x(e)});const $=s=>s instanceof Re?$(s.schema):s instanceof U?$(s.innerType()):s instanceof ce?[s.value]:s instanceof J?s.options:s instanceof Ce?b.objectValues(s.enum):s instanceof ue?$(s._def.innerType):s instanceof be?[void 0]:s instanceof Se?[null]:s instanceof M?[void 0,...$(s.unwrap())]:s instanceof F?[null,...$(s.unwrap())]:s instanceof We||s instanceof he?$(s.unwrap()):s instanceof le?$(s._def.innerType):[];class Ze extends k{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==h.object)return u(t,{code:d.invalid_type,expected:h.object,received:t.parsedType}),_;const r=this.discriminator,a=t.data[r],n=this.optionsMap.get(a);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}):(u(t,{code:d.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),_)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,r){const a=new Map;for(const n of t){const i=$(n.shape[e]);if(!i.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const o of i){if(a.has(o))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);a.set(o,n)}}return new Ze({typeName:y.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:a,...x(r)})}}function Te(s,e){const t=D(s),r=D(e);if(s===e)return{valid:!0,data:s};if(t===h.object&&r===h.object){const a=b.objectKeys(e),n=b.objectKeys(s).filter(o=>a.indexOf(o)!==-1),i={...s,...e};for(const o of n){const p=Te(s[o],e[o]);if(!p.valid)return{valid:!1};i[o]=p.data}return{valid:!0,data:i}}else if(t===h.array&&r===h.array){if(s.length!==e.length)return{valid:!1};const a=[];for(let n=0;n<s.length;n++){const i=s[n],o=e[n],p=Te(i,o);if(!p.valid)return{valid:!1};a.push(p.data)}return{valid:!0,data:a}}else return t===h.date&&r===h.date&&+s==+e?{valid:!0,data:s}:{valid:!1}}class oe extends k{_parse(e){const{status:t,ctx:r}=this._processInputParams(e),a=(n,i)=>{if(Pe(n)||Pe(i))return _;const o=Te(n.value,i.value);return o.valid?((Le(n)||Le(i))&&t.dirty(),{status:t.value,value:o.data}):(u(r,{code:d.invalid_intersection_types}),_)};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(([n,i])=>a(n,i)):a(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}oe.create=(s,e,t)=>new oe({left:s,right:e,typeName:y.ZodIntersection,...x(t)});class W extends k{_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==h.array)return u(r,{code:d.invalid_type,expected:h.array,received:r.parsedType}),_;if(r.data.length<this._def.items.length)return u(r,{code:d.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),_;!this._def.rest&&r.data.length>this._def.items.length&&(u(r,{code:d.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const n=[...r.data].map((i,o)=>{const p=this._def.items[o]||this._def.rest;return p?p._parse(new E(r,i,r.path,o)):null}).filter(i=>!!i);return r.common.async?Promise.all(n).then(i=>N.mergeArray(t,i)):N.mergeArray(t,n)}get items(){return this._def.items}rest(e){return new W({...this._def,rest:e})}}W.create=(s,e)=>{if(!Array.isArray(s))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new W({items:s,typeName:y.ZodTuple,rest:null,...x(e)})};class ye extends k{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!==h.object)return u(r,{code:d.invalid_type,expected:h.object,received:r.parsedType}),_;const a=[],n=this._def.keyType,i=this._def.valueType;for(const o in r.data)a.push({key:n._parse(new E(r,o,r.path,o)),value:i._parse(new E(r,r.data[o],r.path,o)),alwaysSet:o in r.data});return r.common.async?N.mergeObjectAsync(t,a):N.mergeObjectSync(t,a)}get element(){return this._def.valueType}static create(e,t,r){return t instanceof k?new ye({keyType:e,valueType:t,typeName:y.ZodRecord,...x(r)}):new ye({keyType:q.create(),valueType:e,typeName:y.ZodRecord,...x(t)})}}class Be extends k{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!==h.map)return u(r,{code:d.invalid_type,expected:h.map,received:r.parsedType}),_;const a=this._def.keyType,n=this._def.valueType,i=[...r.data.entries()].map(([o,p],g)=>({key:a._parse(new E(r,o,r.path,[g,"key"])),value:n._parse(new E(r,p,r.path,[g,"value"]))}));if(r.common.async){const o=new Map;return Promise.resolve().then(async()=>{for(const p of i){const g=await p.key,S=await p.value;if(g.status==="aborted"||S.status==="aborted")return _;(g.status==="dirty"||S.status==="dirty")&&t.dirty(),o.set(g.value,S.value)}return{status:t.value,value:o}})}else{const o=new Map;for(const p of i){const g=p.key,S=p.value;if(g.status==="aborted"||S.status==="aborted")return _;(g.status==="dirty"||S.status==="dirty")&&t.dirty(),o.set(g.value,S.value)}return{status:t.value,value:o}}}}Be.create=(s,e,t)=>new Be({valueType:e,keyType:s,typeName:y.ZodMap,...x(t)});class ae extends k{_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==h.set)return u(r,{code:d.invalid_type,expected:h.set,received:r.parsedType}),_;const a=this._def;a.minSize!==null&&r.data.size<a.minSize.value&&(u(r,{code:d.too_small,minimum:a.minSize.value,type:"set",inclusive:!0,exact:!1,message:a.minSize.message}),t.dirty()),a.maxSize!==null&&r.data.size>a.maxSize.value&&(u(r,{code:d.too_big,maximum:a.maxSize.value,type:"set",inclusive:!0,exact:!1,message:a.maxSize.message}),t.dirty());const n=this._def.valueType;function i(p){const g=new Set;for(const S of p){if(S.status==="aborted")return _;S.status==="dirty"&&t.dirty(),g.add(S.value)}return{status:t.value,value:g}}const o=[...r.data.values()].map((p,g)=>n._parse(new E(r,p,r.path,g)));return r.common.async?Promise.all(o).then(p=>i(p)):i(o)}min(e,t){return new ae({...this._def,minSize:{value:e,message:m.toString(t)}})}max(e,t){return new ae({...this._def,maxSize:{value:e,message:m.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}ae.create=(s,e)=>new ae({valueType:s,minSize:null,maxSize:null,typeName:y.ZodSet,...x(e)});class Re extends k{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})}}Re.create=(s,e)=>new Re({getter:s,typeName:y.ZodLazy,...x(e)});class ce extends k{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return u(t,{received:t.data,code:d.invalid_literal,expected:this._def.value}),_}return{status:"valid",value:e.data}}get value(){return this._def.value}}ce.create=(s,e)=>new ce({value:s,typeName:y.ZodLiteral,...x(e)});function Ue(s,e){return new J({values:s,typeName:y.ZodEnum,...x(e)})}class J extends k{_parse(e){if(typeof e.data!="string"){const t=this._getOrReturnCtx(e),r=this._def.values;return u(t,{expected:b.joinValues(r),received:t.parsedType,code:d.invalid_type}),_}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){const t=this._getOrReturnCtx(e),r=this._def.values;return u(t,{received:t.data,code:d.invalid_enum_value,options:r}),_}return Z(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,t=this._def){return J.create(e,{...this._def,...t})}exclude(e,t=this._def){return J.create(this.options.filter(r=>!e.includes(r)),{...this._def,...t})}}J.create=Ue;class Ce extends k{_parse(e){const t=b.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==h.string&&r.parsedType!==h.number){const a=b.objectValues(t);return u(r,{expected:b.joinValues(a),received:r.parsedType,code:d.invalid_type}),_}if(this._cache||(this._cache=new Set(b.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const a=b.objectValues(t);return u(r,{received:r.data,code:d.invalid_enum_value,options:a}),_}return Z(e.data)}get enum(){return this._def.values}}Ce.create=(s,e)=>new Ce({values:s,typeName:y.ZodNativeEnum,...x(e)});class de extends k{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==h.promise&&t.common.async===!1)return u(t,{code:d.invalid_type,expected:h.promise,received:t.parsedType}),_;const r=t.parsedType===h.promise?t.data:Promise.resolve(t.data);return Z(r.then(a=>this._def.type.parseAsync(a,{path:t.path,errorMap:t.common.contextualErrorMap})))}}de.create=(s,e)=>new de({type:s,typeName:y.ZodPromise,...x(e)});class U extends k{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===y.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:r}=this._processInputParams(e),a=this._def.effect||null,n={addIssue:i=>{u(r,i),i.fatal?t.abort():t.dirty()},get path(){return r.path}};if(n.addIssue=n.addIssue.bind(n),a.type==="preprocess"){const i=a.transform(r.data,n);if(r.common.async)return Promise.resolve(i).then(async o=>{if(t.value==="aborted")return _;const p=await this._def.schema._parseAsync({data:o,path:r.path,parent:r});return p.status==="aborted"?_:p.status==="dirty"||t.value==="dirty"?X(p.value):p});{if(t.value==="aborted")return _;const o=this._def.schema._parseSync({data:i,path:r.path,parent:r});return o.status==="aborted"?_:o.status==="dirty"||t.value==="dirty"?X(o.value):o}}if(a.type==="refinement"){const i=o=>{const p=a.refinement(o,n);if(r.common.async)return Promise.resolve(p);if(p instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(r.common.async===!1){const o=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return o.status==="aborted"?_:(o.status==="dirty"&&t.dirty(),i(o.value),{status:t.value,value:o.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(o=>o.status==="aborted"?_:(o.status==="dirty"&&t.dirty(),i(o.value).then(()=>({status:t.value,value:o.value}))))}if(a.type==="transform")if(r.common.async===!1){const i=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!H(i))return _;const o=a.transform(i.value,n);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:o}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(i=>H(i)?Promise.resolve(a.transform(i.value,n)).then(o=>({status:t.value,value:o})):_);b.assertNever(a)}}U.create=(s,e,t)=>new U({schema:s,typeName:y.ZodEffects,effect:e,...x(t)}),U.createWithPreprocess=(s,e,t)=>new U({schema:e,effect:{type:"preprocess",transform:s},typeName:y.ZodEffects,...x(t)});class M extends k{_parse(e){return this._getType(e)===h.undefined?Z(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}M.create=(s,e)=>new M({innerType:s,typeName:y.ZodOptional,...x(e)});class F extends k{_parse(e){return this._getType(e)===h.null?Z(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}F.create=(s,e)=>new F({innerType:s,typeName:y.ZodNullable,...x(e)});class ue extends k{_parse(e){const{ctx:t}=this._processInputParams(e);let r=t.data;return t.parsedType===h.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}ue.create=(s,e)=>new ue({innerType:s,typeName:y.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...x(e)});class le extends k{_parse(e){const{ctx:t}=this._processInputParams(e),r={...t,common:{...t.common,issues:[]}},a=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return ne(a)?a.then(n=>({status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new z(r.common.issues)},input:r.data})})):{status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new z(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}le.create=(s,e)=>new le({innerType:s,typeName:y.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...x(e)});class Fe extends k{_parse(e){if(this._getType(e)!==h.nan){const r=this._getOrReturnCtx(e);return u(r,{code:d.invalid_type,expected:h.nan,received:r.parsedType}),_}return{status:"valid",value:e.data}}}Fe.create=s=>new Fe({typeName:y.ZodNaN,...x(s)});class We extends k{_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 Ie extends k{_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{const n=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return n.status==="aborted"?_:n.status==="dirty"?(t.dirty(),X(n.value)):this._def.out._parseAsync({data:n.value,path:r.path,parent:r})})();{const a=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return a.status==="aborted"?_:a.status==="dirty"?(t.dirty(),{status:"dirty",value:a.value}):this._def.out._parseSync({data:a.value,path:r.path,parent:r})}}static create(e,t){return new Ie({in:e,out:t,typeName:y.ZodPipeline})}}class he extends k{_parse(e){const t=this._def.innerType._parse(e),r=a=>(H(a)&&(a.value=Object.freeze(a.value)),a);return ne(t)?t.then(a=>r(a)):r(t)}unwrap(){return this._def.innerType}}he.create=(s,e)=>new he({innerType:s,typeName:y.ZodReadonly,...x(e)});var y;(function(s){s.ZodString="ZodString",s.ZodNumber="ZodNumber",s.ZodNaN="ZodNaN",s.ZodBigInt="ZodBigInt",s.ZodBoolean="ZodBoolean",s.ZodDate="ZodDate",s.ZodSymbol="ZodSymbol",s.ZodUndefined="ZodUndefined",s.ZodNull="ZodNull",s.ZodAny="ZodAny",s.ZodUnknown="ZodUnknown",s.ZodNever="ZodNever",s.ZodVoid="ZodVoid",s.ZodArray="ZodArray",s.ZodObject="ZodObject",s.ZodUnion="ZodUnion",s.ZodDiscriminatedUnion="ZodDiscriminatedUnion",s.ZodIntersection="ZodIntersection",s.ZodTuple="ZodTuple",s.ZodRecord="ZodRecord",s.ZodMap="ZodMap",s.ZodSet="ZodSet",s.ZodFunction="ZodFunction",s.ZodLazy="ZodLazy",s.ZodLiteral="ZodLiteral",s.ZodEnum="ZodEnum",s.ZodEffects="ZodEffects",s.ZodNativeEnum="ZodNativeEnum",s.ZodOptional="ZodOptional",s.ZodNullable="ZodNullable",s.ZodDefault="ZodDefault",s.ZodCatch="ZodCatch",s.ZodPromise="ZodPromise",s.ZodBranded="ZodBranded",s.ZodPipeline="ZodPipeline",s.ZodReadonly="ZodReadonly"})(y||(y={}));const l=q.create,R=Y.create,A=ke.create,K=we.create;B.create;const T=L.create,f=w.create,C=ie.create,$t=Ze.create;oe.create,W.create;const ee=ye.create,v=ce.create,V=J.create;de.create;const c=M.create;F.create;const fe="2.0",Je=C([l(),R().int()]),He=l(),Mt=f({progressToken:c(Je)}).passthrough(),I=f({_meta:c(Mt)}).passthrough(),O=f({method:l(),params:c(I)}),te=f({_meta:c(f({}).passthrough())}).passthrough(),P=f({method:l(),params:c(te)}),j=f({_meta:c(f({}).passthrough())}).passthrough(),me=C([l(),R().int()]),Vt=f({jsonrpc:v(fe),id:me}).merge(O).strict(),zt=f({jsonrpc:v(fe)}).merge(P).strict(),qt=f({jsonrpc:v(fe),id:me,result:j}).strict();var Ge;(function(s){s[s.ConnectionClosed=-32e3]="ConnectionClosed",s[s.RequestTimeout=-32001]="RequestTimeout",s[s.ParseError=-32700]="ParseError",s[s.InvalidRequest=-32600]="InvalidRequest",s[s.MethodNotFound=-32601]="MethodNotFound",s[s.InvalidParams=-32602]="InvalidParams",s[s.InternalError=-32603]="InternalError"})(Ge||(Ge={}));const Dt=f({jsonrpc:v(fe),id:me,error:f({code:R().int(),message:l(),data:c(K())})}).strict(),Bt=C([Vt,zt,qt,Dt]),Ye=j.strict(),Qe=P.extend({method:v("notifications/cancelled"),params:te.extend({requestId:me,reason:l().optional()})}),se=f({name:l(),title:c(l())}).passthrough(),Xe=se.extend({version:l()}),Ut=f({experimental:c(f({}).passthrough()),sampling:c(f({}).passthrough()),elicitation:c(f({}).passthrough()),roots:c(f({listChanged:c(A())}).passthrough())}).passthrough(),Ft=O.extend({method:v("initialize"),params:I.extend({protocolVersion:l(),capabilities:Ut,clientInfo:Xe})}),Wt=f({experimental:c(f({}).passthrough()),logging:c(f({}).passthrough()),completions:c(f({}).passthrough()),prompts:c(f({listChanged:c(A())}).passthrough()),resources:c(f({subscribe:c(A()),listChanged:c(A())}).passthrough()),tools:c(f({listChanged:c(A())}).passthrough())}).passthrough(),Jt=j.extend({protocolVersion:l(),capabilities:Wt,serverInfo:Xe,instructions:c(l())}),Ht=P.extend({method:v("notifications/initialized")}),Ke=O.extend({method:v("ping")}),Gt=f({progress:R(),total:c(R()),message:c(l())}).passthrough(),et=P.extend({method:v("notifications/progress"),params:te.merge(Gt).extend({progressToken:Je})}),pe=O.extend({params:I.extend({cursor:c(He)}).optional()}),ge=j.extend({nextCursor:c(He)}),tt=f({uri:l(),mimeType:c(l()),_meta:c(f({}).passthrough())}).passthrough(),st=tt.extend({text:l()}),rt=tt.extend({blob:l().base64()}),at=se.extend({uri:l(),description:c(l()),mimeType:c(l()),_meta:c(f({}).passthrough())}),Yt=se.extend({uriTemplate:l(),description:c(l()),mimeType:c(l()),_meta:c(f({}).passthrough())}),Qt=pe.extend({method:v("resources/list")}),Xt=ge.extend({resources:T(at)}),Kt=pe.extend({method:v("resources/templates/list")}),es=ge.extend({resourceTemplates:T(Yt)}),ts=O.extend({method:v("resources/read"),params:I.extend({uri:l()})}),ss=j.extend({contents:T(C([st,rt]))}),rs=P.extend({method:v("notifications/resources/list_changed")}),as=O.extend({method:v("resources/subscribe"),params:I.extend({uri:l()})}),ns=O.extend({method:v("resources/unsubscribe"),params:I.extend({uri:l()})}),is=P.extend({method:v("notifications/resources/updated"),params:te.extend({uri:l()})}),os=f({name:l(),description:c(l()),required:c(A())}).passthrough(),cs=se.extend({description:c(l()),arguments:c(T(os)),_meta:c(f({}).passthrough())}),ds=pe.extend({method:v("prompts/list")}),us=ge.extend({prompts:T(cs)}),ls=O.extend({method:v("prompts/get"),params:I.extend({name:l(),arguments:c(ee(l()))})}),Ne=f({type:v("text"),text:l(),_meta:c(f({}).passthrough())}).passthrough(),Oe=f({type:v("image"),data:l().base64(),mimeType:l(),_meta:c(f({}).passthrough())}).passthrough(),Ae=f({type:v("audio"),data:l().base64(),mimeType:l(),_meta:c(f({}).passthrough())}).passthrough(),hs=f({type:v("resource"),resource:C([st,rt]),_meta:c(f({}).passthrough())}).passthrough(),fs=at.extend({type:v("resource_link")}),nt=C([Ne,Oe,Ae,fs,hs]),ms=f({role:V(["user","assistant"]),content:nt}).passthrough(),ps=j.extend({description:c(l()),messages:T(ms)}),gs=P.extend({method:v("notifications/prompts/list_changed")}),_s=f({title:c(l()),readOnlyHint:c(A()),destructiveHint:c(A()),idempotentHint:c(A()),openWorldHint:c(A())}).passthrough(),ys=se.extend({description:c(l()),inputSchema:f({type:v("object"),properties:c(f({}).passthrough()),required:c(T(l()))}).passthrough(),outputSchema:c(f({type:v("object"),properties:c(f({}).passthrough()),required:c(T(l()))}).passthrough()),annotations:c(_s),_meta:c(f({}).passthrough())}),vs=pe.extend({method:v("tools/list")}),xs=ge.extend({tools:T(ys)}),it=j.extend({content:T(nt).default([]),structuredContent:f({}).passthrough().optional(),isError:c(A())});it.or(j.extend({toolResult:K()}));const ks=O.extend({method:v("tools/call"),params:I.extend({name:l(),arguments:c(ee(K()))})}),bs=P.extend({method:v("notifications/tools/list_changed")}),ot=V(["debug","info","notice","warning","error","critical","alert","emergency"]),Ss=O.extend({method:v("logging/setLevel"),params:I.extend({level:ot})}),ws=P.extend({method:v("notifications/message"),params:te.extend({level:ot,logger:c(l()),data:K()})}),Ts=f({name:l().optional()}).passthrough(),Rs=f({hints:c(T(Ts)),costPriority:c(R().min(0).max(1)),speedPriority:c(R().min(0).max(1)),intelligencePriority:c(R().min(0).max(1))}).passthrough(),Cs=f({role:V(["user","assistant"]),content:C([Ne,Oe,Ae])}).passthrough(),Ns=O.extend({method:v("sampling/createMessage"),params:I.extend({messages:T(Cs),systemPrompt:c(l()),includeContext:c(V(["none","thisServer","allServers"])),temperature:c(R()),maxTokens:R().int(),stopSequences:c(T(l())),metadata:c(f({}).passthrough()),modelPreferences:c(Rs)})}),Os=j.extend({model:l(),stopReason:c(V(["endTurn","stopSequence","maxTokens"]).or(l())),role:V(["user","assistant"]),content:$t("type",[Ne,Oe,Ae])}),As=f({type:v("boolean"),title:c(l()),description:c(l()),default:c(A())}).passthrough(),Zs=f({type:v("string"),title:c(l()),description:c(l()),minLength:c(R()),maxLength:c(R()),format:c(V(["email","uri","date","date-time"]))}).passthrough(),Is=f({type:V(["number","integer"]),title:c(l()),description:c(l()),minimum:c(R()),maximum:c(R())}).passthrough(),js=f({type:v("string"),title:c(l()),description:c(l()),enum:T(l()),enumNames:c(T(l()))}).passthrough(),Es=C([As,Zs,Is,js]),Ps=O.extend({method:v("elicitation/create"),params:I.extend({message:l(),requestedSchema:f({type:v("object"),properties:ee(l(),Es),required:c(T(l()))}).passthrough()})}),Ls=j.extend({action:V(["accept","reject","cancel"]),content:c(ee(l(),K()))}),$s=f({type:v("ref/resource"),uri:l()}).passthrough(),Ms=f({type:v("ref/prompt"),name:l()}).passthrough(),Vs=O.extend({method:v("completion/complete"),params:I.extend({ref:C([Ms,$s]),argument:f({name:l(),value:l()}).passthrough(),context:c(f({arguments:c(ee(l(),l()))}))})}),zs=j.extend({completion:f({values:T(l()).max(100),total:c(R().int()),hasMore:c(A())}).passthrough()}),qs=f({uri:l().startsWith("file://"),name:c(l()),_meta:c(f({}).passthrough())}).passthrough(),Ds=O.extend({method:v("roots/list")}),Bs=j.extend({roots:T(qs)}),Us=P.extend({method:v("notifications/roots/list_changed")});C([Ke,Ft,Vs,Ss,ls,ds,Qt,Kt,ts,as,ns,ks,vs]),C([Qe,et,Ht,Us]),C([Ye,Os,Ls,Bs]),C([Ke,Ns,Ps,Ds]),C([Qe,et,ws,is,rs,bs,gs]),C([Ye,Jt,zs,ps,us,Xt,es,ss,it,xs]);class Fs{append(e){this._buffer=this._buffer?Buffer.concat([this._buffer,e]):e}readMessage(){if(!this._buffer)return null;const e=this._buffer.indexOf(`
3
+ `);if(e===-1)return null;const t=this._buffer.toString("utf8",0,e).replace(/\r$/,"");return this._buffer=this._buffer.subarray(e+1),Ws(t)}clear(){this._buffer=void 0}}function Ws(s){return Bt.parse(JSON.parse(s))}function Js(s){return JSON.stringify(s)+`
4
+ `}class Hs{constructor(e=je.stdin,t=je.stdout){this._stdin=e,this._stdout=t,this._readBuffer=new Fs,this._started=!1,this._ondata=r=>{this._readBuffer.append(r),this.processReadBuffer()},this._onerror=r=>{var a;(a=this.onerror)===null||a===void 0||a.call(this,r)}}async start(){if(this._started)throw new Error("StdioServerTransport already started! If using Server class, note that connect() calls start() automatically.");this._started=!0,this._stdin.on("data",this._ondata),this._stdin.on("error",this._onerror)}processReadBuffer(){for(var e,t;;)try{const r=this._readBuffer.readMessage();if(r===null)break;(e=this.onmessage)===null||e===void 0||e.call(this,r)}catch(r){(t=this.onerror)===null||t===void 0||t.call(this,r)}}async close(){var e;this._stdin.off("data",this._ondata),this._stdin.off("error",this._onerror),this._stdin.listenerCount("data")===0&&this._stdin.pause(),this._readBuffer.clear(),(e=this.onclose)===null||e===void 0||e.call(this)}send(e){return new Promise(t=>{const r=Js(e);this._stdout.write(r)?t():this._stdout.once("drain",t)})}}const ct=lt(process.env.LIKEC4_WORKSPACE||".");async function Gs(){console.error(`Loading LikeC4 from workspace ${ct}`);const s=await ut.fromWorkspace(ct,{logger:!1}),e=s.langium.mcp.ServerFactory.create({capabilities:{tools:{},logging:{}}});e.server.oninitialized=()=>{e.server.sendLoggingMessage({level:"info",data:{message:"Server initialized",workspace:s.workspace}})};const t=new Hs;console.error("Connecting server to transport..."),await e.connect(t),console.error("LikeC4 MCP Server running on stdio")}Gs().catch(s=>{console.error(s),process.exit(1)});
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@likec4/mcp",
3
3
  "license": "MIT",
4
- "version": "1.33.0",
4
+ "version": "1.34.1",
5
5
  "bugs": "https://github.com/likec4/likec4/issues",
6
6
  "homepage": "https://likec4.dev",
7
7
  "author": "Denis Davydkov <denis@davydkov.com>",
@@ -47,10 +47,10 @@
47
47
  }
48
48
  },
49
49
  "dependencies": {
50
- "likec4": "1.33.0"
50
+ "likec4": "1.34.1"
51
51
  },
52
52
  "devDependencies": {
53
- "@modelcontextprotocol/sdk": "^1.13.1",
53
+ "@modelcontextprotocol/sdk": "^1.13.2",
54
54
  "@types/node": "~20.19.1",
55
55
  "remeda": "^2.23.1",
56
56
  "tsx": "4.19.4",
@@ -60,8 +60,8 @@
60
60
  "vitest": "3.2.4",
61
61
  "zod": "3.25.67",
62
62
  "wireit": "0.14.12",
63
- "@likec4/core": "1.33.0",
64
- "@likec4/tsconfig": "1.33.0"
63
+ "@likec4/core": "1.34.1",
64
+ "@likec4/tsconfig": "1.34.1"
65
65
  },
66
66
  "scripts": {
67
67
  "typecheck": "tsc -b --verbose",
package/src/index.ts CHANGED
@@ -1,12 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- import {
4
- type ProjectId,
5
- ifilter,
6
- } from '@likec4/core'
7
- import { ResourceTemplate } from '@modelcontextprotocol/sdk/server/mcp.js'
8
3
  import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js'
9
- import type { Resource } from '@modelcontextprotocol/sdk/types.js'
10
4
  import { LikeC4 } from 'likec4'
11
5
  import { resolve } from 'node:path'
12
6
 
@@ -18,64 +12,12 @@ async function main() {
18
12
  logger: false,
19
13
  })
20
14
 
21
- const mcpTools = likec4.langium.mcp.Tools
22
15
  const mcp = likec4.langium.mcp.ServerFactory.create({
23
16
  capabilities: {
24
- completions: {},
25
17
  tools: {},
26
- resources: {},
18
+ logging: {},
27
19
  },
28
20
  })
29
-
30
- mcp.resource(
31
- 'likec4 element',
32
- new ResourceTemplate('likec4://projects/{project}/elements/{id}', {
33
- list: async () => {
34
- const projects = await likec4.languageServices.projects()
35
- const resources: Resource[] = []
36
- for (const { id } of projects) {
37
- const model = likec4.computedModel(id)
38
- for (const el of model.elements()) {
39
- resources.push({
40
- uri: `likec4://projects/${id}/elements/${el.id}`,
41
- name: el.title,
42
- id: el.id,
43
- description: `Model element of kind "${el.kind}"`,
44
- })
45
- }
46
- }
47
- return ({
48
- resources,
49
- })
50
- },
51
- complete: {
52
- project: async (name) => {
53
- const projects = await likec4.projects()
54
- const newLocal = name.toLowerCase()
55
- return projects.filter(id => id.toLowerCase().startsWith(newLocal))
56
- },
57
- id: async (name) => {
58
- const { id } = likec4.languageServices.projects()[0]
59
- const model = likec4.computedModel(id)
60
- return [...ifilter(model.elements(), el => el.id.startsWith(name))].map(i => i.id)
61
- },
62
- },
63
- }),
64
- async (uri, { project, id }) => {
65
- const text = await mcpTools.readElement({
66
- id: id as string,
67
- project: project as ProjectId,
68
- })
69
- return {
70
- contents: [{
71
- uri: uri.href,
72
- mimeType: 'application/json',
73
- text,
74
- }],
75
- }
76
- },
77
- )
78
-
79
21
  mcp.server.oninitialized = () => {
80
22
  mcp.server.sendLoggingMessage({
81
23
  level: 'info',