HEX
Server: LiteSpeed
System: Linux node612.namehero.net 4.18.0-553.121.1.lve.el8.x86_64 #1 SMP Thu Apr 30 16:40:41 UTC 2026 x86_64
User: dfwparty (1186)
PHP: 8.3.31
Disabled: NONE
Upload Files
File: //home/dfwparty/www/wp-content/plugins/ultimate-elementor/angie/uael-angie-mcp-server.min.js
var e,t,r,a,s,i=Object.defineProperty,n=(e,t,r)=>((e,t,r)=>t in e?i(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r)(e,"symbol"!=typeof t?t+"":t,r);(e||(e={})).POST_MESSAGE="postMessage",(s=t||(t={})).SDK_ANGIE_READY_PING="sdk-angie-ready-ping",s.SDK_REQUEST_CLIENT_CREATION="sdk-request-client-creation",s.SDK_REQUEST_INIT_SERVER="sdk-request-init-server";class o{constructor(){if(n(this,"isAngieReady",!1),n(this,"readyPromise"),n(this,"readyResolve"),this.readyPromise=new Promise(e=>{this.readyResolve=e}),"undefined"==typeof window)return;let e=0;const r=()=>{if(this.isAngieReady||e>=500)return void(!this.isAngieReady&&e>=500&&this.handleDetectionTimeout());const a=new MessageChannel;a.port1.onmessage=e=>{this.handleAngieReady(e.data),a.port1.close(),a.port2.close()};const s={type:t.SDK_ANGIE_READY_PING,timestamp:Date.now()};window.postMessage(s,window.location.origin,[a.port2]),e++,setTimeout(r,500)};r()}handleAngieReady(e){this.isAngieReady=!0;const t={isReady:!0,version:e.version,capabilities:e.capabilities};this.readyResolve&&this.readyResolve(t)}handleDetectionTimeout(){this.readyResolve&&this.readyResolve({isReady:!1}),console.warn("AngieMcpSdk: AngieDetector: Detection timeout - Angie may not be available")}isReady(){return this.isAngieReady}async waitForReady(){return this.readyPromise}}class d{constructor(){n(this,"queue",[]),n(this,"isProcessing",!1)}add(e){const t={id:this.generateId(e),config:e,timestamp:Date.now(),status:"pending"};return this.queue.push(t),console.log(`RegistrationQueue: Added server "${e.name}" to queue`),t}getAll(){return[...this.queue]}getPending(){return this.queue.filter(e=>"pending"===e.status)}updateStatus(e,t,r){const a=this.queue.find(t=>t.id===e);a&&(a.status=t,r&&(a.error=r),console.log(`RegistrationQueue: Updated server ${e} status to ${t}`))}async processQueue(e){if(this.isProcessing)return void console.log("RegistrationQueue: Already processing queue");this.isProcessing=!0;const t=this.getPending();console.log(`RegistrationQueue: Processing ${t.length} pending registrations`);try{for(const r of t)try{await e(r),this.updateStatus(r.id,"registered")}catch(e){const t=e instanceof Error?e.message:String(e);this.updateStatus(r.id,"failed",t),console.error(`RegistrationQueue: Failed to process registration ${r.id}:`,t)}}finally{this.isProcessing=!1}}clear(){this.queue=[],console.log("RegistrationQueue: Cleared all registrations")}remove(e){const t=this.queue.findIndex(t=>t.id===e);return-1!==t&&(this.queue.splice(t,1),console.log(`RegistrationQueue: Removed registration ${e}`),!0)}generateId(e){return`reg_${e.name}_${e.version}_${Date.now()}`}}class c{async requestClientCreation(r){const{config:a}=r,s={serverId:r.id,serverName:a.name,serverVersion:a.version,description:a.description,transport:e.POST_MESSAGE,capabilities:a.capabilities};return new Promise((e,r)=>{const a=new MessageChannel,i=setTimeout(()=>{r(new Error("Client creation request timed out after 10000ms"))},1e4);a.port1.onmessage=t=>{clearTimeout(i),e(t.data)};const n={type:t.SDK_REQUEST_CLIENT_CREATION,payload:s,timestamp:Date.now()};window.postMessage(n,window.location.origin,[a.port2])})}}!function(e){e.assertEqual=e=>{},e.assertIs=function(e){},e.assertNever=function(e){throw new Error},e.arrayToEnum=e=>{const t={};for(const r of e)t[r]=r;return t},e.getValidEnumValues=t=>{const r=e.objectKeys(t).filter(e=>"number"!=typeof t[t[e]]),a={};for(const e of r)a[e]=t[e];return e.objectValues(a)},e.objectValues=t=>e.objectKeys(t).map(function(e){return t[e]}),e.objectKeys="function"==typeof Object.keys?e=>Object.keys(e):e=>{const t=[];for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.push(r);return t},e.find=(e,t)=>{for(const r of e)if(t(r))return r},e.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&Number.isFinite(e)&&Math.floor(e)===e,e.joinValues=function(e,t=" | "){return e.map(e=>"string"==typeof e?`'${e}'`:e).join(t)},e.jsonStringifyReplacer=(e,t)=>"bigint"==typeof t?t.toString():t}(r||(r={})),(a||(a={})).mergeShapes=(e,t)=>({...e,...t});const u=r.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),l=e=>{switch(typeof e){case"undefined":return u.undefined;case"string":return u.string;case"number":return Number.isNaN(e)?u.nan:u.number;case"boolean":return u.boolean;case"function":return u.function;case"bigint":return u.bigint;case"symbol":return u.symbol;case"object":return Array.isArray(e)?u.array:null===e?u.null:e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch?u.promise:"undefined"!=typeof Map&&e instanceof Map?u.map:"undefined"!=typeof Set&&e instanceof Set?u.set:"undefined"!=typeof Date&&e instanceof Date?u.date:u.object;default:return u.unknown}},h=r.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 p extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){const t=e||function(e){return e.message},r={_errors:[]},a=e=>{for(const s of e.issues)if("invalid_union"===s.code)s.unionErrors.map(a);else if("invalid_return_type"===s.code)a(s.returnTypeError);else if("invalid_arguments"===s.code)a(s.argumentsError);else if(0===s.path.length)r._errors.push(t(s));else{let e=r,a=0;for(;a<s.path.length;){const r=s.path[a];a===s.path.length-1?(e[r]=e[r]||{_errors:[]},e[r]._errors.push(t(s))):e[r]=e[r]||{_errors:[]},e=e[r],a++}}};return a(this),r}static assert(e){if(!(e instanceof p))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,r.jsonStringifyReplacer,2)}get isEmpty(){return 0===this.issues.length}flatten(e=e=>e.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()}}p.create=e=>new p(e);const m=(e,t)=>{let a;switch(e.code){case h.invalid_type:a=e.received===u.undefined?"Required":`Expected ${e.expected}, received ${e.received}`;break;case h.invalid_literal:a=`Invalid literal value, expected ${JSON.stringify(e.expected,r.jsonStringifyReplacer)}`;break;case h.unrecognized_keys:a=`Unrecognized key(s) in object: ${r.joinValues(e.keys,", ")}`;break;case h.invalid_union:a="Invalid input";break;case h.invalid_union_discriminator:a=`Invalid discriminator value. Expected ${r.joinValues(e.options)}`;break;case h.invalid_enum_value:a=`Invalid enum value. Expected ${r.joinValues(e.options)}, received '${e.received}'`;break;case h.invalid_arguments:a="Invalid function arguments";break;case h.invalid_return_type:a="Invalid function return type";break;case h.invalid_date:a="Invalid date";break;case h.invalid_string:"object"==typeof e.validation?"includes"in e.validation?(a=`Invalid input: must include "${e.validation.includes}"`,"number"==typeof e.validation.position&&(a=`${a} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?a=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?a=`Invalid input: must end with "${e.validation.endsWith}"`:r.assertNever(e.validation):a="regex"!==e.validation?`Invalid ${e.validation}`:"Invalid";break;case h.too_small:a="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:"date"===e.type?`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:"Invalid input";break;case h.too_big:a="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"bigint"===e.type?`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"date"===e.type?`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:"Invalid input";break;case h.custom:a="Invalid input";break;case h.invalid_intersection_types:a="Intersection results could not be merged";break;case h.not_multiple_of:a=`Number must be a multiple of ${e.multipleOf}`;break;case h.not_finite:a="Number must be finite";break;default:a=t.defaultError,r.assertNever(e)}return{message:a}};let f=m;function v(e,t){const r=f,a=(e=>{const{data:t,path:r,errorMaps:a,issueData:s}=e,i=[...r,...s.path||[]],n={...s,path:i};if(void 0!==s.message)return{...s,path:i,message:s.message};let o="";const d=a.filter(e=>!!e).slice().reverse();for(const e of d)o=e(n,{data:t,defaultError:o}).message;return{...s,path:i,message:o}})({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===m?void 0:m].filter(e=>!!e)});e.common.issues.push(a)}class g{constructor(){this.value="valid"}dirty(){"valid"===this.value&&(this.value="dirty")}abort(){"aborted"!==this.value&&(this.value="aborted")}static mergeArray(e,t){const r=[];for(const a of t){if("aborted"===a.status)return y;"dirty"===a.status&&e.dirty(),r.push(a.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,t){const r=[];for(const e of t){const t=await e.key,a=await e.value;r.push({key:t,value:a})}return g.mergeObjectSync(e,r)}static mergeObjectSync(e,t){const r={};for(const a of t){const{key:t,value:s}=a;if("aborted"===t.status)return y;if("aborted"===s.status)return y;"dirty"===t.status&&e.dirty(),"dirty"===s.status&&e.dirty(),"__proto__"===t.value||void 0===s.value&&!a.alwaysSet||(r[t.value]=s.value)}return{status:e.value,value:r}}}const y=Object.freeze({status:"aborted"}),_=e=>({status:"dirty",value:e}),b=e=>({status:"valid",value:e}),w=e=>"aborted"===e.status,x=e=>"dirty"===e.status,P=e=>"valid"===e.status,k=e=>"undefined"!=typeof Promise&&e instanceof Promise;var E;!function(e){e.errToObj=e=>"string"==typeof e?{message:e}:e||{},e.toString=e=>"string"==typeof e?e:null==e?void 0:e.message}(E||(E={}));class S{constructor(e,t,r,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 R=(e,t)=>{if(P(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new p(e.common.issues);return this._error=t,this._error}}};function T(e){if(!e)return{};const{errorMap:t,invalid_type_error:r,required_error:a,description:s}=e;if(t&&(r||a))throw new Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');return t?{errorMap:t,description:s}:{errorMap:(t,s)=>{const{message:i}=e;return"invalid_enum_value"===t.code?{message:i??s.defaultError}:void 0===s.data?{message:i??a??s.defaultError}:"invalid_type"!==t.code?{message:s.defaultError}:{message:i??r??s.defaultError}},description:s}}class A{get description(){return this._def.description}_getType(e){return l(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:l(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new g,ctx:{common:e.parent.common,data:e.data,parsedType:l(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(k(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:(null==t?void 0:t.async)??!1,contextualErrorMap:null==t?void 0:t.errorMap},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:l(e)},a=this._parseSync({data:e,path:r.path,parent:r});return R(r,a)}"~validate"(e){var t,r;const a={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:l(e)};if(!this["~standard"].async)try{const t=this._parseSync({data:e,path:[],parent:a});return P(t)?{value:t.value}:{issues:a.common.issues}}catch(e){(null==(r=null==(t=null==e?void 0:e.message)?void 0:t.toLowerCase())?void 0:r.includes("encountered"))&&(this["~standard"].async=!0),a.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:a}).then(e=>P(e)?{value:e.value}:{issues:a.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:null==t?void 0:t.errorMap,async:!0},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:l(e)},a=this._parse({data:e,path:r.path,parent:r}),s=await(k(a)?a:Promise.resolve(a));return R(r,s)}refine(e,t){return this._refinement((r,a)=>{const s=e(r),i=()=>{return a.addIssue({code:h.custom,...(e=r,"string"==typeof t||void 0===t?{message:t}:"function"==typeof t?t(e):t)});var e};return"undefined"!=typeof Promise&&s instanceof Promise?s.then(e=>!!e||(i(),!1)):!!s||(i(),!1)})}refinement(e,t){return this._refinement((r,a)=>!!e(r)||(a.addIssue("function"==typeof t?t(r,a):t),!1))}_refinement(e){return new Te({schema:this,typeName:Ze.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:e=>this["~validate"](e)}}optional(){return Ae.create(this,this._def)}nullable(){return Oe.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return ue.create(this)}promise(){return Re.create(this,this._def)}or(e){return pe.create([this,e],this._def)}and(e){return ge.create(this,e,this._def)}transform(e){return new Te({...T(this._def),schema:this,typeName:Ze.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t="function"==typeof e?e:()=>e;return new Ce({...T(this._def),innerType:this,defaultValue:t,typeName:Ze.ZodDefault})}brand(){return new Ie({typeName:Ze.ZodBranded,type:this,...T(this._def)})}catch(e){const t="function"==typeof e?e:()=>e;return new $e({...T(this._def),innerType:this,catchValue:t,typeName:Ze.ZodCatch})}describe(e){return new this.constructor({...this._def,description:e})}pipe(e){return Ne.create(this,e)}readonly(){return Fe.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const O=/^c[^\s-]{8,}$/i,C=/^[0-9a-z]+$/,$=/^[0-9A-HJKMNP-TV-Z]{26}$/i,j=/^[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,I=/^[a-z0-9_-]{21}$/i,N=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,F=/^[-+]?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)?)??$/,Z=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;let D;const L=/^(?:(?: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])$/,M=/^(?:(?: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])$/,q=/^(([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]))$/,z=/^(([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])$/,V=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,H=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,U="((\\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])))",Q=new RegExp(`^${U}$`);function K(e){let t="[0-5]\\d";return e.precision?t=`${t}\\.\\d{${e.precision}}`:null==e.precision&&(t=`${t}(\\.\\d+)?`),`([01]\\d|2[0-3]):[0-5]\\d(:${t})${e.precision?"+":"?"}`}function B(e){let t=`${U}T${K(e)}`;const r=[];return r.push(e.local?"Z?":"Z"),e.offset&&r.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${r.join("|")})`,new RegExp(`^${t}$`)}function W(e,t){if(!N.test(e))return!1;try{const[r]=e.split("."),a=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),s=JSON.parse(atob(a));return!("object"!=typeof s||null===s||"typ"in s&&"JWT"!==(null==s?void 0:s.typ)||!s.alg||t&&s.alg!==t)}catch{return!1}}function J(e,t){return!("v4"!==t&&t||!M.test(e))||!("v6"!==t&&t||!z.test(e))}class G extends A{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==u.string){const t=this._getOrReturnCtx(e);return v(t,{code:h.invalid_type,expected:u.string,received:t.parsedType}),y}const t=new g;let a;for(const n of this._def.checks)if("min"===n.kind)e.data.length<n.value&&(a=this._getOrReturnCtx(e,a),v(a,{code:h.too_small,minimum:n.value,type:"string",inclusive:!0,exact:!1,message:n.message}),t.dirty());else if("max"===n.kind)e.data.length>n.value&&(a=this._getOrReturnCtx(e,a),v(a,{code:h.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!1,message:n.message}),t.dirty());else if("length"===n.kind){const r=e.data.length>n.value,s=e.data.length<n.value;(r||s)&&(a=this._getOrReturnCtx(e,a),r?v(a,{code:h.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message}):s&&v(a,{code:h.too_small,minimum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message}),t.dirty())}else if("email"===n.kind)Z.test(e.data)||(a=this._getOrReturnCtx(e,a),v(a,{validation:"email",code:h.invalid_string,message:n.message}),t.dirty());else if("emoji"===n.kind)D||(D=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),D.test(e.data)||(a=this._getOrReturnCtx(e,a),v(a,{validation:"emoji",code:h.invalid_string,message:n.message}),t.dirty());else if("uuid"===n.kind)j.test(e.data)||(a=this._getOrReturnCtx(e,a),v(a,{validation:"uuid",code:h.invalid_string,message:n.message}),t.dirty());else if("nanoid"===n.kind)I.test(e.data)||(a=this._getOrReturnCtx(e,a),v(a,{validation:"nanoid",code:h.invalid_string,message:n.message}),t.dirty());else if("cuid"===n.kind)O.test(e.data)||(a=this._getOrReturnCtx(e,a),v(a,{validation:"cuid",code:h.invalid_string,message:n.message}),t.dirty());else if("cuid2"===n.kind)C.test(e.data)||(a=this._getOrReturnCtx(e,a),v(a,{validation:"cuid2",code:h.invalid_string,message:n.message}),t.dirty());else if("ulid"===n.kind)$.test(e.data)||(a=this._getOrReturnCtx(e,a),v(a,{validation:"ulid",code:h.invalid_string,message:n.message}),t.dirty());else if("url"===n.kind)try{new URL(e.data)}catch{a=this._getOrReturnCtx(e,a),v(a,{validation:"url",code:h.invalid_string,message:n.message}),t.dirty()}else"regex"===n.kind?(n.regex.lastIndex=0,n.regex.test(e.data)||(a=this._getOrReturnCtx(e,a),v(a,{validation:"regex",code:h.invalid_string,message:n.message}),t.dirty())):"trim"===n.kind?e.data=e.data.trim():"includes"===n.kind?e.data.includes(n.value,n.position)||(a=this._getOrReturnCtx(e,a),v(a,{code:h.invalid_string,validation:{includes:n.value,position:n.position},message:n.message}),t.dirty()):"toLowerCase"===n.kind?e.data=e.data.toLowerCase():"toUpperCase"===n.kind?e.data=e.data.toUpperCase():"startsWith"===n.kind?e.data.startsWith(n.value)||(a=this._getOrReturnCtx(e,a),v(a,{code:h.invalid_string,validation:{startsWith:n.value},message:n.message}),t.dirty()):"endsWith"===n.kind?e.data.endsWith(n.value)||(a=this._getOrReturnCtx(e,a),v(a,{code:h.invalid_string,validation:{endsWith:n.value},message:n.message}),t.dirty()):"datetime"===n.kind?B(n).test(e.data)||(a=this._getOrReturnCtx(e,a),v(a,{code:h.invalid_string,validation:"datetime",message:n.message}),t.dirty()):"date"===n.kind?Q.test(e.data)||(a=this._getOrReturnCtx(e,a),v(a,{code:h.invalid_string,validation:"date",message:n.message}),t.dirty()):"time"===n.kind?new RegExp(`^${K(n)}$`).test(e.data)||(a=this._getOrReturnCtx(e,a),v(a,{code:h.invalid_string,validation:"time",message:n.message}),t.dirty()):"duration"===n.kind?F.test(e.data)||(a=this._getOrReturnCtx(e,a),v(a,{validation:"duration",code:h.invalid_string,message:n.message}),t.dirty()):"ip"===n.kind?(s=e.data,("v4"!==(i=n.version)&&i||!L.test(s))&&("v6"!==i&&i||!q.test(s))&&(a=this._getOrReturnCtx(e,a),v(a,{validation:"ip",code:h.invalid_string,message:n.message}),t.dirty())):"jwt"===n.kind?W(e.data,n.alg)||(a=this._getOrReturnCtx(e,a),v(a,{validation:"jwt",code:h.invalid_string,message:n.message}),t.dirty()):"cidr"===n.kind?J(e.data,n.version)||(a=this._getOrReturnCtx(e,a),v(a,{validation:"cidr",code:h.invalid_string,message:n.message}),t.dirty()):"base64"===n.kind?V.test(e.data)||(a=this._getOrReturnCtx(e,a),v(a,{validation:"base64",code:h.invalid_string,message:n.message}),t.dirty()):"base64url"===n.kind?H.test(e.data)||(a=this._getOrReturnCtx(e,a),v(a,{validation:"base64url",code:h.invalid_string,message:n.message}),t.dirty()):r.assertNever(n);var s,i;return{status:t.value,value:e.data}}_regex(e,t,r){return this.refinement(t=>e.test(t),{validation:t,code:h.invalid_string,...E.errToObj(r)})}_addCheck(e){return new G({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...E.errToObj(e)})}url(e){return this._addCheck({kind:"url",...E.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...E.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...E.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...E.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...E.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...E.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...E.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...E.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...E.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...E.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...E.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...E.errToObj(e)})}datetime(e){return"string"==typeof e?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:void 0===(null==e?void 0:e.precision)?null:null==e?void 0:e.precision,offset:(null==e?void 0:e.offset)??!1,local:(null==e?void 0:e.local)??!1,...E.errToObj(null==e?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return"string"==typeof e?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:void 0===(null==e?void 0:e.precision)?null:null==e?void 0:e.precision,...E.errToObj(null==e?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...E.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...E.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:null==t?void 0:t.position,...E.errToObj(null==t?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...E.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...E.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...E.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...E.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...E.errToObj(t)})}nonempty(e){return this.min(1,E.errToObj(e))}trim(){return new G({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new G({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new G({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>"datetime"===e.kind)}get isDate(){return!!this._def.checks.find(e=>"date"===e.kind)}get isTime(){return!!this._def.checks.find(e=>"time"===e.kind)}get isDuration(){return!!this._def.checks.find(e=>"duration"===e.kind)}get isEmail(){return!!this._def.checks.find(e=>"email"===e.kind)}get isURL(){return!!this._def.checks.find(e=>"url"===e.kind)}get isEmoji(){return!!this._def.checks.find(e=>"emoji"===e.kind)}get isUUID(){return!!this._def.checks.find(e=>"uuid"===e.kind)}get isNANOID(){return!!this._def.checks.find(e=>"nanoid"===e.kind)}get isCUID(){return!!this._def.checks.find(e=>"cuid"===e.kind)}get isCUID2(){return!!this._def.checks.find(e=>"cuid2"===e.kind)}get isULID(){return!!this._def.checks.find(e=>"ulid"===e.kind)}get isIP(){return!!this._def.checks.find(e=>"ip"===e.kind)}get isCIDR(){return!!this._def.checks.find(e=>"cidr"===e.kind)}get isBase64(){return!!this._def.checks.find(e=>"base64"===e.kind)}get isBase64url(){return!!this._def.checks.find(e=>"base64url"===e.kind)}get minLength(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}function Y(e,t){const r=(e.toString().split(".")[1]||"").length,a=(t.toString().split(".")[1]||"").length,s=r>a?r:a;return Number.parseInt(e.toFixed(s).replace(".",""))%Number.parseInt(t.toFixed(s).replace(".",""))/10**s}G.create=e=>new G({checks:[],typeName:Ze.ZodString,coerce:(null==e?void 0:e.coerce)??!1,...T(e)});class X extends A{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)!==u.number){const t=this._getOrReturnCtx(e);return v(t,{code:h.invalid_type,expected:u.number,received:t.parsedType}),y}let t;const a=new g;for(const s of this._def.checks)"int"===s.kind?r.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),v(t,{code:h.invalid_type,expected:"integer",received:"float",message:s.message}),a.dirty()):"min"===s.kind?(s.inclusive?e.data<s.value:e.data<=s.value)&&(t=this._getOrReturnCtx(e,t),v(t,{code:h.too_small,minimum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),a.dirty()):"max"===s.kind?(s.inclusive?e.data>s.value:e.data>=s.value)&&(t=this._getOrReturnCtx(e,t),v(t,{code:h.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),a.dirty()):"multipleOf"===s.kind?0!==Y(e.data,s.value)&&(t=this._getOrReturnCtx(e,t),v(t,{code:h.not_multiple_of,multipleOf:s.value,message:s.message}),a.dirty()):"finite"===s.kind?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),v(t,{code:h.not_finite,message:s.message}),a.dirty()):r.assertNever(s);return{status:a.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,E.toString(t))}gt(e,t){return this.setLimit("min",e,!1,E.toString(t))}lte(e,t){return this.setLimit("max",e,!0,E.toString(t))}lt(e,t){return this.setLimit("max",e,!1,E.toString(t))}setLimit(e,t,r,a){return new X({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:E.toString(a)}]})}_addCheck(e){return new X({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:E.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:E.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:E.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:E.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:E.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:E.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:E.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:E.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:E.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>"int"===e.kind||"multipleOf"===e.kind&&r.isInteger(e.value))}get isFinite(){let e=null,t=null;for(const r of this._def.checks){if("finite"===r.kind||"int"===r.kind||"multipleOf"===r.kind)return!0;"min"===r.kind?(null===t||r.value>t)&&(t=r.value):"max"===r.kind&&(null===e||r.value<e)&&(e=r.value)}return Number.isFinite(t)&&Number.isFinite(e)}}X.create=e=>new X({checks:[],typeName:Ze.ZodNumber,coerce:(null==e?void 0:e.coerce)||!1,...T(e)});class ee extends A{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)!==u.bigint)return this._getInvalidInput(e);let t;const a=new g;for(const s of this._def.checks)"min"===s.kind?(s.inclusive?e.data<s.value:e.data<=s.value)&&(t=this._getOrReturnCtx(e,t),v(t,{code:h.too_small,type:"bigint",minimum:s.value,inclusive:s.inclusive,message:s.message}),a.dirty()):"max"===s.kind?(s.inclusive?e.data>s.value:e.data>=s.value)&&(t=this._getOrReturnCtx(e,t),v(t,{code:h.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),a.dirty()):"multipleOf"===s.kind?e.data%s.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),v(t,{code:h.not_multiple_of,multipleOf:s.value,message:s.message}),a.dirty()):r.assertNever(s);return{status:a.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return v(t,{code:h.invalid_type,expected:u.bigint,received:t.parsedType}),y}gte(e,t){return this.setLimit("min",e,!0,E.toString(t))}gt(e,t){return this.setLimit("min",e,!1,E.toString(t))}lte(e,t){return this.setLimit("max",e,!0,E.toString(t))}lt(e,t){return this.setLimit("max",e,!1,E.toString(t))}setLimit(e,t,r,a){return new ee({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:E.toString(a)}]})}_addCheck(e){return new ee({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:E.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:E.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:E.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:E.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:E.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}ee.create=e=>new ee({checks:[],typeName:Ze.ZodBigInt,coerce:(null==e?void 0:e.coerce)??!1,...T(e)});class te extends A{_parse(e){if(this._def.coerce&&(e.data=Boolean(e.data)),this._getType(e)!==u.boolean){const t=this._getOrReturnCtx(e);return v(t,{code:h.invalid_type,expected:u.boolean,received:t.parsedType}),y}return b(e.data)}}te.create=e=>new te({typeName:Ze.ZodBoolean,coerce:(null==e?void 0:e.coerce)||!1,...T(e)});class re extends A{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==u.date){const t=this._getOrReturnCtx(e);return v(t,{code:h.invalid_type,expected:u.date,received:t.parsedType}),y}if(Number.isNaN(e.data.getTime()))return v(this._getOrReturnCtx(e),{code:h.invalid_date}),y;const t=new g;let a;for(const s of this._def.checks)"min"===s.kind?e.data.getTime()<s.value&&(a=this._getOrReturnCtx(e,a),v(a,{code:h.too_small,message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),t.dirty()):"max"===s.kind?e.data.getTime()>s.value&&(a=this._getOrReturnCtx(e,a),v(a,{code:h.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),t.dirty()):r.assertNever(s);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(e){return new re({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:E.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:E.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return null!=e?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return null!=e?new Date(e):null}}re.create=e=>new re({checks:[],coerce:(null==e?void 0:e.coerce)||!1,typeName:Ze.ZodDate,...T(e)});class ae extends A{_parse(e){if(this._getType(e)!==u.symbol){const t=this._getOrReturnCtx(e);return v(t,{code:h.invalid_type,expected:u.symbol,received:t.parsedType}),y}return b(e.data)}}ae.create=e=>new ae({typeName:Ze.ZodSymbol,...T(e)});class se extends A{_parse(e){if(this._getType(e)!==u.undefined){const t=this._getOrReturnCtx(e);return v(t,{code:h.invalid_type,expected:u.undefined,received:t.parsedType}),y}return b(e.data)}}se.create=e=>new se({typeName:Ze.ZodUndefined,...T(e)});class ie extends A{_parse(e){if(this._getType(e)!==u.null){const t=this._getOrReturnCtx(e);return v(t,{code:h.invalid_type,expected:u.null,received:t.parsedType}),y}return b(e.data)}}ie.create=e=>new ie({typeName:Ze.ZodNull,...T(e)});class ne extends A{constructor(){super(...arguments),this._any=!0}_parse(e){return b(e.data)}}ne.create=e=>new ne({typeName:Ze.ZodAny,...T(e)});class oe extends A{constructor(){super(...arguments),this._unknown=!0}_parse(e){return b(e.data)}}oe.create=e=>new oe({typeName:Ze.ZodUnknown,...T(e)});class de extends A{_parse(e){const t=this._getOrReturnCtx(e);return v(t,{code:h.invalid_type,expected:u.never,received:t.parsedType}),y}}de.create=e=>new de({typeName:Ze.ZodNever,...T(e)});class ce extends A{_parse(e){if(this._getType(e)!==u.undefined){const t=this._getOrReturnCtx(e);return v(t,{code:h.invalid_type,expected:u.void,received:t.parsedType}),y}return b(e.data)}}ce.create=e=>new ce({typeName:Ze.ZodVoid,...T(e)});class ue extends A{_parse(e){const{ctx:t,status:r}=this._processInputParams(e),a=this._def;if(t.parsedType!==u.array)return v(t,{code:h.invalid_type,expected:u.array,received:t.parsedType}),y;if(null!==a.exactLength){const e=t.data.length>a.exactLength.value,s=t.data.length<a.exactLength.value;(e||s)&&(v(t,{code:e?h.too_big:h.too_small,minimum:s?a.exactLength.value:void 0,maximum:e?a.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:a.exactLength.message}),r.dirty())}if(null!==a.minLength&&t.data.length<a.minLength.value&&(v(t,{code:h.too_small,minimum:a.minLength.value,type:"array",inclusive:!0,exact:!1,message:a.minLength.message}),r.dirty()),null!==a.maxLength&&t.data.length>a.maxLength.value&&(v(t,{code:h.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((e,r)=>a.type._parseAsync(new S(t,e,t.path,r)))).then(e=>g.mergeArray(r,e));const s=[...t.data].map((e,r)=>a.type._parseSync(new S(t,e,t.path,r)));return g.mergeArray(r,s)}get element(){return this._def.type}min(e,t){return new ue({...this._def,minLength:{value:e,message:E.toString(t)}})}max(e,t){return new ue({...this._def,maxLength:{value:e,message:E.toString(t)}})}length(e,t){return new ue({...this._def,exactLength:{value:e,message:E.toString(t)}})}nonempty(e){return this.min(1,e)}}function le(e){if(e instanceof he){const t={};for(const r in e.shape){const a=e.shape[r];t[r]=Ae.create(le(a))}return new he({...e._def,shape:()=>t})}return e instanceof ue?new ue({...e._def,type:le(e.element)}):e instanceof Ae?Ae.create(le(e.unwrap())):e instanceof Oe?Oe.create(le(e.unwrap())):e instanceof ye?ye.create(e.items.map(e=>le(e))):e}ue.create=(e,t)=>new ue({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Ze.ZodArray,...T(t)});class he extends A{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(null!==this._cached)return this._cached;const e=this._def.shape(),t=r.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==u.object){const t=this._getOrReturnCtx(e);return v(t,{code:h.invalid_type,expected:u.object,received:t.parsedType}),y}const{status:t,ctx:r}=this._processInputParams(e),{shape:a,keys:s}=this._getCached(),i=[];if(!(this._def.catchall instanceof de&&"strip"===this._def.unknownKeys))for(const e in r.data)s.includes(e)||i.push(e);const n=[];for(const e of s){const t=a[e],s=r.data[e];n.push({key:{status:"valid",value:e},value:t._parse(new S(r,s,r.path,e)),alwaysSet:e in r.data})}if(this._def.catchall instanceof de){const e=this._def.unknownKeys;if("passthrough"===e)for(const e of i)n.push({key:{status:"valid",value:e},value:{status:"valid",value:r.data[e]}});else if("strict"===e)i.length>0&&(v(r,{code:h.unrecognized_keys,keys:i}),t.dirty());else if("strip"!==e)throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const e=this._def.catchall;for(const t of i){const a=r.data[t];n.push({key:{status:"valid",value:t},value:e._parse(new S(r,a,r.path,t)),alwaysSet:t in r.data})}}return r.common.async?Promise.resolve().then(async()=>{const e=[];for(const t of n){const r=await t.key,a=await t.value;e.push({key:r,value:a,alwaysSet:t.alwaysSet})}return e}).then(e=>g.mergeObjectSync(t,e)):g.mergeObjectSync(t,n)}get shape(){return this._def.shape()}strict(e){return E.errToObj,new he({...this._def,unknownKeys:"strict",...void 0!==e?{errorMap:(t,r)=>{var a,s;const i=(null==(s=(a=this._def).errorMap)?void 0:s.call(a,t,r).message)??r.defaultError;return"unrecognized_keys"===t.code?{message:E.errToObj(e).message??i}:{message:i}}}:{}})}strip(){return new he({...this._def,unknownKeys:"strip"})}passthrough(){return new he({...this._def,unknownKeys:"passthrough"})}extend(e){return new he({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new he({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:Ze.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new he({...this._def,catchall:e})}pick(e){const t={};for(const a of r.objectKeys(e))e[a]&&this.shape[a]&&(t[a]=this.shape[a]);return new he({...this._def,shape:()=>t})}omit(e){const t={};for(const a of r.objectKeys(this.shape))e[a]||(t[a]=this.shape[a]);return new he({...this._def,shape:()=>t})}deepPartial(){return le(this)}partial(e){const t={};for(const a of r.objectKeys(this.shape)){const r=this.shape[a];e&&!e[a]?t[a]=r:t[a]=r.optional()}return new he({...this._def,shape:()=>t})}required(e){const t={};for(const a of r.objectKeys(this.shape))if(e&&!e[a])t[a]=this.shape[a];else{let e=this.shape[a];for(;e instanceof Ae;)e=e._def.innerType;t[a]=e}return new he({...this._def,shape:()=>t})}keyof(){return ke(r.objectKeys(this.shape))}}he.create=(e,t)=>new he({shape:()=>e,unknownKeys:"strip",catchall:de.create(),typeName:Ze.ZodObject,...T(t)}),he.strictCreate=(e,t)=>new he({shape:()=>e,unknownKeys:"strict",catchall:de.create(),typeName:Ze.ZodObject,...T(t)}),he.lazycreate=(e,t)=>new he({shape:e,unknownKeys:"strip",catchall:de.create(),typeName:Ze.ZodObject,...T(t)});class pe extends A{_parse(e){const{ctx:t}=this._processInputParams(e),r=this._def.options;if(t.common.async)return Promise.all(r.map(async e=>{const r={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:r}),ctx:r}})).then(function(e){for(const t of e)if("valid"===t.result.status)return t.result;for(const r of e)if("dirty"===r.result.status)return t.common.issues.push(...r.ctx.common.issues),r.result;const r=e.map(e=>new p(e.ctx.common.issues));return v(t,{code:h.invalid_union,unionErrors:r}),y});{let e;const a=[];for(const s of r){const r={...t,common:{...t.common,issues:[]},parent:null},i=s._parseSync({data:t.data,path:t.path,parent:r});if("valid"===i.status)return i;"dirty"!==i.status||e||(e={result:i,ctx:r}),r.common.issues.length&&a.push(r.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;const s=a.map(e=>new p(e));return v(t,{code:h.invalid_union,unionErrors:s}),y}}get options(){return this._def.options}}pe.create=(e,t)=>new pe({options:e,typeName:Ze.ZodUnion,...T(t)});const me=e=>e instanceof xe?me(e.schema):e instanceof Te?me(e.innerType()):e instanceof Pe?[e.value]:e instanceof Ee?e.options:e instanceof Se?r.objectValues(e.enum):e instanceof Ce?me(e._def.innerType):e instanceof se?[void 0]:e instanceof ie?[null]:e instanceof Ae?[void 0,...me(e.unwrap())]:e instanceof Oe?[null,...me(e.unwrap())]:e instanceof Ie||e instanceof Fe?me(e.unwrap()):e instanceof $e?me(e._def.innerType):[];class fe extends A{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==u.object)return v(t,{code:h.invalid_type,expected:u.object,received:t.parsedType}),y;const r=this.discriminator,a=t.data[r],s=this.optionsMap.get(a);return s?t.common.async?s._parseAsync({data:t.data,path:t.path,parent:t}):s._parseSync({data:t.data,path:t.path,parent:t}):(v(t,{code:h.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),y)}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 r of t){const t=me(r.shape[e]);if(!t.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const s of t){if(a.has(s))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(s)}`);a.set(s,r)}}return new fe({typeName:Ze.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:a,...T(r)})}}function ve(e,t){const a=l(e),s=l(t);if(e===t)return{valid:!0,data:e};if(a===u.object&&s===u.object){const a=r.objectKeys(t),s=r.objectKeys(e).filter(e=>-1!==a.indexOf(e)),i={...e,...t};for(const r of s){const a=ve(e[r],t[r]);if(!a.valid)return{valid:!1};i[r]=a.data}return{valid:!0,data:i}}if(a===u.array&&s===u.array){if(e.length!==t.length)return{valid:!1};const r=[];for(let a=0;a<e.length;a++){const s=ve(e[a],t[a]);if(!s.valid)return{valid:!1};r.push(s.data)}return{valid:!0,data:r}}return a===u.date&&s===u.date&&+e===+t?{valid:!0,data:e}:{valid:!1}}class ge extends A{_parse(e){const{status:t,ctx:r}=this._processInputParams(e),a=(e,a)=>{if(w(e)||w(a))return y;const s=ve(e.value,a.value);return s.valid?((x(e)||x(a))&&t.dirty(),{status:t.value,value:s.data}):(v(r,{code:h.invalid_intersection_types}),y)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([e,t])=>a(e,t)):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}))}}ge.create=(e,t,r)=>new ge({left:e,right:t,typeName:Ze.ZodIntersection,...T(r)});class ye extends A{_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==u.array)return v(r,{code:h.invalid_type,expected:u.array,received:r.parsedType}),y;if(r.data.length<this._def.items.length)return v(r,{code:h.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),y;!this._def.rest&&r.data.length>this._def.items.length&&(v(r,{code:h.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const a=[...r.data].map((e,t)=>{const a=this._def.items[t]||this._def.rest;return a?a._parse(new S(r,e,r.path,t)):null}).filter(e=>!!e);return r.common.async?Promise.all(a).then(e=>g.mergeArray(t,e)):g.mergeArray(t,a)}get items(){return this._def.items}rest(e){return new ye({...this._def,rest:e})}}ye.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new ye({items:e,typeName:Ze.ZodTuple,rest:null,...T(t)})};class _e extends A{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!==u.object)return v(r,{code:h.invalid_type,expected:u.object,received:r.parsedType}),y;const a=[],s=this._def.keyType,i=this._def.valueType;for(const e in r.data)a.push({key:s._parse(new S(r,e,r.path,e)),value:i._parse(new S(r,r.data[e],r.path,e)),alwaysSet:e in r.data});return r.common.async?g.mergeObjectAsync(t,a):g.mergeObjectSync(t,a)}get element(){return this._def.valueType}static create(e,t,r){return new _e(t instanceof A?{keyType:e,valueType:t,typeName:Ze.ZodRecord,...T(r)}:{keyType:G.create(),valueType:e,typeName:Ze.ZodRecord,...T(t)})}}class be extends A{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!==u.map)return v(r,{code:h.invalid_type,expected:u.map,received:r.parsedType}),y;const a=this._def.keyType,s=this._def.valueType,i=[...r.data.entries()].map(([e,t],i)=>({key:a._parse(new S(r,e,r.path,[i,"key"])),value:s._parse(new S(r,t,r.path,[i,"value"]))}));if(r.common.async){const e=new Map;return Promise.resolve().then(async()=>{for(const r of i){const a=await r.key,s=await r.value;if("aborted"===a.status||"aborted"===s.status)return y;"dirty"!==a.status&&"dirty"!==s.status||t.dirty(),e.set(a.value,s.value)}return{status:t.value,value:e}})}{const e=new Map;for(const r of i){const a=r.key,s=r.value;if("aborted"===a.status||"aborted"===s.status)return y;"dirty"!==a.status&&"dirty"!==s.status||t.dirty(),e.set(a.value,s.value)}return{status:t.value,value:e}}}}be.create=(e,t,r)=>new be({valueType:t,keyType:e,typeName:Ze.ZodMap,...T(r)});class we extends A{_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==u.set)return v(r,{code:h.invalid_type,expected:u.set,received:r.parsedType}),y;const a=this._def;null!==a.minSize&&r.data.size<a.minSize.value&&(v(r,{code:h.too_small,minimum:a.minSize.value,type:"set",inclusive:!0,exact:!1,message:a.minSize.message}),t.dirty()),null!==a.maxSize&&r.data.size>a.maxSize.value&&(v(r,{code:h.too_big,maximum:a.maxSize.value,type:"set",inclusive:!0,exact:!1,message:a.maxSize.message}),t.dirty());const s=this._def.valueType;function i(e){const r=new Set;for(const a of e){if("aborted"===a.status)return y;"dirty"===a.status&&t.dirty(),r.add(a.value)}return{status:t.value,value:r}}const n=[...r.data.values()].map((e,t)=>s._parse(new S(r,e,r.path,t)));return r.common.async?Promise.all(n).then(e=>i(e)):i(n)}min(e,t){return new we({...this._def,minSize:{value:e,message:E.toString(t)}})}max(e,t){return new we({...this._def,maxSize:{value:e,message:E.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}we.create=(e,t)=>new we({valueType:e,minSize:null,maxSize:null,typeName:Ze.ZodSet,...T(t)});class xe extends A{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})}}xe.create=(e,t)=>new xe({getter:e,typeName:Ze.ZodLazy,...T(t)});class Pe extends A{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return v(t,{received:t.data,code:h.invalid_literal,expected:this._def.value}),y}return{status:"valid",value:e.data}}get value(){return this._def.value}}function ke(e,t){return new Ee({values:e,typeName:Ze.ZodEnum,...T(t)})}Pe.create=(e,t)=>new Pe({value:e,typeName:Ze.ZodLiteral,...T(t)});class Ee extends A{_parse(e){if("string"!=typeof e.data){const t=this._getOrReturnCtx(e),a=this._def.values;return v(t,{expected:r.joinValues(a),received:t.parsedType,code:h.invalid_type}),y}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 v(t,{received:t.data,code:h.invalid_enum_value,options:r}),y}return b(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 Ee.create(e,{...this._def,...t})}exclude(e,t=this._def){return Ee.create(this.options.filter(t=>!e.includes(t)),{...this._def,...t})}}Ee.create=ke;class Se extends A{_parse(e){const t=r.getValidEnumValues(this._def.values),a=this._getOrReturnCtx(e);if(a.parsedType!==u.string&&a.parsedType!==u.number){const e=r.objectValues(t);return v(a,{expected:r.joinValues(e),received:a.parsedType,code:h.invalid_type}),y}if(this._cache||(this._cache=new Set(r.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const e=r.objectValues(t);return v(a,{received:a.data,code:h.invalid_enum_value,options:e}),y}return b(e.data)}get enum(){return this._def.values}}Se.create=(e,t)=>new Se({values:e,typeName:Ze.ZodNativeEnum,...T(t)});class Re extends A{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==u.promise&&!1===t.common.async)return v(t,{code:h.invalid_type,expected:u.promise,received:t.parsedType}),y;const r=t.parsedType===u.promise?t.data:Promise.resolve(t.data);return b(r.then(e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap})))}}Re.create=(e,t)=>new Re({type:e,typeName:Ze.ZodPromise,...T(t)});class Te extends A{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Ze.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:a}=this._processInputParams(e),s=this._def.effect||null,i={addIssue:e=>{v(a,e),e.fatal?t.abort():t.dirty()},get path(){return a.path}};if(i.addIssue=i.addIssue.bind(i),"preprocess"===s.type){const e=s.transform(a.data,i);if(a.common.async)return Promise.resolve(e).then(async e=>{if("aborted"===t.value)return y;const r=await this._def.schema._parseAsync({data:e,path:a.path,parent:a});return"aborted"===r.status?y:"dirty"===r.status||"dirty"===t.value?_(r.value):r});{if("aborted"===t.value)return y;const r=this._def.schema._parseSync({data:e,path:a.path,parent:a});return"aborted"===r.status?y:"dirty"===r.status||"dirty"===t.value?_(r.value):r}}if("refinement"===s.type){const e=e=>{const t=s.refinement(e,i);if(a.common.async)return Promise.resolve(t);if(t instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return e};if(!1===a.common.async){const r=this._def.schema._parseSync({data:a.data,path:a.path,parent:a});return"aborted"===r.status?y:("dirty"===r.status&&t.dirty(),e(r.value),{status:t.value,value:r.value})}return this._def.schema._parseAsync({data:a.data,path:a.path,parent:a}).then(r=>"aborted"===r.status?y:("dirty"===r.status&&t.dirty(),e(r.value).then(()=>({status:t.value,value:r.value}))))}if("transform"===s.type){if(!1===a.common.async){const e=this._def.schema._parseSync({data:a.data,path:a.path,parent:a});if(!P(e))return y;const r=s.transform(e.value,i);if(r instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:r}}return this._def.schema._parseAsync({data:a.data,path:a.path,parent:a}).then(e=>P(e)?Promise.resolve(s.transform(e.value,i)).then(e=>({status:t.value,value:e})):y)}r.assertNever(s)}}Te.create=(e,t,r)=>new Te({schema:e,typeName:Ze.ZodEffects,effect:t,...T(r)}),Te.createWithPreprocess=(e,t,r)=>new Te({schema:t,effect:{type:"preprocess",transform:e},typeName:Ze.ZodEffects,...T(r)});class Ae extends A{_parse(e){return this._getType(e)===u.undefined?b(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Ae.create=(e,t)=>new Ae({innerType:e,typeName:Ze.ZodOptional,...T(t)});class Oe extends A{_parse(e){return this._getType(e)===u.null?b(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Oe.create=(e,t)=>new Oe({innerType:e,typeName:Ze.ZodNullable,...T(t)});class Ce extends A{_parse(e){const{ctx:t}=this._processInputParams(e);let r=t.data;return t.parsedType===u.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}Ce.create=(e,t)=>new Ce({innerType:e,typeName:Ze.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...T(t)});class $e extends A{_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 k(a)?a.then(e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new p(r.common.issues)},input:r.data})})):{status:"valid",value:"valid"===a.status?a.value:this._def.catchValue({get error(){return new p(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}$e.create=(e,t)=>new $e({innerType:e,typeName:Ze.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...T(t)});class je extends A{_parse(e){if(this._getType(e)!==u.nan){const t=this._getOrReturnCtx(e);return v(t,{code:h.invalid_type,expected:u.nan,received:t.parsedType}),y}return{status:"valid",value:e.data}}}je.create=e=>new je({typeName:Ze.ZodNaN,...T(e)});class Ie extends A{_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 Ne extends A{_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{const e=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return"aborted"===e.status?y:"dirty"===e.status?(t.dirty(),_(e.value)):this._def.out._parseAsync({data:e.value,path:r.path,parent:r})})();{const e=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return"aborted"===e.status?y:"dirty"===e.status?(t.dirty(),{status:"dirty",value:e.value}):this._def.out._parseSync({data:e.value,path:r.path,parent:r})}}static create(e,t){return new Ne({in:e,out:t,typeName:Ze.ZodPipeline})}}class Fe extends A{_parse(e){const t=this._def.innerType._parse(e),r=e=>(P(e)&&(e.value=Object.freeze(e.value)),e);return k(t)?t.then(e=>r(e)):r(t)}unwrap(){return this._def.innerType}}var Ze;Fe.create=(e,t)=>new Fe({innerType:e,typeName:Ze.ZodReadonly,...T(t)}),function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"}(Ze||(Ze={}));const De=G.create,Le=X.create,Me=te.create,qe=oe.create,ze=(de.create,ue.create),Ve=he.create,He=pe.create,Ue=fe.create,Qe=(ge.create,ye.create,_e.create),Ke=Pe.create,Be=Ee.create,We=(Re.create,Ae.create),Je=(Oe.create,"2.0"),Ge=He([De(),Le().int()]),Ye=De(),Xe=Ve({progressToken:We(Ge)}).passthrough(),et=Ve({_meta:We(Xe)}).passthrough(),tt=Ve({method:De(),params:We(et)}),rt=Ve({_meta:We(Ve({}).passthrough())}).passthrough(),at=Ve({method:De(),params:We(rt)}),st=Ve({_meta:We(Ve({}).passthrough())}).passthrough(),it=He([De(),Le().int()]),nt=Ve({jsonrpc:Ke(Je),id:it}).merge(tt).strict(),ot=Ve({jsonrpc:Ke(Je)}).merge(at).strict(),dt=Ve({jsonrpc:Ke(Je),id:it,result:st}).strict();var ct;!function(e){e[e.ConnectionClosed=-32e3]="ConnectionClosed",e[e.RequestTimeout=-32001]="RequestTimeout",e[e.ParseError=-32700]="ParseError",e[e.InvalidRequest=-32600]="InvalidRequest",e[e.MethodNotFound=-32601]="MethodNotFound",e[e.InvalidParams=-32602]="InvalidParams",e[e.InternalError=-32603]="InternalError"}(ct||(ct={}));const ut=He([nt,ot,dt,Ve({jsonrpc:Ke(Je),id:it,error:Ve({code:Le().int(),message:De(),data:We(qe())})}).strict()]),lt=st.strict(),ht=at.extend({method:Ke("notifications/cancelled"),params:rt.extend({requestId:it,reason:De().optional()})}),pt=Ve({name:De(),title:We(De())}).passthrough(),mt=pt.extend({version:De()}),ft=Ve({experimental:We(Ve({}).passthrough()),sampling:We(Ve({}).passthrough()),elicitation:We(Ve({}).passthrough()),roots:We(Ve({listChanged:We(Me())}).passthrough())}).passthrough(),vt=tt.extend({method:Ke("initialize"),params:et.extend({protocolVersion:De(),capabilities:ft,clientInfo:mt})}),gt=Ve({experimental:We(Ve({}).passthrough()),logging:We(Ve({}).passthrough()),completions:We(Ve({}).passthrough()),prompts:We(Ve({listChanged:We(Me())}).passthrough()),resources:We(Ve({subscribe:We(Me()),listChanged:We(Me())}).passthrough()),tools:We(Ve({listChanged:We(Me())}).passthrough())}).passthrough(),yt=st.extend({protocolVersion:De(),capabilities:gt,serverInfo:mt,instructions:We(De())}),_t=at.extend({method:Ke("notifications/initialized")}),bt=tt.extend({method:Ke("ping")}),wt=Ve({progress:Le(),total:We(Le()),message:We(De())}).passthrough(),xt=at.extend({method:Ke("notifications/progress"),params:rt.merge(wt).extend({progressToken:Ge})}),Pt=tt.extend({params:et.extend({cursor:We(Ye)}).optional()}),kt=st.extend({nextCursor:We(Ye)}),Et=Ve({uri:De(),mimeType:We(De()),_meta:We(Ve({}).passthrough())}).passthrough(),St=Et.extend({text:De()}),Rt=Et.extend({blob:De().base64()}),Tt=pt.extend({uri:De(),description:We(De()),mimeType:We(De()),_meta:We(Ve({}).passthrough())}),At=pt.extend({uriTemplate:De(),description:We(De()),mimeType:We(De()),_meta:We(Ve({}).passthrough())}),Ot=Pt.extend({method:Ke("resources/list")}),Ct=kt.extend({resources:ze(Tt)}),$t=Pt.extend({method:Ke("resources/templates/list")}),jt=kt.extend({resourceTemplates:ze(At)}),It=tt.extend({method:Ke("resources/read"),params:et.extend({uri:De()})}),Nt=st.extend({contents:ze(He([St,Rt]))}),Ft=at.extend({method:Ke("notifications/resources/list_changed")}),Zt=tt.extend({method:Ke("resources/subscribe"),params:et.extend({uri:De()})}),Dt=tt.extend({method:Ke("resources/unsubscribe"),params:et.extend({uri:De()})}),Lt=at.extend({method:Ke("notifications/resources/updated"),params:rt.extend({uri:De()})}),Mt=Ve({name:De(),description:We(De()),required:We(Me())}).passthrough(),qt=pt.extend({description:We(De()),arguments:We(ze(Mt)),_meta:We(Ve({}).passthrough())}),zt=Pt.extend({method:Ke("prompts/list")}),Vt=kt.extend({prompts:ze(qt)}),Ht=tt.extend({method:Ke("prompts/get"),params:et.extend({name:De(),arguments:We(Qe(De()))})}),Ut=Ve({type:Ke("text"),text:De(),_meta:We(Ve({}).passthrough())}).passthrough(),Qt=Ve({type:Ke("image"),data:De().base64(),mimeType:De(),_meta:We(Ve({}).passthrough())}).passthrough(),Kt=Ve({type:Ke("audio"),data:De().base64(),mimeType:De(),_meta:We(Ve({}).passthrough())}).passthrough(),Bt=Ve({type:Ke("resource"),resource:He([St,Rt]),_meta:We(Ve({}).passthrough())}).passthrough(),Wt=He([Ut,Qt,Kt,Tt.extend({type:Ke("resource_link")}),Bt]),Jt=Ve({role:Be(["user","assistant"]),content:Wt}).passthrough(),Gt=st.extend({description:We(De()),messages:ze(Jt)}),Yt=at.extend({method:Ke("notifications/prompts/list_changed")}),Xt=Ve({title:We(De()),readOnlyHint:We(Me()),destructiveHint:We(Me()),idempotentHint:We(Me()),openWorldHint:We(Me())}).passthrough(),er=pt.extend({description:We(De()),inputSchema:Ve({type:Ke("object"),properties:We(Ve({}).passthrough()),required:We(ze(De()))}).passthrough(),outputSchema:We(Ve({type:Ke("object"),properties:We(Ve({}).passthrough()),required:We(ze(De()))}).passthrough()),annotations:We(Xt),_meta:We(Ve({}).passthrough())}),tr=Pt.extend({method:Ke("tools/list")}),rr=kt.extend({tools:ze(er)}),ar=st.extend({content:ze(Wt).default([]),structuredContent:Ve({}).passthrough().optional(),isError:We(Me())}),sr=(ar.or(st.extend({toolResult:qe()})),tt.extend({method:Ke("tools/call"),params:et.extend({name:De(),arguments:We(Qe(qe()))})})),ir=at.extend({method:Ke("notifications/tools/list_changed")}),nr=Be(["debug","info","notice","warning","error","critical","alert","emergency"]),or=tt.extend({method:Ke("logging/setLevel"),params:et.extend({level:nr})}),dr=at.extend({method:Ke("notifications/message"),params:rt.extend({level:nr,logger:We(De()),data:qe()})}),cr=Ve({name:De().optional()}).passthrough(),ur=Ve({hints:We(ze(cr)),costPriority:We(Le().min(0).max(1)),speedPriority:We(Le().min(0).max(1)),intelligencePriority:We(Le().min(0).max(1))}).passthrough(),lr=Ve({role:Be(["user","assistant"]),content:He([Ut,Qt,Kt])}).passthrough(),hr=tt.extend({method:Ke("sampling/createMessage"),params:et.extend({messages:ze(lr),systemPrompt:We(De()),includeContext:We(Be(["none","thisServer","allServers"])),temperature:We(Le()),maxTokens:Le().int(),stopSequences:We(ze(De())),metadata:We(Ve({}).passthrough()),modelPreferences:We(ur)})}),pr=st.extend({model:De(),stopReason:We(Be(["endTurn","stopSequence","maxTokens"]).or(De())),role:Be(["user","assistant"]),content:Ue("type",[Ut,Qt,Kt])}),mr=He([Ve({type:Ke("boolean"),title:We(De()),description:We(De()),default:We(Me())}).passthrough(),Ve({type:Ke("string"),title:We(De()),description:We(De()),minLength:We(Le()),maxLength:We(Le()),format:We(Be(["email","uri","date","date-time"]))}).passthrough(),Ve({type:Be(["number","integer"]),title:We(De()),description:We(De()),minimum:We(Le()),maximum:We(Le())}).passthrough(),Ve({type:Ke("string"),title:We(De()),description:We(De()),enum:ze(De()),enumNames:We(ze(De()))}).passthrough()]),fr=tt.extend({method:Ke("elicitation/create"),params:et.extend({message:De(),requestedSchema:Ve({type:Ke("object"),properties:Qe(De(),mr),required:We(ze(De()))}).passthrough()})}),vr=st.extend({action:Be(["accept","reject","cancel"]),content:We(Qe(De(),qe()))}),gr=Ve({type:Ke("ref/resource"),uri:De()}).passthrough(),yr=Ve({type:Ke("ref/prompt"),name:De()}).passthrough(),_r=tt.extend({method:Ke("completion/complete"),params:et.extend({ref:He([yr,gr]),argument:Ve({name:De(),value:De()}).passthrough(),context:We(Ve({arguments:We(Qe(De(),De()))}))})}),br=st.extend({completion:Ve({values:ze(De()).max(100),total:We(Le().int()),hasMore:We(Me())}).passthrough()}),wr=Ve({uri:De().startsWith("file://"),name:We(De()),_meta:We(Ve({}).passthrough())}).passthrough(),xr=tt.extend({method:Ke("roots/list")}),Pr=st.extend({roots:ze(wr)}),kr=at.extend({method:Ke("notifications/roots/list_changed")});He([bt,vt,_r,or,Ht,zt,Ot,$t,It,Zt,Dt,sr,tr]),He([ht,xt,_t,kr]),He([lt,pr,vr,Pr]),He([bt,hr,fr,xr]),He([ht,xt,dr,Lt,Ft,ir,Yt]),He([lt,yt,br,Gt,Vt,Ct,jt,Nt,ar,rr]);class Er{constructor(e,t){if(n(this,"sessionId"),n(this,"onmessage"),n(this,"onerror"),n(this,"onclose"),n(this,"_port"),n(this,"_started",!1),n(this,"_closed",!1),!e)throw new Error("MessagePort is required");this._port=e,this.sessionId=t||this.generateId(),this._port.onmessage=e=>{var t,r;try{const r=ut.parse(e.data);null==(t=this.onmessage)||t.call(this,r)}catch(e){const t=new Error(`Failed to parse message: ${e}`);null==(r=this.onerror)||r.call(this,t)}},this._port.onmessageerror=e=>{var t;const r=new Error(`MessagePort error: ${JSON.stringify(e)}`);null==(t=this.onerror)||t.call(this,r)}}static generateSessionId(){return"undefined"!=typeof crypto&&"function"==typeof crypto.randomUUID?crypto.randomUUID():`${Date.now().toString(36)}-${Math.random().toString(36).substring(2,10)}`}async start(){if(this._started)throw new Error("BrowserContextTransport already started! If using Client or Server class, note that connect() calls start() automatically.");if(this._closed)throw new Error("Cannot start a closed BrowserContextTransport");this._started=!0,this._port.start()}async send(e){if(this._closed)throw new Error("Cannot send on a closed BrowserContextTransport");return new Promise((t,r)=>{var a;try{this._port.postMessage(e),t()}catch(e){const t=e instanceof Error?e:new Error(String(e));null==(a=this.onerror)||a.call(this,t),r(t)}})}async close(){var e;this._closed||(this._closed=!0,this._port.close(),null==(e=this.onclose)||e.call(this))}generateId(){return Er.generateSessionId()}}class Sr{constructor(){n(this,"angieDetector"),n(this,"registrationQueue"),n(this,"clientManager"),n(this,"isInitialized",!1),this.angieDetector=new o,this.registrationQueue=new d,this.clientManager=new c,this.setupAngieReadyHandler(),this.setupServerInitHandler()}setupAngieReadyHandler(){this.angieDetector.waitForReady().then(e=>{e.isReady?this.handleAngieReady():console.warn("AngieMcpSdk: Angie not detected - servers will remain queued")}).catch(e=>{console.error("AngieMcpSdk: Error waiting for Angie:",e)})}async handleAngieReady(){console.log("AngieMcpSdk: Angie is ready, processing queued registrations");try{await this.registrationQueue.processQueue(async e=>{await this.processRegistration(e)}),this.isInitialized=!0,console.log("AngieMcpSdk: Initialization complete")}catch(e){console.error("AngieMcpSdk: Error processing registration queue:",e)}}async processRegistration(e){console.log(`AngieMcpSdk: Processing registration for server "${e.config.name}"`);try{await this.clientManager.requestClientCreation(e),console.log(`AngieMcpSdk: Successfully registered server "${e.config.name}"`)}catch(t){throw console.error(`AngieMcpSdk: Failed to register server "${e.config.name}":`,t),t}}async registerServer(e){if(!e.server)throw new Error("Server instance is required");if(!e.name)throw new Error("Server name is required");if(!e.description)throw new Error("Server description is required");console.log(`AngieMcpSdk: Registering server "${e.name}"`);const t=this.registrationQueue.add(e);if(this.angieDetector.isReady())try{await this.processRegistration(t),this.registrationQueue.updateStatus(t.id,"registered"),console.log(`AngieMcpSdk: Server "${e.name}" registered successfully`)}catch(e){const r=e instanceof Error?e.message:String(e);throw this.registrationQueue.updateStatus(t.id,"failed",r),e}else console.log(`AngieMcpSdk: Server "${e.name}" queued until Angie is ready`)}getRegistrations(){return this.registrationQueue.getAll()}getPendingRegistrations(){return this.registrationQueue.getPending()}isAngieReady(){return this.angieDetector.isReady()}isReady(){return this.isInitialized}async waitForReady(){if(!(await this.angieDetector.waitForReady()).isReady)throw new Error("Angie is not available");for(;!this.isInitialized;)await new Promise(e=>setTimeout(e,100))}destroy(){this.registrationQueue.clear(),console.log("AngieMcpSdk: SDK destroyed")}setupServerInitHandler(){window.addEventListener("message",e=>{var r;(null==(r=e.data)?void 0:r.type)===t.SDK_REQUEST_INIT_SERVER&&this.handleServerInitRequest(e)})}handleServerInitRequest(e){const{clientId:t,serverId:r}=e.data.payload||{};if(t&&r){console.log(`AngieMcpSdk: Handling server init request for clientId: ${t}, serverId: ${r}`);try{const t=this.registrationQueue.getAll().find(e=>e.id===r);if(!t)return void console.error(`AngieMcpSdk: No registration found for serverId: ${r}`);const a=e.ports[0];if(!a)return void console.error("AngieMcpSdk: No port provided in server init request");const s=t.config.server,i=new Er(a);s.connect(i),console.log(`AngieMcpSdk: Server "${t.config.name}" initialized successfully`)}catch(e){console.error(`AngieMcpSdk: Error initializing server for clientId ${t}:`,e)}}else console.error("AngieMcpSdk: Invalid server init request - missing clientId or serverId")}}var Rr,Tr,Ar;(Tr=Rr||(Rr={})).assertEqual=e=>{},Tr.assertIs=function(e){},Tr.assertNever=function(e){throw new Error},Tr.arrayToEnum=e=>{const t={};for(const r of e)t[r]=r;return t},Tr.getValidEnumValues=e=>{const t=Tr.objectKeys(e).filter(t=>"number"!=typeof e[e[t]]),r={};for(const a of t)r[a]=e[a];return Tr.objectValues(r)},Tr.objectValues=e=>Tr.objectKeys(e).map(function(t){return e[t]}),Tr.objectKeys="function"==typeof Object.keys?e=>Object.keys(e):e=>{const t=[];for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.push(r);return t},Tr.find=(e,t)=>{for(const r of e)if(t(r))return r},Tr.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&Number.isFinite(e)&&Math.floor(e)===e,Tr.joinValues=function(e,t=" | "){return e.map(e=>"string"==typeof e?`'${e}'`:e).join(t)},Tr.jsonStringifyReplacer=(e,t)=>"bigint"==typeof t?t.toString():t,(Ar||(Ar={})).mergeShapes=(e,t)=>({...e,...t});const Or=Rr.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Cr=e=>{switch(typeof e){case"undefined":return Or.undefined;case"string":return Or.string;case"number":return Number.isNaN(e)?Or.nan:Or.number;case"boolean":return Or.boolean;case"function":return Or.function;case"bigint":return Or.bigint;case"symbol":return Or.symbol;case"object":return Array.isArray(e)?Or.array:null===e?Or.null:e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch?Or.promise:"undefined"!=typeof Map&&e instanceof Map?Or.map:"undefined"!=typeof Set&&e instanceof Set?Or.set:"undefined"!=typeof Date&&e instanceof Date?Or.date:Or.object;default:return Or.unknown}},$r=Rr.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 jr extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){const t=e||function(e){return e.message},r={_errors:[]},a=e=>{for(const s of e.issues)if("invalid_union"===s.code)s.unionErrors.map(a);else if("invalid_return_type"===s.code)a(s.returnTypeError);else if("invalid_arguments"===s.code)a(s.argumentsError);else if(0===s.path.length)r._errors.push(t(s));else{let e=r,a=0;for(;a<s.path.length;){const r=s.path[a];a===s.path.length-1?(e[r]=e[r]||{_errors:[]},e[r]._errors.push(t(s))):e[r]=e[r]||{_errors:[]},e=e[r],a++}}};return a(this),r}static assert(e){if(!(e instanceof jr))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Rr.jsonStringifyReplacer,2)}get isEmpty(){return 0===this.issues.length}flatten(e=e=>e.message){const t={},r=[];for(const a of this.issues)if(a.path.length>0){const r=a.path[0];t[r]=t[r]||[],t[r].push(e(a))}else r.push(e(a));return{formErrors:r,fieldErrors:t}}get formErrors(){return this.flatten()}}jr.create=e=>new jr(e);const Ir=(e,t)=>{let r;switch(e.code){case $r.invalid_type:r=e.received===Or.undefined?"Required":`Expected ${e.expected}, received ${e.received}`;break;case $r.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,Rr.jsonStringifyReplacer)}`;break;case $r.unrecognized_keys:r=`Unrecognized key(s) in object: ${Rr.joinValues(e.keys,", ")}`;break;case $r.invalid_union:r="Invalid input";break;case $r.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${Rr.joinValues(e.options)}`;break;case $r.invalid_enum_value:r=`Invalid enum value. Expected ${Rr.joinValues(e.options)}, received '${e.received}'`;break;case $r.invalid_arguments:r="Invalid function arguments";break;case $r.invalid_return_type:r="Invalid function return type";break;case $r.invalid_date:r="Invalid date";break;case $r.invalid_string:"object"==typeof e.validation?"includes"in e.validation?(r=`Invalid input: must include "${e.validation.includes}"`,"number"==typeof e.validation.position&&(r=`${r} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?r=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?r=`Invalid input: must end with "${e.validation.endsWith}"`:Rr.assertNever(e.validation):r="regex"!==e.validation?`Invalid ${e.validation}`:"Invalid";break;case $r.too_small:r="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:"number"===e.type||"bigint"===e.type?`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:"date"===e.type?`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:"Invalid input";break;case $r.too_big:r="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"bigint"===e.type?`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"date"===e.type?`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:"Invalid input";break;case $r.custom:r="Invalid input";break;case $r.invalid_intersection_types:r="Intersection results could not be merged";break;case $r.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case $r.not_finite:r="Number must be finite";break;default:r=t.defaultError,Rr.assertNever(e)}return{message:r}};let Nr=Ir;function Fr(e,t){const r=Nr,a=(e=>{const{data:t,path:r,errorMaps:a,issueData:s}=e,i=[...r,...s.path||[]],n={...s,path:i};if(void 0!==s.message)return{...s,path:i,message:s.message};let o="";const d=a.filter(e=>!!e).slice().reverse();for(const e of d)o=e(n,{data:t,defaultError:o}).message;return{...s,path:i,message:o}})({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===Ir?void 0:Ir].filter(e=>!!e)});e.common.issues.push(a)}class Zr{constructor(){this.value="valid"}dirty(){"valid"===this.value&&(this.value="dirty")}abort(){"aborted"!==this.value&&(this.value="aborted")}static mergeArray(e,t){const r=[];for(const a of t){if("aborted"===a.status)return Dr;"dirty"===a.status&&e.dirty(),r.push(a.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,t){const r=[];for(const e of t){const t=await e.key,a=await e.value;r.push({key:t,value:a})}return Zr.mergeObjectSync(e,r)}static mergeObjectSync(e,t){const r={};for(const a of t){const{key:t,value:s}=a;if("aborted"===t.status)return Dr;if("aborted"===s.status)return Dr;"dirty"===t.status&&e.dirty(),"dirty"===s.status&&e.dirty(),"__proto__"===t.value||void 0===s.value&&!a.alwaysSet||(r[t.value]=s.value)}return{status:e.value,value:r}}}const Dr=Object.freeze({status:"aborted"}),Lr=e=>({status:"dirty",value:e}),Mr=e=>({status:"valid",value:e}),qr=e=>"aborted"===e.status,zr=e=>"dirty"===e.status,Vr=e=>"valid"===e.status,Hr=e=>"undefined"!=typeof Promise&&e instanceof Promise;var Ur,Qr;(Qr=Ur||(Ur={})).errToObj=e=>"string"==typeof e?{message:e}:e||{},Qr.toString=e=>"string"==typeof e?e:null==e?void 0:e.message;class Kr{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 Br=(e,t)=>{if(Vr(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new jr(e.common.issues);return this._error=t,this._error}}};function Wr(e){if(!e)return{};const{errorMap:t,invalid_type_error:r,required_error:a,description:s}=e;if(t&&(r||a))throw new Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');if(t)return{errorMap:t,description:s};return{errorMap:(t,s)=>{const{message:i}=e;return"invalid_enum_value"===t.code?{message:i??s.defaultError}:void 0===s.data?{message:i??a??s.defaultError}:"invalid_type"!==t.code?{message:s.defaultError}:{message:i??r??s.defaultError}},description:s}}class Jr{get description(){return this._def.description}_getType(e){return Cr(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:Cr(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Zr,ctx:{common:e.parent.common,data:e.data,parsedType:Cr(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(Hr(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:(null==t?void 0:t.async)??!1,contextualErrorMap:null==t?void 0:t.errorMap},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Cr(e)},a=this._parseSync({data:e,path:r.path,parent:r});return Br(r,a)}"~validate"(e){var t,r;const a={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Cr(e)};if(!this["~standard"].async)try{const t=this._parseSync({data:e,path:[],parent:a});return Vr(t)?{value:t.value}:{issues:a.common.issues}}catch(e){(null==(r=null==(t=null==e?void 0:e.message)?void 0:t.toLowerCase())?void 0:r.includes("encountered"))&&(this["~standard"].async=!0),a.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:a}).then(e=>Vr(e)?{value:e.value}:{issues:a.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:null==t?void 0:t.errorMap,async:!0},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Cr(e)},a=this._parse({data:e,path:r.path,parent:r}),s=await(Hr(a)?a:Promise.resolve(a));return Br(r,s)}refine(e,t){const r=e=>"string"==typeof t||void 0===t?{message:t}:"function"==typeof t?t(e):t;return this._refinement((t,a)=>{const s=e(t),i=()=>a.addIssue({code:$r.custom,...r(t)});return"undefined"!=typeof Promise&&s instanceof Promise?s.then(e=>!!e||(i(),!1)):!!s||(i(),!1)})}refinement(e,t){return this._refinement((r,a)=>!!e(r)||(a.addIssue("function"==typeof t?t(r,a):t),!1))}_refinement(e){return new Ga({schema:this,typeName:ns.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:e=>this["~validate"](e)}}optional(){return Ya.create(this,this._def)}nullable(){return Xa.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return ja.create(this)}promise(){return Ja.create(this,this._def)}or(e){return Fa.create([this,e],this._def)}and(e){return Ma.create(this,e,this._def)}transform(e){return new Ga({...Wr(this._def),schema:this,typeName:ns.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t="function"==typeof e?e:()=>e;return new es({...Wr(this._def),innerType:this,defaultValue:t,typeName:ns.ZodDefault})}brand(){return new as({typeName:ns.ZodBranded,type:this,...Wr(this._def)})}catch(e){const t="function"==typeof e?e:()=>e;return new ts({...Wr(this._def),innerType:this,catchValue:t,typeName:ns.ZodCatch})}describe(e){return new(0,this.constructor)({...this._def,description:e})}pipe(e){return ss.create(this,e)}readonly(){return is.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const Gr=/^c[^\s-]{8,}$/i,Yr=/^[0-9a-z]+$/,Xr=/^[0-9A-HJKMNP-TV-Z]{26}$/i,ea=/^[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,ta=/^[a-z0-9_-]{21}$/i,ra=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,aa=/^[-+]?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)?)??$/,sa=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;let ia;const na=/^(?:(?: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])$/,oa=/^(?:(?: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])$/,da=/^(([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]))$/,ca=/^(([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])$/,ua=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,la=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,ha="((\\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])))",pa=new RegExp(`^${ha}$`);function ma(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:null==e.precision&&(t=`${t}(\\.\\d+)?`);return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${e.precision?"+":"?"}`}function fa(e){return new RegExp(`^${ma(e)}$`)}function va(e){let t=`${ha}T${ma(e)}`;const r=[];return r.push(e.local?"Z?":"Z"),e.offset&&r.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${r.join("|")})`,new RegExp(`^${t}$`)}function ga(e,t){return!("v4"!==t&&t||!na.test(e))||!("v6"!==t&&t||!da.test(e))}function ya(e,t){if(!ra.test(e))return!1;try{const[r]=e.split(".");if(!r)return!1;const a=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),s=JSON.parse(atob(a));return"object"==typeof s&&null!==s&&((!("typ"in s)||"JWT"===(null==s?void 0:s.typ))&&(!!s.alg&&(!t||s.alg===t)))}catch{return!1}}function _a(e,t){return!("v4"!==t&&t||!oa.test(e))||!("v6"!==t&&t||!ca.test(e))}class ba extends Jr{_parse(e){this._def.coerce&&(e.data=String(e.data));if(this._getType(e)!==Or.string){const t=this._getOrReturnCtx(e);return Fr(t,{code:$r.invalid_type,expected:Or.string,received:t.parsedType}),Dr}const t=new Zr;let r;for(const a of this._def.checks)if("min"===a.kind)e.data.length<a.value&&(r=this._getOrReturnCtx(e,r),Fr(r,{code:$r.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),t.dirty());else if("max"===a.kind)e.data.length>a.value&&(r=this._getOrReturnCtx(e,r),Fr(r,{code:$r.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),t.dirty());else if("length"===a.kind){const s=e.data.length>a.value,i=e.data.length<a.value;(s||i)&&(r=this._getOrReturnCtx(e,r),s?Fr(r,{code:$r.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):i&&Fr(r,{code:$r.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),t.dirty())}else if("email"===a.kind)sa.test(e.data)||(r=this._getOrReturnCtx(e,r),Fr(r,{validation:"email",code:$r.invalid_string,message:a.message}),t.dirty());else if("emoji"===a.kind)ia||(ia=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),ia.test(e.data)||(r=this._getOrReturnCtx(e,r),Fr(r,{validation:"emoji",code:$r.invalid_string,message:a.message}),t.dirty());else if("uuid"===a.kind)ea.test(e.data)||(r=this._getOrReturnCtx(e,r),Fr(r,{validation:"uuid",code:$r.invalid_string,message:a.message}),t.dirty());else if("nanoid"===a.kind)ta.test(e.data)||(r=this._getOrReturnCtx(e,r),Fr(r,{validation:"nanoid",code:$r.invalid_string,message:a.message}),t.dirty());else if("cuid"===a.kind)Gr.test(e.data)||(r=this._getOrReturnCtx(e,r),Fr(r,{validation:"cuid",code:$r.invalid_string,message:a.message}),t.dirty());else if("cuid2"===a.kind)Yr.test(e.data)||(r=this._getOrReturnCtx(e,r),Fr(r,{validation:"cuid2",code:$r.invalid_string,message:a.message}),t.dirty());else if("ulid"===a.kind)Xr.test(e.data)||(r=this._getOrReturnCtx(e,r),Fr(r,{validation:"ulid",code:$r.invalid_string,message:a.message}),t.dirty());else if("url"===a.kind)try{new URL(e.data)}catch{r=this._getOrReturnCtx(e,r),Fr(r,{validation:"url",code:$r.invalid_string,message:a.message}),t.dirty()}else if("regex"===a.kind){a.regex.lastIndex=0;a.regex.test(e.data)||(r=this._getOrReturnCtx(e,r),Fr(r,{validation:"regex",code:$r.invalid_string,message:a.message}),t.dirty())}else if("trim"===a.kind)e.data=e.data.trim();else if("includes"===a.kind)e.data.includes(a.value,a.position)||(r=this._getOrReturnCtx(e,r),Fr(r,{code:$r.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),t.dirty());else if("toLowerCase"===a.kind)e.data=e.data.toLowerCase();else if("toUpperCase"===a.kind)e.data=e.data.toUpperCase();else if("startsWith"===a.kind)e.data.startsWith(a.value)||(r=this._getOrReturnCtx(e,r),Fr(r,{code:$r.invalid_string,validation:{startsWith:a.value},message:a.message}),t.dirty());else if("endsWith"===a.kind)e.data.endsWith(a.value)||(r=this._getOrReturnCtx(e,r),Fr(r,{code:$r.invalid_string,validation:{endsWith:a.value},message:a.message}),t.dirty());else if("datetime"===a.kind){va(a).test(e.data)||(r=this._getOrReturnCtx(e,r),Fr(r,{code:$r.invalid_string,validation:"datetime",message:a.message}),t.dirty())}else if("date"===a.kind){pa.test(e.data)||(r=this._getOrReturnCtx(e,r),Fr(r,{code:$r.invalid_string,validation:"date",message:a.message}),t.dirty())}else if("time"===a.kind){fa(a).test(e.data)||(r=this._getOrReturnCtx(e,r),Fr(r,{code:$r.invalid_string,validation:"time",message:a.message}),t.dirty())}else"duration"===a.kind?aa.test(e.data)||(r=this._getOrReturnCtx(e,r),Fr(r,{validation:"duration",code:$r.invalid_string,message:a.message}),t.dirty()):"ip"===a.kind?ga(e.data,a.version)||(r=this._getOrReturnCtx(e,r),Fr(r,{validation:"ip",code:$r.invalid_string,message:a.message}),t.dirty()):"jwt"===a.kind?ya(e.data,a.alg)||(r=this._getOrReturnCtx(e,r),Fr(r,{validation:"jwt",code:$r.invalid_string,message:a.message}),t.dirty()):"cidr"===a.kind?_a(e.data,a.version)||(r=this._getOrReturnCtx(e,r),Fr(r,{validation:"cidr",code:$r.invalid_string,message:a.message}),t.dirty()):"base64"===a.kind?ua.test(e.data)||(r=this._getOrReturnCtx(e,r),Fr(r,{validation:"base64",code:$r.invalid_string,message:a.message}),t.dirty()):"base64url"===a.kind?la.test(e.data)||(r=this._getOrReturnCtx(e,r),Fr(r,{validation:"base64url",code:$r.invalid_string,message:a.message}),t.dirty()):Rr.assertNever(a);return{status:t.value,value:e.data}}_regex(e,t,r){return this.refinement(t=>e.test(t),{validation:t,code:$r.invalid_string,...Ur.errToObj(r)})}_addCheck(e){return new ba({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...Ur.errToObj(e)})}url(e){return this._addCheck({kind:"url",...Ur.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...Ur.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...Ur.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...Ur.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...Ur.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...Ur.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...Ur.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...Ur.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...Ur.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...Ur.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...Ur.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...Ur.errToObj(e)})}datetime(e){return"string"==typeof e?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:void 0===(null==e?void 0:e.precision)?null:null==e?void 0:e.precision,offset:(null==e?void 0:e.offset)??!1,local:(null==e?void 0:e.local)??!1,...Ur.errToObj(null==e?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return"string"==typeof e?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:void 0===(null==e?void 0:e.precision)?null:null==e?void 0:e.precision,...Ur.errToObj(null==e?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...Ur.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...Ur.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:null==t?void 0:t.position,...Ur.errToObj(null==t?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...Ur.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...Ur.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...Ur.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...Ur.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...Ur.errToObj(t)})}nonempty(e){return this.min(1,Ur.errToObj(e))}trim(){return new ba({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new ba({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new ba({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>"datetime"===e.kind)}get isDate(){return!!this._def.checks.find(e=>"date"===e.kind)}get isTime(){return!!this._def.checks.find(e=>"time"===e.kind)}get isDuration(){return!!this._def.checks.find(e=>"duration"===e.kind)}get isEmail(){return!!this._def.checks.find(e=>"email"===e.kind)}get isURL(){return!!this._def.checks.find(e=>"url"===e.kind)}get isEmoji(){return!!this._def.checks.find(e=>"emoji"===e.kind)}get isUUID(){return!!this._def.checks.find(e=>"uuid"===e.kind)}get isNANOID(){return!!this._def.checks.find(e=>"nanoid"===e.kind)}get isCUID(){return!!this._def.checks.find(e=>"cuid"===e.kind)}get isCUID2(){return!!this._def.checks.find(e=>"cuid2"===e.kind)}get isULID(){return!!this._def.checks.find(e=>"ulid"===e.kind)}get isIP(){return!!this._def.checks.find(e=>"ip"===e.kind)}get isCIDR(){return!!this._def.checks.find(e=>"cidr"===e.kind)}get isBase64(){return!!this._def.checks.find(e=>"base64"===e.kind)}get isBase64url(){return!!this._def.checks.find(e=>"base64url"===e.kind)}get minLength(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}function wa(e,t){const r=(e.toString().split(".")[1]||"").length,a=(t.toString().split(".")[1]||"").length,s=r>a?r:a;return Number.parseInt(e.toFixed(s).replace(".",""))%Number.parseInt(t.toFixed(s).replace(".",""))/10**s}ba.create=e=>new ba({checks:[],typeName:ns.ZodString,coerce:(null==e?void 0:e.coerce)??!1,...Wr(e)});class xa extends Jr{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){this._def.coerce&&(e.data=Number(e.data));if(this._getType(e)!==Or.number){const t=this._getOrReturnCtx(e);return Fr(t,{code:$r.invalid_type,expected:Or.number,received:t.parsedType}),Dr}let t;const r=new Zr;for(const a of this._def.checks)if("int"===a.kind)Rr.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),Fr(t,{code:$r.invalid_type,expected:"integer",received:"float",message:a.message}),r.dirty());else if("min"===a.kind){(a.inclusive?e.data<a.value:e.data<=a.value)&&(t=this._getOrReturnCtx(e,t),Fr(t,{code:$r.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),r.dirty())}else if("max"===a.kind){(a.inclusive?e.data>a.value:e.data>=a.value)&&(t=this._getOrReturnCtx(e,t),Fr(t,{code:$r.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),r.dirty())}else"multipleOf"===a.kind?0!==wa(e.data,a.value)&&(t=this._getOrReturnCtx(e,t),Fr(t,{code:$r.not_multiple_of,multipleOf:a.value,message:a.message}),r.dirty()):"finite"===a.kind?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),Fr(t,{code:$r.not_finite,message:a.message}),r.dirty()):Rr.assertNever(a);return{status:r.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,Ur.toString(t))}gt(e,t){return this.setLimit("min",e,!1,Ur.toString(t))}lte(e,t){return this.setLimit("max",e,!0,Ur.toString(t))}lt(e,t){return this.setLimit("max",e,!1,Ur.toString(t))}setLimit(e,t,r,a){return new xa({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:Ur.toString(a)}]})}_addCheck(e){return new xa({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:Ur.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Ur.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Ur.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Ur.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Ur.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:Ur.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:Ur.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Ur.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Ur.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>"int"===e.kind||"multipleOf"===e.kind&&Rr.isInteger(e.value))}get isFinite(){let e=null,t=null;for(const r of this._def.checks){if("finite"===r.kind||"int"===r.kind||"multipleOf"===r.kind)return!0;"min"===r.kind?(null===t||r.value>t)&&(t=r.value):"max"===r.kind&&(null===e||r.value<e)&&(e=r.value)}return Number.isFinite(t)&&Number.isFinite(e)}}xa.create=e=>new xa({checks:[],typeName:ns.ZodNumber,coerce:(null==e?void 0:e.coerce)||!1,...Wr(e)});class Pa extends Jr{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)!==Or.bigint)return this._getInvalidInput(e);let t;const r=new Zr;for(const a of this._def.checks)if("min"===a.kind){(a.inclusive?e.data<a.value:e.data<=a.value)&&(t=this._getOrReturnCtx(e,t),Fr(t,{code:$r.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),r.dirty())}else if("max"===a.kind){(a.inclusive?e.data>a.value:e.data>=a.value)&&(t=this._getOrReturnCtx(e,t),Fr(t,{code:$r.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),r.dirty())}else"multipleOf"===a.kind?e.data%a.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),Fr(t,{code:$r.not_multiple_of,multipleOf:a.value,message:a.message}),r.dirty()):Rr.assertNever(a);return{status:r.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return Fr(t,{code:$r.invalid_type,expected:Or.bigint,received:t.parsedType}),Dr}gte(e,t){return this.setLimit("min",e,!0,Ur.toString(t))}gt(e,t){return this.setLimit("min",e,!1,Ur.toString(t))}lte(e,t){return this.setLimit("max",e,!0,Ur.toString(t))}lt(e,t){return this.setLimit("max",e,!1,Ur.toString(t))}setLimit(e,t,r,a){return new Pa({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:Ur.toString(a)}]})}_addCheck(e){return new Pa({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Ur.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Ur.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Ur.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Ur.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:Ur.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}Pa.create=e=>new Pa({checks:[],typeName:ns.ZodBigInt,coerce:(null==e?void 0:e.coerce)??!1,...Wr(e)});class ka extends Jr{_parse(e){this._def.coerce&&(e.data=Boolean(e.data));if(this._getType(e)!==Or.boolean){const t=this._getOrReturnCtx(e);return Fr(t,{code:$r.invalid_type,expected:Or.boolean,received:t.parsedType}),Dr}return Mr(e.data)}}ka.create=e=>new ka({typeName:ns.ZodBoolean,coerce:(null==e?void 0:e.coerce)||!1,...Wr(e)});class Ea extends Jr{_parse(e){this._def.coerce&&(e.data=new Date(e.data));if(this._getType(e)!==Or.date){const t=this._getOrReturnCtx(e);return Fr(t,{code:$r.invalid_type,expected:Or.date,received:t.parsedType}),Dr}if(Number.isNaN(e.data.getTime())){return Fr(this._getOrReturnCtx(e),{code:$r.invalid_date}),Dr}const t=new Zr;let r;for(const a of this._def.checks)"min"===a.kind?e.data.getTime()<a.value&&(r=this._getOrReturnCtx(e,r),Fr(r,{code:$r.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),t.dirty()):"max"===a.kind?e.data.getTime()>a.value&&(r=this._getOrReturnCtx(e,r),Fr(r,{code:$r.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),t.dirty()):Rr.assertNever(a);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Ea({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:Ur.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:Ur.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return null!=e?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return null!=e?new Date(e):null}}Ea.create=e=>new Ea({checks:[],coerce:(null==e?void 0:e.coerce)||!1,typeName:ns.ZodDate,...Wr(e)});class Sa extends Jr{_parse(e){if(this._getType(e)!==Or.symbol){const t=this._getOrReturnCtx(e);return Fr(t,{code:$r.invalid_type,expected:Or.symbol,received:t.parsedType}),Dr}return Mr(e.data)}}Sa.create=e=>new Sa({typeName:ns.ZodSymbol,...Wr(e)});class Ra extends Jr{_parse(e){if(this._getType(e)!==Or.undefined){const t=this._getOrReturnCtx(e);return Fr(t,{code:$r.invalid_type,expected:Or.undefined,received:t.parsedType}),Dr}return Mr(e.data)}}Ra.create=e=>new Ra({typeName:ns.ZodUndefined,...Wr(e)});class Ta extends Jr{_parse(e){if(this._getType(e)!==Or.null){const t=this._getOrReturnCtx(e);return Fr(t,{code:$r.invalid_type,expected:Or.null,received:t.parsedType}),Dr}return Mr(e.data)}}Ta.create=e=>new Ta({typeName:ns.ZodNull,...Wr(e)});class Aa extends Jr{constructor(){super(...arguments),this._any=!0}_parse(e){return Mr(e.data)}}Aa.create=e=>new Aa({typeName:ns.ZodAny,...Wr(e)});class Oa extends Jr{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Mr(e.data)}}Oa.create=e=>new Oa({typeName:ns.ZodUnknown,...Wr(e)});class Ca extends Jr{_parse(e){const t=this._getOrReturnCtx(e);return Fr(t,{code:$r.invalid_type,expected:Or.never,received:t.parsedType}),Dr}}Ca.create=e=>new Ca({typeName:ns.ZodNever,...Wr(e)});class $a extends Jr{_parse(e){if(this._getType(e)!==Or.undefined){const t=this._getOrReturnCtx(e);return Fr(t,{code:$r.invalid_type,expected:Or.void,received:t.parsedType}),Dr}return Mr(e.data)}}$a.create=e=>new $a({typeName:ns.ZodVoid,...Wr(e)});class ja extends Jr{_parse(e){const{ctx:t,status:r}=this._processInputParams(e),a=this._def;if(t.parsedType!==Or.array)return Fr(t,{code:$r.invalid_type,expected:Or.array,received:t.parsedType}),Dr;if(null!==a.exactLength){const e=t.data.length>a.exactLength.value,s=t.data.length<a.exactLength.value;(e||s)&&(Fr(t,{code:e?$r.too_big:$r.too_small,minimum:s?a.exactLength.value:void 0,maximum:e?a.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:a.exactLength.message}),r.dirty())}if(null!==a.minLength&&t.data.length<a.minLength.value&&(Fr(t,{code:$r.too_small,minimum:a.minLength.value,type:"array",inclusive:!0,exact:!1,message:a.minLength.message}),r.dirty()),null!==a.maxLength&&t.data.length>a.maxLength.value&&(Fr(t,{code:$r.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((e,r)=>a.type._parseAsync(new Kr(t,e,t.path,r)))).then(e=>Zr.mergeArray(r,e));const s=[...t.data].map((e,r)=>a.type._parseSync(new Kr(t,e,t.path,r)));return Zr.mergeArray(r,s)}get element(){return this._def.type}min(e,t){return new ja({...this._def,minLength:{value:e,message:Ur.toString(t)}})}max(e,t){return new ja({...this._def,maxLength:{value:e,message:Ur.toString(t)}})}length(e,t){return new ja({...this._def,exactLength:{value:e,message:Ur.toString(t)}})}nonempty(e){return this.min(1,e)}}function Ia(e){if(e instanceof Na){const t={};for(const r in e.shape){const a=e.shape[r];t[r]=Ya.create(Ia(a))}return new Na({...e._def,shape:()=>t})}return e instanceof ja?new ja({...e._def,type:Ia(e.element)}):e instanceof Ya?Ya.create(Ia(e.unwrap())):e instanceof Xa?Xa.create(Ia(e.unwrap())):e instanceof qa?qa.create(e.items.map(e=>Ia(e))):e}ja.create=(e,t)=>new ja({type:e,minLength:null,maxLength:null,exactLength:null,typeName:ns.ZodArray,...Wr(t)});class Na extends Jr{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(null!==this._cached)return this._cached;const e=this._def.shape(),t=Rr.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==Or.object){const t=this._getOrReturnCtx(e);return Fr(t,{code:$r.invalid_type,expected:Or.object,received:t.parsedType}),Dr}const{status:t,ctx:r}=this._processInputParams(e),{shape:a,keys:s}=this._getCached(),i=[];if(!(this._def.catchall instanceof Ca&&"strip"===this._def.unknownKeys))for(const e in r.data)s.includes(e)||i.push(e);const n=[];for(const e of s){const t=a[e],s=r.data[e];n.push({key:{status:"valid",value:e},value:t._parse(new Kr(r,s,r.path,e)),alwaysSet:e in r.data})}if(this._def.catchall instanceof Ca){const e=this._def.unknownKeys;if("passthrough"===e)for(const e of i)n.push({key:{status:"valid",value:e},value:{status:"valid",value:r.data[e]}});else if("strict"===e)i.length>0&&(Fr(r,{code:$r.unrecognized_keys,keys:i}),t.dirty());else if("strip"!==e)throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const e=this._def.catchall;for(const t of i){const a=r.data[t];n.push({key:{status:"valid",value:t},value:e._parse(new Kr(r,a,r.path,t)),alwaysSet:t in r.data})}}return r.common.async?Promise.resolve().then(async()=>{const e=[];for(const t of n){const r=await t.key,a=await t.value;e.push({key:r,value:a,alwaysSet:t.alwaysSet})}return e}).then(e=>Zr.mergeObjectSync(t,e)):Zr.mergeObjectSync(t,n)}get shape(){return this._def.shape()}strict(e){return Ur.errToObj,new Na({...this._def,unknownKeys:"strict",...void 0!==e?{errorMap:(t,r)=>{var a,s;const i=(null==(s=(a=this._def).errorMap)?void 0:s.call(a,t,r).message)??r.defaultError;return"unrecognized_keys"===t.code?{message:Ur.errToObj(e).message??i}:{message:i}}}:{}})}strip(){return new Na({...this._def,unknownKeys:"strip"})}passthrough(){return new Na({...this._def,unknownKeys:"passthrough"})}extend(e){return new Na({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new Na({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:ns.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new Na({...this._def,catchall:e})}pick(e){const t={};for(const r of Rr.objectKeys(e))e[r]&&this.shape[r]&&(t[r]=this.shape[r]);return new Na({...this._def,shape:()=>t})}omit(e){const t={};for(const r of Rr.objectKeys(this.shape))e[r]||(t[r]=this.shape[r]);return new Na({...this._def,shape:()=>t})}deepPartial(){return Ia(this)}partial(e){const t={};for(const r of Rr.objectKeys(this.shape)){const a=this.shape[r];e&&!e[r]?t[r]=a:t[r]=a.optional()}return new Na({...this._def,shape:()=>t})}required(e){const t={};for(const r of Rr.objectKeys(this.shape))if(e&&!e[r])t[r]=this.shape[r];else{let e=this.shape[r];for(;e instanceof Ya;)e=e._def.innerType;t[r]=e}return new Na({...this._def,shape:()=>t})}keyof(){return Ka(Rr.objectKeys(this.shape))}}Na.create=(e,t)=>new Na({shape:()=>e,unknownKeys:"strip",catchall:Ca.create(),typeName:ns.ZodObject,...Wr(t)}),Na.strictCreate=(e,t)=>new Na({shape:()=>e,unknownKeys:"strict",catchall:Ca.create(),typeName:ns.ZodObject,...Wr(t)}),Na.lazycreate=(e,t)=>new Na({shape:e,unknownKeys:"strip",catchall:Ca.create(),typeName:ns.ZodObject,...Wr(t)});class Fa extends Jr{_parse(e){const{ctx:t}=this._processInputParams(e),r=this._def.options;if(t.common.async)return Promise.all(r.map(async e=>{const r={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:r}),ctx:r}})).then(function(e){for(const t of e)if("valid"===t.result.status)return t.result;for(const r of e)if("dirty"===r.result.status)return t.common.issues.push(...r.ctx.common.issues),r.result;const r=e.map(e=>new jr(e.ctx.common.issues));return Fr(t,{code:$r.invalid_union,unionErrors:r}),Dr});{let e;const a=[];for(const s of r){const r={...t,common:{...t.common,issues:[]},parent:null},i=s._parseSync({data:t.data,path:t.path,parent:r});if("valid"===i.status)return i;"dirty"!==i.status||e||(e={result:i,ctx:r}),r.common.issues.length&&a.push(r.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;const s=a.map(e=>new jr(e));return Fr(t,{code:$r.invalid_union,unionErrors:s}),Dr}}get options(){return this._def.options}}Fa.create=(e,t)=>new Fa({options:e,typeName:ns.ZodUnion,...Wr(t)});const Za=e=>e instanceof Ua?Za(e.schema):e instanceof Ga?Za(e.innerType()):e instanceof Qa?[e.value]:e instanceof Ba?e.options:e instanceof Wa?Rr.objectValues(e.enum):e instanceof es?Za(e._def.innerType):e instanceof Ra?[void 0]:e instanceof Ta?[null]:e instanceof Ya?[void 0,...Za(e.unwrap())]:e instanceof Xa?[null,...Za(e.unwrap())]:e instanceof as||e instanceof is?Za(e.unwrap()):e instanceof ts?Za(e._def.innerType):[];class Da extends Jr{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==Or.object)return Fr(t,{code:$r.invalid_type,expected:Or.object,received:t.parsedType}),Dr;const r=this.discriminator,a=t.data[r],s=this.optionsMap.get(a);return s?t.common.async?s._parseAsync({data:t.data,path:t.path,parent:t}):s._parseSync({data:t.data,path:t.path,parent:t}):(Fr(t,{code:$r.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),Dr)}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 r of t){const t=Za(r.shape[e]);if(!t.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const s of t){if(a.has(s))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(s)}`);a.set(s,r)}}return new Da({typeName:ns.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:a,...Wr(r)})}}function La(e,t){const r=Cr(e),a=Cr(t);if(e===t)return{valid:!0,data:e};if(r===Or.object&&a===Or.object){const r=Rr.objectKeys(t),a=Rr.objectKeys(e).filter(e=>-1!==r.indexOf(e)),s={...e,...t};for(const r of a){const a=La(e[r],t[r]);if(!a.valid)return{valid:!1};s[r]=a.data}return{valid:!0,data:s}}if(r===Or.array&&a===Or.array){if(e.length!==t.length)return{valid:!1};const r=[];for(let a=0;a<e.length;a++){const s=La(e[a],t[a]);if(!s.valid)return{valid:!1};r.push(s.data)}return{valid:!0,data:r}}return r===Or.date&&a===Or.date&&+e===+t?{valid:!0,data:e}:{valid:!1}}class Ma extends Jr{_parse(e){const{status:t,ctx:r}=this._processInputParams(e),a=(e,a)=>{if(qr(e)||qr(a))return Dr;const s=La(e.value,a.value);return s.valid?((zr(e)||zr(a))&&t.dirty(),{status:t.value,value:s.data}):(Fr(r,{code:$r.invalid_intersection_types}),Dr)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([e,t])=>a(e,t)):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}))}}Ma.create=(e,t,r)=>new Ma({left:e,right:t,typeName:ns.ZodIntersection,...Wr(r)});class qa extends Jr{_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==Or.array)return Fr(r,{code:$r.invalid_type,expected:Or.array,received:r.parsedType}),Dr;if(r.data.length<this._def.items.length)return Fr(r,{code:$r.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Dr;!this._def.rest&&r.data.length>this._def.items.length&&(Fr(r,{code:$r.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const a=[...r.data].map((e,t)=>{const a=this._def.items[t]||this._def.rest;return a?a._parse(new Kr(r,e,r.path,t)):null}).filter(e=>!!e);return r.common.async?Promise.all(a).then(e=>Zr.mergeArray(t,e)):Zr.mergeArray(t,a)}get items(){return this._def.items}rest(e){return new qa({...this._def,rest:e})}}qa.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new qa({items:e,typeName:ns.ZodTuple,rest:null,...Wr(t)})};class za extends Jr{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!==Or.object)return Fr(r,{code:$r.invalid_type,expected:Or.object,received:r.parsedType}),Dr;const a=[],s=this._def.keyType,i=this._def.valueType;for(const e in r.data)a.push({key:s._parse(new Kr(r,e,r.path,e)),value:i._parse(new Kr(r,r.data[e],r.path,e)),alwaysSet:e in r.data});return r.common.async?Zr.mergeObjectAsync(t,a):Zr.mergeObjectSync(t,a)}get element(){return this._def.valueType}static create(e,t,r){return new za(t instanceof Jr?{keyType:e,valueType:t,typeName:ns.ZodRecord,...Wr(r)}:{keyType:ba.create(),valueType:e,typeName:ns.ZodRecord,...Wr(t)})}}class Va extends Jr{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!==Or.map)return Fr(r,{code:$r.invalid_type,expected:Or.map,received:r.parsedType}),Dr;const a=this._def.keyType,s=this._def.valueType,i=[...r.data.entries()].map(([e,t],i)=>({key:a._parse(new Kr(r,e,r.path,[i,"key"])),value:s._parse(new Kr(r,t,r.path,[i,"value"]))}));if(r.common.async){const e=new Map;return Promise.resolve().then(async()=>{for(const r of i){const a=await r.key,s=await r.value;if("aborted"===a.status||"aborted"===s.status)return Dr;"dirty"!==a.status&&"dirty"!==s.status||t.dirty(),e.set(a.value,s.value)}return{status:t.value,value:e}})}{const e=new Map;for(const r of i){const a=r.key,s=r.value;if("aborted"===a.status||"aborted"===s.status)return Dr;"dirty"!==a.status&&"dirty"!==s.status||t.dirty(),e.set(a.value,s.value)}return{status:t.value,value:e}}}}Va.create=(e,t,r)=>new Va({valueType:t,keyType:e,typeName:ns.ZodMap,...Wr(r)});class Ha extends Jr{_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==Or.set)return Fr(r,{code:$r.invalid_type,expected:Or.set,received:r.parsedType}),Dr;const a=this._def;null!==a.minSize&&r.data.size<a.minSize.value&&(Fr(r,{code:$r.too_small,minimum:a.minSize.value,type:"set",inclusive:!0,exact:!1,message:a.minSize.message}),t.dirty()),null!==a.maxSize&&r.data.size>a.maxSize.value&&(Fr(r,{code:$r.too_big,maximum:a.maxSize.value,type:"set",inclusive:!0,exact:!1,message:a.maxSize.message}),t.dirty());const s=this._def.valueType;function i(e){const r=new Set;for(const a of e){if("aborted"===a.status)return Dr;"dirty"===a.status&&t.dirty(),r.add(a.value)}return{status:t.value,value:r}}const n=[...r.data.values()].map((e,t)=>s._parse(new Kr(r,e,r.path,t)));return r.common.async?Promise.all(n).then(e=>i(e)):i(n)}min(e,t){return new Ha({...this._def,minSize:{value:e,message:Ur.toString(t)}})}max(e,t){return new Ha({...this._def,maxSize:{value:e,message:Ur.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}Ha.create=(e,t)=>new Ha({valueType:e,minSize:null,maxSize:null,typeName:ns.ZodSet,...Wr(t)});class Ua extends Jr{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})}}Ua.create=(e,t)=>new Ua({getter:e,typeName:ns.ZodLazy,...Wr(t)});class Qa extends Jr{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return Fr(t,{received:t.data,code:$r.invalid_literal,expected:this._def.value}),Dr}return{status:"valid",value:e.data}}get value(){return this._def.value}}function Ka(e,t){return new Ba({values:e,typeName:ns.ZodEnum,...Wr(t)})}Qa.create=(e,t)=>new Qa({value:e,typeName:ns.ZodLiteral,...Wr(t)});class Ba extends Jr{_parse(e){if("string"!=typeof e.data){const t=this._getOrReturnCtx(e),r=this._def.values;return Fr(t,{expected:Rr.joinValues(r),received:t.parsedType,code:$r.invalid_type}),Dr}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 Fr(t,{received:t.data,code:$r.invalid_enum_value,options:r}),Dr}return Mr(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 Ba.create(e,{...this._def,...t})}exclude(e,t=this._def){return Ba.create(this.options.filter(t=>!e.includes(t)),{...this._def,...t})}}Ba.create=Ka;class Wa extends Jr{_parse(e){const t=Rr.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==Or.string&&r.parsedType!==Or.number){const e=Rr.objectValues(t);return Fr(r,{expected:Rr.joinValues(e),received:r.parsedType,code:$r.invalid_type}),Dr}if(this._cache||(this._cache=new Set(Rr.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const e=Rr.objectValues(t);return Fr(r,{received:r.data,code:$r.invalid_enum_value,options:e}),Dr}return Mr(e.data)}get enum(){return this._def.values}}Wa.create=(e,t)=>new Wa({values:e,typeName:ns.ZodNativeEnum,...Wr(t)});class Ja extends Jr{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==Or.promise&&!1===t.common.async)return Fr(t,{code:$r.invalid_type,expected:Or.promise,received:t.parsedType}),Dr;const r=t.parsedType===Or.promise?t.data:Promise.resolve(t.data);return Mr(r.then(e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap})))}}Ja.create=(e,t)=>new Ja({type:e,typeName:ns.ZodPromise,...Wr(t)});class Ga extends Jr{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===ns.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:r}=this._processInputParams(e),a=this._def.effect||null,s={addIssue:e=>{Fr(r,e),e.fatal?t.abort():t.dirty()},get path(){return r.path}};if(s.addIssue=s.addIssue.bind(s),"preprocess"===a.type){const e=a.transform(r.data,s);if(r.common.async)return Promise.resolve(e).then(async e=>{if("aborted"===t.value)return Dr;const a=await this._def.schema._parseAsync({data:e,path:r.path,parent:r});return"aborted"===a.status?Dr:"dirty"===a.status||"dirty"===t.value?Lr(a.value):a});{if("aborted"===t.value)return Dr;const a=this._def.schema._parseSync({data:e,path:r.path,parent:r});return"aborted"===a.status?Dr:"dirty"===a.status||"dirty"===t.value?Lr(a.value):a}}if("refinement"===a.type){const e=e=>{const t=a.refinement(e,s);if(r.common.async)return Promise.resolve(t);if(t instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return e};if(!1===r.common.async){const a=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return"aborted"===a.status?Dr:("dirty"===a.status&&t.dirty(),e(a.value),{status:t.value,value:a.value})}return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(r=>"aborted"===r.status?Dr:("dirty"===r.status&&t.dirty(),e(r.value).then(()=>({status:t.value,value:r.value}))))}if("transform"===a.type){if(!1===r.common.async){const e=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!Vr(e))return Dr;const i=a.transform(e.value,s);if(i instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:i}}return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(e=>Vr(e)?Promise.resolve(a.transform(e.value,s)).then(e=>({status:t.value,value:e})):Dr)}Rr.assertNever(a)}}Ga.create=(e,t,r)=>new Ga({schema:e,typeName:ns.ZodEffects,effect:t,...Wr(r)}),Ga.createWithPreprocess=(e,t,r)=>new Ga({schema:t,effect:{type:"preprocess",transform:e},typeName:ns.ZodEffects,...Wr(r)});class Ya extends Jr{_parse(e){return this._getType(e)===Or.undefined?Mr(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Ya.create=(e,t)=>new Ya({innerType:e,typeName:ns.ZodOptional,...Wr(t)});class Xa extends Jr{_parse(e){return this._getType(e)===Or.null?Mr(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Xa.create=(e,t)=>new Xa({innerType:e,typeName:ns.ZodNullable,...Wr(t)});class es extends Jr{_parse(e){const{ctx:t}=this._processInputParams(e);let r=t.data;return t.parsedType===Or.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}es.create=(e,t)=>new es({innerType:e,typeName:ns.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...Wr(t)});class ts extends Jr{_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 Hr(a)?a.then(e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new jr(r.common.issues)},input:r.data})})):{status:"valid",value:"valid"===a.status?a.value:this._def.catchValue({get error(){return new jr(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}ts.create=(e,t)=>new ts({innerType:e,typeName:ns.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...Wr(t)});class rs extends Jr{_parse(e){if(this._getType(e)!==Or.nan){const t=this._getOrReturnCtx(e);return Fr(t,{code:$r.invalid_type,expected:Or.nan,received:t.parsedType}),Dr}return{status:"valid",value:e.data}}}rs.create=e=>new rs({typeName:ns.ZodNaN,...Wr(e)});class as extends Jr{_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 ss extends Jr{_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.common.async){return(async()=>{const e=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return"aborted"===e.status?Dr:"dirty"===e.status?(t.dirty(),Lr(e.value)):this._def.out._parseAsync({data:e.value,path:r.path,parent:r})})()}{const e=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return"aborted"===e.status?Dr:"dirty"===e.status?(t.dirty(),{status:"dirty",value:e.value}):this._def.out._parseSync({data:e.value,path:r.path,parent:r})}}static create(e,t){return new ss({in:e,out:t,typeName:ns.ZodPipeline})}}class is extends Jr{_parse(e){const t=this._def.innerType._parse(e),r=e=>(Vr(e)&&(e.value=Object.freeze(e.value)),e);return Hr(t)?t.then(e=>r(e)):r(t)}unwrap(){return this._def.innerType}}var ns,os;is.create=(e,t)=>new is({innerType:e,typeName:ns.ZodReadonly,...Wr(t)}),(os=ns||(ns={})).ZodString="ZodString",os.ZodNumber="ZodNumber",os.ZodNaN="ZodNaN",os.ZodBigInt="ZodBigInt",os.ZodBoolean="ZodBoolean",os.ZodDate="ZodDate",os.ZodSymbol="ZodSymbol",os.ZodUndefined="ZodUndefined",os.ZodNull="ZodNull",os.ZodAny="ZodAny",os.ZodUnknown="ZodUnknown",os.ZodNever="ZodNever",os.ZodVoid="ZodVoid",os.ZodArray="ZodArray",os.ZodObject="ZodObject",os.ZodUnion="ZodUnion",os.ZodDiscriminatedUnion="ZodDiscriminatedUnion",os.ZodIntersection="ZodIntersection",os.ZodTuple="ZodTuple",os.ZodRecord="ZodRecord",os.ZodMap="ZodMap",os.ZodSet="ZodSet",os.ZodFunction="ZodFunction",os.ZodLazy="ZodLazy",os.ZodLiteral="ZodLiteral",os.ZodEnum="ZodEnum",os.ZodEffects="ZodEffects",os.ZodNativeEnum="ZodNativeEnum",os.ZodOptional="ZodOptional",os.ZodNullable="ZodNullable",os.ZodDefault="ZodDefault",os.ZodCatch="ZodCatch",os.ZodPromise="ZodPromise",os.ZodBranded="ZodBranded",os.ZodPipeline="ZodPipeline",os.ZodReadonly="ZodReadonly";const ds=ba.create,cs=xa.create,us=ka.create,ls=Aa.create,hs=Oa.create;Ca.create;const ps=ja.create,ms=Na.create,fs=Fa.create,vs=Da.create;Ma.create,qa.create;const gs=za.create,ys=Qa.create,_s=Ba.create;Ja.create;const bs=Ya.create;Xa.create;const ws="2025-06-18",xs=[ws,"2025-03-26","2024-11-05","2024-10-07"],Ps="2.0",ks=fs([ds(),cs().int()]),Es=ds(),Ss=ms({progressToken:bs(ks)}).passthrough(),Rs=ms({_meta:bs(Ss)}).passthrough(),Ts=ms({method:ds(),params:bs(Rs)}),As=ms({_meta:bs(ms({}).passthrough())}).passthrough(),Os=ms({method:ds(),params:bs(As)}),Cs=ms({_meta:bs(ms({}).passthrough())}).passthrough(),$s=fs([ds(),cs().int()]),js=ms({jsonrpc:ys(Ps),id:$s}).merge(Ts).strict(),Is=ms({jsonrpc:ys(Ps)}).merge(Os).strict(),Ns=ms({jsonrpc:ys(Ps),id:$s,result:Cs}).strict(),Fs=e=>Ns.safeParse(e).success;var Zs,Ds;(Ds=Zs||(Zs={}))[Ds.ConnectionClosed=-32e3]="ConnectionClosed",Ds[Ds.RequestTimeout=-32001]="RequestTimeout",Ds[Ds.ParseError=-32700]="ParseError",Ds[Ds.InvalidRequest=-32600]="InvalidRequest",Ds[Ds.MethodNotFound=-32601]="MethodNotFound",Ds[Ds.InvalidParams=-32602]="InvalidParams",Ds[Ds.InternalError=-32603]="InternalError";const Ls=ms({jsonrpc:ys(Ps),id:$s,error:ms({code:cs().int(),message:ds(),data:bs(hs())})}).strict();fs([js,Is,Ns,Ls]);const Ms=Cs.strict(),qs=Os.extend({method:ys("notifications/cancelled"),params:As.extend({requestId:$s,reason:ds().optional()})}),zs=ms({src:ds(),mimeType:bs(ds()),sizes:bs(ps(ds()))}).passthrough(),Vs=ms({icons:ps(zs).optional()}).passthrough(),Hs=ms({name:ds(),title:bs(ds())}).passthrough(),Us=Hs.extend({version:ds(),websiteUrl:bs(ds())}).merge(Vs),Qs=ms({experimental:bs(ms({}).passthrough()),sampling:bs(ms({}).passthrough()),elicitation:bs(ms({}).passthrough()),roots:bs(ms({listChanged:bs(us())}).passthrough())}).passthrough(),Ks=Ts.extend({method:ys("initialize"),params:Rs.extend({protocolVersion:ds(),capabilities:Qs,clientInfo:Us})}),Bs=ms({experimental:bs(ms({}).passthrough()),logging:bs(ms({}).passthrough()),completions:bs(ms({}).passthrough()),prompts:bs(ms({listChanged:bs(us())}).passthrough()),resources:bs(ms({subscribe:bs(us()),listChanged:bs(us())}).passthrough()),tools:bs(ms({listChanged:bs(us())}).passthrough())}).passthrough(),Ws=Cs.extend({protocolVersion:ds(),capabilities:Bs,serverInfo:Us,instructions:bs(ds())}),Js=Os.extend({method:ys("notifications/initialized")}),Gs=Ts.extend({method:ys("ping")}),Ys=ms({progress:cs(),total:bs(cs()),message:bs(ds())}).passthrough(),Xs=Os.extend({method:ys("notifications/progress"),params:As.merge(Ys).extend({progressToken:ks})}),ei=Ts.extend({params:Rs.extend({cursor:bs(Es)}).optional()}),ti=Cs.extend({nextCursor:bs(Es)}),ri=ms({uri:ds(),mimeType:bs(ds()),_meta:bs(ms({}).passthrough())}).passthrough(),ai=ri.extend({text:ds()}),si=ds().refine(e=>{try{return atob(e),!0}catch(e){return!1}},{message:"Invalid Base64 string"}),ii=ri.extend({blob:si}),ni=Hs.extend({uri:ds(),description:bs(ds()),mimeType:bs(ds()),_meta:bs(ms({}).passthrough())}).merge(Vs),oi=Hs.extend({uriTemplate:ds(),description:bs(ds()),mimeType:bs(ds()),_meta:bs(ms({}).passthrough())}).merge(Vs),di=ei.extend({method:ys("resources/list")}),ci=ti.extend({resources:ps(ni)}),ui=ei.extend({method:ys("resources/templates/list")}),li=ti.extend({resourceTemplates:ps(oi)}),hi=Ts.extend({method:ys("resources/read"),params:Rs.extend({uri:ds()})}),pi=Cs.extend({contents:ps(fs([ai,ii]))}),mi=Os.extend({method:ys("notifications/resources/list_changed")}),fi=Ts.extend({method:ys("resources/subscribe"),params:Rs.extend({uri:ds()})}),vi=Ts.extend({method:ys("resources/unsubscribe"),params:Rs.extend({uri:ds()})}),gi=Os.extend({method:ys("notifications/resources/updated"),params:As.extend({uri:ds()})}),yi=ms({name:ds(),description:bs(ds()),required:bs(us())}).passthrough(),_i=Hs.extend({description:bs(ds()),arguments:bs(ps(yi)),_meta:bs(ms({}).passthrough())}).merge(Vs),bi=ei.extend({method:ys("prompts/list")}),wi=ti.extend({prompts:ps(_i)}),xi=Ts.extend({method:ys("prompts/get"),params:Rs.extend({name:ds(),arguments:bs(gs(ds()))})}),Pi=ms({type:ys("text"),text:ds(),_meta:bs(ms({}).passthrough())}).passthrough(),ki=ms({type:ys("image"),data:si,mimeType:ds(),_meta:bs(ms({}).passthrough())}).passthrough(),Ei=ms({type:ys("audio"),data:si,mimeType:ds(),_meta:bs(ms({}).passthrough())}).passthrough(),Si=ms({type:ys("resource"),resource:fs([ai,ii]),_meta:bs(ms({}).passthrough())}).passthrough(),Ri=ni.extend({type:ys("resource_link")}),Ti=fs([Pi,ki,Ei,Ri,Si]),Ai=ms({role:_s(["user","assistant"]),content:Ti}).passthrough(),Oi=Cs.extend({description:bs(ds()),messages:ps(Ai)}),Ci=Os.extend({method:ys("notifications/prompts/list_changed")}),$i=ms({title:bs(ds()),readOnlyHint:bs(us()),destructiveHint:bs(us()),idempotentHint:bs(us()),openWorldHint:bs(us())}).passthrough(),ji=Hs.extend({description:bs(ds()),inputSchema:ms({type:ys("object"),properties:bs(ms({}).passthrough()),required:bs(ps(ds()))}).passthrough(),outputSchema:bs(ms({type:ys("object"),properties:bs(ms({}).passthrough()),required:bs(ps(ds()))}).passthrough()),annotations:bs($i),_meta:bs(ms({}).passthrough())}).merge(Vs),Ii=ei.extend({method:ys("tools/list")}),Ni=ti.extend({tools:ps(ji)}),Fi=Cs.extend({content:ps(Ti).default([]),structuredContent:ms({}).passthrough().optional(),isError:bs(us())});Fi.or(Cs.extend({toolResult:hs()}));const Zi=Ts.extend({method:ys("tools/call"),params:Rs.extend({name:ds(),arguments:bs(gs(hs()))})}),Di=Os.extend({method:ys("notifications/tools/list_changed")}),Li=_s(["debug","info","notice","warning","error","critical","alert","emergency"]),Mi=Ts.extend({method:ys("logging/setLevel"),params:Rs.extend({level:Li})}),qi=Os.extend({method:ys("notifications/message"),params:As.extend({level:Li,logger:bs(ds()),data:hs()})}),zi=ms({name:ds().optional()}).passthrough(),Vi=ms({hints:bs(ps(zi)),costPriority:bs(cs().min(0).max(1)),speedPriority:bs(cs().min(0).max(1)),intelligencePriority:bs(cs().min(0).max(1))}).passthrough(),Hi=ms({role:_s(["user","assistant"]),content:fs([Pi,ki,Ei])}).passthrough(),Ui=Ts.extend({method:ys("sampling/createMessage"),params:Rs.extend({messages:ps(Hi),systemPrompt:bs(ds()),includeContext:bs(_s(["none","thisServer","allServers"])),temperature:bs(cs()),maxTokens:cs().int(),stopSequences:bs(ps(ds())),metadata:bs(ms({}).passthrough()),modelPreferences:bs(Vi)})}),Qi=Cs.extend({model:ds(),stopReason:bs(_s(["endTurn","stopSequence","maxTokens"]).or(ds())),role:_s(["user","assistant"]),content:vs("type",[Pi,ki,Ei])}),Ki=ms({type:ys("boolean"),title:bs(ds()),description:bs(ds()),default:bs(us())}).passthrough(),Bi=ms({type:ys("string"),title:bs(ds()),description:bs(ds()),minLength:bs(cs()),maxLength:bs(cs()),format:bs(_s(["email","uri","date","date-time"]))}).passthrough(),Wi=ms({type:_s(["number","integer"]),title:bs(ds()),description:bs(ds()),minimum:bs(cs()),maximum:bs(cs())}).passthrough(),Ji=ms({type:ys("string"),title:bs(ds()),description:bs(ds()),enum:ps(ds()),enumNames:bs(ps(ds()))}).passthrough(),Gi=fs([Ki,Bi,Wi,Ji]),Yi=Ts.extend({method:ys("elicitation/create"),params:Rs.extend({message:ds(),requestedSchema:ms({type:ys("object"),properties:gs(ds(),Gi),required:bs(ps(ds()))}).passthrough()})}),Xi=Cs.extend({action:_s(["accept","decline","cancel"]),content:bs(gs(ds(),hs()))}),en=ms({type:ys("ref/resource"),uri:ds()}).passthrough(),tn=ms({type:ys("ref/prompt"),name:ds()}).passthrough(),rn=Ts.extend({method:ys("completion/complete"),params:Rs.extend({ref:fs([tn,en]),argument:ms({name:ds(),value:ds()}).passthrough(),context:bs(ms({arguments:bs(gs(ds(),ds()))}))})}),an=Cs.extend({completion:ms({values:ps(ds()).max(100),total:bs(cs().int()),hasMore:bs(us())}).passthrough()}),sn=ms({uri:ds().startsWith("file://"),name:bs(ds()),_meta:bs(ms({}).passthrough())}).passthrough(),nn=Ts.extend({method:ys("roots/list")}),on=Cs.extend({roots:ps(sn)}),dn=Os.extend({method:ys("notifications/roots/list_changed")});fs([Gs,Ks,rn,Mi,xi,bi,di,ui,hi,fi,vi,Zi,Ii]),fs([qs,Xs,Js,dn]),fs([Ms,Qi,Xi,on]),fs([Gs,Ui,Yi,nn]),fs([qs,Xs,qi,gi,mi,Di,Ci]),fs([Ms,Ws,an,Oi,wi,ci,li,pi,Fi,Ni]);class cn extends Error{constructor(e,t,r){super(`MCP error ${e}: ${t}`),this.code=e,this.data=r,this.name="McpError"}}class un{constructor(e){this._options=e,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this._pendingDebouncedNotifications=new Set,this.setNotificationHandler(qs,e=>{const t=this._requestHandlerAbortControllers.get(e.params.requestId);null==t||t.abort(e.params.reason)}),this.setNotificationHandler(Xs,e=>{this._onprogress(e)}),this.setRequestHandler(Gs,e=>({}))}_setupTimeout(e,t,r,a,s=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(a,t),startTime:Date.now(),timeout:t,maxTotalTimeout:r,resetTimeoutOnProgress:s,onTimeout:a})}_resetTimeout(e){const t=this._timeoutInfo.get(e);if(!t)return!1;const r=Date.now()-t.startTime;if(t.maxTotalTimeout&&r>=t.maxTotalTimeout)throw this._timeoutInfo.delete(e),new cn(Zs.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:t.maxTotalTimeout,totalElapsed:r});return clearTimeout(t.timeoutId),t.timeoutId=setTimeout(t.onTimeout,t.timeout),!0}_cleanupTimeout(e){const t=this._timeoutInfo.get(e);t&&(clearTimeout(t.timeoutId),this._timeoutInfo.delete(e))}async connect(e){var t,r,a;this._transport=e;const s=null===(t=this.transport)||void 0===t?void 0:t.onclose;this._transport.onclose=()=>{null==s||s(),this._onclose()};const i=null===(r=this.transport)||void 0===r?void 0:r.onerror;this._transport.onerror=e=>{null==i||i(e),this._onerror(e)};const n=null===(a=this._transport)||void 0===a?void 0:a.onmessage;this._transport.onmessage=(e,t)=>{var r;null==n||n(e,t),Fs(e)||(r=e,Ls.safeParse(r).success)?this._onresponse(e):(e=>js.safeParse(e).success)(e)?this._onrequest(e,t):(e=>Is.safeParse(e).success)(e)?this._onnotification(e):this._onerror(new Error(`Unknown message type: ${JSON.stringify(e)}`))},await this._transport.start()}_onclose(){var e;const t=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._pendingDebouncedNotifications.clear(),this._transport=void 0,null===(e=this.onclose)||void 0===e||e.call(this);const r=new cn(Zs.ConnectionClosed,"Connection closed");for(const e of t.values())e(r)}_onerror(e){var t;null===(t=this.onerror)||void 0===t||t.call(this,e)}_onnotification(e){var t;const r=null!==(t=this._notificationHandlers.get(e.method))&&void 0!==t?t:this.fallbackNotificationHandler;void 0!==r&&Promise.resolve().then(()=>r(e)).catch(e=>this._onerror(new Error(`Uncaught error in notification handler: ${e}`)))}_onrequest(e,t){var r,a;const s=null!==(r=this._requestHandlers.get(e.method))&&void 0!==r?r:this.fallbackRequestHandler,i=this._transport;if(void 0===s)return void(null==i||i.send({jsonrpc:"2.0",id:e.id,error:{code:Zs.MethodNotFound,message:"Method not found"}}).catch(e=>this._onerror(new Error(`Failed to send an error response: ${e}`))));const n=new AbortController;this._requestHandlerAbortControllers.set(e.id,n);const o={signal:n.signal,sessionId:null==i?void 0:i.sessionId,_meta:null===(a=e.params)||void 0===a?void 0:a._meta,sendNotification:t=>this.notification(t,{relatedRequestId:e.id}),sendRequest:(t,r,a)=>this.request(t,r,{...a,relatedRequestId:e.id}),authInfo:null==t?void 0:t.authInfo,requestId:e.id,requestInfo:null==t?void 0:t.requestInfo};Promise.resolve().then(()=>s(e,o)).then(t=>{if(!n.signal.aborted)return null==i?void 0:i.send({result:t,jsonrpc:"2.0",id:e.id})},t=>{var r;if(!n.signal.aborted)return null==i?void 0:i.send({jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(t.code)?t.code:Zs.InternalError,message:null!==(r=t.message)&&void 0!==r?r:"Internal error"}})}).catch(e=>this._onerror(new Error(`Failed to send response: ${e}`))).finally(()=>{this._requestHandlerAbortControllers.delete(e.id)})}_onprogress(e){const{progressToken:t,...r}=e.params,a=Number(t),s=this._progressHandlers.get(a);if(!s)return void this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));const i=this._responseHandlers.get(a),n=this._timeoutInfo.get(a);if(n&&i&&n.resetTimeoutOnProgress)try{this._resetTimeout(a)}catch(e){return void i(e)}s(r)}_onresponse(e){const t=Number(e.id),r=this._responseHandlers.get(t);if(void 0!==r)if(this._responseHandlers.delete(t),this._progressHandlers.delete(t),this._cleanupTimeout(t),Fs(e))r(e);else{r(new cn(e.error.code,e.error.message,e.error.data))}else this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`))}get transport(){return this._transport}async close(){var e;await(null===(e=this._transport)||void 0===e?void 0:e.close())}request(e,t,r){const{relatedRequestId:a,resumptionToken:s,onresumptiontoken:i}=null!=r?r:{};return new Promise((n,o)=>{var d,c,u,l,h,p;if(!this._transport)return void o(new Error("Not connected"));!0===(null===(d=this._options)||void 0===d?void 0:d.enforceStrictCapabilities)&&this.assertCapabilityForMethod(e.method),null===(c=null==r?void 0:r.signal)||void 0===c||c.throwIfAborted();const m=this._requestMessageId++,f={...e,jsonrpc:"2.0",id:m};(null==r?void 0:r.onprogress)&&(this._progressHandlers.set(m,r.onprogress),f.params={...e.params,_meta:{...(null===(u=e.params)||void 0===u?void 0:u._meta)||{},progressToken:m}});const v=e=>{var t;this._responseHandlers.delete(m),this._progressHandlers.delete(m),this._cleanupTimeout(m),null===(t=this._transport)||void 0===t||t.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:m,reason:String(e)}},{relatedRequestId:a,resumptionToken:s,onresumptiontoken:i}).catch(e=>this._onerror(new Error(`Failed to send cancellation: ${e}`))),o(e)};this._responseHandlers.set(m,e=>{var a;if(!(null===(a=null==r?void 0:r.signal)||void 0===a?void 0:a.aborted)){if(e instanceof Error)return o(e);try{const r=t.parse(e.result);n(r)}catch(e){o(e)}}}),null===(l=null==r?void 0:r.signal)||void 0===l||l.addEventListener("abort",()=>{var e;v(null===(e=null==r?void 0:r.signal)||void 0===e?void 0:e.reason)});const g=null!==(h=null==r?void 0:r.timeout)&&void 0!==h?h:6e4;this._setupTimeout(m,g,null==r?void 0:r.maxTotalTimeout,()=>v(new cn(Zs.RequestTimeout,"Request timed out",{timeout:g})),null!==(p=null==r?void 0:r.resetTimeoutOnProgress)&&void 0!==p&&p),this._transport.send(f,{relatedRequestId:a,resumptionToken:s,onresumptiontoken:i}).catch(e=>{this._cleanupTimeout(m),o(e)})})}async notification(e,t){var r,a;if(!this._transport)throw new Error("Not connected");this.assertNotificationCapability(e.method);if((null!==(a=null===(r=this._options)||void 0===r?void 0:r.debouncedNotificationMethods)&&void 0!==a?a:[]).includes(e.method)&&!e.params&&!(null==t?void 0:t.relatedRequestId)){if(this._pendingDebouncedNotifications.has(e.method))return;return this._pendingDebouncedNotifications.add(e.method),void Promise.resolve().then(()=>{var r;if(this._pendingDebouncedNotifications.delete(e.method),!this._transport)return;const a={...e,jsonrpc:"2.0"};null===(r=this._transport)||void 0===r||r.send(a,t).catch(e=>this._onerror(e))})}const s={...e,jsonrpc:"2.0"};await this._transport.send(s,t)}setRequestHandler(e,t){const r=e.shape.method.value;this.assertRequestHandlerCapability(r),this._requestHandlers.set(r,(r,a)=>Promise.resolve(t(e.parse(r),a)))}removeRequestHandler(e){this._requestHandlers.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw new Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,t){this._notificationHandlers.set(e.shape.method.value,r=>Promise.resolve(t(e.parse(r))))}removeNotificationHandler(e){this._notificationHandlers.delete(e)}}function ln(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var hn,pn,mn,fn,vn,gn,yn,_n,bn,wn={exports:{}};
/** @license URI.js v4.4.1 (c) 2011 Gary Court. License: http://github.com/garycourt/uri-js */function xn(){return hn||(hn=1,function(e){function t(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];if(t.length>1){t[0]=t[0].slice(0,-1);for(var a=t.length-1,s=1;s<a;++s)t[s]=t[s].slice(1,-1);return t[a]=t[a].slice(1),t.join("")}return t[0]}function r(e){return"(?:"+e+")"}function a(e){return void 0===e?"undefined":null===e?"null":Object.prototype.toString.call(e).split(" ").pop().split("]").shift().toLowerCase()}function s(e){return e.toUpperCase()}function i(e){return null!=e?e instanceof Array?e:"number"!=typeof e.length||e.split||e.setInterval||e.call?[e]:Array.prototype.slice.call(e):[]}function n(e,t){var r=e;if(t)for(var a in t)r[a]=t[a];return r}function o(e){var a="[A-Za-z]",s="[0-9]",i=t(s,"[A-Fa-f]"),n=r(r("%[EFef]"+i+"%"+i+i+"%"+i+i)+"|"+r("%[89A-Fa-f]"+i+"%"+i+i)+"|"+r("%"+i+i)),o="[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=]",d=t("[\\:\\/\\?\\#\\[\\]\\@]",o),c=e?"[\\uE000-\\uF8FF]":"[]",u=t(a,s,"[\\-\\.\\_\\~]",e?"[\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]":"[]");r(a+t(a,s,"[\\+\\-\\.]")+"*"),r(r(n+"|"+t(u,o,"[\\:]"))+"*");var l=r(r("25[0-5]")+"|"+r("2[0-4]"+s)+"|"+r("1"+s+s)+"|"+r("0?[1-9]"+s)+"|0?0?"+s),h=r(l+"\\."+l+"\\."+l+"\\."+l),p=r(i+"{1,4}"),m=r(r(p+"\\:"+p)+"|"+h),f=r(r(p+"\\:")+"{6}"+m),v=r("\\:\\:"+r(p+"\\:")+"{5}"+m),g=r(r(p)+"?\\:\\:"+r(p+"\\:")+"{4}"+m),y=r(r(r(p+"\\:")+"{0,1}"+p)+"?\\:\\:"+r(p+"\\:")+"{3}"+m),_=r(r(r(p+"\\:")+"{0,2}"+p)+"?\\:\\:"+r(p+"\\:")+"{2}"+m),b=r(r(r(p+"\\:")+"{0,3}"+p)+"?\\:\\:"+p+"\\:"+m),w=r(r(r(p+"\\:")+"{0,4}"+p)+"?\\:\\:"+m),x=r(r(r(p+"\\:")+"{0,5}"+p)+"?\\:\\:"+p),P=r(r(r(p+"\\:")+"{0,6}"+p)+"?\\:\\:"),k=r([f,v,g,y,_,b,w,x,P].join("|")),E=r(r(u+"|"+n)+"+");r("[vV]"+i+"+\\."+t(u,o,"[\\:]")+"+"),r(r(n+"|"+t(u,o))+"*");var S=r(n+"|"+t(u,o,"[\\:\\@]"));return r(r(n+"|"+t(u,o,"[\\@]"))+"+"),r(r(S+"|"+t("[\\/\\?]",c))+"*"),{NOT_SCHEME:new RegExp(t("[^]",a,s,"[\\+\\-\\.]"),"g"),NOT_USERINFO:new RegExp(t("[^\\%\\:]",u,o),"g"),NOT_HOST:new RegExp(t("[^\\%\\[\\]\\:]",u,o),"g"),NOT_PATH:new RegExp(t("[^\\%\\/\\:\\@]",u,o),"g"),NOT_PATH_NOSCHEME:new RegExp(t("[^\\%\\/\\@]",u,o),"g"),NOT_QUERY:new RegExp(t("[^\\%]",u,o,"[\\:\\@\\/\\?]",c),"g"),NOT_FRAGMENT:new RegExp(t("[^\\%]",u,o,"[\\:\\@\\/\\?]"),"g"),ESCAPE:new RegExp(t("[^]",u,o),"g"),UNRESERVED:new RegExp(u,"g"),OTHER_CHARS:new RegExp(t("[^\\%]",u,d),"g"),PCT_ENCODED:new RegExp(n,"g"),IPV4ADDRESS:new RegExp("^("+h+")$"),IPV6ADDRESS:new RegExp("^\\[?("+k+")"+r(r("\\%25|\\%(?!"+i+"{2})")+"("+E+")")+"?\\]?$")}}var d=o(!1),c=o(!0),u=function(){function e(e,t){var r=[],a=!0,s=!1,i=void 0;try{for(var n,o=e[Symbol.iterator]();!(a=(n=o.next()).done)&&(r.push(n.value),!t||r.length!==t);a=!0);}catch(e){s=!0,i=e}finally{try{!a&&o.return&&o.return()}finally{if(s)throw i}}return r}return function(t,r){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,r);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),l=function(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);t<e.length;t++)r[t]=e[t];return r}return Array.from(e)},h=2147483647,p=36,m=1,f=26,v=38,g=700,y=72,_=128,b="-",w=/^xn--/,x=/[^\0-\x7E]/,P=/[\x2E\u3002\uFF0E\uFF61]/g,k={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},E=p-m,S=Math.floor,R=String.fromCharCode;function T(e){throw new RangeError(k[e])}function A(e,t){for(var r=[],a=e.length;a--;)r[a]=t(e[a]);return r}function O(e,t){var r=e.split("@"),a="";return r.length>1&&(a=r[0]+"@",e=r[1]),a+A((e=e.replace(P,".")).split("."),t).join(".")}function C(e){for(var t=[],r=0,a=e.length;r<a;){var s=e.charCodeAt(r++);if(s>=55296&&s<=56319&&r<a){var i=e.charCodeAt(r++);56320==(64512&i)?t.push(((1023&s)<<10)+(1023&i)+65536):(t.push(s),r--)}else t.push(s)}return t}var $=function(e){return e-48<10?e-22:e-65<26?e-65:e-97<26?e-97:p},j=function(e,t){return e+22+75*(e<26)-((0!=t)<<5)},I=function(e,t,r){var a=0;for(e=r?S(e/g):e>>1,e+=S(e/t);e>E*f>>1;a+=p)e=S(e/E);return S(a+(E+1)*e/(e+v))},N=function(e){var t=[],r=e.length,a=0,s=_,i=y,n=e.lastIndexOf(b);n<0&&(n=0);for(var o=0;o<n;++o)e.charCodeAt(o)>=128&&T("not-basic"),t.push(e.charCodeAt(o));for(var d=n>0?n+1:0;d<r;){for(var c=a,u=1,l=p;;l+=p){d>=r&&T("invalid-input");var v=$(e.charCodeAt(d++));(v>=p||v>S((h-a)/u))&&T("overflow"),a+=v*u;var g=l<=i?m:l>=i+f?f:l-i;if(v<g)break;var w=p-g;u>S(h/w)&&T("overflow"),u*=w}var x=t.length+1;i=I(a-c,x,0==c),S(a/x)>h-s&&T("overflow"),s+=S(a/x),a%=x,t.splice(a++,0,s)}return String.fromCodePoint.apply(String,t)},F=function(e){var t=[],r=(e=C(e)).length,a=_,s=0,i=y,n=!0,o=!1,d=void 0;try{for(var c,u=e[Symbol.iterator]();!(n=(c=u.next()).done);n=!0){var l=c.value;l<128&&t.push(R(l))}}catch(e){o=!0,d=e}finally{try{!n&&u.return&&u.return()}finally{if(o)throw d}}var v=t.length,g=v;for(v&&t.push(b);g<r;){var w=h,x=!0,P=!1,k=void 0;try{for(var E,A=e[Symbol.iterator]();!(x=(E=A.next()).done);x=!0){var O=E.value;O>=a&&O<w&&(w=O)}}catch(e){P=!0,k=e}finally{try{!x&&A.return&&A.return()}finally{if(P)throw k}}var $=g+1;w-a>S((h-s)/$)&&T("overflow"),s+=(w-a)*$,a=w;var N=!0,F=!1,Z=void 0;try{for(var D,L=e[Symbol.iterator]();!(N=(D=L.next()).done);N=!0){var M=D.value;if(M<a&&++s>h&&T("overflow"),M==a){for(var q=s,z=p;;z+=p){var V=z<=i?m:z>=i+f?f:z-i;if(q<V)break;var H=q-V,U=p-V;t.push(R(j(V+H%U,0))),q=S(H/U)}t.push(R(j(q,0))),i=I(s,$,g==v),s=0,++g}}}catch(e){F=!0,Z=e}finally{try{!N&&L.return&&L.return()}finally{if(F)throw Z}}++s,++a}return t.join("")},Z=function(e){return O(e,function(e){return w.test(e)?N(e.slice(4).toLowerCase()):e})},D=function(e){return O(e,function(e){return x.test(e)?"xn--"+F(e):e})},L={version:"2.1.0",ucs2:{decode:C,encode:function(e){return String.fromCodePoint.apply(String,l(e))}},decode:N,encode:F,toASCII:D,toUnicode:Z},M={};function q(e){var t=e.charCodeAt(0);return t<16?"%0"+t.toString(16).toUpperCase():t<128?"%"+t.toString(16).toUpperCase():t<2048?"%"+(t>>6|192).toString(16).toUpperCase()+"%"+(63&t|128).toString(16).toUpperCase():"%"+(t>>12|224).toString(16).toUpperCase()+"%"+(t>>6&63|128).toString(16).toUpperCase()+"%"+(63&t|128).toString(16).toUpperCase()}function z(e){for(var t="",r=0,a=e.length;r<a;){var s=parseInt(e.substr(r+1,2),16);if(s<128)t+=String.fromCharCode(s),r+=3;else if(s>=194&&s<224){if(a-r>=6){var i=parseInt(e.substr(r+4,2),16);t+=String.fromCharCode((31&s)<<6|63&i)}else t+=e.substr(r,6);r+=6}else if(s>=224){if(a-r>=9){var n=parseInt(e.substr(r+4,2),16),o=parseInt(e.substr(r+7,2),16);t+=String.fromCharCode((15&s)<<12|(63&n)<<6|63&o)}else t+=e.substr(r,9);r+=9}else t+=e.substr(r,3),r+=3}return t}function V(e,t){function r(e){var r=z(e);return r.match(t.UNRESERVED)?r:e}return e.scheme&&(e.scheme=String(e.scheme).replace(t.PCT_ENCODED,r).toLowerCase().replace(t.NOT_SCHEME,"")),void 0!==e.userinfo&&(e.userinfo=String(e.userinfo).replace(t.PCT_ENCODED,r).replace(t.NOT_USERINFO,q).replace(t.PCT_ENCODED,s)),void 0!==e.host&&(e.host=String(e.host).replace(t.PCT_ENCODED,r).toLowerCase().replace(t.NOT_HOST,q).replace(t.PCT_ENCODED,s)),void 0!==e.path&&(e.path=String(e.path).replace(t.PCT_ENCODED,r).replace(e.scheme?t.NOT_PATH:t.NOT_PATH_NOSCHEME,q).replace(t.PCT_ENCODED,s)),void 0!==e.query&&(e.query=String(e.query).replace(t.PCT_ENCODED,r).replace(t.NOT_QUERY,q).replace(t.PCT_ENCODED,s)),void 0!==e.fragment&&(e.fragment=String(e.fragment).replace(t.PCT_ENCODED,r).replace(t.NOT_FRAGMENT,q).replace(t.PCT_ENCODED,s)),e}function H(e){return e.replace(/^0*(.*)/,"$1")||"0"}function U(e,t){var r=e.match(t.IPV4ADDRESS)||[],a=u(r,2)[1];return a?a.split(".").map(H).join("."):e}function Q(e,t){var r=e.match(t.IPV6ADDRESS)||[],a=u(r,3),s=a[1],i=a[2];if(s){for(var n=s.toLowerCase().split("::").reverse(),o=u(n,2),d=o[0],c=o[1],l=c?c.split(":").map(H):[],h=d.split(":").map(H),p=t.IPV4ADDRESS.test(h[h.length-1]),m=p?7:8,f=h.length-m,v=Array(m),g=0;g<m;++g)v[g]=l[g]||h[f+g]||"";p&&(v[m-1]=U(v[m-1],t));var y=v.reduce(function(e,t,r){if(!t||"0"===t){var a=e[e.length-1];a&&a.index+a.length===r?a.length++:e.push({index:r,length:1})}return e},[]).sort(function(e,t){return t.length-e.length})[0],_=void 0;if(y&&y.length>1){var b=v.slice(0,y.index),w=v.slice(y.index+y.length);_=b.join(":")+"::"+w.join(":")}else _=v.join(":");return i&&(_+="%"+i),_}return e}var K=/^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i,B=void 0==="".match(/(){0}/)[1];function W(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r={},a=!1!==t.iri?c:d;"suffix"===t.reference&&(e=(t.scheme?t.scheme+":":"")+"//"+e);var s=e.match(K);if(s){B?(r.scheme=s[1],r.userinfo=s[3],r.host=s[4],r.port=parseInt(s[5],10),r.path=s[6]||"",r.query=s[7],r.fragment=s[8],isNaN(r.port)&&(r.port=s[5])):(r.scheme=s[1]||void 0,r.userinfo=-1!==e.indexOf("@")?s[3]:void 0,r.host=-1!==e.indexOf("//")?s[4]:void 0,r.port=parseInt(s[5],10),r.path=s[6]||"",r.query=-1!==e.indexOf("?")?s[7]:void 0,r.fragment=-1!==e.indexOf("#")?s[8]:void 0,isNaN(r.port)&&(r.port=e.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/)?s[4]:void 0)),r.host&&(r.host=Q(U(r.host,a),a)),void 0!==r.scheme||void 0!==r.userinfo||void 0!==r.host||void 0!==r.port||r.path||void 0!==r.query?void 0===r.scheme?r.reference="relative":void 0===r.fragment?r.reference="absolute":r.reference="uri":r.reference="same-document",t.reference&&"suffix"!==t.reference&&t.reference!==r.reference&&(r.error=r.error||"URI is not a "+t.reference+" reference.");var i=M[(t.scheme||r.scheme||"").toLowerCase()];if(t.unicodeSupport||i&&i.unicodeSupport)V(r,a);else{if(r.host&&(t.domainHost||i&&i.domainHost))try{r.host=L.toASCII(r.host.replace(a.PCT_ENCODED,z).toLowerCase())}catch(e){r.error=r.error||"Host's domain name can not be converted to ASCII via punycode: "+e}V(r,d)}i&&i.parse&&i.parse(r,t)}else r.error=r.error||"URI can not be parsed.";return r}function J(e,t){var r=!1!==t.iri?c:d,a=[];return void 0!==e.userinfo&&(a.push(e.userinfo),a.push("@")),void 0!==e.host&&a.push(Q(U(String(e.host),r),r).replace(r.IPV6ADDRESS,function(e,t,r){return"["+t+(r?"%25"+r:"")+"]"})),"number"!=typeof e.port&&"string"!=typeof e.port||(a.push(":"),a.push(String(e.port))),a.length?a.join(""):void 0}var G=/^\.\.?\//,Y=/^\/\.(\/|$)/,X=/^\/\.\.(\/|$)/,ee=/^\/?(?:.|\n)*?(?=\/|$)/;function te(e){for(var t=[];e.length;)if(e.match(G))e=e.replace(G,"");else if(e.match(Y))e=e.replace(Y,"/");else if(e.match(X))e=e.replace(X,"/"),t.pop();else if("."===e||".."===e)e="";else{var r=e.match(ee);if(!r)throw new Error("Unexpected dot segment condition");var a=r[0];e=e.slice(a.length),t.push(a)}return t.join("")}function re(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.iri?c:d,a=[],s=M[(t.scheme||e.scheme||"").toLowerCase()];if(s&&s.serialize&&s.serialize(e,t),e.host)if(r.IPV6ADDRESS.test(e.host));else if(t.domainHost||s&&s.domainHost)try{e.host=t.iri?L.toUnicode(e.host):L.toASCII(e.host.replace(r.PCT_ENCODED,z).toLowerCase())}catch(r){e.error=e.error||"Host's domain name can not be converted to "+(t.iri?"Unicode":"ASCII")+" via punycode: "+r}V(e,r),"suffix"!==t.reference&&e.scheme&&(a.push(e.scheme),a.push(":"));var i=J(e,t);if(void 0!==i&&("suffix"!==t.reference&&a.push("//"),a.push(i),e.path&&"/"!==e.path.charAt(0)&&a.push("/")),void 0!==e.path){var n=e.path;t.absolutePath||s&&s.absolutePath||(n=te(n)),void 0===i&&(n=n.replace(/^\/\//,"/%2F")),a.push(n)}return void 0!==e.query&&(a.push("?"),a.push(e.query)),void 0!==e.fragment&&(a.push("#"),a.push(e.fragment)),a.join("")}function ae(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},a={};return arguments[3]||(e=W(re(e,r),r),t=W(re(t,r),r)),!(r=r||{}).tolerant&&t.scheme?(a.scheme=t.scheme,a.userinfo=t.userinfo,a.host=t.host,a.port=t.port,a.path=te(t.path||""),a.query=t.query):(void 0!==t.userinfo||void 0!==t.host||void 0!==t.port?(a.userinfo=t.userinfo,a.host=t.host,a.port=t.port,a.path=te(t.path||""),a.query=t.query):(t.path?("/"===t.path.charAt(0)?a.path=te(t.path):(void 0===e.userinfo&&void 0===e.host&&void 0===e.port||e.path?e.path?a.path=e.path.slice(0,e.path.lastIndexOf("/")+1)+t.path:a.path=t.path:a.path="/"+t.path,a.path=te(a.path)),a.query=t.query):(a.path=e.path,void 0!==t.query?a.query=t.query:a.query=e.query),a.userinfo=e.userinfo,a.host=e.host,a.port=e.port),a.scheme=e.scheme),a.fragment=t.fragment,a}function se(e,t,r){var a=n({scheme:"null"},r);return re(ae(W(e,a),W(t,a),a,!0),a)}function ie(e,t){return"string"==typeof e?e=re(W(e,t),t):"object"===a(e)&&(e=W(re(e,t),t)),e}function ne(e,t,r){return"string"==typeof e?e=re(W(e,r),r):"object"===a(e)&&(e=re(e,r)),"string"==typeof t?t=re(W(t,r),r):"object"===a(t)&&(t=re(t,r)),e===t}function oe(e,t){return e&&e.toString().replace(t&&t.iri?c.ESCAPE:d.ESCAPE,q)}function de(e,t){return e&&e.toString().replace(t&&t.iri?c.PCT_ENCODED:d.PCT_ENCODED,z)}var ce={scheme:"http",domainHost:!0,parse:function(e,t){return e.host||(e.error=e.error||"HTTP URIs must have a host."),e},serialize:function(e,t){var r="https"===String(e.scheme).toLowerCase();return e.port!==(r?443:80)&&""!==e.port||(e.port=void 0),e.path||(e.path="/"),e}},ue={scheme:"https",domainHost:ce.domainHost,parse:ce.parse,serialize:ce.serialize};function le(e){return"boolean"==typeof e.secure?e.secure:"wss"===String(e.scheme).toLowerCase()}var he={scheme:"ws",domainHost:!0,parse:function(e,t){var r=e;return r.secure=le(r),r.resourceName=(r.path||"/")+(r.query?"?"+r.query:""),r.path=void 0,r.query=void 0,r},serialize:function(e,t){if(e.port!==(le(e)?443:80)&&""!==e.port||(e.port=void 0),"boolean"==typeof e.secure&&(e.scheme=e.secure?"wss":"ws",e.secure=void 0),e.resourceName){var r=e.resourceName.split("?"),a=u(r,2),s=a[0],i=a[1];e.path=s&&"/"!==s?s:void 0,e.query=i,e.resourceName=void 0}return e.fragment=void 0,e}},pe={scheme:"wss",domainHost:he.domainHost,parse:he.parse,serialize:he.serialize},me={},fe="[A-Za-z0-9\\-\\.\\_\\~\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]",ve="[0-9A-Fa-f]",ge=r(r("%[EFef]"+ve+"%"+ve+ve+"%"+ve+ve)+"|"+r("%[89A-Fa-f]"+ve+"%"+ve+ve)+"|"+r("%"+ve+ve)),ye="[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]",_e=t("[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]",'[\\"\\\\]'),be="[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]",we=new RegExp(fe,"g"),xe=new RegExp(ge,"g"),Pe=new RegExp(t("[^]",ye,"[\\.]",'[\\"]',_e),"g"),ke=new RegExp(t("[^]",fe,be),"g"),Ee=ke;function Se(e){var t=z(e);return t.match(we)?t:e}var Re={scheme:"mailto",parse:function(e,t){var r=e,a=r.to=r.path?r.path.split(","):[];if(r.path=void 0,r.query){for(var s=!1,i={},n=r.query.split("&"),o=0,d=n.length;o<d;++o){var c=n[o].split("=");switch(c[0]){case"to":for(var u=c[1].split(","),l=0,h=u.length;l<h;++l)a.push(u[l]);break;case"subject":r.subject=de(c[1],t);break;case"body":r.body=de(c[1],t);break;default:s=!0,i[de(c[0],t)]=de(c[1],t)}}s&&(r.headers=i)}r.query=void 0;for(var p=0,m=a.length;p<m;++p){var f=a[p].split("@");if(f[0]=de(f[0]),t.unicodeSupport)f[1]=de(f[1],t).toLowerCase();else try{f[1]=L.toASCII(de(f[1],t).toLowerCase())}catch(e){r.error=r.error||"Email address's domain name can not be converted to ASCII via punycode: "+e}a[p]=f.join("@")}return r},serialize:function(e,t){var r=e,a=i(e.to);if(a){for(var n=0,o=a.length;n<o;++n){var d=String(a[n]),c=d.lastIndexOf("@"),u=d.slice(0,c).replace(xe,Se).replace(xe,s).replace(Pe,q),l=d.slice(c+1);try{l=t.iri?L.toUnicode(l):L.toASCII(de(l,t).toLowerCase())}catch(e){r.error=r.error||"Email address's domain name can not be converted to "+(t.iri?"Unicode":"ASCII")+" via punycode: "+e}a[n]=u+"@"+l}r.path=a.join(",")}var h=e.headers=e.headers||{};e.subject&&(h.subject=e.subject),e.body&&(h.body=e.body);var p=[];for(var m in h)h[m]!==me[m]&&p.push(m.replace(xe,Se).replace(xe,s).replace(ke,q)+"="+h[m].replace(xe,Se).replace(xe,s).replace(Ee,q));return p.length&&(r.query=p.join("&")),r}},Te=/^([^\:]+)\:(.*)/,Ae={scheme:"urn",parse:function(e,t){var r=e.path&&e.path.match(Te),a=e;if(r){var s=t.scheme||a.scheme||"urn",i=r[1].toLowerCase(),n=r[2],o=s+":"+(t.nid||i),d=M[o];a.nid=i,a.nss=n,a.path=void 0,d&&(a=d.parse(a,t))}else a.error=a.error||"URN can not be parsed.";return a},serialize:function(e,t){var r=t.scheme||e.scheme||"urn",a=e.nid,s=r+":"+(t.nid||a),i=M[s];i&&(e=i.serialize(e,t));var n=e,o=e.nss;return n.path=(a||t.nid)+":"+o,n}},Oe=/^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/,Ce={scheme:"urn:uuid",parse:function(e,t){var r=e;return r.uuid=r.nss,r.nss=void 0,t.tolerant||r.uuid&&r.uuid.match(Oe)||(r.error=r.error||"UUID is not valid."),r},serialize:function(e,t){var r=e;return r.nss=(e.uuid||"").toLowerCase(),r}};M[ce.scheme]=ce,M[ue.scheme]=ue,M[he.scheme]=he,M[pe.scheme]=pe,M[Re.scheme]=Re,M[Ae.scheme]=Ae,M[Ce.scheme]=Ce,e.SCHEMES=M,e.pctEncChar=q,e.pctDecChars=z,e.parse=W,e.removeDotSegments=te,e.serialize=re,e.resolveComponents=ae,e.resolve=se,e.normalize=ie,e.equal=ne,e.escapeComponent=oe,e.unescapeComponent=de,Object.defineProperty(e,"__esModule",{value:!0})}(wn.exports)),wn.exports}function Pn(){return mn?pn:(mn=1,pn=function e(t,r){if(t===r)return!0;if(t&&r&&"object"==typeof t&&"object"==typeof r){if(t.constructor!==r.constructor)return!1;var a,s,i;if(Array.isArray(t)){if((a=t.length)!=r.length)return!1;for(s=a;0!==s--;)if(!e(t[s],r[s]))return!1;return!0}if(t.constructor===RegExp)return t.source===r.source&&t.flags===r.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===r.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===r.toString();if((a=(i=Object.keys(t)).length)!==Object.keys(r).length)return!1;for(s=a;0!==s--;)if(!Object.prototype.hasOwnProperty.call(r,i[s]))return!1;for(s=a;0!==s--;){var n=i[s];if(!e(t[n],r[n]))return!1}return!0}return t!=t&&r!=r})}function kn(){if(yn)return gn;function e(e,t,r,a){var s=a?" !== ":" === ",i=a?" || ":" && ",n=a?"!":"",o=a?"":"!";switch(e){case"null":return t+s+"null";case"array":return n+"Array.isArray("+t+")";case"object":return"("+n+t+i+"typeof "+t+s+'"object"'+i+o+"Array.isArray("+t+"))";case"integer":return"(typeof "+t+s+'"number"'+i+o+"("+t+" % 1)"+i+t+s+t+(r?i+n+"isFinite("+t+")":"")+")";case"number":return"(typeof "+t+s+'"'+e+'"'+(r?i+n+"isFinite("+t+")":"")+")";default:return"typeof "+t+s+'"'+e+'"'}}yn=1,gn={copy:function(e,t){for(var r in t=t||{},e)t[r]=e[r];return t},checkDataType:e,checkDataTypes:function(t,a,s){if(1===t.length)return e(t[0],a,s,!0);var i="",n=r(t);for(var o in n.array&&n.object&&(i=n.null?"(":"(!"+a+" || ",i+="typeof "+a+' !== "object")',delete n.null,delete n.array,delete n.object),n.number&&delete n.integer,n)i+=(i?" && ":"")+e(o,a,s,!0);return i},coerceToTypes:function(e,r){if(Array.isArray(r)){for(var a=[],s=0;s<r.length;s++){var i=r[s];(t[i]||"array"===e&&"array"===i)&&(a[a.length]=i)}if(a.length)return a}else{if(t[r])return[r];if("array"===e&&"array"===r)return["array"]}},toHash:r,getProperty:i,escapeQuotes:n,equal:Pn(),ucs2length:vn?fn:(vn=1,fn=function(e){for(var t,r=0,a=e.length,s=0;s<a;)r++,(t=e.charCodeAt(s++))>=55296&&t<=56319&&s<a&&56320==(64512&(t=e.charCodeAt(s)))&&s++;return r}),varOccurences:function(e,t){t+="[^0-9]";var r=e.match(new RegExp(t,"g"));return r?r.length:0},varReplace:function(e,t,r){return t+="([^0-9])",r=r.replace(/\$/g,"$$$$"),e.replace(new RegExp(t,"g"),r+"$1")},schemaHasRules:function(e,t){if("boolean"==typeof e)return!e;for(var r in e)if(t[r])return!0},schemaHasRulesExcept:function(e,t,r){if("boolean"==typeof e)return!e&&"not"!=r;for(var a in e)if(a!=r&&t[a])return!0},schemaUnknownRules:function(e,t){if("boolean"==typeof e)return;for(var r in e)if(!t[r])return r},toQuotedString:o,getPathExpr:function(e,t,r,a){return u(e,r?"'/' + "+t+(a?"":".replace(/~/g, '~0').replace(/\\//g, '~1')"):a?"'[' + "+t+" + ']'":"'[\\'' + "+t+" + '\\']'")},getPath:function(e,t,r){var a=o(r?"/"+l(t):i(t));return u(e,a)},getData:function(e,t,r){var a,s,n,o;if(""===e)return"rootData";if("/"==e[0]){if(!d.test(e))throw new Error("Invalid JSON-pointer: "+e);s=e,n="rootData"}else{if(!(o=e.match(c)))throw new Error("Invalid JSON-pointer: "+e);if(a=+o[1],"#"==(s=o[2])){if(a>=t)throw new Error("Cannot access property/index "+a+" levels up, current level is "+t);return r[t-a]}if(a>t)throw new Error("Cannot access data "+a+" levels up, current level is "+t);if(n="data"+(t-a||""),!s)return n}for(var u=n,l=s.split("/"),p=0;p<l.length;p++){var m=l[p];m&&(u+=" && "+(n+=i(h(m))))}return u},unescapeFragment:function(e){return h(decodeURIComponent(e))},unescapeJsonPointer:h,escapeFragment:function(e){return encodeURIComponent(l(e))},escapeJsonPointer:l};var t=r(["string","number","integer","boolean","null"]);function r(e){for(var t={},r=0;r<e.length;r++)t[e[r]]=!0;return t}var a=/^[a-z$_][a-z$_0-9]*$/i,s=/'|\\/g;function i(e){return"number"==typeof e?"["+e+"]":a.test(e)?"."+e:"['"+n(e)+"']"}function n(e){return e.replace(s,"\\$&").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\f/g,"\\f").replace(/\t/g,"\\t")}function o(e){return"'"+n(e)+"'"}var d=/^\/(?:[^~]|~0|~1)*$/,c=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function u(e,t){return'""'==e?t:(e+" + "+t).replace(/([^\\])' \+ '/g,"$1")}function l(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function h(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}return gn}function En(){if(bn)return _n;bn=1;var e=kn();return _n=function(t){e.copy(t,this)}}var Sn,Rn,Tn,An,On,Cn,$n,jn,In,Nn,Fn,Zn={exports:{}};function Dn(){if(Sn)return Zn.exports;Sn=1;var e=Zn.exports=function(e,r,a){"function"==typeof r&&(a=r,r={}),t(r,"function"==typeof(a=r.cb||a)?a:a.pre||function(){},a.post||function(){},e,"",e)};function t(a,s,i,n,o,d,c,u,l,h){if(n&&"object"==typeof n&&!Array.isArray(n)){for(var p in s(n,o,d,c,u,l,h),n){var m=n[p];if(Array.isArray(m)){if(p in e.arrayKeywords)for(var f=0;f<m.length;f++)t(a,s,i,m[f],o+"/"+p+"/"+f,d,o,p,n,f)}else if(p in e.propsKeywords){if(m&&"object"==typeof m)for(var v in m)t(a,s,i,m[v],o+"/"+p+"/"+r(v),d,o,p,n,v)}else(p in e.keywords||a.allKeys&&!(p in e.skipKeywords))&&t(a,s,i,m,o+"/"+p,d,o,p,n)}i(n,o,d,c,u,l,h)}}function r(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}return e.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0},e.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0},e.propsKeywords={definitions:!0,properties:!0,patternProperties:!0,dependencies:!0},e.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},Zn.exports}function Ln(){if(Tn)return Rn;Tn=1;var e=xn(),t=Pn(),r=kn(),a=En(),s=Dn();function i(e,t,r){var s=this._refs[r];if("string"==typeof s){if(!this._refs[s])return i.call(this,e,t,s);s=this._refs[s]}if((s=s||this._schemas[r])instanceof a)return l(s.schema,this._opts.inlineRefs)?s.schema:s.validate||this._compile(s);var o,d,c,u=n.call(this,t,r);return u&&(o=u.schema,t=u.root,c=u.baseId),o instanceof a?d=o.validate||e.call(this,o.schema,t,void 0,c):void 0!==o&&(d=l(o,this._opts.inlineRefs)?o:e.call(this,o,t,void 0,c)),d}function n(t,r){var s=e.parse(r),i=f(s),n=m(this._getId(t.schema));if(0===Object.keys(t.schema).length||i!==n){var d=g(i),u=this._refs[d];if("string"==typeof u)return o.call(this,t,u,s);if(u instanceof a)u.validate||this._compile(u),t=u;else{if(!((u=this._schemas[d])instanceof a))return;if(u.validate||this._compile(u),d==g(r))return{schema:u,root:t,baseId:n};t=u}if(!t.schema)return;n=m(this._getId(t.schema))}return c.call(this,s,n,t.schema,t)}function o(e,t,r){var a=n.call(this,e,t);if(a){var s=a.schema,i=a.baseId;e=a.root;var o=this._getId(s);return o&&(i=y(i,o)),c.call(this,r,i,s,e)}}Rn=i,i.normalizeId=g,i.fullPath=m,i.url=y,i.ids=function(a){var i=g(this._getId(a)),n={"":i},o={"":m(i,!1)},d={},c=this;return s(a,{allKeys:!0},function(a,s,i,u,l,h,p){if(""!==s){var m=c._getId(a),f=n[u],v=o[u]+"/"+l;if(void 0!==p&&(v+="/"+("number"==typeof p?p:r.escapeFragment(p))),"string"==typeof m){m=f=g(f?e.resolve(f,m):m);var y=c._refs[m];if("string"==typeof y&&(y=c._refs[y]),y&&y.schema){if(!t(a,y.schema))throw new Error('id "'+m+'" resolves to more than one schema')}else if(m!=g(v))if("#"==m[0]){if(d[m]&&!t(a,d[m]))throw new Error('id "'+m+'" resolves to more than one schema');d[m]=a}else c._refs[m]=v}n[s]=f,o[s]=v}}),d},i.inlineRef=l,i.schema=n;var d=r.toHash(["properties","patternProperties","enum","dependencies","definitions"]);function c(e,t,a,s){if(e.fragment=e.fragment||"","/"==e.fragment.slice(0,1)){for(var i=e.fragment.split("/"),o=1;o<i.length;o++){var c=i[o];if(c){if(void 0===(a=a[c=r.unescapeFragment(c)]))break;var u;if(!d[c]&&((u=this._getId(a))&&(t=y(t,u)),a.$ref)){var l=y(t,a.$ref),h=n.call(this,s,l);h&&(a=h.schema,s=h.root,t=h.baseId)}}}return void 0!==a&&a!==s.schema?{schema:a,root:s,baseId:t}:void 0}}var u=r.toHash(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum"]);function l(e,t){return!1!==t&&(void 0===t||!0===t?h(e):t?p(e)<=t:void 0)}function h(e){var t;if(Array.isArray(e)){for(var r=0;r<e.length;r++)if("object"==typeof(t=e[r])&&!h(t))return!1}else for(var a in e){if("$ref"==a)return!1;if("object"==typeof(t=e[a])&&!h(t))return!1}return!0}function p(e){var t,r=0;if(Array.isArray(e)){for(var a=0;a<e.length;a++)if("object"==typeof(t=e[a])&&(r+=p(t)),r==1/0)return 1/0}else for(var s in e){if("$ref"==s)return 1/0;if(u[s])r++;else if("object"==typeof(t=e[s])&&(r+=p(t)+1),r==1/0)return 1/0}return r}function m(t,r){return!1!==r&&(t=g(t)),f(e.parse(t))}function f(t){return e.serialize(t).split("#")[0]+"#"}var v=/#\/?$/;function g(e){return e?e.replace(v,""):""}function y(t,r){return r=g(r),e.resolve(t,r)}return Rn}function Mn(){if(On)return An;On=1;var e=Ln();function t(r,a,s){this.message=s||t.message(r,a),this.missingRef=e.url(r,a),this.missingSchema=e.normalizeId(e.fullPath(this.missingRef))}function r(e){return e.prototype=Object.create(Error.prototype),e.prototype.constructor=e,e}return An={Validation:r(function(e){this.message="validation failed",this.errors=e,this.ajv=this.validation=!0}),MissingRef:r(t)},t.message=function(e,t){return"can't resolve reference "+t+" from id "+e},An}function qn(){return $n?Cn:($n=1,Cn=function(e,t){t||(t={}),"function"==typeof t&&(t={cmp:t});var r="boolean"==typeof t.cycles&&t.cycles,a=t.cmp&&function(e){return function(t){return function(r,a){var s={key:r,value:t[r]},i={key:a,value:t[a]};return e(s,i)}}}(t.cmp),s=[];return function e(t){if(t&&t.toJSON&&"function"==typeof t.toJSON&&(t=t.toJSON()),void 0!==t){if("number"==typeof t)return isFinite(t)?""+t:"null";if("object"!=typeof t)return JSON.stringify(t);var i,n;if(Array.isArray(t)){for(n="[",i=0;i<t.length;i++)i&&(n+=","),n+=e(t[i])||"null";return n+"]"}if(null===t)return"null";if(-1!==s.indexOf(t)){if(r)return JSON.stringify("__cycle__");throw new TypeError("Converting circular structure to JSON")}var o=s.push(t)-1,d=Object.keys(t).sort(a&&a(t));for(n="",i=0;i<d.length;i++){var c=d[i],u=e(t[c]);u&&(n&&(n+=","),n+=JSON.stringify(c)+":"+u)}return s.splice(o,1),"{"+n+"}"}}(e)})}function zn(){return In?jn:(In=1,jn=function(e,t,r){var a="",s=!0===e.schema.$async,i=e.util.schemaHasRulesExcept(e.schema,e.RULES.all,"$ref"),n=e.self._getId(e.schema);if(e.opts.strictKeywords){var o=e.util.schemaUnknownRules(e.schema,e.RULES.keywords);if(o){var d="unknown keyword: "+o;if("log"!==e.opts.strictKeywords)throw new Error(d);e.logger.warn(d)}}if(e.isTop&&(a+=" var validate = ",s&&(e.async=!0,a+="async "),a+="function(data, dataPath, parentData, parentDataProperty, rootData) { 'use strict'; ",n&&(e.opts.sourceCode||e.opts.processCode)&&(a+=" /*# sourceURL="+n+" */ ")),"boolean"==typeof e.schema||!i&&!e.schema.$ref){t="false schema";var c=e.level,u=e.dataLevel,l=e.schema[t],h=e.schemaPath+e.util.getProperty(t),p=e.errSchemaPath+"/"+t,m=!e.opts.allErrors,f="data"+(u||""),v="valid"+c;if(!1===e.schema){e.isTop?m=!0:a+=" var "+v+" = false; ",(J=J||[]).push(a),a="",!1!==e.createErrors?(a+=" { keyword: 'false schema' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(p)+" , params: {} ",!1!==e.opts.messages&&(a+=" , message: 'boolean schema is false' "),e.opts.verbose&&(a+=" , schema: false , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),a+=" } "):a+=" {} ";var g=a;a=J.pop(),!e.compositeRule&&m?e.async?a+=" throw new ValidationError(["+g+"]); ":a+=" validate.errors = ["+g+"]; return false; ":a+=" var err = "+g+";  if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}else e.isTop?a+=s?" return data; ":" validate.errors = null; return true; ":a+=" var "+v+" = true; ";return e.isTop&&(a+=" }; return validate; "),a}if(e.isTop){var y=e.isTop;c=e.level=0,u=e.dataLevel=0,f="data";if(e.rootId=e.resolve.fullPath(e.self._getId(e.root.schema)),e.baseId=e.baseId||e.rootId,delete e.isTop,e.dataPathArr=[""],void 0!==e.schema.default&&e.opts.useDefaults&&e.opts.strictDefaults){var _="default is ignored in the schema root";if("log"!==e.opts.strictDefaults)throw new Error(_);e.logger.warn(_)}a+=" var vErrors = null; ",a+=" var errors = 0;     ",a+=" if (rootData === undefined) rootData = data; "}else{c=e.level,f="data"+((u=e.dataLevel)||"");if(n&&(e.baseId=e.resolve.url(e.baseId,n)),s&&!e.async)throw new Error("async schema in sync schema");a+=" var errs_"+c+" = errors;"}v="valid"+c,m=!e.opts.allErrors;var b="",w="",x=e.schema.type,P=Array.isArray(x);if(x&&e.opts.nullable&&!0===e.schema.nullable&&(P?-1==x.indexOf("null")&&(x=x.concat("null")):"null"!=x&&(x=[x,"null"],P=!0)),P&&1==x.length&&(x=x[0],P=!1),e.schema.$ref&&i){if("fail"==e.opts.extendRefs)throw new Error('$ref: validation keywords used in schema at path "'+e.errSchemaPath+'" (see option extendRefs)');!0!==e.opts.extendRefs&&(i=!1,e.logger.warn('$ref: keywords ignored in schema at path "'+e.errSchemaPath+'"'))}if(e.schema.$comment&&e.opts.$comment&&(a+=" "+e.RULES.all.$comment.code(e,"$comment")),x){if(e.opts.coerceTypes)var k=e.util.coerceToTypes(e.opts.coerceTypes,x);var E=e.RULES.types[x];if(k||P||!0===E||E&&!G(E)){h=e.schemaPath+".type",p=e.errSchemaPath+"/type",h=e.schemaPath+".type",p=e.errSchemaPath+"/type";var S=P?"checkDataTypes":"checkDataType";if(a+=" if ("+e.util[S](x,f,e.opts.strictNumbers,!0)+") { ",k){var R="dataType"+c,T="coerced"+c;a+=" var "+R+" = typeof "+f+"; var "+T+" = undefined; ","array"==e.opts.coerceTypes&&(a+=" if ("+R+" == 'object' && Array.isArray("+f+") && "+f+".length == 1) { "+f+" = "+f+"[0]; "+R+" = typeof "+f+"; if ("+e.util.checkDataType(e.schema.type,f,e.opts.strictNumbers)+") "+T+" = "+f+"; } "),a+=" if ("+T+" !== undefined) ; ";var A=k;if(A)for(var O,C=-1,$=A.length-1;C<$;)"string"==(O=A[C+=1])?a+=" else if ("+R+" == 'number' || "+R+" == 'boolean') "+T+" = '' + "+f+"; else if ("+f+" === null) "+T+" = ''; ":"number"==O||"integer"==O?(a+=" else if ("+R+" == 'boolean' || "+f+" === null || ("+R+" == 'string' && "+f+" && "+f+" == +"+f+" ","integer"==O&&(a+=" && !("+f+" % 1)"),a+=")) "+T+" = +"+f+"; "):"boolean"==O?a+=" else if ("+f+" === 'false' || "+f+" === 0 || "+f+" === null) "+T+" = false; else if ("+f+" === 'true' || "+f+" === 1) "+T+" = true; ":"null"==O?a+=" else if ("+f+" === '' || "+f+" === 0 || "+f+" === false) "+T+" = null; ":"array"==e.opts.coerceTypes&&"array"==O&&(a+=" else if ("+R+" == 'string' || "+R+" == 'number' || "+R+" == 'boolean' || "+f+" == null) "+T+" = ["+f+"]; ");a+=" else {   ",(J=J||[]).push(a),a="",!1!==e.createErrors?(a+=" { keyword: 'type' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(p)+" , params: { type: '",a+=P?""+x.join(","):""+x,a+="' } ",!1!==e.opts.messages&&(a+=" , message: 'should be ",a+=P?""+x.join(","):""+x,a+="' "),e.opts.verbose&&(a+=" , schema: validate.schema"+h+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),a+=" } "):a+=" {} ";g=a;a=J.pop(),!e.compositeRule&&m?e.async?a+=" throw new ValidationError(["+g+"]); ":a+=" validate.errors = ["+g+"]; return false; ":a+=" var err = "+g+";  if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+=" } if ("+T+" !== undefined) {  ";var j=u?"data"+(u-1||""):"parentData";a+=" "+f+" = "+T+"; ",u||(a+="if ("+j+" !== undefined)"),a+=" "+j+"["+(u?e.dataPathArr[u]:"parentDataProperty")+"] = "+T+"; } "}else{(J=J||[]).push(a),a="",!1!==e.createErrors?(a+=" { keyword: 'type' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(p)+" , params: { type: '",a+=P?""+x.join(","):""+x,a+="' } ",!1!==e.opts.messages&&(a+=" , message: 'should be ",a+=P?""+x.join(","):""+x,a+="' "),e.opts.verbose&&(a+=" , schema: validate.schema"+h+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),a+=" } "):a+=" {} ";g=a;a=J.pop(),!e.compositeRule&&m?e.async?a+=" throw new ValidationError(["+g+"]); ":a+=" validate.errors = ["+g+"]; return false; ":a+=" var err = "+g+";  if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}a+=" } "}}if(e.schema.$ref&&!i)a+=" "+e.RULES.all.$ref.code(e,"$ref")+" ",m&&(a+=" } if (errors === ",a+=y?"0":"errs_"+c,a+=") { ",w+="}");else{var I=e.RULES;if(I)for(var N=-1,F=I.length-1;N<F;)if(G(E=I[N+=1])){if(E.type&&(a+=" if ("+e.util.checkDataType(E.type,f,e.opts.strictNumbers)+") { "),e.opts.useDefaults)if("object"==E.type&&e.schema.properties){l=e.schema.properties;var Z=Object.keys(l);if(Z)for(var D,L=-1,M=Z.length-1;L<M;){if(void 0!==(V=l[D=Z[L+=1]]).default){var q=f+e.util.getProperty(D);if(e.compositeRule){if(e.opts.strictDefaults){_="default is ignored for: "+q;if("log"!==e.opts.strictDefaults)throw new Error(_);e.logger.warn(_)}}else a+=" if ("+q+" === undefined ","empty"==e.opts.useDefaults&&(a+=" || "+q+" === null || "+q+" === '' "),a+=" ) "+q+" = ","shared"==e.opts.useDefaults?a+=" "+e.useDefault(V.default)+" ":a+=" "+JSON.stringify(V.default)+" ",a+="; "}}}else if("array"==E.type&&Array.isArray(e.schema.items)){var z=e.schema.items;if(z){C=-1;for(var V,H=z.length-1;C<H;)if(void 0!==(V=z[C+=1]).default){q=f+"["+C+"]";if(e.compositeRule){if(e.opts.strictDefaults){_="default is ignored for: "+q;if("log"!==e.opts.strictDefaults)throw new Error(_);e.logger.warn(_)}}else a+=" if ("+q+" === undefined ","empty"==e.opts.useDefaults&&(a+=" || "+q+" === null || "+q+" === '' "),a+=" ) "+q+" = ","shared"==e.opts.useDefaults?a+=" "+e.useDefault(V.default)+" ":a+=" "+JSON.stringify(V.default)+" ",a+="; "}}}var U=E.rules;if(U)for(var Q,K=-1,B=U.length-1;K<B;)if(Y(Q=U[K+=1])){var W=Q.code(e,Q.keyword,E.type);W&&(a+=" "+W+" ",m&&(b+="}"))}if(m&&(a+=" "+b+" ",b=""),E.type&&(a+=" } ",x&&x===E.type&&!k)){a+=" else { ";var J;h=e.schemaPath+".type",p=e.errSchemaPath+"/type";(J=J||[]).push(a),a="",!1!==e.createErrors?(a+=" { keyword: 'type' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(p)+" , params: { type: '",a+=P?""+x.join(","):""+x,a+="' } ",!1!==e.opts.messages&&(a+=" , message: 'should be ",a+=P?""+x.join(","):""+x,a+="' "),e.opts.verbose&&(a+=" , schema: validate.schema"+h+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),a+=" } "):a+=" {} ";g=a;a=J.pop(),!e.compositeRule&&m?e.async?a+=" throw new ValidationError(["+g+"]); ":a+=" validate.errors = ["+g+"]; return false; ":a+=" var err = "+g+";  if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+=" } "}m&&(a+=" if (errors === ",a+=y?"0":"errs_"+c,a+=") { ",w+="}")}}function G(e){for(var t=e.rules,r=0;r<t.length;r++)if(Y(t[r]))return!0}function Y(t){return void 0!==e.schema[t.keyword]||t.implements&&function(t){for(var r=t.implements,a=0;a<r.length;a++)if(void 0!==e.schema[r[a]])return!0}(t)}return m&&(a+=" "+w+" "),y?(s?(a+=" if (errors === 0) return data;           ",a+=" else throw new ValidationError(vErrors); "):(a+=" validate.errors = vErrors; ",a+=" return errors === 0;       "),a+=" }; return validate;"):a+=" var "+v+" = errors === errs_"+c+";",a})}function Vn(){if(Fn)return Nn;Fn=1;var e=Ln(),t=kn(),r=Mn(),a=qn(),s=zn(),i=t.ucs2length,n=Pn(),o=r.Validation;function d(e,t,r){var a=u.call(this,e,t,r);return a>=0?{index:a,compiling:!0}:(a=this._compilations.length,this._compilations[a]={schema:e,root:t,baseId:r},{index:a,compiling:!1})}function c(e,t,r){var a=u.call(this,e,t,r);a>=0&&this._compilations.splice(a,1)}function u(e,t,r){for(var a=0;a<this._compilations.length;a++){var s=this._compilations[a];if(s.schema==e&&s.root==t&&s.baseId==r)return a}return-1}function l(e,r){return"var pattern"+e+" = new RegExp("+t.toQuotedString(r[e])+");"}function h(e){return"var default"+e+" = defaults["+e+"];"}function p(e,t){return void 0===t[e]?"":"var refVal"+e+" = refVal["+e+"];"}function m(e){return"var customRule"+e+" = customRules["+e+"];"}function f(e,t){if(!e.length)return"";for(var r="",a=0;a<e.length;a++)r+=t(a,e);return r}return Nn=function u(v,g,y,_){var b=this,w=this._opts,x=[void 0],P={},k=[],E={},S=[],R={},T=[];g=g||{schema:v,refVal:x,refs:P};var A=d.call(this,v,g,_),O=this._compilations[A.index];if(A.compiling)return O.callValidate=function e(){var t=O.validate,r=t.apply(this,arguments);return e.errors=t.errors,r};var C=this._formats,$=this.RULES;try{var j=N(v,g,y,_);O.validate=j;var I=O.callValidate;return I&&(I.schema=j.schema,I.errors=null,I.refs=j.refs,I.refVal=j.refVal,I.root=j.root,I.$async=j.$async,w.sourceCode&&(I.source=j.source)),j}finally{c.call(this,v,g,_)}function N(a,d,c,v){var y=!d||d&&d.schema==a;if(d.schema!=g.schema)return u.call(b,a,d,c,v);var _,E=!0===a.$async,R=s({isTop:!0,schema:a,isRoot:y,baseId:v,root:d,schemaPath:"",errSchemaPath:"#",errorPath:'""',MissingRefError:r.MissingRef,RULES:$,validate:s,util:t,resolve:e,resolveRef:F,usePattern:L,useDefault:M,useCustomRule:q,opts:w,formats:C,logger:b.logger,self:b});R=f(x,p)+f(k,l)+f(S,h)+f(T,m)+R,w.processCode&&(R=w.processCode(R,a));try{_=new Function("self","RULES","formats","root","refVal","defaults","customRules","equal","ucs2length","ValidationError",R)(b,$,C,g,x,S,T,n,i,o),x[0]=_}catch(e){throw b.logger.error("Error compiling schema, function code:",R),e}return _.schema=a,_.errors=null,_.refs=P,_.refVal=x,_.root=y?_:d,E&&(_.$async=!0),!0===w.sourceCode&&(_.source={code:R,patterns:k,defaults:S}),_}function F(t,r,a){r=e.url(t,r);var s,i,n=P[r];if(void 0!==n)return D(s=x[n],i="refVal["+n+"]");if(!a&&g.refs){var o=g.refs[r];if(void 0!==o)return D(s=g.refVal[o],i=Z(r,s))}i=Z(r);var d=e.call(b,N,g,r);if(void 0===d){var c=y&&y[r];c&&(d=e.inlineRef(c,w.inlineRefs)?c:u.call(b,c,g,y,t))}if(void 0!==d)return function(e,t){var r=P[e];x[r]=t}(r,d),D(d,i);!function(e){delete P[e]}(r)}function Z(e,t){var r=x.length;return x[r]=t,P[e]=r,"refVal"+r}function D(e,t){return"object"==typeof e||"boolean"==typeof e?{code:t,schema:e,inline:!0}:{code:t,$async:e&&!!e.$async}}function L(e){var t=E[e];return void 0===t&&(t=E[e]=k.length,k[t]=e),"pattern"+t}function M(e){switch(typeof e){case"boolean":case"number":return""+e;case"string":return t.toQuotedString(e);case"object":if(null===e)return"null";var r=a(e),s=R[r];return void 0===s&&(s=R[r]=S.length,S[s]=e),"default"+s}}function q(e,t,r,a){if(!1!==b._opts.validateSchema){var s=e.definition.dependencies;if(s&&!s.every(function(e){return Object.prototype.hasOwnProperty.call(r,e)}))throw new Error("parent schema must have all required keywords: "+s.join(","));var i=e.definition.validateSchema;if(i)if(!i(t)){var n="keyword schema is invalid: "+b.errorsText(i.errors);if("log"!=b._opts.validateSchema)throw new Error(n);b.logger.error(n)}}var o,d=e.definition.compile,c=e.definition.inline,u=e.definition.macro;if(d)o=d.call(b,t,r,a);else if(u)o=u.call(b,t,r,a),!1!==w.validateSchema&&b.validateSchema(o,!0);else if(c)o=c.call(b,a,e.keyword,t,r);else if(!(o=e.definition.validate))return;if(void 0===o)throw new Error('custom keyword "'+e.keyword+'"failed to compile');var l=T.length;return T[l]=o,{code:"customRule"+l,validate:o}}},Nn}var Hn,Un,Qn,Kn,Bn,Wn,Jn,Gn,Yn,Xn,eo,to,ro,ao,so,io,no,oo,co,uo,lo,ho,po,mo,fo,vo,go,yo,_o,bo,wo,xo,Po,ko,Eo,So,Ro,To,Ao,Oo,Co,$o,jo,Io,No,Fo,Zo,Do,Lo,Mo,qo,zo,Vo,Ho,Uo,Qo,Ko,Bo,Wo,Jo={exports:{}};function Go(){return go?vo:(go=1,vo=function(e,t,r){var a,s=" ",i=e.level,n=e.dataLevel,o=e.schema[t],d=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,u=!e.opts.allErrors,l="data"+(n||""),h=e.opts.$data&&o&&o.$data;h?(s+=" var schema"+i+" = "+e.util.getData(o.$data,n,e.dataPathArr)+"; ",a="schema"+i):a=o;var p="maximum"==t,m=p?"exclusiveMaximum":"exclusiveMinimum",f=e.schema[m],v=e.opts.$data&&f&&f.$data,g=p?"<":">",y=p?">":"<",_=void 0;if(!h&&"number"!=typeof o&&void 0!==o)throw new Error(t+" must be number");if(!v&&void 0!==f&&"number"!=typeof f&&"boolean"!=typeof f)throw new Error(m+" must be number or boolean");if(v){var b=e.util.getData(f.$data,n,e.dataPathArr),w="exclusive"+i,x="exclType"+i,P="exclIsNumber"+i,k="' + "+(R="op"+i)+" + '";s+=" var schemaExcl"+i+" = "+b+"; ",s+=" var "+w+"; var "+x+" = typeof "+(b="schemaExcl"+i)+"; if ("+x+" != 'boolean' && "+x+" != 'undefined' && "+x+" != 'number') { ";var E;_=m;(E=E||[]).push(s),s="",!1!==e.createErrors?(s+=" { keyword: '"+(_||"_exclusiveLimit")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: {} ",!1!==e.opts.messages&&(s+=" , message: '"+m+" should be boolean' "),e.opts.verbose&&(s+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+l+" "),s+=" } "):s+=" {} ";var S=s;s=E.pop(),!e.compositeRule&&u?e.async?s+=" throw new ValidationError(["+S+"]); ":s+=" validate.errors = ["+S+"]; return false; ":s+=" var err = "+S+";  if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",s+=" } else if ( ",h&&(s+=" ("+a+" !== undefined && typeof "+a+" != 'number') || "),s+=" "+x+" == 'number' ? ( ("+w+" = "+a+" === undefined || "+b+" "+g+"= "+a+") ? "+l+" "+y+"= "+b+" : "+l+" "+y+" "+a+" ) : ( ("+w+" = "+b+" === true) ? "+l+" "+y+"= "+a+" : "+l+" "+y+" "+a+" ) || "+l+" !== "+l+") { var op"+i+" = "+w+" ? '"+g+"' : '"+g+"='; ",void 0===o&&(_=m,c=e.errSchemaPath+"/"+m,a=b,h=v)}else{k=g;if((P="number"==typeof f)&&h){var R="'"+k+"'";s+=" if ( ",h&&(s+=" ("+a+" !== undefined && typeof "+a+" != 'number') || "),s+=" ( "+a+" === undefined || "+f+" "+g+"= "+a+" ? "+l+" "+y+"= "+f+" : "+l+" "+y+" "+a+" ) || "+l+" !== "+l+") { "}else{P&&void 0===o?(w=!0,_=m,c=e.errSchemaPath+"/"+m,a=f,y+="="):(P&&(a=Math[p?"min":"max"](f,o)),f===(!P||a)?(w=!0,_=m,c=e.errSchemaPath+"/"+m,y+="="):(w=!1,k+="="));R="'"+k+"'";s+=" if ( ",h&&(s+=" ("+a+" !== undefined && typeof "+a+" != 'number') || "),s+=" "+l+" "+y+" "+a+" || "+l+" !== "+l+") { "}}_=_||t,(E=E||[]).push(s),s="",!1!==e.createErrors?(s+=" { keyword: '"+(_||"_limit")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { comparison: "+R+", limit: "+a+", exclusive: "+w+" } ",!1!==e.opts.messages&&(s+=" , message: 'should be "+k+" ",s+=h?"' + "+a:a+"'"),e.opts.verbose&&(s+=" , schema:  ",s+=h?"validate.schema"+d:""+o,s+="         , parentSchema: validate.schema"+e.schemaPath+" , data: "+l+" "),s+=" } "):s+=" {} ";S=s;return s=E.pop(),!e.compositeRule&&u?e.async?s+=" throw new ValidationError(["+S+"]); ":s+=" validate.errors = ["+S+"]; return false; ":s+=" var err = "+S+";  if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",s+=" } ",u&&(s+=" else { "),s})}function Yo(){return _o?yo:(_o=1,yo=function(e,t,r){var a,s=" ",i=e.level,n=e.dataLevel,o=e.schema[t],d=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,u=!e.opts.allErrors,l="data"+(n||""),h=e.opts.$data&&o&&o.$data;if(h?(s+=" var schema"+i+" = "+e.util.getData(o.$data,n,e.dataPathArr)+"; ",a="schema"+i):a=o,!h&&"number"!=typeof o)throw new Error(t+" must be number");s+="if ( ",h&&(s+=" ("+a+" !== undefined && typeof "+a+" != 'number') || "),s+=" "+l+".length "+("maxItems"==t?">":"<")+" "+a+") { ";var p=t,m=m||[];m.push(s),s="",!1!==e.createErrors?(s+=" { keyword: '"+(p||"_limitItems")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { limit: "+a+" } ",!1!==e.opts.messages&&(s+=" , message: 'should NOT have ",s+="maxItems"==t?"more":"fewer",s+=" than ",s+=h?"' + "+a+" + '":""+o,s+=" items' "),e.opts.verbose&&(s+=" , schema:  ",s+=h?"validate.schema"+d:""+o,s+="         , parentSchema: validate.schema"+e.schemaPath+" , data: "+l+" "),s+=" } "):s+=" {} ";var f=s;return s=m.pop(),!e.compositeRule&&u?e.async?s+=" throw new ValidationError(["+f+"]); ":s+=" validate.errors = ["+f+"]; return false; ":s+=" var err = "+f+";  if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",s+="} ",u&&(s+=" else { "),s})}function Xo(){return wo?bo:(wo=1,bo=function(e,t,r){var a,s=" ",i=e.level,n=e.dataLevel,o=e.schema[t],d=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,u=!e.opts.allErrors,l="data"+(n||""),h=e.opts.$data&&o&&o.$data;if(h?(s+=" var schema"+i+" = "+e.util.getData(o.$data,n,e.dataPathArr)+"; ",a="schema"+i):a=o,!h&&"number"!=typeof o)throw new Error(t+" must be number");var p="maxLength"==t?">":"<";s+="if ( ",h&&(s+=" ("+a+" !== undefined && typeof "+a+" != 'number') || "),!1===e.opts.unicode?s+=" "+l+".length ":s+=" ucs2length("+l+") ",s+=" "+p+" "+a+") { ";var m=t,f=f||[];f.push(s),s="",!1!==e.createErrors?(s+=" { keyword: '"+(m||"_limitLength")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { limit: "+a+" } ",!1!==e.opts.messages&&(s+=" , message: 'should NOT be ",s+="maxLength"==t?"longer":"shorter",s+=" than ",s+=h?"' + "+a+" + '":""+o,s+=" characters' "),e.opts.verbose&&(s+=" , schema:  ",s+=h?"validate.schema"+d:""+o,s+="         , parentSchema: validate.schema"+e.schemaPath+" , data: "+l+" "),s+=" } "):s+=" {} ";var v=s;return s=f.pop(),!e.compositeRule&&u?e.async?s+=" throw new ValidationError(["+v+"]); ":s+=" validate.errors = ["+v+"]; return false; ":s+=" var err = "+v+";  if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",s+="} ",u&&(s+=" else { "),s})}function ed(){return Po?xo:(Po=1,xo=function(e,t,r){var a,s=" ",i=e.level,n=e.dataLevel,o=e.schema[t],d=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,u=!e.opts.allErrors,l="data"+(n||""),h=e.opts.$data&&o&&o.$data;if(h?(s+=" var schema"+i+" = "+e.util.getData(o.$data,n,e.dataPathArr)+"; ",a="schema"+i):a=o,!h&&"number"!=typeof o)throw new Error(t+" must be number");s+="if ( ",h&&(s+=" ("+a+" !== undefined && typeof "+a+" != 'number') || "),s+=" Object.keys("+l+").length "+("maxProperties"==t?">":"<")+" "+a+") { ";var p=t,m=m||[];m.push(s),s="",!1!==e.createErrors?(s+=" { keyword: '"+(p||"_limitProperties")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { limit: "+a+" } ",!1!==e.opts.messages&&(s+=" , message: 'should NOT have ",s+="maxProperties"==t?"more":"fewer",s+=" than ",s+=h?"' + "+a+" + '":""+o,s+=" properties' "),e.opts.verbose&&(s+=" , schema:  ",s+=h?"validate.schema"+d:""+o,s+="         , parentSchema: validate.schema"+e.schemaPath+" , data: "+l+" "),s+=" } "):s+=" {} ";var f=s;return s=m.pop(),!e.compositeRule&&u?e.async?s+=" throw new ValidationError(["+f+"]); ":s+=" validate.errors = ["+f+"]; return false; ":s+=" var err = "+f+";  if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",s+="} ",u&&(s+=" else { "),s})}function td(){if(Vo)return zo;Vo=1;var e=qo?Mo:(qo=1,Mo={$ref:Bn?Kn:(Bn=1,Kn=function(e,t,r){var a,s,i=" ",n=e.level,o=e.dataLevel,d=e.schema[t],c=e.errSchemaPath+"/"+t,u=!e.opts.allErrors,l="data"+(o||""),h="valid"+n;if("#"==d||"#/"==d)e.isRoot?(a=e.async,s="validate"):(a=!0===e.root.schema.$async,s="root.refVal[0]");else{var p=e.resolveRef(e.baseId,d,e.isRoot);if(void 0===p){var m=e.MissingRefError.message(e.baseId,d);if("fail"==e.opts.missingRefs){e.logger.error(m),(y=y||[]).push(i),i="",!1!==e.createErrors?(i+=" { keyword: '$ref' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { ref: '"+e.util.escapeQuotes(d)+"' } ",!1!==e.opts.messages&&(i+=" , message: 'can\\'t resolve reference "+e.util.escapeQuotes(d)+"' "),e.opts.verbose&&(i+=" , schema: "+e.util.toQuotedString(d)+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+l+" "),i+=" } "):i+=" {} ";var f=i;i=y.pop(),!e.compositeRule&&u?e.async?i+=" throw new ValidationError(["+f+"]); ":i+=" validate.errors = ["+f+"]; return false; ":i+=" var err = "+f+";  if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",u&&(i+=" if (false) { ")}else{if("ignore"!=e.opts.missingRefs)throw new e.MissingRefError(e.baseId,d,m);e.logger.warn(m),u&&(i+=" if (true) { ")}}else if(p.inline){var v=e.util.copy(e);v.level++;var g="valid"+v.level;v.schema=p.schema,v.schemaPath="",v.errSchemaPath=d,i+=" "+e.validate(v).replace(/validate\.schema/g,p.code)+" ",u&&(i+=" if ("+g+") { ")}else a=!0===p.$async||e.async&&!1!==p.$async,s=p.code}if(s){var y;(y=y||[]).push(i),i="",e.opts.passContext?i+=" "+s+".call(this, ":i+=" "+s+"( ",i+=" "+l+", (dataPath || '')",'""'!=e.errorPath&&(i+=" + "+e.errorPath);var _=i+=" , "+(o?"data"+(o-1||""):"parentData")+" , "+(o?e.dataPathArr[o]:"parentDataProperty")+", rootData)  ";if(i=y.pop(),a){if(!e.async)throw new Error("async schema referenced by sync schema");u&&(i+=" var "+h+"; "),i+=" try { await "+_+"; ",u&&(i+=" "+h+" = true; "),i+=" } catch (e) { if (!(e instanceof ValidationError)) throw e; if (vErrors === null) vErrors = e.errors; else vErrors = vErrors.concat(e.errors); errors = vErrors.length; ",u&&(i+=" "+h+" = false; "),i+=" } ",u&&(i+=" if ("+h+") { ")}else i+=" if (!"+_+") { if (vErrors === null) vErrors = "+s+".errors; else vErrors = vErrors.concat("+s+".errors); errors = vErrors.length; } ",u&&(i+=" else { ")}return i}),allOf:Jn?Wn:(Jn=1,Wn=function(e,t,r){var a=" ",s=e.schema[t],i=e.schemaPath+e.util.getProperty(t),n=e.errSchemaPath+"/"+t,o=!e.opts.allErrors,d=e.util.copy(e),c="";d.level++;var u="valid"+d.level,l=d.baseId,h=!0,p=s;if(p)for(var m,f=-1,v=p.length-1;f<v;)m=p[f+=1],(e.opts.strictKeywords?"object"==typeof m&&Object.keys(m).length>0||!1===m:e.util.schemaHasRules(m,e.RULES.all))&&(h=!1,d.schema=m,d.schemaPath=i+"["+f+"]",d.errSchemaPath=n+"/"+f,a+="  "+e.validate(d)+" ",d.baseId=l,o&&(a+=" if ("+u+") { ",c+="}"));return o&&(a+=h?" if (true) { ":" "+c.slice(0,-1)+" "),a}),anyOf:Yn?Gn:(Yn=1,Gn=function(e,t,r){var a=" ",s=e.level,i=e.dataLevel,n=e.schema[t],o=e.schemaPath+e.util.getProperty(t),d=e.errSchemaPath+"/"+t,c=!e.opts.allErrors,u="data"+(i||""),l="valid"+s,h="errs__"+s,p=e.util.copy(e),m="";p.level++;var f="valid"+p.level;if(n.every(function(t){return e.opts.strictKeywords?"object"==typeof t&&Object.keys(t).length>0||!1===t:e.util.schemaHasRules(t,e.RULES.all)})){var v=p.baseId;a+=" var "+h+" = errors; var "+l+" = false;  ";var g=e.compositeRule;e.compositeRule=p.compositeRule=!0;var y=n;if(y)for(var _,b=-1,w=y.length-1;b<w;)_=y[b+=1],p.schema=_,p.schemaPath=o+"["+b+"]",p.errSchemaPath=d+"/"+b,a+="  "+e.validate(p)+" ",p.baseId=v,a+=" "+l+" = "+l+" || "+f+"; if (!"+l+") { ",m+="}";e.compositeRule=p.compositeRule=g,a+=" "+m+" if (!"+l+") {   var err =   ",!1!==e.createErrors?(a+=" { keyword: 'anyOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(d)+" , params: {} ",!1!==e.opts.messages&&(a+=" , message: 'should match some schema in anyOf' "),e.opts.verbose&&(a+=" , schema: validate.schema"+o+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),a+=" } "):a+=" {} ",a+=";  if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&c&&(e.async?a+=" throw new ValidationError(vErrors); ":a+=" validate.errors = vErrors; return false; "),a+=" } else {  errors = "+h+"; if (vErrors !== null) { if ("+h+") vErrors.length = "+h+"; else vErrors = null; } ",e.opts.allErrors&&(a+=" } ")}else c&&(a+=" if (true) { ");return a}),$comment:eo?Xn:(eo=1,Xn=function(e,t,r){var a=" ",s=e.schema[t],i=e.errSchemaPath+"/"+t;e.opts.allErrors;var n=e.util.toQuotedString(s);return!0===e.opts.$comment?a+=" console.log("+n+");":"function"==typeof e.opts.$comment&&(a+=" self._opts.$comment("+n+", "+e.util.toQuotedString(i)+", validate.root.schema);"),a}),const:ro?to:(ro=1,to=function(e,t,r){var a=" ",s=e.level,i=e.dataLevel,n=e.schema[t],o=e.schemaPath+e.util.getProperty(t),d=e.errSchemaPath+"/"+t,c=!e.opts.allErrors,u="data"+(i||""),l="valid"+s,h=e.opts.$data&&n&&n.$data;h&&(a+=" var schema"+s+" = "+e.util.getData(n.$data,i,e.dataPathArr)+"; "),h||(a+=" var schema"+s+" = validate.schema"+o+";"),a+="var "+l+" = equal("+u+", schema"+s+"); if (!"+l+") {   ";var p=p||[];p.push(a),a="",!1!==e.createErrors?(a+=" { keyword: 'const' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(d)+" , params: { allowedValue: schema"+s+" } ",!1!==e.opts.messages&&(a+=" , message: 'should be equal to constant' "),e.opts.verbose&&(a+=" , schema: validate.schema"+o+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),a+=" } "):a+=" {} ";var m=a;return a=p.pop(),!e.compositeRule&&c?e.async?a+=" throw new ValidationError(["+m+"]); ":a+=" validate.errors = ["+m+"]; return false; ":a+=" var err = "+m+";  if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+=" }",c&&(a+=" else { "),a}),contains:so?ao:(so=1,ao=function(e,t,r){var a=" ",s=e.level,i=e.dataLevel,n=e.schema[t],o=e.schemaPath+e.util.getProperty(t),d=e.errSchemaPath+"/"+t,c=!e.opts.allErrors,u="data"+(i||""),l="valid"+s,h="errs__"+s,p=e.util.copy(e);p.level++;var m="valid"+p.level,f="i"+s,v=p.dataLevel=e.dataLevel+1,g="data"+v,y=e.baseId,_=e.opts.strictKeywords?"object"==typeof n&&Object.keys(n).length>0||!1===n:e.util.schemaHasRules(n,e.RULES.all);if(a+="var "+h+" = errors;var "+l+";",_){var b=e.compositeRule;e.compositeRule=p.compositeRule=!0,p.schema=n,p.schemaPath=o,p.errSchemaPath=d,a+=" var "+m+" = false; for (var "+f+" = 0; "+f+" < "+u+".length; "+f+"++) { ",p.errorPath=e.util.getPathExpr(e.errorPath,f,e.opts.jsonPointers,!0);var w=u+"["+f+"]";p.dataPathArr[v]=f;var x=e.validate(p);p.baseId=y,e.util.varOccurences(x,g)<2?a+=" "+e.util.varReplace(x,g,w)+" ":a+=" var "+g+" = "+w+"; "+x+" ",a+=" if ("+m+") break; }  ",e.compositeRule=p.compositeRule=b,a+="  if (!"+m+") {"}else a+=" if ("+u+".length == 0) {";var P=P||[];P.push(a),a="",!1!==e.createErrors?(a+=" { keyword: 'contains' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(d)+" , params: {} ",!1!==e.opts.messages&&(a+=" , message: 'should contain a valid item' "),e.opts.verbose&&(a+=" , schema: validate.schema"+o+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),a+=" } "):a+=" {} ";var k=a;return a=P.pop(),!e.compositeRule&&c?e.async?a+=" throw new ValidationError(["+k+"]); ":a+=" validate.errors = ["+k+"]; return false; ":a+=" var err = "+k+";  if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+=" } else { ",_&&(a+="  errors = "+h+"; if (vErrors !== null) { if ("+h+") vErrors.length = "+h+"; else vErrors = null; } "),e.opts.allErrors&&(a+=" } "),a}),dependencies:no?io:(no=1,io=function(e,t,r){var a=" ",s=e.level,i=e.dataLevel,n=e.schema[t],o=e.schemaPath+e.util.getProperty(t),d=e.errSchemaPath+"/"+t,c=!e.opts.allErrors,u="data"+(i||""),l="errs__"+s,h=e.util.copy(e),p="";h.level++;var m="valid"+h.level,f={},v={},g=e.opts.ownProperties;for(w in n)if("__proto__"!=w){var y=n[w],_=Array.isArray(y)?v:f;_[w]=y}a+="var "+l+" = errors;";var b=e.errorPath;for(var w in a+="var missing"+s+";",v)if((_=v[w]).length){if(a+=" if ( "+u+e.util.getProperty(w)+" !== undefined ",g&&(a+=" && Object.prototype.hasOwnProperty.call("+u+", '"+e.util.escapeQuotes(w)+"') "),c){a+=" && ( ";var x=_;if(x)for(var P=-1,k=x.length-1;P<k;)O=x[P+=1],P&&(a+=" || "),a+=" ( ( "+(I=u+(j=e.util.getProperty(O)))+" === undefined ",g&&(a+=" || ! Object.prototype.hasOwnProperty.call("+u+", '"+e.util.escapeQuotes(O)+"') "),a+=") && (missing"+s+" = "+e.util.toQuotedString(e.opts.jsonPointers?O:j)+") ) ";a+=")) {  ";var E="missing"+s,S="' + "+E+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.opts.jsonPointers?e.util.getPathExpr(b,E,!0):b+" + "+E);var R=R||[];R.push(a),a="",!1!==e.createErrors?(a+=" { keyword: 'dependencies' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(d)+" , params: { property: '"+e.util.escapeQuotes(w)+"', missingProperty: '"+S+"', depsCount: "+_.length+", deps: '"+e.util.escapeQuotes(1==_.length?_[0]:_.join(", "))+"' } ",!1!==e.opts.messages&&(a+=" , message: 'should have ",1==_.length?a+="property "+e.util.escapeQuotes(_[0]):a+="properties "+e.util.escapeQuotes(_.join(", ")),a+=" when property "+e.util.escapeQuotes(w)+" is present' "),e.opts.verbose&&(a+=" , schema: validate.schema"+o+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),a+=" } "):a+=" {} ";var T=a;a=R.pop(),!e.compositeRule&&c?e.async?a+=" throw new ValidationError(["+T+"]); ":a+=" validate.errors = ["+T+"]; return false; ":a+=" var err = "+T+";  if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}else{a+=" ) { ";var A=_;if(A)for(var O,C=-1,$=A.length-1;C<$;){O=A[C+=1];var j=e.util.getProperty(O),I=(S=e.util.escapeQuotes(O),u+j);e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPath(b,O,e.opts.jsonPointers)),a+=" if ( "+I+" === undefined ",g&&(a+=" || ! Object.prototype.hasOwnProperty.call("+u+", '"+e.util.escapeQuotes(O)+"') "),a+=") {  var err =   ",!1!==e.createErrors?(a+=" { keyword: 'dependencies' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(d)+" , params: { property: '"+e.util.escapeQuotes(w)+"', missingProperty: '"+S+"', depsCount: "+_.length+", deps: '"+e.util.escapeQuotes(1==_.length?_[0]:_.join(", "))+"' } ",!1!==e.opts.messages&&(a+=" , message: 'should have ",1==_.length?a+="property "+e.util.escapeQuotes(_[0]):a+="properties "+e.util.escapeQuotes(_.join(", ")),a+=" when property "+e.util.escapeQuotes(w)+" is present' "),e.opts.verbose&&(a+=" , schema: validate.schema"+o+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),a+=" } "):a+=" {} ",a+=";  if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } "}}a+=" }   ",c&&(p+="}",a+=" else { ")}e.errorPath=b;var N=h.baseId;for(var w in f)y=f[w],(e.opts.strictKeywords?"object"==typeof y&&Object.keys(y).length>0||!1===y:e.util.schemaHasRules(y,e.RULES.all))&&(a+=" "+m+" = true; if ( "+u+e.util.getProperty(w)+" !== undefined ",g&&(a+=" && Object.prototype.hasOwnProperty.call("+u+", '"+e.util.escapeQuotes(w)+"') "),a+=") { ",h.schema=y,h.schemaPath=o+e.util.getProperty(w),h.errSchemaPath=d+"/"+e.util.escapeFragment(w),a+="  "+e.validate(h)+" ",h.baseId=N,a+=" }  ",c&&(a+=" if ("+m+") { ",p+="}"));return c&&(a+="   "+p+" if ("+l+" == errors) {"),a}),enum:co?oo:(co=1,oo=function(e,t,r){var a=" ",s=e.level,i=e.dataLevel,n=e.schema[t],o=e.schemaPath+e.util.getProperty(t),d=e.errSchemaPath+"/"+t,c=!e.opts.allErrors,u="data"+(i||""),l="valid"+s,h=e.opts.$data&&n&&n.$data;h&&(a+=" var schema"+s+" = "+e.util.getData(n.$data,i,e.dataPathArr)+"; ");var p="i"+s,m="schema"+s;h||(a+=" var "+m+" = validate.schema"+o+";"),a+="var "+l+";",h&&(a+=" if (schema"+s+" === undefined) "+l+" = true; else if (!Array.isArray(schema"+s+")) "+l+" = false; else {"),a+=l+" = false;for (var "+p+"=0; "+p+"<"+m+".length; "+p+"++) if (equal("+u+", "+m+"["+p+"])) { "+l+" = true; break; }",h&&(a+="  }  "),a+=" if (!"+l+") {   ";var f=f||[];f.push(a),a="",!1!==e.createErrors?(a+=" { keyword: 'enum' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(d)+" , params: { allowedValues: schema"+s+" } ",!1!==e.opts.messages&&(a+=" , message: 'should be equal to one of the allowed values' "),e.opts.verbose&&(a+=" , schema: validate.schema"+o+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),a+=" } "):a+=" {} ";var v=a;return a=f.pop(),!e.compositeRule&&c?e.async?a+=" throw new ValidationError(["+v+"]); ":a+=" validate.errors = ["+v+"]; return false; ":a+=" var err = "+v+";  if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+=" }",c&&(a+=" else { "),a}),format:lo?uo:(lo=1,uo=function(e,t,r){var a=" ",s=e.level,i=e.dataLevel,n=e.schema[t],o=e.schemaPath+e.util.getProperty(t),d=e.errSchemaPath+"/"+t,c=!e.opts.allErrors,u="data"+(i||"");if(!1===e.opts.format)return c&&(a+=" if (true) { "),a;var l,h=e.opts.$data&&n&&n.$data;h?(a+=" var schema"+s+" = "+e.util.getData(n.$data,i,e.dataPathArr)+"; ",l="schema"+s):l=n;var p=e.opts.unknownFormats,m=Array.isArray(p);if(h)a+=" var "+(f="format"+s)+" = formats["+l+"]; var "+(v="isObject"+s)+" = typeof "+f+" == 'object' && !("+f+" instanceof RegExp) && "+f+".validate; var "+(g="formatType"+s)+" = "+v+" && "+f+".type || 'string'; if ("+v+") { ",e.async&&(a+=" var async"+s+" = "+f+".async; "),a+=" "+f+" = "+f+".validate; } if (  ",h&&(a+=" ("+l+" !== undefined && typeof "+l+" != 'string') || "),a+=" (","ignore"!=p&&(a+=" ("+l+" && !"+f+" ",m&&(a+=" && self._opts.unknownFormats.indexOf("+l+") == -1 "),a+=") || "),a+=" ("+f+" && "+g+" == '"+r+"' && !(typeof "+f+" == 'function' ? ",e.async?a+=" (async"+s+" ? await "+f+"("+u+") : "+f+"("+u+")) ":a+=" "+f+"("+u+") ",a+=" : "+f+".test("+u+"))))) {";else{var f;if(!(f=e.formats[n])){if("ignore"==p)return e.logger.warn('unknown format "'+n+'" ignored in schema at path "'+e.errSchemaPath+'"'),c&&(a+=" if (true) { "),a;if(m&&p.indexOf(n)>=0)return c&&(a+=" if (true) { "),a;throw new Error('unknown format "'+n+'" is used in schema at path "'+e.errSchemaPath+'"')}var v,g=(v="object"==typeof f&&!(f instanceof RegExp)&&f.validate)&&f.type||"string";if(v){var y=!0===f.async;f=f.validate}if(g!=r)return c&&(a+=" if (true) { "),a;if(y){if(!e.async)throw new Error("async format in sync schema");a+=" if (!(await "+(_="formats"+e.util.getProperty(n)+".validate")+"("+u+"))) { "}else{a+=" if (! ";var _="formats"+e.util.getProperty(n);v&&(_+=".validate"),a+="function"==typeof f?" "+_+"("+u+") ":" "+_+".test("+u+") ",a+=") { "}}var b=b||[];b.push(a),a="",!1!==e.createErrors?(a+=" { keyword: 'format' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(d)+" , params: { format:  ",a+=h?""+l:""+e.util.toQuotedString(n),a+="  } ",!1!==e.opts.messages&&(a+=" , message: 'should match format \"",a+=h?"' + "+l+" + '":""+e.util.escapeQuotes(n),a+="\"' "),e.opts.verbose&&(a+=" , schema:  ",a+=h?"validate.schema"+o:""+e.util.toQuotedString(n),a+="         , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),a+=" } "):a+=" {} ";var w=a;return a=b.pop(),!e.compositeRule&&c?e.async?a+=" throw new ValidationError(["+w+"]); ":a+=" validate.errors = ["+w+"]; return false; ":a+=" var err = "+w+";  if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+=" } ",c&&(a+=" else { "),a}),if:po?ho:(po=1,ho=function(e,t,r){var a=" ",s=e.level,i=e.dataLevel,n=e.schema[t],o=e.schemaPath+e.util.getProperty(t),d=e.errSchemaPath+"/"+t,c=!e.opts.allErrors,u="data"+(i||""),l="valid"+s,h="errs__"+s,p=e.util.copy(e);p.level++;var m="valid"+p.level,f=e.schema.then,v=e.schema.else,g=void 0!==f&&(e.opts.strictKeywords?"object"==typeof f&&Object.keys(f).length>0||!1===f:e.util.schemaHasRules(f,e.RULES.all)),y=void 0!==v&&(e.opts.strictKeywords?"object"==typeof v&&Object.keys(v).length>0||!1===v:e.util.schemaHasRules(v,e.RULES.all)),_=p.baseId;if(g||y){var b;p.createErrors=!1,p.schema=n,p.schemaPath=o,p.errSchemaPath=d,a+=" var "+h+" = errors; var "+l+" = true;  ";var w=e.compositeRule;e.compositeRule=p.compositeRule=!0,a+="  "+e.validate(p)+" ",p.baseId=_,p.createErrors=!0,a+="  errors = "+h+"; if (vErrors !== null) { if ("+h+") vErrors.length = "+h+"; else vErrors = null; }  ",e.compositeRule=p.compositeRule=w,g?(a+=" if ("+m+") {  ",p.schema=e.schema.then,p.schemaPath=e.schemaPath+".then",p.errSchemaPath=e.errSchemaPath+"/then",a+="  "+e.validate(p)+" ",p.baseId=_,a+=" "+l+" = "+m+"; ",g&&y?a+=" var "+(b="ifClause"+s)+" = 'then'; ":b="'then'",a+=" } ",y&&(a+=" else { ")):a+=" if (!"+m+") { ",y&&(p.schema=e.schema.else,p.schemaPath=e.schemaPath+".else",p.errSchemaPath=e.errSchemaPath+"/else",a+="  "+e.validate(p)+" ",p.baseId=_,a+=" "+l+" = "+m+"; ",g&&y?a+=" var "+(b="ifClause"+s)+" = 'else'; ":b="'else'",a+=" } "),a+=" if (!"+l+") {   var err =   ",!1!==e.createErrors?(a+=" { keyword: 'if' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(d)+" , params: { failingKeyword: "+b+" } ",!1!==e.opts.messages&&(a+=" , message: 'should match \"' + "+b+" + '\" schema' "),e.opts.verbose&&(a+=" , schema: validate.schema"+o+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),a+=" } "):a+=" {} ",a+=";  if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&c&&(e.async?a+=" throw new ValidationError(vErrors); ":a+=" validate.errors = vErrors; return false; "),a+=" }   ",c&&(a+=" else { ")}else c&&(a+=" if (true) { ");return a}),items:fo?mo:(fo=1,mo=function(e,t,r){var a=" ",s=e.level,i=e.dataLevel,n=e.schema[t],o=e.schemaPath+e.util.getProperty(t),d=e.errSchemaPath+"/"+t,c=!e.opts.allErrors,u="data"+(i||""),l="valid"+s,h="errs__"+s,p=e.util.copy(e),m="";p.level++;var f="valid"+p.level,v="i"+s,g=p.dataLevel=e.dataLevel+1,y="data"+g,_=e.baseId;if(a+="var "+h+" = errors;var "+l+";",Array.isArray(n)){var b=e.schema.additionalItems;if(!1===b){a+=" "+l+" = "+u+".length <= "+n.length+"; ";var w=d;d=e.errSchemaPath+"/additionalItems",a+="  if (!"+l+") {   ";var x=x||[];x.push(a),a="",!1!==e.createErrors?(a+=" { keyword: 'additionalItems' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(d)+" , params: { limit: "+n.length+" } ",!1!==e.opts.messages&&(a+=" , message: 'should NOT have more than "+n.length+" items' "),e.opts.verbose&&(a+=" , schema: false , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),a+=" } "):a+=" {} ";var P=a;a=x.pop(),!e.compositeRule&&c?e.async?a+=" throw new ValidationError(["+P+"]); ":a+=" validate.errors = ["+P+"]; return false; ":a+=" var err = "+P+";  if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+=" } ",d=w,c&&(m+="}",a+=" else { ")}var k=n;if(k)for(var E,S=-1,R=k.length-1;S<R;)if(E=k[S+=1],e.opts.strictKeywords?"object"==typeof E&&Object.keys(E).length>0||!1===E:e.util.schemaHasRules(E,e.RULES.all)){a+=" "+f+" = true; if ("+u+".length > "+S+") { ";var T=u+"["+S+"]";p.schema=E,p.schemaPath=o+"["+S+"]",p.errSchemaPath=d+"/"+S,p.errorPath=e.util.getPathExpr(e.errorPath,S,e.opts.jsonPointers,!0),p.dataPathArr[g]=S;var A=e.validate(p);p.baseId=_,e.util.varOccurences(A,y)<2?a+=" "+e.util.varReplace(A,y,T)+" ":a+=" var "+y+" = "+T+"; "+A+" ",a+=" }  ",c&&(a+=" if ("+f+") { ",m+="}")}"object"==typeof b&&(e.opts.strictKeywords?"object"==typeof b&&Object.keys(b).length>0||!1===b:e.util.schemaHasRules(b,e.RULES.all))&&(p.schema=b,p.schemaPath=e.schemaPath+".additionalItems",p.errSchemaPath=e.errSchemaPath+"/additionalItems",a+=" "+f+" = true; if ("+u+".length > "+n.length+") {  for (var "+v+" = "+n.length+"; "+v+" < "+u+".length; "+v+"++) { ",p.errorPath=e.util.getPathExpr(e.errorPath,v,e.opts.jsonPointers,!0),T=u+"["+v+"]",p.dataPathArr[g]=v,A=e.validate(p),p.baseId=_,e.util.varOccurences(A,y)<2?a+=" "+e.util.varReplace(A,y,T)+" ":a+=" var "+y+" = "+T+"; "+A+" ",c&&(a+=" if (!"+f+") break; "),a+=" } }  ",c&&(a+=" if ("+f+") { ",m+="}"))}else(e.opts.strictKeywords?"object"==typeof n&&Object.keys(n).length>0||!1===n:e.util.schemaHasRules(n,e.RULES.all))&&(p.schema=n,p.schemaPath=o,p.errSchemaPath=d,a+="  for (var "+v+" = 0; "+v+" < "+u+".length; "+v+"++) { ",p.errorPath=e.util.getPathExpr(e.errorPath,v,e.opts.jsonPointers,!0),T=u+"["+v+"]",p.dataPathArr[g]=v,A=e.validate(p),p.baseId=_,e.util.varOccurences(A,y)<2?a+=" "+e.util.varReplace(A,y,T)+" ":a+=" var "+y+" = "+T+"; "+A+" ",c&&(a+=" if (!"+f+") break; "),a+=" }");return c&&(a+=" "+m+" if ("+h+" == errors) {"),a}),maximum:Go(),minimum:Go(),maxItems:Yo(),minItems:Yo(),maxLength:Xo(),minLength:Xo(),maxProperties:ed(),minProperties:ed(),multipleOf:Eo?ko:(Eo=1,ko=function(e,t,r){var a,s=" ",i=e.level,n=e.dataLevel,o=e.schema[t],d=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,u=!e.opts.allErrors,l="data"+(n||""),h=e.opts.$data&&o&&o.$data;if(h?(s+=" var schema"+i+" = "+e.util.getData(o.$data,n,e.dataPathArr)+"; ",a="schema"+i):a=o,!h&&"number"!=typeof o)throw new Error(t+" must be number");s+="var division"+i+";if (",h&&(s+=" "+a+" !== undefined && ( typeof "+a+" != 'number' || "),s+=" (division"+i+" = "+l+" / "+a+", ",e.opts.multipleOfPrecision?s+=" Math.abs(Math.round(division"+i+") - division"+i+") > 1e-"+e.opts.multipleOfPrecision+" ":s+=" division"+i+" !== parseInt(division"+i+") ",s+=" ) ",h&&(s+="  )  "),s+=" ) {   ";var p=p||[];p.push(s),s="",!1!==e.createErrors?(s+=" { keyword: 'multipleOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { multipleOf: "+a+" } ",!1!==e.opts.messages&&(s+=" , message: 'should be multiple of ",s+=h?"' + "+a:a+"'"),e.opts.verbose&&(s+=" , schema:  ",s+=h?"validate.schema"+d:""+o,s+="         , parentSchema: validate.schema"+e.schemaPath+" , data: "+l+" "),s+=" } "):s+=" {} ";var m=s;return s=p.pop(),!e.compositeRule&&u?e.async?s+=" throw new ValidationError(["+m+"]); ":s+=" validate.errors = ["+m+"]; return false; ":s+=" var err = "+m+";  if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",s+="} ",u&&(s+=" else { "),s}),not:Ro?So:(Ro=1,So=function(e,t,r){var a=" ",s=e.level,i=e.dataLevel,n=e.schema[t],o=e.schemaPath+e.util.getProperty(t),d=e.errSchemaPath+"/"+t,c=!e.opts.allErrors,u="data"+(i||""),l="errs__"+s,h=e.util.copy(e);h.level++;var p="valid"+h.level;if(e.opts.strictKeywords?"object"==typeof n&&Object.keys(n).length>0||!1===n:e.util.schemaHasRules(n,e.RULES.all)){h.schema=n,h.schemaPath=o,h.errSchemaPath=d,a+=" var "+l+" = errors;  ";var m,f=e.compositeRule;e.compositeRule=h.compositeRule=!0,h.createErrors=!1,h.opts.allErrors&&(m=h.opts.allErrors,h.opts.allErrors=!1),a+=" "+e.validate(h)+" ",h.createErrors=!0,m&&(h.opts.allErrors=m),e.compositeRule=h.compositeRule=f,a+=" if ("+p+") {   ";var v=v||[];v.push(a),a="",!1!==e.createErrors?(a+=" { keyword: 'not' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(d)+" , params: {} ",!1!==e.opts.messages&&(a+=" , message: 'should NOT be valid' "),e.opts.verbose&&(a+=" , schema: validate.schema"+o+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),a+=" } "):a+=" {} ";var g=a;a=v.pop(),!e.compositeRule&&c?e.async?a+=" throw new ValidationError(["+g+"]); ":a+=" validate.errors = ["+g+"]; return false; ":a+=" var err = "+g+";  if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+=" } else {  errors = "+l+"; if (vErrors !== null) { if ("+l+") vErrors.length = "+l+"; else vErrors = null; } ",e.opts.allErrors&&(a+=" } ")}else a+="  var err =   ",!1!==e.createErrors?(a+=" { keyword: 'not' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(d)+" , params: {} ",!1!==e.opts.messages&&(a+=" , message: 'should NOT be valid' "),e.opts.verbose&&(a+=" , schema: validate.schema"+o+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),a+=" } "):a+=" {} ",a+=";  if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",c&&(a+=" if (false) { ");return a}),oneOf:Ao?To:(Ao=1,To=function(e,t,r){var a=" ",s=e.level,i=e.dataLevel,n=e.schema[t],o=e.schemaPath+e.util.getProperty(t),d=e.errSchemaPath+"/"+t,c=!e.opts.allErrors,u="data"+(i||""),l="valid"+s,h="errs__"+s,p=e.util.copy(e),m="";p.level++;var f="valid"+p.level,v=p.baseId,g="prevValid"+s,y="passingSchemas"+s;a+="var "+h+" = errors , "+g+" = false , "+l+" = false , "+y+" = null; ";var _=e.compositeRule;e.compositeRule=p.compositeRule=!0;var b=n;if(b)for(var w,x=-1,P=b.length-1;x<P;)w=b[x+=1],(e.opts.strictKeywords?"object"==typeof w&&Object.keys(w).length>0||!1===w:e.util.schemaHasRules(w,e.RULES.all))?(p.schema=w,p.schemaPath=o+"["+x+"]",p.errSchemaPath=d+"/"+x,a+="  "+e.validate(p)+" ",p.baseId=v):a+=" var "+f+" = true; ",x&&(a+=" if ("+f+" && "+g+") { "+l+" = false; "+y+" = ["+y+", "+x+"]; } else { ",m+="}"),a+=" if ("+f+") { "+l+" = "+g+" = true; "+y+" = "+x+"; }";return e.compositeRule=p.compositeRule=_,a+=m+"if (!"+l+") {   var err =   ",!1!==e.createErrors?(a+=" { keyword: 'oneOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(d)+" , params: { passingSchemas: "+y+" } ",!1!==e.opts.messages&&(a+=" , message: 'should match exactly one schema in oneOf' "),e.opts.verbose&&(a+=" , schema: validate.schema"+o+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),a+=" } "):a+=" {} ",a+=";  if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&c&&(e.async?a+=" throw new ValidationError(vErrors); ":a+=" validate.errors = vErrors; return false; "),a+="} else {  errors = "+h+"; if (vErrors !== null) { if ("+h+") vErrors.length = "+h+"; else vErrors = null; }",e.opts.allErrors&&(a+=" } "),a}),pattern:Co?Oo:(Co=1,Oo=function(e,t,r){var a,s=" ",i=e.level,n=e.dataLevel,o=e.schema[t],d=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,u=!e.opts.allErrors,l="data"+(n||""),h=e.opts.$data&&o&&o.$data;h?(s+=" var schema"+i+" = "+e.util.getData(o.$data,n,e.dataPathArr)+"; ",a="schema"+i):a=o,s+="if ( ",h&&(s+=" ("+a+" !== undefined && typeof "+a+" != 'string') || "),s+=" !"+(h?"(new RegExp("+a+"))":e.usePattern(o))+".test("+l+") ) {   ";var p=p||[];p.push(s),s="",!1!==e.createErrors?(s+=" { keyword: 'pattern' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { pattern:  ",s+=h?""+a:""+e.util.toQuotedString(o),s+="  } ",!1!==e.opts.messages&&(s+=" , message: 'should match pattern \"",s+=h?"' + "+a+" + '":""+e.util.escapeQuotes(o),s+="\"' "),e.opts.verbose&&(s+=" , schema:  ",s+=h?"validate.schema"+d:""+e.util.toQuotedString(o),s+="         , parentSchema: validate.schema"+e.schemaPath+" , data: "+l+" "),s+=" } "):s+=" {} ";var m=s;return s=p.pop(),!e.compositeRule&&u?e.async?s+=" throw new ValidationError(["+m+"]); ":s+=" validate.errors = ["+m+"]; return false; ":s+=" var err = "+m+";  if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",s+="} ",u&&(s+=" else { "),s}),properties:jo?$o:(jo=1,$o=function(e,t,r){var a=" ",s=e.level,i=e.dataLevel,n=e.schema[t],o=e.schemaPath+e.util.getProperty(t),d=e.errSchemaPath+"/"+t,c=!e.opts.allErrors,u="data"+(i||""),l="errs__"+s,h=e.util.copy(e),p="";h.level++;var m="valid"+h.level,f="key"+s,v="idx"+s,g=h.dataLevel=e.dataLevel+1,y="data"+g,_="dataProperties"+s,b=Object.keys(n||{}).filter(j),w=e.schema.patternProperties||{},x=Object.keys(w).filter(j),P=e.schema.additionalProperties,k=b.length||x.length,E=!1===P,S="object"==typeof P&&Object.keys(P).length,R=e.opts.removeAdditional,T=E||S||R,A=e.opts.ownProperties,O=e.baseId,C=e.schema.required;if(C&&(!e.opts.$data||!C.$data)&&C.length<e.opts.loopRequired)var $=e.util.toHash(C);function j(e){return"__proto__"!==e}if(a+="var "+l+" = errors;var "+m+" = true;",A&&(a+=" var "+_+" = undefined;"),T){if(a+=A?" "+_+" = "+_+" || Object.keys("+u+"); for (var "+v+"=0; "+v+"<"+_+".length; "+v+"++) { var "+f+" = "+_+"["+v+"]; ":" for (var "+f+" in "+u+") { ",k){if(a+=" var isAdditional"+s+" = !(false ",b.length)if(b.length>8)a+=" || validate.schema"+o+".hasOwnProperty("+f+") ";else{var I=b;if(I)for(var N=-1,F=I.length-1;N<F;)W=I[N+=1],a+=" || "+f+" == "+e.util.toQuotedString(W)+" "}if(x.length){var Z=x;if(Z)for(var D=-1,L=Z.length-1;D<L;)ie=Z[D+=1],a+=" || "+e.usePattern(ie)+".test("+f+") "}a+=" ); if (isAdditional"+s+") { "}if("all"==R)a+=" delete "+u+"["+f+"]; ";else{var M=e.errorPath,q="' + "+f+" + '";if(e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(e.errorPath,f,e.opts.jsonPointers)),E)if(R)a+=" delete "+u+"["+f+"]; ";else{a+=" "+m+" = false; ";var z=d;d=e.errSchemaPath+"/additionalProperties",(re=re||[]).push(a),a="",!1!==e.createErrors?(a+=" { keyword: 'additionalProperties' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(d)+" , params: { additionalProperty: '"+q+"' } ",!1!==e.opts.messages&&(a+=" , message: '",e.opts._errorDataPathProperty?a+="is an invalid additional property":a+="should NOT have additional properties",a+="' "),e.opts.verbose&&(a+=" , schema: false , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),a+=" } "):a+=" {} ";var V=a;a=re.pop(),!e.compositeRule&&c?e.async?a+=" throw new ValidationError(["+V+"]); ":a+=" validate.errors = ["+V+"]; return false; ":a+=" var err = "+V+";  if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",d=z,c&&(a+=" break; ")}else if(S)if("failing"==R){a+=" var "+l+" = errors;  ";var H=e.compositeRule;e.compositeRule=h.compositeRule=!0,h.schema=P,h.schemaPath=e.schemaPath+".additionalProperties",h.errSchemaPath=e.errSchemaPath+"/additionalProperties",h.errorPath=e.opts._errorDataPathProperty?e.errorPath:e.util.getPathExpr(e.errorPath,f,e.opts.jsonPointers);var U=u+"["+f+"]";h.dataPathArr[g]=f;var Q=e.validate(h);h.baseId=O,e.util.varOccurences(Q,y)<2?a+=" "+e.util.varReplace(Q,y,U)+" ":a+=" var "+y+" = "+U+"; "+Q+" ",a+=" if (!"+m+") { errors = "+l+"; if (validate.errors !== null) { if (errors) validate.errors.length = errors; else validate.errors = null; } delete "+u+"["+f+"]; }  ",e.compositeRule=h.compositeRule=H}else h.schema=P,h.schemaPath=e.schemaPath+".additionalProperties",h.errSchemaPath=e.errSchemaPath+"/additionalProperties",h.errorPath=e.opts._errorDataPathProperty?e.errorPath:e.util.getPathExpr(e.errorPath,f,e.opts.jsonPointers),U=u+"["+f+"]",h.dataPathArr[g]=f,Q=e.validate(h),h.baseId=O,e.util.varOccurences(Q,y)<2?a+=" "+e.util.varReplace(Q,y,U)+" ":a+=" var "+y+" = "+U+"; "+Q+" ",c&&(a+=" if (!"+m+") break; ");e.errorPath=M}k&&(a+=" } "),a+=" }  ",c&&(a+=" if ("+m+") { ",p+="}")}var K=e.opts.useDefaults&&!e.compositeRule;if(b.length){var B=b;if(B)for(var W,J=-1,G=B.length-1;J<G;){var Y=n[W=B[J+=1]];if(e.opts.strictKeywords?"object"==typeof Y&&Object.keys(Y).length>0||!1===Y:e.util.schemaHasRules(Y,e.RULES.all)){var X=e.util.getProperty(W),ee=(U=u+X,K&&void 0!==Y.default);if(h.schema=Y,h.schemaPath=o+X,h.errSchemaPath=d+"/"+e.util.escapeFragment(W),h.errorPath=e.util.getPath(e.errorPath,W,e.opts.jsonPointers),h.dataPathArr[g]=e.util.toQuotedString(W),Q=e.validate(h),h.baseId=O,e.util.varOccurences(Q,y)<2){Q=e.util.varReplace(Q,y,U);var te=U}else te=y,a+=" var "+y+" = "+U+"; ";if(ee)a+=" "+Q+" ";else{if($&&$[W]){a+=" if ( "+te+" === undefined ",A&&(a+=" || ! Object.prototype.hasOwnProperty.call("+u+", '"+e.util.escapeQuotes(W)+"') "),a+=") { "+m+" = false; ",M=e.errorPath,z=d;var re,ae=e.util.escapeQuotes(W);e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPath(M,W,e.opts.jsonPointers)),d=e.errSchemaPath+"/required",(re=re||[]).push(a),a="",!1!==e.createErrors?(a+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(d)+" , params: { missingProperty: '"+ae+"' } ",!1!==e.opts.messages&&(a+=" , message: '",e.opts._errorDataPathProperty?a+="is a required property":a+="should have required property \\'"+ae+"\\'",a+="' "),e.opts.verbose&&(a+=" , schema: validate.schema"+o+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),a+=" } "):a+=" {} ",V=a,a=re.pop(),!e.compositeRule&&c?e.async?a+=" throw new ValidationError(["+V+"]); ":a+=" validate.errors = ["+V+"]; return false; ":a+=" var err = "+V+";  if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",d=z,e.errorPath=M,a+=" } else { "}else c?(a+=" if ( "+te+" === undefined ",A&&(a+=" || ! Object.prototype.hasOwnProperty.call("+u+", '"+e.util.escapeQuotes(W)+"') "),a+=") { "+m+" = true; } else { "):(a+=" if ("+te+" !== undefined ",A&&(a+=" &&   Object.prototype.hasOwnProperty.call("+u+", '"+e.util.escapeQuotes(W)+"') "),a+=" ) { ");a+=" "+Q+" } "}}c&&(a+=" if ("+m+") { ",p+="}")}}if(x.length){var se=x;if(se)for(var ie,ne=-1,oe=se.length-1;ne<oe;)Y=w[ie=se[ne+=1]],(e.opts.strictKeywords?"object"==typeof Y&&Object.keys(Y).length>0||!1===Y:e.util.schemaHasRules(Y,e.RULES.all))&&(h.schema=Y,h.schemaPath=e.schemaPath+".patternProperties"+e.util.getProperty(ie),h.errSchemaPath=e.errSchemaPath+"/patternProperties/"+e.util.escapeFragment(ie),a+=A?" "+_+" = "+_+" || Object.keys("+u+"); for (var "+v+"=0; "+v+"<"+_+".length; "+v+"++) { var "+f+" = "+_+"["+v+"]; ":" for (var "+f+" in "+u+") { ",a+=" if ("+e.usePattern(ie)+".test("+f+")) { ",h.errorPath=e.util.getPathExpr(e.errorPath,f,e.opts.jsonPointers),U=u+"["+f+"]",h.dataPathArr[g]=f,Q=e.validate(h),h.baseId=O,e.util.varOccurences(Q,y)<2?a+=" "+e.util.varReplace(Q,y,U)+" ":a+=" var "+y+" = "+U+"; "+Q+" ",c&&(a+=" if (!"+m+") break; "),a+=" } ",c&&(a+=" else "+m+" = true; "),a+=" }  ",c&&(a+=" if ("+m+") { ",p+="}"))}return c&&(a+=" "+p+" if ("+l+" == errors) {"),a}),propertyNames:No?Io:(No=1,Io=function(e,t,r){var a=" ",s=e.level,i=e.dataLevel,n=e.schema[t],o=e.schemaPath+e.util.getProperty(t),d=e.errSchemaPath+"/"+t,c=!e.opts.allErrors,u="data"+(i||""),l="errs__"+s,h=e.util.copy(e);h.level++;var p="valid"+h.level;if(a+="var "+l+" = errors;",e.opts.strictKeywords?"object"==typeof n&&Object.keys(n).length>0||!1===n:e.util.schemaHasRules(n,e.RULES.all)){h.schema=n,h.schemaPath=o,h.errSchemaPath=d;var m="key"+s,f="idx"+s,v="i"+s,g="' + "+m+" + '",y="data"+(h.dataLevel=e.dataLevel+1),_="dataProperties"+s,b=e.opts.ownProperties,w=e.baseId;b&&(a+=" var "+_+" = undefined; "),a+=b?" "+_+" = "+_+" || Object.keys("+u+"); for (var "+f+"=0; "+f+"<"+_+".length; "+f+"++) { var "+m+" = "+_+"["+f+"]; ":" for (var "+m+" in "+u+") { ",a+=" var startErrs"+s+" = errors; ";var x=m,P=e.compositeRule;e.compositeRule=h.compositeRule=!0;var k=e.validate(h);h.baseId=w,e.util.varOccurences(k,y)<2?a+=" "+e.util.varReplace(k,y,x)+" ":a+=" var "+y+" = "+x+"; "+k+" ",e.compositeRule=h.compositeRule=P,a+=" if (!"+p+") { for (var "+v+"=startErrs"+s+"; "+v+"<errors; "+v+"++) { vErrors["+v+"].propertyName = "+m+"; }   var err =   ",!1!==e.createErrors?(a+=" { keyword: 'propertyNames' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(d)+" , params: { propertyName: '"+g+"' } ",!1!==e.opts.messages&&(a+=" , message: 'property name \\'"+g+"\\' is invalid' "),e.opts.verbose&&(a+=" , schema: validate.schema"+o+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),a+=" } "):a+=" {} ",a+=";  if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&c&&(e.async?a+=" throw new ValidationError(vErrors); ":a+=" validate.errors = vErrors; return false; "),c&&(a+=" break; "),a+=" } }"}return c&&(a+="  if ("+l+" == errors) {"),a}),required:Zo?Fo:(Zo=1,Fo=function(e,t,r){var a=" ",s=e.level,i=e.dataLevel,n=e.schema[t],o=e.schemaPath+e.util.getProperty(t),d=e.errSchemaPath+"/"+t,c=!e.opts.allErrors,u="data"+(i||""),l="valid"+s,h=e.opts.$data&&n&&n.$data;h&&(a+=" var schema"+s+" = "+e.util.getData(n.$data,i,e.dataPathArr)+"; ");var p="schema"+s;if(!h)if(n.length<e.opts.loopRequired&&e.schema.properties&&Object.keys(e.schema.properties).length){var m=[],f=n;if(f)for(var v,g=-1,y=f.length-1;g<y;){v=f[g+=1];var _=e.schema.properties[v];_&&(e.opts.strictKeywords?"object"==typeof _&&Object.keys(_).length>0||!1===_:e.util.schemaHasRules(_,e.RULES.all))||(m[m.length]=v)}}else m=n;if(h||m.length){var b=e.errorPath,w=h||m.length>=e.opts.loopRequired,x=e.opts.ownProperties;if(c)if(a+=" var missing"+s+"; ",w){h||(a+=" var "+p+" = validate.schema"+o+"; ");var P="' + "+(A="schema"+s+"["+(R="i"+s)+"]")+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(b,A,e.opts.jsonPointers)),a+=" var "+l+" = true; ",h&&(a+=" if (schema"+s+" === undefined) "+l+" = true; else if (!Array.isArray(schema"+s+")) "+l+" = false; else {"),a+=" for (var "+R+" = 0; "+R+" < "+p+".length; "+R+"++) { "+l+" = "+u+"["+p+"["+R+"]] !== undefined ",x&&(a+=" &&   Object.prototype.hasOwnProperty.call("+u+", "+p+"["+R+"]) "),a+="; if (!"+l+") break; } ",h&&(a+="  }  "),a+="  if (!"+l+") {   ",(E=E||[]).push(a),a="",!1!==e.createErrors?(a+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(d)+" , params: { missingProperty: '"+P+"' } ",!1!==e.opts.messages&&(a+=" , message: '",e.opts._errorDataPathProperty?a+="is a required property":a+="should have required property \\'"+P+"\\'",a+="' "),e.opts.verbose&&(a+=" , schema: validate.schema"+o+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),a+=" } "):a+=" {} ";var k=a;a=E.pop(),!e.compositeRule&&c?e.async?a+=" throw new ValidationError(["+k+"]); ":a+=" validate.errors = ["+k+"]; return false; ":a+=" var err = "+k+";  if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+=" } else { "}else{a+=" if ( ";var E,S=m;if(S)for(var R=-1,T=S.length-1;R<T;)C=S[R+=1],R&&(a+=" || "),a+=" ( ( "+(N=u+(I=e.util.getProperty(C)))+" === undefined ",x&&(a+=" || ! Object.prototype.hasOwnProperty.call("+u+", '"+e.util.escapeQuotes(C)+"') "),a+=") && (missing"+s+" = "+e.util.toQuotedString(e.opts.jsonPointers?C:I)+") ) ";a+=") {  ",P="' + "+(A="missing"+s)+" + '",e.opts._errorDataPathProperty&&(e.errorPath=e.opts.jsonPointers?e.util.getPathExpr(b,A,!0):b+" + "+A),(E=E||[]).push(a),a="",!1!==e.createErrors?(a+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(d)+" , params: { missingProperty: '"+P+"' } ",!1!==e.opts.messages&&(a+=" , message: '",e.opts._errorDataPathProperty?a+="is a required property":a+="should have required property \\'"+P+"\\'",a+="' "),e.opts.verbose&&(a+=" , schema: validate.schema"+o+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),a+=" } "):a+=" {} ",k=a,a=E.pop(),!e.compositeRule&&c?e.async?a+=" throw new ValidationError(["+k+"]); ":a+=" validate.errors = ["+k+"]; return false; ":a+=" var err = "+k+";  if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",a+=" } else { "}else if(w){var A;h||(a+=" var "+p+" = validate.schema"+o+"; "),P="' + "+(A="schema"+s+"["+(R="i"+s)+"]")+" + '",e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(b,A,e.opts.jsonPointers)),h&&(a+=" if ("+p+" && !Array.isArray("+p+")) {  var err =   ",!1!==e.createErrors?(a+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(d)+" , params: { missingProperty: '"+P+"' } ",!1!==e.opts.messages&&(a+=" , message: '",e.opts._errorDataPathProperty?a+="is a required property":a+="should have required property \\'"+P+"\\'",a+="' "),e.opts.verbose&&(a+=" , schema: validate.schema"+o+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),a+=" } "):a+=" {} ",a+=";  if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } else if ("+p+" !== undefined) { "),a+=" for (var "+R+" = 0; "+R+" < "+p+".length; "+R+"++) { if ("+u+"["+p+"["+R+"]] === undefined ",x&&(a+=" || ! Object.prototype.hasOwnProperty.call("+u+", "+p+"["+R+"]) "),a+=") {  var err =   ",!1!==e.createErrors?(a+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(d)+" , params: { missingProperty: '"+P+"' } ",!1!==e.opts.messages&&(a+=" , message: '",e.opts._errorDataPathProperty?a+="is a required property":a+="should have required property \\'"+P+"\\'",a+="' "),e.opts.verbose&&(a+=" , schema: validate.schema"+o+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),a+=" } "):a+=" {} ",a+=";  if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } } ",h&&(a+="  }  ")}else{var O=m;if(O)for(var C,$=-1,j=O.length-1;$<j;){C=O[$+=1];var I=e.util.getProperty(C),N=(P=e.util.escapeQuotes(C),u+I);e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPath(b,C,e.opts.jsonPointers)),a+=" if ( "+N+" === undefined ",x&&(a+=" || ! Object.prototype.hasOwnProperty.call("+u+", '"+e.util.escapeQuotes(C)+"') "),a+=") {  var err =   ",!1!==e.createErrors?(a+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(d)+" , params: { missingProperty: '"+P+"' } ",!1!==e.opts.messages&&(a+=" , message: '",e.opts._errorDataPathProperty?a+="is a required property":a+="should have required property \\'"+P+"\\'",a+="' "),e.opts.verbose&&(a+=" , schema: validate.schema"+o+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+u+" "),a+=" } "):a+=" {} ",a+=";  if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } "}}e.errorPath=b}else c&&(a+=" if (true) {");return a}),uniqueItems:Lo?Do:(Lo=1,Do=function(e,t,r){var a,s=" ",i=e.level,n=e.dataLevel,o=e.schema[t],d=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,u=!e.opts.allErrors,l="data"+(n||""),h="valid"+i,p=e.opts.$data&&o&&o.$data;if(p?(s+=" var schema"+i+" = "+e.util.getData(o.$data,n,e.dataPathArr)+"; ",a="schema"+i):a=o,(o||p)&&!1!==e.opts.uniqueItems){p&&(s+=" var "+h+"; if ("+a+" === false || "+a+" === undefined) "+h+" = true; else if (typeof "+a+" != 'boolean') "+h+" = false; else { "),s+=" var i = "+l+".length , "+h+" = true , j; if (i > 1) { ";var m=e.schema.items&&e.schema.items.type,f=Array.isArray(m);if(!m||"object"==m||"array"==m||f&&(m.indexOf("object")>=0||m.indexOf("array")>=0))s+=" outer: for (;i--;) { for (j = i; j--;) { if (equal("+l+"[i], "+l+"[j])) { "+h+" = false; break outer; } } } ";else{s+=" var itemIndices = {}, item; for (;i--;) { var item = "+l+"[i]; ";var v="checkDataType"+(f?"s":"");s+=" if ("+e.util[v](m,"item",e.opts.strictNumbers,!0)+") continue; ",f&&(s+=" if (typeof item == 'string') item = '\"' + item; "),s+=" if (typeof itemIndices[item] == 'number') { "+h+" = false; j = itemIndices[item]; break; } itemIndices[item] = i; } "}s+=" } ",p&&(s+="  }  "),s+=" if (!"+h+") {   ";var g=g||[];g.push(s),s="",!1!==e.createErrors?(s+=" { keyword: 'uniqueItems' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { i: i, j: j } ",!1!==e.opts.messages&&(s+=" , message: 'should NOT have duplicate items (items ## ' + j + ' and ' + i + ' are identical)' "),e.opts.verbose&&(s+=" , schema:  ",s+=p?"validate.schema"+d:""+o,s+="         , parentSchema: validate.schema"+e.schemaPath+" , data: "+l+" "),s+=" } "):s+=" {} ";var y=s;s=g.pop(),!e.compositeRule&&u?e.async?s+=" throw new ValidationError(["+y+"]); ":s+=" validate.errors = ["+y+"]; return false; ":s+=" var err = "+y+";  if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",s+=" } ",u&&(s+=" else { ")}else u&&(s+=" if (true) { ");return s}),validate:zn()}),t=kn().toHash;return zo=function(){var r=[{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"]}],a=["type","$comment"];return r.all=t(a),r.types=t(["number","integer","string","array","object","boolean","null"]),r.forEach(function(t){t.rules=t.rules.map(function(t){var s;if("object"==typeof t){var i=Object.keys(t)[0];s=t[i],t=i,s.forEach(function(e){a.push(e),r.all[e]=!0})}return a.push(t),r.all[t]={keyword:t,code:e[t],implements:s}}),r.all.$comment={keyword:"$comment",code:e.$comment},t.type&&(r.types[t.type]=t)}),r.keywords=t(a.concat(["$schema","$id","id","$data","$async","title","description","default","definitions","examples","readOnly","writeOnly","contentMediaType","contentEncoding","additionalItems","then","else"])),r.custom={},r}}function rd(){if(Ko)return Qo;Ko=1;var e=Mn().MissingRef;return Qo=function t(r,a,s){var i=this;if("function"!=typeof this._opts.loadSchema)throw new Error("options.loadSchema should be a function");"function"==typeof a&&(s=a,a=void 0);var n=o(r).then(function(){var e=i._addSchema(r,void 0,a);return e.validate||d(e)});s&&n.then(function(e){s(null,e)},s);return n;function o(e){var r=e.$schema;return r&&!i.getSchema(r)?t.call(i,{$ref:r},!0):Promise.resolve()}function d(t){try{return i._compile(t)}catch(r){if(r instanceof e)return function(e){var r=e.missingSchema;if(c(r))throw new Error("Schema "+r+" is loaded but "+e.missingRef+" cannot be resolved");var s=i._loadingSchemas[r];s||(s=i._loadingSchemas[r]=i._opts.loadSchema(r)).then(n,n);return s.then(function(e){if(!c(r))return o(e).then(function(){c(r)||i.addSchema(e,r,void 0,a)})}).then(function(){return d(t)});function n(){delete i._loadingSchemas[r]}function c(e){return i._refs[e]||i._schemas[e]}}(r);throw r}}},Qo}const ad={$schema:"http://json-schema.org/draft-07/schema#",$id:"http://json-schema.org/draft-07/schema#",title:"Core schema meta-schema",definitions:{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:[]}},type:["object","boolean"],properties:{$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:"#"}},default:!0};var sd,id,nd,od;function dd(){if(od)return nd;od=1;var e=/^[a-z_$][a-z0-9_$-]*$/i,t=Wo?Bo:(Wo=1,Bo=function(e,t,r){var a,s,i=" ",n=e.level,o=e.dataLevel,d=e.schema[t],c=e.schemaPath+e.util.getProperty(t),u=e.errSchemaPath+"/"+t,l=!e.opts.allErrors,h="data"+(o||""),p="valid"+n,m="errs__"+n,f=e.opts.$data&&d&&d.$data;f?(i+=" var schema"+n+" = "+e.util.getData(d.$data,o,e.dataPathArr)+"; ",s="schema"+n):s=d;var v,g,y,_,b,w=this,x="definition"+n,P=w.definition,k="";if(f&&P.$data){b="keywordValidate"+n;var E=P.validateSchema;i+=" var "+x+" = RULES.custom['"+t+"'].definition; var "+b+" = "+x+".validate;"}else{if(!(_=e.useCustomRule(w,d,e.schema,e)))return;s="validate.schema"+c,b=_.code,v=P.compile,g=P.inline,y=P.macro}var S=b+".errors",R="i"+n,T="ruleErr"+n,A=P.async;if(A&&!e.async)throw new Error("async keyword in sync schema");if(g||y||(i+=S+" = null;"),i+="var "+m+" = errors;var "+p+";",f&&P.$data&&(k+="}",i+=" if ("+s+" === undefined) { "+p+" = true; } else { ",E&&(k+="}",i+=" "+p+" = "+x+".validateSchema("+s+"); if ("+p+") { ")),g)P.statements?i+=" "+_.validate+" ":i+=" "+p+" = "+_.validate+"; ";else if(y){var O=e.util.copy(e);k="",O.level++;var C="valid"+O.level;O.schema=_.validate,O.schemaPath="";var $=e.compositeRule;e.compositeRule=O.compositeRule=!0;var j=e.validate(O).replace(/validate\.schema/g,b);e.compositeRule=O.compositeRule=$,i+=" "+j}else{(Z=Z||[]).push(i),i="",i+="  "+b+".call( ",e.opts.passContext?i+="this":i+="self",v||!1===P.schema?i+=" , "+h+" ":i+=" , "+s+" , "+h+" , validate.schema"+e.schemaPath+" ",i+=" , (dataPath || '')",'""'!=e.errorPath&&(i+=" + "+e.errorPath);var I=o?"data"+(o-1||""):"parentData",N=o?e.dataPathArr[o]:"parentDataProperty",F=i+=" , "+I+" , "+N+" , rootData )  ";i=Z.pop(),!1===P.errors?(i+=" "+p+" = ",A&&(i+="await "),i+=F+"; "):i+=A?" var "+(S="customErrors"+n)+" = null; try { "+p+" = await "+F+"; } catch (e) { "+p+" = false; if (e instanceof ValidationError) "+S+" = e.errors; else throw e; } ":" "+S+" = null; "+p+" = "+F+"; "}if(P.modifying&&(i+=" if ("+I+") "+h+" = "+I+"["+N+"];"),i+=""+k,P.valid)l&&(i+=" if (true) { ");else{var Z;i+=" if ( ",void 0===P.valid?(i+=" !",i+=y?""+C:""+p):i+=" "+!P.valid+" ",i+=") { ",a=w.keyword,(Z=Z||[]).push(i),i="",(Z=Z||[]).push(i),i="",!1!==e.createErrors?(i+=" { keyword: '"+(a||"custom")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { keyword: '"+w.keyword+"' } ",!1!==e.opts.messages&&(i+=" , message: 'should pass \""+w.keyword+"\" keyword validation' "),e.opts.verbose&&(i+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),i+=" } "):i+=" {} ";var D=i;i=Z.pop(),!e.compositeRule&&l?e.async?i+=" throw new ValidationError(["+D+"]); ":i+=" validate.errors = ["+D+"]; return false; ":i+=" var err = "+D+";  if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";var L=i;i=Z.pop(),g?P.errors?"full"!=P.errors&&(i+="  for (var "+R+"="+m+"; "+R+"<errors; "+R+"++) { var "+T+" = vErrors["+R+"]; if ("+T+".dataPath === undefined) "+T+".dataPath = (dataPath || '') + "+e.errorPath+"; if ("+T+".schemaPath === undefined) { "+T+'.schemaPath = "'+u+'"; } ',e.opts.verbose&&(i+=" "+T+".schema = "+s+"; "+T+".data = "+h+"; "),i+=" } "):!1===P.errors?i+=" "+L+" ":(i+=" if ("+m+" == errors) { "+L+" } else {  for (var "+R+"="+m+"; "+R+"<errors; "+R+"++) { var "+T+" = vErrors["+R+"]; if ("+T+".dataPath === undefined) "+T+".dataPath = (dataPath || '') + "+e.errorPath+"; if ("+T+".schemaPath === undefined) { "+T+'.schemaPath = "'+u+'"; } ',e.opts.verbose&&(i+=" "+T+".schema = "+s+"; "+T+".data = "+h+"; "),i+=" } } "):y?(i+="   var err =   ",!1!==e.createErrors?(i+=" { keyword: '"+(a||"custom")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { keyword: '"+w.keyword+"' } ",!1!==e.opts.messages&&(i+=" , message: 'should pass \""+w.keyword+"\" keyword validation' "),e.opts.verbose&&(i+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+h+" "),i+=" } "):i+=" {} ",i+=";  if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&l&&(e.async?i+=" throw new ValidationError(vErrors); ":i+=" validate.errors = vErrors; return false; ")):!1===P.errors?i+=" "+L+" ":(i+=" if (Array.isArray("+S+")) { if (vErrors === null) vErrors = "+S+"; else vErrors = vErrors.concat("+S+"); errors = vErrors.length;  for (var "+R+"="+m+"; "+R+"<errors; "+R+"++) { var "+T+" = vErrors["+R+"]; if ("+T+".dataPath === undefined) "+T+".dataPath = (dataPath || '') + "+e.errorPath+";  "+T+'.schemaPath = "'+u+'";  ',e.opts.verbose&&(i+=" "+T+".schema = "+s+"; "+T+".data = "+h+"; "),i+=" } } else { "+L+" } "),i+=" } ",l&&(i+=" else { ")}return i}),r=function(){if(id)return sd;id=1;var e=ad;return sd={$id:"https://github.com/ajv-validator/ajv/blob/master/lib/definition_schema.js",definitions:{simpleTypes:e.definitions.simpleTypes},type:"object",dependencies:{schema:["validate"],$data:["validate"],statements:["inline"],valid:{not:{required:["macro"]}}},properties:{type:e.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"}]}}}}();return nd={add:function(r,a){var s=this.RULES;if(s.keywords[r])throw new Error("Keyword "+r+" is already defined");if(!e.test(r))throw new Error("Keyword "+r+" is not a valid identifier");if(a){this.validateKeyword(a,!0);var i=a.type;if(Array.isArray(i))for(var n=0;n<i.length;n++)d(r,i[n],a);else d(r,i,a);var o=a.metaSchema;o&&(a.$data&&this._opts.$data&&(o={anyOf:[o,{$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"}]}),a.validateSchema=this.compile(o,!0))}function d(e,r,a){for(var i,n=0;n<s.length;n++){var o=s[n];if(o.type==r){i=o;break}}i||(i={type:r,rules:[]},s.push(i));var d={keyword:e,definition:a,custom:!0,code:t,implements:a.implements};i.rules.push(d),s.custom[e]=d}return s.keywords[r]=s.all[r]=!0,this},get:function(e){var t=this.RULES.custom[e];return t?t.definition:this.RULES.keywords[e]||!1},remove:function(e){var t=this.RULES;delete t.keywords[e],delete t.all[e],delete t.custom[e];for(var r=0;r<t.length;r++)for(var a=t[r].rules,s=0;s<a.length;s++)if(a[s].keyword==e){a.splice(s,1);break}return this},validate:function e(t,a){e.errors=null;var s=this._validateKeyword=this._validateKeyword||this.compile(r,!0);if(s(t))return!0;if(e.errors=s.errors,a)throw new Error("custom keyword definition is invalid: "+this.errorsText(s.errors));return!1}},nd}const cd={$schema:"http://json-schema.org/draft-07/schema#",$id:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",description:"Meta-schema for $data reference (JSON Schema extension proposal)",type:"object",required:["$data"],properties:{$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},additionalProperties:!1};var ud,ld;var hd=function(){if(ld)return ud;ld=1;var e=Vn(),t=Ln(),r=function(){if(Hn)return Jo.exports;Hn=1;var e=Jo.exports=function(){this._cache={}};return e.prototype.put=function(e,t){this._cache[e]=t},e.prototype.get=function(e){return this._cache[e]},e.prototype.del=function(e){delete this._cache[e]},e.prototype.clear=function(){this._cache={}},Jo.exports}(),a=En(),s=qn(),i=function(){if(Qn)return Un;Qn=1;var e=kn(),t=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,r=[0,31,28,31,30,31,30,31,31,30,31,30,31],a=/^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i,s=/^(?=.{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,i=/^(?:[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,n=/^(?:(?:[^\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,o=/^(?:(?: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,d=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,c=/^(?:\/(?:[^~/]|~0|~1)*)*$/,u=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,l=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/;function h(t){return t="full"==t?"full":"fast",e.copy(h[t])}function p(e){var a=e.match(t);if(!a)return!1;var s=+a[1],i=+a[2],n=+a[3];return i>=1&&i<=12&&n>=1&&n<=(2==i&&function(e){return e%4==0&&(e%100!=0||e%400==0)}(s)?29:r[i])}function m(e,t){var r=e.match(a);if(!r)return!1;var s=r[1],i=r[2],n=r[3],o=r[5];return(s<=23&&i<=59&&n<=59||23==s&&59==i&&60==n)&&(!t||o)}Un=h,h.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":n,url:o,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:s,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:y,uuid:d,"json-pointer":c,"json-pointer-uri-fragment":u,"relative-json-pointer":l},h.full={date:p,time:m,"date-time":function(e){var t=e.split(f);return 2==t.length&&p(t[0])&&m(t[1],!0)},uri:function(e){return v.test(e)&&i.test(e)},"uri-reference":/^(?:[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,"uri-template":n,url:o,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:s,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:y,uuid:d,"json-pointer":c,"json-pointer-uri-fragment":u,"relative-json-pointer":l};var f=/t|\s/i,v=/\/|:/,g=/[^\\]\\Z/;function y(e){if(g.test(e))return!1;try{return new RegExp(e),!0}catch(e){return!1}}return Un}(),n=td(),o=function(){if(Uo)return Ho;Uo=1;var e=["multipleOf","maximum","exclusiveMaximum","minimum","exclusiveMinimum","maxLength","minLength","pattern","additionalItems","maxItems","minItems","uniqueItems","maxProperties","minProperties","required","additionalProperties","enum","format","const"];return Ho=function(t,r){for(var a=0;a<r.length;a++){t=JSON.parse(JSON.stringify(t));var s,i=r[a].split("/"),n=t;for(s=1;s<i.length;s++)n=n[i[s]];for(s=0;s<e.length;s++){var o=e[s],d=n[o];d&&(n[o]={anyOf:[d,{$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"}]})}}return t}}(),d=kn();ud=m,m.prototype.validate=function(e,t){var r;if("string"==typeof e){if(!(r=this.getSchema(e)))throw new Error('no schema with key or ref "'+e+'"')}else{var a=this._addSchema(e);r=a.validate||this._compile(a)}var s=r(t);!0!==r.$async&&(this.errors=r.errors);return s},m.prototype.compile=function(e,t){var r=this._addSchema(e,void 0,t);return r.validate||this._compile(r)},m.prototype.addSchema=function(e,r,a,s){if(Array.isArray(e)){for(var i=0;i<e.length;i++)this.addSchema(e[i],void 0,a,s);return this}var n=this._getId(e);if(void 0!==n&&"string"!=typeof n)throw new Error("schema id must be string");return b(this,r=t.normalizeId(r||n)),this._schemas[r]=this._addSchema(e,a,s,!0),this},m.prototype.addMetaSchema=function(e,t,r){return this.addSchema(e,t,r,!0),this},m.prototype.validateSchema=function(e,t){var r=e.$schema;if(void 0!==r&&"string"!=typeof r)throw new Error("$schema must be a string");if(!(r=r||this._opts.defaultMeta||function(e){var t=e._opts.meta;return e._opts.defaultMeta="object"==typeof t?e._getId(t)||t:e.getSchema(l)?l:void 0,e._opts.defaultMeta}(this)))return this.logger.warn("meta-schema not available"),this.errors=null,!0;var a=this.validate(r,e);if(!a&&t){var s="schema is invalid: "+this.errorsText();if("log"!=this._opts.validateSchema)throw new Error(s);this.logger.error(s)}return a},m.prototype.getSchema=function(r){var s=f(this,r);switch(typeof s){case"object":return s.validate||this._compile(s);case"string":return this.getSchema(s);case"undefined":return function(r,s){var i=t.schema.call(r,{schema:{}},s);if(i){var n=i.schema,o=i.root,d=i.baseId,c=e.call(r,n,o,void 0,d);return r._fragments[s]=new a({ref:s,fragment:!0,schema:n,root:o,baseId:d,validate:c}),c}}(this,r)}},m.prototype.removeSchema=function(e){if(e instanceof RegExp)return v(this,this._schemas,e),v(this,this._refs,e),this;switch(typeof e){case"undefined":return v(this,this._schemas),v(this,this._refs),this._cache.clear(),this;case"string":var r=f(this,e);return r&&this._cache.del(r.cacheKey),delete this._schemas[e],delete this._refs[e],this;case"object":var a=this._opts.serialize,s=a?a(e):e;this._cache.del(s);var i=this._getId(e);i&&(i=t.normalizeId(i),delete this._schemas[i],delete this._refs[i])}return this},m.prototype.addFormat=function(e,t){"string"==typeof t&&(t=new RegExp(t));return this._formats[e]=t,this},m.prototype.errorsText=function(e,t){if(!(e=e||this.errors))return"No errors";for(var r=void 0===(t=t||{}).separator?", ":t.separator,a=void 0===t.dataVar?"data":t.dataVar,s="",i=0;i<e.length;i++){var n=e[i];n&&(s+=a+n.dataPath+" "+n.message+r)}return s.slice(0,-r.length)},m.prototype._addSchema=function(e,r,s,i){if("object"!=typeof e&&"boolean"!=typeof e)throw new Error("schema should be object or boolean");var n=this._opts.serialize,o=n?n(e):e,d=this._cache.get(o);if(d)return d;i=i||!1!==this._opts.addUsedSchema;var c=t.normalizeId(this._getId(e));c&&i&&b(this,c);var u,l=!1!==this._opts.validateSchema&&!r;l&&!(u=c&&c==t.normalizeId(e.$schema))&&this.validateSchema(e,!0);var h=t.ids.call(this,e),p=new a({id:c,schema:e,localRefs:h,cacheKey:o,meta:s});"#"!=c[0]&&i&&(this._refs[c]=p);this._cache.put(o,p),l&&u&&this.validateSchema(e,!0);return p},m.prototype._compile=function(t,r){if(t.compiling)return t.validate=i,i.schema=t.schema,i.errors=null,i.root=r||i,!0===t.schema.$async&&(i.$async=!0),i;var a,s;t.compiling=!0,t.meta&&(a=this._opts,this._opts=this._metaOpts);try{s=e.call(this,t.schema,r,t.localRefs)}catch(e){throw delete t.validate,e}finally{t.compiling=!1,t.meta&&(this._opts=a)}return t.validate=s,t.refs=s.refs,t.refVal=s.refVal,t.root=s.root,s;function i(){var e=t.validate,r=e.apply(this,arguments);return i.errors=e.errors,r}},m.prototype.compileAsync=rd();var c=dd();m.prototype.addKeyword=c.add,m.prototype.getKeyword=c.get,m.prototype.removeKeyword=c.remove,m.prototype.validateKeyword=c.validate;var u=Mn();m.ValidationError=u.Validation,m.MissingRefError=u.MissingRef,m.$dataMetaSchema=o;var l="http://json-schema.org/draft-07/schema",h=["removeAdditional","useDefaults","coerceTypes","strictDefaults"],p=["/properties"];function m(e){if(!(this instanceof m))return new m(e);e=this._opts=d.copy(e)||{},function(e){var t=e._opts.logger;if(!1===t)e.logger={log:w,warn:w,error:w};else{if(void 0===t&&(t=console),!("object"==typeof t&&t.log&&t.warn&&t.error))throw new Error("logger must implement log, warn and error methods");e.logger=t}}(this),this._schemas={},this._refs={},this._fragments={},this._formats=i(e.format),this._cache=e.cache||new r,this._loadingSchemas={},this._compilations=[],this.RULES=n(),this._getId=function(e){switch(e.schemaId){case"auto":return _;case"id":return g;default:return y}}(e),e.loopRequired=e.loopRequired||1/0,"property"==e.errorDataPath&&(e._errorDataPathProperty=!0),void 0===e.serialize&&(e.serialize=s),this._metaOpts=function(e){for(var t=d.copy(e._opts),r=0;r<h.length;r++)delete t[h[r]];return t}(this),e.formats&&function(e){for(var t in e._opts.formats){var r=e._opts.formats[t];e.addFormat(t,r)}}(this),e.keywords&&function(e){for(var t in e._opts.keywords){var r=e._opts.keywords[t];e.addKeyword(t,r)}}(this),function(e){var t;e._opts.$data&&(t=cd,e.addMetaSchema(t,t.$id,!0));if(!1===e._opts.meta)return;var r=ad;e._opts.$data&&(r=o(r,p));e.addMetaSchema(r,l,!0),e._refs["http://json-schema.org/schema"]=l}(this),"object"==typeof e.meta&&this.addMetaSchema(e.meta),e.nullable&&this.addKeyword("nullable",{metaSchema:{type:"boolean"}}),function(e){var t=e._opts.schemas;if(!t)return;if(Array.isArray(t))e.addSchema(t);else for(var r in t)e.addSchema(t[r],r)}(this)}function f(e,r){return r=t.normalizeId(r),e._schemas[r]||e._refs[r]||e._fragments[r]}function v(e,t,r){for(var a in t){var s=t[a];s.meta||r&&!r.test(a)||(e._cache.del(s.cacheKey),delete t[a])}}function g(e){return e.$id&&this.logger.warn("schema $id ignored",e.$id),e.id}function y(e){return e.id&&this.logger.warn("schema id ignored",e.id),e.$id}function _(e){if(e.$id&&e.id&&e.$id!=e.id)throw new Error("schema $id is different from id");return e.$id||e.id}function b(e,t){if(e._schemas[t]||e._refs[t])throw new Error('schema with key or id "'+t+'" already exists')}function w(){}return ud}();const pd=ln(hd);class md extends un{constructor(e,t){var r;super(t),this._serverInfo=e,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(Li.options.map((e,t)=>[e,t])),this.isMessageIgnored=(e,t)=>{const r=this._loggingLevels.get(t);return!!r&&this.LOG_LEVEL_SEVERITY.get(e)<this.LOG_LEVEL_SEVERITY.get(r)},this._capabilities=null!==(r=null==t?void 0:t.capabilities)&&void 0!==r?r:{},this._instructions=null==t?void 0:t.instructions,this.setRequestHandler(Ks,e=>this._oninitialize(e)),this.setNotificationHandler(Js,()=>{var e;return null===(e=this.oninitialized)||void 0===e?void 0:e.call(this)}),this._capabilities.logging&&this.setRequestHandler(Mi,async(e,t)=>{var r;const a=t.sessionId||(null===(r=t.requestInfo)||void 0===r?void 0:r.headers["mcp-session-id"])||void 0,{level:s}=e.params,i=Li.safeParse(s);return i.success&&this._loggingLevels.set(a,i.data),{}})}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");var t,r;this._capabilities=(t=this._capabilities,r=e,Object.entries(r).reduce((e,[t,r])=>(e[t]=r&&"object"==typeof r&&e[t]?{...e[t],...r}:r,e),{...t}))}assertCapabilityForMethod(e){var t,r,a;switch(e){case"sampling/createMessage":if(!(null===(t=this._clientCapabilities)||void 0===t?void 0:t.sampling))throw new Error(`Client does not support sampling (required for ${e})`);break;case"elicitation/create":if(!(null===(r=this._clientCapabilities)||void 0===r?void 0:r.elicitation))throw new Error(`Client does not support elicitation (required for ${e})`);break;case"roots/list":if(!(null===(a=this._clientCapabilities)||void 0===a?void 0:a.roots))throw new Error(`Client does not support listing roots (required for ${e})`)}}assertNotificationCapability(e){switch(e){case"notifications/message":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${e})`);break;case"notifications/resources/updated":case"notifications/resources/list_changed":if(!this._capabilities.resources)throw new Error(`Server does not support notifying about resources (required for ${e})`);break;case"notifications/tools/list_changed":if(!this._capabilities.tools)throw new Error(`Server does not support notifying of tool list changes (required for ${e})`);break;case"notifications/prompts/list_changed":if(!this._capabilities.prompts)throw new Error(`Server does not support notifying of prompt list changes (required for ${e})`)}}assertRequestHandlerCapability(e){switch(e){case"sampling/createMessage":if(!this._capabilities.sampling)throw new Error(`Server does not support sampling (required for ${e})`);break;case"logging/setLevel":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!this._capabilities.prompts)throw new Error(`Server does not support prompts (required for ${e})`);break;case"resources/list":case"resources/templates/list":case"resources/read":if(!this._capabilities.resources)throw new Error(`Server does not support resources (required for ${e})`);break;case"tools/call":case"tools/list":if(!this._capabilities.tools)throw new Error(`Server does not support tools (required for ${e})`)}}async _oninitialize(e){const t=e.params.protocolVersion;this._clientCapabilities=e.params.capabilities,this._clientVersion=e.params.clientInfo;return{protocolVersion:xs.includes(t)?t:ws,capabilities:this.getCapabilities(),serverInfo:this._serverInfo,...this._instructions&&{instructions:this._instructions}}}getClientCapabilities(){return this._clientCapabilities}getClientVersion(){return this._clientVersion}getCapabilities(){return this._capabilities}async ping(){return this.request({method:"ping"},Ms)}async createMessage(e,t){return this.request({method:"sampling/createMessage",params:e},Qi,t)}async elicitInput(e,t){const r=await this.request({method:"elicitation/create",params:e},Xi,t);if("accept"===r.action&&r.content)try{const t=new pd,a=t.compile(e.requestedSchema);if(!a(r.content))throw new cn(Zs.InvalidParams,`Elicitation response content does not match requested schema: ${t.errorsText(a.errors)}`)}catch(e){if(e instanceof cn)throw e;throw new cn(Zs.InternalError,`Error validating elicitation response: ${e}`)}return r}async listRoots(e,t){return this.request({method:"roots/list",params:e},on,t)}async sendLoggingMessage(e,t){if(this._capabilities.logging&&!this.isMessageIgnored(e.level,t))return this.notification({method:"notifications/message",params:e})}async sendResourceUpdated(e){return this.notification({method:"notifications/resources/updated",params:e})}async sendResourceListChanged(){return this.notification({method:"notifications/resources/list_changed"})}async sendToolListChanged(){return this.notification({method:"notifications/tools/list_changed"})}async sendPromptListChanged(){return this.notification({method:"notifications/prompts/list_changed"})}}const fd=Symbol("Let zodToJsonSchema decide on which parser to use"),vd={name:void 0,$refStrategy:"root",basePath:["#"],effectStrategy:"input",pipeStrategy:"all",dateStrategy:"format:date-time",mapStrategy:"entries",removeAdditionalStrategy:"passthrough",allowedAdditionalProperties:!0,rejectedAdditionalProperties:!1,definitionPath:"definitions",target:"jsonSchema7",strictUnions:!1,definitions:{},errorMessages:!1,markdownDescription:!1,patternStrategy:"escape",applyRegexFlags:!1,emailStrategy:"format:email",base64Strategy:"contentEncoding:base64",nameStrategy:"ref",openAiAnyTypeName:"OpenAiAnyType"},gd=e=>{const t=(e=>"string"==typeof e?{...vd,name:e}:{...vd,...e})(e),r=void 0!==t.name?[...t.basePath,t.definitionPath,t.name]:t.basePath;return{...t,flags:{hasReferencedOpenAiAnyType:!1},currentPath:r,propertyPath:void 0,seen:new Map(Object.entries(t.definitions).map(([e,r])=>[r._def,{def:r._def,path:[...t.basePath,t.definitionPath,e],jsonSchema:void 0}]))}};function yd(e,t,r,a){(null==a?void 0:a.errorMessages)&&r&&(e.errorMessage={...e.errorMessage,[t]:r})}function _d(e,t,r,a,s){e[t]=r,yd(e,t,a,s)}const bd=(e,t)=>{let r=0;for(;r<e.length&&r<t.length&&e[r]===t[r];r++);return[(e.length-r).toString(),...t.slice(r)].join("/")};function wd(e){if("openAi"!==e.target)return{};const t=[...e.basePath,e.definitionPath,e.openAiAnyTypeName];return e.flags.hasReferencedOpenAiAnyType=!0,{$ref:"relative"===e.$refStrategy?bd(t,e.currentPath):t.join("/")}}function xd(e,t){return Wd(e.type._def,t)}function Pd(e,t,r){const a=r??t.dateStrategy;if(Array.isArray(a))return{anyOf:a.map((r,a)=>Pd(e,t,r))};switch(a){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return kd(e,t)}}const kd=(e,t)=>{const r={type:"integer",format:"unix-time"};if("openApi3"===t.target)return r;for(const a of e.checks)switch(a.kind){case"min":_d(r,"minimum",a.value,a.message,t);break;case"max":_d(r,"maximum",a.value,a.message,t)}return r};let Ed;const Sd=/^[cC][^\s-]{8,}$/,Rd=/^[0-9a-z]+$/,Td=/^[0-9A-HJKMNP-TV-Z]{26}$/,Ad=/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,Od=()=>(void 0===Ed&&(Ed=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),Ed),Cd=/^(?:(?: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])$/,$d=/^(([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])$/,jd=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Id=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Nd=/^[a-zA-Z0-9_-]{21}$/,Fd=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/;function Zd(e,t){const r={type:"string"};if(e.checks)for(const a of e.checks)switch(a.kind){case"min":_d(r,"minLength","number"==typeof r.minLength?Math.max(r.minLength,a.value):a.value,a.message,t);break;case"max":_d(r,"maxLength","number"==typeof r.maxLength?Math.min(r.maxLength,a.value):a.value,a.message,t);break;case"email":switch(t.emailStrategy){case"format:email":Md(r,"email",a.message,t);break;case"format:idn-email":Md(r,"idn-email",a.message,t);break;case"pattern:zod":qd(r,Ad,a.message,t)}break;case"url":Md(r,"uri",a.message,t);break;case"uuid":Md(r,"uuid",a.message,t);break;case"regex":qd(r,a.regex,a.message,t);break;case"cuid":qd(r,Sd,a.message,t);break;case"cuid2":qd(r,Rd,a.message,t);break;case"startsWith":qd(r,RegExp(`^${Dd(a.value,t)}`),a.message,t);break;case"endsWith":qd(r,RegExp(`${Dd(a.value,t)}$`),a.message,t);break;case"datetime":Md(r,"date-time",a.message,t);break;case"date":Md(r,"date",a.message,t);break;case"time":Md(r,"time",a.message,t);break;case"duration":Md(r,"duration",a.message,t);break;case"length":_d(r,"minLength","number"==typeof r.minLength?Math.max(r.minLength,a.value):a.value,a.message,t),_d(r,"maxLength","number"==typeof r.maxLength?Math.min(r.maxLength,a.value):a.value,a.message,t);break;case"includes":qd(r,RegExp(Dd(a.value,t)),a.message,t);break;case"ip":"v6"!==a.version&&Md(r,"ipv4",a.message,t),"v4"!==a.version&&Md(r,"ipv6",a.message,t);break;case"base64url":qd(r,Id,a.message,t);break;case"jwt":qd(r,Fd,a.message,t);break;case"cidr":"v6"!==a.version&&qd(r,Cd,a.message,t),"v4"!==a.version&&qd(r,$d,a.message,t);break;case"emoji":qd(r,Od(),a.message,t);break;case"ulid":qd(r,Td,a.message,t);break;case"base64":switch(t.base64Strategy){case"format:binary":Md(r,"binary",a.message,t);break;case"contentEncoding:base64":_d(r,"contentEncoding","base64",a.message,t);break;case"pattern:zod":qd(r,jd,a.message,t)}break;case"nanoid":qd(r,Nd,a.message,t)}return r}function Dd(e,t){return"escape"===t.patternStrategy?function(e){let t="";for(let r=0;r<e.length;r++)Ld.has(e[r])||(t+="\\"),t+=e[r];return t}(e):e}const Ld=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function Md(e,t,r,a){var s;e.format||(null==(s=e.anyOf)?void 0:s.some(e=>e.format))?(e.anyOf||(e.anyOf=[]),e.format&&(e.anyOf.push({format:e.format,...e.errorMessage&&a.errorMessages&&{errorMessage:{format:e.errorMessage.format}}}),delete e.format,e.errorMessage&&(delete e.errorMessage.format,0===Object.keys(e.errorMessage).length&&delete e.errorMessage)),e.anyOf.push({format:t,...r&&a.errorMessages&&{errorMessage:{format:r}}})):_d(e,"format",t,r,a)}function qd(e,t,r,a){var s;e.pattern||(null==(s=e.allOf)?void 0:s.some(e=>e.pattern))?(e.allOf||(e.allOf=[]),e.pattern&&(e.allOf.push({pattern:e.pattern,...e.errorMessage&&a.errorMessages&&{errorMessage:{pattern:e.errorMessage.pattern}}}),delete e.pattern,e.errorMessage&&(delete e.errorMessage.pattern,0===Object.keys(e.errorMessage).length&&delete e.errorMessage)),e.allOf.push({pattern:zd(t,a),...r&&a.errorMessages&&{errorMessage:{pattern:r}}})):_d(e,"pattern",zd(t,a),r,a)}function zd(e,t){var r;if(!t.applyRegexFlags||!e.flags)return e.source;const a=e.flags.includes("i"),s=e.flags.includes("m"),i=e.flags.includes("s"),n=a?e.source.toLowerCase():e.source;let o="",d=!1,c=!1,u=!1;for(let e=0;e<n.length;e++)if(d)o+=n[e],d=!1;else{if(a)if(c){if(n[e].match(/[a-z]/)){u?(o+=n[e],o+=`${n[e-2]}-${n[e]}`.toUpperCase(),u=!1):"-"===n[e+1]&&(null==(r=n[e+2])?void 0:r.match(/[a-z]/))?(o+=n[e],u=!0):o+=`${n[e]}${n[e].toUpperCase()}`;continue}}else if(n[e].match(/[a-z]/)){o+=`[${n[e]}${n[e].toUpperCase()}]`;continue}if(s){if("^"===n[e]){o+="(^|(?<=[\r\n]))";continue}if("$"===n[e]){o+="($|(?=[\r\n]))";continue}}i&&"."===n[e]?o+=c?`${n[e]}\r\n`:`[${n[e]}\r\n]`:(o+=n[e],"\\"===n[e]?d=!0:c&&"]"===n[e]?c=!1:c||"["!==n[e]||(c=!0))}try{new RegExp(o)}catch{return console.warn(`Could not convert regex pattern at ${t.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`),e.source}return o}function Vd(e,t){var r,a,s,i,n,o;if("openAi"===t.target&&console.warn("Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead."),"openApi3"===t.target&&(null==(r=e.keyType)?void 0:r._def.typeName)===ns.ZodEnum)return{type:"object",required:e.keyType._def.values,properties:e.keyType._def.values.reduce((r,a)=>({...r,[a]:Wd(e.valueType._def,{...t,currentPath:[...t.currentPath,"properties",a]})??wd(t)}),{}),additionalProperties:t.rejectedAdditionalProperties};const d={type:"object",additionalProperties:Wd(e.valueType._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]})??t.allowedAdditionalProperties};if("openApi3"===t.target)return d;if((null==(a=e.keyType)?void 0:a._def.typeName)===ns.ZodString&&(null==(s=e.keyType._def.checks)?void 0:s.length)){const{type:r,...a}=Zd(e.keyType._def,t);return{...d,propertyNames:a}}if((null==(i=e.keyType)?void 0:i._def.typeName)===ns.ZodEnum)return{...d,propertyNames:{enum:e.keyType._def.values}};if((null==(n=e.keyType)?void 0:n._def.typeName)===ns.ZodBranded&&e.keyType._def.type._def.typeName===ns.ZodString&&(null==(o=e.keyType._def.type._def.checks)?void 0:o.length)){const{type:r,...a}=xd(e.keyType._def,t);return{...d,propertyNames:a}}return d}const Hd={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};const Ud=(e,t)=>{const r=(e.options instanceof Map?Array.from(e.options.values()):e.options).map((e,r)=>Wd(e._def,{...t,currentPath:[...t.currentPath,"anyOf",`${r}`]})).filter(e=>!!e&&(!t.strictUnions||"object"==typeof e&&Object.keys(e).length>0));return r.length?{anyOf:r}:void 0};function Qd(e,t){const r="openAi"===t.target,a={type:"object",properties:{}},s=[],i=e.shape();for(const e in i){let n=i[e];if(void 0===n||void 0===n._def)continue;let o=Kd(n);o&&r&&("ZodOptional"===n._def.typeName&&(n=n._def.innerType),n.isNullable()||(n=n.nullable()),o=!1);const d=Wd(n._def,{...t,currentPath:[...t.currentPath,"properties",e],propertyPath:[...t.currentPath,"properties",e]});void 0!==d&&(a.properties[e]=d,o||s.push(e))}s.length&&(a.required=s);const n=function(e,t){if("ZodNever"!==e.catchall._def.typeName)return Wd(e.catchall._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]});switch(e.unknownKeys){case"passthrough":return t.allowedAdditionalProperties;case"strict":return t.rejectedAdditionalProperties;case"strip":return"strict"===t.removeAdditionalStrategy?t.allowedAdditionalProperties:t.rejectedAdditionalProperties}}(e,t);return void 0!==n&&(a.additionalProperties=n),a}function Kd(e){try{return e.isOptional()}catch{return!0}}const Bd=(e,t,r)=>{switch(t){case ns.ZodString:return Zd(e,r);case ns.ZodNumber:return function(e,t){const r={type:"number"};if(!e.checks)return r;for(const a of e.checks)switch(a.kind){case"int":r.type="integer",yd(r,"type",a.message,t);break;case"min":"jsonSchema7"===t.target?a.inclusive?_d(r,"minimum",a.value,a.message,t):_d(r,"exclusiveMinimum",a.value,a.message,t):(a.inclusive||(r.exclusiveMinimum=!0),_d(r,"minimum",a.value,a.message,t));break;case"max":"jsonSchema7"===t.target?a.inclusive?_d(r,"maximum",a.value,a.message,t):_d(r,"exclusiveMaximum",a.value,a.message,t):(a.inclusive||(r.exclusiveMaximum=!0),_d(r,"maximum",a.value,a.message,t));break;case"multipleOf":_d(r,"multipleOf",a.value,a.message,t)}return r}(e,r);case ns.ZodObject:return Qd(e,r);case ns.ZodBigInt:return function(e,t){const r={type:"integer",format:"int64"};if(!e.checks)return r;for(const a of e.checks)switch(a.kind){case"min":"jsonSchema7"===t.target?a.inclusive?_d(r,"minimum",a.value,a.message,t):_d(r,"exclusiveMinimum",a.value,a.message,t):(a.inclusive||(r.exclusiveMinimum=!0),_d(r,"minimum",a.value,a.message,t));break;case"max":"jsonSchema7"===t.target?a.inclusive?_d(r,"maximum",a.value,a.message,t):_d(r,"exclusiveMaximum",a.value,a.message,t):(a.inclusive||(r.exclusiveMaximum=!0),_d(r,"maximum",a.value,a.message,t));break;case"multipleOf":_d(r,"multipleOf",a.value,a.message,t)}return r}(e,r);case ns.ZodBoolean:return{type:"boolean"};case ns.ZodDate:return Pd(e,r);case ns.ZodUndefined:return function(e){return{not:wd(e)}}(r);case ns.ZodNull:return function(e){return"openApi3"===e.target?{enum:["null"],nullable:!0}:{type:"null"}}(r);case ns.ZodArray:return function(e,t){var r,a,s;const i={type:"array"};return(null==(r=e.type)?void 0:r._def)&&(null==(s=null==(a=e.type)?void 0:a._def)?void 0:s.typeName)!==ns.ZodAny&&(i.items=Wd(e.type._def,{...t,currentPath:[...t.currentPath,"items"]})),e.minLength&&_d(i,"minItems",e.minLength.value,e.minLength.message,t),e.maxLength&&_d(i,"maxItems",e.maxLength.value,e.maxLength.message,t),e.exactLength&&(_d(i,"minItems",e.exactLength.value,e.exactLength.message,t),_d(i,"maxItems",e.exactLength.value,e.exactLength.message,t)),i}(e,r);case ns.ZodUnion:case ns.ZodDiscriminatedUnion:return function(e,t){if("openApi3"===t.target)return Ud(e,t);const r=e.options instanceof Map?Array.from(e.options.values()):e.options;if(r.every(e=>e._def.typeName in Hd&&(!e._def.checks||!e._def.checks.length))){const e=r.reduce((e,t)=>{const r=Hd[t._def.typeName];return r&&!e.includes(r)?[...e,r]:e},[]);return{type:e.length>1?e:e[0]}}if(r.every(e=>"ZodLiteral"===e._def.typeName&&!e.description)){const e=r.reduce((e,t)=>{const r=typeof t._def.value;switch(r){case"string":case"number":case"boolean":return[...e,r];case"bigint":return[...e,"integer"];case"object":if(null===t._def.value)return[...e,"null"];default:return e}},[]);if(e.length===r.length){const t=e.filter((e,t,r)=>r.indexOf(e)===t);return{type:t.length>1?t:t[0],enum:r.reduce((e,t)=>e.includes(t._def.value)?e:[...e,t._def.value],[])}}}else if(r.every(e=>"ZodEnum"===e._def.typeName))return{type:"string",enum:r.reduce((e,t)=>[...e,...t._def.values.filter(t=>!e.includes(t))],[])};return Ud(e,t)}(e,r);case ns.ZodIntersection:return function(e,t){const r=[Wd(e.left._def,{...t,currentPath:[...t.currentPath,"allOf","0"]}),Wd(e.right._def,{...t,currentPath:[...t.currentPath,"allOf","1"]})].filter(e=>!!e);let a="jsonSchema2019-09"===t.target?{unevaluatedProperties:!1}:void 0;const s=[];return r.forEach(e=>{if("type"in(t=e)&&"string"===t.type||!("allOf"in t)){let t=e;if("additionalProperties"in e&&!1===e.additionalProperties){const{additionalProperties:r,...a}=e;t=a}else a=void 0;s.push(t)}else s.push(...e.allOf),void 0===e.unevaluatedProperties&&(a=void 0);var t}),s.length?{allOf:s,...a}:void 0}(e,r);case ns.ZodTuple:return function(e,t){return e.rest?{type:"array",minItems:e.items.length,items:e.items.map((e,r)=>Wd(e._def,{...t,currentPath:[...t.currentPath,"items",`${r}`]})).reduce((e,t)=>void 0===t?e:[...e,t],[]),additionalItems:Wd(e.rest._def,{...t,currentPath:[...t.currentPath,"additionalItems"]})}:{type:"array",minItems:e.items.length,maxItems:e.items.length,items:e.items.map((e,r)=>Wd(e._def,{...t,currentPath:[...t.currentPath,"items",`${r}`]})).reduce((e,t)=>void 0===t?e:[...e,t],[])}}(e,r);case ns.ZodRecord:return Vd(e,r);case ns.ZodLiteral:return function(e,t){const r=typeof e.value;return"bigint"!==r&&"number"!==r&&"boolean"!==r&&"string"!==r?{type:Array.isArray(e.value)?"array":"object"}:"openApi3"===t.target?{type:"bigint"===r?"integer":r,enum:[e.value]}:{type:"bigint"===r?"integer":r,const:e.value}}(e,r);case ns.ZodEnum:return function(e){return{type:"string",enum:Array.from(e.values)}}(e);case ns.ZodNativeEnum:return function(e){const t=e.values,r=Object.keys(e.values).filter(e=>"number"!=typeof t[t[e]]).map(e=>t[e]),a=Array.from(new Set(r.map(e=>typeof e)));return{type:1===a.length?"string"===a[0]?"string":"number":["string","number"],enum:r}}(e);case ns.ZodNullable:return function(e,t){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(e.innerType._def.typeName)&&(!e.innerType._def.checks||!e.innerType._def.checks.length))return"openApi3"===t.target?{type:Hd[e.innerType._def.typeName],nullable:!0}:{type:[Hd[e.innerType._def.typeName],"null"]};if("openApi3"===t.target){const r=Wd(e.innerType._def,{...t,currentPath:[...t.currentPath]});return r&&"$ref"in r?{allOf:[r],nullable:!0}:r&&{...r,nullable:!0}}const r=Wd(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","0"]});return r&&{anyOf:[r,{type:"null"}]}}(e,r);case ns.ZodOptional:return((e,t)=>{var r;if(t.currentPath.toString()===(null==(r=t.propertyPath)?void 0:r.toString()))return Wd(e.innerType._def,t);const a=Wd(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","1"]});return a?{anyOf:[{not:wd(t)},a]}:wd(t)})(e,r);case ns.ZodMap:return function(e,t){return"record"===t.mapStrategy?Vd(e,t):{type:"array",maxItems:125,items:{type:"array",items:[Wd(e.keyType._def,{...t,currentPath:[...t.currentPath,"items","items","0"]})||wd(t),Wd(e.valueType._def,{...t,currentPath:[...t.currentPath,"items","items","1"]})||wd(t)],minItems:2,maxItems:2}}}(e,r);case ns.ZodSet:return function(e,t){const r={type:"array",uniqueItems:!0,items:Wd(e.valueType._def,{...t,currentPath:[...t.currentPath,"items"]})};return e.minSize&&_d(r,"minItems",e.minSize.value,e.minSize.message,t),e.maxSize&&_d(r,"maxItems",e.maxSize.value,e.maxSize.message,t),r}(e,r);case ns.ZodLazy:return()=>e.getter()._def;case ns.ZodPromise:return function(e,t){return Wd(e.type._def,t)}(e,r);case ns.ZodNaN:case ns.ZodNever:return function(e){return"openAi"===e.target?void 0:{not:wd({...e,currentPath:[...e.currentPath,"not"]})}}(r);case ns.ZodEffects:return function(e,t){return"input"===t.effectStrategy?Wd(e.schema._def,t):wd(t)}(e,r);case ns.ZodAny:return wd(r);case ns.ZodUnknown:return function(e){return wd(e)}(r);case ns.ZodDefault:return function(e,t){return{...Wd(e.innerType._def,t),default:e.defaultValue()}}(e,r);case ns.ZodBranded:return xd(e,r);case ns.ZodReadonly:case ns.ZodCatch:return((e,t)=>Wd(e.innerType._def,t))(e,r);case ns.ZodPipeline:return((e,t)=>{if("input"===t.pipeStrategy)return Wd(e.in._def,t);if("output"===t.pipeStrategy)return Wd(e.out._def,t);const r=Wd(e.in._def,{...t,currentPath:[...t.currentPath,"allOf","0"]});return{allOf:[r,Wd(e.out._def,{...t,currentPath:[...t.currentPath,"allOf",r?"1":"0"]})].filter(e=>void 0!==e)}})(e,r);case ns.ZodFunction:case ns.ZodVoid:case ns.ZodSymbol:default:return}};function Wd(e,t,r=!1){var a;const s=t.seen.get(e);if(t.override){const i=null==(a=t.override)?void 0:a.call(t,e,t,s,r);if(i!==fd)return i}if(s&&!r){const e=Jd(s,t);if(void 0!==e)return e}const i={def:e,path:t.currentPath,jsonSchema:void 0};t.seen.set(e,i);const n=Bd(e,e.typeName,t),o="function"==typeof n?Wd(n(),t):n;if(o&&Gd(e,t,o),t.postProcess){const r=t.postProcess(o,e,t);return i.jsonSchema=o,r}return i.jsonSchema=o,o}const Jd=(e,t)=>{switch(t.$refStrategy){case"root":return{$ref:e.path.join("/")};case"relative":return{$ref:bd(t.currentPath,e.path)};case"none":case"seen":return e.path.length<t.currentPath.length&&e.path.every((e,r)=>t.currentPath[r]===e)?(console.warn(`Recursive reference detected at ${t.currentPath.join("/")}! Defaulting to any`),wd(t)):"seen"===t.$refStrategy?wd(t):void 0}},Gd=(e,t,r)=>(e.description&&(r.description=e.description,t.markdownDescription&&(r.markdownDescription=e.description)),r),Yd=(e,t)=>{const r=gd(t);let a="object"==typeof t&&t.definitions?Object.entries(t.definitions).reduce((e,[t,a])=>({...e,[t]:Wd(a._def,{...r,currentPath:[...r.basePath,r.definitionPath,t]},!0)??wd(r)}),{}):void 0;const s="string"==typeof t?t:"title"===(null==t?void 0:t.nameStrategy)||null==t?void 0:t.name,i=Wd(e._def,void 0===s?r:{...r,currentPath:[...r.basePath,r.definitionPath,s]},!1)??wd(r),n="object"==typeof t&&void 0!==t.name&&"title"===t.nameStrategy?t.name:void 0;void 0!==n&&(i.title=n),r.flags.hasReferencedOpenAiAnyType&&(a||(a={}),a[r.openAiAnyTypeName]||(a[r.openAiAnyTypeName]={type:["string","number","integer","boolean","array","null"],items:{$ref:"relative"===r.$refStrategy?"1":[...r.basePath,r.definitionPath,r.openAiAnyTypeName].join("/")}}));const o=void 0===s?a?{...i,[r.definitionPath]:a}:i:{$ref:[..."relative"===r.$refStrategy?[]:r.basePath,r.definitionPath,s].join("/"),[r.definitionPath]:{...a,[s]:i}};return"jsonSchema7"===r.target?o.$schema="http://json-schema.org/draft-07/schema#":"jsonSchema2019-09"!==r.target&&"openAi"!==r.target||(o.$schema="https://json-schema.org/draft/2019-09/schema#"),"openAi"===r.target&&("anyOf"in o||"oneOf"in o||"allOf"in o||"type"in o&&Array.isArray(o.type))&&console.warn("Warning: OpenAI may not support schemas with unions as roots! Try wrapping it in an object property."),o};var Xd;(Xd||(Xd={})).Completable="McpCompletable";class ec extends Jr{_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}}function tc(e){if(!e)return{};const{errorMap:t,invalid_type_error:r,required_error:a,description:s}=e;if(t&&(r||a))throw new Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');if(t)return{errorMap:t,description:s};return{errorMap:(t,s)=>{var i,n;const{message:o}=e;return"invalid_enum_value"===t.code?{message:null!=o?o:s.defaultError}:void 0===s.data?{message:null!==(i=null!=o?o:a)&&void 0!==i?i:s.defaultError}:"invalid_type"!==t.code?{message:s.defaultError}:{message:null!==(n=null!=o?o:r)&&void 0!==n?n:s.defaultError}},description:s}}ec.create=(e,t)=>new ec({type:e,typeName:Xd.Completable,complete:t.complete,...tc(t)});class rc{constructor(e,t){this._registeredResources={},this._registeredResourceTemplates={},this._registeredTools={},this._registeredPrompts={},this._toolHandlersInitialized=!1,this._completionHandlerInitialized=!1,this._resourceHandlersInitialized=!1,this._promptHandlersInitialized=!1,this.server=new md(e,t)}async connect(e){return await this.server.connect(e)}async close(){await this.server.close()}setToolRequestHandlers(){this._toolHandlersInitialized||(this.server.assertCanSetRequestHandler(Ii.shape.method.value),this.server.assertCanSetRequestHandler(Zi.shape.method.value),this.server.registerCapabilities({tools:{listChanged:!0}}),this.server.setRequestHandler(Ii,()=>({tools:Object.entries(this._registeredTools).filter(([,e])=>e.enabled).map(([e,t])=>{const r={name:e,title:t.title,description:t.description,inputSchema:t.inputSchema?Yd(t.inputSchema,{strictUnions:!0}):ac,annotations:t.annotations,_meta:t._meta};return t.outputSchema&&(r.outputSchema=Yd(t.outputSchema,{strictUnions:!0})),r})})),this.server.setRequestHandler(Zi,async(e,t)=>{const r=this._registeredTools[e.params.name];if(!r)throw new cn(Zs.InvalidParams,`Tool ${e.params.name} not found`);if(!r.enabled)throw new cn(Zs.InvalidParams,`Tool ${e.params.name} disabled`);let a;if(r.inputSchema){const s=await r.inputSchema.safeParseAsync(e.params.arguments);if(!s.success)throw new cn(Zs.InvalidParams,`Invalid arguments for tool ${e.params.name}: ${s.error.message}`);const i=s.data,n=r.callback;try{a=await Promise.resolve(n(i,t))}catch(e){a={content:[{type:"text",text:e instanceof Error?e.message:String(e)}],isError:!0}}}else{const e=r.callback;try{a=await Promise.resolve(e(t))}catch(e){a={content:[{type:"text",text:e instanceof Error?e.message:String(e)}],isError:!0}}}if(r.outputSchema&&!a.isError){if(!a.structuredContent)throw new cn(Zs.InvalidParams,`Tool ${e.params.name} has an output schema but no structured content was provided`);const t=await r.outputSchema.safeParseAsync(a.structuredContent);if(!t.success)throw new cn(Zs.InvalidParams,`Invalid structured content for tool ${e.params.name}: ${t.error.message}`)}return a}),this._toolHandlersInitialized=!0)}setCompletionRequestHandler(){this._completionHandlerInitialized||(this.server.assertCanSetRequestHandler(rn.shape.method.value),this.server.registerCapabilities({completions:{}}),this.server.setRequestHandler(rn,async e=>{switch(e.params.ref.type){case"ref/prompt":return this.handlePromptCompletion(e,e.params.ref);case"ref/resource":return this.handleResourceCompletion(e,e.params.ref);default:throw new cn(Zs.InvalidParams,`Invalid completion reference: ${e.params.ref}`)}}),this._completionHandlerInitialized=!0)}async handlePromptCompletion(e,t){const r=this._registeredPrompts[t.name];if(!r)throw new cn(Zs.InvalidParams,`Prompt ${t.name} not found`);if(!r.enabled)throw new cn(Zs.InvalidParams,`Prompt ${t.name} disabled`);if(!r.argsSchema)return oc;const a=r.argsSchema.shape[e.params.argument.name];if(!(a instanceof ec))return oc;const s=a._def;return nc(await s.complete(e.params.argument.value,e.params.context))}async handleResourceCompletion(e,t){const r=Object.values(this._registeredResourceTemplates).find(e=>e.resourceTemplate.uriTemplate.toString()===t.uri);if(!r){if(this._registeredResources[t.uri])return oc;throw new cn(Zs.InvalidParams,`Resource template ${e.params.ref.uri} not found`)}const a=r.resourceTemplate.completeCallback(e.params.argument.name);if(!a)return oc;return nc(await a(e.params.argument.value,e.params.context))}setResourceRequestHandlers(){this._resourceHandlersInitialized||(this.server.assertCanSetRequestHandler(di.shape.method.value),this.server.assertCanSetRequestHandler(ui.shape.method.value),this.server.assertCanSetRequestHandler(hi.shape.method.value),this.server.registerCapabilities({resources:{listChanged:!0}}),this.server.setRequestHandler(di,async(e,t)=>{const r=Object.entries(this._registeredResources).filter(([e,t])=>t.enabled).map(([e,t])=>({uri:e,name:t.name,...t.metadata})),a=[];for(const e of Object.values(this._registeredResourceTemplates)){if(!e.resourceTemplate.listCallback)continue;const r=await e.resourceTemplate.listCallback(t);for(const t of r.resources)a.push({...e.metadata,...t})}return{resources:[...r,...a]}}),this.server.setRequestHandler(ui,async()=>({resourceTemplates:Object.entries(this._registeredResourceTemplates).map(([e,t])=>({name:e,uriTemplate:t.resourceTemplate.uriTemplate.toString(),...t.metadata}))})),this.server.setRequestHandler(hi,async(e,t)=>{const r=new URL(e.params.uri),a=this._registeredResources[r.toString()];if(a){if(!a.enabled)throw new cn(Zs.InvalidParams,`Resource ${r} disabled`);return a.readCallback(r,t)}for(const e of Object.values(this._registeredResourceTemplates)){const a=e.resourceTemplate.uriTemplate.match(r.toString());if(a)return e.readCallback(r,a,t)}throw new cn(Zs.InvalidParams,`Resource ${r} not found`)}),this.setCompletionRequestHandler(),this._resourceHandlersInitialized=!0)}setPromptRequestHandlers(){this._promptHandlersInitialized||(this.server.assertCanSetRequestHandler(bi.shape.method.value),this.server.assertCanSetRequestHandler(xi.shape.method.value),this.server.registerCapabilities({prompts:{listChanged:!0}}),this.server.setRequestHandler(bi,()=>({prompts:Object.entries(this._registeredPrompts).filter(([,e])=>e.enabled).map(([e,t])=>{return{name:e,title:t.title,description:t.description,arguments:t.argsSchema?(r=t.argsSchema,Object.entries(r.shape).map(([e,t])=>({name:e,description:t.description,required:!t.isOptional()}))):void 0};var r})})),this.server.setRequestHandler(xi,async(e,t)=>{const r=this._registeredPrompts[e.params.name];if(!r)throw new cn(Zs.InvalidParams,`Prompt ${e.params.name} not found`);if(!r.enabled)throw new cn(Zs.InvalidParams,`Prompt ${e.params.name} disabled`);if(r.argsSchema){const a=await r.argsSchema.safeParseAsync(e.params.arguments);if(!a.success)throw new cn(Zs.InvalidParams,`Invalid arguments for prompt ${e.params.name}: ${a.error.message}`);const s=a.data,i=r.callback;return await Promise.resolve(i(s,t))}{const e=r.callback;return await Promise.resolve(e(t))}}),this.setCompletionRequestHandler(),this._promptHandlersInitialized=!0)}resource(e,t,...r){let a;"object"==typeof r[0]&&(a=r.shift());const s=r[0];if("string"==typeof t){if(this._registeredResources[t])throw new Error(`Resource ${t} is already registered`);const r=this._createRegisteredResource(e,void 0,t,a,s);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),r}{if(this._registeredResourceTemplates[e])throw new Error(`Resource template ${e} is already registered`);const r=this._createRegisteredResourceTemplate(e,void 0,t,a,s);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),r}}registerResource(e,t,r,a){if("string"==typeof t){if(this._registeredResources[t])throw new Error(`Resource ${t} is already registered`);const s=this._createRegisteredResource(e,r.title,t,r,a);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),s}{if(this._registeredResourceTemplates[e])throw new Error(`Resource template ${e} is already registered`);const s=this._createRegisteredResourceTemplate(e,r.title,t,r,a);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),s}}_createRegisteredResource(e,t,r,a,s){const i={name:e,title:t,metadata:a,readCallback:s,enabled:!0,disable:()=>i.update({enabled:!1}),enable:()=>i.update({enabled:!0}),remove:()=>i.update({uri:null}),update:e=>{void 0!==e.uri&&e.uri!==r&&(delete this._registeredResources[r],e.uri&&(this._registeredResources[e.uri]=i)),void 0!==e.name&&(i.name=e.name),void 0!==e.title&&(i.title=e.title),void 0!==e.metadata&&(i.metadata=e.metadata),void 0!==e.callback&&(i.readCallback=e.callback),void 0!==e.enabled&&(i.enabled=e.enabled),this.sendResourceListChanged()}};return this._registeredResources[r]=i,i}_createRegisteredResourceTemplate(e,t,r,a,s){const i={resourceTemplate:r,title:t,metadata:a,readCallback:s,enabled:!0,disable:()=>i.update({enabled:!1}),enable:()=>i.update({enabled:!0}),remove:()=>i.update({name:null}),update:t=>{void 0!==t.name&&t.name!==e&&(delete this._registeredResourceTemplates[e],t.name&&(this._registeredResourceTemplates[t.name]=i)),void 0!==t.title&&(i.title=t.title),void 0!==t.template&&(i.resourceTemplate=t.template),void 0!==t.metadata&&(i.metadata=t.metadata),void 0!==t.callback&&(i.readCallback=t.callback),void 0!==t.enabled&&(i.enabled=t.enabled),this.sendResourceListChanged()}};return this._registeredResourceTemplates[e]=i,i}_createRegisteredPrompt(e,t,r,a,s){const i={title:t,description:r,argsSchema:void 0===a?void 0:ms(a),callback:s,enabled:!0,disable:()=>i.update({enabled:!1}),enable:()=>i.update({enabled:!0}),remove:()=>i.update({name:null}),update:t=>{void 0!==t.name&&t.name!==e&&(delete this._registeredPrompts[e],t.name&&(this._registeredPrompts[t.name]=i)),void 0!==t.title&&(i.title=t.title),void 0!==t.description&&(i.description=t.description),void 0!==t.argsSchema&&(i.argsSchema=ms(t.argsSchema)),void 0!==t.callback&&(i.callback=t.callback),void 0!==t.enabled&&(i.enabled=t.enabled),this.sendPromptListChanged()}};return this._registeredPrompts[e]=i,i}_createRegisteredTool(e,t,r,a,s,i,n,o){const d={title:t,description:r,inputSchema:void 0===a?void 0:ms(a),outputSchema:void 0===s?void 0:ms(s),annotations:i,_meta:n,callback:o,enabled:!0,disable:()=>d.update({enabled:!1}),enable:()=>d.update({enabled:!0}),remove:()=>d.update({name:null}),update:t=>{void 0!==t.name&&t.name!==e&&(delete this._registeredTools[e],t.name&&(this._registeredTools[t.name]=d)),void 0!==t.title&&(d.title=t.title),void 0!==t.description&&(d.description=t.description),void 0!==t.paramsSchema&&(d.inputSchema=ms(t.paramsSchema)),void 0!==t.callback&&(d.callback=t.callback),void 0!==t.annotations&&(d.annotations=t.annotations),void 0!==t._meta&&(d._meta=t._meta),void 0!==t.enabled&&(d.enabled=t.enabled),this.sendToolListChanged()}};return this._registeredTools[e]=d,this.setToolRequestHandlers(),this.sendToolListChanged(),d}tool(e,...t){if(this._registeredTools[e])throw new Error(`Tool ${e} is already registered`);let r,a,s;if("string"==typeof t[0]&&(r=t.shift()),t.length>1){const e=t[0];sc(e)?(a=t.shift(),t.length>1&&"object"==typeof t[0]&&null!==t[0]&&!sc(t[0])&&(s=t.shift())):"object"==typeof e&&null!==e&&(s=t.shift())}const i=t[0];return this._createRegisteredTool(e,void 0,r,a,void 0,s,void 0,i)}registerTool(e,t,r){if(this._registeredTools[e])throw new Error(`Tool ${e} is already registered`);const{title:a,description:s,inputSchema:i,outputSchema:n,annotations:o,_meta:d}=t;return this._createRegisteredTool(e,a,s,i,n,o,d,r)}prompt(e,...t){if(this._registeredPrompts[e])throw new Error(`Prompt ${e} is already registered`);let r,a;"string"==typeof t[0]&&(r=t.shift()),t.length>1&&(a=t.shift());const s=t[0],i=this._createRegisteredPrompt(e,void 0,r,a,s);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),i}registerPrompt(e,t,r){if(this._registeredPrompts[e])throw new Error(`Prompt ${e} is already registered`);const{title:a,description:s,argsSchema:i}=t,n=this._createRegisteredPrompt(e,a,s,i,r);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),n}isConnected(){return void 0!==this.server.transport}async sendLoggingMessage(e,t){return this.server.sendLoggingMessage(e,t)}sendResourceListChanged(){this.isConnected()&&this.server.sendResourceListChanged()}sendToolListChanged(){this.isConnected()&&this.server.sendToolListChanged()}sendPromptListChanged(){this.isConnected()&&this.server.sendPromptListChanged()}}const ac={type:"object",properties:{}};function sc(e){if("object"!=typeof e||null===e)return!1;return 0===Object.keys(e).length||Object.values(e).some(ic)}function ic(e){return null!==e&&"object"==typeof e&&"parse"in e&&"function"==typeof e.parse&&"safeParse"in e&&"function"==typeof e.safeParse}function nc(e){return{completion:{values:e.slice(0,100),total:e.length,hasMore:e.length>100}}}const oc={completion:{values:[],hasMore:!1}};async function dc(e,t){const r=await fetch(window.wpApiSettings.root+e,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":window.wpApiSettings?.nonce||""},body:JSON.stringify(t)}),a=await r.json();if(!r.ok){if(a&&a.message)throw new Error(a.message);throw new Error(`HTTP error! status: ${r.status}`)}return a}async function cc(e){const t="uael/v1/angie/",r=await dc(t+"abilities/",{});if(!Array.isArray(r))throw new Error("Abilities response was not an array");r.forEach(r=>{const a=uc(r.input_schema);e.registerTool(r.name,{title:r.label,description:r.description,inputSchema:a},async e=>{const a=await dc(t+r.name+"/",e);return a&&a.error?{content:[{type:"text",text:"Error: "+(a.message||"Unknown error")}],isError:!0}:{content:[{type:"text",text:JSON.stringify(a,null,2)}]}})})}function uc(e){const t={};if(e&&"object"===e.type&&e.properties&&"object"==typeof e.properties)for(const[r,a]of Object.entries(e.properties)){const e=a;let s;if("object"===e.type&&e.properties)s=ms(uc(e));else if(e.enum&&Array.isArray(e.enum)&&e.enum.length>0){const t=e.enum.every(e=>"number"==typeof e),r=e.enum.every(e=>"string"==typeof e);if(r)s=_s(e.enum);else if(t){const t=e.enum.map(e=>ys(e));s=1===t.length?t[0]:fs([t[0],t[1],...t.slice(2)])}else s=ls()}else switch(e.type){case"number":case"integer":s=cs();break;case"string":s=ds();break;case"boolean":s=us();break;case"array":s=ps(ls());break;case"object":s=gs(ds(),ls());break;default:s=ls()}void 0!==e.default&&(s=s.default(e.default)),e.description&&(s=s.describe(e.description)),t[r]=s}return t}(async()=>{try{const e=new rc({name:"uae-angie",version:"1.0.0"},{capabilities:{tools:{}}});await cc(e);const t=new Sr;await t.registerServer({name:"uae-angie",version:"1.0.0",description:"UAE MCP Server for Angie — manage headers, footers, templates, pages, and widgets.",server:e}),console.log("UAE Angie MCP Server registered successfully")}catch(e){console.error("Failed to register UAE Angie MCP Server:",e)}})();