@mcp-b/global 1.0.14 → 1.0.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,8 @@
1
- var WebMCP=(function(e,t){var n=Object.create,r=Object.defineProperty,i=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,o=Object.getPrototypeOf,s=Object.prototype.hasOwnProperty,c=(e,t,n,o)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var c=a(t),l=0,ee=c.length,u;l<ee;l++)u=c[l],!s.call(e,u)&&u!==n&&r(e,u,{get:(e=>t[e]).bind(null,u),enumerable:!(o=i(t,u))||o.enumerable});return e};t=((e,t,i)=>(i=e==null?{}:n(o(e)),c(t||!e||!e.__esModule?r(i,`default`,{value:e,enumerable:!0}):i,e)))(t);var l;(function(e){e.assertEqual=e=>e;function t(e){}e.assertIs=t;function n(e){throw Error()}e.assertNever=n,e.arrayToEnum=e=>{let t={};for(let n of e)t[n]=n;return t},e.getValidEnumValues=t=>{let n=e.objectKeys(t).filter(e=>typeof t[t[e]]!=`number`),r={};for(let e of n)r[e]=t[e];return e.objectValues(r)},e.objectValues=t=>e.objectKeys(t).map(function(e){return t[e]}),e.objectKeys=typeof Object.keys==`function`?e=>Object.keys(e):e=>{let t=[];for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.push(n);return t},e.find=(e,t)=>{for(let n of e)if(t(n))return n},e.isInteger=typeof Number.isInteger==`function`?e=>Number.isInteger(e):e=>typeof e==`number`&&isFinite(e)&&Math.floor(e)===e;function r(e,t=` | `){return e.map(e=>typeof e==`string`?`'${e}'`:e).join(t)}e.joinValues=r,e.jsonStringifyReplacer=(e,t)=>typeof t==`bigint`?t.toString():t})(l||={});var ee;(function(e){e.mergeShapes=(e,t)=>({...e,...t})})(ee||={});let u=l.arrayToEnum([`string`,`nan`,`number`,`integer`,`float`,`boolean`,`date`,`bigint`,`symbol`,`function`,`undefined`,`null`,`array`,`object`,`unknown`,`promise`,`void`,`never`,`map`,`set`]),d=e=>{switch(typeof e){case`undefined`:return u.undefined;case`string`:return u.string;case`number`:return 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:e===null?u.null:e.then&&typeof e.then==`function`&&e.catch&&typeof e.catch==`function`?u.promise:typeof Map<`u`&&e instanceof Map?u.map:typeof Set<`u`&&e instanceof Set?u.set:typeof Date<`u`&&e instanceof Date?u.date:u.object;default:return u.unknown}},f=l.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`]),te=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,`$1:`);var p=class e 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]};let t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name=`ZodError`,this.issues=e}format(e){let t=e||function(e){return e.message},n={_errors:[]},r=e=>{for(let i of e.issues)if(i.code===`invalid_union`)i.unionErrors.map(r);else if(i.code===`invalid_return_type`)r(i.returnTypeError);else if(i.code===`invalid_arguments`)r(i.argumentsError);else if(i.path.length===0)n._errors.push(t(i));else{let e=n,r=0;for(;r<i.path.length;){let n=i.path[r];r===i.path.length-1?(e[n]=e[n]||{_errors:[]},e[n]._errors.push(t(i))):e[n]=e[n]||{_errors:[]},e=e[n],r++}}};return r(this),n}static assert(t){if(!(t instanceof e))throw Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,l.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=e=>e.message){let t={},n=[];for(let r of this.issues)r.path.length>0?(t[r.path[0]]=t[r.path[0]]||[],t[r.path[0]].push(e(r))):n.push(e(r));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}};p.create=e=>new p(e);let ne=(e,t)=>{let n;switch(e.code){case f.invalid_type:n=e.received===u.undefined?`Required`:`Expected ${e.expected}, received ${e.received}`;break;case f.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,l.jsonStringifyReplacer)}`;break;case f.unrecognized_keys:n=`Unrecognized key(s) in object: ${l.joinValues(e.keys,`, `)}`;break;case f.invalid_union:n=`Invalid input`;break;case f.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${l.joinValues(e.options)}`;break;case f.invalid_enum_value:n=`Invalid enum value. Expected ${l.joinValues(e.options)}, received '${e.received}'`;break;case f.invalid_arguments:n=`Invalid function arguments`;break;case f.invalid_return_type:n=`Invalid function return type`;break;case f.invalid_date:n=`Invalid date`;break;case f.invalid_string:typeof e.validation==`object`?`includes`in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position==`number`&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):`startsWith`in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:`endsWith`in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:l.assertNever(e.validation):n=e.validation===`regex`?`Invalid`:`Invalid ${e.validation}`;break;case f.too_small:n=e.type===`array`?`Array must contain ${e.exact?`exactly`:e.inclusive?`at least`:`more than`} ${e.minimum} element(s)`:e.type===`string`?`String must contain ${e.exact?`exactly`:e.inclusive?`at least`:`over`} ${e.minimum} character(s)`:e.type===`number`?`Number must be ${e.exact?`exactly equal to `:e.inclusive?`greater than or equal to `:`greater than `}${e.minimum}`:e.type===`date`?`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 f.too_big:n=e.type===`array`?`Array must contain ${e.exact?`exactly`:e.inclusive?`at most`:`less than`} ${e.maximum} element(s)`:e.type===`string`?`String must contain ${e.exact?`exactly`:e.inclusive?`at most`:`under`} ${e.maximum} character(s)`:e.type===`number`?`Number must be ${e.exact?`exactly`:e.inclusive?`less than or equal to`:`less than`} ${e.maximum}`:e.type===`bigint`?`BigInt must be ${e.exact?`exactly`:e.inclusive?`less than or equal to`:`less than`} ${e.maximum}`:e.type===`date`?`Date must be ${e.exact?`exactly`:e.inclusive?`smaller than or equal to`:`smaller than`} ${new Date(Number(e.maximum))}`:`Invalid input`;break;case f.custom:n=`Invalid input`;break;case f.invalid_intersection_types:n=`Intersection results could not be merged`;break;case f.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case f.not_finite:n=`Number must be finite`;break;default:n=t.defaultError,l.assertNever(e)}return{message:n}},re=ne;function ie(e){re=e}function ae(){return re}let oe=e=>{let{data:t,path:n,errorMaps:r,issueData:i}=e,a=[...n,...i.path||[]],o={...i,path:a};if(i.message!==void 0)return{...i,path:a,message:i.message};let s=``,c=r.filter(e=>!!e).slice().reverse();for(let e of c)s=e(o,{data:t,defaultError:s}).message;return{...i,path:a,message:s}},se=[];function m(e,t){let n=ae(),r=oe({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===ne?void 0:ne].filter(e=>!!e)});e.common.issues.push(r)}var h=class e{constructor(){this.value=`valid`}dirty(){this.value===`valid`&&(this.value=`dirty`)}abort(){this.value!==`aborted`&&(this.value=`aborted`)}static mergeArray(e,t){let n=[];for(let r of t){if(r.status===`aborted`)return g;r.status===`dirty`&&e.dirty(),n.push(r.value)}return{status:e.value,value:n}}static async mergeObjectAsync(t,n){let r=[];for(let e of n){let t=await e.key,n=await e.value;r.push({key:t,value:n})}return e.mergeObjectSync(t,r)}static mergeObjectSync(e,t){let n={};for(let r of t){let{key:t,value:i}=r;if(t.status===`aborted`||i.status===`aborted`)return g;t.status===`dirty`&&e.dirty(),i.status===`dirty`&&e.dirty(),t.value!==`__proto__`&&(i.value!==void 0||r.alwaysSet)&&(n[t.value]=i.value)}return{status:e.value,value:n}}};let g=Object.freeze({status:`aborted`}),ce=e=>({status:`dirty`,value:e}),_=e=>({status:`valid`,value:e}),le=e=>e.status===`aborted`,ue=e=>e.status===`dirty`,de=e=>e.status===`valid`,fe=e=>typeof Promise<`u`&&e instanceof Promise;function pe(e,t,n,r){if(n===`a`&&!r)throw TypeError(`Private accessor was defined without a getter`);if(typeof t==`function`?e!==t||!r:!t.has(e))throw TypeError(`Cannot read private member from an object whose class did not declare it`);return n===`m`?r:n===`a`?r.call(e):r?r.value:t.get(e)}function me(e,t,n,r,i){if(r===`m`)throw TypeError(`Private method is not writable`);if(r===`a`&&!i)throw TypeError(`Private accessor was defined without a setter`);if(typeof t==`function`?e!==t||!i:!t.has(e))throw TypeError(`Cannot write private member to an object whose class did not declare it`);return r===`a`?i.call(e,n):i?i.value=n:t.set(e,n),n}var v;(function(e){e.errToObj=e=>typeof e==`string`?{message:e}:e||{},e.toString=e=>typeof e==`string`?e:e?.message})(v||={});var he,ge,y=class{constructor(e,t,n,r){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=r}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}};let _e=(e,t)=>{if(de(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw Error(`Validation failed but no issues detected.`);return{success:!1,get error(){return this._error||=new p(e.common.issues),this._error}}};function b(e){if(!e)return{};let{errorMap:t,invalid_type_error:n,required_error:r,description:i}=e;if(t&&(n||r))throw Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:i}:{errorMap:(t,i)=>{let{message:a}=e;return t.code===`invalid_enum_value`?{message:a??i.defaultError}:i.data===void 0?{message:a??r??i.defaultError}:t.code===`invalid_type`?{message:a??n??i.defaultError}:{message:i.defaultError}},description:i}}var x=class{get description(){return this._def.description}_getType(e){return d(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:d(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new h,ctx:{common:e.parent.common,data:e.data,parsedType:d(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(fe(t))throw Error(`Synchronous parse encountered promise.`);return t}_parseAsync(e){let t=this._parse(e);return Promise.resolve(t)}parse(e,t){let n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){let n={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:d(e)};return _e(n,this._parseSync({data:e,path:n.path,parent:n}))}"~validate"(e){let t={common:{issues:[],async:!!this[`~standard`].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:d(e)};if(!this[`~standard`].async)try{let n=this._parseSync({data:e,path:[],parent:t});return de(n)?{value:n.value}:{issues:t.common.issues}}catch(e){((e?.message)?.toLowerCase())?.includes(`encountered`)&&(this[`~standard`].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(e=>de(e)?{value:e.value}:{issues:t.common.issues})}async parseAsync(e,t){let n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){let n={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:d(e)},r=this._parse({data:e,path:n.path,parent:n});return _e(n,await(fe(r)?r:Promise.resolve(r)))}refine(e,t){let n=e=>typeof t==`string`||t===void 0?{message:t}:typeof t==`function`?t(e):t;return this._refinement((t,r)=>{let i=e(t),a=()=>r.addIssue({code:f.custom,...n(t)});return typeof Promise<`u`&&i instanceof Promise?i.then(e=>e?!0:(a(),!1)):i?!0:(a(),!1)})}refinement(e,t){return this._refinement((n,r)=>e(n)?!0:(r.addIssue(typeof t==`function`?t(n,r):t),!1))}_refinement(e){return new T({schema:this,typeName:D.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 E.create(this,this._def)}nullable(){return gt.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return $e.create(this)}promise(){return ht.create(this,this._def)}or(e){return tt.create([this,e],this._def)}and(e){return it.create(this,e,this._def)}transform(e){return new T({...b(this._def),schema:this,typeName:D.ZodEffects,effect:{type:`transform`,transform:e}})}default(e){let t=typeof e==`function`?e:()=>e;return new _t({...b(this._def),innerType:this,defaultValue:t,typeName:D.ZodDefault})}brand(){return new xt({typeName:D.ZodBranded,type:this,...b(this._def)})}catch(e){let t=typeof e==`function`?e:()=>e;return new vt({...b(this._def),innerType:this,catchValue:t,typeName:D.ZodCatch})}describe(e){let t=this.constructor;return new t({...this._def,description:e})}pipe(e){return St.create(this,e)}readonly(){return Ct.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}};let ve=/^c[^\s-]{8,}$/i,ye=/^[0-9a-z]+$/,be=/^[0-9A-HJKMNP-TV-Z]{26}$/i,xe=/^[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,Se=/^[a-z0-9_-]{21}$/i,Ce=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,we=/^[-+]?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)?)??$/,Te=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Ee,De=/^(?:(?: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])$/,Oe=/^(?:(?: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])$/,ke=/^(([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]))$/,Ae=/^(([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])$/,je=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Me=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Ne=`((\\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])))`,Pe=RegExp(`^${Ne}$`);function Fe(e){let t=`([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d`;return e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision??(t=`${t}(\\.\\d+)?`),t}function Ie(e){return RegExp(`^${Fe(e)}$`)}function Le(e){let t=`${Ne}T${Fe(e)}`,n=[];return n.push(e.local?`Z?`:`Z`),e.offset&&n.push(`([+-]\\d{2}:?\\d{2})`),t=`${t}(${n.join(`|`)})`,RegExp(`^${t}$`)}function Re(e,t){return!!((t===`v4`||!t)&&De.test(e)||(t===`v6`||!t)&&ke.test(e))}function ze(e,t){if(!Ce.test(e))return!1;try{let[n]=e.split(`.`),r=n.replace(/-/g,`+`).replace(/_/g,`/`).padEnd(n.length+(4-n.length%4)%4,`=`),i=JSON.parse(atob(r));return!(typeof i!=`object`||!i||!i.typ||!i.alg||t&&i.alg!==t)}catch{return!1}}function Be(e,t){return!!((t===`v4`||!t)&&Oe.test(e)||(t===`v6`||!t)&&Ae.test(e))}var Ve=class e extends x{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==u.string){let t=this._getOrReturnCtx(e);return m(t,{code:f.invalid_type,expected:u.string,received:t.parsedType}),g}let t=new h,n;for(let r of this._def.checks)if(r.kind===`min`)e.data.length<r.value&&(n=this._getOrReturnCtx(e,n),m(n,{code:f.too_small,minimum:r.value,type:`string`,inclusive:!0,exact:!1,message:r.message}),t.dirty());else if(r.kind===`max`)e.data.length>r.value&&(n=this._getOrReturnCtx(e,n),m(n,{code:f.too_big,maximum:r.value,type:`string`,inclusive:!0,exact:!1,message:r.message}),t.dirty());else if(r.kind===`length`){let i=e.data.length>r.value,a=e.data.length<r.value;(i||a)&&(n=this._getOrReturnCtx(e,n),i?m(n,{code:f.too_big,maximum:r.value,type:`string`,inclusive:!0,exact:!0,message:r.message}):a&&m(n,{code:f.too_small,minimum:r.value,type:`string`,inclusive:!0,exact:!0,message:r.message}),t.dirty())}else if(r.kind===`email`)Te.test(e.data)||(n=this._getOrReturnCtx(e,n),m(n,{validation:`email`,code:f.invalid_string,message:r.message}),t.dirty());else if(r.kind===`emoji`)Ee||=RegExp(`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`,`u`),Ee.test(e.data)||(n=this._getOrReturnCtx(e,n),m(n,{validation:`emoji`,code:f.invalid_string,message:r.message}),t.dirty());else if(r.kind===`uuid`)xe.test(e.data)||(n=this._getOrReturnCtx(e,n),m(n,{validation:`uuid`,code:f.invalid_string,message:r.message}),t.dirty());else if(r.kind===`nanoid`)Se.test(e.data)||(n=this._getOrReturnCtx(e,n),m(n,{validation:`nanoid`,code:f.invalid_string,message:r.message}),t.dirty());else if(r.kind===`cuid`)ve.test(e.data)||(n=this._getOrReturnCtx(e,n),m(n,{validation:`cuid`,code:f.invalid_string,message:r.message}),t.dirty());else if(r.kind===`cuid2`)ye.test(e.data)||(n=this._getOrReturnCtx(e,n),m(n,{validation:`cuid2`,code:f.invalid_string,message:r.message}),t.dirty());else if(r.kind===`ulid`)be.test(e.data)||(n=this._getOrReturnCtx(e,n),m(n,{validation:`ulid`,code:f.invalid_string,message:r.message}),t.dirty());else if(r.kind===`url`)try{new URL(e.data)}catch{n=this._getOrReturnCtx(e,n),m(n,{validation:`url`,code:f.invalid_string,message:r.message}),t.dirty()}else r.kind===`regex`?(r.regex.lastIndex=0,r.regex.test(e.data)||(n=this._getOrReturnCtx(e,n),m(n,{validation:`regex`,code:f.invalid_string,message:r.message}),t.dirty())):r.kind===`trim`?e.data=e.data.trim():r.kind===`includes`?e.data.includes(r.value,r.position)||(n=this._getOrReturnCtx(e,n),m(n,{code:f.invalid_string,validation:{includes:r.value,position:r.position},message:r.message}),t.dirty()):r.kind===`toLowerCase`?e.data=e.data.toLowerCase():r.kind===`toUpperCase`?e.data=e.data.toUpperCase():r.kind===`startsWith`?e.data.startsWith(r.value)||(n=this._getOrReturnCtx(e,n),m(n,{code:f.invalid_string,validation:{startsWith:r.value},message:r.message}),t.dirty()):r.kind===`endsWith`?e.data.endsWith(r.value)||(n=this._getOrReturnCtx(e,n),m(n,{code:f.invalid_string,validation:{endsWith:r.value},message:r.message}),t.dirty()):r.kind===`datetime`?Le(r).test(e.data)||(n=this._getOrReturnCtx(e,n),m(n,{code:f.invalid_string,validation:`datetime`,message:r.message}),t.dirty()):r.kind===`date`?Pe.test(e.data)||(n=this._getOrReturnCtx(e,n),m(n,{code:f.invalid_string,validation:`date`,message:r.message}),t.dirty()):r.kind===`time`?Ie(r).test(e.data)||(n=this._getOrReturnCtx(e,n),m(n,{code:f.invalid_string,validation:`time`,message:r.message}),t.dirty()):r.kind===`duration`?we.test(e.data)||(n=this._getOrReturnCtx(e,n),m(n,{validation:`duration`,code:f.invalid_string,message:r.message}),t.dirty()):r.kind===`ip`?Re(e.data,r.version)||(n=this._getOrReturnCtx(e,n),m(n,{validation:`ip`,code:f.invalid_string,message:r.message}),t.dirty()):r.kind===`jwt`?ze(e.data,r.alg)||(n=this._getOrReturnCtx(e,n),m(n,{validation:`jwt`,code:f.invalid_string,message:r.message}),t.dirty()):r.kind===`cidr`?Be(e.data,r.version)||(n=this._getOrReturnCtx(e,n),m(n,{validation:`cidr`,code:f.invalid_string,message:r.message}),t.dirty()):r.kind===`base64`?je.test(e.data)||(n=this._getOrReturnCtx(e,n),m(n,{validation:`base64`,code:f.invalid_string,message:r.message}),t.dirty()):r.kind===`base64url`?Me.test(e.data)||(n=this._getOrReturnCtx(e,n),m(n,{validation:`base64url`,code:f.invalid_string,message:r.message}),t.dirty()):l.assertNever(r);return{status:t.value,value:e.data}}_regex(e,t,n){return this.refinement(t=>e.test(t),{validation:t,code:f.invalid_string,...v.errToObj(n)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(e){return this._addCheck({kind:`email`,...v.errToObj(e)})}url(e){return this._addCheck({kind:`url`,...v.errToObj(e)})}emoji(e){return this._addCheck({kind:`emoji`,...v.errToObj(e)})}uuid(e){return this._addCheck({kind:`uuid`,...v.errToObj(e)})}nanoid(e){return this._addCheck({kind:`nanoid`,...v.errToObj(e)})}cuid(e){return this._addCheck({kind:`cuid`,...v.errToObj(e)})}cuid2(e){return this._addCheck({kind:`cuid2`,...v.errToObj(e)})}ulid(e){return this._addCheck({kind:`ulid`,...v.errToObj(e)})}base64(e){return this._addCheck({kind:`base64`,...v.errToObj(e)})}base64url(e){return this._addCheck({kind:`base64url`,...v.errToObj(e)})}jwt(e){return this._addCheck({kind:`jwt`,...v.errToObj(e)})}ip(e){return this._addCheck({kind:`ip`,...v.errToObj(e)})}cidr(e){return this._addCheck({kind:`cidr`,...v.errToObj(e)})}datetime(e){return typeof e==`string`?this._addCheck({kind:`datetime`,precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:`datetime`,precision:e?.precision===void 0?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...v.errToObj(e?.message)})}date(e){return this._addCheck({kind:`date`,message:e})}time(e){return typeof e==`string`?this._addCheck({kind:`time`,precision:null,message:e}):this._addCheck({kind:`time`,precision:e?.precision===void 0?null:e?.precision,...v.errToObj(e?.message)})}duration(e){return this._addCheck({kind:`duration`,...v.errToObj(e)})}regex(e,t){return this._addCheck({kind:`regex`,regex:e,...v.errToObj(t)})}includes(e,t){return this._addCheck({kind:`includes`,value:e,position:t?.position,...v.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:`startsWith`,value:e,...v.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:`endsWith`,value:e,...v.errToObj(t)})}min(e,t){return this._addCheck({kind:`min`,value:e,...v.errToObj(t)})}max(e,t){return this._addCheck({kind:`max`,value:e,...v.errToObj(t)})}length(e,t){return this._addCheck({kind:`length`,value:e,...v.errToObj(t)})}nonempty(e){return this.min(1,v.errToObj(e))}trim(){return new e({...this._def,checks:[...this._def.checks,{kind:`trim`}]})}toLowerCase(){return new e({...this._def,checks:[...this._def.checks,{kind:`toLowerCase`}]})}toUpperCase(){return new e({...this._def,checks:[...this._def.checks,{kind:`toUpperCase`}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind===`datetime`)}get isDate(){return!!this._def.checks.find(e=>e.kind===`date`)}get isTime(){return!!this._def.checks.find(e=>e.kind===`time`)}get isDuration(){return!!this._def.checks.find(e=>e.kind===`duration`)}get isEmail(){return!!this._def.checks.find(e=>e.kind===`email`)}get isURL(){return!!this._def.checks.find(e=>e.kind===`url`)}get isEmoji(){return!!this._def.checks.find(e=>e.kind===`emoji`)}get isUUID(){return!!this._def.checks.find(e=>e.kind===`uuid`)}get isNANOID(){return!!this._def.checks.find(e=>e.kind===`nanoid`)}get isCUID(){return!!this._def.checks.find(e=>e.kind===`cuid`)}get isCUID2(){return!!this._def.checks.find(e=>e.kind===`cuid2`)}get isULID(){return!!this._def.checks.find(e=>e.kind===`ulid`)}get isIP(){return!!this._def.checks.find(e=>e.kind===`ip`)}get isCIDR(){return!!this._def.checks.find(e=>e.kind===`cidr`)}get isBase64(){return!!this._def.checks.find(e=>e.kind===`base64`)}get isBase64url(){return!!this._def.checks.find(e=>e.kind===`base64url`)}get minLength(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.value<e)&&(e=t.value);return e}};Ve.create=e=>new Ve({checks:[],typeName:D.ZodString,coerce:e?.coerce??!1,...b(e)});function He(e,t){let n=(e.toString().split(`.`)[1]||``).length,r=(t.toString().split(`.`)[1]||``).length,i=n>r?n:r;return parseInt(e.toFixed(i).replace(`.`,``))%parseInt(t.toFixed(i).replace(`.`,``))/10**i}var Ue=class e extends x{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){let t=this._getOrReturnCtx(e);return m(t,{code:f.invalid_type,expected:u.number,received:t.parsedType}),g}let t,n=new h;for(let r of this._def.checks)r.kind===`int`?l.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),m(t,{code:f.invalid_type,expected:`integer`,received:`float`,message:r.message}),n.dirty()):r.kind===`min`?(r.inclusive?e.data<r.value:e.data<=r.value)&&(t=this._getOrReturnCtx(e,t),m(t,{code:f.too_small,minimum:r.value,type:`number`,inclusive:r.inclusive,exact:!1,message:r.message}),n.dirty()):r.kind===`max`?(r.inclusive?e.data>r.value:e.data>=r.value)&&(t=this._getOrReturnCtx(e,t),m(t,{code:f.too_big,maximum:r.value,type:`number`,inclusive:r.inclusive,exact:!1,message:r.message}),n.dirty()):r.kind===`multipleOf`?He(e.data,r.value)!==0&&(t=this._getOrReturnCtx(e,t),m(t,{code:f.not_multiple_of,multipleOf:r.value,message:r.message}),n.dirty()):r.kind===`finite`?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),m(t,{code:f.not_finite,message:r.message}),n.dirty()):l.assertNever(r);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit(`min`,e,!0,v.toString(t))}gt(e,t){return this.setLimit(`min`,e,!1,v.toString(t))}lte(e,t){return this.setLimit(`max`,e,!0,v.toString(t))}lt(e,t){return this.setLimit(`max`,e,!1,v.toString(t))}setLimit(t,n,r,i){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:v.toString(i)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(e){return this._addCheck({kind:`int`,message:v.toString(e)})}positive(e){return this._addCheck({kind:`min`,value:0,inclusive:!1,message:v.toString(e)})}negative(e){return this._addCheck({kind:`max`,value:0,inclusive:!1,message:v.toString(e)})}nonpositive(e){return this._addCheck({kind:`max`,value:0,inclusive:!0,message:v.toString(e)})}nonnegative(e){return this._addCheck({kind:`min`,value:0,inclusive:!0,message:v.toString(e)})}multipleOf(e,t){return this._addCheck({kind:`multipleOf`,value:e,message:v.toString(t)})}finite(e){return this._addCheck({kind:`finite`,message:v.toString(e)})}safe(e){return this._addCheck({kind:`min`,inclusive:!0,value:-(2**53-1),message:v.toString(e)})._addCheck({kind:`max`,inclusive:!0,value:2**53-1,message:v.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind===`int`||e.kind===`multipleOf`&&l.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let n of this._def.checks)if(n.kind===`finite`||n.kind===`int`||n.kind===`multipleOf`)return!0;else n.kind===`min`?(t===null||n.value>t)&&(t=n.value):n.kind===`max`&&(e===null||n.value<e)&&(e=n.value);return Number.isFinite(t)&&Number.isFinite(e)}};Ue.create=e=>new Ue({checks:[],typeName:D.ZodNumber,coerce:e?.coerce||!1,...b(e)});var We=class e extends x{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,n=new h;for(let r of this._def.checks)r.kind===`min`?(r.inclusive?e.data<r.value:e.data<=r.value)&&(t=this._getOrReturnCtx(e,t),m(t,{code:f.too_small,type:`bigint`,minimum:r.value,inclusive:r.inclusive,message:r.message}),n.dirty()):r.kind===`max`?(r.inclusive?e.data>r.value:e.data>=r.value)&&(t=this._getOrReturnCtx(e,t),m(t,{code:f.too_big,type:`bigint`,maximum:r.value,inclusive:r.inclusive,message:r.message}),n.dirty()):r.kind===`multipleOf`?e.data%r.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),m(t,{code:f.not_multiple_of,multipleOf:r.value,message:r.message}),n.dirty()):l.assertNever(r);return{status:n.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return m(t,{code:f.invalid_type,expected:u.bigint,received:t.parsedType}),g}gte(e,t){return this.setLimit(`min`,e,!0,v.toString(t))}gt(e,t){return this.setLimit(`min`,e,!1,v.toString(t))}lte(e,t){return this.setLimit(`max`,e,!0,v.toString(t))}lt(e,t){return this.setLimit(`max`,e,!1,v.toString(t))}setLimit(t,n,r,i){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:v.toString(i)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}positive(e){return this._addCheck({kind:`min`,value:BigInt(0),inclusive:!1,message:v.toString(e)})}negative(e){return this._addCheck({kind:`max`,value:BigInt(0),inclusive:!1,message:v.toString(e)})}nonpositive(e){return this._addCheck({kind:`max`,value:BigInt(0),inclusive:!0,message:v.toString(e)})}nonnegative(e){return this._addCheck({kind:`min`,value:BigInt(0),inclusive:!0,message:v.toString(e)})}multipleOf(e,t){return this._addCheck({kind:`multipleOf`,value:e,message:v.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.value<e)&&(e=t.value);return e}};We.create=e=>new We({checks:[],typeName:D.ZodBigInt,coerce:e?.coerce??!1,...b(e)});var Ge=class extends x{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==u.boolean){let t=this._getOrReturnCtx(e);return m(t,{code:f.invalid_type,expected:u.boolean,received:t.parsedType}),g}return _(e.data)}};Ge.create=e=>new Ge({typeName:D.ZodBoolean,coerce:e?.coerce||!1,...b(e)});var Ke=class e extends x{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==u.date){let t=this._getOrReturnCtx(e);return m(t,{code:f.invalid_type,expected:u.date,received:t.parsedType}),g}if(isNaN(e.data.getTime()))return m(this._getOrReturnCtx(e),{code:f.invalid_date}),g;let t=new h,n;for(let r of this._def.checks)r.kind===`min`?e.data.getTime()<r.value&&(n=this._getOrReturnCtx(e,n),m(n,{code:f.too_small,message:r.message,inclusive:!0,exact:!1,minimum:r.value,type:`date`}),t.dirty()):r.kind===`max`?e.data.getTime()>r.value&&(n=this._getOrReturnCtx(e,n),m(n,{code:f.too_big,message:r.message,inclusive:!0,exact:!1,maximum:r.value,type:`date`}),t.dirty()):l.assertNever(r);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}min(e,t){return this._addCheck({kind:`min`,value:e.getTime(),message:v.toString(t)})}max(e,t){return this._addCheck({kind:`max`,value:e.getTime(),message:v.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e==null?null:new Date(e)}get maxDate(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.value<e)&&(e=t.value);return e==null?null:new Date(e)}};Ke.create=e=>new Ke({checks:[],coerce:e?.coerce||!1,typeName:D.ZodDate,...b(e)});var qe=class extends x{_parse(e){if(this._getType(e)!==u.symbol){let t=this._getOrReturnCtx(e);return m(t,{code:f.invalid_type,expected:u.symbol,received:t.parsedType}),g}return _(e.data)}};qe.create=e=>new qe({typeName:D.ZodSymbol,...b(e)});var Je=class extends x{_parse(e){if(this._getType(e)!==u.undefined){let t=this._getOrReturnCtx(e);return m(t,{code:f.invalid_type,expected:u.undefined,received:t.parsedType}),g}return _(e.data)}};Je.create=e=>new Je({typeName:D.ZodUndefined,...b(e)});var Ye=class extends x{_parse(e){if(this._getType(e)!==u.null){let t=this._getOrReturnCtx(e);return m(t,{code:f.invalid_type,expected:u.null,received:t.parsedType}),g}return _(e.data)}};Ye.create=e=>new Ye({typeName:D.ZodNull,...b(e)});var Xe=class extends x{constructor(){super(...arguments),this._any=!0}_parse(e){return _(e.data)}};Xe.create=e=>new Xe({typeName:D.ZodAny,...b(e)});var Ze=class extends x{constructor(){super(...arguments),this._unknown=!0}_parse(e){return _(e.data)}};Ze.create=e=>new Ze({typeName:D.ZodUnknown,...b(e)});var S=class extends x{_parse(e){let t=this._getOrReturnCtx(e);return m(t,{code:f.invalid_type,expected:u.never,received:t.parsedType}),g}};S.create=e=>new S({typeName:D.ZodNever,...b(e)});var Qe=class extends x{_parse(e){if(this._getType(e)!==u.undefined){let t=this._getOrReturnCtx(e);return m(t,{code:f.invalid_type,expected:u.void,received:t.parsedType}),g}return _(e.data)}};Qe.create=e=>new Qe({typeName:D.ZodVoid,...b(e)});var $e=class e extends x{_parse(e){let{ctx:t,status:n}=this._processInputParams(e),r=this._def;if(t.parsedType!==u.array)return m(t,{code:f.invalid_type,expected:u.array,received:t.parsedType}),g;if(r.exactLength!==null){let e=t.data.length>r.exactLength.value,i=t.data.length<r.exactLength.value;(e||i)&&(m(t,{code:e?f.too_big:f.too_small,minimum:i?r.exactLength.value:void 0,maximum:e?r.exactLength.value:void 0,type:`array`,inclusive:!0,exact:!0,message:r.exactLength.message}),n.dirty())}if(r.minLength!==null&&t.data.length<r.minLength.value&&(m(t,{code:f.too_small,minimum:r.minLength.value,type:`array`,inclusive:!0,exact:!1,message:r.minLength.message}),n.dirty()),r.maxLength!==null&&t.data.length>r.maxLength.value&&(m(t,{code:f.too_big,maximum:r.maxLength.value,type:`array`,inclusive:!0,exact:!1,message:r.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map((e,n)=>r.type._parseAsync(new y(t,e,t.path,n)))).then(e=>h.mergeArray(n,e));let i=[...t.data].map((e,n)=>r.type._parseSync(new y(t,e,t.path,n)));return h.mergeArray(n,i)}get element(){return this._def.type}min(t,n){return new e({...this._def,minLength:{value:t,message:v.toString(n)}})}max(t,n){return new e({...this._def,maxLength:{value:t,message:v.toString(n)}})}length(t,n){return new e({...this._def,exactLength:{value:t,message:v.toString(n)}})}nonempty(e){return this.min(1,e)}};$e.create=(e,t)=>new $e({type:e,minLength:null,maxLength:null,exactLength:null,typeName:D.ZodArray,...b(t)});function et(e){if(e instanceof C){let t={};for(let n in e.shape){let r=e.shape[n];t[n]=E.create(et(r))}return new C({...e._def,shape:()=>t})}else if(e instanceof $e)return new $e({...e._def,type:et(e.element)});else if(e instanceof E)return E.create(et(e.unwrap()));else if(e instanceof gt)return gt.create(et(e.unwrap()));else if(e instanceof at)return at.create(e.items.map(e=>et(e)));else return e}var C=class e extends x{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape();return this._cached={shape:e,keys:l.objectKeys(e)}}_parse(e){if(this._getType(e)!==u.object){let t=this._getOrReturnCtx(e);return m(t,{code:f.invalid_type,expected:u.object,received:t.parsedType}),g}let{status:t,ctx:n}=this._processInputParams(e),{shape:r,keys:i}=this._getCached(),a=[];if(!(this._def.catchall instanceof S&&this._def.unknownKeys===`strip`))for(let e in n.data)i.includes(e)||a.push(e);let o=[];for(let e of i){let t=r[e],i=n.data[e];o.push({key:{status:`valid`,value:e},value:t._parse(new y(n,i,n.path,e)),alwaysSet:e in n.data})}if(this._def.catchall instanceof S){let e=this._def.unknownKeys;if(e===`passthrough`)for(let e of a)o.push({key:{status:`valid`,value:e},value:{status:`valid`,value:n.data[e]}});else if(e===`strict`)a.length>0&&(m(n,{code:f.unrecognized_keys,keys:a}),t.dirty());else if(e!==`strip`)throw Error(`Internal ZodObject error: invalid unknownKeys value.`)}else{let e=this._def.catchall;for(let t of a){let r=n.data[t];o.push({key:{status:`valid`,value:t},value:e._parse(new y(n,r,n.path,t)),alwaysSet:t in n.data})}}return n.common.async?Promise.resolve().then(async()=>{let e=[];for(let t of o){let n=await t.key,r=await t.value;e.push({key:n,value:r,alwaysSet:t.alwaysSet})}return e}).then(e=>h.mergeObjectSync(t,e)):h.mergeObjectSync(t,o)}get shape(){return this._def.shape()}strict(t){return v.errToObj,new e({...this._def,unknownKeys:`strict`,...t===void 0?{}:{errorMap:(e,n)=>{var r;let i=(r=this._def).errorMap?.call(r,e,n).message??n.defaultError;return e.code===`unrecognized_keys`?{message:v.errToObj(t).message??i}:{message:i}}}})}strip(){return new e({...this._def,unknownKeys:`strip`})}passthrough(){return new e({...this._def,unknownKeys:`passthrough`})}extend(t){return new e({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new e({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:D.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(t){return new e({...this._def,catchall:t})}pick(t){let n={};return l.objectKeys(t).forEach(e=>{t[e]&&this.shape[e]&&(n[e]=this.shape[e])}),new e({...this._def,shape:()=>n})}omit(t){let n={};return l.objectKeys(this.shape).forEach(e=>{t[e]||(n[e]=this.shape[e])}),new e({...this._def,shape:()=>n})}deepPartial(){return et(this)}partial(t){let n={};return l.objectKeys(this.shape).forEach(e=>{let r=this.shape[e];t&&!t[e]?n[e]=r:n[e]=r.optional()}),new e({...this._def,shape:()=>n})}required(t){let n={};return l.objectKeys(this.shape).forEach(e=>{if(t&&!t[e])n[e]=this.shape[e];else{let t=this.shape[e];for(;t instanceof E;)t=t._def.innerType;n[e]=t}}),new e({...this._def,shape:()=>n})}keyof(){return ft(l.objectKeys(this.shape))}};C.create=(e,t)=>new C({shape:()=>e,unknownKeys:`strip`,catchall:S.create(),typeName:D.ZodObject,...b(t)}),C.strictCreate=(e,t)=>new C({shape:()=>e,unknownKeys:`strict`,catchall:S.create(),typeName:D.ZodObject,...b(t)}),C.lazycreate=(e,t)=>new C({shape:e,unknownKeys:`strip`,catchall:S.create(),typeName:D.ZodObject,...b(t)});var tt=class extends x{_parse(e){let{ctx:t}=this._processInputParams(e),n=this._def.options;function r(e){for(let t of e)if(t.result.status===`valid`)return t.result;for(let n of e)if(n.result.status===`dirty`)return t.common.issues.push(...n.ctx.common.issues),n.result;let n=e.map(e=>new p(e.ctx.common.issues));return m(t,{code:f.invalid_union,unionErrors:n}),g}if(t.common.async)return Promise.all(n.map(async e=>{let n={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:n}),ctx:n}})).then(r);{let e,r=[];for(let i of n){let n={...t,common:{...t.common,issues:[]},parent:null},a=i._parseSync({data:t.data,path:t.path,parent:n});if(a.status===`valid`)return a;a.status===`dirty`&&!e&&(e={result:a,ctx:n}),n.common.issues.length&&r.push(n.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;let i=r.map(e=>new p(e));return m(t,{code:f.invalid_union,unionErrors:i}),g}}get options(){return this._def.options}};tt.create=(e,t)=>new tt({options:e,typeName:D.ZodUnion,...b(t)});let w=e=>e instanceof ut?w(e.schema):e instanceof T?w(e.innerType()):e instanceof dt?[e.value]:e instanceof pt?e.options:e instanceof mt?l.objectValues(e.enum):e instanceof _t?w(e._def.innerType):e instanceof Je?[void 0]:e instanceof Ye?[null]:e instanceof E?[void 0,...w(e.unwrap())]:e instanceof gt?[null,...w(e.unwrap())]:e instanceof xt||e instanceof Ct?w(e.unwrap()):e instanceof vt?w(e._def.innerType):[];var nt=class e extends x{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==u.object)return m(t,{code:f.invalid_type,expected:u.object,received:t.parsedType}),g;let n=this.discriminator,r=t.data[n],i=this.optionsMap.get(r);return i?t.common.async?i._parseAsync({data:t.data,path:t.path,parent:t}):i._parseSync({data:t.data,path:t.path,parent:t}):(m(t,{code:f.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),g)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,n,r){let i=new Map;for(let e of n){let n=w(e.shape[t]);if(!n.length)throw Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(let r of n){if(i.has(r))throw Error(`Discriminator property ${String(t)} has duplicate value ${String(r)}`);i.set(r,e)}}return new e({typeName:D.ZodDiscriminatedUnion,discriminator:t,options:n,optionsMap:i,...b(r)})}};function rt(e,t){let n=d(e),r=d(t);if(e===t)return{valid:!0,data:e};if(n===u.object&&r===u.object){let n=l.objectKeys(t),r=l.objectKeys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};for(let n of r){let r=rt(e[n],t[n]);if(!r.valid)return{valid:!1};i[n]=r.data}return{valid:!0,data:i}}else if(n===u.array&&r===u.array){if(e.length!==t.length)return{valid:!1};let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t[r],o=rt(i,a);if(!o.valid)return{valid:!1};n.push(o.data)}return{valid:!0,data:n}}else if(n===u.date&&r===u.date&&+e==+t)return{valid:!0,data:e};else return{valid:!1}}var it=class extends x{_parse(e){let{status:t,ctx:n}=this._processInputParams(e),r=(e,r)=>{if(le(e)||le(r))return g;let i=rt(e.value,r.value);return i.valid?((ue(e)||ue(r))&&t.dirty(),{status:t.value,value:i.data}):(m(n,{code:f.invalid_intersection_types}),g)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([e,t])=>r(e,t)):r(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};it.create=(e,t,n)=>new it({left:e,right:t,typeName:D.ZodIntersection,...b(n)});var at=class e extends x{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==u.array)return m(n,{code:f.invalid_type,expected:u.array,received:n.parsedType}),g;if(n.data.length<this._def.items.length)return m(n,{code:f.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:`array`}),g;!this._def.rest&&n.data.length>this._def.items.length&&(m(n,{code:f.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:`array`}),t.dirty());let r=[...n.data].map((e,t)=>{let r=this._def.items[t]||this._def.rest;return r?r._parse(new y(n,e,n.path,t)):null}).filter(e=>!!e);return n.common.async?Promise.all(r).then(e=>h.mergeArray(t,e)):h.mergeArray(t,r)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};at.create=(e,t)=>{if(!Array.isArray(e))throw Error(`You must pass an array of schemas to z.tuple([ ... ])`);return new at({items:e,typeName:D.ZodTuple,rest:null,...b(t)})};var ot=class e extends x{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==u.object)return m(n,{code:f.invalid_type,expected:u.object,received:n.parsedType}),g;let r=[],i=this._def.keyType,a=this._def.valueType;for(let e in n.data)r.push({key:i._parse(new y(n,e,n.path,e)),value:a._parse(new y(n,n.data[e],n.path,e)),alwaysSet:e in n.data});return n.common.async?h.mergeObjectAsync(t,r):h.mergeObjectSync(t,r)}get element(){return this._def.valueType}static create(t,n,r){return n instanceof x?new e({keyType:t,valueType:n,typeName:D.ZodRecord,...b(r)}):new e({keyType:Ve.create(),valueType:t,typeName:D.ZodRecord,...b(n)})}},st=class extends x{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==u.map)return m(n,{code:f.invalid_type,expected:u.map,received:n.parsedType}),g;let r=this._def.keyType,i=this._def.valueType,a=[...n.data.entries()].map(([e,t],a)=>({key:r._parse(new y(n,e,n.path,[a,`key`])),value:i._parse(new y(n,t,n.path,[a,`value`]))}));if(n.common.async){let e=new Map;return Promise.resolve().then(async()=>{for(let n of a){let r=await n.key,i=await n.value;if(r.status===`aborted`||i.status===`aborted`)return g;(r.status===`dirty`||i.status===`dirty`)&&t.dirty(),e.set(r.value,i.value)}return{status:t.value,value:e}})}else{let e=new Map;for(let n of a){let r=n.key,i=n.value;if(r.status===`aborted`||i.status===`aborted`)return g;(r.status===`dirty`||i.status===`dirty`)&&t.dirty(),e.set(r.value,i.value)}return{status:t.value,value:e}}}};st.create=(e,t,n)=>new st({valueType:t,keyType:e,typeName:D.ZodMap,...b(n)});var ct=class e extends x{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==u.set)return m(n,{code:f.invalid_type,expected:u.set,received:n.parsedType}),g;let r=this._def;r.minSize!==null&&n.data.size<r.minSize.value&&(m(n,{code:f.too_small,minimum:r.minSize.value,type:`set`,inclusive:!0,exact:!1,message:r.minSize.message}),t.dirty()),r.maxSize!==null&&n.data.size>r.maxSize.value&&(m(n,{code:f.too_big,maximum:r.maxSize.value,type:`set`,inclusive:!0,exact:!1,message:r.maxSize.message}),t.dirty());let i=this._def.valueType;function a(e){let n=new Set;for(let r of e){if(r.status===`aborted`)return g;r.status===`dirty`&&t.dirty(),n.add(r.value)}return{status:t.value,value:n}}let o=[...n.data.values()].map((e,t)=>i._parse(new y(n,e,n.path,t)));return n.common.async?Promise.all(o).then(e=>a(e)):a(o)}min(t,n){return new e({...this._def,minSize:{value:t,message:v.toString(n)}})}max(t,n){return new e({...this._def,maxSize:{value:t,message:v.toString(n)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};ct.create=(e,t)=>new ct({valueType:e,minSize:null,maxSize:null,typeName:D.ZodSet,...b(t)});var lt=class e extends x{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==u.function)return m(t,{code:f.invalid_type,expected:u.function,received:t.parsedType}),g;function n(e,n){return oe({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,ae(),ne].filter(e=>!!e),issueData:{code:f.invalid_arguments,argumentsError:n}})}function r(e,n){return oe({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,ae(),ne].filter(e=>!!e),issueData:{code:f.invalid_return_type,returnTypeError:n}})}let i={errorMap:t.common.contextualErrorMap},a=t.data;if(this._def.returns instanceof ht){let e=this;return _(async function(...t){let o=new p([]),s=await e._def.args.parseAsync(t,i).catch(e=>{throw o.addIssue(n(t,e)),o}),c=await Reflect.apply(a,this,s);return await e._def.returns._def.type.parseAsync(c,i).catch(e=>{throw o.addIssue(r(c,e)),o})})}else{let e=this;return _(function(...t){let o=e._def.args.safeParse(t,i);if(!o.success)throw new p([n(t,o.error)]);let s=Reflect.apply(a,this,o.data),c=e._def.returns.safeParse(s,i);if(!c.success)throw new p([r(s,c.error)]);return c.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e({...this._def,args:at.create(t).rest(Ze.create())})}returns(t){return new e({...this._def,returns:t})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(t,n,r){return new e({args:t||at.create([]).rest(Ze.create()),returns:n||Ze.create(),typeName:D.ZodFunction,...b(r)})}},ut=class extends x{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}};ut.create=(e,t)=>new ut({getter:e,typeName:D.ZodLazy,...b(t)});var dt=class extends x{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return m(t,{received:t.data,code:f.invalid_literal,expected:this._def.value}),g}return{status:`valid`,value:e.data}}get value(){return this._def.value}};dt.create=(e,t)=>new dt({value:e,typeName:D.ZodLiteral,...b(t)});function ft(e,t){return new pt({values:e,typeName:D.ZodEnum,...b(t)})}var pt=class e extends x{constructor(){super(...arguments),he.set(this,void 0)}_parse(e){if(typeof e.data!=`string`){let t=this._getOrReturnCtx(e),n=this._def.values;return m(t,{expected:l.joinValues(n),received:t.parsedType,code:f.invalid_type}),g}if(pe(this,he,`f`)||me(this,he,new Set(this._def.values),`f`),!pe(this,he,`f`).has(e.data)){let t=this._getOrReturnCtx(e),n=this._def.values;return m(t,{received:t.data,code:f.invalid_enum_value,options:n}),g}return _(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}extract(t,n=this._def){return e.create(t,{...this._def,...n})}exclude(t,n=this._def){return e.create(this.options.filter(e=>!t.includes(e)),{...this._def,...n})}};he=new WeakMap,pt.create=ft;var mt=class extends x{constructor(){super(...arguments),ge.set(this,void 0)}_parse(e){let t=l.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==u.string&&n.parsedType!==u.number){let e=l.objectValues(t);return m(n,{expected:l.joinValues(e),received:n.parsedType,code:f.invalid_type}),g}if(pe(this,ge,`f`)||me(this,ge,new Set(l.getValidEnumValues(this._def.values)),`f`),!pe(this,ge,`f`).has(e.data)){let e=l.objectValues(t);return m(n,{received:n.data,code:f.invalid_enum_value,options:e}),g}return _(e.data)}get enum(){return this._def.values}};ge=new WeakMap,mt.create=(e,t)=>new mt({values:e,typeName:D.ZodNativeEnum,...b(t)});var ht=class extends x{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);return t.parsedType!==u.promise&&t.common.async===!1?(m(t,{code:f.invalid_type,expected:u.promise,received:t.parsedType}),g):_((t.parsedType===u.promise?t.data:Promise.resolve(t.data)).then(e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap})))}};ht.create=(e,t)=>new ht({type:e,typeName:D.ZodPromise,...b(t)});var T=class extends x{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===D.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:n}=this._processInputParams(e),r=this._def.effect||null,i={addIssue:e=>{m(n,e),e.fatal?t.abort():t.dirty()},get path(){return n.path}};if(i.addIssue=i.addIssue.bind(i),r.type===`preprocess`){let e=r.transform(n.data,i);if(n.common.async)return Promise.resolve(e).then(async e=>{if(t.value===`aborted`)return g;let r=await this._def.schema._parseAsync({data:e,path:n.path,parent:n});return r.status===`aborted`?g:r.status===`dirty`||t.value===`dirty`?ce(r.value):r});{if(t.value===`aborted`)return g;let r=this._def.schema._parseSync({data:e,path:n.path,parent:n});return r.status===`aborted`?g:r.status===`dirty`||t.value===`dirty`?ce(r.value):r}}if(r.type===`refinement`){let e=e=>{let t=r.refinement(e,i);if(n.common.async)return Promise.resolve(t);if(t instanceof Promise)throw Error(`Async refinement encountered during synchronous parse operation. Use .parseAsync instead.`);return e};if(n.common.async===!1){let r=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return r.status===`aborted`?g:(r.status===`dirty`&&t.dirty(),e(r.value),{status:t.value,value:r.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(n=>n.status===`aborted`?g:(n.status===`dirty`&&t.dirty(),e(n.value).then(()=>({status:t.value,value:n.value}))))}if(r.type===`transform`)if(n.common.async===!1){let e=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!de(e))return e;let a=r.transform(e.value,i);if(a instanceof Promise)throw Error(`Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.`);return{status:t.value,value:a}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(e=>de(e)?Promise.resolve(r.transform(e.value,i)).then(e=>({status:t.value,value:e})):e);l.assertNever(r)}};T.create=(e,t,n)=>new T({schema:e,typeName:D.ZodEffects,effect:t,...b(n)}),T.createWithPreprocess=(e,t,n)=>new T({schema:t,effect:{type:`preprocess`,transform:e},typeName:D.ZodEffects,...b(n)});var E=class extends x{_parse(e){return this._getType(e)===u.undefined?_(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};E.create=(e,t)=>new E({innerType:e,typeName:D.ZodOptional,...b(t)});var gt=class extends x{_parse(e){return this._getType(e)===u.null?_(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};gt.create=(e,t)=>new gt({innerType:e,typeName:D.ZodNullable,...b(t)});var _t=class extends x{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return t.parsedType===u.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};_t.create=(e,t)=>new _t({innerType:e,typeName:D.ZodDefault,defaultValue:typeof t.default==`function`?t.default:()=>t.default,...b(t)});var vt=class extends x{_parse(e){let{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},r=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return fe(r)?r.then(e=>({status:`valid`,value:e.status===`valid`?e.value:this._def.catchValue({get error(){return new p(n.common.issues)},input:n.data})})):{status:`valid`,value:r.status===`valid`?r.value:this._def.catchValue({get error(){return new p(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};vt.create=(e,t)=>new vt({innerType:e,typeName:D.ZodCatch,catchValue:typeof t.catch==`function`?t.catch:()=>t.catch,...b(t)});var yt=class extends x{_parse(e){if(this._getType(e)!==u.nan){let t=this._getOrReturnCtx(e);return m(t,{code:f.invalid_type,expected:u.nan,received:t.parsedType}),g}return{status:`valid`,value:e.data}}};yt.create=e=>new yt({typeName:D.ZodNaN,...b(e)});let bt=Symbol(`zod_brand`);var xt=class extends x{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}},St=class e extends x{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{let e=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return e.status===`aborted`?g:e.status===`dirty`?(t.dirty(),ce(e.value)):this._def.out._parseAsync({data:e.value,path:n.path,parent:n})})();{let e=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return e.status===`aborted`?g:e.status===`dirty`?(t.dirty(),{status:`dirty`,value:e.value}):this._def.out._parseSync({data:e.value,path:n.path,parent:n})}}static create(t,n){return new e({in:t,out:n,typeName:D.ZodPipeline})}},Ct=class extends x{_parse(e){let t=this._def.innerType._parse(e),n=e=>(de(e)&&(e.value=Object.freeze(e.value)),e);return fe(t)?t.then(e=>n(e)):n(t)}unwrap(){return this._def.innerType}};Ct.create=(e,t)=>new Ct({innerType:e,typeName:D.ZodReadonly,...b(t)});function wt(e,t={},n){return e?Xe.create().superRefine((r,i)=>{if(!e(r)){let e=typeof t==`function`?t(r):typeof t==`string`?{message:t}:t,a=e.fatal??n??!0,o=typeof e==`string`?{message:e}:e;i.addIssue({code:`custom`,...o,fatal:a})}}):Xe.create()}let Tt={object:C.lazycreate};var D;(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`})(D||={});let Et=(e,t={message:`Input not instance of ${e.name}`})=>wt(t=>t instanceof e,t),Dt=Ve.create,Ot=Ue.create,kt=yt.create,At=We.create,jt=Ge.create,Mt=Ke.create,Nt=qe.create,Pt=Je.create,Ft=Ye.create,It=Xe.create,Lt=Ze.create,Rt=S.create,zt=Qe.create,Bt=$e.create,Vt=C.create,Ht=C.strictCreate,Ut=tt.create,Wt=nt.create,Gt=it.create,Kt=at.create,qt=ot.create,Jt=st.create,Yt=ct.create,Xt=lt.create,Zt=ut.create,Qt=dt.create,$t=pt.create,en=mt.create,tn=ht.create,nn=T.create,rn=E.create,an=gt.create,on=T.createWithPreprocess,sn=St.create,cn=()=>Dt().optional(),ln=()=>Ot().optional(),un=()=>jt().optional(),dn={string:(e=>Ve.create({...e,coerce:!0})),number:(e=>Ue.create({...e,coerce:!0})),boolean:(e=>Ge.create({...e,coerce:!0})),bigint:(e=>We.create({...e,coerce:!0})),date:(e=>Ke.create({...e,coerce:!0}))},fn=g;var O=Object.freeze({__proto__:null,defaultErrorMap:ne,setErrorMap:ie,getErrorMap:ae,makeIssue:oe,EMPTY_PATH:se,addIssueToContext:m,ParseStatus:h,INVALID:g,DIRTY:ce,OK:_,isAborted:le,isDirty:ue,isValid:de,isAsync:fe,get util(){return l},get objectUtil(){return ee},ZodParsedType:u,getParsedType:d,ZodType:x,datetimeRegex:Le,ZodString:Ve,ZodNumber:Ue,ZodBigInt:We,ZodBoolean:Ge,ZodDate:Ke,ZodSymbol:qe,ZodUndefined:Je,ZodNull:Ye,ZodAny:Xe,ZodUnknown:Ze,ZodNever:S,ZodVoid:Qe,ZodArray:$e,ZodObject:C,ZodUnion:tt,ZodDiscriminatedUnion:nt,ZodIntersection:it,ZodTuple:at,ZodRecord:ot,ZodMap:st,ZodSet:ct,ZodFunction:lt,ZodLazy:ut,ZodLiteral:dt,ZodEnum:pt,ZodNativeEnum:mt,ZodPromise:ht,ZodEffects:T,ZodTransformer:T,ZodOptional:E,ZodNullable:gt,ZodDefault:_t,ZodCatch:vt,ZodNaN:yt,BRAND:bt,ZodBranded:xt,ZodPipeline:St,ZodReadonly:Ct,custom:wt,Schema:x,ZodSchema:x,late:Tt,get ZodFirstPartyTypeKind(){return D},coerce:dn,any:It,array:Bt,bigint:At,boolean:jt,date:Mt,discriminatedUnion:Wt,effect:nn,enum:$t,function:Xt,instanceof:Et,intersection:Gt,lazy:Zt,literal:Qt,map:Jt,nan:kt,nativeEnum:en,never:Rt,null:Ft,nullable:an,number:Ot,object:Vt,oboolean:un,onumber:ln,optional:rn,ostring:cn,pipeline:sn,preprocess:on,promise:tn,record:qt,set:Yt,strictObject:Ht,string:Dt,symbol:Nt,transformer:nn,tuple:Kt,undefined:Pt,union:Ut,unknown:Lt,void:zt,NEVER:fn,ZodIssueCode:f,quotelessJson:te,ZodError:p});let pn=O.union([O.string(),O.number().int()]),mn=O.string(),hn=O.object({progressToken:O.optional(pn)}).passthrough(),k=O.object({_meta:O.optional(hn)}).passthrough(),A=O.object({method:O.string(),params:O.optional(k)}),gn=O.object({_meta:O.optional(O.object({}).passthrough())}).passthrough(),j=O.object({method:O.string(),params:O.optional(gn)}),M=O.object({_meta:O.optional(O.object({}).passthrough())}).passthrough(),_n=O.union([O.string(),O.number().int()]),vn=O.object({jsonrpc:O.literal(`2.0`),id:_n}).merge(A).strict(),yn=O.object({jsonrpc:O.literal(`2.0`)}).merge(j).strict(),bn=O.object({jsonrpc:O.literal(`2.0`),id:_n,result:M}).strict();var xn;(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`})(xn||={});let Sn=O.object({jsonrpc:O.literal(`2.0`),id:_n,error:O.object({code:O.number().int(),message:O.string(),data:O.optional(O.unknown())})}).strict(),Cn=O.union([vn,yn,bn,Sn]),wn=M.strict(),Tn=j.extend({method:O.literal(`notifications/cancelled`),params:gn.extend({requestId:_n,reason:O.string().optional()})}),En=O.object({name:O.string(),title:O.optional(O.string())}).passthrough(),Dn=En.extend({version:O.string()}),On=O.object({experimental:O.optional(O.object({}).passthrough()),sampling:O.optional(O.object({}).passthrough()),elicitation:O.optional(O.object({}).passthrough()),roots:O.optional(O.object({listChanged:O.optional(O.boolean())}).passthrough())}).passthrough(),kn=A.extend({method:O.literal(`initialize`),params:k.extend({protocolVersion:O.string(),capabilities:On,clientInfo:Dn})}),An=O.object({experimental:O.optional(O.object({}).passthrough()),logging:O.optional(O.object({}).passthrough()),completions:O.optional(O.object({}).passthrough()),prompts:O.optional(O.object({listChanged:O.optional(O.boolean())}).passthrough()),resources:O.optional(O.object({subscribe:O.optional(O.boolean()),listChanged:O.optional(O.boolean())}).passthrough()),tools:O.optional(O.object({listChanged:O.optional(O.boolean())}).passthrough())}).passthrough(),jn=M.extend({protocolVersion:O.string(),capabilities:An,serverInfo:Dn,instructions:O.optional(O.string())}),Mn=j.extend({method:O.literal(`notifications/initialized`)}),Nn=A.extend({method:O.literal(`ping`)}),Pn=O.object({progress:O.number(),total:O.optional(O.number()),message:O.optional(O.string())}).passthrough(),Fn=j.extend({method:O.literal(`notifications/progress`),params:gn.merge(Pn).extend({progressToken:pn})}),In=A.extend({params:k.extend({cursor:O.optional(mn)}).optional()}),Ln=M.extend({nextCursor:O.optional(mn)}),Rn=O.object({uri:O.string(),mimeType:O.optional(O.string()),_meta:O.optional(O.object({}).passthrough())}).passthrough(),zn=Rn.extend({text:O.string()}),Bn=O.string().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:`Invalid Base64 string`}),Vn=Rn.extend({blob:Bn}),Hn=En.extend({uri:O.string(),description:O.optional(O.string()),mimeType:O.optional(O.string()),_meta:O.optional(O.object({}).passthrough())}),Un=En.extend({uriTemplate:O.string(),description:O.optional(O.string()),mimeType:O.optional(O.string()),_meta:O.optional(O.object({}).passthrough())}),Wn=In.extend({method:O.literal(`resources/list`)}),Gn=Ln.extend({resources:O.array(Hn)}),Kn=In.extend({method:O.literal(`resources/templates/list`)}),qn=Ln.extend({resourceTemplates:O.array(Un)}),Jn=A.extend({method:O.literal(`resources/read`),params:k.extend({uri:O.string()})}),Yn=M.extend({contents:O.array(O.union([zn,Vn]))}),Xn=j.extend({method:O.literal(`notifications/resources/list_changed`)}),Zn=A.extend({method:O.literal(`resources/subscribe`),params:k.extend({uri:O.string()})}),Qn=A.extend({method:O.literal(`resources/unsubscribe`),params:k.extend({uri:O.string()})}),$n=j.extend({method:O.literal(`notifications/resources/updated`),params:gn.extend({uri:O.string()})}),er=O.object({name:O.string(),description:O.optional(O.string()),required:O.optional(O.boolean())}).passthrough(),tr=En.extend({description:O.optional(O.string()),arguments:O.optional(O.array(er)),_meta:O.optional(O.object({}).passthrough())}),nr=In.extend({method:O.literal(`prompts/list`)}),rr=Ln.extend({prompts:O.array(tr)}),ir=A.extend({method:O.literal(`prompts/get`),params:k.extend({name:O.string(),arguments:O.optional(O.record(O.string()))})}),ar=O.object({type:O.literal(`text`),text:O.string(),_meta:O.optional(O.object({}).passthrough())}).passthrough(),or=O.object({type:O.literal(`image`),data:Bn,mimeType:O.string(),_meta:O.optional(O.object({}).passthrough())}).passthrough(),sr=O.object({type:O.literal(`audio`),data:Bn,mimeType:O.string(),_meta:O.optional(O.object({}).passthrough())}).passthrough(),cr=O.object({type:O.literal(`resource`),resource:O.union([zn,Vn]),_meta:O.optional(O.object({}).passthrough())}).passthrough(),lr=Hn.extend({type:O.literal(`resource_link`)}),ur=O.union([ar,or,sr,lr,cr]),dr=O.object({role:O.enum([`user`,`assistant`]),content:ur}).passthrough(),fr=M.extend({description:O.optional(O.string()),messages:O.array(dr)}),pr=j.extend({method:O.literal(`notifications/prompts/list_changed`)}),mr=O.object({title:O.optional(O.string()),readOnlyHint:O.optional(O.boolean()),destructiveHint:O.optional(O.boolean()),idempotentHint:O.optional(O.boolean()),openWorldHint:O.optional(O.boolean())}).passthrough(),hr=En.extend({description:O.optional(O.string()),inputSchema:O.object({type:O.literal(`object`),properties:O.optional(O.object({}).passthrough()),required:O.optional(O.array(O.string()))}).passthrough(),outputSchema:O.optional(O.object({type:O.literal(`object`),properties:O.optional(O.object({}).passthrough()),required:O.optional(O.array(O.string()))}).passthrough()),annotations:O.optional(mr),_meta:O.optional(O.object({}).passthrough())}),gr=In.extend({method:O.literal(`tools/list`)}),_r=Ln.extend({tools:O.array(hr)}),vr=M.extend({content:O.array(ur).default([]),structuredContent:O.object({}).passthrough().optional(),isError:O.optional(O.boolean())});vr.or(M.extend({toolResult:O.unknown()}));let yr=A.extend({method:O.literal(`tools/call`),params:k.extend({name:O.string(),arguments:O.optional(O.record(O.unknown()))})}),br=j.extend({method:O.literal(`notifications/tools/list_changed`)}),xr=O.enum([`debug`,`info`,`notice`,`warning`,`error`,`critical`,`alert`,`emergency`]),Sr=A.extend({method:O.literal(`logging/setLevel`),params:k.extend({level:xr})}),Cr=j.extend({method:O.literal(`notifications/message`),params:gn.extend({level:xr,logger:O.optional(O.string()),data:O.unknown()})}),wr=O.object({name:O.string().optional()}).passthrough(),Tr=O.object({hints:O.optional(O.array(wr)),costPriority:O.optional(O.number().min(0).max(1)),speedPriority:O.optional(O.number().min(0).max(1)),intelligencePriority:O.optional(O.number().min(0).max(1))}).passthrough(),Er=O.object({role:O.enum([`user`,`assistant`]),content:O.union([ar,or,sr])}).passthrough(),Dr=A.extend({method:O.literal(`sampling/createMessage`),params:k.extend({messages:O.array(Er),systemPrompt:O.optional(O.string()),includeContext:O.optional(O.enum([`none`,`thisServer`,`allServers`])),temperature:O.optional(O.number()),maxTokens:O.number().int(),stopSequences:O.optional(O.array(O.string())),metadata:O.optional(O.object({}).passthrough()),modelPreferences:O.optional(Tr)})}),Or=M.extend({model:O.string(),stopReason:O.optional(O.enum([`endTurn`,`stopSequence`,`maxTokens`]).or(O.string())),role:O.enum([`user`,`assistant`]),content:O.discriminatedUnion(`type`,[ar,or,sr])}),kr=O.object({type:O.literal(`boolean`),title:O.optional(O.string()),description:O.optional(O.string()),default:O.optional(O.boolean())}).passthrough(),Ar=O.object({type:O.literal(`string`),title:O.optional(O.string()),description:O.optional(O.string()),minLength:O.optional(O.number()),maxLength:O.optional(O.number()),format:O.optional(O.enum([`email`,`uri`,`date`,`date-time`]))}).passthrough(),jr=O.object({type:O.enum([`number`,`integer`]),title:O.optional(O.string()),description:O.optional(O.string()),minimum:O.optional(O.number()),maximum:O.optional(O.number())}).passthrough(),Mr=O.object({type:O.literal(`string`),title:O.optional(O.string()),description:O.optional(O.string()),enum:O.array(O.string()),enumNames:O.optional(O.array(O.string()))}).passthrough(),Nr=O.union([kr,Ar,jr,Mr]),Pr=A.extend({method:O.literal(`elicitation/create`),params:k.extend({message:O.string(),requestedSchema:O.object({type:O.literal(`object`),properties:O.record(O.string(),Nr),required:O.optional(O.array(O.string()))}).passthrough()})}),Fr=M.extend({action:O.enum([`accept`,`decline`,`cancel`]),content:O.optional(O.record(O.string(),O.unknown()))}),Ir=O.object({type:O.literal(`ref/resource`),uri:O.string()}).passthrough(),Lr=O.object({type:O.literal(`ref/prompt`),name:O.string()}).passthrough(),Rr=A.extend({method:O.literal(`completion/complete`),params:k.extend({ref:O.union([Lr,Ir]),argument:O.object({name:O.string(),value:O.string()}).passthrough(),context:O.optional(O.object({arguments:O.optional(O.record(O.string(),O.string()))}))})}),zr=M.extend({completion:O.object({values:O.array(O.string()).max(100),total:O.optional(O.number().int()),hasMore:O.optional(O.boolean())}).passthrough()}),Br=O.object({uri:O.string().startsWith(`file://`),name:O.optional(O.string()),_meta:O.optional(O.object({}).passthrough())}).passthrough(),Vr=A.extend({method:O.literal(`roots/list`)}),Hr=M.extend({roots:O.array(Br)}),Ur=j.extend({method:O.literal(`notifications/roots/list_changed`)});O.union([Nn,kn,Rr,Sr,ir,nr,Wn,Kn,Jn,Zn,Qn,yr,gr]),O.union([Tn,Fn,Mn,Ur]),O.union([wn,Or,Fr,Hr]),O.union([Nn,Dr,Pr,Vr]),O.union([Tn,Fn,Cr,$n,Xn,br,pr]),O.union([wn,jn,zr,fr,rr,Gn,qn,Yn,vr,_r]),function(e){return e.START=`start`,e.STARTED=`started`,e.STOP=`stop`,e.STOPPED=`stopped`,e.PING=`ping`,e.PONG=`pong`,e.ERROR=`error`,e.LIST_TOOLS=`list_tools`,e.CALL_TOOL=`call_tool`,e.TOOL_LIST_UPDATED=`tool_list_updated`,e.TOOL_LIST_UPDATED_ACK=`tool_list_updated_ack`,e.PROCESS_DATA=`process_data`,e.SERVER_STARTED=`server_started`,e.SERVER_STOPPED=`server_stopped`,e.ERROR_FROM_NATIVE_HOST=`error_from_native_host`,e.CONNECT_NATIVE=`connectNative`,e.PING_NATIVE=`ping_native`,e.DISCONNECT_NATIVE=`disconnect_native`,e}({}),{NAME:`com.chromemcp.nativehost`,DEFAULT_PORT:12306}.NAME;var Wr=class{_started=!1;_allowedOrigins;_channelId;_messageHandler;_clientOrigin;onclose;onerror;onmessage;constructor(e){if(!e.allowedOrigins||e.allowedOrigins.length===0)throw Error(`At least one allowed origin must be specified`);this._allowedOrigins=e.allowedOrigins,this._channelId=e.channelId||`mcp-default`}async start(){if(this._started)throw Error(`Transport already started`);this._messageHandler=e=>{if(!this._allowedOrigins.includes(e.origin)&&!this._allowedOrigins.includes(`*`)||e.data?.channel!==this._channelId||e.data?.type!==`mcp`||e.data?.direction!==`client-to-server`)return;this._clientOrigin=e.origin;let t=e.data.payload;if(typeof t==`string`&&t===`mcp-check-ready`){window.postMessage({channel:this._channelId,type:`mcp`,direction:`server-to-client`,payload:`mcp-server-ready`},this._clientOrigin);return}try{let e=Cn.parse(t);this.onmessage?.(e)}catch(e){this.onerror?.(Error(`Invalid message: ${e instanceof Error?e.message:String(e)}`))}},window.addEventListener(`message`,this._messageHandler),this._started=!0,window.postMessage({channel:this._channelId,type:`mcp`,direction:`server-to-client`,payload:`mcp-server-ready`},`*`)}async send(e){if(!this._started)throw Error(`Transport not started`);if(!this._clientOrigin)throw Error(`No client connected`);window.postMessage({channel:this._channelId,type:`mcp`,direction:`server-to-client`,payload:e},this._clientOrigin)}async close(){this._messageHandler&&window.removeEventListener(`message`,this._messageHandler),this._started=!1,window.postMessage({channel:this._channelId,type:`mcp`,direction:`server-to-client`,payload:`mcp-server-stopped`},`*`),this.onclose?.()}},N;(function(e){e.assertEqual=e=>{};function t(e){}e.assertIs=t;function n(e){throw Error()}e.assertNever=n,e.arrayToEnum=e=>{let t={};for(let n of e)t[n]=n;return t},e.getValidEnumValues=t=>{let n=e.objectKeys(t).filter(e=>typeof t[t[e]]!=`number`),r={};for(let e of n)r[e]=t[e];return e.objectValues(r)},e.objectValues=t=>e.objectKeys(t).map(function(e){return t[e]}),e.objectKeys=typeof Object.keys==`function`?e=>Object.keys(e):e=>{let t=[];for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.push(n);return t},e.find=(e,t)=>{for(let n of e)if(t(n))return n},e.isInteger=typeof Number.isInteger==`function`?e=>Number.isInteger(e):e=>typeof e==`number`&&Number.isFinite(e)&&Math.floor(e)===e;function r(e,t=` | `){return e.map(e=>typeof e==`string`?`'${e}'`:e).join(t)}e.joinValues=r,e.jsonStringifyReplacer=(e,t)=>typeof t==`bigint`?t.toString():t})(N||={});var Gr;(function(e){e.mergeShapes=(e,t)=>({...e,...t})})(Gr||={});let P=N.arrayToEnum([`string`,`nan`,`number`,`integer`,`float`,`boolean`,`date`,`bigint`,`symbol`,`function`,`undefined`,`null`,`array`,`object`,`unknown`,`promise`,`void`,`never`,`map`,`set`]),Kr=e=>{switch(typeof e){case`undefined`:return P.undefined;case`string`:return P.string;case`number`:return Number.isNaN(e)?P.nan:P.number;case`boolean`:return P.boolean;case`function`:return P.function;case`bigint`:return P.bigint;case`symbol`:return P.symbol;case`object`:return Array.isArray(e)?P.array:e===null?P.null:e.then&&typeof e.then==`function`&&e.catch&&typeof e.catch==`function`?P.promise:typeof Map<`u`&&e instanceof Map?P.map:typeof Set<`u`&&e instanceof Set?P.set:typeof Date<`u`&&e instanceof Date?P.date:P.object;default:return P.unknown}},F=N.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`]);var I=class e 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]};let t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name=`ZodError`,this.issues=e}format(e){let t=e||function(e){return e.message},n={_errors:[]},r=e=>{for(let i of e.issues)if(i.code===`invalid_union`)i.unionErrors.map(r);else if(i.code===`invalid_return_type`)r(i.returnTypeError);else if(i.code===`invalid_arguments`)r(i.argumentsError);else if(i.path.length===0)n._errors.push(t(i));else{let e=n,r=0;for(;r<i.path.length;){let n=i.path[r];r===i.path.length-1?(e[n]=e[n]||{_errors:[]},e[n]._errors.push(t(i))):e[n]=e[n]||{_errors:[]},e=e[n],r++}}};return r(this),n}static assert(t){if(!(t instanceof e))throw Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,N.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=e=>e.message){let t={},n=[];for(let r of this.issues)if(r.path.length>0){let n=r.path[0];t[n]=t[n]||[],t[n].push(e(r))}else n.push(e(r));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}};I.create=e=>new I(e);var qr=(e,t)=>{let n;switch(e.code){case F.invalid_type:n=e.received===P.undefined?`Required`:`Expected ${e.expected}, received ${e.received}`;break;case F.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,N.jsonStringifyReplacer)}`;break;case F.unrecognized_keys:n=`Unrecognized key(s) in object: ${N.joinValues(e.keys,`, `)}`;break;case F.invalid_union:n=`Invalid input`;break;case F.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${N.joinValues(e.options)}`;break;case F.invalid_enum_value:n=`Invalid enum value. Expected ${N.joinValues(e.options)}, received '${e.received}'`;break;case F.invalid_arguments:n=`Invalid function arguments`;break;case F.invalid_return_type:n=`Invalid function return type`;break;case F.invalid_date:n=`Invalid date`;break;case F.invalid_string:typeof e.validation==`object`?`includes`in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position==`number`&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):`startsWith`in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:`endsWith`in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:N.assertNever(e.validation):n=e.validation===`regex`?`Invalid`:`Invalid ${e.validation}`;break;case F.too_small:n=e.type===`array`?`Array must contain ${e.exact?`exactly`:e.inclusive?`at least`:`more than`} ${e.minimum} element(s)`:e.type===`string`?`String must contain ${e.exact?`exactly`:e.inclusive?`at least`:`over`} ${e.minimum} character(s)`:e.type===`number`||e.type===`bigint`?`Number must be ${e.exact?`exactly equal to `:e.inclusive?`greater than or equal to `:`greater than `}${e.minimum}`:e.type===`date`?`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 F.too_big:n=e.type===`array`?`Array must contain ${e.exact?`exactly`:e.inclusive?`at most`:`less than`} ${e.maximum} element(s)`:e.type===`string`?`String must contain ${e.exact?`exactly`:e.inclusive?`at most`:`under`} ${e.maximum} character(s)`:e.type===`number`?`Number must be ${e.exact?`exactly`:e.inclusive?`less than or equal to`:`less than`} ${e.maximum}`:e.type===`bigint`?`BigInt must be ${e.exact?`exactly`:e.inclusive?`less than or equal to`:`less than`} ${e.maximum}`:e.type===`date`?`Date must be ${e.exact?`exactly`:e.inclusive?`smaller than or equal to`:`smaller than`} ${new Date(Number(e.maximum))}`:`Invalid input`;break;case F.custom:n=`Invalid input`;break;case F.invalid_intersection_types:n=`Intersection results could not be merged`;break;case F.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case F.not_finite:n=`Number must be finite`;break;default:n=t.defaultError,N.assertNever(e)}return{message:n}};let Jr=qr;function Yr(){return Jr}let Xr=e=>{let{data:t,path:n,errorMaps:r,issueData:i}=e,a=[...n,...i.path||[]],o={...i,path:a};if(i.message!==void 0)return{...i,path:a,message:i.message};let s=``,c=r.filter(e=>!!e).slice().reverse();for(let e of c)s=e(o,{data:t,defaultError:s}).message;return{...i,path:a,message:s}};function L(e,t){let n=Yr(),r=Xr({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===qr?void 0:qr].filter(e=>!!e)});e.common.issues.push(r)}var R=class e{constructor(){this.value=`valid`}dirty(){this.value===`valid`&&(this.value=`dirty`)}abort(){this.value!==`aborted`&&(this.value=`aborted`)}static mergeArray(e,t){let n=[];for(let r of t){if(r.status===`aborted`)return z;r.status===`dirty`&&e.dirty(),n.push(r.value)}return{status:e.value,value:n}}static async mergeObjectAsync(t,n){let r=[];for(let e of n){let t=await e.key,n=await e.value;r.push({key:t,value:n})}return e.mergeObjectSync(t,r)}static mergeObjectSync(e,t){let n={};for(let r of t){let{key:t,value:i}=r;if(t.status===`aborted`||i.status===`aborted`)return z;t.status===`dirty`&&e.dirty(),i.status===`dirty`&&e.dirty(),t.value!==`__proto__`&&(i.value!==void 0||r.alwaysSet)&&(n[t.value]=i.value)}return{status:e.value,value:n}}};let z=Object.freeze({status:`aborted`}),Zr=e=>({status:`dirty`,value:e}),B=e=>({status:`valid`,value:e}),Qr=e=>e.status===`aborted`,$r=e=>e.status===`dirty`,ei=e=>e.status===`valid`,ti=e=>typeof Promise<`u`&&e instanceof Promise;var V;(function(e){e.errToObj=e=>typeof e==`string`?{message:e}:e||{},e.toString=e=>typeof e==`string`?e:e?.message})(V||={});var H=class{constructor(e,t,n,r){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=r}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}};let ni=(e,t)=>{if(ei(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw Error(`Validation failed but no issues detected.`);return{success:!1,get error(){return this._error||=new I(e.common.issues),this._error}}};function U(e){if(!e)return{};let{errorMap:t,invalid_type_error:n,required_error:r,description:i}=e;if(t&&(n||r))throw Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:i}:{errorMap:(t,i)=>{let{message:a}=e;return t.code===`invalid_enum_value`?{message:a??i.defaultError}:i.data===void 0?{message:a??r??i.defaultError}:t.code===`invalid_type`?{message:a??n??i.defaultError}:{message:i.defaultError}},description:i}}var W=class{get description(){return this._def.description}_getType(e){return Kr(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:Kr(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new R,ctx:{common:e.parent.common,data:e.data,parsedType:Kr(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(ti(t))throw Error(`Synchronous parse encountered promise.`);return t}_parseAsync(e){let t=this._parse(e);return Promise.resolve(t)}parse(e,t){let n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){let n={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Kr(e)};return ni(n,this._parseSync({data:e,path:n.path,parent:n}))}"~validate"(e){let t={common:{issues:[],async:!!this[`~standard`].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Kr(e)};if(!this[`~standard`].async)try{let n=this._parseSync({data:e,path:[],parent:t});return ei(n)?{value:n.value}:{issues:t.common.issues}}catch(e){e?.message?.toLowerCase()?.includes(`encountered`)&&(this[`~standard`].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(e=>ei(e)?{value:e.value}:{issues:t.common.issues})}async parseAsync(e,t){let n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){let n={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Kr(e)},r=this._parse({data:e,path:n.path,parent:n});return ni(n,await(ti(r)?r:Promise.resolve(r)))}refine(e,t){let n=e=>typeof t==`string`||t===void 0?{message:t}:typeof t==`function`?t(e):t;return this._refinement((t,r)=>{let i=e(t),a=()=>r.addIssue({code:F.custom,...n(t)});return typeof Promise<`u`&&i instanceof Promise?i.then(e=>e?!0:(a(),!1)):i?!0:(a(),!1)})}refinement(e,t){return this._refinement((n,r)=>e(n)?!0:(r.addIssue(typeof t==`function`?t(n,r):t),!1))}_refinement(e){return new q({schema:this,typeName:Y.ZodEffects,effect:{type:`refinement`,refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this[`~standard`]={version:1,vendor:`zod`,validate:e=>this[`~validate`](e)}}optional(){return J.create(this,this._def)}nullable(){return na.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Ri.create(this)}promise(){return ta.create(this,this._def)}or(e){return Bi.create([this,e],this._def)}and(e){return Wi.create(this,e,this._def)}transform(e){return new q({...U(this._def),schema:this,typeName:Y.ZodEffects,effect:{type:`transform`,transform:e}})}default(e){let t=typeof e==`function`?e:()=>e;return new ra({...U(this._def),innerType:this,defaultValue:t,typeName:Y.ZodDefault})}brand(){return new oa({typeName:Y.ZodBranded,type:this,...U(this._def)})}catch(e){let t=typeof e==`function`?e:()=>e;return new ia({...U(this._def),innerType:this,catchValue:t,typeName:Y.ZodCatch})}describe(e){let t=this.constructor;return new t({...this._def,description:e})}pipe(e){return sa.create(this,e)}readonly(){return ca.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}};let ri=/^c[^\s-]{8,}$/i,ii=/^[0-9a-z]+$/,ai=/^[0-9A-HJKMNP-TV-Z]{26}$/i,oi=/^[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,si=/^[a-z0-9_-]{21}$/i,ci=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,li=/^[-+]?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)?)??$/,ui=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,di,fi=/^(?:(?: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])$/,pi=/^(?:(?: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])$/,mi=/^(([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]))$/,hi=/^(([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])$/,gi=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,_i=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,vi=`((\\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])))`,yi=RegExp(`^${vi}$`);function bi(e){let t=`[0-5]\\d`;e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision??(t=`${t}(\\.\\d+)?`);let n=e.precision?`+`:`?`;return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${n}`}function xi(e){return RegExp(`^${bi(e)}$`)}function Si(e){let t=`${vi}T${bi(e)}`,n=[];return n.push(e.local?`Z?`:`Z`),e.offset&&n.push(`([+-]\\d{2}:?\\d{2})`),t=`${t}(${n.join(`|`)})`,RegExp(`^${t}$`)}function Ci(e,t){return!!((t===`v4`||!t)&&fi.test(e)||(t===`v6`||!t)&&mi.test(e))}function wi(e,t){if(!ci.test(e))return!1;try{let[n]=e.split(`.`);if(!n)return!1;let r=n.replace(/-/g,`+`).replace(/_/g,`/`).padEnd(n.length+(4-n.length%4)%4,`=`),i=JSON.parse(atob(r));return!(typeof i!=`object`||!i||`typ`in i&&i?.typ!==`JWT`||!i.alg||t&&i.alg!==t)}catch{return!1}}function Ti(e,t){return!!((t===`v4`||!t)&&pi.test(e)||(t===`v6`||!t)&&hi.test(e))}var Ei=class e extends W{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==P.string){let t=this._getOrReturnCtx(e);return L(t,{code:F.invalid_type,expected:P.string,received:t.parsedType}),z}let t=new R,n;for(let r of this._def.checks)if(r.kind===`min`)e.data.length<r.value&&(n=this._getOrReturnCtx(e,n),L(n,{code:F.too_small,minimum:r.value,type:`string`,inclusive:!0,exact:!1,message:r.message}),t.dirty());else if(r.kind===`max`)e.data.length>r.value&&(n=this._getOrReturnCtx(e,n),L(n,{code:F.too_big,maximum:r.value,type:`string`,inclusive:!0,exact:!1,message:r.message}),t.dirty());else if(r.kind===`length`){let i=e.data.length>r.value,a=e.data.length<r.value;(i||a)&&(n=this._getOrReturnCtx(e,n),i?L(n,{code:F.too_big,maximum:r.value,type:`string`,inclusive:!0,exact:!0,message:r.message}):a&&L(n,{code:F.too_small,minimum:r.value,type:`string`,inclusive:!0,exact:!0,message:r.message}),t.dirty())}else if(r.kind===`email`)ui.test(e.data)||(n=this._getOrReturnCtx(e,n),L(n,{validation:`email`,code:F.invalid_string,message:r.message}),t.dirty());else if(r.kind===`emoji`)di||=RegExp(`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`,`u`),di.test(e.data)||(n=this._getOrReturnCtx(e,n),L(n,{validation:`emoji`,code:F.invalid_string,message:r.message}),t.dirty());else if(r.kind===`uuid`)oi.test(e.data)||(n=this._getOrReturnCtx(e,n),L(n,{validation:`uuid`,code:F.invalid_string,message:r.message}),t.dirty());else if(r.kind===`nanoid`)si.test(e.data)||(n=this._getOrReturnCtx(e,n),L(n,{validation:`nanoid`,code:F.invalid_string,message:r.message}),t.dirty());else if(r.kind===`cuid`)ri.test(e.data)||(n=this._getOrReturnCtx(e,n),L(n,{validation:`cuid`,code:F.invalid_string,message:r.message}),t.dirty());else if(r.kind===`cuid2`)ii.test(e.data)||(n=this._getOrReturnCtx(e,n),L(n,{validation:`cuid2`,code:F.invalid_string,message:r.message}),t.dirty());else if(r.kind===`ulid`)ai.test(e.data)||(n=this._getOrReturnCtx(e,n),L(n,{validation:`ulid`,code:F.invalid_string,message:r.message}),t.dirty());else if(r.kind===`url`)try{new URL(e.data)}catch{n=this._getOrReturnCtx(e,n),L(n,{validation:`url`,code:F.invalid_string,message:r.message}),t.dirty()}else r.kind===`regex`?(r.regex.lastIndex=0,r.regex.test(e.data)||(n=this._getOrReturnCtx(e,n),L(n,{validation:`regex`,code:F.invalid_string,message:r.message}),t.dirty())):r.kind===`trim`?e.data=e.data.trim():r.kind===`includes`?e.data.includes(r.value,r.position)||(n=this._getOrReturnCtx(e,n),L(n,{code:F.invalid_string,validation:{includes:r.value,position:r.position},message:r.message}),t.dirty()):r.kind===`toLowerCase`?e.data=e.data.toLowerCase():r.kind===`toUpperCase`?e.data=e.data.toUpperCase():r.kind===`startsWith`?e.data.startsWith(r.value)||(n=this._getOrReturnCtx(e,n),L(n,{code:F.invalid_string,validation:{startsWith:r.value},message:r.message}),t.dirty()):r.kind===`endsWith`?e.data.endsWith(r.value)||(n=this._getOrReturnCtx(e,n),L(n,{code:F.invalid_string,validation:{endsWith:r.value},message:r.message}),t.dirty()):r.kind===`datetime`?Si(r).test(e.data)||(n=this._getOrReturnCtx(e,n),L(n,{code:F.invalid_string,validation:`datetime`,message:r.message}),t.dirty()):r.kind===`date`?yi.test(e.data)||(n=this._getOrReturnCtx(e,n),L(n,{code:F.invalid_string,validation:`date`,message:r.message}),t.dirty()):r.kind===`time`?xi(r).test(e.data)||(n=this._getOrReturnCtx(e,n),L(n,{code:F.invalid_string,validation:`time`,message:r.message}),t.dirty()):r.kind===`duration`?li.test(e.data)||(n=this._getOrReturnCtx(e,n),L(n,{validation:`duration`,code:F.invalid_string,message:r.message}),t.dirty()):r.kind===`ip`?Ci(e.data,r.version)||(n=this._getOrReturnCtx(e,n),L(n,{validation:`ip`,code:F.invalid_string,message:r.message}),t.dirty()):r.kind===`jwt`?wi(e.data,r.alg)||(n=this._getOrReturnCtx(e,n),L(n,{validation:`jwt`,code:F.invalid_string,message:r.message}),t.dirty()):r.kind===`cidr`?Ti(e.data,r.version)||(n=this._getOrReturnCtx(e,n),L(n,{validation:`cidr`,code:F.invalid_string,message:r.message}),t.dirty()):r.kind===`base64`?gi.test(e.data)||(n=this._getOrReturnCtx(e,n),L(n,{validation:`base64`,code:F.invalid_string,message:r.message}),t.dirty()):r.kind===`base64url`?_i.test(e.data)||(n=this._getOrReturnCtx(e,n),L(n,{validation:`base64url`,code:F.invalid_string,message:r.message}),t.dirty()):N.assertNever(r);return{status:t.value,value:e.data}}_regex(e,t,n){return this.refinement(t=>e.test(t),{validation:t,code:F.invalid_string,...V.errToObj(n)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(e){return this._addCheck({kind:`email`,...V.errToObj(e)})}url(e){return this._addCheck({kind:`url`,...V.errToObj(e)})}emoji(e){return this._addCheck({kind:`emoji`,...V.errToObj(e)})}uuid(e){return this._addCheck({kind:`uuid`,...V.errToObj(e)})}nanoid(e){return this._addCheck({kind:`nanoid`,...V.errToObj(e)})}cuid(e){return this._addCheck({kind:`cuid`,...V.errToObj(e)})}cuid2(e){return this._addCheck({kind:`cuid2`,...V.errToObj(e)})}ulid(e){return this._addCheck({kind:`ulid`,...V.errToObj(e)})}base64(e){return this._addCheck({kind:`base64`,...V.errToObj(e)})}base64url(e){return this._addCheck({kind:`base64url`,...V.errToObj(e)})}jwt(e){return this._addCheck({kind:`jwt`,...V.errToObj(e)})}ip(e){return this._addCheck({kind:`ip`,...V.errToObj(e)})}cidr(e){return this._addCheck({kind:`cidr`,...V.errToObj(e)})}datetime(e){return typeof e==`string`?this._addCheck({kind:`datetime`,precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:`datetime`,precision:e?.precision===void 0?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...V.errToObj(e?.message)})}date(e){return this._addCheck({kind:`date`,message:e})}time(e){return typeof e==`string`?this._addCheck({kind:`time`,precision:null,message:e}):this._addCheck({kind:`time`,precision:e?.precision===void 0?null:e?.precision,...V.errToObj(e?.message)})}duration(e){return this._addCheck({kind:`duration`,...V.errToObj(e)})}regex(e,t){return this._addCheck({kind:`regex`,regex:e,...V.errToObj(t)})}includes(e,t){return this._addCheck({kind:`includes`,value:e,position:t?.position,...V.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:`startsWith`,value:e,...V.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:`endsWith`,value:e,...V.errToObj(t)})}min(e,t){return this._addCheck({kind:`min`,value:e,...V.errToObj(t)})}max(e,t){return this._addCheck({kind:`max`,value:e,...V.errToObj(t)})}length(e,t){return this._addCheck({kind:`length`,value:e,...V.errToObj(t)})}nonempty(e){return this.min(1,V.errToObj(e))}trim(){return new e({...this._def,checks:[...this._def.checks,{kind:`trim`}]})}toLowerCase(){return new e({...this._def,checks:[...this._def.checks,{kind:`toLowerCase`}]})}toUpperCase(){return new e({...this._def,checks:[...this._def.checks,{kind:`toUpperCase`}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind===`datetime`)}get isDate(){return!!this._def.checks.find(e=>e.kind===`date`)}get isTime(){return!!this._def.checks.find(e=>e.kind===`time`)}get isDuration(){return!!this._def.checks.find(e=>e.kind===`duration`)}get isEmail(){return!!this._def.checks.find(e=>e.kind===`email`)}get isURL(){return!!this._def.checks.find(e=>e.kind===`url`)}get isEmoji(){return!!this._def.checks.find(e=>e.kind===`emoji`)}get isUUID(){return!!this._def.checks.find(e=>e.kind===`uuid`)}get isNANOID(){return!!this._def.checks.find(e=>e.kind===`nanoid`)}get isCUID(){return!!this._def.checks.find(e=>e.kind===`cuid`)}get isCUID2(){return!!this._def.checks.find(e=>e.kind===`cuid2`)}get isULID(){return!!this._def.checks.find(e=>e.kind===`ulid`)}get isIP(){return!!this._def.checks.find(e=>e.kind===`ip`)}get isCIDR(){return!!this._def.checks.find(e=>e.kind===`cidr`)}get isBase64(){return!!this._def.checks.find(e=>e.kind===`base64`)}get isBase64url(){return!!this._def.checks.find(e=>e.kind===`base64url`)}get minLength(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.value<e)&&(e=t.value);return e}};Ei.create=e=>new Ei({checks:[],typeName:Y.ZodString,coerce:e?.coerce??!1,...U(e)});function Di(e,t){let n=(e.toString().split(`.`)[1]||``).length,r=(t.toString().split(`.`)[1]||``).length,i=n>r?n:r;return Number.parseInt(e.toFixed(i).replace(`.`,``))%Number.parseInt(t.toFixed(i).replace(`.`,``))/10**i}var Oi=class e extends W{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)!==P.number){let t=this._getOrReturnCtx(e);return L(t,{code:F.invalid_type,expected:P.number,received:t.parsedType}),z}let t,n=new R;for(let r of this._def.checks)r.kind===`int`?N.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),L(t,{code:F.invalid_type,expected:`integer`,received:`float`,message:r.message}),n.dirty()):r.kind===`min`?(r.inclusive?e.data<r.value:e.data<=r.value)&&(t=this._getOrReturnCtx(e,t),L(t,{code:F.too_small,minimum:r.value,type:`number`,inclusive:r.inclusive,exact:!1,message:r.message}),n.dirty()):r.kind===`max`?(r.inclusive?e.data>r.value:e.data>=r.value)&&(t=this._getOrReturnCtx(e,t),L(t,{code:F.too_big,maximum:r.value,type:`number`,inclusive:r.inclusive,exact:!1,message:r.message}),n.dirty()):r.kind===`multipleOf`?Di(e.data,r.value)!==0&&(t=this._getOrReturnCtx(e,t),L(t,{code:F.not_multiple_of,multipleOf:r.value,message:r.message}),n.dirty()):r.kind===`finite`?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),L(t,{code:F.not_finite,message:r.message}),n.dirty()):N.assertNever(r);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit(`min`,e,!0,V.toString(t))}gt(e,t){return this.setLimit(`min`,e,!1,V.toString(t))}lte(e,t){return this.setLimit(`max`,e,!0,V.toString(t))}lt(e,t){return this.setLimit(`max`,e,!1,V.toString(t))}setLimit(t,n,r,i){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:V.toString(i)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(e){return this._addCheck({kind:`int`,message:V.toString(e)})}positive(e){return this._addCheck({kind:`min`,value:0,inclusive:!1,message:V.toString(e)})}negative(e){return this._addCheck({kind:`max`,value:0,inclusive:!1,message:V.toString(e)})}nonpositive(e){return this._addCheck({kind:`max`,value:0,inclusive:!0,message:V.toString(e)})}nonnegative(e){return this._addCheck({kind:`min`,value:0,inclusive:!0,message:V.toString(e)})}multipleOf(e,t){return this._addCheck({kind:`multipleOf`,value:e,message:V.toString(t)})}finite(e){return this._addCheck({kind:`finite`,message:V.toString(e)})}safe(e){return this._addCheck({kind:`min`,inclusive:!0,value:-(2**53-1),message:V.toString(e)})._addCheck({kind:`max`,inclusive:!0,value:2**53-1,message:V.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind===`int`||e.kind===`multipleOf`&&N.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let n of this._def.checks)if(n.kind===`finite`||n.kind===`int`||n.kind===`multipleOf`)return!0;else n.kind===`min`?(t===null||n.value>t)&&(t=n.value):n.kind===`max`&&(e===null||n.value<e)&&(e=n.value);return Number.isFinite(t)&&Number.isFinite(e)}};Oi.create=e=>new Oi({checks:[],typeName:Y.ZodNumber,coerce:e?.coerce||!1,...U(e)});var ki=class e extends W{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)!==P.bigint)return this._getInvalidInput(e);let t,n=new R;for(let r of this._def.checks)r.kind===`min`?(r.inclusive?e.data<r.value:e.data<=r.value)&&(t=this._getOrReturnCtx(e,t),L(t,{code:F.too_small,type:`bigint`,minimum:r.value,inclusive:r.inclusive,message:r.message}),n.dirty()):r.kind===`max`?(r.inclusive?e.data>r.value:e.data>=r.value)&&(t=this._getOrReturnCtx(e,t),L(t,{code:F.too_big,type:`bigint`,maximum:r.value,inclusive:r.inclusive,message:r.message}),n.dirty()):r.kind===`multipleOf`?e.data%r.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),L(t,{code:F.not_multiple_of,multipleOf:r.value,message:r.message}),n.dirty()):N.assertNever(r);return{status:n.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return L(t,{code:F.invalid_type,expected:P.bigint,received:t.parsedType}),z}gte(e,t){return this.setLimit(`min`,e,!0,V.toString(t))}gt(e,t){return this.setLimit(`min`,e,!1,V.toString(t))}lte(e,t){return this.setLimit(`max`,e,!0,V.toString(t))}lt(e,t){return this.setLimit(`max`,e,!1,V.toString(t))}setLimit(t,n,r,i){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:V.toString(i)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}positive(e){return this._addCheck({kind:`min`,value:BigInt(0),inclusive:!1,message:V.toString(e)})}negative(e){return this._addCheck({kind:`max`,value:BigInt(0),inclusive:!1,message:V.toString(e)})}nonpositive(e){return this._addCheck({kind:`max`,value:BigInt(0),inclusive:!0,message:V.toString(e)})}nonnegative(e){return this._addCheck({kind:`min`,value:BigInt(0),inclusive:!0,message:V.toString(e)})}multipleOf(e,t){return this._addCheck({kind:`multipleOf`,value:e,message:V.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.value<e)&&(e=t.value);return e}};ki.create=e=>new ki({checks:[],typeName:Y.ZodBigInt,coerce:e?.coerce??!1,...U(e)});var Ai=class extends W{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==P.boolean){let t=this._getOrReturnCtx(e);return L(t,{code:F.invalid_type,expected:P.boolean,received:t.parsedType}),z}return B(e.data)}};Ai.create=e=>new Ai({typeName:Y.ZodBoolean,coerce:e?.coerce||!1,...U(e)});var ji=class e extends W{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==P.date){let t=this._getOrReturnCtx(e);return L(t,{code:F.invalid_type,expected:P.date,received:t.parsedType}),z}if(Number.isNaN(e.data.getTime()))return L(this._getOrReturnCtx(e),{code:F.invalid_date}),z;let t=new R,n;for(let r of this._def.checks)r.kind===`min`?e.data.getTime()<r.value&&(n=this._getOrReturnCtx(e,n),L(n,{code:F.too_small,message:r.message,inclusive:!0,exact:!1,minimum:r.value,type:`date`}),t.dirty()):r.kind===`max`?e.data.getTime()>r.value&&(n=this._getOrReturnCtx(e,n),L(n,{code:F.too_big,message:r.message,inclusive:!0,exact:!1,maximum:r.value,type:`date`}),t.dirty()):N.assertNever(r);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}min(e,t){return this._addCheck({kind:`min`,value:e.getTime(),message:V.toString(t)})}max(e,t){return this._addCheck({kind:`max`,value:e.getTime(),message:V.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e==null?null:new Date(e)}get maxDate(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.value<e)&&(e=t.value);return e==null?null:new Date(e)}};ji.create=e=>new ji({checks:[],coerce:e?.coerce||!1,typeName:Y.ZodDate,...U(e)});var Mi=class extends W{_parse(e){if(this._getType(e)!==P.symbol){let t=this._getOrReturnCtx(e);return L(t,{code:F.invalid_type,expected:P.symbol,received:t.parsedType}),z}return B(e.data)}};Mi.create=e=>new Mi({typeName:Y.ZodSymbol,...U(e)});var Ni=class extends W{_parse(e){if(this._getType(e)!==P.undefined){let t=this._getOrReturnCtx(e);return L(t,{code:F.invalid_type,expected:P.undefined,received:t.parsedType}),z}return B(e.data)}};Ni.create=e=>new Ni({typeName:Y.ZodUndefined,...U(e)});var Pi=class extends W{_parse(e){if(this._getType(e)!==P.null){let t=this._getOrReturnCtx(e);return L(t,{code:F.invalid_type,expected:P.null,received:t.parsedType}),z}return B(e.data)}};Pi.create=e=>new Pi({typeName:Y.ZodNull,...U(e)});var Fi=class extends W{constructor(){super(...arguments),this._any=!0}_parse(e){return B(e.data)}};Fi.create=e=>new Fi({typeName:Y.ZodAny,...U(e)});var Ii=class extends W{constructor(){super(...arguments),this._unknown=!0}_parse(e){return B(e.data)}};Ii.create=e=>new Ii({typeName:Y.ZodUnknown,...U(e)});var G=class extends W{_parse(e){let t=this._getOrReturnCtx(e);return L(t,{code:F.invalid_type,expected:P.never,received:t.parsedType}),z}};G.create=e=>new G({typeName:Y.ZodNever,...U(e)});var Li=class extends W{_parse(e){if(this._getType(e)!==P.undefined){let t=this._getOrReturnCtx(e);return L(t,{code:F.invalid_type,expected:P.void,received:t.parsedType}),z}return B(e.data)}};Li.create=e=>new Li({typeName:Y.ZodVoid,...U(e)});var Ri=class e extends W{_parse(e){let{ctx:t,status:n}=this._processInputParams(e),r=this._def;if(t.parsedType!==P.array)return L(t,{code:F.invalid_type,expected:P.array,received:t.parsedType}),z;if(r.exactLength!==null){let e=t.data.length>r.exactLength.value,i=t.data.length<r.exactLength.value;(e||i)&&(L(t,{code:e?F.too_big:F.too_small,minimum:i?r.exactLength.value:void 0,maximum:e?r.exactLength.value:void 0,type:`array`,inclusive:!0,exact:!0,message:r.exactLength.message}),n.dirty())}if(r.minLength!==null&&t.data.length<r.minLength.value&&(L(t,{code:F.too_small,minimum:r.minLength.value,type:`array`,inclusive:!0,exact:!1,message:r.minLength.message}),n.dirty()),r.maxLength!==null&&t.data.length>r.maxLength.value&&(L(t,{code:F.too_big,maximum:r.maxLength.value,type:`array`,inclusive:!0,exact:!1,message:r.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map((e,n)=>r.type._parseAsync(new H(t,e,t.path,n)))).then(e=>R.mergeArray(n,e));let i=[...t.data].map((e,n)=>r.type._parseSync(new H(t,e,t.path,n)));return R.mergeArray(n,i)}get element(){return this._def.type}min(t,n){return new e({...this._def,minLength:{value:t,message:V.toString(n)}})}max(t,n){return new e({...this._def,maxLength:{value:t,message:V.toString(n)}})}length(t,n){return new e({...this._def,exactLength:{value:t,message:V.toString(n)}})}nonempty(e){return this.min(1,e)}};Ri.create=(e,t)=>new Ri({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Y.ZodArray,...U(t)});function zi(e){if(e instanceof K){let t={};for(let n in e.shape){let r=e.shape[n];t[n]=J.create(zi(r))}return new K({...e._def,shape:()=>t})}else if(e instanceof Ri)return new Ri({...e._def,type:zi(e.element)});else if(e instanceof J)return J.create(zi(e.unwrap()));else if(e instanceof na)return na.create(zi(e.unwrap()));else if(e instanceof Gi)return Gi.create(e.items.map(e=>zi(e)));else return e}var K=class e extends W{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape();return this._cached={shape:e,keys:N.objectKeys(e)},this._cached}_parse(e){if(this._getType(e)!==P.object){let t=this._getOrReturnCtx(e);return L(t,{code:F.invalid_type,expected:P.object,received:t.parsedType}),z}let{status:t,ctx:n}=this._processInputParams(e),{shape:r,keys:i}=this._getCached(),a=[];if(!(this._def.catchall instanceof G&&this._def.unknownKeys===`strip`))for(let e in n.data)i.includes(e)||a.push(e);let o=[];for(let e of i){let t=r[e],i=n.data[e];o.push({key:{status:`valid`,value:e},value:t._parse(new H(n,i,n.path,e)),alwaysSet:e in n.data})}if(this._def.catchall instanceof G){let e=this._def.unknownKeys;if(e===`passthrough`)for(let e of a)o.push({key:{status:`valid`,value:e},value:{status:`valid`,value:n.data[e]}});else if(e===`strict`)a.length>0&&(L(n,{code:F.unrecognized_keys,keys:a}),t.dirty());else if(e!==`strip`)throw Error(`Internal ZodObject error: invalid unknownKeys value.`)}else{let e=this._def.catchall;for(let t of a){let r=n.data[t];o.push({key:{status:`valid`,value:t},value:e._parse(new H(n,r,n.path,t)),alwaysSet:t in n.data})}}return n.common.async?Promise.resolve().then(async()=>{let e=[];for(let t of o){let n=await t.key,r=await t.value;e.push({key:n,value:r,alwaysSet:t.alwaysSet})}return e}).then(e=>R.mergeObjectSync(t,e)):R.mergeObjectSync(t,o)}get shape(){return this._def.shape()}strict(t){return V.errToObj,new e({...this._def,unknownKeys:`strict`,...t===void 0?{}:{errorMap:(e,n)=>{let r=this._def.errorMap?.(e,n).message??n.defaultError;return e.code===`unrecognized_keys`?{message:V.errToObj(t).message??r}:{message:r}}}})}strip(){return new e({...this._def,unknownKeys:`strip`})}passthrough(){return new e({...this._def,unknownKeys:`passthrough`})}extend(t){return new e({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new e({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:Y.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(t){return new e({...this._def,catchall:t})}pick(t){let n={};for(let e of N.objectKeys(t))t[e]&&this.shape[e]&&(n[e]=this.shape[e]);return new e({...this._def,shape:()=>n})}omit(t){let n={};for(let e of N.objectKeys(this.shape))t[e]||(n[e]=this.shape[e]);return new e({...this._def,shape:()=>n})}deepPartial(){return zi(this)}partial(t){let n={};for(let e of N.objectKeys(this.shape)){let r=this.shape[e];t&&!t[e]?n[e]=r:n[e]=r.optional()}return new e({...this._def,shape:()=>n})}required(t){let n={};for(let e of N.objectKeys(this.shape))if(t&&!t[e])n[e]=this.shape[e];else{let t=this.shape[e];for(;t instanceof J;)t=t._def.innerType;n[e]=t}return new e({...this._def,shape:()=>n})}keyof(){return Qi(N.objectKeys(this.shape))}};K.create=(e,t)=>new K({shape:()=>e,unknownKeys:`strip`,catchall:G.create(),typeName:Y.ZodObject,...U(t)}),K.strictCreate=(e,t)=>new K({shape:()=>e,unknownKeys:`strict`,catchall:G.create(),typeName:Y.ZodObject,...U(t)}),K.lazycreate=(e,t)=>new K({shape:e,unknownKeys:`strip`,catchall:G.create(),typeName:Y.ZodObject,...U(t)});var Bi=class extends W{_parse(e){let{ctx:t}=this._processInputParams(e),n=this._def.options;function r(e){for(let t of e)if(t.result.status===`valid`)return t.result;for(let n of e)if(n.result.status===`dirty`)return t.common.issues.push(...n.ctx.common.issues),n.result;let n=e.map(e=>new I(e.ctx.common.issues));return L(t,{code:F.invalid_union,unionErrors:n}),z}if(t.common.async)return Promise.all(n.map(async e=>{let n={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:n}),ctx:n}})).then(r);{let e,r=[];for(let i of n){let n={...t,common:{...t.common,issues:[]},parent:null},a=i._parseSync({data:t.data,path:t.path,parent:n});if(a.status===`valid`)return a;a.status===`dirty`&&!e&&(e={result:a,ctx:n}),n.common.issues.length&&r.push(n.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;let i=r.map(e=>new I(e));return L(t,{code:F.invalid_union,unionErrors:i}),z}}get options(){return this._def.options}};Bi.create=(e,t)=>new Bi({options:e,typeName:Y.ZodUnion,...U(t)});let Vi=e=>e instanceof Xi?Vi(e.schema):e instanceof q?Vi(e.innerType()):e instanceof Zi?[e.value]:e instanceof $i?e.options:e instanceof ea?N.objectValues(e.enum):e instanceof ra?Vi(e._def.innerType):e instanceof Ni?[void 0]:e instanceof Pi?[null]:e instanceof J?[void 0,...Vi(e.unwrap())]:e instanceof na?[null,...Vi(e.unwrap())]:e instanceof oa||e instanceof ca?Vi(e.unwrap()):e instanceof ia?Vi(e._def.innerType):[];var Hi=class e extends W{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==P.object)return L(t,{code:F.invalid_type,expected:P.object,received:t.parsedType}),z;let n=this.discriminator,r=t.data[n],i=this.optionsMap.get(r);return i?t.common.async?i._parseAsync({data:t.data,path:t.path,parent:t}):i._parseSync({data:t.data,path:t.path,parent:t}):(L(t,{code:F.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),z)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,n,r){let i=new Map;for(let e of n){let n=Vi(e.shape[t]);if(!n.length)throw Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(let r of n){if(i.has(r))throw Error(`Discriminator property ${String(t)} has duplicate value ${String(r)}`);i.set(r,e)}}return new e({typeName:Y.ZodDiscriminatedUnion,discriminator:t,options:n,optionsMap:i,...U(r)})}};function Ui(e,t){let n=Kr(e),r=Kr(t);if(e===t)return{valid:!0,data:e};if(n===P.object&&r===P.object){let n=N.objectKeys(t),r=N.objectKeys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};for(let n of r){let r=Ui(e[n],t[n]);if(!r.valid)return{valid:!1};i[n]=r.data}return{valid:!0,data:i}}else if(n===P.array&&r===P.array){if(e.length!==t.length)return{valid:!1};let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t[r],o=Ui(i,a);if(!o.valid)return{valid:!1};n.push(o.data)}return{valid:!0,data:n}}else if(n===P.date&&r===P.date&&+e==+t)return{valid:!0,data:e};else return{valid:!1}}var Wi=class extends W{_parse(e){let{status:t,ctx:n}=this._processInputParams(e),r=(e,r)=>{if(Qr(e)||Qr(r))return z;let i=Ui(e.value,r.value);return i.valid?(($r(e)||$r(r))&&t.dirty(),{status:t.value,value:i.data}):(L(n,{code:F.invalid_intersection_types}),z)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([e,t])=>r(e,t)):r(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};Wi.create=(e,t,n)=>new Wi({left:e,right:t,typeName:Y.ZodIntersection,...U(n)});var Gi=class e extends W{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==P.array)return L(n,{code:F.invalid_type,expected:P.array,received:n.parsedType}),z;if(n.data.length<this._def.items.length)return L(n,{code:F.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:`array`}),z;!this._def.rest&&n.data.length>this._def.items.length&&(L(n,{code:F.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:`array`}),t.dirty());let r=[...n.data].map((e,t)=>{let r=this._def.items[t]||this._def.rest;return r?r._parse(new H(n,e,n.path,t)):null}).filter(e=>!!e);return n.common.async?Promise.all(r).then(e=>R.mergeArray(t,e)):R.mergeArray(t,r)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};Gi.create=(e,t)=>{if(!Array.isArray(e))throw Error(`You must pass an array of schemas to z.tuple([ ... ])`);return new Gi({items:e,typeName:Y.ZodTuple,rest:null,...U(t)})};var Ki=class e extends W{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==P.object)return L(n,{code:F.invalid_type,expected:P.object,received:n.parsedType}),z;let r=[],i=this._def.keyType,a=this._def.valueType;for(let e in n.data)r.push({key:i._parse(new H(n,e,n.path,e)),value:a._parse(new H(n,n.data[e],n.path,e)),alwaysSet:e in n.data});return n.common.async?R.mergeObjectAsync(t,r):R.mergeObjectSync(t,r)}get element(){return this._def.valueType}static create(t,n,r){return n instanceof W?new e({keyType:t,valueType:n,typeName:Y.ZodRecord,...U(r)}):new e({keyType:Ei.create(),valueType:t,typeName:Y.ZodRecord,...U(n)})}},qi=class extends W{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==P.map)return L(n,{code:F.invalid_type,expected:P.map,received:n.parsedType}),z;let r=this._def.keyType,i=this._def.valueType,a=[...n.data.entries()].map(([e,t],a)=>({key:r._parse(new H(n,e,n.path,[a,`key`])),value:i._parse(new H(n,t,n.path,[a,`value`]))}));if(n.common.async){let e=new Map;return Promise.resolve().then(async()=>{for(let n of a){let r=await n.key,i=await n.value;if(r.status===`aborted`||i.status===`aborted`)return z;(r.status===`dirty`||i.status===`dirty`)&&t.dirty(),e.set(r.value,i.value)}return{status:t.value,value:e}})}else{let e=new Map;for(let n of a){let r=n.key,i=n.value;if(r.status===`aborted`||i.status===`aborted`)return z;(r.status===`dirty`||i.status===`dirty`)&&t.dirty(),e.set(r.value,i.value)}return{status:t.value,value:e}}}};qi.create=(e,t,n)=>new qi({valueType:t,keyType:e,typeName:Y.ZodMap,...U(n)});var Ji=class e extends W{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==P.set)return L(n,{code:F.invalid_type,expected:P.set,received:n.parsedType}),z;let r=this._def;r.minSize!==null&&n.data.size<r.minSize.value&&(L(n,{code:F.too_small,minimum:r.minSize.value,type:`set`,inclusive:!0,exact:!1,message:r.minSize.message}),t.dirty()),r.maxSize!==null&&n.data.size>r.maxSize.value&&(L(n,{code:F.too_big,maximum:r.maxSize.value,type:`set`,inclusive:!0,exact:!1,message:r.maxSize.message}),t.dirty());let i=this._def.valueType;function a(e){let n=new Set;for(let r of e){if(r.status===`aborted`)return z;r.status===`dirty`&&t.dirty(),n.add(r.value)}return{status:t.value,value:n}}let o=[...n.data.values()].map((e,t)=>i._parse(new H(n,e,n.path,t)));return n.common.async?Promise.all(o).then(e=>a(e)):a(o)}min(t,n){return new e({...this._def,minSize:{value:t,message:V.toString(n)}})}max(t,n){return new e({...this._def,maxSize:{value:t,message:V.toString(n)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};Ji.create=(e,t)=>new Ji({valueType:e,minSize:null,maxSize:null,typeName:Y.ZodSet,...U(t)});var Yi=class e extends W{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==P.function)return L(t,{code:F.invalid_type,expected:P.function,received:t.parsedType}),z;function n(e,n){return Xr({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Yr(),qr].filter(e=>!!e),issueData:{code:F.invalid_arguments,argumentsError:n}})}function r(e,n){return Xr({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Yr(),qr].filter(e=>!!e),issueData:{code:F.invalid_return_type,returnTypeError:n}})}let i={errorMap:t.common.contextualErrorMap},a=t.data;if(this._def.returns instanceof ta){let e=this;return B(async function(...t){let o=new I([]),s=await e._def.args.parseAsync(t,i).catch(e=>{throw o.addIssue(n(t,e)),o}),c=await Reflect.apply(a,this,s);return await e._def.returns._def.type.parseAsync(c,i).catch(e=>{throw o.addIssue(r(c,e)),o})})}else{let e=this;return B(function(...t){let o=e._def.args.safeParse(t,i);if(!o.success)throw new I([n(t,o.error)]);let s=Reflect.apply(a,this,o.data),c=e._def.returns.safeParse(s,i);if(!c.success)throw new I([r(s,c.error)]);return c.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e({...this._def,args:Gi.create(t).rest(Ii.create())})}returns(t){return new e({...this._def,returns:t})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(t,n,r){return new e({args:t||Gi.create([]).rest(Ii.create()),returns:n||Ii.create(),typeName:Y.ZodFunction,...U(r)})}},Xi=class extends W{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}};Xi.create=(e,t)=>new Xi({getter:e,typeName:Y.ZodLazy,...U(t)});var Zi=class extends W{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return L(t,{received:t.data,code:F.invalid_literal,expected:this._def.value}),z}return{status:`valid`,value:e.data}}get value(){return this._def.value}};Zi.create=(e,t)=>new Zi({value:e,typeName:Y.ZodLiteral,...U(t)});function Qi(e,t){return new $i({values:e,typeName:Y.ZodEnum,...U(t)})}var $i=class e extends W{_parse(e){if(typeof e.data!=`string`){let t=this._getOrReturnCtx(e),n=this._def.values;return L(t,{expected:N.joinValues(n),received:t.parsedType,code:F.invalid_type}),z}if(this._cache||=new Set(this._def.values),!this._cache.has(e.data)){let t=this._getOrReturnCtx(e),n=this._def.values;return L(t,{received:t.data,code:F.invalid_enum_value,options:n}),z}return B(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}extract(t,n=this._def){return e.create(t,{...this._def,...n})}exclude(t,n=this._def){return e.create(this.options.filter(e=>!t.includes(e)),{...this._def,...n})}};$i.create=Qi;var ea=class extends W{_parse(e){let t=N.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==P.string&&n.parsedType!==P.number){let e=N.objectValues(t);return L(n,{expected:N.joinValues(e),received:n.parsedType,code:F.invalid_type}),z}if(this._cache||=new Set(N.getValidEnumValues(this._def.values)),!this._cache.has(e.data)){let e=N.objectValues(t);return L(n,{received:n.data,code:F.invalid_enum_value,options:e}),z}return B(e.data)}get enum(){return this._def.values}};ea.create=(e,t)=>new ea({values:e,typeName:Y.ZodNativeEnum,...U(t)});var ta=class extends W{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);return t.parsedType!==P.promise&&t.common.async===!1?(L(t,{code:F.invalid_type,expected:P.promise,received:t.parsedType}),z):B((t.parsedType===P.promise?t.data:Promise.resolve(t.data)).then(e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap})))}};ta.create=(e,t)=>new ta({type:e,typeName:Y.ZodPromise,...U(t)});var q=class extends W{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Y.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:n}=this._processInputParams(e),r=this._def.effect||null,i={addIssue:e=>{L(n,e),e.fatal?t.abort():t.dirty()},get path(){return n.path}};if(i.addIssue=i.addIssue.bind(i),r.type===`preprocess`){let e=r.transform(n.data,i);if(n.common.async)return Promise.resolve(e).then(async e=>{if(t.value===`aborted`)return z;let r=await this._def.schema._parseAsync({data:e,path:n.path,parent:n});return r.status===`aborted`?z:r.status===`dirty`||t.value===`dirty`?Zr(r.value):r});{if(t.value===`aborted`)return z;let r=this._def.schema._parseSync({data:e,path:n.path,parent:n});return r.status===`aborted`?z:r.status===`dirty`||t.value===`dirty`?Zr(r.value):r}}if(r.type===`refinement`){let e=e=>{let t=r.refinement(e,i);if(n.common.async)return Promise.resolve(t);if(t instanceof Promise)throw Error(`Async refinement encountered during synchronous parse operation. Use .parseAsync instead.`);return e};if(n.common.async===!1){let r=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return r.status===`aborted`?z:(r.status===`dirty`&&t.dirty(),e(r.value),{status:t.value,value:r.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(n=>n.status===`aborted`?z:(n.status===`dirty`&&t.dirty(),e(n.value).then(()=>({status:t.value,value:n.value}))))}if(r.type===`transform`)if(n.common.async===!1){let e=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!ei(e))return z;let a=r.transform(e.value,i);if(a instanceof Promise)throw Error(`Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.`);return{status:t.value,value:a}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(e=>ei(e)?Promise.resolve(r.transform(e.value,i)).then(e=>({status:t.value,value:e})):z);N.assertNever(r)}};q.create=(e,t,n)=>new q({schema:e,typeName:Y.ZodEffects,effect:t,...U(n)}),q.createWithPreprocess=(e,t,n)=>new q({schema:t,effect:{type:`preprocess`,transform:e},typeName:Y.ZodEffects,...U(n)});var J=class extends W{_parse(e){return this._getType(e)===P.undefined?B(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};J.create=(e,t)=>new J({innerType:e,typeName:Y.ZodOptional,...U(t)});var na=class extends W{_parse(e){return this._getType(e)===P.null?B(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};na.create=(e,t)=>new na({innerType:e,typeName:Y.ZodNullable,...U(t)});var ra=class extends W{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return t.parsedType===P.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};ra.create=(e,t)=>new ra({innerType:e,typeName:Y.ZodDefault,defaultValue:typeof t.default==`function`?t.default:()=>t.default,...U(t)});var ia=class extends W{_parse(e){let{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},r=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return ti(r)?r.then(e=>({status:`valid`,value:e.status===`valid`?e.value:this._def.catchValue({get error(){return new I(n.common.issues)},input:n.data})})):{status:`valid`,value:r.status===`valid`?r.value:this._def.catchValue({get error(){return new I(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};ia.create=(e,t)=>new ia({innerType:e,typeName:Y.ZodCatch,catchValue:typeof t.catch==`function`?t.catch:()=>t.catch,...U(t)});var aa=class extends W{_parse(e){if(this._getType(e)!==P.nan){let t=this._getOrReturnCtx(e);return L(t,{code:F.invalid_type,expected:P.nan,received:t.parsedType}),z}return{status:`valid`,value:e.data}}};aa.create=e=>new aa({typeName:Y.ZodNaN,...U(e)});var oa=class extends W{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}},sa=class e extends W{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{let e=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return e.status===`aborted`?z:e.status===`dirty`?(t.dirty(),Zr(e.value)):this._def.out._parseAsync({data:e.value,path:n.path,parent:n})})();{let e=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return e.status===`aborted`?z:e.status===`dirty`?(t.dirty(),{status:`dirty`,value:e.value}):this._def.out._parseSync({data:e.value,path:n.path,parent:n})}}static create(t,n){return new e({in:t,out:n,typeName:Y.ZodPipeline})}},ca=class extends W{_parse(e){let t=this._def.innerType._parse(e),n=e=>(ei(e)&&(e.value=Object.freeze(e.value)),e);return ti(t)?t.then(e=>n(e)):n(t)}unwrap(){return this._def.innerType}};ca.create=(e,t)=>new ca({innerType:e,typeName:Y.ZodReadonly,...U(t)}),K.lazycreate;var Y;(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`})(Y||={});let la=Ei.create,ua=Oi.create;aa.create,ki.create;let da=Ai.create;ji.create,Mi.create,Ni.create;let fa=Pi.create,pa=Fi.create;Ii.create;let ma=G.create;Li.create;let ha=Ri.create,ga=K.create;K.strictCreate;let X=Bi.create;Hi.create;let _a=Wi.create,va=Gi.create,ya=Ki.create;qi.create,Ji.create,Yi.create,Xi.create;let ba=Zi.create,xa=$i.create;ea.create,ta.create,q.create,J.create,na.create,q.createWithPreprocess,sa.create;var Sa=e=>[e.slice(0,e.length/2),e.slice(e.length/2)],Ca=Symbol(`Original index`),wa=e=>{let t=[];for(let n=0;n<e.length;n++){let r=e[n];if(typeof r==`boolean`)t.push(r?{[Ca]:n}:{[Ca]:n,not:{}});else if(Ca in r)return e;else t.push({...r,[Ca]:n})}return t};function Ta(e,t){if(e.allOf.length===0)return ma();if(e.allOf.length===1){let n=e.allOf[0];return $(n,{...t,path:[...t.path,`allOf`,n[Ca]]})}let[n,r]=Sa(wa(e.allOf));return _a(Ta({allOf:n},t),Ta({allOf:r},t))}var Ea=(e,t)=>e.anyOf.length?e.anyOf.length===1?$(e.anyOf[0],{...t,path:[...t.path,`anyOf`,0]}):X(e.anyOf.map((e,n)=>$(e,{...t,path:[...t.path,`anyOf`,n]}))):pa();function Z(e,t,n,r){let i=t[n];if(i!==void 0){let a=t.errorMessage?.[n];return r(e,i,a)}return e}var Q={an:{object:e=>e.type===`object`||!e.type&&(e.properties!==void 0||e.additionalProperties!==void 0||e.patternProperties!==void 0),array:e=>e.type===`array`,anyOf:e=>e.anyOf!==void 0,allOf:e=>e.allOf!==void 0,enum:e=>e.enum!==void 0},a:{nullable:e=>e.nullable===!0,multipleType:e=>Array.isArray(e.type),not:e=>e.not!==void 0,const:e=>e.const!==void 0,primitive:(e,t)=>e.type===t,conditional:e=>!!(`if`in e&&e.if&&`then`in e&&`else`in e&&e.then&&e.else),oneOf:e=>e.oneOf!==void 0}},Da=(e,t)=>{if(Q.an.anyOf(e)){let n=new Set,r=[];e.anyOf.forEach(e=>{if(typeof e==`object`&&e.type&&n.add(typeof e.type==`string`?e.type:e.type[0]),typeof e==`object`&&e.items){let t=e.items;!Array.isArray(t)&&typeof t==`object`&&r.push(t)}});let i;r.length===1?i=r[0]:r.length>1&&(i={anyOf:r});let a={...n.size>0?{type:Array.from(n)}:{type:`array`},...i&&{items:i}};return[`default`,`description`,`examples`,`title`].forEach(t=>{let n=e[t];n!==void 0&&(a[t]=n)}),$(a,t)}if(Array.isArray(e.items))return va(e.items.map((e,n)=>$(e,{...t,path:[...t.path,`items`,n]})));let n=e.items?ha($(e.items,{...t,path:[...t.path,`items`]})):ha(pa());return n=Z(n,e,`minItems`,(e,t,n)=>e.min(t,n)),n=Z(n,e,`maxItems`,(e,t,n)=>e.max(t,n)),typeof e.min==`number`&&typeof e.minItems!=`number`&&(n=Z(n,{...e,minItems:e.min},`minItems`,(e,t,n)=>e.min(t,n))),typeof e.max==`number`&&typeof e.maxItems!=`number`&&(n=Z(n,{...e,maxItems:e.max},`maxItems`,(e,t,n)=>e.max(t,n))),n},Oa=e=>da(),ka=e=>ba(e.const),Aa=e=>pa(),ja=e=>e.enum.length===0?ma():e.enum.length===1?ba(e.enum[0]):e.enum.every(e=>typeof e==`string`)?xa(e.enum):X(e.enum.map(e=>ba(e))),Ma=(e,t)=>{let n=$(e.if,{...t,path:[...t.path,`if`]}),r=$(e.then,{...t,path:[...t.path,`then`]}),i=$(e.else,{...t,path:[...t.path,`else`]});return X([r,i]).superRefine((e,t)=>{let a=n.safeParse(e).success?r.safeParse(e):i.safeParse(e);a.success||a.error.errors.forEach(e=>t.addIssue(e))})},Na=(e,t)=>X(e.type.map(n=>$({...e,type:n},t))),Pa=(e,t)=>pa().refine(n=>!$(e.not,{...t,path:[...t.path,`not`]}).safeParse(n).success,`Invalid input: Should NOT be valid against schema`),Fa=e=>fa(),Ia=(e,...t)=>Object.keys(e).reduce((n,r)=>(t.includes(r)||(n[r]=e[r]),n),{}),La=(e,t)=>{let n=e.default===null,r=$(n?Ia(Ia(e,`nullable`),`default`):Ia(e,`nullable`),t,!0).nullable();return n?r.default(null):r},Ra=e=>{let t=ua(),n=!1;return e.type===`integer`?(n=!0,t=Z(t,e,`type`,(e,t,n)=>e.int(n))):e.format===`int64`&&(n=!0,t=Z(t,e,`format`,(e,t,n)=>e.int(n))),t=Z(t,e,`multipleOf`,(e,t,r)=>t===1?n?e:e.int(r):e.multipleOf(t,r)),typeof e.minimum==`number`?t=e.exclusiveMinimum===!0?Z(t,e,`minimum`,(e,t,n)=>e.gt(t,n)):Z(t,e,`minimum`,(e,t,n)=>e.gte(t,n)):typeof e.exclusiveMinimum==`number`&&(t=Z(t,e,`exclusiveMinimum`,(e,t,n)=>e.gt(t,n))),typeof e.maximum==`number`?t=e.exclusiveMaximum===!0?Z(t,e,`maximum`,(e,t,n)=>e.lt(t,n)):Z(t,e,`maximum`,(e,t,n)=>e.lte(t,n)):typeof e.exclusiveMaximum==`number`&&(t=Z(t,e,`exclusiveMaximum`,(e,t,n)=>e.lt(t,n))),typeof e.min==`number`&&typeof e.minimum!=`number`&&(t=Z(t,{...e,minimum:e.min},`minimum`,(e,t,n)=>e.gte(t,n))),typeof e.max==`number`&&typeof e.maximum!=`number`&&(t=Z(t,{...e,maximum:e.max},`maximum`,(e,t,n)=>e.lte(t,n))),t},za=(e,t)=>e.oneOf.length?e.oneOf.length===1?$(e.oneOf[0],{...t,path:[...t.path,`oneOf`,0]}):pa().superRefine((n,r)=>{let i=e.oneOf.map((e,n)=>$(e,{...t,path:[...t.path,`oneOf`,n]})),a=i.reduce((e,t)=>(t=>t.error?[...e,t.error]:e)(t.safeParse(n)),[]);i.length-a.length!==1&&r.addIssue({path:r.path,code:`invalid_union`,unionErrors:a,message:`Invalid input: Should pass single schema`})}):pa();function Ba(e,t){if(!e.properties)return ga({});let n=Object.keys(e.properties);if(n.length===0)return ga({});let r={};for(let i of n){let n=e.properties[i],a=$(n,{...t,path:[...t.path,`properties`,i]}),o=Array.isArray(e.required)?e.required.includes(i):!1;if(!o&&n&&typeof n==`object`&&`default`in n)if(n.default===null){let e=n.anyOf&&Array.isArray(n.anyOf)&&n.anyOf.some(e=>typeof e==`object`&&!!e&&e.type===`null`),t=n.oneOf&&Array.isArray(n.oneOf)&&n.oneOf.some(e=>typeof e==`object`&&!!e&&e.type===`null`),o=`nullable`in n&&n.nullable===!0;e||t||o?r[i]=a.optional().default(null):r[i]=a.nullable().optional().default(null)}else r[i]=a.optional().default(n.default);else r[i]=o?a:a.optional()}return ga(r)}function Va(e,t){let n=Object.keys(e.patternProperties??{}).length>0,r=e.type===`object`?e:{...e,type:`object`},i=Ba(r,t),a=i,o=r.additionalProperties===void 0?void 0:$(r.additionalProperties,{...t,path:[...t.path,`additionalProperties`]}),s=r.additionalProperties===!0;if(r.patternProperties){let e=Object.fromEntries(Object.entries(r.patternProperties).map(([e,n])=>[e,$(n,{...t,path:[...t.path,`patternProperties`,e]})])),n=Object.values(e);a=i?o?i.catchall(X([...n,o])):Object.keys(e).length>1?i.catchall(X(n)):i.catchall(n[0]):o?ya(X([...n,o])):n.length>1?ya(X(n)):ya(n[0]);let s=new Set(Object.keys(r.properties??{}));a=a.superRefine((t,n)=>{for(let i in t){let a=s.has(i);for(let o in r.patternProperties){let r=new RegExp(o);if(i.match(r)){a=!0;let r=e[o].safeParse(t[i]);r.success||n.addIssue({path:[...n.path,i],code:`custom`,message:`Invalid input: Key matching regex /${i}/ must match schema`,params:{issues:r.error.issues}})}}if(!a&&o){let e=o.safeParse(t[i]);e.success||n.addIssue({path:[...n.path,i],code:`custom`,message:`Invalid input: must match catchall schema`,params:{issues:e.error.issues}})}}})}let c;return c=i?n?a:o?o instanceof G?i.strict():s?i.passthrough():i.catchall(o):i.strict():n?a:o?o instanceof G?ga({}).strict():s?ga({}).passthrough():ya(o):ga({}).passthrough(),Q.an.anyOf(e)&&(c=c.and(Ea({...e,anyOf:e.anyOf.map(e=>typeof e==`object`&&!e.type&&(e.properties??e.additionalProperties??e.patternProperties)?{...e,type:`object`}:e)},t))),Q.a.oneOf(e)&&(c=c.and(za({...e,oneOf:e.oneOf.map(e=>typeof e==`object`&&!e.type&&(e.properties??e.additionalProperties??e.patternProperties)?{...e,type:`object`}:e)},t))),Q.an.allOf(e)&&(c=c.and(Ta({...e,allOf:e.allOf.map(e=>typeof e==`object`&&!e.type&&(e.properties??e.additionalProperties??e.patternProperties)?{...e,type:`object`}:e)},t))),c}var Ha=e=>{let t=la();return t=Z(t,e,`format`,(e,t,n)=>{switch(t){case`email`:return e.email(n);case`ip`:return e.ip(n);case`ipv4`:return e.ip({version:`v4`,message:n});case`ipv6`:return e.ip({version:`v6`,message:n});case`uri`:return e.url(n);case`uuid`:return e.uuid(n);case`date-time`:return e.datetime({offset:!0,message:n});case`time`:return e.time(n);case`date`:return e.date(n);case`binary`:return e.base64(n);case`duration`:return e.duration(n);default:return e}}),t=Z(t,e,`contentEncoding`,(e,t,n)=>e.base64(n)),t=Z(t,e,`pattern`,(e,t,n)=>e.regex(new RegExp(t),n)),t=Z(t,e,`minLength`,(e,t,n)=>e.min(t,n)),t=Z(t,e,`maxLength`,(e,t,n)=>e.max(t,n)),typeof e.min==`number`&&typeof e.minLength!=`number`&&(t=Z(t,{...e,minLength:e.min},`minLength`,(e,t,n)=>e.min(t,n))),typeof e.max==`number`&&typeof e.maxLength!=`number`&&(t=Z(t,{...e,maxLength:e.max},`maxLength`,(e,t,n)=>e.max(t,n))),t},Ua=(e,t)=>{let n=``;if(e.description?n=e.description:e.title&&(n=e.title),e.example!==void 0){let t=`Example: ${JSON.stringify(e.example)}`;n=n?`${n}
1
+ var WebMCP=(function(e){var t=Object.create,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,a=Object.getPrototypeOf,o=Object.prototype.hasOwnProperty,s=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),c=(e,t,a,s)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var c=i(t),l=0,u=c.length,d;l<u;l++)d=c[l],!o.call(e,d)&&d!==a&&n(e,d,{get:(e=>t[e]).bind(null,d),enumerable:!(s=r(t,d))||s.enumerable});return e},l=(e,r,i)=>(i=e==null?{}:t(a(e)),c(r||!e||!e.__esModule?n(i,`default`,{value:e,enumerable:!0}):i,e)),u;(function(e){e.assertEqual=e=>e;function t(e){}e.assertIs=t;function n(e){throw Error()}e.assertNever=n,e.arrayToEnum=e=>{let t={};for(let n of e)t[n]=n;return t},e.getValidEnumValues=t=>{let n=e.objectKeys(t).filter(e=>typeof t[t[e]]!=`number`),r={};for(let e of n)r[e]=t[e];return e.objectValues(r)},e.objectValues=t=>e.objectKeys(t).map(function(e){return t[e]}),e.objectKeys=typeof Object.keys==`function`?e=>Object.keys(e):e=>{let t=[];for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.push(n);return t},e.find=(e,t)=>{for(let n of e)if(t(n))return n},e.isInteger=typeof Number.isInteger==`function`?e=>Number.isInteger(e):e=>typeof e==`number`&&isFinite(e)&&Math.floor(e)===e;function r(e,t=` | `){return e.map(e=>typeof e==`string`?`'${e}'`:e).join(t)}e.joinValues=r,e.jsonStringifyReplacer=(e,t)=>typeof t==`bigint`?t.toString():t})(u||={});var d;(function(e){e.mergeShapes=(e,t)=>({...e,...t})})(d||={});let f=u.arrayToEnum([`string`,`nan`,`number`,`integer`,`float`,`boolean`,`date`,`bigint`,`symbol`,`function`,`undefined`,`null`,`array`,`object`,`unknown`,`promise`,`void`,`never`,`map`,`set`]),p=e=>{switch(typeof e){case`undefined`:return f.undefined;case`string`:return f.string;case`number`:return isNaN(e)?f.nan:f.number;case`boolean`:return f.boolean;case`function`:return f.function;case`bigint`:return f.bigint;case`symbol`:return f.symbol;case`object`:return Array.isArray(e)?f.array:e===null?f.null:e.then&&typeof e.then==`function`&&e.catch&&typeof e.catch==`function`?f.promise:typeof Map<`u`&&e instanceof Map?f.map:typeof Set<`u`&&e instanceof Set?f.set:typeof Date<`u`&&e instanceof Date?f.date:f.object;default:return f.unknown}},m=u.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`]),h=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,`$1:`);var g=class e 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]};let t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name=`ZodError`,this.issues=e}format(e){let t=e||function(e){return e.message},n={_errors:[]},r=e=>{for(let i of e.issues)if(i.code===`invalid_union`)i.unionErrors.map(r);else if(i.code===`invalid_return_type`)r(i.returnTypeError);else if(i.code===`invalid_arguments`)r(i.argumentsError);else if(i.path.length===0)n._errors.push(t(i));else{let e=n,r=0;for(;r<i.path.length;){let n=i.path[r];r===i.path.length-1?(e[n]=e[n]||{_errors:[]},e[n]._errors.push(t(i))):e[n]=e[n]||{_errors:[]},e=e[n],r++}}};return r(this),n}static assert(t){if(!(t instanceof e))throw Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,u.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=e=>e.message){let t={},n=[];for(let r of this.issues)r.path.length>0?(t[r.path[0]]=t[r.path[0]]||[],t[r.path[0]].push(e(r))):n.push(e(r));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}};g.create=e=>new g(e);let _=(e,t)=>{let n;switch(e.code){case m.invalid_type:n=e.received===f.undefined?`Required`:`Expected ${e.expected}, received ${e.received}`;break;case m.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,u.jsonStringifyReplacer)}`;break;case m.unrecognized_keys:n=`Unrecognized key(s) in object: ${u.joinValues(e.keys,`, `)}`;break;case m.invalid_union:n=`Invalid input`;break;case m.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${u.joinValues(e.options)}`;break;case m.invalid_enum_value:n=`Invalid enum value. Expected ${u.joinValues(e.options)}, received '${e.received}'`;break;case m.invalid_arguments:n=`Invalid function arguments`;break;case m.invalid_return_type:n=`Invalid function return type`;break;case m.invalid_date:n=`Invalid date`;break;case m.invalid_string:typeof e.validation==`object`?`includes`in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position==`number`&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):`startsWith`in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:`endsWith`in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:u.assertNever(e.validation):n=e.validation===`regex`?`Invalid`:`Invalid ${e.validation}`;break;case m.too_small:n=e.type===`array`?`Array must contain ${e.exact?`exactly`:e.inclusive?`at least`:`more than`} ${e.minimum} element(s)`:e.type===`string`?`String must contain ${e.exact?`exactly`:e.inclusive?`at least`:`over`} ${e.minimum} character(s)`:e.type===`number`?`Number must be ${e.exact?`exactly equal to `:e.inclusive?`greater than or equal to `:`greater than `}${e.minimum}`:e.type===`date`?`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 m.too_big:n=e.type===`array`?`Array must contain ${e.exact?`exactly`:e.inclusive?`at most`:`less than`} ${e.maximum} element(s)`:e.type===`string`?`String must contain ${e.exact?`exactly`:e.inclusive?`at most`:`under`} ${e.maximum} character(s)`:e.type===`number`?`Number must be ${e.exact?`exactly`:e.inclusive?`less than or equal to`:`less than`} ${e.maximum}`:e.type===`bigint`?`BigInt must be ${e.exact?`exactly`:e.inclusive?`less than or equal to`:`less than`} ${e.maximum}`:e.type===`date`?`Date must be ${e.exact?`exactly`:e.inclusive?`smaller than or equal to`:`smaller than`} ${new Date(Number(e.maximum))}`:`Invalid input`;break;case m.custom:n=`Invalid input`;break;case m.invalid_intersection_types:n=`Intersection results could not be merged`;break;case m.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case m.not_finite:n=`Number must be finite`;break;default:n=t.defaultError,u.assertNever(e)}return{message:n}},v=_;function y(e){v=e}function b(){return v}let x=e=>{let{data:t,path:n,errorMaps:r,issueData:i}=e,a=[...n,...i.path||[]],o={...i,path:a};if(i.message!==void 0)return{...i,path:a,message:i.message};let s=``,c=r.filter(e=>!!e).slice().reverse();for(let e of c)s=e(o,{data:t,defaultError:s}).message;return{...i,path:a,message:s}},S=[];function C(e,t){let n=b(),r=x({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===_?void 0:_].filter(e=>!!e)});e.common.issues.push(r)}var w=class e{constructor(){this.value=`valid`}dirty(){this.value===`valid`&&(this.value=`dirty`)}abort(){this.value!==`aborted`&&(this.value=`aborted`)}static mergeArray(e,t){let n=[];for(let r of t){if(r.status===`aborted`)return T;r.status===`dirty`&&e.dirty(),n.push(r.value)}return{status:e.value,value:n}}static async mergeObjectAsync(t,n){let r=[];for(let e of n){let t=await e.key,n=await e.value;r.push({key:t,value:n})}return e.mergeObjectSync(t,r)}static mergeObjectSync(e,t){let n={};for(let r of t){let{key:t,value:i}=r;if(t.status===`aborted`||i.status===`aborted`)return T;t.status===`dirty`&&e.dirty(),i.status===`dirty`&&e.dirty(),t.value!==`__proto__`&&(i.value!==void 0||r.alwaysSet)&&(n[t.value]=i.value)}return{status:e.value,value:n}}};let T=Object.freeze({status:`aborted`}),E=e=>({status:`dirty`,value:e}),D=e=>({status:`valid`,value:e}),O=e=>e.status===`aborted`,k=e=>e.status===`dirty`,A=e=>e.status===`valid`,ee=e=>typeof Promise<`u`&&e instanceof Promise;function j(e,t,n,r){if(n===`a`&&!r)throw TypeError(`Private accessor was defined without a getter`);if(typeof t==`function`?e!==t||!r:!t.has(e))throw TypeError(`Cannot read private member from an object whose class did not declare it`);return n===`m`?r:n===`a`?r.call(e):r?r.value:t.get(e)}function M(e,t,n,r,i){if(r===`m`)throw TypeError(`Private method is not writable`);if(r===`a`&&!i)throw TypeError(`Private accessor was defined without a setter`);if(typeof t==`function`?e!==t||!i:!t.has(e))throw TypeError(`Cannot write private member to an object whose class did not declare it`);return r===`a`?i.call(e,n):i?i.value=n:t.set(e,n),n}var N;(function(e){e.errToObj=e=>typeof e==`string`?{message:e}:e||{},e.toString=e=>typeof e==`string`?e:e?.message})(N||={});var P,te,F=class{constructor(e,t,n,r){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=r}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}};let I=(e,t)=>{if(A(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw Error(`Validation failed but no issues detected.`);return{success:!1,get error(){return this._error||=new g(e.common.issues),this._error}}};function L(e){if(!e)return{};let{errorMap:t,invalid_type_error:n,required_error:r,description:i}=e;if(t&&(n||r))throw Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:i}:{errorMap:(t,i)=>{let{message:a}=e;return t.code===`invalid_enum_value`?{message:a??i.defaultError}:i.data===void 0?{message:a??r??i.defaultError}:t.code===`invalid_type`?{message:a??n??i.defaultError}:{message:i.defaultError}},description:i}}var R=class{get description(){return this._def.description}_getType(e){return p(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:p(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new w,ctx:{common:e.parent.common,data:e.data,parsedType:p(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(ee(t))throw Error(`Synchronous parse encountered promise.`);return t}_parseAsync(e){let t=this._parse(e);return Promise.resolve(t)}parse(e,t){let n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){let n={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:p(e)};return I(n,this._parseSync({data:e,path:n.path,parent:n}))}"~validate"(e){let t={common:{issues:[],async:!!this[`~standard`].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:p(e)};if(!this[`~standard`].async)try{let n=this._parseSync({data:e,path:[],parent:t});return A(n)?{value:n.value}:{issues:t.common.issues}}catch(e){((e?.message)?.toLowerCase())?.includes(`encountered`)&&(this[`~standard`].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(e=>A(e)?{value:e.value}:{issues:t.common.issues})}async parseAsync(e,t){let n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){let n={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:p(e)},r=this._parse({data:e,path:n.path,parent:n});return I(n,await(ee(r)?r:Promise.resolve(r)))}refine(e,t){let n=e=>typeof t==`string`||t===void 0?{message:t}:typeof t==`function`?t(e):t;return this._refinement((t,r)=>{let i=e(t),a=()=>r.addIssue({code:m.custom,...n(t)});return typeof Promise<`u`&&i instanceof Promise?i.then(e=>e?!0:(a(),!1)):i?!0:(a(),!1)})}refinement(e,t){return this._refinement((n,r)=>e(n)?!0:(r.addIssue(typeof t==`function`?t(n,r):t),!1))}_refinement(e){return new rt({schema:this,typeName:z.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 it.create(this,this._def)}nullable(){return at.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Re.create(this)}promise(){return nt.create(this,this._def)}or(e){return Ve.create([this,e],this._def)}and(e){return Ge.create(this,e,this._def)}transform(e){return new rt({...L(this._def),schema:this,typeName:z.ZodEffects,effect:{type:`transform`,transform:e}})}default(e){let t=typeof e==`function`?e:()=>e;return new ot({...L(this._def),innerType:this,defaultValue:t,typeName:z.ZodDefault})}brand(){return new ut({typeName:z.ZodBranded,type:this,...L(this._def)})}catch(e){let t=typeof e==`function`?e:()=>e;return new st({...L(this._def),innerType:this,catchValue:t,typeName:z.ZodCatch})}describe(e){let t=this.constructor;return new t({...this._def,description:e})}pipe(e){return dt.create(this,e)}readonly(){return ft.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}};let ne=/^c[^\s-]{8,}$/i,re=/^[0-9a-z]+$/,ie=/^[0-9A-HJKMNP-TV-Z]{26}$/i,ae=/^[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,oe=/^[a-z0-9_-]{21}$/i,se=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,ce=/^[-+]?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)?)??$/,le=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,ue,de=/^(?:(?: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])$/,fe=/^(?:(?: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])$/,pe=/^(([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]))$/,me=/^(([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])$/,he=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,ge=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,_e=`((\\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])))`,ve=RegExp(`^${_e}$`);function ye(e){let t=`([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d`;return e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision??(t=`${t}(\\.\\d+)?`),t}function be(e){return RegExp(`^${ye(e)}$`)}function xe(e){let t=`${_e}T${ye(e)}`,n=[];return n.push(e.local?`Z?`:`Z`),e.offset&&n.push(`([+-]\\d{2}:?\\d{2})`),t=`${t}(${n.join(`|`)})`,RegExp(`^${t}$`)}function Se(e,t){return!!((t===`v4`||!t)&&de.test(e)||(t===`v6`||!t)&&pe.test(e))}function Ce(e,t){if(!se.test(e))return!1;try{let[n]=e.split(`.`),r=n.replace(/-/g,`+`).replace(/_/g,`/`).padEnd(n.length+(4-n.length%4)%4,`=`),i=JSON.parse(atob(r));return!(typeof i!=`object`||!i||!i.typ||!i.alg||t&&i.alg!==t)}catch{return!1}}function we(e,t){return!!((t===`v4`||!t)&&fe.test(e)||(t===`v6`||!t)&&me.test(e))}var Te=class e extends R{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==f.string){let t=this._getOrReturnCtx(e);return C(t,{code:m.invalid_type,expected:f.string,received:t.parsedType}),T}let t=new w,n;for(let r of this._def.checks)if(r.kind===`min`)e.data.length<r.value&&(n=this._getOrReturnCtx(e,n),C(n,{code:m.too_small,minimum:r.value,type:`string`,inclusive:!0,exact:!1,message:r.message}),t.dirty());else if(r.kind===`max`)e.data.length>r.value&&(n=this._getOrReturnCtx(e,n),C(n,{code:m.too_big,maximum:r.value,type:`string`,inclusive:!0,exact:!1,message:r.message}),t.dirty());else if(r.kind===`length`){let i=e.data.length>r.value,a=e.data.length<r.value;(i||a)&&(n=this._getOrReturnCtx(e,n),i?C(n,{code:m.too_big,maximum:r.value,type:`string`,inclusive:!0,exact:!0,message:r.message}):a&&C(n,{code:m.too_small,minimum:r.value,type:`string`,inclusive:!0,exact:!0,message:r.message}),t.dirty())}else if(r.kind===`email`)le.test(e.data)||(n=this._getOrReturnCtx(e,n),C(n,{validation:`email`,code:m.invalid_string,message:r.message}),t.dirty());else if(r.kind===`emoji`)ue||=RegExp(`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`,`u`),ue.test(e.data)||(n=this._getOrReturnCtx(e,n),C(n,{validation:`emoji`,code:m.invalid_string,message:r.message}),t.dirty());else if(r.kind===`uuid`)ae.test(e.data)||(n=this._getOrReturnCtx(e,n),C(n,{validation:`uuid`,code:m.invalid_string,message:r.message}),t.dirty());else if(r.kind===`nanoid`)oe.test(e.data)||(n=this._getOrReturnCtx(e,n),C(n,{validation:`nanoid`,code:m.invalid_string,message:r.message}),t.dirty());else if(r.kind===`cuid`)ne.test(e.data)||(n=this._getOrReturnCtx(e,n),C(n,{validation:`cuid`,code:m.invalid_string,message:r.message}),t.dirty());else if(r.kind===`cuid2`)re.test(e.data)||(n=this._getOrReturnCtx(e,n),C(n,{validation:`cuid2`,code:m.invalid_string,message:r.message}),t.dirty());else if(r.kind===`ulid`)ie.test(e.data)||(n=this._getOrReturnCtx(e,n),C(n,{validation:`ulid`,code:m.invalid_string,message:r.message}),t.dirty());else if(r.kind===`url`)try{new URL(e.data)}catch{n=this._getOrReturnCtx(e,n),C(n,{validation:`url`,code:m.invalid_string,message:r.message}),t.dirty()}else r.kind===`regex`?(r.regex.lastIndex=0,r.regex.test(e.data)||(n=this._getOrReturnCtx(e,n),C(n,{validation:`regex`,code:m.invalid_string,message:r.message}),t.dirty())):r.kind===`trim`?e.data=e.data.trim():r.kind===`includes`?e.data.includes(r.value,r.position)||(n=this._getOrReturnCtx(e,n),C(n,{code:m.invalid_string,validation:{includes:r.value,position:r.position},message:r.message}),t.dirty()):r.kind===`toLowerCase`?e.data=e.data.toLowerCase():r.kind===`toUpperCase`?e.data=e.data.toUpperCase():r.kind===`startsWith`?e.data.startsWith(r.value)||(n=this._getOrReturnCtx(e,n),C(n,{code:m.invalid_string,validation:{startsWith:r.value},message:r.message}),t.dirty()):r.kind===`endsWith`?e.data.endsWith(r.value)||(n=this._getOrReturnCtx(e,n),C(n,{code:m.invalid_string,validation:{endsWith:r.value},message:r.message}),t.dirty()):r.kind===`datetime`?xe(r).test(e.data)||(n=this._getOrReturnCtx(e,n),C(n,{code:m.invalid_string,validation:`datetime`,message:r.message}),t.dirty()):r.kind===`date`?ve.test(e.data)||(n=this._getOrReturnCtx(e,n),C(n,{code:m.invalid_string,validation:`date`,message:r.message}),t.dirty()):r.kind===`time`?be(r).test(e.data)||(n=this._getOrReturnCtx(e,n),C(n,{code:m.invalid_string,validation:`time`,message:r.message}),t.dirty()):r.kind===`duration`?ce.test(e.data)||(n=this._getOrReturnCtx(e,n),C(n,{validation:`duration`,code:m.invalid_string,message:r.message}),t.dirty()):r.kind===`ip`?Se(e.data,r.version)||(n=this._getOrReturnCtx(e,n),C(n,{validation:`ip`,code:m.invalid_string,message:r.message}),t.dirty()):r.kind===`jwt`?Ce(e.data,r.alg)||(n=this._getOrReturnCtx(e,n),C(n,{validation:`jwt`,code:m.invalid_string,message:r.message}),t.dirty()):r.kind===`cidr`?we(e.data,r.version)||(n=this._getOrReturnCtx(e,n),C(n,{validation:`cidr`,code:m.invalid_string,message:r.message}),t.dirty()):r.kind===`base64`?he.test(e.data)||(n=this._getOrReturnCtx(e,n),C(n,{validation:`base64`,code:m.invalid_string,message:r.message}),t.dirty()):r.kind===`base64url`?ge.test(e.data)||(n=this._getOrReturnCtx(e,n),C(n,{validation:`base64url`,code:m.invalid_string,message:r.message}),t.dirty()):u.assertNever(r);return{status:t.value,value:e.data}}_regex(e,t,n){return this.refinement(t=>e.test(t),{validation:t,code:m.invalid_string,...N.errToObj(n)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(e){return this._addCheck({kind:`email`,...N.errToObj(e)})}url(e){return this._addCheck({kind:`url`,...N.errToObj(e)})}emoji(e){return this._addCheck({kind:`emoji`,...N.errToObj(e)})}uuid(e){return this._addCheck({kind:`uuid`,...N.errToObj(e)})}nanoid(e){return this._addCheck({kind:`nanoid`,...N.errToObj(e)})}cuid(e){return this._addCheck({kind:`cuid`,...N.errToObj(e)})}cuid2(e){return this._addCheck({kind:`cuid2`,...N.errToObj(e)})}ulid(e){return this._addCheck({kind:`ulid`,...N.errToObj(e)})}base64(e){return this._addCheck({kind:`base64`,...N.errToObj(e)})}base64url(e){return this._addCheck({kind:`base64url`,...N.errToObj(e)})}jwt(e){return this._addCheck({kind:`jwt`,...N.errToObj(e)})}ip(e){return this._addCheck({kind:`ip`,...N.errToObj(e)})}cidr(e){return this._addCheck({kind:`cidr`,...N.errToObj(e)})}datetime(e){return typeof e==`string`?this._addCheck({kind:`datetime`,precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:`datetime`,precision:e?.precision===void 0?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...N.errToObj(e?.message)})}date(e){return this._addCheck({kind:`date`,message:e})}time(e){return typeof e==`string`?this._addCheck({kind:`time`,precision:null,message:e}):this._addCheck({kind:`time`,precision:e?.precision===void 0?null:e?.precision,...N.errToObj(e?.message)})}duration(e){return this._addCheck({kind:`duration`,...N.errToObj(e)})}regex(e,t){return this._addCheck({kind:`regex`,regex:e,...N.errToObj(t)})}includes(e,t){return this._addCheck({kind:`includes`,value:e,position:t?.position,...N.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:`startsWith`,value:e,...N.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:`endsWith`,value:e,...N.errToObj(t)})}min(e,t){return this._addCheck({kind:`min`,value:e,...N.errToObj(t)})}max(e,t){return this._addCheck({kind:`max`,value:e,...N.errToObj(t)})}length(e,t){return this._addCheck({kind:`length`,value:e,...N.errToObj(t)})}nonempty(e){return this.min(1,N.errToObj(e))}trim(){return new e({...this._def,checks:[...this._def.checks,{kind:`trim`}]})}toLowerCase(){return new e({...this._def,checks:[...this._def.checks,{kind:`toLowerCase`}]})}toUpperCase(){return new e({...this._def,checks:[...this._def.checks,{kind:`toUpperCase`}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind===`datetime`)}get isDate(){return!!this._def.checks.find(e=>e.kind===`date`)}get isTime(){return!!this._def.checks.find(e=>e.kind===`time`)}get isDuration(){return!!this._def.checks.find(e=>e.kind===`duration`)}get isEmail(){return!!this._def.checks.find(e=>e.kind===`email`)}get isURL(){return!!this._def.checks.find(e=>e.kind===`url`)}get isEmoji(){return!!this._def.checks.find(e=>e.kind===`emoji`)}get isUUID(){return!!this._def.checks.find(e=>e.kind===`uuid`)}get isNANOID(){return!!this._def.checks.find(e=>e.kind===`nanoid`)}get isCUID(){return!!this._def.checks.find(e=>e.kind===`cuid`)}get isCUID2(){return!!this._def.checks.find(e=>e.kind===`cuid2`)}get isULID(){return!!this._def.checks.find(e=>e.kind===`ulid`)}get isIP(){return!!this._def.checks.find(e=>e.kind===`ip`)}get isCIDR(){return!!this._def.checks.find(e=>e.kind===`cidr`)}get isBase64(){return!!this._def.checks.find(e=>e.kind===`base64`)}get isBase64url(){return!!this._def.checks.find(e=>e.kind===`base64url`)}get minLength(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.value<e)&&(e=t.value);return e}};Te.create=e=>new Te({checks:[],typeName:z.ZodString,coerce:e?.coerce??!1,...L(e)});function Ee(e,t){let n=(e.toString().split(`.`)[1]||``).length,r=(t.toString().split(`.`)[1]||``).length,i=n>r?n:r;return parseInt(e.toFixed(i).replace(`.`,``))%parseInt(t.toFixed(i).replace(`.`,``))/10**i}var De=class e extends R{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)!==f.number){let t=this._getOrReturnCtx(e);return C(t,{code:m.invalid_type,expected:f.number,received:t.parsedType}),T}let t,n=new w;for(let r of this._def.checks)r.kind===`int`?u.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),C(t,{code:m.invalid_type,expected:`integer`,received:`float`,message:r.message}),n.dirty()):r.kind===`min`?(r.inclusive?e.data<r.value:e.data<=r.value)&&(t=this._getOrReturnCtx(e,t),C(t,{code:m.too_small,minimum:r.value,type:`number`,inclusive:r.inclusive,exact:!1,message:r.message}),n.dirty()):r.kind===`max`?(r.inclusive?e.data>r.value:e.data>=r.value)&&(t=this._getOrReturnCtx(e,t),C(t,{code:m.too_big,maximum:r.value,type:`number`,inclusive:r.inclusive,exact:!1,message:r.message}),n.dirty()):r.kind===`multipleOf`?Ee(e.data,r.value)!==0&&(t=this._getOrReturnCtx(e,t),C(t,{code:m.not_multiple_of,multipleOf:r.value,message:r.message}),n.dirty()):r.kind===`finite`?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),C(t,{code:m.not_finite,message:r.message}),n.dirty()):u.assertNever(r);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit(`min`,e,!0,N.toString(t))}gt(e,t){return this.setLimit(`min`,e,!1,N.toString(t))}lte(e,t){return this.setLimit(`max`,e,!0,N.toString(t))}lt(e,t){return this.setLimit(`max`,e,!1,N.toString(t))}setLimit(t,n,r,i){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:N.toString(i)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(e){return this._addCheck({kind:`int`,message:N.toString(e)})}positive(e){return this._addCheck({kind:`min`,value:0,inclusive:!1,message:N.toString(e)})}negative(e){return this._addCheck({kind:`max`,value:0,inclusive:!1,message:N.toString(e)})}nonpositive(e){return this._addCheck({kind:`max`,value:0,inclusive:!0,message:N.toString(e)})}nonnegative(e){return this._addCheck({kind:`min`,value:0,inclusive:!0,message:N.toString(e)})}multipleOf(e,t){return this._addCheck({kind:`multipleOf`,value:e,message:N.toString(t)})}finite(e){return this._addCheck({kind:`finite`,message:N.toString(e)})}safe(e){return this._addCheck({kind:`min`,inclusive:!0,value:-(2**53-1),message:N.toString(e)})._addCheck({kind:`max`,inclusive:!0,value:2**53-1,message:N.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind===`int`||e.kind===`multipleOf`&&u.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let n of this._def.checks)if(n.kind===`finite`||n.kind===`int`||n.kind===`multipleOf`)return!0;else n.kind===`min`?(t===null||n.value>t)&&(t=n.value):n.kind===`max`&&(e===null||n.value<e)&&(e=n.value);return Number.isFinite(t)&&Number.isFinite(e)}};De.create=e=>new De({checks:[],typeName:z.ZodNumber,coerce:e?.coerce||!1,...L(e)});var Oe=class e extends R{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)!==f.bigint)return this._getInvalidInput(e);let t,n=new w;for(let r of this._def.checks)r.kind===`min`?(r.inclusive?e.data<r.value:e.data<=r.value)&&(t=this._getOrReturnCtx(e,t),C(t,{code:m.too_small,type:`bigint`,minimum:r.value,inclusive:r.inclusive,message:r.message}),n.dirty()):r.kind===`max`?(r.inclusive?e.data>r.value:e.data>=r.value)&&(t=this._getOrReturnCtx(e,t),C(t,{code:m.too_big,type:`bigint`,maximum:r.value,inclusive:r.inclusive,message:r.message}),n.dirty()):r.kind===`multipleOf`?e.data%r.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),C(t,{code:m.not_multiple_of,multipleOf:r.value,message:r.message}),n.dirty()):u.assertNever(r);return{status:n.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return C(t,{code:m.invalid_type,expected:f.bigint,received:t.parsedType}),T}gte(e,t){return this.setLimit(`min`,e,!0,N.toString(t))}gt(e,t){return this.setLimit(`min`,e,!1,N.toString(t))}lte(e,t){return this.setLimit(`max`,e,!0,N.toString(t))}lt(e,t){return this.setLimit(`max`,e,!1,N.toString(t))}setLimit(t,n,r,i){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:N.toString(i)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}positive(e){return this._addCheck({kind:`min`,value:BigInt(0),inclusive:!1,message:N.toString(e)})}negative(e){return this._addCheck({kind:`max`,value:BigInt(0),inclusive:!1,message:N.toString(e)})}nonpositive(e){return this._addCheck({kind:`max`,value:BigInt(0),inclusive:!0,message:N.toString(e)})}nonnegative(e){return this._addCheck({kind:`min`,value:BigInt(0),inclusive:!0,message:N.toString(e)})}multipleOf(e,t){return this._addCheck({kind:`multipleOf`,value:e,message:N.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.value<e)&&(e=t.value);return e}};Oe.create=e=>new Oe({checks:[],typeName:z.ZodBigInt,coerce:e?.coerce??!1,...L(e)});var ke=class extends R{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==f.boolean){let t=this._getOrReturnCtx(e);return C(t,{code:m.invalid_type,expected:f.boolean,received:t.parsedType}),T}return D(e.data)}};ke.create=e=>new ke({typeName:z.ZodBoolean,coerce:e?.coerce||!1,...L(e)});var Ae=class e extends R{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==f.date){let t=this._getOrReturnCtx(e);return C(t,{code:m.invalid_type,expected:f.date,received:t.parsedType}),T}if(isNaN(e.data.getTime()))return C(this._getOrReturnCtx(e),{code:m.invalid_date}),T;let t=new w,n;for(let r of this._def.checks)r.kind===`min`?e.data.getTime()<r.value&&(n=this._getOrReturnCtx(e,n),C(n,{code:m.too_small,message:r.message,inclusive:!0,exact:!1,minimum:r.value,type:`date`}),t.dirty()):r.kind===`max`?e.data.getTime()>r.value&&(n=this._getOrReturnCtx(e,n),C(n,{code:m.too_big,message:r.message,inclusive:!0,exact:!1,maximum:r.value,type:`date`}),t.dirty()):u.assertNever(r);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}min(e,t){return this._addCheck({kind:`min`,value:e.getTime(),message:N.toString(t)})}max(e,t){return this._addCheck({kind:`max`,value:e.getTime(),message:N.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e==null?null:new Date(e)}get maxDate(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.value<e)&&(e=t.value);return e==null?null:new Date(e)}};Ae.create=e=>new Ae({checks:[],coerce:e?.coerce||!1,typeName:z.ZodDate,...L(e)});var je=class extends R{_parse(e){if(this._getType(e)!==f.symbol){let t=this._getOrReturnCtx(e);return C(t,{code:m.invalid_type,expected:f.symbol,received:t.parsedType}),T}return D(e.data)}};je.create=e=>new je({typeName:z.ZodSymbol,...L(e)});var Me=class extends R{_parse(e){if(this._getType(e)!==f.undefined){let t=this._getOrReturnCtx(e);return C(t,{code:m.invalid_type,expected:f.undefined,received:t.parsedType}),T}return D(e.data)}};Me.create=e=>new Me({typeName:z.ZodUndefined,...L(e)});var Ne=class extends R{_parse(e){if(this._getType(e)!==f.null){let t=this._getOrReturnCtx(e);return C(t,{code:m.invalid_type,expected:f.null,received:t.parsedType}),T}return D(e.data)}};Ne.create=e=>new Ne({typeName:z.ZodNull,...L(e)});var Pe=class extends R{constructor(){super(...arguments),this._any=!0}_parse(e){return D(e.data)}};Pe.create=e=>new Pe({typeName:z.ZodAny,...L(e)});var Fe=class extends R{constructor(){super(...arguments),this._unknown=!0}_parse(e){return D(e.data)}};Fe.create=e=>new Fe({typeName:z.ZodUnknown,...L(e)});var Ie=class extends R{_parse(e){let t=this._getOrReturnCtx(e);return C(t,{code:m.invalid_type,expected:f.never,received:t.parsedType}),T}};Ie.create=e=>new Ie({typeName:z.ZodNever,...L(e)});var Le=class extends R{_parse(e){if(this._getType(e)!==f.undefined){let t=this._getOrReturnCtx(e);return C(t,{code:m.invalid_type,expected:f.void,received:t.parsedType}),T}return D(e.data)}};Le.create=e=>new Le({typeName:z.ZodVoid,...L(e)});var Re=class e extends R{_parse(e){let{ctx:t,status:n}=this._processInputParams(e),r=this._def;if(t.parsedType!==f.array)return C(t,{code:m.invalid_type,expected:f.array,received:t.parsedType}),T;if(r.exactLength!==null){let e=t.data.length>r.exactLength.value,i=t.data.length<r.exactLength.value;(e||i)&&(C(t,{code:e?m.too_big:m.too_small,minimum:i?r.exactLength.value:void 0,maximum:e?r.exactLength.value:void 0,type:`array`,inclusive:!0,exact:!0,message:r.exactLength.message}),n.dirty())}if(r.minLength!==null&&t.data.length<r.minLength.value&&(C(t,{code:m.too_small,minimum:r.minLength.value,type:`array`,inclusive:!0,exact:!1,message:r.minLength.message}),n.dirty()),r.maxLength!==null&&t.data.length>r.maxLength.value&&(C(t,{code:m.too_big,maximum:r.maxLength.value,type:`array`,inclusive:!0,exact:!1,message:r.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map((e,n)=>r.type._parseAsync(new F(t,e,t.path,n)))).then(e=>w.mergeArray(n,e));let i=[...t.data].map((e,n)=>r.type._parseSync(new F(t,e,t.path,n)));return w.mergeArray(n,i)}get element(){return this._def.type}min(t,n){return new e({...this._def,minLength:{value:t,message:N.toString(n)}})}max(t,n){return new e({...this._def,maxLength:{value:t,message:N.toString(n)}})}length(t,n){return new e({...this._def,exactLength:{value:t,message:N.toString(n)}})}nonempty(e){return this.min(1,e)}};Re.create=(e,t)=>new Re({type:e,minLength:null,maxLength:null,exactLength:null,typeName:z.ZodArray,...L(t)});function ze(e){if(e instanceof Be){let t={};for(let n in e.shape){let r=e.shape[n];t[n]=it.create(ze(r))}return new Be({...e._def,shape:()=>t})}else if(e instanceof Re)return new Re({...e._def,type:ze(e.element)});else if(e instanceof it)return it.create(ze(e.unwrap()));else if(e instanceof at)return at.create(ze(e.unwrap()));else if(e instanceof Ke)return Ke.create(e.items.map(e=>ze(e)));else return e}var Be=class e extends R{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape();return this._cached={shape:e,keys:u.objectKeys(e)}}_parse(e){if(this._getType(e)!==f.object){let t=this._getOrReturnCtx(e);return C(t,{code:m.invalid_type,expected:f.object,received:t.parsedType}),T}let{status:t,ctx:n}=this._processInputParams(e),{shape:r,keys:i}=this._getCached(),a=[];if(!(this._def.catchall instanceof Ie&&this._def.unknownKeys===`strip`))for(let e in n.data)i.includes(e)||a.push(e);let o=[];for(let e of i){let t=r[e],i=n.data[e];o.push({key:{status:`valid`,value:e},value:t._parse(new F(n,i,n.path,e)),alwaysSet:e in n.data})}if(this._def.catchall instanceof Ie){let e=this._def.unknownKeys;if(e===`passthrough`)for(let e of a)o.push({key:{status:`valid`,value:e},value:{status:`valid`,value:n.data[e]}});else if(e===`strict`)a.length>0&&(C(n,{code:m.unrecognized_keys,keys:a}),t.dirty());else if(e!==`strip`)throw Error(`Internal ZodObject error: invalid unknownKeys value.`)}else{let e=this._def.catchall;for(let t of a){let r=n.data[t];o.push({key:{status:`valid`,value:t},value:e._parse(new F(n,r,n.path,t)),alwaysSet:t in n.data})}}return n.common.async?Promise.resolve().then(async()=>{let e=[];for(let t of o){let n=await t.key,r=await t.value;e.push({key:n,value:r,alwaysSet:t.alwaysSet})}return e}).then(e=>w.mergeObjectSync(t,e)):w.mergeObjectSync(t,o)}get shape(){return this._def.shape()}strict(t){return N.errToObj,new e({...this._def,unknownKeys:`strict`,...t===void 0?{}:{errorMap:(e,n)=>{var r;let i=(r=this._def).errorMap?.call(r,e,n).message??n.defaultError;return e.code===`unrecognized_keys`?{message:N.errToObj(t).message??i}:{message:i}}}})}strip(){return new e({...this._def,unknownKeys:`strip`})}passthrough(){return new e({...this._def,unknownKeys:`passthrough`})}extend(t){return new e({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new e({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:z.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(t){return new e({...this._def,catchall:t})}pick(t){let n={};return u.objectKeys(t).forEach(e=>{t[e]&&this.shape[e]&&(n[e]=this.shape[e])}),new e({...this._def,shape:()=>n})}omit(t){let n={};return u.objectKeys(this.shape).forEach(e=>{t[e]||(n[e]=this.shape[e])}),new e({...this._def,shape:()=>n})}deepPartial(){return ze(this)}partial(t){let n={};return u.objectKeys(this.shape).forEach(e=>{let r=this.shape[e];t&&!t[e]?n[e]=r:n[e]=r.optional()}),new e({...this._def,shape:()=>n})}required(t){let n={};return u.objectKeys(this.shape).forEach(e=>{if(t&&!t[e])n[e]=this.shape[e];else{let t=this.shape[e];for(;t instanceof it;)t=t._def.innerType;n[e]=t}}),new e({...this._def,shape:()=>n})}keyof(){return $e(u.objectKeys(this.shape))}};Be.create=(e,t)=>new Be({shape:()=>e,unknownKeys:`strip`,catchall:Ie.create(),typeName:z.ZodObject,...L(t)}),Be.strictCreate=(e,t)=>new Be({shape:()=>e,unknownKeys:`strict`,catchall:Ie.create(),typeName:z.ZodObject,...L(t)}),Be.lazycreate=(e,t)=>new Be({shape:e,unknownKeys:`strip`,catchall:Ie.create(),typeName:z.ZodObject,...L(t)});var Ve=class extends R{_parse(e){let{ctx:t}=this._processInputParams(e),n=this._def.options;function r(e){for(let t of e)if(t.result.status===`valid`)return t.result;for(let n of e)if(n.result.status===`dirty`)return t.common.issues.push(...n.ctx.common.issues),n.result;let n=e.map(e=>new g(e.ctx.common.issues));return C(t,{code:m.invalid_union,unionErrors:n}),T}if(t.common.async)return Promise.all(n.map(async e=>{let n={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:n}),ctx:n}})).then(r);{let e,r=[];for(let i of n){let n={...t,common:{...t.common,issues:[]},parent:null},a=i._parseSync({data:t.data,path:t.path,parent:n});if(a.status===`valid`)return a;a.status===`dirty`&&!e&&(e={result:a,ctx:n}),n.common.issues.length&&r.push(n.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;let i=r.map(e=>new g(e));return C(t,{code:m.invalid_union,unionErrors:i}),T}}get options(){return this._def.options}};Ve.create=(e,t)=>new Ve({options:e,typeName:z.ZodUnion,...L(t)});let He=e=>e instanceof Ze?He(e.schema):e instanceof rt?He(e.innerType()):e instanceof Qe?[e.value]:e instanceof et?e.options:e instanceof tt?u.objectValues(e.enum):e instanceof ot?He(e._def.innerType):e instanceof Me?[void 0]:e instanceof Ne?[null]:e instanceof it?[void 0,...He(e.unwrap())]:e instanceof at?[null,...He(e.unwrap())]:e instanceof ut||e instanceof ft?He(e.unwrap()):e instanceof st?He(e._def.innerType):[];var Ue=class e extends R{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==f.object)return C(t,{code:m.invalid_type,expected:f.object,received:t.parsedType}),T;let n=this.discriminator,r=t.data[n],i=this.optionsMap.get(r);return i?t.common.async?i._parseAsync({data:t.data,path:t.path,parent:t}):i._parseSync({data:t.data,path:t.path,parent:t}):(C(t,{code:m.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),T)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,n,r){let i=new Map;for(let e of n){let n=He(e.shape[t]);if(!n.length)throw Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(let r of n){if(i.has(r))throw Error(`Discriminator property ${String(t)} has duplicate value ${String(r)}`);i.set(r,e)}}return new e({typeName:z.ZodDiscriminatedUnion,discriminator:t,options:n,optionsMap:i,...L(r)})}};function We(e,t){let n=p(e),r=p(t);if(e===t)return{valid:!0,data:e};if(n===f.object&&r===f.object){let n=u.objectKeys(t),r=u.objectKeys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};for(let n of r){let r=We(e[n],t[n]);if(!r.valid)return{valid:!1};i[n]=r.data}return{valid:!0,data:i}}else if(n===f.array&&r===f.array){if(e.length!==t.length)return{valid:!1};let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t[r],o=We(i,a);if(!o.valid)return{valid:!1};n.push(o.data)}return{valid:!0,data:n}}else if(n===f.date&&r===f.date&&+e==+t)return{valid:!0,data:e};else return{valid:!1}}var Ge=class extends R{_parse(e){let{status:t,ctx:n}=this._processInputParams(e),r=(e,r)=>{if(O(e)||O(r))return T;let i=We(e.value,r.value);return i.valid?((k(e)||k(r))&&t.dirty(),{status:t.value,value:i.data}):(C(n,{code:m.invalid_intersection_types}),T)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([e,t])=>r(e,t)):r(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};Ge.create=(e,t,n)=>new Ge({left:e,right:t,typeName:z.ZodIntersection,...L(n)});var Ke=class e extends R{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==f.array)return C(n,{code:m.invalid_type,expected:f.array,received:n.parsedType}),T;if(n.data.length<this._def.items.length)return C(n,{code:m.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:`array`}),T;!this._def.rest&&n.data.length>this._def.items.length&&(C(n,{code:m.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:`array`}),t.dirty());let r=[...n.data].map((e,t)=>{let r=this._def.items[t]||this._def.rest;return r?r._parse(new F(n,e,n.path,t)):null}).filter(e=>!!e);return n.common.async?Promise.all(r).then(e=>w.mergeArray(t,e)):w.mergeArray(t,r)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};Ke.create=(e,t)=>{if(!Array.isArray(e))throw Error(`You must pass an array of schemas to z.tuple([ ... ])`);return new Ke({items:e,typeName:z.ZodTuple,rest:null,...L(t)})};var qe=class e extends R{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==f.object)return C(n,{code:m.invalid_type,expected:f.object,received:n.parsedType}),T;let r=[],i=this._def.keyType,a=this._def.valueType;for(let e in n.data)r.push({key:i._parse(new F(n,e,n.path,e)),value:a._parse(new F(n,n.data[e],n.path,e)),alwaysSet:e in n.data});return n.common.async?w.mergeObjectAsync(t,r):w.mergeObjectSync(t,r)}get element(){return this._def.valueType}static create(t,n,r){return n instanceof R?new e({keyType:t,valueType:n,typeName:z.ZodRecord,...L(r)}):new e({keyType:Te.create(),valueType:t,typeName:z.ZodRecord,...L(n)})}},Je=class extends R{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==f.map)return C(n,{code:m.invalid_type,expected:f.map,received:n.parsedType}),T;let r=this._def.keyType,i=this._def.valueType,a=[...n.data.entries()].map(([e,t],a)=>({key:r._parse(new F(n,e,n.path,[a,`key`])),value:i._parse(new F(n,t,n.path,[a,`value`]))}));if(n.common.async){let e=new Map;return Promise.resolve().then(async()=>{for(let n of a){let r=await n.key,i=await n.value;if(r.status===`aborted`||i.status===`aborted`)return T;(r.status===`dirty`||i.status===`dirty`)&&t.dirty(),e.set(r.value,i.value)}return{status:t.value,value:e}})}else{let e=new Map;for(let n of a){let r=n.key,i=n.value;if(r.status===`aborted`||i.status===`aborted`)return T;(r.status===`dirty`||i.status===`dirty`)&&t.dirty(),e.set(r.value,i.value)}return{status:t.value,value:e}}}};Je.create=(e,t,n)=>new Je({valueType:t,keyType:e,typeName:z.ZodMap,...L(n)});var Ye=class e extends R{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==f.set)return C(n,{code:m.invalid_type,expected:f.set,received:n.parsedType}),T;let r=this._def;r.minSize!==null&&n.data.size<r.minSize.value&&(C(n,{code:m.too_small,minimum:r.minSize.value,type:`set`,inclusive:!0,exact:!1,message:r.minSize.message}),t.dirty()),r.maxSize!==null&&n.data.size>r.maxSize.value&&(C(n,{code:m.too_big,maximum:r.maxSize.value,type:`set`,inclusive:!0,exact:!1,message:r.maxSize.message}),t.dirty());let i=this._def.valueType;function a(e){let n=new Set;for(let r of e){if(r.status===`aborted`)return T;r.status===`dirty`&&t.dirty(),n.add(r.value)}return{status:t.value,value:n}}let o=[...n.data.values()].map((e,t)=>i._parse(new F(n,e,n.path,t)));return n.common.async?Promise.all(o).then(e=>a(e)):a(o)}min(t,n){return new e({...this._def,minSize:{value:t,message:N.toString(n)}})}max(t,n){return new e({...this._def,maxSize:{value:t,message:N.toString(n)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};Ye.create=(e,t)=>new Ye({valueType:e,minSize:null,maxSize:null,typeName:z.ZodSet,...L(t)});var Xe=class e extends R{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==f.function)return C(t,{code:m.invalid_type,expected:f.function,received:t.parsedType}),T;function n(e,n){return x({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,b(),_].filter(e=>!!e),issueData:{code:m.invalid_arguments,argumentsError:n}})}function r(e,n){return x({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,b(),_].filter(e=>!!e),issueData:{code:m.invalid_return_type,returnTypeError:n}})}let i={errorMap:t.common.contextualErrorMap},a=t.data;if(this._def.returns instanceof nt){let e=this;return D(async function(...t){let o=new g([]),s=await e._def.args.parseAsync(t,i).catch(e=>{throw o.addIssue(n(t,e)),o}),c=await Reflect.apply(a,this,s);return await e._def.returns._def.type.parseAsync(c,i).catch(e=>{throw o.addIssue(r(c,e)),o})})}else{let e=this;return D(function(...t){let o=e._def.args.safeParse(t,i);if(!o.success)throw new g([n(t,o.error)]);let s=Reflect.apply(a,this,o.data),c=e._def.returns.safeParse(s,i);if(!c.success)throw new g([r(s,c.error)]);return c.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e({...this._def,args:Ke.create(t).rest(Fe.create())})}returns(t){return new e({...this._def,returns:t})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(t,n,r){return new e({args:t||Ke.create([]).rest(Fe.create()),returns:n||Fe.create(),typeName:z.ZodFunction,...L(r)})}},Ze=class extends R{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}};Ze.create=(e,t)=>new Ze({getter:e,typeName:z.ZodLazy,...L(t)});var Qe=class extends R{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return C(t,{received:t.data,code:m.invalid_literal,expected:this._def.value}),T}return{status:`valid`,value:e.data}}get value(){return this._def.value}};Qe.create=(e,t)=>new Qe({value:e,typeName:z.ZodLiteral,...L(t)});function $e(e,t){return new et({values:e,typeName:z.ZodEnum,...L(t)})}var et=class e extends R{constructor(){super(...arguments),P.set(this,void 0)}_parse(e){if(typeof e.data!=`string`){let t=this._getOrReturnCtx(e),n=this._def.values;return C(t,{expected:u.joinValues(n),received:t.parsedType,code:m.invalid_type}),T}if(j(this,P,`f`)||M(this,P,new Set(this._def.values),`f`),!j(this,P,`f`).has(e.data)){let t=this._getOrReturnCtx(e),n=this._def.values;return C(t,{received:t.data,code:m.invalid_enum_value,options:n}),T}return D(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}extract(t,n=this._def){return e.create(t,{...this._def,...n})}exclude(t,n=this._def){return e.create(this.options.filter(e=>!t.includes(e)),{...this._def,...n})}};P=new WeakMap,et.create=$e;var tt=class extends R{constructor(){super(...arguments),te.set(this,void 0)}_parse(e){let t=u.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==f.string&&n.parsedType!==f.number){let e=u.objectValues(t);return C(n,{expected:u.joinValues(e),received:n.parsedType,code:m.invalid_type}),T}if(j(this,te,`f`)||M(this,te,new Set(u.getValidEnumValues(this._def.values)),`f`),!j(this,te,`f`).has(e.data)){let e=u.objectValues(t);return C(n,{received:n.data,code:m.invalid_enum_value,options:e}),T}return D(e.data)}get enum(){return this._def.values}};te=new WeakMap,tt.create=(e,t)=>new tt({values:e,typeName:z.ZodNativeEnum,...L(t)});var nt=class extends R{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);return t.parsedType!==f.promise&&t.common.async===!1?(C(t,{code:m.invalid_type,expected:f.promise,received:t.parsedType}),T):D((t.parsedType===f.promise?t.data:Promise.resolve(t.data)).then(e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap})))}};nt.create=(e,t)=>new nt({type:e,typeName:z.ZodPromise,...L(t)});var rt=class extends R{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===z.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:n}=this._processInputParams(e),r=this._def.effect||null,i={addIssue:e=>{C(n,e),e.fatal?t.abort():t.dirty()},get path(){return n.path}};if(i.addIssue=i.addIssue.bind(i),r.type===`preprocess`){let e=r.transform(n.data,i);if(n.common.async)return Promise.resolve(e).then(async e=>{if(t.value===`aborted`)return T;let r=await this._def.schema._parseAsync({data:e,path:n.path,parent:n});return r.status===`aborted`?T:r.status===`dirty`||t.value===`dirty`?E(r.value):r});{if(t.value===`aborted`)return T;let r=this._def.schema._parseSync({data:e,path:n.path,parent:n});return r.status===`aborted`?T:r.status===`dirty`||t.value===`dirty`?E(r.value):r}}if(r.type===`refinement`){let e=e=>{let t=r.refinement(e,i);if(n.common.async)return Promise.resolve(t);if(t instanceof Promise)throw Error(`Async refinement encountered during synchronous parse operation. Use .parseAsync instead.`);return e};if(n.common.async===!1){let r=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return r.status===`aborted`?T:(r.status===`dirty`&&t.dirty(),e(r.value),{status:t.value,value:r.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(n=>n.status===`aborted`?T:(n.status===`dirty`&&t.dirty(),e(n.value).then(()=>({status:t.value,value:n.value}))))}if(r.type===`transform`)if(n.common.async===!1){let e=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!A(e))return e;let a=r.transform(e.value,i);if(a instanceof Promise)throw Error(`Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.`);return{status:t.value,value:a}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(e=>A(e)?Promise.resolve(r.transform(e.value,i)).then(e=>({status:t.value,value:e})):e);u.assertNever(r)}};rt.create=(e,t,n)=>new rt({schema:e,typeName:z.ZodEffects,effect:t,...L(n)}),rt.createWithPreprocess=(e,t,n)=>new rt({schema:t,effect:{type:`preprocess`,transform:e},typeName:z.ZodEffects,...L(n)});var it=class extends R{_parse(e){return this._getType(e)===f.undefined?D(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};it.create=(e,t)=>new it({innerType:e,typeName:z.ZodOptional,...L(t)});var at=class extends R{_parse(e){return this._getType(e)===f.null?D(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};at.create=(e,t)=>new at({innerType:e,typeName:z.ZodNullable,...L(t)});var ot=class extends R{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return t.parsedType===f.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};ot.create=(e,t)=>new ot({innerType:e,typeName:z.ZodDefault,defaultValue:typeof t.default==`function`?t.default:()=>t.default,...L(t)});var st=class extends R{_parse(e){let{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},r=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return ee(r)?r.then(e=>({status:`valid`,value:e.status===`valid`?e.value:this._def.catchValue({get error(){return new g(n.common.issues)},input:n.data})})):{status:`valid`,value:r.status===`valid`?r.value:this._def.catchValue({get error(){return new g(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};st.create=(e,t)=>new st({innerType:e,typeName:z.ZodCatch,catchValue:typeof t.catch==`function`?t.catch:()=>t.catch,...L(t)});var ct=class extends R{_parse(e){if(this._getType(e)!==f.nan){let t=this._getOrReturnCtx(e);return C(t,{code:m.invalid_type,expected:f.nan,received:t.parsedType}),T}return{status:`valid`,value:e.data}}};ct.create=e=>new ct({typeName:z.ZodNaN,...L(e)});let lt=Symbol(`zod_brand`);var ut=class extends R{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}},dt=class e extends R{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{let e=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return e.status===`aborted`?T:e.status===`dirty`?(t.dirty(),E(e.value)):this._def.out._parseAsync({data:e.value,path:n.path,parent:n})})();{let e=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return e.status===`aborted`?T:e.status===`dirty`?(t.dirty(),{status:`dirty`,value:e.value}):this._def.out._parseSync({data:e.value,path:n.path,parent:n})}}static create(t,n){return new e({in:t,out:n,typeName:z.ZodPipeline})}},ft=class extends R{_parse(e){let t=this._def.innerType._parse(e),n=e=>(A(e)&&(e.value=Object.freeze(e.value)),e);return ee(t)?t.then(e=>n(e)):n(t)}unwrap(){return this._def.innerType}};ft.create=(e,t)=>new ft({innerType:e,typeName:z.ZodReadonly,...L(t)});function pt(e,t={},n){return e?Pe.create().superRefine((r,i)=>{if(!e(r)){let e=typeof t==`function`?t(r):typeof t==`string`?{message:t}:t,a=e.fatal??n??!0,o=typeof e==`string`?{message:e}:e;i.addIssue({code:`custom`,...o,fatal:a})}}):Pe.create()}let mt={object:Be.lazycreate};var z;(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`})(z||={});let ht=(e,t={message:`Input not instance of ${e.name}`})=>pt(t=>t instanceof e,t),gt=Te.create,_t=De.create,vt=ct.create,yt=Oe.create,bt=ke.create,xt=Ae.create,St=je.create,Ct=Me.create,wt=Ne.create,Tt=Pe.create,Et=Fe.create,Dt=Ie.create,Ot=Le.create,kt=Re.create,At=Be.create,jt=Be.strictCreate,Mt=Ve.create,Nt=Ue.create,Pt=Ge.create,Ft=Ke.create,It=qe.create,Lt=Je.create,Rt=Ye.create,zt=Xe.create,Bt=Ze.create,Vt=Qe.create,Ht=et.create,Ut=tt.create,Wt=nt.create,Gt=rt.create,Kt=it.create,qt=at.create,Jt=rt.createWithPreprocess,Yt=dt.create,Xt=()=>gt().optional(),Zt=()=>_t().optional(),Qt=()=>bt().optional(),$t={string:(e=>Te.create({...e,coerce:!0})),number:(e=>De.create({...e,coerce:!0})),boolean:(e=>ke.create({...e,coerce:!0})),bigint:(e=>Oe.create({...e,coerce:!0})),date:(e=>Ae.create({...e,coerce:!0}))},en=T;var B=Object.freeze({__proto__:null,defaultErrorMap:_,setErrorMap:y,getErrorMap:b,makeIssue:x,EMPTY_PATH:S,addIssueToContext:C,ParseStatus:w,INVALID:T,DIRTY:E,OK:D,isAborted:O,isDirty:k,isValid:A,isAsync:ee,get util(){return u},get objectUtil(){return d},ZodParsedType:f,getParsedType:p,ZodType:R,datetimeRegex:xe,ZodString:Te,ZodNumber:De,ZodBigInt:Oe,ZodBoolean:ke,ZodDate:Ae,ZodSymbol:je,ZodUndefined:Me,ZodNull:Ne,ZodAny:Pe,ZodUnknown:Fe,ZodNever:Ie,ZodVoid:Le,ZodArray:Re,ZodObject:Be,ZodUnion:Ve,ZodDiscriminatedUnion:Ue,ZodIntersection:Ge,ZodTuple:Ke,ZodRecord:qe,ZodMap:Je,ZodSet:Ye,ZodFunction:Xe,ZodLazy:Ze,ZodLiteral:Qe,ZodEnum:et,ZodNativeEnum:tt,ZodPromise:nt,ZodEffects:rt,ZodTransformer:rt,ZodOptional:it,ZodNullable:at,ZodDefault:ot,ZodCatch:st,ZodNaN:ct,BRAND:lt,ZodBranded:ut,ZodPipeline:dt,ZodReadonly:ft,custom:pt,Schema:R,ZodSchema:R,late:mt,get ZodFirstPartyTypeKind(){return z},coerce:$t,any:Tt,array:kt,bigint:yt,boolean:bt,date:xt,discriminatedUnion:Nt,effect:Gt,enum:Ht,function:zt,instanceof:ht,intersection:Pt,lazy:Bt,literal:Vt,map:Lt,nan:vt,nativeEnum:Ut,never:Dt,null:wt,nullable:qt,number:_t,object:At,oboolean:Qt,onumber:Zt,optional:Kt,ostring:Xt,pipeline:Yt,preprocess:Jt,promise:Wt,record:It,set:Rt,strictObject:jt,string:gt,symbol:St,transformer:Gt,tuple:Ft,undefined:Ct,union:Mt,unknown:Et,void:Ot,NEVER:en,ZodIssueCode:m,quotelessJson:h,ZodError:g});let tn=B.union([B.string(),B.number().int()]),nn=B.string(),rn=B.object({progressToken:B.optional(tn)}).passthrough(),an=B.object({_meta:B.optional(rn)}).passthrough(),on=B.object({method:B.string(),params:B.optional(an)}),sn=B.object({_meta:B.optional(B.object({}).passthrough())}).passthrough(),cn=B.object({method:B.string(),params:B.optional(sn)}),ln=B.object({_meta:B.optional(B.object({}).passthrough())}).passthrough(),un=B.union([B.string(),B.number().int()]),dn=B.object({jsonrpc:B.literal(`2.0`),id:un}).merge(on).strict(),fn=B.object({jsonrpc:B.literal(`2.0`)}).merge(cn).strict(),pn=B.object({jsonrpc:B.literal(`2.0`),id:un,result:ln}).strict();var mn;(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`})(mn||={});let hn=B.object({jsonrpc:B.literal(`2.0`),id:un,error:B.object({code:B.number().int(),message:B.string(),data:B.optional(B.unknown())})}).strict(),gn=B.union([dn,fn,pn,hn]),_n=ln.strict(),vn=cn.extend({method:B.literal(`notifications/cancelled`),params:sn.extend({requestId:un,reason:B.string().optional()})}),yn=B.object({name:B.string(),title:B.optional(B.string())}).passthrough(),bn=yn.extend({version:B.string()}),xn=B.object({experimental:B.optional(B.object({}).passthrough()),sampling:B.optional(B.object({}).passthrough()),elicitation:B.optional(B.object({}).passthrough()),roots:B.optional(B.object({listChanged:B.optional(B.boolean())}).passthrough())}).passthrough(),Sn=on.extend({method:B.literal(`initialize`),params:an.extend({protocolVersion:B.string(),capabilities:xn,clientInfo:bn})}),Cn=B.object({experimental:B.optional(B.object({}).passthrough()),logging:B.optional(B.object({}).passthrough()),completions:B.optional(B.object({}).passthrough()),prompts:B.optional(B.object({listChanged:B.optional(B.boolean())}).passthrough()),resources:B.optional(B.object({subscribe:B.optional(B.boolean()),listChanged:B.optional(B.boolean())}).passthrough()),tools:B.optional(B.object({listChanged:B.optional(B.boolean())}).passthrough())}).passthrough(),wn=ln.extend({protocolVersion:B.string(),capabilities:Cn,serverInfo:bn,instructions:B.optional(B.string())}),Tn=cn.extend({method:B.literal(`notifications/initialized`)}),En=on.extend({method:B.literal(`ping`)}),Dn=B.object({progress:B.number(),total:B.optional(B.number()),message:B.optional(B.string())}).passthrough(),On=cn.extend({method:B.literal(`notifications/progress`),params:sn.merge(Dn).extend({progressToken:tn})}),kn=on.extend({params:an.extend({cursor:B.optional(nn)}).optional()}),An=ln.extend({nextCursor:B.optional(nn)}),jn=B.object({uri:B.string(),mimeType:B.optional(B.string()),_meta:B.optional(B.object({}).passthrough())}).passthrough(),Mn=jn.extend({text:B.string()}),Nn=B.string().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:`Invalid Base64 string`}),Pn=jn.extend({blob:Nn}),Fn=yn.extend({uri:B.string(),description:B.optional(B.string()),mimeType:B.optional(B.string()),_meta:B.optional(B.object({}).passthrough())}),In=yn.extend({uriTemplate:B.string(),description:B.optional(B.string()),mimeType:B.optional(B.string()),_meta:B.optional(B.object({}).passthrough())}),Ln=kn.extend({method:B.literal(`resources/list`)}),Rn=An.extend({resources:B.array(Fn)}),zn=kn.extend({method:B.literal(`resources/templates/list`)}),Bn=An.extend({resourceTemplates:B.array(In)}),Vn=on.extend({method:B.literal(`resources/read`),params:an.extend({uri:B.string()})}),Hn=ln.extend({contents:B.array(B.union([Mn,Pn]))}),Un=cn.extend({method:B.literal(`notifications/resources/list_changed`)}),Wn=on.extend({method:B.literal(`resources/subscribe`),params:an.extend({uri:B.string()})}),Gn=on.extend({method:B.literal(`resources/unsubscribe`),params:an.extend({uri:B.string()})}),Kn=cn.extend({method:B.literal(`notifications/resources/updated`),params:sn.extend({uri:B.string()})}),qn=B.object({name:B.string(),description:B.optional(B.string()),required:B.optional(B.boolean())}).passthrough(),Jn=yn.extend({description:B.optional(B.string()),arguments:B.optional(B.array(qn)),_meta:B.optional(B.object({}).passthrough())}),Yn=kn.extend({method:B.literal(`prompts/list`)}),Xn=An.extend({prompts:B.array(Jn)}),Zn=on.extend({method:B.literal(`prompts/get`),params:an.extend({name:B.string(),arguments:B.optional(B.record(B.string()))})}),Qn=B.object({type:B.literal(`text`),text:B.string(),_meta:B.optional(B.object({}).passthrough())}).passthrough(),$n=B.object({type:B.literal(`image`),data:Nn,mimeType:B.string(),_meta:B.optional(B.object({}).passthrough())}).passthrough(),er=B.object({type:B.literal(`audio`),data:Nn,mimeType:B.string(),_meta:B.optional(B.object({}).passthrough())}).passthrough(),tr=B.object({type:B.literal(`resource`),resource:B.union([Mn,Pn]),_meta:B.optional(B.object({}).passthrough())}).passthrough(),nr=Fn.extend({type:B.literal(`resource_link`)}),rr=B.union([Qn,$n,er,nr,tr]),ir=B.object({role:B.enum([`user`,`assistant`]),content:rr}).passthrough(),ar=ln.extend({description:B.optional(B.string()),messages:B.array(ir)}),or=cn.extend({method:B.literal(`notifications/prompts/list_changed`)}),sr=B.object({title:B.optional(B.string()),readOnlyHint:B.optional(B.boolean()),destructiveHint:B.optional(B.boolean()),idempotentHint:B.optional(B.boolean()),openWorldHint:B.optional(B.boolean())}).passthrough(),cr=yn.extend({description:B.optional(B.string()),inputSchema:B.object({type:B.literal(`object`),properties:B.optional(B.object({}).passthrough()),required:B.optional(B.array(B.string()))}).passthrough(),outputSchema:B.optional(B.object({type:B.literal(`object`),properties:B.optional(B.object({}).passthrough()),required:B.optional(B.array(B.string()))}).passthrough()),annotations:B.optional(sr),_meta:B.optional(B.object({}).passthrough())}),lr=kn.extend({method:B.literal(`tools/list`)}),ur=An.extend({tools:B.array(cr)}),dr=ln.extend({content:B.array(rr).default([]),structuredContent:B.object({}).passthrough().optional(),isError:B.optional(B.boolean())});dr.or(ln.extend({toolResult:B.unknown()}));let fr=on.extend({method:B.literal(`tools/call`),params:an.extend({name:B.string(),arguments:B.optional(B.record(B.unknown()))})}),pr=cn.extend({method:B.literal(`notifications/tools/list_changed`)}),mr=B.enum([`debug`,`info`,`notice`,`warning`,`error`,`critical`,`alert`,`emergency`]),hr=on.extend({method:B.literal(`logging/setLevel`),params:an.extend({level:mr})}),gr=cn.extend({method:B.literal(`notifications/message`),params:sn.extend({level:mr,logger:B.optional(B.string()),data:B.unknown()})}),_r=B.object({name:B.string().optional()}).passthrough(),vr=B.object({hints:B.optional(B.array(_r)),costPriority:B.optional(B.number().min(0).max(1)),speedPriority:B.optional(B.number().min(0).max(1)),intelligencePriority:B.optional(B.number().min(0).max(1))}).passthrough(),yr=B.object({role:B.enum([`user`,`assistant`]),content:B.union([Qn,$n,er])}).passthrough(),br=on.extend({method:B.literal(`sampling/createMessage`),params:an.extend({messages:B.array(yr),systemPrompt:B.optional(B.string()),includeContext:B.optional(B.enum([`none`,`thisServer`,`allServers`])),temperature:B.optional(B.number()),maxTokens:B.number().int(),stopSequences:B.optional(B.array(B.string())),metadata:B.optional(B.object({}).passthrough()),modelPreferences:B.optional(vr)})}),xr=ln.extend({model:B.string(),stopReason:B.optional(B.enum([`endTurn`,`stopSequence`,`maxTokens`]).or(B.string())),role:B.enum([`user`,`assistant`]),content:B.discriminatedUnion(`type`,[Qn,$n,er])}),Sr=B.object({type:B.literal(`boolean`),title:B.optional(B.string()),description:B.optional(B.string()),default:B.optional(B.boolean())}).passthrough(),Cr=B.object({type:B.literal(`string`),title:B.optional(B.string()),description:B.optional(B.string()),minLength:B.optional(B.number()),maxLength:B.optional(B.number()),format:B.optional(B.enum([`email`,`uri`,`date`,`date-time`]))}).passthrough(),wr=B.object({type:B.enum([`number`,`integer`]),title:B.optional(B.string()),description:B.optional(B.string()),minimum:B.optional(B.number()),maximum:B.optional(B.number())}).passthrough(),Tr=B.object({type:B.literal(`string`),title:B.optional(B.string()),description:B.optional(B.string()),enum:B.array(B.string()),enumNames:B.optional(B.array(B.string()))}).passthrough(),Er=B.union([Sr,Cr,wr,Tr]),Dr=on.extend({method:B.literal(`elicitation/create`),params:an.extend({message:B.string(),requestedSchema:B.object({type:B.literal(`object`),properties:B.record(B.string(),Er),required:B.optional(B.array(B.string()))}).passthrough()})}),Or=ln.extend({action:B.enum([`accept`,`decline`,`cancel`]),content:B.optional(B.record(B.string(),B.unknown()))}),kr=B.object({type:B.literal(`ref/resource`),uri:B.string()}).passthrough(),Ar=B.object({type:B.literal(`ref/prompt`),name:B.string()}).passthrough(),jr=on.extend({method:B.literal(`completion/complete`),params:an.extend({ref:B.union([Ar,kr]),argument:B.object({name:B.string(),value:B.string()}).passthrough(),context:B.optional(B.object({arguments:B.optional(B.record(B.string(),B.string()))}))})}),Mr=ln.extend({completion:B.object({values:B.array(B.string()).max(100),total:B.optional(B.number().int()),hasMore:B.optional(B.boolean())}).passthrough()}),Nr=B.object({uri:B.string().startsWith(`file://`),name:B.optional(B.string()),_meta:B.optional(B.object({}).passthrough())}).passthrough(),Pr=on.extend({method:B.literal(`roots/list`)}),Fr=ln.extend({roots:B.array(Nr)}),Ir=cn.extend({method:B.literal(`notifications/roots/list_changed`)});B.union([En,Sn,jr,hr,Zn,Yn,Ln,zn,Vn,Wn,Gn,fr,lr]),B.union([vn,On,Tn,Ir]),B.union([_n,xr,Or,Fr]),B.union([En,br,Dr,Pr]),B.union([vn,On,gr,Kn,Un,pr,or]),B.union([_n,wn,Mr,ar,Xn,Rn,Bn,Hn,dr,ur]),function(e){return e.START=`start`,e.STARTED=`started`,e.STOP=`stop`,e.STOPPED=`stopped`,e.PING=`ping`,e.PONG=`pong`,e.ERROR=`error`,e.LIST_TOOLS=`list_tools`,e.CALL_TOOL=`call_tool`,e.TOOL_LIST_UPDATED=`tool_list_updated`,e.TOOL_LIST_UPDATED_ACK=`tool_list_updated_ack`,e.PROCESS_DATA=`process_data`,e.SERVER_STARTED=`server_started`,e.SERVER_STOPPED=`server_stopped`,e.ERROR_FROM_NATIVE_HOST=`error_from_native_host`,e.CONNECT_NATIVE=`connectNative`,e.PING_NATIVE=`ping_native`,e.DISCONNECT_NATIVE=`disconnect_native`,e}({}),{NAME:`com.chromemcp.nativehost`,DEFAULT_PORT:12306}.NAME;var Lr=class{_started=!1;_allowedOrigins;_channelId;_messageHandler;_clientOrigin;onclose;onerror;onmessage;constructor(e){if(!e.allowedOrigins||e.allowedOrigins.length===0)throw Error(`At least one allowed origin must be specified`);this._allowedOrigins=e.allowedOrigins,this._channelId=e.channelId||`mcp-default`}async start(){if(this._started)throw Error(`Transport already started`);this._messageHandler=e=>{if(!this._allowedOrigins.includes(e.origin)&&!this._allowedOrigins.includes(`*`)||e.data?.channel!==this._channelId||e.data?.type!==`mcp`||e.data?.direction!==`client-to-server`)return;this._clientOrigin=e.origin;let t=e.data.payload;if(typeof t==`string`&&t===`mcp-check-ready`){window.postMessage({channel:this._channelId,type:`mcp`,direction:`server-to-client`,payload:`mcp-server-ready`},this._clientOrigin);return}try{let e=gn.parse(t);this.onmessage?.(e)}catch(e){this.onerror?.(Error(`Invalid message: ${e instanceof Error?e.message:String(e)}`))}},window.addEventListener(`message`,this._messageHandler),this._started=!0,window.postMessage({channel:this._channelId,type:`mcp`,direction:`server-to-client`,payload:`mcp-server-ready`},`*`)}async send(e){if(!this._started)throw Error(`Transport not started`);if(!this._clientOrigin)throw Error(`No client connected`);window.postMessage({channel:this._channelId,type:`mcp`,direction:`server-to-client`,payload:e},this._clientOrigin)}async close(){this._messageHandler&&window.removeEventListener(`message`,this._messageHandler),this._started=!1,window.postMessage({channel:this._channelId,type:`mcp`,direction:`server-to-client`,payload:`mcp-server-stopped`},`*`),this.onclose?.()}},V;(function(e){e.assertEqual=e=>{};function t(e){}e.assertIs=t;function n(e){throw Error()}e.assertNever=n,e.arrayToEnum=e=>{let t={};for(let n of e)t[n]=n;return t},e.getValidEnumValues=t=>{let n=e.objectKeys(t).filter(e=>typeof t[t[e]]!=`number`),r={};for(let e of n)r[e]=t[e];return e.objectValues(r)},e.objectValues=t=>e.objectKeys(t).map(function(e){return t[e]}),e.objectKeys=typeof Object.keys==`function`?e=>Object.keys(e):e=>{let t=[];for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.push(n);return t},e.find=(e,t)=>{for(let n of e)if(t(n))return n},e.isInteger=typeof Number.isInteger==`function`?e=>Number.isInteger(e):e=>typeof e==`number`&&Number.isFinite(e)&&Math.floor(e)===e;function r(e,t=` | `){return e.map(e=>typeof e==`string`?`'${e}'`:e).join(t)}e.joinValues=r,e.jsonStringifyReplacer=(e,t)=>typeof t==`bigint`?t.toString():t})(V||={});var Rr;(function(e){e.mergeShapes=(e,t)=>({...e,...t})})(Rr||={});let H=V.arrayToEnum([`string`,`nan`,`number`,`integer`,`float`,`boolean`,`date`,`bigint`,`symbol`,`function`,`undefined`,`null`,`array`,`object`,`unknown`,`promise`,`void`,`never`,`map`,`set`]),zr=e=>{switch(typeof e){case`undefined`:return H.undefined;case`string`:return H.string;case`number`:return Number.isNaN(e)?H.nan:H.number;case`boolean`:return H.boolean;case`function`:return H.function;case`bigint`:return H.bigint;case`symbol`:return H.symbol;case`object`:return Array.isArray(e)?H.array:e===null?H.null:e.then&&typeof e.then==`function`&&e.catch&&typeof e.catch==`function`?H.promise:typeof Map<`u`&&e instanceof Map?H.map:typeof Set<`u`&&e instanceof Set?H.set:typeof Date<`u`&&e instanceof Date?H.date:H.object;default:return H.unknown}},U=V.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`]);var Br=class e 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]};let t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name=`ZodError`,this.issues=e}format(e){let t=e||function(e){return e.message},n={_errors:[]},r=e=>{for(let i of e.issues)if(i.code===`invalid_union`)i.unionErrors.map(r);else if(i.code===`invalid_return_type`)r(i.returnTypeError);else if(i.code===`invalid_arguments`)r(i.argumentsError);else if(i.path.length===0)n._errors.push(t(i));else{let e=n,r=0;for(;r<i.path.length;){let n=i.path[r];r===i.path.length-1?(e[n]=e[n]||{_errors:[]},e[n]._errors.push(t(i))):e[n]=e[n]||{_errors:[]},e=e[n],r++}}};return r(this),n}static assert(t){if(!(t instanceof e))throw Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,V.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=e=>e.message){let t={},n=[];for(let r of this.issues)if(r.path.length>0){let n=r.path[0];t[n]=t[n]||[],t[n].push(e(r))}else n.push(e(r));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}};Br.create=e=>new Br(e);var Vr=(e,t)=>{let n;switch(e.code){case U.invalid_type:n=e.received===H.undefined?`Required`:`Expected ${e.expected}, received ${e.received}`;break;case U.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,V.jsonStringifyReplacer)}`;break;case U.unrecognized_keys:n=`Unrecognized key(s) in object: ${V.joinValues(e.keys,`, `)}`;break;case U.invalid_union:n=`Invalid input`;break;case U.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${V.joinValues(e.options)}`;break;case U.invalid_enum_value:n=`Invalid enum value. Expected ${V.joinValues(e.options)}, received '${e.received}'`;break;case U.invalid_arguments:n=`Invalid function arguments`;break;case U.invalid_return_type:n=`Invalid function return type`;break;case U.invalid_date:n=`Invalid date`;break;case U.invalid_string:typeof e.validation==`object`?`includes`in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position==`number`&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):`startsWith`in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:`endsWith`in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:V.assertNever(e.validation):n=e.validation===`regex`?`Invalid`:`Invalid ${e.validation}`;break;case U.too_small:n=e.type===`array`?`Array must contain ${e.exact?`exactly`:e.inclusive?`at least`:`more than`} ${e.minimum} element(s)`:e.type===`string`?`String must contain ${e.exact?`exactly`:e.inclusive?`at least`:`over`} ${e.minimum} character(s)`:e.type===`number`||e.type===`bigint`?`Number must be ${e.exact?`exactly equal to `:e.inclusive?`greater than or equal to `:`greater than `}${e.minimum}`:e.type===`date`?`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 U.too_big:n=e.type===`array`?`Array must contain ${e.exact?`exactly`:e.inclusive?`at most`:`less than`} ${e.maximum} element(s)`:e.type===`string`?`String must contain ${e.exact?`exactly`:e.inclusive?`at most`:`under`} ${e.maximum} character(s)`:e.type===`number`?`Number must be ${e.exact?`exactly`:e.inclusive?`less than or equal to`:`less than`} ${e.maximum}`:e.type===`bigint`?`BigInt must be ${e.exact?`exactly`:e.inclusive?`less than or equal to`:`less than`} ${e.maximum}`:e.type===`date`?`Date must be ${e.exact?`exactly`:e.inclusive?`smaller than or equal to`:`smaller than`} ${new Date(Number(e.maximum))}`:`Invalid input`;break;case U.custom:n=`Invalid input`;break;case U.invalid_intersection_types:n=`Intersection results could not be merged`;break;case U.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case U.not_finite:n=`Number must be finite`;break;default:n=t.defaultError,V.assertNever(e)}return{message:n}};let Hr=Vr;function Ur(){return Hr}let Wr=e=>{let{data:t,path:n,errorMaps:r,issueData:i}=e,a=[...n,...i.path||[]],o={...i,path:a};if(i.message!==void 0)return{...i,path:a,message:i.message};let s=``,c=r.filter(e=>!!e).slice().reverse();for(let e of c)s=e(o,{data:t,defaultError:s}).message;return{...i,path:a,message:s}};function W(e,t){let n=Ur(),r=Wr({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===Vr?void 0:Vr].filter(e=>!!e)});e.common.issues.push(r)}var Gr=class e{constructor(){this.value=`valid`}dirty(){this.value===`valid`&&(this.value=`dirty`)}abort(){this.value!==`aborted`&&(this.value=`aborted`)}static mergeArray(e,t){let n=[];for(let r of t){if(r.status===`aborted`)return G;r.status===`dirty`&&e.dirty(),n.push(r.value)}return{status:e.value,value:n}}static async mergeObjectAsync(t,n){let r=[];for(let e of n){let t=await e.key,n=await e.value;r.push({key:t,value:n})}return e.mergeObjectSync(t,r)}static mergeObjectSync(e,t){let n={};for(let r of t){let{key:t,value:i}=r;if(t.status===`aborted`||i.status===`aborted`)return G;t.status===`dirty`&&e.dirty(),i.status===`dirty`&&e.dirty(),t.value!==`__proto__`&&(i.value!==void 0||r.alwaysSet)&&(n[t.value]=i.value)}return{status:e.value,value:n}}};let G=Object.freeze({status:`aborted`}),Kr=e=>({status:`dirty`,value:e}),qr=e=>({status:`valid`,value:e}),Jr=e=>e.status===`aborted`,Yr=e=>e.status===`dirty`,Xr=e=>e.status===`valid`,Zr=e=>typeof Promise<`u`&&e instanceof Promise;var K;(function(e){e.errToObj=e=>typeof e==`string`?{message:e}:e||{},e.toString=e=>typeof e==`string`?e:e?.message})(K||={});var Qr=class{constructor(e,t,n,r){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=r}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}};let $r=(e,t)=>{if(Xr(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw Error(`Validation failed but no issues detected.`);return{success:!1,get error(){return this._error||=new Br(e.common.issues),this._error}}};function q(e){if(!e)return{};let{errorMap:t,invalid_type_error:n,required_error:r,description:i}=e;if(t&&(n||r))throw Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:i}:{errorMap:(t,i)=>{let{message:a}=e;return t.code===`invalid_enum_value`?{message:a??i.defaultError}:i.data===void 0?{message:a??r??i.defaultError}:t.code===`invalid_type`?{message:a??n??i.defaultError}:{message:i.defaultError}},description:i}}var J=class{get description(){return this._def.description}_getType(e){return zr(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:zr(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Gr,ctx:{common:e.parent.common,data:e.data,parsedType:zr(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(Zr(t))throw Error(`Synchronous parse encountered promise.`);return t}_parseAsync(e){let t=this._parse(e);return Promise.resolve(t)}parse(e,t){let n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){let n={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:zr(e)};return $r(n,this._parseSync({data:e,path:n.path,parent:n}))}"~validate"(e){let t={common:{issues:[],async:!!this[`~standard`].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:zr(e)};if(!this[`~standard`].async)try{let n=this._parseSync({data:e,path:[],parent:t});return Xr(n)?{value:n.value}:{issues:t.common.issues}}catch(e){e?.message?.toLowerCase()?.includes(`encountered`)&&(this[`~standard`].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(e=>Xr(e)?{value:e.value}:{issues:t.common.issues})}async parseAsync(e,t){let n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){let n={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:zr(e)},r=this._parse({data:e,path:n.path,parent:n});return $r(n,await(Zr(r)?r:Promise.resolve(r)))}refine(e,t){let n=e=>typeof t==`string`||t===void 0?{message:t}:typeof t==`function`?t(e):t;return this._refinement((t,r)=>{let i=e(t),a=()=>r.addIssue({code:U.custom,...n(t)});return typeof Promise<`u`&&i instanceof Promise?i.then(e=>e?!0:(a(),!1)):i?!0:(a(),!1)})}refinement(e,t){return this._refinement((n,r)=>e(n)?!0:(r.addIssue(typeof t==`function`?t(n,r):t),!1))}_refinement(e){return new ta({schema:this,typeName:Y.ZodEffects,effect:{type:`refinement`,refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this[`~standard`]={version:1,vendor:`zod`,validate:e=>this[`~validate`](e)}}optional(){return na.create(this,this._def)}nullable(){return ra.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Ii.create(this)}promise(){return ea.create(this,this._def)}or(e){return zi.create([this,e],this._def)}and(e){return Ui.create(this,e,this._def)}transform(e){return new ta({...q(this._def),schema:this,typeName:Y.ZodEffects,effect:{type:`transform`,transform:e}})}default(e){let t=typeof e==`function`?e:()=>e;return new ia({...q(this._def),innerType:this,defaultValue:t,typeName:Y.ZodDefault})}brand(){return new sa({typeName:Y.ZodBranded,type:this,...q(this._def)})}catch(e){let t=typeof e==`function`?e:()=>e;return new aa({...q(this._def),innerType:this,catchValue:t,typeName:Y.ZodCatch})}describe(e){let t=this.constructor;return new t({...this._def,description:e})}pipe(e){return ca.create(this,e)}readonly(){return la.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}};let ei=/^c[^\s-]{8,}$/i,ti=/^[0-9a-z]+$/,ni=/^[0-9A-HJKMNP-TV-Z]{26}$/i,ri=/^[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,ii=/^[a-z0-9_-]{21}$/i,ai=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,oi=/^[-+]?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)?)??$/,si=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,ci,li=/^(?:(?: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])$/,ui=/^(?:(?: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])$/,di=/^(([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]))$/,fi=/^(([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])$/,pi=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,mi=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,hi=`((\\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])))`,gi=RegExp(`^${hi}$`);function _i(e){let t=`[0-5]\\d`;e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision??(t=`${t}(\\.\\d+)?`);let n=e.precision?`+`:`?`;return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${n}`}function vi(e){return RegExp(`^${_i(e)}$`)}function yi(e){let t=`${hi}T${_i(e)}`,n=[];return n.push(e.local?`Z?`:`Z`),e.offset&&n.push(`([+-]\\d{2}:?\\d{2})`),t=`${t}(${n.join(`|`)})`,RegExp(`^${t}$`)}function bi(e,t){return!!((t===`v4`||!t)&&li.test(e)||(t===`v6`||!t)&&di.test(e))}function xi(e,t){if(!ai.test(e))return!1;try{let[n]=e.split(`.`);if(!n)return!1;let r=n.replace(/-/g,`+`).replace(/_/g,`/`).padEnd(n.length+(4-n.length%4)%4,`=`),i=JSON.parse(atob(r));return!(typeof i!=`object`||!i||`typ`in i&&i?.typ!==`JWT`||!i.alg||t&&i.alg!==t)}catch{return!1}}function Si(e,t){return!!((t===`v4`||!t)&&ui.test(e)||(t===`v6`||!t)&&fi.test(e))}var Ci=class e extends J{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==H.string){let t=this._getOrReturnCtx(e);return W(t,{code:U.invalid_type,expected:H.string,received:t.parsedType}),G}let t=new Gr,n;for(let r of this._def.checks)if(r.kind===`min`)e.data.length<r.value&&(n=this._getOrReturnCtx(e,n),W(n,{code:U.too_small,minimum:r.value,type:`string`,inclusive:!0,exact:!1,message:r.message}),t.dirty());else if(r.kind===`max`)e.data.length>r.value&&(n=this._getOrReturnCtx(e,n),W(n,{code:U.too_big,maximum:r.value,type:`string`,inclusive:!0,exact:!1,message:r.message}),t.dirty());else if(r.kind===`length`){let i=e.data.length>r.value,a=e.data.length<r.value;(i||a)&&(n=this._getOrReturnCtx(e,n),i?W(n,{code:U.too_big,maximum:r.value,type:`string`,inclusive:!0,exact:!0,message:r.message}):a&&W(n,{code:U.too_small,minimum:r.value,type:`string`,inclusive:!0,exact:!0,message:r.message}),t.dirty())}else if(r.kind===`email`)si.test(e.data)||(n=this._getOrReturnCtx(e,n),W(n,{validation:`email`,code:U.invalid_string,message:r.message}),t.dirty());else if(r.kind===`emoji`)ci||=RegExp(`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`,`u`),ci.test(e.data)||(n=this._getOrReturnCtx(e,n),W(n,{validation:`emoji`,code:U.invalid_string,message:r.message}),t.dirty());else if(r.kind===`uuid`)ri.test(e.data)||(n=this._getOrReturnCtx(e,n),W(n,{validation:`uuid`,code:U.invalid_string,message:r.message}),t.dirty());else if(r.kind===`nanoid`)ii.test(e.data)||(n=this._getOrReturnCtx(e,n),W(n,{validation:`nanoid`,code:U.invalid_string,message:r.message}),t.dirty());else if(r.kind===`cuid`)ei.test(e.data)||(n=this._getOrReturnCtx(e,n),W(n,{validation:`cuid`,code:U.invalid_string,message:r.message}),t.dirty());else if(r.kind===`cuid2`)ti.test(e.data)||(n=this._getOrReturnCtx(e,n),W(n,{validation:`cuid2`,code:U.invalid_string,message:r.message}),t.dirty());else if(r.kind===`ulid`)ni.test(e.data)||(n=this._getOrReturnCtx(e,n),W(n,{validation:`ulid`,code:U.invalid_string,message:r.message}),t.dirty());else if(r.kind===`url`)try{new URL(e.data)}catch{n=this._getOrReturnCtx(e,n),W(n,{validation:`url`,code:U.invalid_string,message:r.message}),t.dirty()}else r.kind===`regex`?(r.regex.lastIndex=0,r.regex.test(e.data)||(n=this._getOrReturnCtx(e,n),W(n,{validation:`regex`,code:U.invalid_string,message:r.message}),t.dirty())):r.kind===`trim`?e.data=e.data.trim():r.kind===`includes`?e.data.includes(r.value,r.position)||(n=this._getOrReturnCtx(e,n),W(n,{code:U.invalid_string,validation:{includes:r.value,position:r.position},message:r.message}),t.dirty()):r.kind===`toLowerCase`?e.data=e.data.toLowerCase():r.kind===`toUpperCase`?e.data=e.data.toUpperCase():r.kind===`startsWith`?e.data.startsWith(r.value)||(n=this._getOrReturnCtx(e,n),W(n,{code:U.invalid_string,validation:{startsWith:r.value},message:r.message}),t.dirty()):r.kind===`endsWith`?e.data.endsWith(r.value)||(n=this._getOrReturnCtx(e,n),W(n,{code:U.invalid_string,validation:{endsWith:r.value},message:r.message}),t.dirty()):r.kind===`datetime`?yi(r).test(e.data)||(n=this._getOrReturnCtx(e,n),W(n,{code:U.invalid_string,validation:`datetime`,message:r.message}),t.dirty()):r.kind===`date`?gi.test(e.data)||(n=this._getOrReturnCtx(e,n),W(n,{code:U.invalid_string,validation:`date`,message:r.message}),t.dirty()):r.kind===`time`?vi(r).test(e.data)||(n=this._getOrReturnCtx(e,n),W(n,{code:U.invalid_string,validation:`time`,message:r.message}),t.dirty()):r.kind===`duration`?oi.test(e.data)||(n=this._getOrReturnCtx(e,n),W(n,{validation:`duration`,code:U.invalid_string,message:r.message}),t.dirty()):r.kind===`ip`?bi(e.data,r.version)||(n=this._getOrReturnCtx(e,n),W(n,{validation:`ip`,code:U.invalid_string,message:r.message}),t.dirty()):r.kind===`jwt`?xi(e.data,r.alg)||(n=this._getOrReturnCtx(e,n),W(n,{validation:`jwt`,code:U.invalid_string,message:r.message}),t.dirty()):r.kind===`cidr`?Si(e.data,r.version)||(n=this._getOrReturnCtx(e,n),W(n,{validation:`cidr`,code:U.invalid_string,message:r.message}),t.dirty()):r.kind===`base64`?pi.test(e.data)||(n=this._getOrReturnCtx(e,n),W(n,{validation:`base64`,code:U.invalid_string,message:r.message}),t.dirty()):r.kind===`base64url`?mi.test(e.data)||(n=this._getOrReturnCtx(e,n),W(n,{validation:`base64url`,code:U.invalid_string,message:r.message}),t.dirty()):V.assertNever(r);return{status:t.value,value:e.data}}_regex(e,t,n){return this.refinement(t=>e.test(t),{validation:t,code:U.invalid_string,...K.errToObj(n)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(e){return this._addCheck({kind:`email`,...K.errToObj(e)})}url(e){return this._addCheck({kind:`url`,...K.errToObj(e)})}emoji(e){return this._addCheck({kind:`emoji`,...K.errToObj(e)})}uuid(e){return this._addCheck({kind:`uuid`,...K.errToObj(e)})}nanoid(e){return this._addCheck({kind:`nanoid`,...K.errToObj(e)})}cuid(e){return this._addCheck({kind:`cuid`,...K.errToObj(e)})}cuid2(e){return this._addCheck({kind:`cuid2`,...K.errToObj(e)})}ulid(e){return this._addCheck({kind:`ulid`,...K.errToObj(e)})}base64(e){return this._addCheck({kind:`base64`,...K.errToObj(e)})}base64url(e){return this._addCheck({kind:`base64url`,...K.errToObj(e)})}jwt(e){return this._addCheck({kind:`jwt`,...K.errToObj(e)})}ip(e){return this._addCheck({kind:`ip`,...K.errToObj(e)})}cidr(e){return this._addCheck({kind:`cidr`,...K.errToObj(e)})}datetime(e){return typeof e==`string`?this._addCheck({kind:`datetime`,precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:`datetime`,precision:e?.precision===void 0?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...K.errToObj(e?.message)})}date(e){return this._addCheck({kind:`date`,message:e})}time(e){return typeof e==`string`?this._addCheck({kind:`time`,precision:null,message:e}):this._addCheck({kind:`time`,precision:e?.precision===void 0?null:e?.precision,...K.errToObj(e?.message)})}duration(e){return this._addCheck({kind:`duration`,...K.errToObj(e)})}regex(e,t){return this._addCheck({kind:`regex`,regex:e,...K.errToObj(t)})}includes(e,t){return this._addCheck({kind:`includes`,value:e,position:t?.position,...K.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:`startsWith`,value:e,...K.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:`endsWith`,value:e,...K.errToObj(t)})}min(e,t){return this._addCheck({kind:`min`,value:e,...K.errToObj(t)})}max(e,t){return this._addCheck({kind:`max`,value:e,...K.errToObj(t)})}length(e,t){return this._addCheck({kind:`length`,value:e,...K.errToObj(t)})}nonempty(e){return this.min(1,K.errToObj(e))}trim(){return new e({...this._def,checks:[...this._def.checks,{kind:`trim`}]})}toLowerCase(){return new e({...this._def,checks:[...this._def.checks,{kind:`toLowerCase`}]})}toUpperCase(){return new e({...this._def,checks:[...this._def.checks,{kind:`toUpperCase`}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind===`datetime`)}get isDate(){return!!this._def.checks.find(e=>e.kind===`date`)}get isTime(){return!!this._def.checks.find(e=>e.kind===`time`)}get isDuration(){return!!this._def.checks.find(e=>e.kind===`duration`)}get isEmail(){return!!this._def.checks.find(e=>e.kind===`email`)}get isURL(){return!!this._def.checks.find(e=>e.kind===`url`)}get isEmoji(){return!!this._def.checks.find(e=>e.kind===`emoji`)}get isUUID(){return!!this._def.checks.find(e=>e.kind===`uuid`)}get isNANOID(){return!!this._def.checks.find(e=>e.kind===`nanoid`)}get isCUID(){return!!this._def.checks.find(e=>e.kind===`cuid`)}get isCUID2(){return!!this._def.checks.find(e=>e.kind===`cuid2`)}get isULID(){return!!this._def.checks.find(e=>e.kind===`ulid`)}get isIP(){return!!this._def.checks.find(e=>e.kind===`ip`)}get isCIDR(){return!!this._def.checks.find(e=>e.kind===`cidr`)}get isBase64(){return!!this._def.checks.find(e=>e.kind===`base64`)}get isBase64url(){return!!this._def.checks.find(e=>e.kind===`base64url`)}get minLength(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.value<e)&&(e=t.value);return e}};Ci.create=e=>new Ci({checks:[],typeName:Y.ZodString,coerce:e?.coerce??!1,...q(e)});function wi(e,t){let n=(e.toString().split(`.`)[1]||``).length,r=(t.toString().split(`.`)[1]||``).length,i=n>r?n:r;return Number.parseInt(e.toFixed(i).replace(`.`,``))%Number.parseInt(t.toFixed(i).replace(`.`,``))/10**i}var Ti=class e extends J{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==H.number){let t=this._getOrReturnCtx(e);return W(t,{code:U.invalid_type,expected:H.number,received:t.parsedType}),G}let t,n=new Gr;for(let r of this._def.checks)r.kind===`int`?V.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),W(t,{code:U.invalid_type,expected:`integer`,received:`float`,message:r.message}),n.dirty()):r.kind===`min`?(r.inclusive?e.data<r.value:e.data<=r.value)&&(t=this._getOrReturnCtx(e,t),W(t,{code:U.too_small,minimum:r.value,type:`number`,inclusive:r.inclusive,exact:!1,message:r.message}),n.dirty()):r.kind===`max`?(r.inclusive?e.data>r.value:e.data>=r.value)&&(t=this._getOrReturnCtx(e,t),W(t,{code:U.too_big,maximum:r.value,type:`number`,inclusive:r.inclusive,exact:!1,message:r.message}),n.dirty()):r.kind===`multipleOf`?wi(e.data,r.value)!==0&&(t=this._getOrReturnCtx(e,t),W(t,{code:U.not_multiple_of,multipleOf:r.value,message:r.message}),n.dirty()):r.kind===`finite`?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),W(t,{code:U.not_finite,message:r.message}),n.dirty()):V.assertNever(r);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit(`min`,e,!0,K.toString(t))}gt(e,t){return this.setLimit(`min`,e,!1,K.toString(t))}lte(e,t){return this.setLimit(`max`,e,!0,K.toString(t))}lt(e,t){return this.setLimit(`max`,e,!1,K.toString(t))}setLimit(t,n,r,i){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:K.toString(i)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(e){return this._addCheck({kind:`int`,message:K.toString(e)})}positive(e){return this._addCheck({kind:`min`,value:0,inclusive:!1,message:K.toString(e)})}negative(e){return this._addCheck({kind:`max`,value:0,inclusive:!1,message:K.toString(e)})}nonpositive(e){return this._addCheck({kind:`max`,value:0,inclusive:!0,message:K.toString(e)})}nonnegative(e){return this._addCheck({kind:`min`,value:0,inclusive:!0,message:K.toString(e)})}multipleOf(e,t){return this._addCheck({kind:`multipleOf`,value:e,message:K.toString(t)})}finite(e){return this._addCheck({kind:`finite`,message:K.toString(e)})}safe(e){return this._addCheck({kind:`min`,inclusive:!0,value:-(2**53-1),message:K.toString(e)})._addCheck({kind:`max`,inclusive:!0,value:2**53-1,message:K.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind===`int`||e.kind===`multipleOf`&&V.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let n of this._def.checks)if(n.kind===`finite`||n.kind===`int`||n.kind===`multipleOf`)return!0;else n.kind===`min`?(t===null||n.value>t)&&(t=n.value):n.kind===`max`&&(e===null||n.value<e)&&(e=n.value);return Number.isFinite(t)&&Number.isFinite(e)}};Ti.create=e=>new Ti({checks:[],typeName:Y.ZodNumber,coerce:e?.coerce||!1,...q(e)});var Ei=class e extends J{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==H.bigint)return this._getInvalidInput(e);let t,n=new Gr;for(let r of this._def.checks)r.kind===`min`?(r.inclusive?e.data<r.value:e.data<=r.value)&&(t=this._getOrReturnCtx(e,t),W(t,{code:U.too_small,type:`bigint`,minimum:r.value,inclusive:r.inclusive,message:r.message}),n.dirty()):r.kind===`max`?(r.inclusive?e.data>r.value:e.data>=r.value)&&(t=this._getOrReturnCtx(e,t),W(t,{code:U.too_big,type:`bigint`,maximum:r.value,inclusive:r.inclusive,message:r.message}),n.dirty()):r.kind===`multipleOf`?e.data%r.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),W(t,{code:U.not_multiple_of,multipleOf:r.value,message:r.message}),n.dirty()):V.assertNever(r);return{status:n.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return W(t,{code:U.invalid_type,expected:H.bigint,received:t.parsedType}),G}gte(e,t){return this.setLimit(`min`,e,!0,K.toString(t))}gt(e,t){return this.setLimit(`min`,e,!1,K.toString(t))}lte(e,t){return this.setLimit(`max`,e,!0,K.toString(t))}lt(e,t){return this.setLimit(`max`,e,!1,K.toString(t))}setLimit(t,n,r,i){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:K.toString(i)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}positive(e){return this._addCheck({kind:`min`,value:BigInt(0),inclusive:!1,message:K.toString(e)})}negative(e){return this._addCheck({kind:`max`,value:BigInt(0),inclusive:!1,message:K.toString(e)})}nonpositive(e){return this._addCheck({kind:`max`,value:BigInt(0),inclusive:!0,message:K.toString(e)})}nonnegative(e){return this._addCheck({kind:`min`,value:BigInt(0),inclusive:!0,message:K.toString(e)})}multipleOf(e,t){return this._addCheck({kind:`multipleOf`,value:e,message:K.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.value<e)&&(e=t.value);return e}};Ei.create=e=>new Ei({checks:[],typeName:Y.ZodBigInt,coerce:e?.coerce??!1,...q(e)});var Di=class extends J{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==H.boolean){let t=this._getOrReturnCtx(e);return W(t,{code:U.invalid_type,expected:H.boolean,received:t.parsedType}),G}return qr(e.data)}};Di.create=e=>new Di({typeName:Y.ZodBoolean,coerce:e?.coerce||!1,...q(e)});var Oi=class e extends J{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==H.date){let t=this._getOrReturnCtx(e);return W(t,{code:U.invalid_type,expected:H.date,received:t.parsedType}),G}if(Number.isNaN(e.data.getTime()))return W(this._getOrReturnCtx(e),{code:U.invalid_date}),G;let t=new Gr,n;for(let r of this._def.checks)r.kind===`min`?e.data.getTime()<r.value&&(n=this._getOrReturnCtx(e,n),W(n,{code:U.too_small,message:r.message,inclusive:!0,exact:!1,minimum:r.value,type:`date`}),t.dirty()):r.kind===`max`?e.data.getTime()>r.value&&(n=this._getOrReturnCtx(e,n),W(n,{code:U.too_big,message:r.message,inclusive:!0,exact:!1,maximum:r.value,type:`date`}),t.dirty()):V.assertNever(r);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}min(e,t){return this._addCheck({kind:`min`,value:e.getTime(),message:K.toString(t)})}max(e,t){return this._addCheck({kind:`max`,value:e.getTime(),message:K.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e==null?null:new Date(e)}get maxDate(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.value<e)&&(e=t.value);return e==null?null:new Date(e)}};Oi.create=e=>new Oi({checks:[],coerce:e?.coerce||!1,typeName:Y.ZodDate,...q(e)});var ki=class extends J{_parse(e){if(this._getType(e)!==H.symbol){let t=this._getOrReturnCtx(e);return W(t,{code:U.invalid_type,expected:H.symbol,received:t.parsedType}),G}return qr(e.data)}};ki.create=e=>new ki({typeName:Y.ZodSymbol,...q(e)});var Ai=class extends J{_parse(e){if(this._getType(e)!==H.undefined){let t=this._getOrReturnCtx(e);return W(t,{code:U.invalid_type,expected:H.undefined,received:t.parsedType}),G}return qr(e.data)}};Ai.create=e=>new Ai({typeName:Y.ZodUndefined,...q(e)});var ji=class extends J{_parse(e){if(this._getType(e)!==H.null){let t=this._getOrReturnCtx(e);return W(t,{code:U.invalid_type,expected:H.null,received:t.parsedType}),G}return qr(e.data)}};ji.create=e=>new ji({typeName:Y.ZodNull,...q(e)});var Mi=class extends J{constructor(){super(...arguments),this._any=!0}_parse(e){return qr(e.data)}};Mi.create=e=>new Mi({typeName:Y.ZodAny,...q(e)});var Ni=class extends J{constructor(){super(...arguments),this._unknown=!0}_parse(e){return qr(e.data)}};Ni.create=e=>new Ni({typeName:Y.ZodUnknown,...q(e)});var Pi=class extends J{_parse(e){let t=this._getOrReturnCtx(e);return W(t,{code:U.invalid_type,expected:H.never,received:t.parsedType}),G}};Pi.create=e=>new Pi({typeName:Y.ZodNever,...q(e)});var Fi=class extends J{_parse(e){if(this._getType(e)!==H.undefined){let t=this._getOrReturnCtx(e);return W(t,{code:U.invalid_type,expected:H.void,received:t.parsedType}),G}return qr(e.data)}};Fi.create=e=>new Fi({typeName:Y.ZodVoid,...q(e)});var Ii=class e extends J{_parse(e){let{ctx:t,status:n}=this._processInputParams(e),r=this._def;if(t.parsedType!==H.array)return W(t,{code:U.invalid_type,expected:H.array,received:t.parsedType}),G;if(r.exactLength!==null){let e=t.data.length>r.exactLength.value,i=t.data.length<r.exactLength.value;(e||i)&&(W(t,{code:e?U.too_big:U.too_small,minimum:i?r.exactLength.value:void 0,maximum:e?r.exactLength.value:void 0,type:`array`,inclusive:!0,exact:!0,message:r.exactLength.message}),n.dirty())}if(r.minLength!==null&&t.data.length<r.minLength.value&&(W(t,{code:U.too_small,minimum:r.minLength.value,type:`array`,inclusive:!0,exact:!1,message:r.minLength.message}),n.dirty()),r.maxLength!==null&&t.data.length>r.maxLength.value&&(W(t,{code:U.too_big,maximum:r.maxLength.value,type:`array`,inclusive:!0,exact:!1,message:r.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map((e,n)=>r.type._parseAsync(new Qr(t,e,t.path,n)))).then(e=>Gr.mergeArray(n,e));let i=[...t.data].map((e,n)=>r.type._parseSync(new Qr(t,e,t.path,n)));return Gr.mergeArray(n,i)}get element(){return this._def.type}min(t,n){return new e({...this._def,minLength:{value:t,message:K.toString(n)}})}max(t,n){return new e({...this._def,maxLength:{value:t,message:K.toString(n)}})}length(t,n){return new e({...this._def,exactLength:{value:t,message:K.toString(n)}})}nonempty(e){return this.min(1,e)}};Ii.create=(e,t)=>new Ii({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Y.ZodArray,...q(t)});function Li(e){if(e instanceof Ri){let t={};for(let n in e.shape){let r=e.shape[n];t[n]=na.create(Li(r))}return new Ri({...e._def,shape:()=>t})}else if(e instanceof Ii)return new Ii({...e._def,type:Li(e.element)});else if(e instanceof na)return na.create(Li(e.unwrap()));else if(e instanceof ra)return ra.create(Li(e.unwrap()));else if(e instanceof Wi)return Wi.create(e.items.map(e=>Li(e)));else return e}var Ri=class e extends J{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape();return this._cached={shape:e,keys:V.objectKeys(e)},this._cached}_parse(e){if(this._getType(e)!==H.object){let t=this._getOrReturnCtx(e);return W(t,{code:U.invalid_type,expected:H.object,received:t.parsedType}),G}let{status:t,ctx:n}=this._processInputParams(e),{shape:r,keys:i}=this._getCached(),a=[];if(!(this._def.catchall instanceof Pi&&this._def.unknownKeys===`strip`))for(let e in n.data)i.includes(e)||a.push(e);let o=[];for(let e of i){let t=r[e],i=n.data[e];o.push({key:{status:`valid`,value:e},value:t._parse(new Qr(n,i,n.path,e)),alwaysSet:e in n.data})}if(this._def.catchall instanceof Pi){let e=this._def.unknownKeys;if(e===`passthrough`)for(let e of a)o.push({key:{status:`valid`,value:e},value:{status:`valid`,value:n.data[e]}});else if(e===`strict`)a.length>0&&(W(n,{code:U.unrecognized_keys,keys:a}),t.dirty());else if(e!==`strip`)throw Error(`Internal ZodObject error: invalid unknownKeys value.`)}else{let e=this._def.catchall;for(let t of a){let r=n.data[t];o.push({key:{status:`valid`,value:t},value:e._parse(new Qr(n,r,n.path,t)),alwaysSet:t in n.data})}}return n.common.async?Promise.resolve().then(async()=>{let e=[];for(let t of o){let n=await t.key,r=await t.value;e.push({key:n,value:r,alwaysSet:t.alwaysSet})}return e}).then(e=>Gr.mergeObjectSync(t,e)):Gr.mergeObjectSync(t,o)}get shape(){return this._def.shape()}strict(t){return K.errToObj,new e({...this._def,unknownKeys:`strict`,...t===void 0?{}:{errorMap:(e,n)=>{let r=this._def.errorMap?.(e,n).message??n.defaultError;return e.code===`unrecognized_keys`?{message:K.errToObj(t).message??r}:{message:r}}}})}strip(){return new e({...this._def,unknownKeys:`strip`})}passthrough(){return new e({...this._def,unknownKeys:`passthrough`})}extend(t){return new e({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new e({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:Y.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(t){return new e({...this._def,catchall:t})}pick(t){let n={};for(let e of V.objectKeys(t))t[e]&&this.shape[e]&&(n[e]=this.shape[e]);return new e({...this._def,shape:()=>n})}omit(t){let n={};for(let e of V.objectKeys(this.shape))t[e]||(n[e]=this.shape[e]);return new e({...this._def,shape:()=>n})}deepPartial(){return Li(this)}partial(t){let n={};for(let e of V.objectKeys(this.shape)){let r=this.shape[e];t&&!t[e]?n[e]=r:n[e]=r.optional()}return new e({...this._def,shape:()=>n})}required(t){let n={};for(let e of V.objectKeys(this.shape))if(t&&!t[e])n[e]=this.shape[e];else{let t=this.shape[e];for(;t instanceof na;)t=t._def.innerType;n[e]=t}return new e({...this._def,shape:()=>n})}keyof(){return Zi(V.objectKeys(this.shape))}};Ri.create=(e,t)=>new Ri({shape:()=>e,unknownKeys:`strip`,catchall:Pi.create(),typeName:Y.ZodObject,...q(t)}),Ri.strictCreate=(e,t)=>new Ri({shape:()=>e,unknownKeys:`strict`,catchall:Pi.create(),typeName:Y.ZodObject,...q(t)}),Ri.lazycreate=(e,t)=>new Ri({shape:e,unknownKeys:`strip`,catchall:Pi.create(),typeName:Y.ZodObject,...q(t)});var zi=class extends J{_parse(e){let{ctx:t}=this._processInputParams(e),n=this._def.options;function r(e){for(let t of e)if(t.result.status===`valid`)return t.result;for(let n of e)if(n.result.status===`dirty`)return t.common.issues.push(...n.ctx.common.issues),n.result;let n=e.map(e=>new Br(e.ctx.common.issues));return W(t,{code:U.invalid_union,unionErrors:n}),G}if(t.common.async)return Promise.all(n.map(async e=>{let n={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:n}),ctx:n}})).then(r);{let e,r=[];for(let i of n){let n={...t,common:{...t.common,issues:[]},parent:null},a=i._parseSync({data:t.data,path:t.path,parent:n});if(a.status===`valid`)return a;a.status===`dirty`&&!e&&(e={result:a,ctx:n}),n.common.issues.length&&r.push(n.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;let i=r.map(e=>new Br(e));return W(t,{code:U.invalid_union,unionErrors:i}),G}}get options(){return this._def.options}};zi.create=(e,t)=>new zi({options:e,typeName:Y.ZodUnion,...q(t)});let Bi=e=>e instanceof Yi?Bi(e.schema):e instanceof ta?Bi(e.innerType()):e instanceof Xi?[e.value]:e instanceof Qi?e.options:e instanceof $i?V.objectValues(e.enum):e instanceof ia?Bi(e._def.innerType):e instanceof Ai?[void 0]:e instanceof ji?[null]:e instanceof na?[void 0,...Bi(e.unwrap())]:e instanceof ra?[null,...Bi(e.unwrap())]:e instanceof sa||e instanceof la?Bi(e.unwrap()):e instanceof aa?Bi(e._def.innerType):[];var Vi=class e extends J{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==H.object)return W(t,{code:U.invalid_type,expected:H.object,received:t.parsedType}),G;let n=this.discriminator,r=t.data[n],i=this.optionsMap.get(r);return i?t.common.async?i._parseAsync({data:t.data,path:t.path,parent:t}):i._parseSync({data:t.data,path:t.path,parent:t}):(W(t,{code:U.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),G)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,n,r){let i=new Map;for(let e of n){let n=Bi(e.shape[t]);if(!n.length)throw Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(let r of n){if(i.has(r))throw Error(`Discriminator property ${String(t)} has duplicate value ${String(r)}`);i.set(r,e)}}return new e({typeName:Y.ZodDiscriminatedUnion,discriminator:t,options:n,optionsMap:i,...q(r)})}};function Hi(e,t){let n=zr(e),r=zr(t);if(e===t)return{valid:!0,data:e};if(n===H.object&&r===H.object){let n=V.objectKeys(t),r=V.objectKeys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};for(let n of r){let r=Hi(e[n],t[n]);if(!r.valid)return{valid:!1};i[n]=r.data}return{valid:!0,data:i}}else if(n===H.array&&r===H.array){if(e.length!==t.length)return{valid:!1};let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t[r],o=Hi(i,a);if(!o.valid)return{valid:!1};n.push(o.data)}return{valid:!0,data:n}}else if(n===H.date&&r===H.date&&+e==+t)return{valid:!0,data:e};else return{valid:!1}}var Ui=class extends J{_parse(e){let{status:t,ctx:n}=this._processInputParams(e),r=(e,r)=>{if(Jr(e)||Jr(r))return G;let i=Hi(e.value,r.value);return i.valid?((Yr(e)||Yr(r))&&t.dirty(),{status:t.value,value:i.data}):(W(n,{code:U.invalid_intersection_types}),G)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([e,t])=>r(e,t)):r(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};Ui.create=(e,t,n)=>new Ui({left:e,right:t,typeName:Y.ZodIntersection,...q(n)});var Wi=class e extends J{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==H.array)return W(n,{code:U.invalid_type,expected:H.array,received:n.parsedType}),G;if(n.data.length<this._def.items.length)return W(n,{code:U.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:`array`}),G;!this._def.rest&&n.data.length>this._def.items.length&&(W(n,{code:U.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:`array`}),t.dirty());let r=[...n.data].map((e,t)=>{let r=this._def.items[t]||this._def.rest;return r?r._parse(new Qr(n,e,n.path,t)):null}).filter(e=>!!e);return n.common.async?Promise.all(r).then(e=>Gr.mergeArray(t,e)):Gr.mergeArray(t,r)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};Wi.create=(e,t)=>{if(!Array.isArray(e))throw Error(`You must pass an array of schemas to z.tuple([ ... ])`);return new Wi({items:e,typeName:Y.ZodTuple,rest:null,...q(t)})};var Gi=class e extends J{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==H.object)return W(n,{code:U.invalid_type,expected:H.object,received:n.parsedType}),G;let r=[],i=this._def.keyType,a=this._def.valueType;for(let e in n.data)r.push({key:i._parse(new Qr(n,e,n.path,e)),value:a._parse(new Qr(n,n.data[e],n.path,e)),alwaysSet:e in n.data});return n.common.async?Gr.mergeObjectAsync(t,r):Gr.mergeObjectSync(t,r)}get element(){return this._def.valueType}static create(t,n,r){return n instanceof J?new e({keyType:t,valueType:n,typeName:Y.ZodRecord,...q(r)}):new e({keyType:Ci.create(),valueType:t,typeName:Y.ZodRecord,...q(n)})}},Ki=class extends J{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==H.map)return W(n,{code:U.invalid_type,expected:H.map,received:n.parsedType}),G;let r=this._def.keyType,i=this._def.valueType,a=[...n.data.entries()].map(([e,t],a)=>({key:r._parse(new Qr(n,e,n.path,[a,`key`])),value:i._parse(new Qr(n,t,n.path,[a,`value`]))}));if(n.common.async){let e=new Map;return Promise.resolve().then(async()=>{for(let n of a){let r=await n.key,i=await n.value;if(r.status===`aborted`||i.status===`aborted`)return G;(r.status===`dirty`||i.status===`dirty`)&&t.dirty(),e.set(r.value,i.value)}return{status:t.value,value:e}})}else{let e=new Map;for(let n of a){let r=n.key,i=n.value;if(r.status===`aborted`||i.status===`aborted`)return G;(r.status===`dirty`||i.status===`dirty`)&&t.dirty(),e.set(r.value,i.value)}return{status:t.value,value:e}}}};Ki.create=(e,t,n)=>new Ki({valueType:t,keyType:e,typeName:Y.ZodMap,...q(n)});var qi=class e extends J{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==H.set)return W(n,{code:U.invalid_type,expected:H.set,received:n.parsedType}),G;let r=this._def;r.minSize!==null&&n.data.size<r.minSize.value&&(W(n,{code:U.too_small,minimum:r.minSize.value,type:`set`,inclusive:!0,exact:!1,message:r.minSize.message}),t.dirty()),r.maxSize!==null&&n.data.size>r.maxSize.value&&(W(n,{code:U.too_big,maximum:r.maxSize.value,type:`set`,inclusive:!0,exact:!1,message:r.maxSize.message}),t.dirty());let i=this._def.valueType;function a(e){let n=new Set;for(let r of e){if(r.status===`aborted`)return G;r.status===`dirty`&&t.dirty(),n.add(r.value)}return{status:t.value,value:n}}let o=[...n.data.values()].map((e,t)=>i._parse(new Qr(n,e,n.path,t)));return n.common.async?Promise.all(o).then(e=>a(e)):a(o)}min(t,n){return new e({...this._def,minSize:{value:t,message:K.toString(n)}})}max(t,n){return new e({...this._def,maxSize:{value:t,message:K.toString(n)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};qi.create=(e,t)=>new qi({valueType:e,minSize:null,maxSize:null,typeName:Y.ZodSet,...q(t)});var Ji=class e extends J{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==H.function)return W(t,{code:U.invalid_type,expected:H.function,received:t.parsedType}),G;function n(e,n){return Wr({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Ur(),Vr].filter(e=>!!e),issueData:{code:U.invalid_arguments,argumentsError:n}})}function r(e,n){return Wr({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Ur(),Vr].filter(e=>!!e),issueData:{code:U.invalid_return_type,returnTypeError:n}})}let i={errorMap:t.common.contextualErrorMap},a=t.data;if(this._def.returns instanceof ea){let e=this;return qr(async function(...t){let o=new Br([]),s=await e._def.args.parseAsync(t,i).catch(e=>{throw o.addIssue(n(t,e)),o}),c=await Reflect.apply(a,this,s);return await e._def.returns._def.type.parseAsync(c,i).catch(e=>{throw o.addIssue(r(c,e)),o})})}else{let e=this;return qr(function(...t){let o=e._def.args.safeParse(t,i);if(!o.success)throw new Br([n(t,o.error)]);let s=Reflect.apply(a,this,o.data),c=e._def.returns.safeParse(s,i);if(!c.success)throw new Br([r(s,c.error)]);return c.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e({...this._def,args:Wi.create(t).rest(Ni.create())})}returns(t){return new e({...this._def,returns:t})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(t,n,r){return new e({args:t||Wi.create([]).rest(Ni.create()),returns:n||Ni.create(),typeName:Y.ZodFunction,...q(r)})}},Yi=class extends J{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}};Yi.create=(e,t)=>new Yi({getter:e,typeName:Y.ZodLazy,...q(t)});var Xi=class extends J{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return W(t,{received:t.data,code:U.invalid_literal,expected:this._def.value}),G}return{status:`valid`,value:e.data}}get value(){return this._def.value}};Xi.create=(e,t)=>new Xi({value:e,typeName:Y.ZodLiteral,...q(t)});function Zi(e,t){return new Qi({values:e,typeName:Y.ZodEnum,...q(t)})}var Qi=class e extends J{_parse(e){if(typeof e.data!=`string`){let t=this._getOrReturnCtx(e),n=this._def.values;return W(t,{expected:V.joinValues(n),received:t.parsedType,code:U.invalid_type}),G}if(this._cache||=new Set(this._def.values),!this._cache.has(e.data)){let t=this._getOrReturnCtx(e),n=this._def.values;return W(t,{received:t.data,code:U.invalid_enum_value,options:n}),G}return qr(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}extract(t,n=this._def){return e.create(t,{...this._def,...n})}exclude(t,n=this._def){return e.create(this.options.filter(e=>!t.includes(e)),{...this._def,...n})}};Qi.create=Zi;var $i=class extends J{_parse(e){let t=V.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==H.string&&n.parsedType!==H.number){let e=V.objectValues(t);return W(n,{expected:V.joinValues(e),received:n.parsedType,code:U.invalid_type}),G}if(this._cache||=new Set(V.getValidEnumValues(this._def.values)),!this._cache.has(e.data)){let e=V.objectValues(t);return W(n,{received:n.data,code:U.invalid_enum_value,options:e}),G}return qr(e.data)}get enum(){return this._def.values}};$i.create=(e,t)=>new $i({values:e,typeName:Y.ZodNativeEnum,...q(t)});var ea=class extends J{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);return t.parsedType!==H.promise&&t.common.async===!1?(W(t,{code:U.invalid_type,expected:H.promise,received:t.parsedType}),G):qr((t.parsedType===H.promise?t.data:Promise.resolve(t.data)).then(e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap})))}};ea.create=(e,t)=>new ea({type:e,typeName:Y.ZodPromise,...q(t)});var ta=class extends J{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Y.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:n}=this._processInputParams(e),r=this._def.effect||null,i={addIssue:e=>{W(n,e),e.fatal?t.abort():t.dirty()},get path(){return n.path}};if(i.addIssue=i.addIssue.bind(i),r.type===`preprocess`){let e=r.transform(n.data,i);if(n.common.async)return Promise.resolve(e).then(async e=>{if(t.value===`aborted`)return G;let r=await this._def.schema._parseAsync({data:e,path:n.path,parent:n});return r.status===`aborted`?G:r.status===`dirty`||t.value===`dirty`?Kr(r.value):r});{if(t.value===`aborted`)return G;let r=this._def.schema._parseSync({data:e,path:n.path,parent:n});return r.status===`aborted`?G:r.status===`dirty`||t.value===`dirty`?Kr(r.value):r}}if(r.type===`refinement`){let e=e=>{let t=r.refinement(e,i);if(n.common.async)return Promise.resolve(t);if(t instanceof Promise)throw Error(`Async refinement encountered during synchronous parse operation. Use .parseAsync instead.`);return e};if(n.common.async===!1){let r=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return r.status===`aborted`?G:(r.status===`dirty`&&t.dirty(),e(r.value),{status:t.value,value:r.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(n=>n.status===`aborted`?G:(n.status===`dirty`&&t.dirty(),e(n.value).then(()=>({status:t.value,value:n.value}))))}if(r.type===`transform`)if(n.common.async===!1){let e=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!Xr(e))return G;let a=r.transform(e.value,i);if(a instanceof Promise)throw Error(`Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.`);return{status:t.value,value:a}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(e=>Xr(e)?Promise.resolve(r.transform(e.value,i)).then(e=>({status:t.value,value:e})):G);V.assertNever(r)}};ta.create=(e,t,n)=>new ta({schema:e,typeName:Y.ZodEffects,effect:t,...q(n)}),ta.createWithPreprocess=(e,t,n)=>new ta({schema:t,effect:{type:`preprocess`,transform:e},typeName:Y.ZodEffects,...q(n)});var na=class extends J{_parse(e){return this._getType(e)===H.undefined?qr(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};na.create=(e,t)=>new na({innerType:e,typeName:Y.ZodOptional,...q(t)});var ra=class extends J{_parse(e){return this._getType(e)===H.null?qr(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};ra.create=(e,t)=>new ra({innerType:e,typeName:Y.ZodNullable,...q(t)});var ia=class extends J{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return t.parsedType===H.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};ia.create=(e,t)=>new ia({innerType:e,typeName:Y.ZodDefault,defaultValue:typeof t.default==`function`?t.default:()=>t.default,...q(t)});var aa=class extends J{_parse(e){let{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},r=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return Zr(r)?r.then(e=>({status:`valid`,value:e.status===`valid`?e.value:this._def.catchValue({get error(){return new Br(n.common.issues)},input:n.data})})):{status:`valid`,value:r.status===`valid`?r.value:this._def.catchValue({get error(){return new Br(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};aa.create=(e,t)=>new aa({innerType:e,typeName:Y.ZodCatch,catchValue:typeof t.catch==`function`?t.catch:()=>t.catch,...q(t)});var oa=class extends J{_parse(e){if(this._getType(e)!==H.nan){let t=this._getOrReturnCtx(e);return W(t,{code:U.invalid_type,expected:H.nan,received:t.parsedType}),G}return{status:`valid`,value:e.data}}};oa.create=e=>new oa({typeName:Y.ZodNaN,...q(e)});var sa=class extends J{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}},ca=class e extends J{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{let e=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return e.status===`aborted`?G:e.status===`dirty`?(t.dirty(),Kr(e.value)):this._def.out._parseAsync({data:e.value,path:n.path,parent:n})})();{let e=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return e.status===`aborted`?G:e.status===`dirty`?(t.dirty(),{status:`dirty`,value:e.value}):this._def.out._parseSync({data:e.value,path:n.path,parent:n})}}static create(t,n){return new e({in:t,out:n,typeName:Y.ZodPipeline})}},la=class extends J{_parse(e){let t=this._def.innerType._parse(e),n=e=>(Xr(e)&&(e.value=Object.freeze(e.value)),e);return Zr(t)?t.then(e=>n(e)):n(t)}unwrap(){return this._def.innerType}};la.create=(e,t)=>new la({innerType:e,typeName:Y.ZodReadonly,...q(t)}),Ri.lazycreate;var Y;(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`})(Y||={});let X=Ci.create,ua=Ti.create;oa.create,Ei.create;let da=Di.create;Oi.create,ki.create,Ai.create;let fa=ji.create,pa=Mi.create,ma=Ni.create,ha=Pi.create;Fi.create;let ga=Ii.create,Z=Ri.create;Ri.strictCreate;let _a=zi.create,va=Vi.create,ya=Ui.create,ba=Wi.create,xa=Gi.create;Ki.create,qi.create,Ji.create,Yi.create;let Q=Xi.create,Sa=Qi.create;$i.create,ea.create,ta.create;let $=na.create;ra.create,ta.createWithPreprocess,ca.create;let Ca=`2025-06-18`,wa=[Ca,`2025-03-26`,`2024-11-05`,`2024-10-07`],Ta=_a([X(),ua().int()]),Ea=X(),Da=Z({_meta:$(Z({progressToken:$(Ta)}).passthrough())}).passthrough(),Oa=Z({method:X(),params:$(Da)}),ka=Z({_meta:$(Z({}).passthrough())}).passthrough(),Aa=Z({method:X(),params:$(ka)}),ja=Z({_meta:$(Z({}).passthrough())}).passthrough(),Ma=_a([X(),ua().int()]),Na=Z({jsonrpc:Q(`2.0`),id:Ma}).merge(Oa).strict(),Pa=e=>Na.safeParse(e).success,Fa=Z({jsonrpc:Q(`2.0`)}).merge(Aa).strict(),Ia=e=>Fa.safeParse(e).success,La=Z({jsonrpc:Q(`2.0`),id:Ma,result:ja}).strict(),Ra=e=>La.safeParse(e).success;var za;(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`})(za||={});let Ba=Z({jsonrpc:Q(`2.0`),id:Ma,error:Z({code:ua().int(),message:X(),data:$(ma())})}).strict(),Va=e=>Ba.safeParse(e).success;_a([Na,Fa,La,Ba]);let Ha=ja.strict(),Ua=Aa.extend({method:Q(`notifications/cancelled`),params:ka.extend({requestId:Ma,reason:X().optional()})}),Wa=Z({name:X(),title:$(X())}).passthrough(),Ga=Wa.extend({version:X()}),Ka=Z({experimental:$(Z({}).passthrough()),sampling:$(Z({}).passthrough()),elicitation:$(Z({}).passthrough()),roots:$(Z({listChanged:$(da())}).passthrough())}).passthrough(),qa=Oa.extend({method:Q(`initialize`),params:Da.extend({protocolVersion:X(),capabilities:Ka,clientInfo:Ga})}),Ja=Z({experimental:$(Z({}).passthrough()),logging:$(Z({}).passthrough()),completions:$(Z({}).passthrough()),prompts:$(Z({listChanged:$(da())}).passthrough()),resources:$(Z({subscribe:$(da()),listChanged:$(da())}).passthrough()),tools:$(Z({listChanged:$(da())}).passthrough())}).passthrough(),Ya=ja.extend({protocolVersion:X(),capabilities:Ja,serverInfo:Ga,instructions:$(X())}),Xa=Aa.extend({method:Q(`notifications/initialized`)}),Za=Oa.extend({method:Q(`ping`)}),Qa=Z({progress:ua(),total:$(ua()),message:$(X())}).passthrough(),$a=Aa.extend({method:Q(`notifications/progress`),params:ka.merge(Qa).extend({progressToken:Ta})}),eo=Oa.extend({params:Da.extend({cursor:$(Ea)}).optional()}),to=ja.extend({nextCursor:$(Ea)}),no=Z({uri:X(),mimeType:$(X()),_meta:$(Z({}).passthrough())}).passthrough(),ro=no.extend({text:X()}),io=no.extend({blob:X().base64()}),ao=Wa.extend({uri:X(),description:$(X()),mimeType:$(X()),_meta:$(Z({}).passthrough())}),oo=Wa.extend({uriTemplate:X(),description:$(X()),mimeType:$(X()),_meta:$(Z({}).passthrough())}),so=eo.extend({method:Q(`resources/list`)}),co=to.extend({resources:ga(ao)}),lo=eo.extend({method:Q(`resources/templates/list`)}),uo=to.extend({resourceTemplates:ga(oo)}),fo=Oa.extend({method:Q(`resources/read`),params:Da.extend({uri:X()})}),po=ja.extend({contents:ga(_a([ro,io]))}),mo=Aa.extend({method:Q(`notifications/resources/list_changed`)}),ho=Oa.extend({method:Q(`resources/subscribe`),params:Da.extend({uri:X()})}),go=Oa.extend({method:Q(`resources/unsubscribe`),params:Da.extend({uri:X()})}),_o=Aa.extend({method:Q(`notifications/resources/updated`),params:ka.extend({uri:X()})}),vo=Z({name:X(),description:$(X()),required:$(da())}).passthrough(),yo=Wa.extend({description:$(X()),arguments:$(ga(vo)),_meta:$(Z({}).passthrough())}),bo=eo.extend({method:Q(`prompts/list`)}),xo=to.extend({prompts:ga(yo)}),So=Oa.extend({method:Q(`prompts/get`),params:Da.extend({name:X(),arguments:$(xa(X()))})}),Co=Z({type:Q(`text`),text:X(),_meta:$(Z({}).passthrough())}).passthrough(),wo=Z({type:Q(`image`),data:X().base64(),mimeType:X(),_meta:$(Z({}).passthrough())}).passthrough(),To=Z({type:Q(`audio`),data:X().base64(),mimeType:X(),_meta:$(Z({}).passthrough())}).passthrough(),Eo=Z({type:Q(`resource`),resource:_a([ro,io]),_meta:$(Z({}).passthrough())}).passthrough(),Do=_a([Co,wo,To,ao.extend({type:Q(`resource_link`)}),Eo]),Oo=Z({role:Sa([`user`,`assistant`]),content:Do}).passthrough(),ko=ja.extend({description:$(X()),messages:ga(Oo)}),Ao=Aa.extend({method:Q(`notifications/prompts/list_changed`)}),jo=Z({title:$(X()),readOnlyHint:$(da()),destructiveHint:$(da()),idempotentHint:$(da()),openWorldHint:$(da())}).passthrough(),Mo=Wa.extend({description:$(X()),inputSchema:Z({type:Q(`object`),properties:$(Z({}).passthrough()),required:$(ga(X()))}).passthrough(),outputSchema:$(Z({type:Q(`object`),properties:$(Z({}).passthrough()),required:$(ga(X()))}).passthrough()),annotations:$(jo),_meta:$(Z({}).passthrough())}),No=eo.extend({method:Q(`tools/list`)}),Po=to.extend({tools:ga(Mo)}),Fo=ja.extend({content:ga(Do).default([]),structuredContent:Z({}).passthrough().optional(),isError:$(da())});Fo.or(ja.extend({toolResult:ma()}));let Io=Oa.extend({method:Q(`tools/call`),params:Da.extend({name:X(),arguments:$(xa(ma()))})}),Lo=Aa.extend({method:Q(`notifications/tools/list_changed`)}),Ro=Sa([`debug`,`info`,`notice`,`warning`,`error`,`critical`,`alert`,`emergency`]),zo=Oa.extend({method:Q(`logging/setLevel`),params:Da.extend({level:Ro})}),Bo=Aa.extend({method:Q(`notifications/message`),params:ka.extend({level:Ro,logger:$(X()),data:ma()})}),Vo=Z({hints:$(ga(Z({name:X().optional()}).passthrough())),costPriority:$(ua().min(0).max(1)),speedPriority:$(ua().min(0).max(1)),intelligencePriority:$(ua().min(0).max(1))}).passthrough(),Ho=Z({role:Sa([`user`,`assistant`]),content:_a([Co,wo,To])}).passthrough(),Uo=Oa.extend({method:Q(`sampling/createMessage`),params:Da.extend({messages:ga(Ho),systemPrompt:$(X()),includeContext:$(Sa([`none`,`thisServer`,`allServers`])),temperature:$(ua()),maxTokens:ua().int(),stopSequences:$(ga(X())),metadata:$(Z({}).passthrough()),modelPreferences:$(Vo)})}),Wo=ja.extend({model:X(),stopReason:$(Sa([`endTurn`,`stopSequence`,`maxTokens`]).or(X())),role:Sa([`user`,`assistant`]),content:va(`type`,[Co,wo,To])}),Go=_a([Z({type:Q(`boolean`),title:$(X()),description:$(X()),default:$(da())}).passthrough(),Z({type:Q(`string`),title:$(X()),description:$(X()),minLength:$(ua()),maxLength:$(ua()),format:$(Sa([`email`,`uri`,`date`,`date-time`]))}).passthrough(),Z({type:Sa([`number`,`integer`]),title:$(X()),description:$(X()),minimum:$(ua()),maximum:$(ua())}).passthrough(),Z({type:Q(`string`),title:$(X()),description:$(X()),enum:ga(X()),enumNames:$(ga(X()))}).passthrough()]),Ko=Oa.extend({method:Q(`elicitation/create`),params:Da.extend({message:X(),requestedSchema:Z({type:Q(`object`),properties:xa(X(),Go),required:$(ga(X()))}).passthrough()})}),qo=ja.extend({action:Sa([`accept`,`decline`,`cancel`]),content:$(xa(X(),ma()))}),Jo=Z({type:Q(`ref/resource`),uri:X()}).passthrough(),Yo=Z({type:Q(`ref/prompt`),name:X()}).passthrough(),Xo=Oa.extend({method:Q(`completion/complete`),params:Da.extend({ref:_a([Yo,Jo]),argument:Z({name:X(),value:X()}).passthrough(),context:$(Z({arguments:$(xa(X(),X()))}))})}),Zo=ja.extend({completion:Z({values:ga(X()).max(100),total:$(ua().int()),hasMore:$(da())}).passthrough()}),Qo=Z({uri:X().startsWith(`file://`),name:$(X()),_meta:$(Z({}).passthrough())}).passthrough(),$o=Oa.extend({method:Q(`roots/list`)}),es=ja.extend({roots:ga(Qo)}),ts=Aa.extend({method:Q(`notifications/roots/list_changed`)});_a([Za,qa,Xo,zo,So,bo,so,lo,fo,ho,go,Io,No]),_a([Ua,$a,Xa,ts]),_a([Ha,Wo,qo,es]),_a([Za,Uo,Ko,$o]),_a([Ua,$a,Bo,_o,mo,Lo,Ao]),_a([Ha,Ya,Zo,ko,xo,co,uo,po,Fo,Po]);var ns=class extends Error{constructor(e,t,n){super(`MCP error ${e}: ${t}`),this.code=e,this.data=n,this.name=`McpError`}},rs=class{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.setNotificationHandler(Ua,e=>{this._requestHandlerAbortControllers.get(e.params.requestId)?.abort(e.params.reason)}),this.setNotificationHandler($a,e=>{this._onprogress(e)}),this.setRequestHandler(Za,e=>({}))}_setupTimeout(e,t,n,r,i=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(r,t),startTime:Date.now(),timeout:t,maxTotalTimeout:n,resetTimeoutOnProgress:i,onTimeout:r})}_resetTimeout(e){let t=this._timeoutInfo.get(e);if(!t)return!1;let n=Date.now()-t.startTime;if(t.maxTotalTimeout&&n>=t.maxTotalTimeout)throw this._timeoutInfo.delete(e),new ns(za.RequestTimeout,`Maximum total timeout exceeded`,{maxTotalTimeout:t.maxTotalTimeout,totalElapsed:n});return clearTimeout(t.timeoutId),t.timeoutId=setTimeout(t.onTimeout,t.timeout),!0}_cleanupTimeout(e){let t=this._timeoutInfo.get(e);t&&(clearTimeout(t.timeoutId),this._timeoutInfo.delete(e))}async connect(e){this._transport=e;let t=this.transport?.onclose;this._transport.onclose=()=>{t?.(),this._onclose()};let n=this.transport?.onerror;this._transport.onerror=e=>{n?.(e),this._onerror(e)};let r=this._transport?.onmessage;this._transport.onmessage=(e,t)=>{r?.(e,t),Ra(e)||Va(e)?this._onresponse(e):Pa(e)?this._onrequest(e,t):Ia(e)?this._onnotification(e):this._onerror(Error(`Unknown message type: ${JSON.stringify(e)}`))},await this._transport.start()}_onclose(){var e;let t=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._transport=void 0,(e=this.onclose)==null||e.call(this);let n=new ns(za.ConnectionClosed,`Connection closed`);for(let e of t.values())e(n)}_onerror(e){var t;(t=this.onerror)==null||t.call(this,e)}_onnotification(e){let t=this._notificationHandlers.get(e.method)??this.fallbackNotificationHandler;t!==void 0&&Promise.resolve().then(()=>t(e)).catch(e=>this._onerror(Error(`Uncaught error in notification handler: ${e}`)))}_onrequest(e,t){var n;let r=this._requestHandlers.get(e.method)??this.fallbackRequestHandler;if(r===void 0){(n=this._transport)==null||n.send({jsonrpc:`2.0`,id:e.id,error:{code:za.MethodNotFound,message:`Method not found`}}).catch(e=>this._onerror(Error(`Failed to send an error response: ${e}`)));return}let i=new AbortController;this._requestHandlerAbortControllers.set(e.id,i);let a={signal:i.signal,sessionId:this._transport?.sessionId,_meta:e.params?._meta,sendNotification:t=>this.notification(t,{relatedRequestId:e.id}),sendRequest:(t,n,r)=>this.request(t,n,{...r,relatedRequestId:e.id}),authInfo:t?.authInfo,requestId:e.id,requestInfo:t?.requestInfo};Promise.resolve().then(()=>r(e,a)).then(t=>{if(!i.signal.aborted)return this._transport?.send({result:t,jsonrpc:`2.0`,id:e.id})},t=>{if(!i.signal.aborted)return this._transport?.send({jsonrpc:`2.0`,id:e.id,error:{code:Number.isSafeInteger(t.code)?t.code:za.InternalError,message:t.message??`Internal error`}})}).catch(e=>this._onerror(Error(`Failed to send response: ${e}`))).finally(()=>{this._requestHandlerAbortControllers.delete(e.id)})}_onprogress(e){let{progressToken:t,...n}=e.params,r=Number(t),i=this._progressHandlers.get(r);if(!i){this._onerror(Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}let a=this._responseHandlers.get(r),o=this._timeoutInfo.get(r);if(o&&a&&o.resetTimeoutOnProgress)try{this._resetTimeout(r)}catch(e){a(e);return}i(n)}_onresponse(e){let t=Number(e.id),n=this._responseHandlers.get(t);if(n===void 0){this._onerror(Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}this._responseHandlers.delete(t),this._progressHandlers.delete(t),this._cleanupTimeout(t),Ra(e)?n(e):n(new ns(e.error.code,e.error.message,e.error.data))}get transport(){return this._transport}async close(){await this._transport?.close()}request(e,t,n){let{relatedRequestId:r,resumptionToken:i,onresumptiontoken:a}=n??{};return new Promise((o,s)=>{var c,l;if(!this._transport){s(Error(`Not connected`));return}this._options?.enforceStrictCapabilities===!0&&this.assertCapabilityForMethod(e.method),(c=n?.signal)==null||c.throwIfAborted();let u=this._requestMessageId++,d={...e,jsonrpc:`2.0`,id:u};n?.onprogress&&(this._progressHandlers.set(u,n.onprogress),d.params={...e.params,_meta:{...e.params?._meta||{},progressToken:u}});let f=e=>{var t;this._responseHandlers.delete(u),this._progressHandlers.delete(u),this._cleanupTimeout(u),(t=this._transport)==null||t.send({jsonrpc:`2.0`,method:`notifications/cancelled`,params:{requestId:u,reason:String(e)}},{relatedRequestId:r,resumptionToken:i,onresumptiontoken:a}).catch(e=>this._onerror(Error(`Failed to send cancellation: ${e}`))),s(e)};this._responseHandlers.set(u,e=>{if(!n?.signal?.aborted){if(e instanceof Error)return s(e);try{o(t.parse(e.result))}catch(e){s(e)}}}),(l=n?.signal)==null||l.addEventListener(`abort`,()=>{f(n?.signal?.reason)});let p=n?.timeout??6e4;this._setupTimeout(u,p,n?.maxTotalTimeout,()=>f(new ns(za.RequestTimeout,`Request timed out`,{timeout:p})),n?.resetTimeoutOnProgress??!1),this._transport.send(d,{relatedRequestId:r,resumptionToken:i,onresumptiontoken:a}).catch(e=>{this._cleanupTimeout(u),s(e)})})}async notification(e,t){if(!this._transport)throw Error(`Not connected`);this.assertNotificationCapability(e.method);let n={...e,jsonrpc:`2.0`};await this._transport.send(n,t)}setRequestHandler(e,t){let n=e.shape.method.value;this.assertRequestHandlerCapability(n),this._requestHandlers.set(n,(n,r)=>Promise.resolve(t(e.parse(n),r)))}removeRequestHandler(e){this._requestHandlers.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,t){this._notificationHandlers.set(e.shape.method.value,n=>Promise.resolve(t(e.parse(n))))}removeNotificationHandler(e){this._notificationHandlers.delete(e)}};function is(e,t){return Object.entries(t).reduce((e,[t,n])=>(n&&typeof n==`object`?e[t]=e[t]?{...e[t],...n}:n:e[t]=n,e),{...e})}var as=s(((e,t)=>{
2
+ /** @license URI.js v4.4.1 (c) 2011 Gary Court. License: http://github.com/garycourt/uri-js */
3
+ (function(n,r){typeof e==`object`&&t!==void 0?r(e):typeof define==`function`&&define.amd?define([`exports`],r):r(n.URI=n.URI||{})})(e,(function(e){function t(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];if(t.length>1){t[0]=t[0].slice(0,-1);for(var r=t.length-1,i=1;i<r;++i)t[i]=t[i].slice(1,-1);return t[r]=t[r].slice(1),t.join(``)}else return t[0]}function n(e){return`(?:`+e+`)`}function r(e){return e===void 0?`undefined`:e===null?`null`:Object.prototype.toString.call(e).split(` `).pop().split(`]`).shift().toLowerCase()}function i(e){return e.toUpperCase()}function a(e){return e==null?[]:e instanceof Array?e:typeof e.length!=`number`||e.split||e.setInterval||e.call?[e]:Array.prototype.slice.call(e)}function o(e,t){var n=e;if(t)for(var r in t)n[r]=t[r];return n}function s(e){var r=`[A-Za-z]`,i=`[0-9]`,a=t(i,`[A-Fa-f]`),o=n(n(`%[EFef]`+a+`%`+a+a+`%`+a+a)+`|`+n(`%[89A-Fa-f]`+a+`%`+a+a)+`|`+n(`%`+a+a)),s=`[\\:\\/\\?\\#\\[\\]\\@]`,c=`[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=]`,l=t(s,c),u=e?`[\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]`:`[]`,d=e?`[\\uE000-\\uF8FF]`:`[]`,f=t(r,i,`[\\-\\.\\_\\~]`,u),p=n(r+t(r,i,`[\\+\\-\\.]`)+`*`),m=n(n(o+`|`+t(f,c,`[\\:]`))+`*`);n(n(`25[0-5]`)+`|`+n(`2[0-4]`+i)+`|`+n(`1`+i+i)+`|`+n(`[1-9]`+i)+`|`+i);var h=n(n(`25[0-5]`)+`|`+n(`2[0-4]`+i)+`|`+n(`1`+i+i)+`|`+n(`0?[1-9]`+i)+`|0?0?`+i),g=n(h+`\\.`+h+`\\.`+h+`\\.`+h),_=n(a+`{1,4}`),v=n(n(_+`\\:`+_)+`|`+g),y=n([n(n(_+`\\:`)+`{6}`+v),n(`\\:\\:`+n(_+`\\:`)+`{5}`+v),n(n(_)+`?\\:\\:`+n(_+`\\:`)+`{4}`+v),n(n(n(_+`\\:`)+`{0,1}`+_)+`?\\:\\:`+n(_+`\\:`)+`{3}`+v),n(n(n(_+`\\:`)+`{0,2}`+_)+`?\\:\\:`+n(_+`\\:`)+`{2}`+v),n(n(n(_+`\\:`)+`{0,3}`+_)+`?\\:\\:`+_+`\\:`+v),n(n(n(_+`\\:`)+`{0,4}`+_)+`?\\:\\:`+v),n(n(n(_+`\\:`)+`{0,5}`+_)+`?\\:\\:`+_),n(n(n(_+`\\:`)+`{0,6}`+_)+`?\\:\\:`)].join(`|`)),b=n(n(f+`|`+o)+`+`);n(y+`\\%25`+b);var x=n(y+n(`\\%25|\\%(?!`+a+`{2})`)+b),S=n(`[vV]`+a+`+\\.`+t(f,c,`[\\:]`)+`+`),C=n(`\\[`+n(x+`|`+y+`|`+S)+`\\]`),w=n(n(o+`|`+t(f,c))+`*`),T=n(C+`|`+g+`(?!`+w+`)|`+w),E=n(i+`*`),D=n(n(m+`@`)+`?`+T+n(`\\:`+E)+`?`),O=n(o+`|`+t(f,c,`[\\:\\@]`)),k=n(O+`*`),A=n(O+`+`),ee=n(n(o+`|`+t(f,c,`[\\@]`))+`+`),j=n(n(`\\/`+k)+`*`),M=n(`\\/`+n(A+j)+`?`),N=n(ee+j),P=n(A+j),te=`(?!`+O+`)`;n(j+`|`+M+`|`+N+`|`+P+`|`+te);var F=n(n(O+`|`+t(`[\\/\\?]`,d))+`*`),I=n(n(O+`|[\\/\\?]`)+`*`),L=n(n(`\\/\\/`+D+j)+`|`+M+`|`+P+`|`+te),R=n(p+`\\:`+L+n(`\\?`+F)+`?`+n(`\\#`+I)+`?`),ne=n(n(n(`\\/\\/`+D+j)+`|`+M+`|`+N+`|`+te)+n(`\\?`+F)+`?`+n(`\\#`+I)+`?`);return n(R+`|`+ne),n(p+`\\:`+L+n(`\\?`+F)+`?`),``+p+n(n(`\\/\\/(`+n(`(`+m+`)@`)+`?(`+T+`)`+n(`\\:(`+E+`)`)+`?)`)+`?(`+j+`|`+M+`|`+P+`|`+te+`)`)+n(`\\?(`+F+`)`)+n(`\\#(`+I+`)`),``+n(n(`\\/\\/(`+n(`(`+m+`)@`)+`?(`+T+`)`+n(`\\:(`+E+`)`)+`?)`)+`?(`+j+`|`+M+`|`+N+`|`+te+`)`)+n(`\\?(`+F+`)`)+n(`\\#(`+I+`)`),``+p+n(n(`\\/\\/(`+n(`(`+m+`)@`)+`?(`+T+`)`+n(`\\:(`+E+`)`)+`?)`)+`?(`+j+`|`+M+`|`+P+`|`+te+`)`)+n(`\\?(`+F+`)`),``+n(`\\#(`+I+`)`),``+n(`(`+m+`)@`)+T+n(`\\:(`+E+`)`),{NOT_SCHEME:new RegExp(t(`[^]`,r,i,`[\\+\\-\\.]`),`g`),NOT_USERINFO:new RegExp(t(`[^\\%\\:]`,f,c),`g`),NOT_HOST:new RegExp(t(`[^\\%\\[\\]\\:]`,f,c),`g`),NOT_PATH:new RegExp(t(`[^\\%\\/\\:\\@]`,f,c),`g`),NOT_PATH_NOSCHEME:new RegExp(t(`[^\\%\\/\\@]`,f,c),`g`),NOT_QUERY:new RegExp(t(`[^\\%]`,f,c,`[\\:\\@\\/\\?]`,d),`g`),NOT_FRAGMENT:new RegExp(t(`[^\\%]`,f,c,`[\\:\\@\\/\\?]`),`g`),ESCAPE:new RegExp(t(`[^]`,f,c),`g`),UNRESERVED:new RegExp(f,`g`),OTHER_CHARS:new RegExp(t(`[^\\%]`,f,l),`g`),PCT_ENCODED:new RegExp(o,`g`),IPV4ADDRESS:RegExp(`^(`+g+`)$`),IPV6ADDRESS:RegExp(`^\\[?(`+y+`)`+n(n(`\\%25|\\%(?!`+a+`{2})`)+`(`+b+`)`)+`?\\]?$`)}}var c=s(!1),l=s(!0),u=function(){function e(e,t){var n=[],r=!0,i=!1,a=void 0;try{for(var o=e[Symbol.iterator](),s;!(r=(s=o.next()).done)&&(n.push(s.value),!(t&&n.length===t));r=!0);}catch(e){i=!0,a=e}finally{try{!r&&o.return&&o.return()}finally{if(i)throw a}}return n}return function(t,n){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,n);throw TypeError(`Invalid attempt to destructure non-iterable instance`)}}(),d=function(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}else return Array.from(e)},f=2147483647,p=36,m=1,h=26,g=38,_=700,v=72,y=128,b=`-`,x=/^xn--/,S=/[^\0-\x7E]/,C=/[\x2E\u3002\uFF0E\uFF61]/g,w={overflow:`Overflow: input needs wider integers to process`,"not-basic":`Illegal input >= 0x80 (not a basic code point)`,"invalid-input":`Invalid input`},T=p-m,E=Math.floor,D=String.fromCharCode;function O(e){throw RangeError(w[e])}function k(e,t){for(var n=[],r=e.length;r--;)n[r]=t(e[r]);return n}function A(e,t){var n=e.split(`@`),r=``;n.length>1&&(r=n[0]+`@`,e=n[1]),e=e.replace(C,`.`);var i=k(e.split(`.`),t).join(`.`);return r+i}function ee(e){for(var t=[],n=0,r=e.length;n<r;){var i=e.charCodeAt(n++);if(i>=55296&&i<=56319&&n<r){var a=e.charCodeAt(n++);(a&64512)==56320?t.push(((i&1023)<<10)+(a&1023)+65536):(t.push(i),n--)}else t.push(i)}return t}var j=function(e){return String.fromCodePoint.apply(String,d(e))},M=function(e){return e-48<10?e-22:e-65<26?e-65:e-97<26?e-97:p},N=function(e,t){return e+22+75*(e<26)-((t!=0)<<5)},P=function(e,t,n){var r=0;for(e=n?E(e/_):e>>1,e+=E(e/t);e>T*h>>1;r+=p)e=E(e/T);return E(r+(T+1)*e/(e+g))},te=function(e){var t=[],n=e.length,r=0,i=y,a=v,o=e.lastIndexOf(b);o<0&&(o=0);for(var s=0;s<o;++s)e.charCodeAt(s)>=128&&O(`not-basic`),t.push(e.charCodeAt(s));for(var c=o>0?o+1:0;c<n;){for(var l=r,u=1,d=p;;d+=p){c>=n&&O(`invalid-input`);var g=M(e.charCodeAt(c++));(g>=p||g>E((f-r)/u))&&O(`overflow`),r+=g*u;var _=d<=a?m:d>=a+h?h:d-a;if(g<_)break;var x=p-_;u>E(f/x)&&O(`overflow`),u*=x}var S=t.length+1;a=P(r-l,S,l==0),E(r/S)>f-i&&O(`overflow`),i+=E(r/S),r%=S,t.splice(r++,0,i)}return String.fromCodePoint.apply(String,t)},F=function(e){var t=[];e=ee(e);var n=e.length,r=y,i=0,a=v,o=!0,s=!1,c=void 0;try{for(var l=e[Symbol.iterator](),u;!(o=(u=l.next()).done);o=!0){var d=u.value;d<128&&t.push(D(d))}}catch(e){s=!0,c=e}finally{try{!o&&l.return&&l.return()}finally{if(s)throw c}}var g=t.length,_=g;for(g&&t.push(b);_<n;){var x=f,S=!0,C=!1,w=void 0;try{for(var T=e[Symbol.iterator](),k;!(S=(k=T.next()).done);S=!0){var A=k.value;A>=r&&A<x&&(x=A)}}catch(e){C=!0,w=e}finally{try{!S&&T.return&&T.return()}finally{if(C)throw w}}var j=_+1;x-r>E((f-i)/j)&&O(`overflow`),i+=(x-r)*j,r=x;var M=!0,te=!1,F=void 0;try{for(var I=e[Symbol.iterator](),L;!(M=(L=I.next()).done);M=!0){var R=L.value;if(R<r&&++i>f&&O(`overflow`),R==r){for(var ne=i,re=p;;re+=p){var ie=re<=a?m:re>=a+h?h:re-a;if(ne<ie)break;var ae=ne-ie,oe=p-ie;t.push(D(N(ie+ae%oe,0))),ne=E(ae/oe)}t.push(D(N(ne,0))),a=P(i,j,_==g),i=0,++_}}}catch(e){te=!0,F=e}finally{try{!M&&I.return&&I.return()}finally{if(te)throw F}}++i,++r}return t.join(``)},I={version:`2.1.0`,ucs2:{decode:ee,encode:j},decode:te,encode:F,toASCII:function(e){return A(e,function(e){return S.test(e)?`xn--`+F(e):e})},toUnicode:function(e){return A(e,function(e){return x.test(e)?te(e.slice(4).toLowerCase()):e})}},L={};function R(e){var t=e.charCodeAt(0),n=void 0;return n=t<16?`%0`+t.toString(16).toUpperCase():t<128?`%`+t.toString(16).toUpperCase():t<2048?`%`+(t>>6|192).toString(16).toUpperCase()+`%`+(t&63|128).toString(16).toUpperCase():`%`+(t>>12|224).toString(16).toUpperCase()+`%`+(t>>6&63|128).toString(16).toUpperCase()+`%`+(t&63|128).toString(16).toUpperCase(),n}function ne(e){for(var t=``,n=0,r=e.length;n<r;){var i=parseInt(e.substr(n+1,2),16);if(i<128)t+=String.fromCharCode(i),n+=3;else if(i>=194&&i<224){if(r-n>=6){var a=parseInt(e.substr(n+4,2),16);t+=String.fromCharCode((i&31)<<6|a&63)}else t+=e.substr(n,6);n+=6}else if(i>=224){if(r-n>=9){var o=parseInt(e.substr(n+4,2),16),s=parseInt(e.substr(n+7,2),16);t+=String.fromCharCode((i&15)<<12|(o&63)<<6|s&63)}else t+=e.substr(n,9);n+=9}else t+=e.substr(n,3),n+=3}return t}function re(e,t){function n(e){var n=ne(e);return n.match(t.UNRESERVED)?n:e}return e.scheme&&=String(e.scheme).replace(t.PCT_ENCODED,n).toLowerCase().replace(t.NOT_SCHEME,``),e.userinfo!==void 0&&(e.userinfo=String(e.userinfo).replace(t.PCT_ENCODED,n).replace(t.NOT_USERINFO,R).replace(t.PCT_ENCODED,i)),e.host!==void 0&&(e.host=String(e.host).replace(t.PCT_ENCODED,n).toLowerCase().replace(t.NOT_HOST,R).replace(t.PCT_ENCODED,i)),e.path!==void 0&&(e.path=String(e.path).replace(t.PCT_ENCODED,n).replace(e.scheme?t.NOT_PATH:t.NOT_PATH_NOSCHEME,R).replace(t.PCT_ENCODED,i)),e.query!==void 0&&(e.query=String(e.query).replace(t.PCT_ENCODED,n).replace(t.NOT_QUERY,R).replace(t.PCT_ENCODED,i)),e.fragment!==void 0&&(e.fragment=String(e.fragment).replace(t.PCT_ENCODED,n).replace(t.NOT_FRAGMENT,R).replace(t.PCT_ENCODED,i)),e}function ie(e){return e.replace(/^0*(.*)/,`$1`)||`0`}function ae(e,t){var n=u(e.match(t.IPV4ADDRESS)||[],2)[1];return n?n.split(`.`).map(ie).join(`.`):e}function oe(e,t){var n=u(e.match(t.IPV6ADDRESS)||[],3),r=n[1],i=n[2];if(r){for(var a=u(r.toLowerCase().split(`::`).reverse(),2),o=a[0],s=a[1],c=s?s.split(`:`).map(ie):[],l=o.split(`:`).map(ie),d=t.IPV4ADDRESS.test(l[l.length-1]),f=d?7:8,p=l.length-f,m=Array(f),h=0;h<f;++h)m[h]=c[h]||l[p+h]||``;d&&(m[f-1]=ae(m[f-1],t));var g=m.reduce(function(e,t,n){if(!t||t===`0`){var r=e[e.length-1];r&&r.index+r.length===n?r.length++:e.push({index:n,length:1})}return e},[]).sort(function(e,t){return t.length-e.length})[0],_=void 0;if(g&&g.length>1){var v=m.slice(0,g.index),y=m.slice(g.index+g.length);_=v.join(`:`)+`::`+y.join(`:`)}else _=m.join(`:`);return i&&(_+=`%`+i),_}else return e}var se=/^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i,ce=``.match(/(){0}/)[1]===void 0;function le(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n={},r=t.iri===!1?c:l;t.reference===`suffix`&&(e=(t.scheme?t.scheme+`:`:``)+`//`+e);var i=e.match(se);if(i){ce?(n.scheme=i[1],n.userinfo=i[3],n.host=i[4],n.port=parseInt(i[5],10),n.path=i[6]||``,n.query=i[7],n.fragment=i[8],isNaN(n.port)&&(n.port=i[5])):(n.scheme=i[1]||void 0,n.userinfo=e.indexOf(`@`)===-1?void 0:i[3],n.host=e.indexOf(`//`)===-1?void 0:i[4],n.port=parseInt(i[5],10),n.path=i[6]||``,n.query=e.indexOf(`?`)===-1?void 0:i[7],n.fragment=e.indexOf(`#`)===-1?void 0:i[8],isNaN(n.port)&&(n.port=e.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/)?i[4]:void 0)),n.host&&=oe(ae(n.host,r),r),n.scheme===void 0&&n.userinfo===void 0&&n.host===void 0&&n.port===void 0&&!n.path&&n.query===void 0?n.reference=`same-document`:n.scheme===void 0?n.reference=`relative`:n.fragment===void 0?n.reference=`absolute`:n.reference=`uri`,t.reference&&t.reference!==`suffix`&&t.reference!==n.reference&&(n.error=n.error||`URI is not a `+t.reference+` reference.`);var a=L[(t.scheme||n.scheme||``).toLowerCase()];if(!t.unicodeSupport&&(!a||!a.unicodeSupport)){if(n.host&&(t.domainHost||a&&a.domainHost))try{n.host=I.toASCII(n.host.replace(r.PCT_ENCODED,ne).toLowerCase())}catch(e){n.error=n.error||`Host's domain name can not be converted to ASCII via punycode: `+e}re(n,c)}else re(n,r);a&&a.parse&&a.parse(n,t)}else n.error=n.error||`URI can not be parsed.`;return n}function ue(e,t){var n=t.iri===!1?c:l,r=[];return e.userinfo!==void 0&&(r.push(e.userinfo),r.push(`@`)),e.host!==void 0&&r.push(oe(ae(String(e.host),n),n).replace(n.IPV6ADDRESS,function(e,t,n){return`[`+t+(n?`%25`+n:``)+`]`})),(typeof e.port==`number`||typeof e.port==`string`)&&(r.push(`:`),r.push(String(e.port))),r.length?r.join(``):void 0}var de=/^\.\.?\//,fe=/^\/\.(\/|$)/,pe=/^\/\.\.(\/|$)/,me=/^\/?(?:.|\n)*?(?=\/|$)/;function he(e){for(var t=[];e.length;)if(e.match(de))e=e.replace(de,``);else if(e.match(fe))e=e.replace(fe,`/`);else if(e.match(pe))e=e.replace(pe,`/`),t.pop();else if(e===`.`||e===`..`)e=``;else{var n=e.match(me);if(n){var r=n[0];e=e.slice(r.length),t.push(r)}else throw Error(`Unexpected dot segment condition`)}return t.join(``)}function ge(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=t.iri?l:c,r=[],i=L[(t.scheme||e.scheme||``).toLowerCase()];if(i&&i.serialize&&i.serialize(e,t),e.host&&!n.IPV6ADDRESS.test(e.host)&&(t.domainHost||i&&i.domainHost))try{e.host=t.iri?I.toUnicode(e.host):I.toASCII(e.host.replace(n.PCT_ENCODED,ne).toLowerCase())}catch(n){e.error=e.error||`Host's domain name can not be converted to `+(t.iri?`Unicode`:`ASCII`)+` via punycode: `+n}re(e,n),t.reference!==`suffix`&&e.scheme&&(r.push(e.scheme),r.push(`:`));var a=ue(e,t);if(a!==void 0&&(t.reference!==`suffix`&&r.push(`//`),r.push(a),e.path&&e.path.charAt(0)!==`/`&&r.push(`/`)),e.path!==void 0){var o=e.path;!t.absolutePath&&(!i||!i.absolutePath)&&(o=he(o)),a===void 0&&(o=o.replace(/^\/\//,`/%2F`)),r.push(o)}return e.query!==void 0&&(r.push(`?`),r.push(e.query)),e.fragment!==void 0&&(r.push(`#`),r.push(e.fragment)),r.join(``)}function _e(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},r=arguments[3],i={};return r||(e=le(ge(e,n),n),t=le(ge(t,n),n)),n||={},!n.tolerant&&t.scheme?(i.scheme=t.scheme,i.userinfo=t.userinfo,i.host=t.host,i.port=t.port,i.path=he(t.path||``),i.query=t.query):(t.userinfo!==void 0||t.host!==void 0||t.port!==void 0?(i.userinfo=t.userinfo,i.host=t.host,i.port=t.port,i.path=he(t.path||``),i.query=t.query):(t.path?(t.path.charAt(0)===`/`?i.path=he(t.path):((e.userinfo!==void 0||e.host!==void 0||e.port!==void 0)&&!e.path?i.path=`/`+t.path:e.path?i.path=e.path.slice(0,e.path.lastIndexOf(`/`)+1)+t.path:i.path=t.path,i.path=he(i.path)),i.query=t.query):(i.path=e.path,t.query===void 0?i.query=e.query:i.query=t.query),i.userinfo=e.userinfo,i.host=e.host,i.port=e.port),i.scheme=e.scheme),i.fragment=t.fragment,i}function ve(e,t,n){var r=o({scheme:`null`},n);return ge(_e(le(e,r),le(t,r),r,!0),r)}function ye(e,t){return typeof e==`string`?e=ge(le(e,t),t):r(e)===`object`&&(e=le(ge(e,t),t)),e}function be(e,t,n){return typeof e==`string`?e=ge(le(e,n),n):r(e)===`object`&&(e=ge(e,n)),typeof t==`string`?t=ge(le(t,n),n):r(t)===`object`&&(t=ge(t,n)),e===t}function xe(e,t){return e&&e.toString().replace(!t||!t.iri?c.ESCAPE:l.ESCAPE,R)}function Se(e,t){return e&&e.toString().replace(!t||!t.iri?c.PCT_ENCODED:l.PCT_ENCODED,ne)}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 n=String(e.scheme).toLowerCase()===`https`;return(e.port===(n?443:80)||e.port===``)&&(e.port=void 0),e.path||=`/`,e}},we={scheme:`https`,domainHost:Ce.domainHost,parse:Ce.parse,serialize:Ce.serialize};function Te(e){return typeof e.secure==`boolean`?e.secure:String(e.scheme).toLowerCase()===`wss`}var Ee={scheme:`ws`,domainHost:!0,parse:function(e,t){var n=e;return n.secure=Te(n),n.resourceName=(n.path||`/`)+(n.query?`?`+n.query:``),n.path=void 0,n.query=void 0,n},serialize:function(e,t){if((e.port===(Te(e)?443:80)||e.port===``)&&(e.port=void 0),typeof e.secure==`boolean`&&(e.scheme=e.secure?`wss`:`ws`,e.secure=void 0),e.resourceName){var n=u(e.resourceName.split(`?`),2),r=n[0],i=n[1];e.path=r&&r!==`/`?r:void 0,e.query=i,e.resourceName=void 0}return e.fragment=void 0,e}},De={scheme:`wss`,domainHost:Ee.domainHost,parse:Ee.parse,serialize:Ee.serialize},Oe={},ke=`[A-Za-z0-9\\-\\.\\_\\~\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]`,Ae=`[0-9A-Fa-f]`,je=n(n(`%[EFef]`+Ae+`%`+Ae+Ae+`%`+Ae+Ae)+`|`+n(`%[89A-Fa-f]`+Ae+`%`+Ae+Ae)+`|`+n(`%`+Ae+Ae)),Me="[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]",Ne=t(`[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]`,`[\\"\\\\]`),Pe=`[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]`,Fe=new RegExp(ke,`g`),Ie=new RegExp(je,`g`),Le=new RegExp(t(`[^]`,Me,`[\\.]`,`[\\"]`,Ne),`g`),Re=new RegExp(t(`[^]`,ke,Pe),`g`),ze=Re;function Be(e){var t=ne(e);return t.match(Fe)?t:e}var Ve={scheme:`mailto`,parse:function(e,t){var n=e,r=n.to=n.path?n.path.split(`,`):[];if(n.path=void 0,n.query){for(var i=!1,a={},o=n.query.split(`&`),s=0,c=o.length;s<c;++s){var l=o[s].split(`=`);switch(l[0]){case`to`:for(var u=l[1].split(`,`),d=0,f=u.length;d<f;++d)r.push(u[d]);break;case`subject`:n.subject=Se(l[1],t);break;case`body`:n.body=Se(l[1],t);break;default:i=!0,a[Se(l[0],t)]=Se(l[1],t);break}}i&&(n.headers=a)}n.query=void 0;for(var p=0,m=r.length;p<m;++p){var h=r[p].split(`@`);if(h[0]=Se(h[0]),t.unicodeSupport)h[1]=Se(h[1],t).toLowerCase();else try{h[1]=I.toASCII(Se(h[1],t).toLowerCase())}catch(e){n.error=n.error||`Email address's domain name can not be converted to ASCII via punycode: `+e}r[p]=h.join(`@`)}return n},serialize:function(e,t){var n=e,r=a(e.to);if(r){for(var o=0,s=r.length;o<s;++o){var c=String(r[o]),l=c.lastIndexOf(`@`),u=c.slice(0,l).replace(Ie,Be).replace(Ie,i).replace(Le,R),d=c.slice(l+1);try{d=t.iri?I.toUnicode(d):I.toASCII(Se(d,t).toLowerCase())}catch(e){n.error=n.error||`Email address's domain name can not be converted to `+(t.iri?`Unicode`:`ASCII`)+` via punycode: `+e}r[o]=u+`@`+d}n.path=r.join(`,`)}var f=e.headers=e.headers||{};e.subject&&(f.subject=e.subject),e.body&&(f.body=e.body);var p=[];for(var m in f)f[m]!==Oe[m]&&p.push(m.replace(Ie,Be).replace(Ie,i).replace(Re,R)+`=`+f[m].replace(Ie,Be).replace(Ie,i).replace(ze,R));return p.length&&(n.query=p.join(`&`)),n}},He=/^([^\:]+)\:(.*)/,Ue={scheme:`urn`,parse:function(e,t){var n=e.path&&e.path.match(He),r=e;if(n){var i=t.scheme||r.scheme||`urn`,a=n[1].toLowerCase(),o=n[2],s=L[i+`:`+(t.nid||a)];r.nid=a,r.nss=o,r.path=void 0,s&&(r=s.parse(r,t))}else r.error=r.error||`URN can not be parsed.`;return r},serialize:function(e,t){var n=t.scheme||e.scheme||`urn`,r=e.nid,i=L[n+`:`+(t.nid||r)];i&&(e=i.serialize(e,t));var a=e,o=e.nss;return a.path=(r||t.nid)+`:`+o,a}},We=/^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/,Ge={scheme:`urn:uuid`,parse:function(e,t){var n=e;return n.uuid=n.nss,n.nss=void 0,!t.tolerant&&(!n.uuid||!n.uuid.match(We))&&(n.error=n.error||`UUID is not valid.`),n},serialize:function(e,t){var n=e;return n.nss=(e.uuid||``).toLowerCase(),n}};L[Ce.scheme]=Ce,L[we.scheme]=we,L[Ee.scheme]=Ee,L[De.scheme]=De,L[Ve.scheme]=Ve,L[Ue.scheme]=Ue,L[Ge.scheme]=Ge,e.SCHEMES=L,e.pctEncChar=R,e.pctDecChars=ne,e.parse=le,e.removeDotSegments=he,e.serialize=ge,e.resolveComponents=_e,e.resolve=ve,e.normalize=ye,e.equal=be,e.escapeComponent=xe,e.unescapeComponent=Se,Object.defineProperty(e,`__esModule`,{value:!0})}))})),os=s(((e,t)=>{t.exports=function e(t,n){if(t===n)return!0;if(t&&n&&typeof t==`object`&&typeof n==`object`){if(t.constructor!==n.constructor)return!1;var r,i,a;if(Array.isArray(t)){if(r=t.length,r!=n.length)return!1;for(i=r;i--!==0;)if(!e(t[i],n[i]))return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===n.toString();if(a=Object.keys(t),r=a.length,r!==Object.keys(n).length)return!1;for(i=r;i--!==0;)if(!Object.prototype.hasOwnProperty.call(n,a[i]))return!1;for(i=r;i--!==0;){var o=a[i];if(!e(t[o],n[o]))return!1}return!0}return t!==t&&n!==n}})),ss=s(((e,t)=>{t.exports=function(e){for(var t=0,n=e.length,r=0,i;r<n;)t++,i=e.charCodeAt(r++),i>=55296&&i<=56319&&r<n&&(i=e.charCodeAt(r),(i&64512)==56320&&r++);return t}})),cs=s(((e,t)=>{t.exports={copy:n,checkDataType:r,checkDataTypes:i,coerceToTypes:o,toHash:s,getProperty:u,escapeQuotes:d,equal:os(),ucs2length:ss(),varOccurences:f,varReplace:p,schemaHasRules:m,schemaHasRulesExcept:h,schemaUnknownRules:g,toQuotedString:_,getPathExpr:v,getPath:y,getData:S,unescapeFragment:w,unescapeJsonPointer:D,escapeFragment:T,escapeJsonPointer:E};function n(e,t){for(var n in t||={},e)t[n]=e[n];return t}function r(e,t,n,r){var i=r?` !== `:` === `,a=r?` || `:` && `,o=r?`!`:``,s=r?``:`!`;switch(e){case`null`:return t+i+`null`;case`array`:return o+`Array.isArray(`+t+`)`;case`object`:return`(`+o+t+a+`typeof `+t+i+`"object"`+a+s+`Array.isArray(`+t+`))`;case`integer`:return`(typeof `+t+i+`"number"`+a+s+`(`+t+` % 1)`+a+t+i+t+(n?a+o+`isFinite(`+t+`)`:``)+`)`;case`number`:return`(typeof `+t+i+`"`+e+`"`+(n?a+o+`isFinite(`+t+`)`:``)+`)`;default:return`typeof `+t+i+`"`+e+`"`}}function i(e,t,n){switch(e.length){case 1:return r(e[0],t,n,!0);default:var i=``,a=s(e);for(var o in a.array&&a.object&&(i=a.null?`(`:`(!`+t+` || `,i+=`typeof `+t+` !== "object")`,delete a.null,delete a.array,delete a.object),a.number&&delete a.integer,a)i+=(i?` && `:``)+r(o,t,n,!0);return i}}var a=s([`string`,`number`,`integer`,`boolean`,`null`]);function o(e,t){if(Array.isArray(t)){for(var n=[],r=0;r<t.length;r++){var i=t[r];(a[i]||e===`array`&&i===`array`)&&(n[n.length]=i)}if(n.length)return n}else if(a[t])return[t];else if(e===`array`&&t===`array`)return[`array`]}function s(e){for(var t={},n=0;n<e.length;n++)t[e[n]]=!0;return t}var c=/^[a-z$_][a-z$_0-9]*$/i,l=/'|\\/g;function u(e){return typeof e==`number`?`[`+e+`]`:c.test(e)?`.`+e:`['`+d(e)+`']`}function d(e){return e.replace(l,`\\$&`).replace(/\n/g,`\\n`).replace(/\r/g,`\\r`).replace(/\f/g,`\\f`).replace(/\t/g,`\\t`)}function f(e,t){t+=`[^0-9]`;var n=e.match(new RegExp(t,`g`));return n?n.length:0}function p(e,t,n){return t+=`([^0-9])`,n=n.replace(/\$/g,`$$$$`),e.replace(new RegExp(t,`g`),n+`$1`)}function m(e,t){if(typeof e==`boolean`)return!e;for(var n in e)if(t[n])return!0}function h(e,t,n){if(typeof e==`boolean`)return!e&&n!=`not`;for(var r in e)if(r!=n&&t[r])return!0}function g(e,t){if(typeof e!=`boolean`){for(var n in e)if(!t[n])return n}}function _(e){return`'`+d(e)+`'`}function v(e,t,n,r){return C(e,n?`'/' + `+t+(r?``:`.replace(/~/g, '~0').replace(/\\//g, '~1')`):r?`'[' + `+t+` + ']'`:`'[\\'' + `+t+` + '\\']'`)}function y(e,t,n){return C(e,_(n?`/`+E(t):u(t)))}var b=/^\/(?:[^~]|~0|~1)*$/,x=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function S(e,t,n){var r,i,a,o;if(e===``)return`rootData`;if(e[0]==`/`){if(!b.test(e))throw Error(`Invalid JSON-pointer: `+e);i=e,a=`rootData`}else{if(o=e.match(x),!o)throw Error(`Invalid JSON-pointer: `+e);if(r=+o[1],i=o[2],i==`#`){if(r>=t)throw Error(`Cannot access property/index `+r+` levels up, current level is `+t);return n[t-r]}if(r>t)throw Error(`Cannot access data `+r+` levels up, current level is `+t);if(a=`data`+(t-r||``),!i)return a}for(var s=a,c=i.split(`/`),l=0;l<c.length;l++){var d=c[l];d&&(a+=u(D(d)),s+=` && `+a)}return s}function C(e,t){return e==`""`?t:(e+` + `+t).replace(/([^\\])' \+ '/g,`$1`)}function w(e){return D(decodeURIComponent(e))}function T(e){return encodeURIComponent(E(e))}function E(e){return e.replace(/~/g,`~0`).replace(/\//g,`~1`)}function D(e){return e.replace(/~1/g,`/`).replace(/~0/g,`~`)}})),ls=s(((e,t)=>{var n=cs();t.exports=r;function r(e){n.copy(e,this)}})),us=s(((e,t)=>{var n=t.exports=function(e,t,n){typeof t==`function`&&(n=t,t={}),n=t.cb||n;var i=typeof n==`function`?n:n.pre||function(){},a=n.post||function(){};r(t,i,a,e,``,e)};n.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0},n.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0},n.propsKeywords={definitions:!0,properties:!0,patternProperties:!0,dependencies:!0},n.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0};function r(e,t,a,o,s,c,l,u,d,f){if(o&&typeof o==`object`&&!Array.isArray(o)){for(var p in t(o,s,c,l,u,d,f),o){var m=o[p];if(Array.isArray(m)){if(p in n.arrayKeywords)for(var h=0;h<m.length;h++)r(e,t,a,m[h],s+`/`+p+`/`+h,c,s,p,o,h)}else if(p in n.propsKeywords){if(m&&typeof m==`object`)for(var g in m)r(e,t,a,m[g],s+`/`+p+`/`+i(g),c,s,p,o,g)}else (p in n.keywords||e.allKeys&&!(p in n.skipKeywords))&&r(e,t,a,m,s+`/`+p,c,s,p,o)}a(o,s,c,l,u,d,f)}}function i(e){return e.replace(/~/g,`~0`).replace(/\//g,`~1`)}})),ds=s(((e,t)=>{var n=as(),r=os(),i=cs(),a=ls(),o=us();t.exports=s,s.normalizeId=y,s.fullPath=g,s.url=b,s.ids=x,s.inlineRef=p,s.schema=c;function s(e,t,n){var r=this._refs[n];if(typeof r==`string`)if(this._refs[r])r=this._refs[r];else return s.call(this,e,t,r);if(r||=this._schemas[n],r instanceof a)return p(r.schema,this._opts.inlineRefs)?r.schema:r.validate||this._compile(r);var i=c.call(this,t,n),o,l,u;return i&&(o=i.schema,t=i.root,u=i.baseId),o instanceof a?l=o.validate||e.call(this,o.schema,t,void 0,u):o!==void 0&&(l=p(o,this._opts.inlineRefs)?o:e.call(this,o,t,void 0,u)),l}function c(e,t){var r=n.parse(t),i=_(r),o=g(this._getId(e.schema));if(Object.keys(e.schema).length===0||i!==o){var s=y(i),c=this._refs[s];if(typeof c==`string`)return l.call(this,e,c,r);if(c instanceof a)c.validate||this._compile(c),e=c;else if(c=this._schemas[s],c instanceof a){if(c.validate||this._compile(c),s==y(t))return{schema:c,root:e,baseId:o};e=c}else return;if(!e.schema)return;o=g(this._getId(e.schema))}return d.call(this,r,o,e.schema,e)}function l(e,t,n){var r=c.call(this,e,t);if(r){var i=r.schema,a=r.baseId;e=r.root;var o=this._getId(i);return o&&(a=b(a,o)),d.call(this,n,a,i,e)}}var u=i.toHash([`properties`,`patternProperties`,`enum`,`dependencies`,`definitions`]);function d(e,t,n,r){if(e.fragment=e.fragment||``,e.fragment.slice(0,1)==`/`){for(var a=e.fragment.split(`/`),o=1;o<a.length;o++){var s=a[o];if(s){if(s=i.unescapeFragment(s),n=n[s],n===void 0)break;var l;if(!u[s]&&(l=this._getId(n),l&&(t=b(t,l)),n.$ref)){var d=b(t,n.$ref),f=c.call(this,r,d);f&&(n=f.schema,r=f.root,t=f.baseId)}}}if(n!==void 0&&n!==r.schema)return{schema:n,root:r,baseId:t}}}var f=i.toHash([`type`,`format`,`pattern`,`maxLength`,`minLength`,`maxProperties`,`minProperties`,`maxItems`,`minItems`,`maximum`,`minimum`,`uniqueItems`,`multipleOf`,`required`,`enum`]);function p(e,t){if(t===!1)return!1;if(t===void 0||t===!0)return m(e);if(t)return h(e)<=t}function m(e){var t;if(Array.isArray(e)){for(var n=0;n<e.length;n++)if(t=e[n],typeof t==`object`&&!m(t))return!1}else for(var r in e)if(r==`$ref`||(t=e[r],typeof t==`object`&&!m(t)))return!1;return!0}function h(e){var t=0,n;if(Array.isArray(e)){for(var r=0;r<e.length;r++)if(n=e[r],typeof n==`object`&&(t+=h(n)),t==1/0)return 1/0}else for(var i in e){if(i==`$ref`)return 1/0;if(f[i])t++;else if(n=e[i],typeof n==`object`&&(t+=h(n)+1),t==1/0)return 1/0}return t}function g(e,t){return t!==!1&&(e=y(e)),_(n.parse(e))}function _(e){return n.serialize(e).split(`#`)[0]+`#`}var v=/#\/?$/;function y(e){return e?e.replace(v,``):``}function b(e,t){return t=y(t),n.resolve(e,t)}function x(e){var t=y(this._getId(e)),a={"":t},s={"":g(t,!1)},c={},l=this;return o(e,{allKeys:!0},function(e,t,o,u,d,f,p){if(t!==``){var m=l._getId(e),h=a[u],g=s[u]+`/`+d;if(p!==void 0&&(g+=`/`+(typeof p==`number`?p:i.escapeFragment(p))),typeof m==`string`){m=h=y(h?n.resolve(h,m):m);var _=l._refs[m];if(typeof _==`string`&&(_=l._refs[_]),_&&_.schema){if(!r(e,_.schema))throw Error(`id "`+m+`" resolves to more than one schema`)}else if(m!=y(g))if(m[0]==`#`){if(c[m]&&!r(e,c[m]))throw Error(`id "`+m+`" resolves to more than one schema`);c[m]=e}else l._refs[m]=g}a[t]=h,s[t]=g}}),c}})),fs=s(((e,t)=>{var n=ds();t.exports={Validation:a(r),MissingRef:a(i)};function r(e){this.message=`validation failed`,this.errors=e,this.ajv=this.validation=!0}i.message=function(e,t){return`can't resolve reference `+t+` from id `+e};function i(e,t,r){this.message=r||i.message(e,t),this.missingRef=n.url(e,t),this.missingSchema=n.normalizeId(n.fullPath(this.missingRef))}function a(e){return e.prototype=Object.create(Error.prototype),e.prototype.constructor=e,e}})),ps=s(((e,t)=>{t.exports=function(e,t){t||={},typeof t==`function`&&(t={cmp:t});var n=typeof t.cycles==`boolean`?t.cycles:!1,r=t.cmp&&(function(e){return function(t){return function(n,r){return e({key:n,value:t[n]},{key:r,value:t[r]})}}})(t.cmp),i=[];return(function e(t){if(t&&t.toJSON&&typeof t.toJSON==`function`&&(t=t.toJSON()),t!==void 0){if(typeof t==`number`)return isFinite(t)?``+t:`null`;if(typeof t!=`object`)return JSON.stringify(t);var a,o;if(Array.isArray(t)){for(o=`[`,a=0;a<t.length;a++)a&&(o+=`,`),o+=e(t[a])||`null`;return o+`]`}if(t===null)return`null`;if(i.indexOf(t)!==-1){if(n)return JSON.stringify(`__cycle__`);throw TypeError(`Converting circular structure to JSON`)}var s=i.push(t)-1,c=Object.keys(t).sort(r&&r(t));for(o=``,a=0;a<c.length;a++){var l=c[a],u=e(t[l]);u&&(o&&(o+=`,`),o+=JSON.stringify(l)+`:`+u)}return i.splice(s,1),`{`+o+`}`}})(e)}})),ms=s(((e,t)=>{t.exports=function(e,t,n){var r=``,i=e.schema.$async===!0,a=e.util.schemaHasRulesExcept(e.schema,e.RULES.all,`$ref`),o=e.self._getId(e.schema);if(e.opts.strictKeywords){var s=e.util.schemaUnknownRules(e.schema,e.RULES.keywords);if(s){var c=`unknown keyword: `+s;if(e.opts.strictKeywords===`log`)e.logger.warn(c);else throw Error(c)}}if(e.isTop&&(r+=` var validate = `,i&&(e.async=!0,r+=`async `),r+=`function(data, dataPath, parentData, parentDataProperty, rootData) { 'use strict'; `,o&&(e.opts.sourceCode||e.opts.processCode)&&(r+=` `+(`/*# sourceURL=`+o+` */`)+` `)),typeof e.schema==`boolean`||!(a||e.schema.$ref)){var t=`false schema`,l=e.level,u=e.dataLevel,d=e.schema[t],f=e.schemaPath+e.util.getProperty(t),p=e.errSchemaPath+`/`+t,m=!e.opts.allErrors,h,g=`data`+(u||``),_=`valid`+l;if(e.schema===!1){e.isTop?m=!0:r+=` var `+_+` = false; `;var v=v||[];v.push(r),r=``,e.createErrors===!1?r+=` {} `:(r+=` { keyword: '`+(h||`false schema`)+`' , dataPath: (dataPath || '') + `+e.errorPath+` , schemaPath: `+e.util.toQuotedString(p)+` , params: {} `,e.opts.messages!==!1&&(r+=` , message: 'boolean schema is false' `),e.opts.verbose&&(r+=` , schema: false , parentSchema: validate.schema`+e.schemaPath+` , data: `+g+` `),r+=` } `);var y=r;r=v.pop(),!e.compositeRule&&m?e.async?r+=` throw new ValidationError([`+y+`]); `:r+=` validate.errors = [`+y+`]; return false; `:r+=` var err = `+y+`; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; `}else e.isTop?i?r+=` return data; `:r+=` validate.errors = null; return true; `:r+=` var `+_+` = true; `;return e.isTop&&(r+=` }; return validate; `),r}if(e.isTop){var b=e.isTop,l=e.level=0,u=e.dataLevel=0,g=`data`;if(e.rootId=e.resolve.fullPath(e.self._getId(e.root.schema)),e.baseId=e.baseId||e.rootId,delete e.isTop,e.dataPathArr=[``],e.schema.default!==void 0&&e.opts.useDefaults&&e.opts.strictDefaults){var x=`default is ignored in the schema root`;if(e.opts.strictDefaults===`log`)e.logger.warn(x);else throw Error(x)}r+=` var vErrors = null; `,r+=` var errors = 0; `,r+=` if (rootData === undefined) rootData = data; `}else{var l=e.level,u=e.dataLevel,g=`data`+(u||``);if(o&&(e.baseId=e.resolve.url(e.baseId,o)),i&&!e.async)throw Error(`async schema in sync schema`);r+=` var errs_`+l+` = errors;`}var _=`valid`+l,m=!e.opts.allErrors,S=``,C=``,h,w=e.schema.type,T=Array.isArray(w);if(w&&e.opts.nullable&&e.schema.nullable===!0&&(T?w.indexOf(`null`)==-1&&(w=w.concat(`null`)):w!=`null`&&(w=[w,`null`],T=!0)),T&&w.length==1&&(w=w[0],T=!1),e.schema.$ref&&a){if(e.opts.extendRefs==`fail`)throw Error(`$ref: validation keywords used in schema at path "`+e.errSchemaPath+`" (see option extendRefs)`);e.opts.extendRefs!==!0&&(a=!1,e.logger.warn(`$ref: keywords ignored in schema at path "`+e.errSchemaPath+`"`))}if(e.schema.$comment&&e.opts.$comment&&(r+=` `+e.RULES.all.$comment.code(e,`$comment`)),w){if(e.opts.coerceTypes)var E=e.util.coerceToTypes(e.opts.coerceTypes,w);var D=e.RULES.types[w];if(E||T||D===!0||D&&!me(D)){var f=e.schemaPath+`.type`,p=e.errSchemaPath+`/type`,f=e.schemaPath+`.type`,p=e.errSchemaPath+`/type`,O=T?`checkDataTypes`:`checkDataType`;if(r+=` if (`+e.util[O](w,g,e.opts.strictNumbers,!0)+`) { `,E){var k=`dataType`+l,A=`coerced`+l;r+=` var `+k+` = typeof `+g+`; var `+A+` = undefined; `,e.opts.coerceTypes==`array`&&(r+=` if (`+k+` == 'object' && Array.isArray(`+g+`) && `+g+`.length == 1) { `+g+` = `+g+`[0]; `+k+` = typeof `+g+`; if (`+e.util.checkDataType(e.schema.type,g,e.opts.strictNumbers)+`) `+A+` = `+g+`; } `),r+=` if (`+A+` !== undefined) ; `;var ee=E;if(ee)for(var j,M=-1,N=ee.length-1;M<N;)j=ee[M+=1],j==`string`?r+=` else if (`+k+` == 'number' || `+k+` == 'boolean') `+A+` = '' + `+g+`; else if (`+g+` === null) `+A+` = ''; `:j==`number`||j==`integer`?(r+=` else if (`+k+` == 'boolean' || `+g+` === null || (`+k+` == 'string' && `+g+` && `+g+` == +`+g+` `,j==`integer`&&(r+=` && !(`+g+` % 1)`),r+=`)) `+A+` = +`+g+`; `):j==`boolean`?r+=` else if (`+g+` === 'false' || `+g+` === 0 || `+g+` === null) `+A+` = false; else if (`+g+` === 'true' || `+g+` === 1) `+A+` = true; `:j==`null`?r+=` else if (`+g+` === '' || `+g+` === 0 || `+g+` === false) `+A+` = null; `:e.opts.coerceTypes==`array`&&j==`array`&&(r+=` else if (`+k+` == 'string' || `+k+` == 'number' || `+k+` == 'boolean' || `+g+` == null) `+A+` = [`+g+`]; `);r+=` else { `;var v=v||[];v.push(r),r=``,e.createErrors===!1?r+=` {} `:(r+=` { keyword: '`+(h||`type`)+`' , dataPath: (dataPath || '') + `+e.errorPath+` , schemaPath: `+e.util.toQuotedString(p)+` , params: { type: '`,T?r+=``+w.join(`,`):r+=``+w,r+=`' } `,e.opts.messages!==!1&&(r+=` , message: 'should be `,T?r+=``+w.join(`,`):r+=``+w,r+=`' `),e.opts.verbose&&(r+=` , schema: validate.schema`+f+` , parentSchema: validate.schema`+e.schemaPath+` , data: `+g+` `),r+=` } `);var y=r;r=v.pop(),!e.compositeRule&&m?e.async?r+=` throw new ValidationError([`+y+`]); `:r+=` validate.errors = [`+y+`]; return false; `:r+=` var err = `+y+`; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; `,r+=` } if (`+A+` !== undefined) { `;var P=u?`data`+(u-1||``):`parentData`,te=u?e.dataPathArr[u]:`parentDataProperty`;r+=` `+g+` = `+A+`; `,u||(r+=`if (`+P+` !== undefined)`),r+=` `+P+`[`+te+`] = `+A+`; } `}else{var v=v||[];v.push(r),r=``,e.createErrors===!1?r+=` {} `:(r+=` { keyword: '`+(h||`type`)+`' , dataPath: (dataPath || '') + `+e.errorPath+` , schemaPath: `+e.util.toQuotedString(p)+` , params: { type: '`,T?r+=``+w.join(`,`):r+=``+w,r+=`' } `,e.opts.messages!==!1&&(r+=` , message: 'should be `,T?r+=``+w.join(`,`):r+=``+w,r+=`' `),e.opts.verbose&&(r+=` , schema: validate.schema`+f+` , parentSchema: validate.schema`+e.schemaPath+` , data: `+g+` `),r+=` } `);var y=r;r=v.pop(),!e.compositeRule&&m?e.async?r+=` throw new ValidationError([`+y+`]); `:r+=` validate.errors = [`+y+`]; return false; `:r+=` var err = `+y+`; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; `}r+=` } `}}if(e.schema.$ref&&!a)r+=` `+e.RULES.all.$ref.code(e,`$ref`)+` `,m&&(r+=` } if (errors === `,b?r+=`0`:r+=`errs_`+l,r+=`) { `,C+=`}`);else{var F=e.RULES;if(F){for(var D,I=-1,L=F.length-1;I<L;)if(D=F[I+=1],me(D)){if(D.type&&(r+=` if (`+e.util.checkDataType(D.type,g,e.opts.strictNumbers)+`) { `),e.opts.useDefaults){if(D.type==`object`&&e.schema.properties){var d=e.schema.properties,R=Object.keys(d);if(R)for(var ne,re=-1,ie=R.length-1;re<ie;){ne=R[re+=1];var ae=d[ne];if(ae.default!==void 0){var oe=g+e.util.getProperty(ne);if(e.compositeRule){if(e.opts.strictDefaults){var x=`default is ignored for: `+oe;if(e.opts.strictDefaults===`log`)e.logger.warn(x);else throw Error(x)}}else r+=` if (`+oe+` === undefined `,e.opts.useDefaults==`empty`&&(r+=` || `+oe+` === null || `+oe+` === '' `),r+=` ) `+oe+` = `,e.opts.useDefaults==`shared`?r+=` `+e.useDefault(ae.default)+` `:r+=` `+JSON.stringify(ae.default)+` `,r+=`; `}}}else if(D.type==`array`&&Array.isArray(e.schema.items)){var se=e.schema.items;if(se){for(var ae,M=-1,ce=se.length-1;M<ce;)if(ae=se[M+=1],ae.default!==void 0){var oe=g+`[`+M+`]`;if(e.compositeRule){if(e.opts.strictDefaults){var x=`default is ignored for: `+oe;if(e.opts.strictDefaults===`log`)e.logger.warn(x);else throw Error(x)}}else r+=` if (`+oe+` === undefined `,e.opts.useDefaults==`empty`&&(r+=` || `+oe+` === null || `+oe+` === '' `),r+=` ) `+oe+` = `,e.opts.useDefaults==`shared`?r+=` `+e.useDefault(ae.default)+` `:r+=` `+JSON.stringify(ae.default)+` `,r+=`; `}}}}var le=D.rules;if(le){for(var ue,de=-1,fe=le.length-1;de<fe;)if(ue=le[de+=1],he(ue)){var pe=ue.code(e,ue.keyword,D.type);pe&&(r+=` `+pe+` `,m&&(S+=`}`))}}if(m&&(r+=` `+S+` `,S=``),D.type&&(r+=` } `,w&&w===D.type&&!E)){r+=` else { `;var f=e.schemaPath+`.type`,p=e.errSchemaPath+`/type`,v=v||[];v.push(r),r=``,e.createErrors===!1?r+=` {} `:(r+=` { keyword: '`+(h||`type`)+`' , dataPath: (dataPath || '') + `+e.errorPath+` , schemaPath: `+e.util.toQuotedString(p)+` , params: { type: '`,T?r+=``+w.join(`,`):r+=``+w,r+=`' } `,e.opts.messages!==!1&&(r+=` , message: 'should be `,T?r+=``+w.join(`,`):r+=``+w,r+=`' `),e.opts.verbose&&(r+=` , schema: validate.schema`+f+` , parentSchema: validate.schema`+e.schemaPath+` , data: `+g+` `),r+=` } `);var y=r;r=v.pop(),!e.compositeRule&&m?e.async?r+=` throw new ValidationError([`+y+`]); `:r+=` validate.errors = [`+y+`]; return false; `:r+=` var err = `+y+`; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; `,r+=` } `}m&&(r+=` if (errors === `,b?r+=`0`:r+=`errs_`+l,r+=`) { `,C+=`}`)}}}m&&(r+=` `+C+` `),b?(i?(r+=` if (errors === 0) return data; `,r+=` else throw new ValidationError(vErrors); `):(r+=` validate.errors = vErrors; `,r+=` return errors === 0; `),r+=` }; return validate;`):r+=` var `+_+` = errors === errs_`+l+`;`;function me(e){for(var t=e.rules,n=0;n<t.length;n++)if(he(t[n]))return!0}function he(t){return e.schema[t.keyword]!==void 0||t.implements&&ge(t)}function ge(t){for(var n=t.implements,r=0;r<n.length;r++)if(e.schema[n[r]]!==void 0)return!0}return r}})),hs=s(((e,t)=>{var n=ds(),r=cs(),i=fs(),a=ps(),o=ms(),s=r.ucs2length,c=os(),l=i.Validation;t.exports=u;function u(e,t,p,y){var b=this,x=this._opts,S=[void 0],C={},w=[],T={},E=[],D={},O=[];t||={schema:e,refVal:S,refs:C};var k=d.call(this,e,t,y),A=this._compilations[k.index];if(k.compiling)return A.callValidate=P;var ee=this._formats,j=this.RULES;try{var M=te(e,t,p,y);A.validate=M;var N=A.callValidate;return N&&(N.schema=M.schema,N.errors=null,N.refs=M.refs,N.refVal=M.refVal,N.root=M.root,N.$async=M.$async,x.sourceCode&&(N.source=M.source)),M}finally{f.call(this,e,t,y)}function P(){var e=A.validate,t=e.apply(this,arguments);return P.errors=e.errors,t}function te(e,a,d,f){var p=!a||a&&a.schema==e;if(a.schema!=t.schema)return u.call(b,e,a,d,f);var y=e.$async===!0,T=o({isTop:!0,schema:e,isRoot:p,baseId:f,root:a,schemaPath:``,errSchemaPath:`#`,errorPath:`""`,MissingRefError:i.MissingRef,RULES:j,validate:o,util:r,resolve:n,resolveRef:F,usePattern:re,useDefault:ie,useCustomRule:ae,opts:x,formats:ee,logger:b.logger,self:b});T=v(S,g)+v(w,m)+v(E,h)+v(O,_)+T,x.processCode&&(T=x.processCode(T,e));var D;try{D=Function(`self`,`RULES`,`formats`,`root`,`refVal`,`defaults`,`customRules`,`equal`,`ucs2length`,`ValidationError`,T)(b,j,ee,t,S,E,O,c,s,l),S[0]=D}catch(e){throw b.logger.error(`Error compiling schema, function code:`,T),e}return D.schema=e,D.errors=null,D.refs=C,D.refVal=S,D.root=p?D:a,y&&(D.$async=!0),x.sourceCode===!0&&(D.source={code:T,patterns:w,defaults:E}),D}function F(e,r,i){r=n.url(e,r);var a=C[r],o,s;if(a!==void 0)return o=S[a],s=`refVal[`+a+`]`,ne(o,s);if(!i&&t.refs){var c=t.refs[r];if(c!==void 0)return o=t.refVal[c],s=I(r,o),ne(o,s)}s=I(r);var l=n.call(b,te,t,r);if(l===void 0){var d=p&&p[r];d&&(l=n.inlineRef(d,x.inlineRefs)?d:u.call(b,d,t,p,e))}if(l===void 0)L(r);else return R(r,l),ne(l,s)}function I(e,t){var n=S.length;return S[n]=t,C[e]=n,`refVal`+n}function L(e){delete C[e]}function R(e,t){var n=C[e];S[n]=t}function ne(e,t){return typeof e==`object`||typeof e==`boolean`?{code:t,schema:e,inline:!0}:{code:t,$async:e&&!!e.$async}}function re(e){var t=T[e];return t===void 0&&(t=T[e]=w.length,w[t]=e),`pattern`+t}function ie(e){switch(typeof e){case`boolean`:case`number`:return``+e;case`string`:return r.toQuotedString(e);case`object`:if(e===null)return`null`;var t=a(e),n=D[t];return n===void 0&&(n=D[t]=E.length,E[n]=e),`default`+n}}function ae(e,t,n,r){if(b._opts.validateSchema!==!1){var i=e.definition.dependencies;if(i&&!i.every(function(e){return Object.prototype.hasOwnProperty.call(n,e)}))throw Error(`parent schema must have all required keywords: `+i.join(`,`));var a=e.definition.validateSchema;if(a&&!a(t)){var o=`keyword schema is invalid: `+b.errorsText(a.errors);if(b._opts.validateSchema==`log`)b.logger.error(o);else throw Error(o)}}var s=e.definition.compile,c=e.definition.inline,l=e.definition.macro,u;if(s)u=s.call(b,t,n,r);else if(l)u=l.call(b,t,n,r),x.validateSchema!==!1&&b.validateSchema(u,!0);else if(c)u=c.call(b,r,e.keyword,t,n);else if(u=e.definition.validate,!u)return;if(u===void 0)throw Error(`custom keyword "`+e.keyword+`"failed to compile`);var d=O.length;return O[d]=u,{code:`customRule`+d,validate:u}}}function d(e,t,n){var r=p.call(this,e,t,n);return r>=0?{index:r,compiling:!0}:(r=this._compilations.length,this._compilations[r]={schema:e,root:t,baseId:n},{index:r,compiling:!1})}function f(e,t,n){var r=p.call(this,e,t,n);r>=0&&this._compilations.splice(r,1)}function p(e,t,n){for(var r=0;r<this._compilations.length;r++){var i=this._compilations[r];if(i.schema==e&&i.root==t&&i.baseId==n)return r}return-1}function m(e,t){return`var pattern`+e+` = new RegExp(`+r.toQuotedString(t[e])+`);`}function h(e){return`var default`+e+` = defaults[`+e+`];`}function g(e,t){return t[e]===void 0?``:`var refVal`+e+` = refVal[`+e+`];`}function _(e){return`var customRule`+e+` = customRules[`+e+`];`}function v(e,t){if(!e.length)return``;for(var n=``,r=0;r<e.length;r++)n+=t(r,e);return n}})),gs=s(((e,t)=>{var n=t.exports=function(){this._cache={}};n.prototype.put=function(e,t){this._cache[e]=t},n.prototype.get=function(e){return this._cache[e]},n.prototype.del=function(e){delete this._cache[e]},n.prototype.clear=function(){this._cache={}}})),_s=s(((e,t)=>{var n=cs(),r=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,i=[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,o=/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,s=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,c=/^(?:[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,l=/^(?:(?:[^\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,u=/^(?:(?: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,f=/^(?:\/(?:[^~/]|~0|~1)*)*$/,p=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,m=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/;t.exports=h;function h(e){return e=e==`full`?`full`:`fast`,n.copy(h[e])}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":l,url:u,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:o,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:w,uuid:d,"json-pointer":f,"json-pointer-uri-fragment":p,"relative-json-pointer":m},h.full={date:_,time:v,"date-time":b,uri:S,"uri-reference":c,"uri-template":l,url:u,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:o,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:w,uuid:d,"json-pointer":f,"json-pointer-uri-fragment":p,"relative-json-pointer":m};function g(e){return e%4==0&&(e%100!=0||e%400==0)}function _(e){var t=e.match(r);if(!t)return!1;var n=+t[1],a=+t[2],o=+t[3];return a>=1&&a<=12&&o>=1&&o<=(a==2&&g(n)?29:i[a])}function v(e,t){var n=e.match(a);if(!n)return!1;var r=n[1],i=n[2],o=n[3],s=n[5];return(r<=23&&i<=59&&o<=59||r==23&&i==59&&o==60)&&(!t||s)}var y=/t|\s/i;function b(e){var t=e.split(y);return t.length==2&&_(t[0])&&v(t[1],!0)}var x=/\/|:/;function S(e){return x.test(e)&&s.test(e)}var C=/[^\\]\\Z/;function w(e){if(C.test(e))return!1;try{return new RegExp(e),!0}catch{return!1}}})),vs=s(((e,t)=>{t.exports=function(e,t,n){var r=` `,i=e.level,a=e.dataLevel,o=e.schema[t],s=e.errSchemaPath+`/`+t,c=!e.opts.allErrors,l=`data`+(a||``),u=`valid`+i,d,f;if(o==`#`||o==`#/`)e.isRoot?(d=e.async,f=`validate`):(d=e.root.schema.$async===!0,f=`root.refVal[0]`);else{var p=e.resolveRef(e.baseId,o,e.isRoot);if(p===void 0){var m=e.MissingRefError.message(e.baseId,o);if(e.opts.missingRefs==`fail`){e.logger.error(m);var h=h||[];h.push(r),r=``,e.createErrors===!1?r+=` {} `:(r+=` { keyword: '$ref' , dataPath: (dataPath || '') + `+e.errorPath+` , schemaPath: `+e.util.toQuotedString(s)+` , params: { ref: '`+e.util.escapeQuotes(o)+`' } `,e.opts.messages!==!1&&(r+=` , message: 'can\\'t resolve reference `+e.util.escapeQuotes(o)+`' `),e.opts.verbose&&(r+=` , schema: `+e.util.toQuotedString(o)+` , parentSchema: validate.schema`+e.schemaPath+` , data: `+l+` `),r+=` } `);var g=r;r=h.pop(),!e.compositeRule&&c?e.async?r+=` throw new ValidationError([`+g+`]); `:r+=` validate.errors = [`+g+`]; return false; `:r+=` var err = `+g+`; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; `,c&&(r+=` if (false) { `)}else if(e.opts.missingRefs==`ignore`)e.logger.warn(m),c&&(r+=` if (true) { `);else throw new e.MissingRefError(e.baseId,o,m)}else if(p.inline){var _=e.util.copy(e);_.level++;var v=`valid`+_.level;_.schema=p.schema,_.schemaPath=``,_.errSchemaPath=o;var y=e.validate(_).replace(/validate\.schema/g,p.code);r+=` `+y+` `,c&&(r+=` if (`+v+`) { `)}else d=p.$async===!0||e.async&&p.$async!==!1,f=p.code}if(f){var h=h||[];h.push(r),r=``,e.opts.passContext?r+=` `+f+`.call(this, `:r+=` `+f+`( `,r+=` `+l+`, (dataPath || '')`,e.errorPath!=`""`&&(r+=` + `+e.errorPath);var b=a?`data`+(a-1||``):`parentData`,x=a?e.dataPathArr[a]:`parentDataProperty`;r+=` , `+b+` , `+x+`, rootData) `;var S=r;if(r=h.pop(),d){if(!e.async)throw Error(`async schema referenced by sync schema`);c&&(r+=` var `+u+`; `),r+=` try { await `+S+`; `,c&&(r+=` `+u+` = true; `),r+=` } catch (e) { if (!(e instanceof ValidationError)) throw e; if (vErrors === null) vErrors = e.errors; else vErrors = vErrors.concat(e.errors); errors = vErrors.length; `,c&&(r+=` `+u+` = false; `),r+=` } `,c&&(r+=` if (`+u+`) { `)}else r+=` if (!`+S+`) { if (vErrors === null) vErrors = `+f+`.errors; else vErrors = vErrors.concat(`+f+`.errors); errors = vErrors.length; } `,c&&(r+=` else { `)}return r}})),ys=s(((e,t)=>{t.exports=function(e,t,n){var r=` `,i=e.schema[t],a=e.schemaPath+e.util.getProperty(t),o=e.errSchemaPath+`/`+t,s=!e.opts.allErrors,c=e.util.copy(e),l=``;c.level++;var u=`valid`+c.level,d=c.baseId,f=!0,p=i;if(p)for(var m,h=-1,g=p.length-1;h<g;)m=p[h+=1],(e.opts.strictKeywords?typeof m==`object`&&Object.keys(m).length>0||m===!1:e.util.schemaHasRules(m,e.RULES.all))&&(f=!1,c.schema=m,c.schemaPath=a+`[`+h+`]`,c.errSchemaPath=o+`/`+h,r+=` `+e.validate(c)+` `,c.baseId=d,s&&(r+=` if (`+u+`) { `,l+=`}`));return s&&(f?r+=` if (true) { `:r+=` `+l.slice(0,-1)+` `),r}})),bs=s(((e,t)=>{t.exports=function(e,t,n){var r=` `,i=e.level,a=e.dataLevel,o=e.schema[t],s=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+`/`+t,l=!e.opts.allErrors,u=`data`+(a||``),d=`valid`+i,f=`errs__`+i,p=e.util.copy(e),m=``;p.level++;var h=`valid`+p.level;if(o.every(function(t){return e.opts.strictKeywords?typeof t==`object`&&Object.keys(t).length>0||t===!1:e.util.schemaHasRules(t,e.RULES.all)})){var g=p.baseId;r+=` var `+f+` = errors; var `+d+` = false; `;var _=e.compositeRule;e.compositeRule=p.compositeRule=!0;var v=o;if(v)for(var y,b=-1,x=v.length-1;b<x;)y=v[b+=1],p.schema=y,p.schemaPath=s+`[`+b+`]`,p.errSchemaPath=c+`/`+b,r+=` `+e.validate(p)+` `,p.baseId=g,r+=` `+d+` = `+d+` || `+h+`; if (!`+d+`) { `,m+=`}`;e.compositeRule=p.compositeRule=_,r+=` `+m+` if (!`+d+`) { var err = `,e.createErrors===!1?r+=` {} `:(r+=` { keyword: 'anyOf' , dataPath: (dataPath || '') + `+e.errorPath+` , schemaPath: `+e.util.toQuotedString(c)+` , params: {} `,e.opts.messages!==!1&&(r+=` , message: 'should match some schema in anyOf' `),e.opts.verbose&&(r+=` , schema: validate.schema`+s+` , parentSchema: validate.schema`+e.schemaPath+` , data: `+u+` `),r+=` } `),r+=`; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; `,!e.compositeRule&&l&&(e.async?r+=` throw new ValidationError(vErrors); `:r+=` validate.errors = vErrors; return false; `),r+=` } else { errors = `+f+`; if (vErrors !== null) { if (`+f+`) vErrors.length = `+f+`; else vErrors = null; } `,e.opts.allErrors&&(r+=` } `)}else l&&(r+=` if (true) { `);return r}})),xs=s(((e,t)=>{t.exports=function(e,t,n){var r=` `,i=e.schema[t],a=e.errSchemaPath+`/`+t;e.opts.allErrors;var o=e.util.toQuotedString(i);return e.opts.$comment===!0?r+=` console.log(`+o+`);`:typeof e.opts.$comment==`function`&&(r+=` self._opts.$comment(`+o+`, `+e.util.toQuotedString(a)+`, validate.root.schema);`),r}})),Ss=s(((e,t)=>{t.exports=function(e,t,n){var r=` `,i=e.level,a=e.dataLevel,o=e.schema[t],s=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+`/`+t,l=!e.opts.allErrors,u=`data`+(a||``),d=`valid`+i,f=e.opts.$data&&o&&o.$data;f&&(r+=` var schema`+i+` = `+e.util.getData(o.$data,a,e.dataPathArr)+`; `,``+i),f||(r+=` var schema`+i+` = validate.schema`+s+`;`),r+=`var `+d+` = equal(`+u+`, schema`+i+`); if (!`+d+`) { `;var p=p||[];p.push(r),r=``,e.createErrors===!1?r+=` {} `:(r+=` { keyword: 'const' , dataPath: (dataPath || '') + `+e.errorPath+` , schemaPath: `+e.util.toQuotedString(c)+` , params: { allowedValue: schema`+i+` } `,e.opts.messages!==!1&&(r+=` , message: 'should be equal to constant' `),e.opts.verbose&&(r+=` , schema: validate.schema`+s+` , parentSchema: validate.schema`+e.schemaPath+` , data: `+u+` `),r+=` } `);var m=r;return r=p.pop(),!e.compositeRule&&l?e.async?r+=` throw new ValidationError([`+m+`]); `:r+=` validate.errors = [`+m+`]; return false; `:r+=` var err = `+m+`; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; `,r+=` }`,l&&(r+=` else { `),r}})),Cs=s(((e,t)=>{t.exports=function(e,t,n){var r=` `,i=e.level,a=e.dataLevel,o=e.schema[t],s=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+`/`+t,l=!e.opts.allErrors,u=`data`+(a||``),d=`valid`+i,f=`errs__`+i,p=e.util.copy(e),m=``;p.level++;var h=`valid`+p.level,g=`i`+i,_=p.dataLevel=e.dataLevel+1,v=`data`+_,y=e.baseId,b=e.opts.strictKeywords?typeof o==`object`&&Object.keys(o).length>0||o===!1:e.util.schemaHasRules(o,e.RULES.all);if(r+=`var `+f+` = errors;var `+d+`;`,b){var x=e.compositeRule;e.compositeRule=p.compositeRule=!0,p.schema=o,p.schemaPath=s,p.errSchemaPath=c,r+=` var `+h+` = false; for (var `+g+` = 0; `+g+` < `+u+`.length; `+g+`++) { `,p.errorPath=e.util.getPathExpr(e.errorPath,g,e.opts.jsonPointers,!0);var S=u+`[`+g+`]`;p.dataPathArr[_]=g;var C=e.validate(p);p.baseId=y,e.util.varOccurences(C,v)<2?r+=` `+e.util.varReplace(C,v,S)+` `:r+=` var `+v+` = `+S+`; `+C+` `,r+=` if (`+h+`) break; } `,e.compositeRule=p.compositeRule=x,r+=` `+m+` if (!`+h+`) {`}else r+=` if (`+u+`.length == 0) {`;var w=w||[];w.push(r),r=``,e.createErrors===!1?r+=` {} `:(r+=` { keyword: 'contains' , dataPath: (dataPath || '') + `+e.errorPath+` , schemaPath: `+e.util.toQuotedString(c)+` , params: {} `,e.opts.messages!==!1&&(r+=` , message: 'should contain a valid item' `),e.opts.verbose&&(r+=` , schema: validate.schema`+s+` , parentSchema: validate.schema`+e.schemaPath+` , data: `+u+` `),r+=` } `);var T=r;return r=w.pop(),!e.compositeRule&&l?e.async?r+=` throw new ValidationError([`+T+`]); `:r+=` validate.errors = [`+T+`]; return false; `:r+=` var err = `+T+`; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; `,r+=` } else { `,b&&(r+=` errors = `+f+`; if (vErrors !== null) { if (`+f+`) vErrors.length = `+f+`; else vErrors = null; } `),e.opts.allErrors&&(r+=` } `),r}})),ws=s(((e,t)=>{t.exports=function(e,t,n){var r=` `,i=e.level,a=e.dataLevel,o=e.schema[t],s=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+`/`+t,l=!e.opts.allErrors,u=`data`+(a||``),d=`errs__`+i,f=e.util.copy(e),p=``;f.level++;var m=`valid`+f.level,h={},g={},_=e.opts.ownProperties;for(x in o)if(x!=`__proto__`){var v=o[x],y=Array.isArray(v)?g:h;y[x]=v}r+=`var `+d+` = errors;`;var b=e.errorPath;for(var x in r+=`var missing`+i+`;`,g)if(y=g[x],y.length){if(r+=` if ( `+u+e.util.getProperty(x)+` !== undefined `,_&&(r+=` && Object.prototype.hasOwnProperty.call(`+u+`, '`+e.util.escapeQuotes(x)+`') `),l){r+=` && ( `;var S=y;if(S)for(var C,w=-1,T=S.length-1;w<T;){C=S[w+=1],w&&(r+=` || `);var E=e.util.getProperty(C),D=u+E;r+=` ( ( `+D+` === undefined `,_&&(r+=` || ! Object.prototype.hasOwnProperty.call(`+u+`, '`+e.util.escapeQuotes(C)+`') `),r+=`) && (missing`+i+` = `+e.util.toQuotedString(e.opts.jsonPointers?C:E)+`) ) `}r+=`)) { `;var O=`missing`+i,k=`' + `+O+` + '`;e.opts._errorDataPathProperty&&(e.errorPath=e.opts.jsonPointers?e.util.getPathExpr(b,O,!0):b+` + `+O);var A=A||[];A.push(r),r=``,e.createErrors===!1?r+=` {} `:(r+=` { keyword: 'dependencies' , dataPath: (dataPath || '') + `+e.errorPath+` , schemaPath: `+e.util.toQuotedString(c)+` , params: { property: '`+e.util.escapeQuotes(x)+`', missingProperty: '`+k+`', depsCount: `+y.length+`, deps: '`+e.util.escapeQuotes(y.length==1?y[0]:y.join(`, `))+`' } `,e.opts.messages!==!1&&(r+=` , message: 'should have `,y.length==1?r+=`property `+e.util.escapeQuotes(y[0]):r+=`properties `+e.util.escapeQuotes(y.join(`, `)),r+=` when property `+e.util.escapeQuotes(x)+` is present' `),e.opts.verbose&&(r+=` , schema: validate.schema`+s+` , parentSchema: validate.schema`+e.schemaPath+` , data: `+u+` `),r+=` } `);var ee=r;r=A.pop(),!e.compositeRule&&l?e.async?r+=` throw new ValidationError([`+ee+`]); `:r+=` validate.errors = [`+ee+`]; return false; `:r+=` var err = `+ee+`; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; `}else{r+=` ) { `;var j=y;if(j)for(var C,M=-1,N=j.length-1;M<N;){C=j[M+=1];var E=e.util.getProperty(C),k=e.util.escapeQuotes(C),D=u+E;e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPath(b,C,e.opts.jsonPointers)),r+=` if ( `+D+` === undefined `,_&&(r+=` || ! Object.prototype.hasOwnProperty.call(`+u+`, '`+e.util.escapeQuotes(C)+`') `),r+=`) { var err = `,e.createErrors===!1?r+=` {} `:(r+=` { keyword: 'dependencies' , dataPath: (dataPath || '') + `+e.errorPath+` , schemaPath: `+e.util.toQuotedString(c)+` , params: { property: '`+e.util.escapeQuotes(x)+`', missingProperty: '`+k+`', depsCount: `+y.length+`, deps: '`+e.util.escapeQuotes(y.length==1?y[0]:y.join(`, `))+`' } `,e.opts.messages!==!1&&(r+=` , message: 'should have `,y.length==1?r+=`property `+e.util.escapeQuotes(y[0]):r+=`properties `+e.util.escapeQuotes(y.join(`, `)),r+=` when property `+e.util.escapeQuotes(x)+` is present' `),e.opts.verbose&&(r+=` , schema: validate.schema`+s+` , parentSchema: validate.schema`+e.schemaPath+` , data: `+u+` `),r+=` } `),r+=`; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } `}}r+=` } `,l&&(p+=`}`,r+=` else { `)}e.errorPath=b;var P=f.baseId;for(var x in h){var v=h[x];(e.opts.strictKeywords?typeof v==`object`&&Object.keys(v).length>0||v===!1:e.util.schemaHasRules(v,e.RULES.all))&&(r+=` `+m+` = true; if ( `+u+e.util.getProperty(x)+` !== undefined `,_&&(r+=` && Object.prototype.hasOwnProperty.call(`+u+`, '`+e.util.escapeQuotes(x)+`') `),r+=`) { `,f.schema=v,f.schemaPath=s+e.util.getProperty(x),f.errSchemaPath=c+`/`+e.util.escapeFragment(x),r+=` `+e.validate(f)+` `,f.baseId=P,r+=` } `,l&&(r+=` if (`+m+`) { `,p+=`}`))}return l&&(r+=` `+p+` if (`+d+` == errors) {`),r}})),Ts=s(((e,t)=>{t.exports=function(e,t,n){var r=` `,i=e.level,a=e.dataLevel,o=e.schema[t],s=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+`/`+t,l=!e.opts.allErrors,u=`data`+(a||``),d=`valid`+i,f=e.opts.$data&&o&&o.$data;f&&(r+=` var schema`+i+` = `+e.util.getData(o.$data,a,e.dataPathArr)+`; `,``+i);var p=`i`+i,m=`schema`+i;f||(r+=` var `+m+` = validate.schema`+s+`;`),r+=`var `+d+`;`,f&&(r+=` if (schema`+i+` === undefined) `+d+` = true; else if (!Array.isArray(schema`+i+`)) `+d+` = false; else {`),r+=``+d+` = false;for (var `+p+`=0; `+p+`<`+m+`.length; `+p+`++) if (equal(`+u+`, `+m+`[`+p+`])) { `+d+` = true; break; }`,f&&(r+=` } `),r+=` if (!`+d+`) { `;var h=h||[];h.push(r),r=``,e.createErrors===!1?r+=` {} `:(r+=` { keyword: 'enum' , dataPath: (dataPath || '') + `+e.errorPath+` , schemaPath: `+e.util.toQuotedString(c)+` , params: { allowedValues: schema`+i+` } `,e.opts.messages!==!1&&(r+=` , message: 'should be equal to one of the allowed values' `),e.opts.verbose&&(r+=` , schema: validate.schema`+s+` , parentSchema: validate.schema`+e.schemaPath+` , data: `+u+` `),r+=` } `);var g=r;return r=h.pop(),!e.compositeRule&&l?e.async?r+=` throw new ValidationError([`+g+`]); `:r+=` validate.errors = [`+g+`]; return false; `:r+=` var err = `+g+`; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; `,r+=` }`,l&&(r+=` else { `),r}})),Es=s(((e,t)=>{t.exports=function(e,t,n){var r=` `,i=e.level,a=e.dataLevel,o=e.schema[t],s=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+`/`+t,l=!e.opts.allErrors,u=`data`+(a||``);if(e.opts.format===!1)return l&&(r+=` if (true) { `),r;var d=e.opts.$data&&o&&o.$data,f;d?(r+=` var schema`+i+` = `+e.util.getData(o.$data,a,e.dataPathArr)+`; `,f=`schema`+i):f=o;var p=e.opts.unknownFormats,m=Array.isArray(p);if(d){var h=`format`+i,g=`isObject`+i,_=`formatType`+i;r+=` var `+h+` = formats[`+f+`]; var `+g+` = typeof `+h+` == 'object' && !(`+h+` instanceof RegExp) && `+h+`.validate; var `+_+` = `+g+` && `+h+`.type || 'string'; if (`+g+`) { `,e.async&&(r+=` var async`+i+` = `+h+`.async; `),r+=` `+h+` = `+h+`.validate; } if ( `,d&&(r+=` (`+f+` !== undefined && typeof `+f+` != 'string') || `),r+=` (`,p!=`ignore`&&(r+=` (`+f+` && !`+h+` `,m&&(r+=` && self._opts.unknownFormats.indexOf(`+f+`) == -1 `),r+=`) || `),r+=` (`+h+` && `+_+` == '`+n+`' && !(typeof `+h+` == 'function' ? `,e.async?r+=` (async`+i+` ? await `+h+`(`+u+`) : `+h+`(`+u+`)) `:r+=` `+h+`(`+u+`) `,r+=` : `+h+`.test(`+u+`))))) {`}else{var h=e.formats[o];if(!h){if(p==`ignore`)return e.logger.warn(`unknown format "`+o+`" ignored in schema at path "`+e.errSchemaPath+`"`),l&&(r+=` if (true) { `),r;if(m&&p.indexOf(o)>=0)return l&&(r+=` if (true) { `),r;throw Error(`unknown format "`+o+`" is used in schema at path "`+e.errSchemaPath+`"`)}var g=typeof h==`object`&&!(h instanceof RegExp)&&h.validate,_=g&&h.type||`string`;if(g){var v=h.async===!0;h=h.validate}if(_!=n)return l&&(r+=` if (true) { `),r;if(v){if(!e.async)throw Error(`async format in sync schema`);var y=`formats`+e.util.getProperty(o)+`.validate`;r+=` if (!(await `+y+`(`+u+`))) { `}else{r+=` if (! `;var y=`formats`+e.util.getProperty(o);g&&(y+=`.validate`),typeof h==`function`?r+=` `+y+`(`+u+`) `:r+=` `+y+`.test(`+u+`) `,r+=`) { `}}var b=b||[];b.push(r),r=``,e.createErrors===!1?r+=` {} `:(r+=` { keyword: 'format' , dataPath: (dataPath || '') + `+e.errorPath+` , schemaPath: `+e.util.toQuotedString(c)+` , params: { format: `,d?r+=``+f:r+=``+e.util.toQuotedString(o),r+=` } `,e.opts.messages!==!1&&(r+=` , message: 'should match format "`,d?r+=`' + `+f+` + '`:r+=``+e.util.escapeQuotes(o),r+=`"' `),e.opts.verbose&&(r+=` , schema: `,d?r+=`validate.schema`+s:r+=``+e.util.toQuotedString(o),r+=` , parentSchema: validate.schema`+e.schemaPath+` , data: `+u+` `),r+=` } `);var x=r;return r=b.pop(),!e.compositeRule&&l?e.async?r+=` throw new ValidationError([`+x+`]); `:r+=` validate.errors = [`+x+`]; return false; `:r+=` var err = `+x+`; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; `,r+=` } `,l&&(r+=` else { `),r}})),Ds=s(((e,t)=>{t.exports=function(e,t,n){var r=` `,i=e.level,a=e.dataLevel,o=e.schema[t],s=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+`/`+t,l=!e.opts.allErrors,u=`data`+(a||``),d=`valid`+i,f=`errs__`+i,p=e.util.copy(e);p.level++;var m=`valid`+p.level,h=e.schema.then,g=e.schema.else,_=h!==void 0&&(e.opts.strictKeywords?typeof h==`object`&&Object.keys(h).length>0||h===!1:e.util.schemaHasRules(h,e.RULES.all)),v=g!==void 0&&(e.opts.strictKeywords?typeof g==`object`&&Object.keys(g).length>0||g===!1:e.util.schemaHasRules(g,e.RULES.all)),y=p.baseId;if(_||v){var b;p.createErrors=!1,p.schema=o,p.schemaPath=s,p.errSchemaPath=c,r+=` var `+f+` = errors; var `+d+` = true; `;var x=e.compositeRule;e.compositeRule=p.compositeRule=!0,r+=` `+e.validate(p)+` `,p.baseId=y,p.createErrors=!0,r+=` errors = `+f+`; if (vErrors !== null) { if (`+f+`) vErrors.length = `+f+`; else vErrors = null; } `,e.compositeRule=p.compositeRule=x,_?(r+=` if (`+m+`) { `,p.schema=e.schema.then,p.schemaPath=e.schemaPath+`.then`,p.errSchemaPath=e.errSchemaPath+`/then`,r+=` `+e.validate(p)+` `,p.baseId=y,r+=` `+d+` = `+m+`; `,_&&v?(b=`ifClause`+i,r+=` var `+b+` = 'then'; `):b=`'then'`,r+=` } `,v&&(r+=` else { `)):r+=` if (!`+m+`) { `,v&&(p.schema=e.schema.else,p.schemaPath=e.schemaPath+`.else`,p.errSchemaPath=e.errSchemaPath+`/else`,r+=` `+e.validate(p)+` `,p.baseId=y,r+=` `+d+` = `+m+`; `,_&&v?(b=`ifClause`+i,r+=` var `+b+` = 'else'; `):b=`'else'`,r+=` } `),r+=` if (!`+d+`) { var err = `,e.createErrors===!1?r+=` {} `:(r+=` { keyword: 'if' , dataPath: (dataPath || '') + `+e.errorPath+` , schemaPath: `+e.util.toQuotedString(c)+` , params: { failingKeyword: `+b+` } `,e.opts.messages!==!1&&(r+=` , message: 'should match "' + `+b+` + '" schema' `),e.opts.verbose&&(r+=` , schema: validate.schema`+s+` , parentSchema: validate.schema`+e.schemaPath+` , data: `+u+` `),r+=` } `),r+=`; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; `,!e.compositeRule&&l&&(e.async?r+=` throw new ValidationError(vErrors); `:r+=` validate.errors = vErrors; return false; `),r+=` } `,l&&(r+=` else { `)}else l&&(r+=` if (true) { `);return r}})),Os=s(((e,t)=>{t.exports=function(e,t,n){var r=` `,i=e.level,a=e.dataLevel,o=e.schema[t],s=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+`/`+t,l=!e.opts.allErrors,u=`data`+(a||``),d=`valid`+i,f=`errs__`+i,p=e.util.copy(e),m=``;p.level++;var h=`valid`+p.level,g=`i`+i,_=p.dataLevel=e.dataLevel+1,v=`data`+_,y=e.baseId;if(r+=`var `+f+` = errors;var `+d+`;`,Array.isArray(o)){var b=e.schema.additionalItems;if(b===!1){r+=` `+d+` = `+u+`.length <= `+o.length+`; `;var x=c;c=e.errSchemaPath+`/additionalItems`,r+=` if (!`+d+`) { `;var S=S||[];S.push(r),r=``,e.createErrors===!1?r+=` {} `:(r+=` { keyword: 'additionalItems' , dataPath: (dataPath || '') + `+e.errorPath+` , schemaPath: `+e.util.toQuotedString(c)+` , params: { limit: `+o.length+` } `,e.opts.messages!==!1&&(r+=` , message: 'should NOT have more than `+o.length+` items' `),e.opts.verbose&&(r+=` , schema: false , parentSchema: validate.schema`+e.schemaPath+` , data: `+u+` `),r+=` } `);var C=r;r=S.pop(),!e.compositeRule&&l?e.async?r+=` throw new ValidationError([`+C+`]); `:r+=` validate.errors = [`+C+`]; return false; `:r+=` var err = `+C+`; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; `,r+=` } `,c=x,l&&(m+=`}`,r+=` else { `)}var w=o;if(w){for(var T,E=-1,D=w.length-1;E<D;)if(T=w[E+=1],e.opts.strictKeywords?typeof T==`object`&&Object.keys(T).length>0||T===!1:e.util.schemaHasRules(T,e.RULES.all)){r+=` `+h+` = true; if (`+u+`.length > `+E+`) { `;var O=u+`[`+E+`]`;p.schema=T,p.schemaPath=s+`[`+E+`]`,p.errSchemaPath=c+`/`+E,p.errorPath=e.util.getPathExpr(e.errorPath,E,e.opts.jsonPointers,!0),p.dataPathArr[_]=E;var k=e.validate(p);p.baseId=y,e.util.varOccurences(k,v)<2?r+=` `+e.util.varReplace(k,v,O)+` `:r+=` var `+v+` = `+O+`; `+k+` `,r+=` } `,l&&(r+=` if (`+h+`) { `,m+=`}`)}}if(typeof b==`object`&&(e.opts.strictKeywords?typeof b==`object`&&Object.keys(b).length>0||b===!1:e.util.schemaHasRules(b,e.RULES.all))){p.schema=b,p.schemaPath=e.schemaPath+`.additionalItems`,p.errSchemaPath=e.errSchemaPath+`/additionalItems`,r+=` `+h+` = true; if (`+u+`.length > `+o.length+`) { for (var `+g+` = `+o.length+`; `+g+` < `+u+`.length; `+g+`++) { `,p.errorPath=e.util.getPathExpr(e.errorPath,g,e.opts.jsonPointers,!0);var O=u+`[`+g+`]`;p.dataPathArr[_]=g;var k=e.validate(p);p.baseId=y,e.util.varOccurences(k,v)<2?r+=` `+e.util.varReplace(k,v,O)+` `:r+=` var `+v+` = `+O+`; `+k+` `,l&&(r+=` if (!`+h+`) break; `),r+=` } } `,l&&(r+=` if (`+h+`) { `,m+=`}`)}}else if(e.opts.strictKeywords?typeof o==`object`&&Object.keys(o).length>0||o===!1:e.util.schemaHasRules(o,e.RULES.all)){p.schema=o,p.schemaPath=s,p.errSchemaPath=c,r+=` for (var `+g+` = 0; `+g+` < `+u+`.length; `+g+`++) { `,p.errorPath=e.util.getPathExpr(e.errorPath,g,e.opts.jsonPointers,!0);var O=u+`[`+g+`]`;p.dataPathArr[_]=g;var k=e.validate(p);p.baseId=y,e.util.varOccurences(k,v)<2?r+=` `+e.util.varReplace(k,v,O)+` `:r+=` var `+v+` = `+O+`; `+k+` `,l&&(r+=` if (!`+h+`) break; `),r+=` }`}return l&&(r+=` `+m+` if (`+f+` == errors) {`),r}})),ks=s(((e,t)=>{t.exports=function(e,t,n){var r=` `,i=e.level,a=e.dataLevel,o=e.schema[t],s=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+`/`+t,l=!e.opts.allErrors,u,d=`data`+(a||``),f=e.opts.$data&&o&&o.$data,p;f?(r+=` var schema`+i+` = `+e.util.getData(o.$data,a,e.dataPathArr)+`; `,p=`schema`+i):p=o;var m=t==`maximum`,h=m?`exclusiveMaximum`:`exclusiveMinimum`,g=e.schema[h],_=e.opts.$data&&g&&g.$data,v=m?`<`:`>`,y=m?`>`:`<`,u=void 0;if(!(f||typeof o==`number`||o===void 0))throw Error(t+` must be number`);if(!(_||g===void 0||typeof g==`number`||typeof g==`boolean`))throw Error(h+` must be number or boolean`);if(_){var b=e.util.getData(g.$data,a,e.dataPathArr),x=`exclusive`+i,S=`exclType`+i,C=`exclIsNumber`+i,w=`op`+i,T=`' + `+w+` + '`;r+=` var schemaExcl`+i+` = `+b+`; `,b=`schemaExcl`+i,r+=` var `+x+`; var `+S+` = typeof `+b+`; if (`+S+` != 'boolean' && `+S+` != 'undefined' && `+S+` != 'number') { `;var u=h,E=E||[];E.push(r),r=``,e.createErrors===!1?r+=` {} `:(r+=` { keyword: '`+(u||`_exclusiveLimit`)+`' , dataPath: (dataPath || '') + `+e.errorPath+` , schemaPath: `+e.util.toQuotedString(c)+` , params: {} `,e.opts.messages!==!1&&(r+=` , message: '`+h+` should be boolean' `),e.opts.verbose&&(r+=` , schema: validate.schema`+s+` , parentSchema: validate.schema`+e.schemaPath+` , data: `+d+` `),r+=` } `);var D=r;r=E.pop(),!e.compositeRule&&l?e.async?r+=` throw new ValidationError([`+D+`]); `:r+=` validate.errors = [`+D+`]; return false; `:r+=` var err = `+D+`; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; `,r+=` } else if ( `,f&&(r+=` (`+p+` !== undefined && typeof `+p+` != 'number') || `),r+=` `+S+` == 'number' ? ( (`+x+` = `+p+` === undefined || `+b+` `+v+`= `+p+`) ? `+d+` `+y+`= `+b+` : `+d+` `+y+` `+p+` ) : ( (`+x+` = `+b+` === true) ? `+d+` `+y+`= `+p+` : `+d+` `+y+` `+p+` ) || `+d+` !== `+d+`) { var op`+i+` = `+x+` ? '`+v+`' : '`+v+`='; `,o===void 0&&(u=h,c=e.errSchemaPath+`/`+h,p=b,f=_)}else{var C=typeof g==`number`,T=v;if(C&&f){var w=`'`+T+`'`;r+=` if ( `,f&&(r+=` (`+p+` !== undefined && typeof `+p+` != 'number') || `),r+=` ( `+p+` === undefined || `+g+` `+v+`= `+p+` ? `+d+` `+y+`= `+g+` : `+d+` `+y+` `+p+` ) || `+d+` !== `+d+`) { `}else{C&&o===void 0?(x=!0,u=h,c=e.errSchemaPath+`/`+h,p=g,y+=`=`):(C&&(p=Math[m?`min`:`max`](g,o)),g===(C?p:!0)?(x=!0,u=h,c=e.errSchemaPath+`/`+h,y+=`=`):(x=!1,T+=`=`));var w=`'`+T+`'`;r+=` if ( `,f&&(r+=` (`+p+` !== undefined && typeof `+p+` != 'number') || `),r+=` `+d+` `+y+` `+p+` || `+d+` !== `+d+`) { `}}u||=t;var E=E||[];E.push(r),r=``,e.createErrors===!1?r+=` {} `:(r+=` { keyword: '`+(u||`_limit`)+`' , dataPath: (dataPath || '') + `+e.errorPath+` , schemaPath: `+e.util.toQuotedString(c)+` , params: { comparison: `+w+`, limit: `+p+`, exclusive: `+x+` } `,e.opts.messages!==!1&&(r+=` , message: 'should be `+T+` `,f?r+=`' + `+p:r+=``+p+`'`),e.opts.verbose&&(r+=` , schema: `,f?r+=`validate.schema`+s:r+=``+o,r+=` , parentSchema: validate.schema`+e.schemaPath+` , data: `+d+` `),r+=` } `);var D=r;return r=E.pop(),!e.compositeRule&&l?e.async?r+=` throw new ValidationError([`+D+`]); `:r+=` validate.errors = [`+D+`]; return false; `:r+=` var err = `+D+`; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; `,r+=` } `,l&&(r+=` else { `),r}})),As=s(((e,t)=>{t.exports=function(e,t,n){var r=` `,i=e.level,a=e.dataLevel,o=e.schema[t],s=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+`/`+t,l=!e.opts.allErrors,u,d=`data`+(a||``),f=e.opts.$data&&o&&o.$data,p;if(f?(r+=` var schema`+i+` = `+e.util.getData(o.$data,a,e.dataPathArr)+`; `,p=`schema`+i):p=o,!(f||typeof o==`number`))throw Error(t+` must be number`);var m=t==`maxItems`?`>`:`<`;r+=`if ( `,f&&(r+=` (`+p+` !== undefined && typeof `+p+` != 'number') || `),r+=` `+d+`.length `+m+` `+p+`) { `;var u=t,h=h||[];h.push(r),r=``,e.createErrors===!1?r+=` {} `:(r+=` { keyword: '`+(u||`_limitItems`)+`' , dataPath: (dataPath || '') + `+e.errorPath+` , schemaPath: `+e.util.toQuotedString(c)+` , params: { limit: `+p+` } `,e.opts.messages!==!1&&(r+=` , message: 'should NOT have `,t==`maxItems`?r+=`more`:r+=`fewer`,r+=` than `,f?r+=`' + `+p+` + '`:r+=``+o,r+=` items' `),e.opts.verbose&&(r+=` , schema: `,f?r+=`validate.schema`+s:r+=``+o,r+=` , parentSchema: validate.schema`+e.schemaPath+` , data: `+d+` `),r+=` } `);var g=r;return r=h.pop(),!e.compositeRule&&l?e.async?r+=` throw new ValidationError([`+g+`]); `:r+=` validate.errors = [`+g+`]; return false; `:r+=` var err = `+g+`; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; `,r+=`} `,l&&(r+=` else { `),r}})),js=s(((e,t)=>{t.exports=function(e,t,n){var r=` `,i=e.level,a=e.dataLevel,o=e.schema[t],s=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+`/`+t,l=!e.opts.allErrors,u,d=`data`+(a||``),f=e.opts.$data&&o&&o.$data,p;if(f?(r+=` var schema`+i+` = `+e.util.getData(o.$data,a,e.dataPathArr)+`; `,p=`schema`+i):p=o,!(f||typeof o==`number`))throw Error(t+` must be number`);var m=t==`maxLength`?`>`:`<`;r+=`if ( `,f&&(r+=` (`+p+` !== undefined && typeof `+p+` != 'number') || `),e.opts.unicode===!1?r+=` `+d+`.length `:r+=` ucs2length(`+d+`) `,r+=` `+m+` `+p+`) { `;var u=t,h=h||[];h.push(r),r=``,e.createErrors===!1?r+=` {} `:(r+=` { keyword: '`+(u||`_limitLength`)+`' , dataPath: (dataPath || '') + `+e.errorPath+` , schemaPath: `+e.util.toQuotedString(c)+` , params: { limit: `+p+` } `,e.opts.messages!==!1&&(r+=` , message: 'should NOT be `,t==`maxLength`?r+=`longer`:r+=`shorter`,r+=` than `,f?r+=`' + `+p+` + '`:r+=``+o,r+=` characters' `),e.opts.verbose&&(r+=` , schema: `,f?r+=`validate.schema`+s:r+=``+o,r+=` , parentSchema: validate.schema`+e.schemaPath+` , data: `+d+` `),r+=` } `);var g=r;return r=h.pop(),!e.compositeRule&&l?e.async?r+=` throw new ValidationError([`+g+`]); `:r+=` validate.errors = [`+g+`]; return false; `:r+=` var err = `+g+`; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; `,r+=`} `,l&&(r+=` else { `),r}})),Ms=s(((e,t)=>{t.exports=function(e,t,n){var r=` `,i=e.level,a=e.dataLevel,o=e.schema[t],s=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+`/`+t,l=!e.opts.allErrors,u,d=`data`+(a||``),f=e.opts.$data&&o&&o.$data,p;if(f?(r+=` var schema`+i+` = `+e.util.getData(o.$data,a,e.dataPathArr)+`; `,p=`schema`+i):p=o,!(f||typeof o==`number`))throw Error(t+` must be number`);var m=t==`maxProperties`?`>`:`<`;r+=`if ( `,f&&(r+=` (`+p+` !== undefined && typeof `+p+` != 'number') || `),r+=` Object.keys(`+d+`).length `+m+` `+p+`) { `;var u=t,h=h||[];h.push(r),r=``,e.createErrors===!1?r+=` {} `:(r+=` { keyword: '`+(u||`_limitProperties`)+`' , dataPath: (dataPath || '') + `+e.errorPath+` , schemaPath: `+e.util.toQuotedString(c)+` , params: { limit: `+p+` } `,e.opts.messages!==!1&&(r+=` , message: 'should NOT have `,t==`maxProperties`?r+=`more`:r+=`fewer`,r+=` than `,f?r+=`' + `+p+` + '`:r+=``+o,r+=` properties' `),e.opts.verbose&&(r+=` , schema: `,f?r+=`validate.schema`+s:r+=``+o,r+=` , parentSchema: validate.schema`+e.schemaPath+` , data: `+d+` `),r+=` } `);var g=r;return r=h.pop(),!e.compositeRule&&l?e.async?r+=` throw new ValidationError([`+g+`]); `:r+=` validate.errors = [`+g+`]; return false; `:r+=` var err = `+g+`; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; `,r+=`} `,l&&(r+=` else { `),r}})),Ns=s(((e,t)=>{t.exports=function(e,t,n){var r=` `,i=e.level,a=e.dataLevel,o=e.schema[t],s=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+`/`+t,l=!e.opts.allErrors,u=`data`+(a||``),d=e.opts.$data&&o&&o.$data,f;if(d?(r+=` var schema`+i+` = `+e.util.getData(o.$data,a,e.dataPathArr)+`; `,f=`schema`+i):f=o,!(d||typeof o==`number`))throw Error(t+` must be number`);r+=`var division`+i+`;if (`,d&&(r+=` `+f+` !== undefined && ( typeof `+f+` != 'number' || `),r+=` (division`+i+` = `+u+` / `+f+`, `,e.opts.multipleOfPrecision?r+=` Math.abs(Math.round(division`+i+`) - division`+i+`) > 1e-`+e.opts.multipleOfPrecision+` `:r+=` division`+i+` !== parseInt(division`+i+`) `,r+=` ) `,d&&(r+=` ) `),r+=` ) { `;var p=p||[];p.push(r),r=``,e.createErrors===!1?r+=` {} `:(r+=` { keyword: 'multipleOf' , dataPath: (dataPath || '') + `+e.errorPath+` , schemaPath: `+e.util.toQuotedString(c)+` , params: { multipleOf: `+f+` } `,e.opts.messages!==!1&&(r+=` , message: 'should be multiple of `,d?r+=`' + `+f:r+=``+f+`'`),e.opts.verbose&&(r+=` , schema: `,d?r+=`validate.schema`+s:r+=``+o,r+=` , parentSchema: validate.schema`+e.schemaPath+` , data: `+u+` `),r+=` } `);var m=r;return r=p.pop(),!e.compositeRule&&l?e.async?r+=` throw new ValidationError([`+m+`]); `:r+=` validate.errors = [`+m+`]; return false; `:r+=` var err = `+m+`; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; `,r+=`} `,l&&(r+=` else { `),r}})),Ps=s(((e,t)=>{t.exports=function(e,t,n){var r=` `,i=e.level,a=e.dataLevel,o=e.schema[t],s=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+`/`+t,l=!e.opts.allErrors,u=`data`+(a||``),d=`errs__`+i,f=e.util.copy(e);f.level++;var p=`valid`+f.level;if(e.opts.strictKeywords?typeof o==`object`&&Object.keys(o).length>0||o===!1:e.util.schemaHasRules(o,e.RULES.all)){f.schema=o,f.schemaPath=s,f.errSchemaPath=c,r+=` var `+d+` = errors; `;var m=e.compositeRule;e.compositeRule=f.compositeRule=!0,f.createErrors=!1;var h;f.opts.allErrors&&(h=f.opts.allErrors,f.opts.allErrors=!1),r+=` `+e.validate(f)+` `,f.createErrors=!0,h&&(f.opts.allErrors=h),e.compositeRule=f.compositeRule=m,r+=` if (`+p+`) { `;var g=g||[];g.push(r),r=``,e.createErrors===!1?r+=` {} `:(r+=` { keyword: 'not' , dataPath: (dataPath || '') + `+e.errorPath+` , schemaPath: `+e.util.toQuotedString(c)+` , params: {} `,e.opts.messages!==!1&&(r+=` , message: 'should NOT be valid' `),e.opts.verbose&&(r+=` , schema: validate.schema`+s+` , parentSchema: validate.schema`+e.schemaPath+` , data: `+u+` `),r+=` } `);var _=r;r=g.pop(),!e.compositeRule&&l?e.async?r+=` throw new ValidationError([`+_+`]); `:r+=` validate.errors = [`+_+`]; return false; `:r+=` var err = `+_+`; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; `,r+=` } else { errors = `+d+`; if (vErrors !== null) { if (`+d+`) vErrors.length = `+d+`; else vErrors = null; } `,e.opts.allErrors&&(r+=` } `)}else r+=` var err = `,e.createErrors===!1?r+=` {} `:(r+=` { keyword: 'not' , dataPath: (dataPath || '') + `+e.errorPath+` , schemaPath: `+e.util.toQuotedString(c)+` , params: {} `,e.opts.messages!==!1&&(r+=` , message: 'should NOT be valid' `),e.opts.verbose&&(r+=` , schema: validate.schema`+s+` , parentSchema: validate.schema`+e.schemaPath+` , data: `+u+` `),r+=` } `),r+=`; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; `,l&&(r+=` if (false) { `);return r}})),Fs=s(((e,t)=>{t.exports=function(e,t,n){var r=` `,i=e.level,a=e.dataLevel,o=e.schema[t],s=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+`/`+t,l=!e.opts.allErrors,u=`data`+(a||``),d=`valid`+i,f=`errs__`+i,p=e.util.copy(e),m=``;p.level++;var h=`valid`+p.level,g=p.baseId,_=`prevValid`+i,v=`passingSchemas`+i;r+=`var `+f+` = errors , `+_+` = false , `+d+` = false , `+v+` = null; `;var y=e.compositeRule;e.compositeRule=p.compositeRule=!0;var b=o;if(b)for(var x,S=-1,C=b.length-1;S<C;)x=b[S+=1],(e.opts.strictKeywords?typeof x==`object`&&Object.keys(x).length>0||x===!1:e.util.schemaHasRules(x,e.RULES.all))?(p.schema=x,p.schemaPath=s+`[`+S+`]`,p.errSchemaPath=c+`/`+S,r+=` `+e.validate(p)+` `,p.baseId=g):r+=` var `+h+` = true; `,S&&(r+=` if (`+h+` && `+_+`) { `+d+` = false; `+v+` = [`+v+`, `+S+`]; } else { `,m+=`}`),r+=` if (`+h+`) { `+d+` = `+_+` = true; `+v+` = `+S+`; }`;return e.compositeRule=p.compositeRule=y,r+=``+m+`if (!`+d+`) { var err = `,e.createErrors===!1?r+=` {} `:(r+=` { keyword: 'oneOf' , dataPath: (dataPath || '') + `+e.errorPath+` , schemaPath: `+e.util.toQuotedString(c)+` , params: { passingSchemas: `+v+` } `,e.opts.messages!==!1&&(r+=` , message: 'should match exactly one schema in oneOf' `),e.opts.verbose&&(r+=` , schema: validate.schema`+s+` , parentSchema: validate.schema`+e.schemaPath+` , data: `+u+` `),r+=` } `),r+=`; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; `,!e.compositeRule&&l&&(e.async?r+=` throw new ValidationError(vErrors); `:r+=` validate.errors = vErrors; return false; `),r+=`} else { errors = `+f+`; if (vErrors !== null) { if (`+f+`) vErrors.length = `+f+`; else vErrors = null; }`,e.opts.allErrors&&(r+=` } `),r}})),Is=s(((e,t)=>{t.exports=function(e,t,n){var r=` `,i=e.level,a=e.dataLevel,o=e.schema[t],s=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+`/`+t,l=!e.opts.allErrors,u=`data`+(a||``),d=e.opts.$data&&o&&o.$data,f;d?(r+=` var schema`+i+` = `+e.util.getData(o.$data,a,e.dataPathArr)+`; `,f=`schema`+i):f=o;var p=d?`(new RegExp(`+f+`))`:e.usePattern(o);r+=`if ( `,d&&(r+=` (`+f+` !== undefined && typeof `+f+` != 'string') || `),r+=` !`+p+`.test(`+u+`) ) { `;var m=m||[];m.push(r),r=``,e.createErrors===!1?r+=` {} `:(r+=` { keyword: 'pattern' , dataPath: (dataPath || '') + `+e.errorPath+` , schemaPath: `+e.util.toQuotedString(c)+` , params: { pattern: `,d?r+=``+f:r+=``+e.util.toQuotedString(o),r+=` } `,e.opts.messages!==!1&&(r+=` , message: 'should match pattern "`,d?r+=`' + `+f+` + '`:r+=``+e.util.escapeQuotes(o),r+=`"' `),e.opts.verbose&&(r+=` , schema: `,d?r+=`validate.schema`+s:r+=``+e.util.toQuotedString(o),r+=` , parentSchema: validate.schema`+e.schemaPath+` , data: `+u+` `),r+=` } `);var h=r;return r=m.pop(),!e.compositeRule&&l?e.async?r+=` throw new ValidationError([`+h+`]); `:r+=` validate.errors = [`+h+`]; return false; `:r+=` var err = `+h+`; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; `,r+=`} `,l&&(r+=` else { `),r}})),Ls=s(((e,t)=>{t.exports=function(e,t,n){var r=` `,i=e.level,a=e.dataLevel,o=e.schema[t],s=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+`/`+t,l=!e.opts.allErrors,u=`data`+(a||``),d=`errs__`+i,f=e.util.copy(e),p=``;f.level++;var m=`valid`+f.level,h=`key`+i,g=`idx`+i,_=f.dataLevel=e.dataLevel+1,v=`data`+_,y=`dataProperties`+i,b=Object.keys(o||{}).filter(M),x=e.schema.patternProperties||{},S=Object.keys(x).filter(M),C=e.schema.additionalProperties,w=b.length||S.length,T=C===!1,E=typeof C==`object`&&Object.keys(C).length,D=e.opts.removeAdditional,O=T||E||D,k=e.opts.ownProperties,A=e.baseId,ee=e.schema.required;if(ee&&!(e.opts.$data&&ee.$data)&&ee.length<e.opts.loopRequired)var j=e.util.toHash(ee);function M(e){return e!==`__proto__`}if(r+=`var `+d+` = errors;var `+m+` = true;`,k&&(r+=` var `+y+` = undefined;`),O){if(k?r+=` `+y+` = `+y+` || Object.keys(`+u+`); for (var `+g+`=0; `+g+`<`+y+`.length; `+g+`++) { var `+h+` = `+y+`[`+g+`]; `:r+=` for (var `+h+` in `+u+`) { `,w){if(r+=` var isAdditional`+i+` = !(false `,b.length)if(b.length>8)r+=` || validate.schema`+s+`.hasOwnProperty(`+h+`) `;else{var N=b;if(N)for(var P,te=-1,F=N.length-1;te<F;)P=N[te+=1],r+=` || `+h+` == `+e.util.toQuotedString(P)+` `}if(S.length){var I=S;if(I)for(var L,R=-1,ne=I.length-1;R<ne;)L=I[R+=1],r+=` || `+e.usePattern(L)+`.test(`+h+`) `}r+=` ); if (isAdditional`+i+`) { `}if(D==`all`)r+=` delete `+u+`[`+h+`]; `;else{var re=e.errorPath,ie=`' + `+h+` + '`;if(e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(e.errorPath,h,e.opts.jsonPointers)),T)if(D)r+=` delete `+u+`[`+h+`]; `;else{r+=` `+m+` = false; `;var ae=c;c=e.errSchemaPath+`/additionalProperties`;var oe=oe||[];oe.push(r),r=``,e.createErrors===!1?r+=` {} `:(r+=` { keyword: 'additionalProperties' , dataPath: (dataPath || '') + `+e.errorPath+` , schemaPath: `+e.util.toQuotedString(c)+` , params: { additionalProperty: '`+ie+`' } `,e.opts.messages!==!1&&(r+=` , message: '`,e.opts._errorDataPathProperty?r+=`is an invalid additional property`:r+=`should NOT have additional properties`,r+=`' `),e.opts.verbose&&(r+=` , schema: false , parentSchema: validate.schema`+e.schemaPath+` , data: `+u+` `),r+=` } `);var se=r;r=oe.pop(),!e.compositeRule&&l?e.async?r+=` throw new ValidationError([`+se+`]); `:r+=` validate.errors = [`+se+`]; return false; `:r+=` var err = `+se+`; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; `,c=ae,l&&(r+=` break; `)}else if(E)if(D==`failing`){r+=` var `+d+` = errors; `;var ce=e.compositeRule;e.compositeRule=f.compositeRule=!0,f.schema=C,f.schemaPath=e.schemaPath+`.additionalProperties`,f.errSchemaPath=e.errSchemaPath+`/additionalProperties`,f.errorPath=e.opts._errorDataPathProperty?e.errorPath:e.util.getPathExpr(e.errorPath,h,e.opts.jsonPointers);var le=u+`[`+h+`]`;f.dataPathArr[_]=h;var ue=e.validate(f);f.baseId=A,e.util.varOccurences(ue,v)<2?r+=` `+e.util.varReplace(ue,v,le)+` `:r+=` var `+v+` = `+le+`; `+ue+` `,r+=` if (!`+m+`) { errors = `+d+`; if (validate.errors !== null) { if (errors) validate.errors.length = errors; else validate.errors = null; } delete `+u+`[`+h+`]; } `,e.compositeRule=f.compositeRule=ce}else{f.schema=C,f.schemaPath=e.schemaPath+`.additionalProperties`,f.errSchemaPath=e.errSchemaPath+`/additionalProperties`,f.errorPath=e.opts._errorDataPathProperty?e.errorPath:e.util.getPathExpr(e.errorPath,h,e.opts.jsonPointers);var le=u+`[`+h+`]`;f.dataPathArr[_]=h;var ue=e.validate(f);f.baseId=A,e.util.varOccurences(ue,v)<2?r+=` `+e.util.varReplace(ue,v,le)+` `:r+=` var `+v+` = `+le+`; `+ue+` `,l&&(r+=` if (!`+m+`) break; `)}e.errorPath=re}w&&(r+=` } `),r+=` } `,l&&(r+=` if (`+m+`) { `,p+=`}`)}var de=e.opts.useDefaults&&!e.compositeRule;if(b.length){var fe=b;if(fe)for(var P,pe=-1,me=fe.length-1;pe<me;){P=fe[pe+=1];var he=o[P];if(e.opts.strictKeywords?typeof he==`object`&&Object.keys(he).length>0||he===!1:e.util.schemaHasRules(he,e.RULES.all)){var ge=e.util.getProperty(P),le=u+ge,_e=de&&he.default!==void 0;f.schema=he,f.schemaPath=s+ge,f.errSchemaPath=c+`/`+e.util.escapeFragment(P),f.errorPath=e.util.getPath(e.errorPath,P,e.opts.jsonPointers),f.dataPathArr[_]=e.util.toQuotedString(P);var ue=e.validate(f);if(f.baseId=A,e.util.varOccurences(ue,v)<2){ue=e.util.varReplace(ue,v,le);var ve=le}else{var ve=v;r+=` var `+v+` = `+le+`; `}if(_e)r+=` `+ue+` `;else{if(j&&j[P]){r+=` if ( `+ve+` === undefined `,k&&(r+=` || ! Object.prototype.hasOwnProperty.call(`+u+`, '`+e.util.escapeQuotes(P)+`') `),r+=`) { `+m+` = false; `;var re=e.errorPath,ae=c,ye=e.util.escapeQuotes(P);e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPath(re,P,e.opts.jsonPointers)),c=e.errSchemaPath+`/required`;var oe=oe||[];oe.push(r),r=``,e.createErrors===!1?r+=` {} `:(r+=` { keyword: 'required' , dataPath: (dataPath || '') + `+e.errorPath+` , schemaPath: `+e.util.toQuotedString(c)+` , params: { missingProperty: '`+ye+`' } `,e.opts.messages!==!1&&(r+=` , message: '`,e.opts._errorDataPathProperty?r+=`is a required property`:r+=`should have required property \\'`+ye+`\\'`,r+=`' `),e.opts.verbose&&(r+=` , schema: validate.schema`+s+` , parentSchema: validate.schema`+e.schemaPath+` , data: `+u+` `),r+=` } `);var se=r;r=oe.pop(),!e.compositeRule&&l?e.async?r+=` throw new ValidationError([`+se+`]); `:r+=` validate.errors = [`+se+`]; return false; `:r+=` var err = `+se+`; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; `,c=ae,e.errorPath=re,r+=` } else { `}else l?(r+=` if ( `+ve+` === undefined `,k&&(r+=` || ! Object.prototype.hasOwnProperty.call(`+u+`, '`+e.util.escapeQuotes(P)+`') `),r+=`) { `+m+` = true; } else { `):(r+=` if (`+ve+` !== undefined `,k&&(r+=` && Object.prototype.hasOwnProperty.call(`+u+`, '`+e.util.escapeQuotes(P)+`') `),r+=` ) { `);r+=` `+ue+` } `}}l&&(r+=` if (`+m+`) { `,p+=`}`)}}if(S.length){var be=S;if(be)for(var L,xe=-1,Se=be.length-1;xe<Se;){L=be[xe+=1];var he=x[L];if(e.opts.strictKeywords?typeof he==`object`&&Object.keys(he).length>0||he===!1:e.util.schemaHasRules(he,e.RULES.all)){f.schema=he,f.schemaPath=e.schemaPath+`.patternProperties`+e.util.getProperty(L),f.errSchemaPath=e.errSchemaPath+`/patternProperties/`+e.util.escapeFragment(L),k?r+=` `+y+` = `+y+` || Object.keys(`+u+`); for (var `+g+`=0; `+g+`<`+y+`.length; `+g+`++) { var `+h+` = `+y+`[`+g+`]; `:r+=` for (var `+h+` in `+u+`) { `,r+=` if (`+e.usePattern(L)+`.test(`+h+`)) { `,f.errorPath=e.util.getPathExpr(e.errorPath,h,e.opts.jsonPointers);var le=u+`[`+h+`]`;f.dataPathArr[_]=h;var ue=e.validate(f);f.baseId=A,e.util.varOccurences(ue,v)<2?r+=` `+e.util.varReplace(ue,v,le)+` `:r+=` var `+v+` = `+le+`; `+ue+` `,l&&(r+=` if (!`+m+`) break; `),r+=` } `,l&&(r+=` else `+m+` = true; `),r+=` } `,l&&(r+=` if (`+m+`) { `,p+=`}`)}}}return l&&(r+=` `+p+` if (`+d+` == errors) {`),r}})),Rs=s(((e,t)=>{t.exports=function(e,t,n){var r=` `,i=e.level,a=e.dataLevel,o=e.schema[t],s=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+`/`+t,l=!e.opts.allErrors,u=`data`+(a||``),d=`errs__`+i,f=e.util.copy(e),p=``;f.level++;var m=`valid`+f.level;if(r+=`var `+d+` = errors;`,e.opts.strictKeywords?typeof o==`object`&&Object.keys(o).length>0||o===!1:e.util.schemaHasRules(o,e.RULES.all)){f.schema=o,f.schemaPath=s,f.errSchemaPath=c;var h=`key`+i,g=`idx`+i,_=`i`+i,v=`' + `+h+` + '`,y=`data`+(f.dataLevel=e.dataLevel+1),b=`dataProperties`+i,x=e.opts.ownProperties,S=e.baseId;x&&(r+=` var `+b+` = undefined; `),x?r+=` `+b+` = `+b+` || Object.keys(`+u+`); for (var `+g+`=0; `+g+`<`+b+`.length; `+g+`++) { var `+h+` = `+b+`[`+g+`]; `:r+=` for (var `+h+` in `+u+`) { `,r+=` var startErrs`+i+` = errors; `;var C=h,w=e.compositeRule;e.compositeRule=f.compositeRule=!0;var T=e.validate(f);f.baseId=S,e.util.varOccurences(T,y)<2?r+=` `+e.util.varReplace(T,y,C)+` `:r+=` var `+y+` = `+C+`; `+T+` `,e.compositeRule=f.compositeRule=w,r+=` if (!`+m+`) { for (var `+_+`=startErrs`+i+`; `+_+`<errors; `+_+`++) { vErrors[`+_+`].propertyName = `+h+`; } var err = `,e.createErrors===!1?r+=` {} `:(r+=` { keyword: 'propertyNames' , dataPath: (dataPath || '') + `+e.errorPath+` , schemaPath: `+e.util.toQuotedString(c)+` , params: { propertyName: '`+v+`' } `,e.opts.messages!==!1&&(r+=` , message: 'property name \\'`+v+`\\' is invalid' `),e.opts.verbose&&(r+=` , schema: validate.schema`+s+` , parentSchema: validate.schema`+e.schemaPath+` , data: `+u+` `),r+=` } `),r+=`; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; `,!e.compositeRule&&l&&(e.async?r+=` throw new ValidationError(vErrors); `:r+=` validate.errors = vErrors; return false; `),l&&(r+=` break; `),r+=` } }`}return l&&(r+=` `+p+` if (`+d+` == errors) {`),r}})),zs=s(((e,t)=>{t.exports=function(e,t,n){var r=` `,i=e.level,a=e.dataLevel,o=e.schema[t],s=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+`/`+t,l=!e.opts.allErrors,u=`data`+(a||``),d=`valid`+i,f=e.opts.$data&&o&&o.$data;f&&(r+=` var schema`+i+` = `+e.util.getData(o.$data,a,e.dataPathArr)+`; `,``+i);var p=`schema`+i;if(!f)if(o.length<e.opts.loopRequired&&e.schema.properties&&Object.keys(e.schema.properties).length){var m=[],h=o;if(h)for(var g,_=-1,v=h.length-1;_<v;){g=h[_+=1];var y=e.schema.properties[g];y&&(e.opts.strictKeywords?typeof y==`object`&&Object.keys(y).length>0||y===!1:e.util.schemaHasRules(y,e.RULES.all))||(m[m.length]=g)}}else var m=o;if(f||m.length){var b=e.errorPath,x=f||m.length>=e.opts.loopRequired,S=e.opts.ownProperties;if(l)if(r+=` var missing`+i+`; `,x){f||(r+=` var `+p+` = validate.schema`+s+`; `);var C=`i`+i,w=`schema`+i+`[`+C+`]`,T=`' + `+w+` + '`;e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(b,w,e.opts.jsonPointers)),r+=` var `+d+` = true; `,f&&(r+=` if (schema`+i+` === undefined) `+d+` = true; else if (!Array.isArray(schema`+i+`)) `+d+` = false; else {`),r+=` for (var `+C+` = 0; `+C+` < `+p+`.length; `+C+`++) { `+d+` = `+u+`[`+p+`[`+C+`]] !== undefined `,S&&(r+=` && Object.prototype.hasOwnProperty.call(`+u+`, `+p+`[`+C+`]) `),r+=`; if (!`+d+`) break; } `,f&&(r+=` } `),r+=` if (!`+d+`) { `;var E=E||[];E.push(r),r=``,e.createErrors===!1?r+=` {} `:(r+=` { keyword: 'required' , dataPath: (dataPath || '') + `+e.errorPath+` , schemaPath: `+e.util.toQuotedString(c)+` , params: { missingProperty: '`+T+`' } `,e.opts.messages!==!1&&(r+=` , message: '`,e.opts._errorDataPathProperty?r+=`is a required property`:r+=`should have required property \\'`+T+`\\'`,r+=`' `),e.opts.verbose&&(r+=` , schema: validate.schema`+s+` , parentSchema: validate.schema`+e.schemaPath+` , data: `+u+` `),r+=` } `);var D=r;r=E.pop(),!e.compositeRule&&l?e.async?r+=` throw new ValidationError([`+D+`]); `:r+=` validate.errors = [`+D+`]; return false; `:r+=` var err = `+D+`; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; `,r+=` } else { `}else{r+=` if ( `;var O=m;if(O)for(var k,C=-1,A=O.length-1;C<A;){k=O[C+=1],C&&(r+=` || `);var ee=e.util.getProperty(k),j=u+ee;r+=` ( ( `+j+` === undefined `,S&&(r+=` || ! Object.prototype.hasOwnProperty.call(`+u+`, '`+e.util.escapeQuotes(k)+`') `),r+=`) && (missing`+i+` = `+e.util.toQuotedString(e.opts.jsonPointers?k:ee)+`) ) `}r+=`) { `;var w=`missing`+i,T=`' + `+w+` + '`;e.opts._errorDataPathProperty&&(e.errorPath=e.opts.jsonPointers?e.util.getPathExpr(b,w,!0):b+` + `+w);var E=E||[];E.push(r),r=``,e.createErrors===!1?r+=` {} `:(r+=` { keyword: 'required' , dataPath: (dataPath || '') + `+e.errorPath+` , schemaPath: `+e.util.toQuotedString(c)+` , params: { missingProperty: '`+T+`' } `,e.opts.messages!==!1&&(r+=` , message: '`,e.opts._errorDataPathProperty?r+=`is a required property`:r+=`should have required property \\'`+T+`\\'`,r+=`' `),e.opts.verbose&&(r+=` , schema: validate.schema`+s+` , parentSchema: validate.schema`+e.schemaPath+` , data: `+u+` `),r+=` } `);var D=r;r=E.pop(),!e.compositeRule&&l?e.async?r+=` throw new ValidationError([`+D+`]); `:r+=` validate.errors = [`+D+`]; return false; `:r+=` var err = `+D+`; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; `,r+=` } else { `}else if(x){f||(r+=` var `+p+` = validate.schema`+s+`; `);var C=`i`+i,w=`schema`+i+`[`+C+`]`,T=`' + `+w+` + '`;e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(b,w,e.opts.jsonPointers)),f&&(r+=` if (`+p+` && !Array.isArray(`+p+`)) { var err = `,e.createErrors===!1?r+=` {} `:(r+=` { keyword: 'required' , dataPath: (dataPath || '') + `+e.errorPath+` , schemaPath: `+e.util.toQuotedString(c)+` , params: { missingProperty: '`+T+`' } `,e.opts.messages!==!1&&(r+=` , message: '`,e.opts._errorDataPathProperty?r+=`is a required property`:r+=`should have required property \\'`+T+`\\'`,r+=`' `),e.opts.verbose&&(r+=` , schema: validate.schema`+s+` , parentSchema: validate.schema`+e.schemaPath+` , data: `+u+` `),r+=` } `),r+=`; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } else if (`+p+` !== undefined) { `),r+=` for (var `+C+` = 0; `+C+` < `+p+`.length; `+C+`++) { if (`+u+`[`+p+`[`+C+`]] === undefined `,S&&(r+=` || ! Object.prototype.hasOwnProperty.call(`+u+`, `+p+`[`+C+`]) `),r+=`) { var err = `,e.createErrors===!1?r+=` {} `:(r+=` { keyword: 'required' , dataPath: (dataPath || '') + `+e.errorPath+` , schemaPath: `+e.util.toQuotedString(c)+` , params: { missingProperty: '`+T+`' } `,e.opts.messages!==!1&&(r+=` , message: '`,e.opts._errorDataPathProperty?r+=`is a required property`:r+=`should have required property \\'`+T+`\\'`,r+=`' `),e.opts.verbose&&(r+=` , schema: validate.schema`+s+` , parentSchema: validate.schema`+e.schemaPath+` , data: `+u+` `),r+=` } `),r+=`; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } } `,f&&(r+=` } `)}else{var M=m;if(M)for(var k,N=-1,P=M.length-1;N<P;){k=M[N+=1];var ee=e.util.getProperty(k),T=e.util.escapeQuotes(k),j=u+ee;e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPath(b,k,e.opts.jsonPointers)),r+=` if ( `+j+` === undefined `,S&&(r+=` || ! Object.prototype.hasOwnProperty.call(`+u+`, '`+e.util.escapeQuotes(k)+`') `),r+=`) { var err = `,e.createErrors===!1?r+=` {} `:(r+=` { keyword: 'required' , dataPath: (dataPath || '') + `+e.errorPath+` , schemaPath: `+e.util.toQuotedString(c)+` , params: { missingProperty: '`+T+`' } `,e.opts.messages!==!1&&(r+=` , message: '`,e.opts._errorDataPathProperty?r+=`is a required property`:r+=`should have required property \\'`+T+`\\'`,r+=`' `),e.opts.verbose&&(r+=` , schema: validate.schema`+s+` , parentSchema: validate.schema`+e.schemaPath+` , data: `+u+` `),r+=` } `),r+=`; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } `}}e.errorPath=b}else l&&(r+=` if (true) {`);return r}})),Bs=s(((e,t)=>{t.exports=function(e,t,n){var r=` `,i=e.level,a=e.dataLevel,o=e.schema[t],s=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+`/`+t,l=!e.opts.allErrors,u=`data`+(a||``),d=`valid`+i,f=e.opts.$data&&o&&o.$data,p;if(f?(r+=` var schema`+i+` = `+e.util.getData(o.$data,a,e.dataPathArr)+`; `,p=`schema`+i):p=o,(o||f)&&e.opts.uniqueItems!==!1){f&&(r+=` var `+d+`; if (`+p+` === false || `+p+` === undefined) `+d+` = true; else if (typeof `+p+` != 'boolean') `+d+` = false; else { `),r+=` var i = `+u+`.length , `+d+` = true , j; if (i > 1) { `;var m=e.schema.items&&e.schema.items.type,h=Array.isArray(m);if(!m||m==`object`||m==`array`||h&&(m.indexOf(`object`)>=0||m.indexOf(`array`)>=0))r+=` outer: for (;i--;) { for (j = i; j--;) { if (equal(`+u+`[i], `+u+`[j])) { `+d+` = false; break outer; } } } `;else{r+=` var itemIndices = {}, item; for (;i--;) { var item = `+u+`[i]; `;var g=`checkDataType`+(h?`s`:``);r+=` if (`+e.util[g](m,`item`,e.opts.strictNumbers,!0)+`) continue; `,h&&(r+=` if (typeof item == 'string') item = '"' + item; `),r+=` if (typeof itemIndices[item] == 'number') { `+d+` = false; j = itemIndices[item]; break; } itemIndices[item] = i; } `}r+=` } `,f&&(r+=` } `),r+=` if (!`+d+`) { `;var _=_||[];_.push(r),r=``,e.createErrors===!1?r+=` {} `:(r+=` { keyword: 'uniqueItems' , dataPath: (dataPath || '') + `+e.errorPath+` , schemaPath: `+e.util.toQuotedString(c)+` , params: { i: i, j: j } `,e.opts.messages!==!1&&(r+=` , message: 'should NOT have duplicate items (items ## ' + j + ' and ' + i + ' are identical)' `),e.opts.verbose&&(r+=` , schema: `,f?r+=`validate.schema`+s:r+=``+o,r+=` , parentSchema: validate.schema`+e.schemaPath+` , data: `+u+` `),r+=` } `);var v=r;r=_.pop(),!e.compositeRule&&l?e.async?r+=` throw new ValidationError([`+v+`]); `:r+=` validate.errors = [`+v+`]; return false; `:r+=` var err = `+v+`; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; `,r+=` } `,l&&(r+=` else { `)}else l&&(r+=` if (true) { `);return r}})),Vs=s(((e,t)=>{t.exports={$ref:vs(),allOf:ys(),anyOf:bs(),$comment:xs(),const:Ss(),contains:Cs(),dependencies:ws(),enum:Ts(),format:Es(),if:Ds(),items:Os(),maximum:ks(),minimum:ks(),maxItems:As(),minItems:As(),maxLength:js(),minLength:js(),maxProperties:Ms(),minProperties:Ms(),multipleOf:Ns(),not:Ps(),oneOf:Fs(),pattern:Is(),properties:Ls(),propertyNames:Rs(),required:zs(),uniqueItems:Bs(),validate:ms()}})),Hs=s(((e,t)=>{var n=Vs(),r=cs().toHash;t.exports=function(){var e=[{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`]}],t=[`type`,`$comment`];return e.all=r(t),e.types=r([`number`,`integer`,`string`,`array`,`object`,`boolean`,`null`]),e.forEach(function(r){r.rules=r.rules.map(function(r){var i;if(typeof r==`object`){var a=Object.keys(r)[0];i=r[a],r=a,i.forEach(function(n){t.push(n),e.all[n]=!0})}return t.push(r),e.all[r]={keyword:r,code:n[r],implements:i}}),e.all.$comment={keyword:`$comment`,code:n.$comment},r.type&&(e.types[r.type]=r)}),e.keywords=r(t.concat([`$schema`,`$id`,`id`,`$data`,`$async`,`title`,`description`,`default`,`definitions`,`examples`,`readOnly`,`writeOnly`,`contentMediaType`,`contentEncoding`,`additionalItems`,`then`,`else`])),e.custom={},e}})),Us=s(((e,t)=>{var n=[`multipleOf`,`maximum`,`exclusiveMaximum`,`minimum`,`exclusiveMinimum`,`maxLength`,`minLength`,`pattern`,`additionalItems`,`maxItems`,`minItems`,`uniqueItems`,`maxProperties`,`minProperties`,`required`,`additionalProperties`,`enum`,`format`,`const`];t.exports=function(e,t){for(var r=0;r<t.length;r++){e=JSON.parse(JSON.stringify(e));var i=t[r].split(`/`),a=e,o;for(o=1;o<i.length;o++)a=a[i[o]];for(o=0;o<n.length;o++){var s=n[o],c=a[s];c&&(a[s]={anyOf:[c,{$ref:`https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#`}]})}}return e}})),Ws=s(((e,t)=>{var n=fs().MissingRef;t.exports=r;function r(e,t,i){var a=this;if(typeof this._opts.loadSchema!=`function`)throw Error(`options.loadSchema should be a function`);typeof t==`function`&&(i=t,t=void 0);var o=s(e).then(function(){var n=a._addSchema(e,void 0,t);return n.validate||c(n)});return i&&o.then(function(e){i(null,e)},i),o;function s(e){var t=e.$schema;return t&&!a.getSchema(t)?r.call(a,{$ref:t},!0):Promise.resolve()}function c(e){try{return a._compile(e)}catch(e){if(e instanceof n)return r(e);throw e}function r(n){var r=n.missingSchema;if(l(r))throw Error(`Schema `+r+` is loaded but `+n.missingRef+` cannot be resolved`);var i=a._loadingSchemas[r];return i||(i=a._loadingSchemas[r]=a._opts.loadSchema(r),i.then(o,o)),i.then(function(e){if(!l(r))return s(e).then(function(){l(r)||a.addSchema(e,r,void 0,t)})}).then(function(){return c(e)});function o(){delete a._loadingSchemas[r]}function l(e){return a._refs[e]||a._schemas[e]}}}}})),Gs=s(((e,t)=>{t.exports=function(e,t,n){var r=` `,i=e.level,a=e.dataLevel,o=e.schema[t],s=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+`/`+t,l=!e.opts.allErrors,u,d=`data`+(a||``),f=`valid`+i,p=`errs__`+i,m=e.opts.$data&&o&&o.$data,h;m?(r+=` var schema`+i+` = `+e.util.getData(o.$data,a,e.dataPathArr)+`; `,h=`schema`+i):h=o;var g=this,_=`definition`+i,v=g.definition,y=``,b,x,S,C,w;if(m&&v.$data){w=`keywordValidate`+i;var T=v.validateSchema;r+=` var `+_+` = RULES.custom['`+t+`'].definition; var `+w+` = `+_+`.validate;`}else{if(C=e.useCustomRule(g,o,e.schema,e),!C)return;h=`validate.schema`+s,w=C.code,b=v.compile,x=v.inline,S=v.macro}var E=w+`.errors`,D=`i`+i,O=`ruleErr`+i,k=v.async;if(k&&!e.async)throw Error(`async keyword in sync schema`);if(x||S||(r+=``+E+` = null;`),r+=`var `+p+` = errors;var `+f+`;`,m&&v.$data&&(y+=`}`,r+=` if (`+h+` === undefined) { `+f+` = true; } else { `,T&&(y+=`}`,r+=` `+f+` = `+_+`.validateSchema(`+h+`); if (`+f+`) { `)),x)v.statements?r+=` `+C.validate+` `:r+=` `+f+` = `+C.validate+`; `;else if(S){var A=e.util.copy(e),y=``;A.level++;var ee=`valid`+A.level;A.schema=C.validate,A.schemaPath=``;var j=e.compositeRule;e.compositeRule=A.compositeRule=!0;var M=e.validate(A).replace(/validate\.schema/g,w);e.compositeRule=A.compositeRule=j,r+=` `+M}else{var N=N||[];N.push(r),r=``,r+=` `+w+`.call( `,e.opts.passContext?r+=`this`:r+=`self`,b||v.schema===!1?r+=` , `+d+` `:r+=` , `+h+` , `+d+` , validate.schema`+e.schemaPath+` `,r+=` , (dataPath || '')`,e.errorPath!=`""`&&(r+=` + `+e.errorPath);var P=a?`data`+(a-1||``):`parentData`,te=a?e.dataPathArr[a]:`parentDataProperty`;r+=` , `+P+` , `+te+` , rootData ) `;var F=r;r=N.pop(),v.errors===!1?(r+=` `+f+` = `,k&&(r+=`await `),r+=``+F+`; `):k?(E=`customErrors`+i,r+=` var `+E+` = null; try { `+f+` = await `+F+`; } catch (e) { `+f+` = false; if (e instanceof ValidationError) `+E+` = e.errors; else throw e; } `):r+=` `+E+` = null; `+f+` = `+F+`; `}if(v.modifying&&(r+=` if (`+P+`) `+d+` = `+P+`[`+te+`];`),r+=``+y,v.valid)l&&(r+=` if (true) { `);else{r+=` if ( `,v.valid===void 0?(r+=` !`,S?r+=``+ee:r+=``+f):r+=` `+!v.valid+` `,r+=`) { `,u=g.keyword;var N=N||[];N.push(r),r=``;var N=N||[];N.push(r),r=``,e.createErrors===!1?r+=` {} `:(r+=` { keyword: '`+(u||`custom`)+`' , dataPath: (dataPath || '') + `+e.errorPath+` , schemaPath: `+e.util.toQuotedString(c)+` , params: { keyword: '`+g.keyword+`' } `,e.opts.messages!==!1&&(r+=` , message: 'should pass "`+g.keyword+`" keyword validation' `),e.opts.verbose&&(r+=` , schema: validate.schema`+s+` , parentSchema: validate.schema`+e.schemaPath+` , data: `+d+` `),r+=` } `);var I=r;r=N.pop(),!e.compositeRule&&l?e.async?r+=` throw new ValidationError([`+I+`]); `:r+=` validate.errors = [`+I+`]; return false; `:r+=` var err = `+I+`; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; `;var L=r;r=N.pop(),x?v.errors?v.errors!=`full`&&(r+=` for (var `+D+`=`+p+`; `+D+`<errors; `+D+`++) { var `+O+` = vErrors[`+D+`]; if (`+O+`.dataPath === undefined) `+O+`.dataPath = (dataPath || '') + `+e.errorPath+`; if (`+O+`.schemaPath === undefined) { `+O+`.schemaPath = "`+c+`"; } `,e.opts.verbose&&(r+=` `+O+`.schema = `+h+`; `+O+`.data = `+d+`; `),r+=` } `):v.errors===!1?r+=` `+L+` `:(r+=` if (`+p+` == errors) { `+L+` } else { for (var `+D+`=`+p+`; `+D+`<errors; `+D+`++) { var `+O+` = vErrors[`+D+`]; if (`+O+`.dataPath === undefined) `+O+`.dataPath = (dataPath || '') + `+e.errorPath+`; if (`+O+`.schemaPath === undefined) { `+O+`.schemaPath = "`+c+`"; } `,e.opts.verbose&&(r+=` `+O+`.schema = `+h+`; `+O+`.data = `+d+`; `),r+=` } } `):S?(r+=` var err = `,e.createErrors===!1?r+=` {} `:(r+=` { keyword: '`+(u||`custom`)+`' , dataPath: (dataPath || '') + `+e.errorPath+` , schemaPath: `+e.util.toQuotedString(c)+` , params: { keyword: '`+g.keyword+`' } `,e.opts.messages!==!1&&(r+=` , message: 'should pass "`+g.keyword+`" keyword validation' `),e.opts.verbose&&(r+=` , schema: validate.schema`+s+` , parentSchema: validate.schema`+e.schemaPath+` , data: `+d+` `),r+=` } `),r+=`; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; `,!e.compositeRule&&l&&(e.async?r+=` throw new ValidationError(vErrors); `:r+=` validate.errors = vErrors; return false; `)):v.errors===!1?r+=` `+L+` `:(r+=` if (Array.isArray(`+E+`)) { if (vErrors === null) vErrors = `+E+`; else vErrors = vErrors.concat(`+E+`); errors = vErrors.length; for (var `+D+`=`+p+`; `+D+`<errors; `+D+`++) { var `+O+` = vErrors[`+D+`]; if (`+O+`.dataPath === undefined) `+O+`.dataPath = (dataPath || '') + `+e.errorPath+`; `+O+`.schemaPath = "`+c+`"; `,e.opts.verbose&&(r+=` `+O+`.schema = `+h+`; `+O+`.data = `+d+`; `),r+=` } } else { `+L+` } `),r+=` } `,l&&(r+=` else { `)}return r}})),Ks=s(((e,t)=>{t.exports={$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}})),qs=s(((e,t)=>{var n=Ks();t.exports={$id:`https://github.com/ajv-validator/ajv/blob/master/lib/definition_schema.js`,definitions:{simpleTypes:n.definitions.simpleTypes},type:`object`,dependencies:{schema:[`validate`],$data:[`validate`],statements:[`inline`],valid:{not:{required:[`macro`]}}},properties:{type:n.properties.type,schema:{type:`boolean`},statements:{type:`boolean`},dependencies:{type:`array`,items:{type:`string`}},metaSchema:{type:`object`},modifying:{type:`boolean`},valid:{type:`boolean`},$data:{type:`boolean`},async:{type:`boolean`},errors:{anyOf:[{type:`boolean`},{const:`full`}]}}}})),Js=s(((e,t)=>{var n=/^[a-z_$][a-z0-9_$-]*$/i,r=Gs(),i=qs();t.exports={add:a,get:o,remove:s,validate:c};function a(e,t){var i=this.RULES;if(i.keywords[e])throw Error(`Keyword `+e+` is already defined`);if(!n.test(e))throw Error(`Keyword `+e+` is not a valid identifier`);if(t){this.validateKeyword(t,!0);var a=t.type;if(Array.isArray(a))for(var o=0;o<a.length;o++)c(e,a[o],t);else c(e,a,t);var s=t.metaSchema;s&&(t.$data&&this._opts.$data&&(s={anyOf:[s,{$ref:`https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#`}]}),t.validateSchema=this.compile(s,!0))}i.keywords[e]=i.all[e]=!0;function c(e,t,n){for(var a,o=0;o<i.length;o++){var s=i[o];if(s.type==t){a=s;break}}a||(a={type:t,rules:[]},i.push(a));var c={keyword:e,definition:n,custom:!0,code:r,implements:n.implements};a.rules.push(c),i.custom[e]=c}return this}function o(e){var t=this.RULES.custom[e];return t?t.definition:this.RULES.keywords[e]||!1}function s(e){var t=this.RULES;delete t.keywords[e],delete t.all[e],delete t.custom[e];for(var n=0;n<t.length;n++)for(var r=t[n].rules,i=0;i<r.length;i++)if(r[i].keyword==e){r.splice(i,1);break}return this}function c(e,t){c.errors=null;var n=this._validateKeyword=this._validateKeyword||this.compile(i,!0);if(n(e))return!0;if(c.errors=n.errors,t)throw Error(`custom keyword definition is invalid: `+this.errorsText(n.errors));return!1}})),Ys=s(((e,t)=>{t.exports={$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}})),Xs=l(s(((e,t)=>{var n=hs(),r=ds(),i=gs(),a=ls(),o=ps(),s=_s(),c=Hs(),l=Us(),u=cs();t.exports=g,g.prototype.validate=_,g.prototype.compile=v,g.prototype.addSchema=y,g.prototype.addMetaSchema=b,g.prototype.validateSchema=x,g.prototype.getSchema=C,g.prototype.removeSchema=E,g.prototype.addFormat=P,g.prototype.errorsText=N,g.prototype._addSchema=O,g.prototype._compile=k,g.prototype.compileAsync=Ws();var d=Js();g.prototype.addKeyword=d.add,g.prototype.getKeyword=d.get,g.prototype.removeKeyword=d.remove,g.prototype.validateKeyword=d.validate;var f=fs();g.ValidationError=f.Validation,g.MissingRefError=f.MissingRef,g.$dataMetaSchema=l;var p=`http://json-schema.org/draft-07/schema`,m=[`removeAdditional`,`useDefaults`,`coerceTypes`,`strictDefaults`],h=[`/properties`];function g(e){if(!(this instanceof g))return new g(e);e=this._opts=u.copy(e)||{},re(this),this._schemas={},this._refs={},this._fragments={},this._formats=s(e.format),this._cache=e.cache||new i,this._loadingSchemas={},this._compilations=[],this.RULES=c(),this._getId=A(e),e.loopRequired=e.loopRequired||1/0,e.errorDataPath==`property`&&(e._errorDataPathProperty=!0),e.serialize===void 0&&(e.serialize=o),this._metaOpts=ne(this),e.formats&&I(this),e.keywords&&L(this),te(this),typeof e.meta==`object`&&this.addMetaSchema(e.meta),e.nullable&&this.addKeyword(`nullable`,{metaSchema:{type:`boolean`}}),F(this)}function _(e,t){var n;if(typeof e==`string`){if(n=this.getSchema(e),!n)throw Error(`no schema with key or ref "`+e+`"`)}else{var r=this._addSchema(e);n=r.validate||this._compile(r)}var i=n(t);return n.$async!==!0&&(this.errors=n.errors),i}function v(e,t){var n=this._addSchema(e,void 0,t);return n.validate||this._compile(n)}function y(e,t,n,i){if(Array.isArray(e)){for(var a=0;a<e.length;a++)this.addSchema(e[a],void 0,n,i);return this}var o=this._getId(e);if(o!==void 0&&typeof o!=`string`)throw Error(`schema id must be string`);return t=r.normalizeId(t||o),R(this,t),this._schemas[t]=this._addSchema(e,n,i,!0),this}function b(e,t,n){return this.addSchema(e,t,n,!0),this}function x(e,t){var n=e.$schema;if(n!==void 0&&typeof n!=`string`)throw Error(`$schema must be a string`);if(n=n||this._opts.defaultMeta||S(this),!n)return this.logger.warn(`meta-schema not available`),this.errors=null,!0;var r=this.validate(n,e);if(!r&&t){var i=`schema is invalid: `+this.errorsText();if(this._opts.validateSchema==`log`)this.logger.error(i);else throw Error(i)}return r}function S(e){var t=e._opts.meta;return e._opts.defaultMeta=typeof t==`object`?e._getId(t)||t:e.getSchema(p)?p:void 0,e._opts.defaultMeta}function C(e){var t=T(this,e);switch(typeof t){case`object`:return t.validate||this._compile(t);case`string`:return this.getSchema(t);case`undefined`:return w(this,e)}}function w(e,t){var i=r.schema.call(e,{schema:{}},t);if(i){var o=i.schema,s=i.root,c=i.baseId,l=n.call(e,o,s,void 0,c);return e._fragments[t]=new a({ref:t,fragment:!0,schema:o,root:s,baseId:c,validate:l}),l}}function T(e,t){return t=r.normalizeId(t),e._schemas[t]||e._refs[t]||e._fragments[t]}function E(e){if(e instanceof RegExp)return D(this,this._schemas,e),D(this,this._refs,e),this;switch(typeof e){case`undefined`:return D(this,this._schemas),D(this,this._refs),this._cache.clear(),this;case`string`:var t=T(this,e);return t&&this._cache.del(t.cacheKey),delete this._schemas[e],delete this._refs[e],this;case`object`:var n=this._opts.serialize,i=n?n(e):e;this._cache.del(i);var a=this._getId(e);a&&(a=r.normalizeId(a),delete this._schemas[a],delete this._refs[a])}return this}function D(e,t,n){for(var r in t){var i=t[r];!i.meta&&(!n||n.test(r))&&(e._cache.del(i.cacheKey),delete t[r])}}function O(e,t,n,i){if(typeof e!=`object`&&typeof e!=`boolean`)throw Error(`schema should be object or boolean`);var o=this._opts.serialize,s=o?o(e):e,c=this._cache.get(s);if(c)return c;i||=this._opts.addUsedSchema!==!1;var l=r.normalizeId(this._getId(e));l&&i&&R(this,l);var u=this._opts.validateSchema!==!1&&!t,d;u&&!(d=l&&l==r.normalizeId(e.$schema))&&this.validateSchema(e,!0);var f=new a({id:l,schema:e,localRefs:r.ids.call(this,e),cacheKey:s,meta:n});return l[0]!=`#`&&i&&(this._refs[l]=f),this._cache.put(s,f),u&&d&&this.validateSchema(e,!0),f}function k(e,t){if(e.compiling)return e.validate=a,a.schema=e.schema,a.errors=null,a.root=t||a,e.schema.$async===!0&&(a.$async=!0),a;e.compiling=!0;var r;e.meta&&(r=this._opts,this._opts=this._metaOpts);var i;try{i=n.call(this,e.schema,t,e.localRefs)}catch(t){throw delete e.validate,t}finally{e.compiling=!1,e.meta&&(this._opts=r)}return e.validate=i,e.refs=i.refs,e.refVal=i.refVal,e.root=i.root,i;function a(){var t=e.validate,n=t.apply(this,arguments);return a.errors=t.errors,n}}function A(e){switch(e.schemaId){case`auto`:return M;case`id`:return ee;default:return j}}function ee(e){return e.$id&&this.logger.warn(`schema $id ignored`,e.$id),e.id}function j(e){return e.id&&this.logger.warn(`schema id ignored`,e.id),e.$id}function M(e){if(e.$id&&e.id&&e.$id!=e.id)throw Error(`schema $id is different from id`);return e.$id||e.id}function N(e,t){if(e||=this.errors,!e)return`No errors`;t||={};for(var n=t.separator===void 0?`, `:t.separator,r=t.dataVar===void 0?`data`:t.dataVar,i=``,a=0;a<e.length;a++){var o=e[a];o&&(i+=r+o.dataPath+` `+o.message+n)}return i.slice(0,-n.length)}function P(e,t){return typeof t==`string`&&(t=new RegExp(t)),this._formats[e]=t,this}function te(e){var t;if(e._opts.$data&&(t=Ys(),e.addMetaSchema(t,t.$id,!0)),e._opts.meta!==!1){var n=Ks();e._opts.$data&&(n=l(n,h)),e.addMetaSchema(n,p,!0),e._refs[`http://json-schema.org/schema`]=p}}function F(e){var t=e._opts.schemas;if(t)if(Array.isArray(t))e.addSchema(t);else for(var n in t)e.addSchema(t[n],n)}function I(e){for(var t in e._opts.formats){var n=e._opts.formats[t];e.addFormat(t,n)}}function L(e){for(var t in e._opts.keywords){var n=e._opts.keywords[t];e.addKeyword(t,n)}}function R(e,t){if(e._schemas[t]||e._refs[t])throw Error(`schema with key or id "`+t+`" already exists`)}function ne(e){for(var t=u.copy(e._opts),n=0;n<m.length;n++)delete t[m[n]];return t}function re(e){var t=e._opts.logger;if(t===!1)e.logger={log:ie,warn:ie,error:ie};else{if(t===void 0&&(t=console),!(typeof t==`object`&&t.log&&t.warn&&t.error))throw Error(`logger must implement log, warn and error methods`);e.logger=t}}function ie(){}}))(),1),Zs=class extends rs{constructor(e,t){super(t),this._serverInfo=e,this._capabilities=t?.capabilities??{},this._instructions=t?.instructions,this.setRequestHandler(qa,e=>this._oninitialize(e)),this.setNotificationHandler(Xa,()=>this.oninitialized?.call(this))}registerCapabilities(e){if(this.transport)throw Error(`Cannot register capabilities after connecting to transport`);this._capabilities=is(this._capabilities,e)}assertCapabilityForMethod(e){switch(e){case`sampling/createMessage`:if(!this._clientCapabilities?.sampling)throw Error(`Client does not support sampling (required for ${e})`);break;case`elicitation/create`:if(!this._clientCapabilities?.elicitation)throw Error(`Client does not support elicitation (required for ${e})`);break;case`roots/list`:if(!this._clientCapabilities?.roots)throw Error(`Client does not support listing roots (required for ${e})`);break;case`ping`:break}}assertNotificationCapability(e){switch(e){case`notifications/message`:if(!this._capabilities.logging)throw Error(`Server does not support logging (required for ${e})`);break;case`notifications/resources/updated`:case`notifications/resources/list_changed`:if(!this._capabilities.resources)throw Error(`Server does not support notifying about resources (required for ${e})`);break;case`notifications/tools/list_changed`:if(!this._capabilities.tools)throw Error(`Server does not support notifying of tool list changes (required for ${e})`);break;case`notifications/prompts/list_changed`:if(!this._capabilities.prompts)throw Error(`Server does not support notifying of prompt list changes (required for ${e})`);break;case`notifications/cancelled`:break;case`notifications/progress`:break}}assertRequestHandlerCapability(e){switch(e){case`sampling/createMessage`:if(!this._capabilities.sampling)throw Error(`Server does not support sampling (required for ${e})`);break;case`logging/setLevel`:if(!this._capabilities.logging)throw Error(`Server does not support logging (required for ${e})`);break;case`prompts/get`:case`prompts/list`:if(!this._capabilities.prompts)throw 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 Error(`Server does not support resources (required for ${e})`);break;case`tools/call`:case`tools/list`:if(!this._capabilities.tools)throw Error(`Server does not support tools (required for ${e})`);break;case`ping`:case`initialize`:break}}async _oninitialize(e){let t=e.params.protocolVersion;return this._clientCapabilities=e.params.capabilities,this._clientVersion=e.params.clientInfo,{protocolVersion:wa.includes(t)?t:Ca,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`},Ha)}async createMessage(e,t){return this.request({method:`sampling/createMessage`,params:e},Wo,t)}async elicitInput(e,t){let n=await this.request({method:`elicitation/create`,params:e},qo,t);if(n.action===`accept`&&n.content)try{let t=new Xs.default,r=t.compile(e.requestedSchema);if(!r(n.content))throw new ns(za.InvalidParams,`Elicitation response content does not match requested schema: ${t.errorsText(r.errors)}`)}catch(e){throw e instanceof ns?e:new ns(za.InternalError,`Error validating elicitation response: ${e}`)}return n}async listRoots(e,t){return this.request({method:`roots/list`,params:e},es,t)}async sendLoggingMessage(e){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`})}},Qs;(function(e){e.Completable=`McpCompletable`})(Qs||={});var $s=class extends J{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}};$s.create=(e,t)=>new $s({type:e,typeName:Qs.Completable,complete:t.complete,...ec(t)});function ec(e){if(!e)return{};let{errorMap:t,invalid_type_error:n,required_error:r,description:i}=e;if(t&&(n||r))throw Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:i}:{errorMap:(t,i)=>{let{message:a}=e;return t.code===`invalid_enum_value`?{message:a??i.defaultError}:i.data===void 0?{message:a??r??i.defaultError}:t.code===`invalid_type`?{message:a??n??i.defaultError}:{message:i.defaultError}},description:i}}var tc=e=>[e.slice(0,e.length/2),e.slice(e.length/2)],nc=Symbol(`Original index`),rc=e=>{let t=[];for(let n=0;n<e.length;n++){let r=e[n];if(typeof r==`boolean`)t.push(r?{[nc]:n}:{[nc]:n,not:{}});else if(nc in r)return e;else t.push({...r,[nc]:n})}return t};function ic(e,t){if(e.allOf.length===0)return ha();if(e.allOf.length===1){let n=e.allOf[0];return Oc(n,{...t,path:[...t.path,`allOf`,n[nc]]})}let[n,r]=tc(rc(e.allOf));return ya(ic({allOf:n},t),ic({allOf:r},t))}var ac=(e,t)=>e.anyOf.length?e.anyOf.length===1?Oc(e.anyOf[0],{...t,path:[...t.path,`anyOf`,0]}):_a(e.anyOf.map((e,n)=>Oc(e,{...t,path:[...t.path,`anyOf`,n]}))):pa();function oc(e,t,n,r){let i=t[n];if(i!==void 0){let a=t.errorMessage?.[n];return r(e,i,a)}return e}var sc={an:{object:e=>e.type===`object`||!e.type&&(e.properties!==void 0||e.additionalProperties!==void 0||e.patternProperties!==void 0),array:e=>e.type===`array`,anyOf:e=>e.anyOf!==void 0,allOf:e=>e.allOf!==void 0,enum:e=>e.enum!==void 0},a:{nullable:e=>e.nullable===!0,multipleType:e=>Array.isArray(e.type),not:e=>e.not!==void 0,const:e=>e.const!==void 0,primitive:(e,t)=>e.type===t,conditional:e=>!!(`if`in e&&e.if&&`then`in e&&`else`in e&&e.then&&e.else),oneOf:e=>e.oneOf!==void 0}},cc=(e,t)=>{if(sc.an.anyOf(e)){let n=new Set,r=[];e.anyOf.forEach(e=>{if(typeof e==`object`&&e.type&&n.add(typeof e.type==`string`?e.type:e.type[0]),typeof e==`object`&&e.items){let t=e.items;!Array.isArray(t)&&typeof t==`object`&&r.push(t)}});let i;r.length===1?i=r[0]:r.length>1&&(i={anyOf:r});let a={...n.size>0?{type:Array.from(n)}:{type:`array`},...i&&{items:i}};return[`default`,`description`,`examples`,`title`].forEach(t=>{let n=e[t];n!==void 0&&(a[t]=n)}),Oc(a,t)}if(Array.isArray(e.items))return ba(e.items.map((e,n)=>Oc(e,{...t,path:[...t.path,`items`,n]})));let n=e.items?ga(Oc(e.items,{...t,path:[...t.path,`items`]})):ga(pa());return n=oc(n,e,`minItems`,(e,t,n)=>e.min(t,n)),n=oc(n,e,`maxItems`,(e,t,n)=>e.max(t,n)),typeof e.min==`number`&&typeof e.minItems!=`number`&&(n=oc(n,{...e,minItems:e.min},`minItems`,(e,t,n)=>e.min(t,n))),typeof e.max==`number`&&typeof e.maxItems!=`number`&&(n=oc(n,{...e,maxItems:e.max},`maxItems`,(e,t,n)=>e.max(t,n))),n},lc=e=>da(),uc=e=>Q(e.const),dc=e=>pa(),fc=e=>e.enum.length===0?ha():e.enum.length===1?Q(e.enum[0]):e.enum.every(e=>typeof e==`string`)?Sa(e.enum):_a(e.enum.map(e=>Q(e))),pc=(e,t)=>{let n=Oc(e.if,{...t,path:[...t.path,`if`]}),r=Oc(e.then,{...t,path:[...t.path,`then`]}),i=Oc(e.else,{...t,path:[...t.path,`else`]});return _a([r,i]).superRefine((e,t)=>{let a=n.safeParse(e).success?r.safeParse(e):i.safeParse(e);a.success||a.error.errors.forEach(e=>t.addIssue(e))})},mc=(e,t)=>_a(e.type.map(n=>Oc({...e,type:n},t))),hc=(e,t)=>pa().refine(n=>!Oc(e.not,{...t,path:[...t.path,`not`]}).safeParse(n).success,`Invalid input: Should NOT be valid against schema`),gc=e=>fa(),_c=(e,...t)=>Object.keys(e).reduce((n,r)=>(t.includes(r)||(n[r]=e[r]),n),{}),vc=(e,t)=>{let n=e.default===null,r=Oc(n?_c(_c(e,`nullable`),`default`):_c(e,`nullable`),t,!0).nullable();return n?r.default(null):r},yc=e=>{let t=ua(),n=!1;return e.type===`integer`?(n=!0,t=oc(t,e,`type`,(e,t,n)=>e.int(n))):e.format===`int64`&&(n=!0,t=oc(t,e,`format`,(e,t,n)=>e.int(n))),t=oc(t,e,`multipleOf`,(e,t,r)=>t===1?n?e:e.int(r):e.multipleOf(t,r)),typeof e.minimum==`number`?t=e.exclusiveMinimum===!0?oc(t,e,`minimum`,(e,t,n)=>e.gt(t,n)):oc(t,e,`minimum`,(e,t,n)=>e.gte(t,n)):typeof e.exclusiveMinimum==`number`&&(t=oc(t,e,`exclusiveMinimum`,(e,t,n)=>e.gt(t,n))),typeof e.maximum==`number`?t=e.exclusiveMaximum===!0?oc(t,e,`maximum`,(e,t,n)=>e.lt(t,n)):oc(t,e,`maximum`,(e,t,n)=>e.lte(t,n)):typeof e.exclusiveMaximum==`number`&&(t=oc(t,e,`exclusiveMaximum`,(e,t,n)=>e.lt(t,n))),typeof e.min==`number`&&typeof e.minimum!=`number`&&(t=oc(t,{...e,minimum:e.min},`minimum`,(e,t,n)=>e.gte(t,n))),typeof e.max==`number`&&typeof e.maximum!=`number`&&(t=oc(t,{...e,maximum:e.max},`maximum`,(e,t,n)=>e.lte(t,n))),t},bc=(e,t)=>e.oneOf.length?e.oneOf.length===1?Oc(e.oneOf[0],{...t,path:[...t.path,`oneOf`,0]}):pa().superRefine((n,r)=>{let i=e.oneOf.map((e,n)=>Oc(e,{...t,path:[...t.path,`oneOf`,n]})),a=i.reduce((e,t)=>(t=>t.error?[...e,t.error]:e)(t.safeParse(n)),[]);i.length-a.length!==1&&r.addIssue({path:r.path,code:`invalid_union`,unionErrors:a,message:`Invalid input: Should pass single schema`})}):pa();function xc(e,t){if(!e.properties)return Z({});let n=Object.keys(e.properties);if(n.length===0)return Z({});let r={};for(let i of n){let n=e.properties[i],a=Oc(n,{...t,path:[...t.path,`properties`,i]}),o=Array.isArray(e.required)?e.required.includes(i):!1;if(!o&&n&&typeof n==`object`&&`default`in n)if(n.default===null){let e=n.anyOf&&Array.isArray(n.anyOf)&&n.anyOf.some(e=>typeof e==`object`&&!!e&&e.type===`null`),t=n.oneOf&&Array.isArray(n.oneOf)&&n.oneOf.some(e=>typeof e==`object`&&!!e&&e.type===`null`),o=`nullable`in n&&n.nullable===!0;e||t||o?r[i]=a.optional().default(null):r[i]=a.nullable().optional().default(null)}else r[i]=a.optional().default(n.default);else r[i]=o?a:a.optional()}return Z(r)}function Sc(e,t){let n=Object.keys(e.patternProperties??{}).length>0,r=e.type===`object`?e:{...e,type:`object`},i=xc(r,t),a=i,o=r.additionalProperties===void 0?void 0:Oc(r.additionalProperties,{...t,path:[...t.path,`additionalProperties`]}),s=r.additionalProperties===!0;if(r.patternProperties){let e=Object.fromEntries(Object.entries(r.patternProperties).map(([e,n])=>[e,Oc(n,{...t,path:[...t.path,`patternProperties`,e]})])),n=Object.values(e);a=i?o?i.catchall(_a([...n,o])):Object.keys(e).length>1?i.catchall(_a(n)):i.catchall(n[0]):o?xa(_a([...n,o])):n.length>1?xa(_a(n)):xa(n[0]);let s=new Set(Object.keys(r.properties??{}));a=a.superRefine((t,n)=>{for(let i in t){let a=s.has(i);for(let o in r.patternProperties){let r=new RegExp(o);if(i.match(r)){a=!0;let r=e[o].safeParse(t[i]);r.success||n.addIssue({path:[...n.path,i],code:`custom`,message:`Invalid input: Key matching regex /${i}/ must match schema`,params:{issues:r.error.issues}})}}if(!a&&o){let e=o.safeParse(t[i]);e.success||n.addIssue({path:[...n.path,i],code:`custom`,message:`Invalid input: must match catchall schema`,params:{issues:e.error.issues}})}}})}let c;return c=i?n?a:o?o instanceof Pi?i.strict():s?i.passthrough():i.catchall(o):i.strict():n?a:o?o instanceof Pi?Z({}).strict():s?Z({}).passthrough():xa(o):Z({}).passthrough(),sc.an.anyOf(e)&&(c=c.and(ac({...e,anyOf:e.anyOf.map(e=>typeof e==`object`&&!e.type&&(e.properties??e.additionalProperties??e.patternProperties)?{...e,type:`object`}:e)},t))),sc.a.oneOf(e)&&(c=c.and(bc({...e,oneOf:e.oneOf.map(e=>typeof e==`object`&&!e.type&&(e.properties??e.additionalProperties??e.patternProperties)?{...e,type:`object`}:e)},t))),sc.an.allOf(e)&&(c=c.and(ic({...e,allOf:e.allOf.map(e=>typeof e==`object`&&!e.type&&(e.properties??e.additionalProperties??e.patternProperties)?{...e,type:`object`}:e)},t))),c}var Cc=e=>{let t=X();return t=oc(t,e,`format`,(e,t,n)=>{switch(t){case`email`:return e.email(n);case`ip`:return e.ip(n);case`ipv4`:return e.ip({version:`v4`,message:n});case`ipv6`:return e.ip({version:`v6`,message:n});case`uri`:return e.url(n);case`uuid`:return e.uuid(n);case`date-time`:return e.datetime({offset:!0,message:n});case`time`:return e.time(n);case`date`:return e.date(n);case`binary`:return e.base64(n);case`duration`:return e.duration(n);default:return e}}),t=oc(t,e,`contentEncoding`,(e,t,n)=>e.base64(n)),t=oc(t,e,`pattern`,(e,t,n)=>e.regex(new RegExp(t),n)),t=oc(t,e,`minLength`,(e,t,n)=>e.min(t,n)),t=oc(t,e,`maxLength`,(e,t,n)=>e.max(t,n)),typeof e.min==`number`&&typeof e.minLength!=`number`&&(t=oc(t,{...e,minLength:e.min},`minLength`,(e,t,n)=>e.min(t,n))),typeof e.max==`number`&&typeof e.maxLength!=`number`&&(t=oc(t,{...e,maxLength:e.max},`maxLength`,(e,t,n)=>e.max(t,n))),t},wc=(e,t)=>{let n=``;if(e.description?n=e.description:e.title&&(n=e.title),e.example!==void 0){let t=`Example: ${JSON.stringify(e.example)}`;n=n?`${n}
2
4
  ${t}`:t}else if(e.examples!==void 0&&Array.isArray(e.examples)){let t=e.examples;if(t&&t.length&&t.length>0){let e=t.length===1?`Example: ${JSON.stringify(t[0])}`:`Examples:
3
5
  ${t.map(e=>` ${JSON.stringify(e)}`).join(`
4
6
  `)}`;n=n?`${n}
5
- ${e}`:e}}return n&&(t=t.describe(n)),t},Wa=(e,t,n)=>{if(e.default!==void 0){if(e.default===null&&n?.path.some(e=>e===`anyOf`||e===`oneOf`)&&e.type&&e.type!==`null`&&!e.nullable)return t;t=t.default(e.default)}return t},Ga=(e,t)=>(e.readOnly&&(t=t.readonly()),t),Ka=(e,t)=>Q.a.nullable(e)?La(e,t):Q.an.object(e)?Va(e,t):Q.an.array(e)?Da(e,t):Q.an.anyOf(e)?Ea(e,t):Q.an.allOf(e)?Ta(e,t):Q.a.oneOf(e)?za(e,t):Q.a.not(e)?Pa(e,t):Q.an.enum(e)?ja(e):Q.a.const(e)?ka(e):Q.a.multipleType(e)?Na(e,t):Q.a.primitive(e,`string`)?Ha(e):Q.a.primitive(e,`number`)||Q.a.primitive(e,`integer`)?Ra(e):Q.a.primitive(e,`boolean`)?Oa(e):Q.a.primitive(e,`null`)?Fa(e):Q.a.conditional(e)?Ma(e,t):Aa(e),$=(e,t={seen:new Map,path:[]},n)=>{if(typeof e!=`object`)return e?pa():ma();if(t.parserOverride){let n=t.parserOverride(e,t);if(n instanceof W)return n}let r=t.seen.get(e);if(r){if(r.r!==void 0)return r.r;if(t.depth===void 0||r.n>=t.depth)return pa();r.n+=1}else r={r:void 0,n:0},t.seen.set(e,r);let i=Ka(e,t);return n||(t.withoutDescribes||(i=Ua(e,i)),t.withoutDefaults||(i=Wa(e,i,t)),i=Ga(e,i)),r.r=i,i},qa=(e,t={})=>$(e,{path:[],seen:new Map,...t});function Ja(e){if(typeof e!=`object`||!e||`type`in e&&typeof e.type==`string`)return!1;let t=Object.values(e);return t.length===0?!1:t.some(e=>e instanceof W)}function Ya(e){try{return qa(e)}catch(e){return console.warn(`[Web Model Context] Failed to convert JSON Schema to Zod:`,e),ga({}).passthrough()}}function Xa(e){let t={},n=[];for(let[r,i]of Object.entries(e)){let e=i.description||void 0,a=`string`,o,s;if(i instanceof Ei)a=`string`;else if(i instanceof Oi)a=`number`;else if(i instanceof Ai)a=`boolean`;else if(i instanceof Ri){a=`array`;let e=i.element;s=e instanceof Ei?{type:`string`}:e instanceof Oi?{type:`number`}:e instanceof Ai?{type:`boolean`}:{type:`string`}}else if(i instanceof K)a=`object`;else if(i instanceof $i){a=`string`;let e=i._def;e?.values&&(o=e.values)}let c={type:a};e&&(c.description=e),o&&(c.enum=o),s&&(c.items=s),t[r]=c,i.isOptional()||n.push(r)}return{type:`object`,properties:t,...n.length>0&&{required:n}}}function Za(e){if(Ja(e))return{jsonSchema:Xa(e),zodValidator:ga(e)};let t=e;return{jsonSchema:t,zodValidator:Ya(t)}}function Qa(e,t){let n=t.safeParse(e);return n.success?{success:!0,data:n.data}:{success:!1,error:`Validation failed:\n${n.error.errors.map(e=>` - ${e.path.join(`.`)||`root`}: ${e.message}`).join(`
6
- `)}`}}var $a=class extends Event{name;arguments;_response=null;_responded=!1;constructor(e,t){super(`toolcall`,{cancelable:!0}),this.name=e,this.arguments=t}respondWith(e){if(this._responded)throw Error(`Response already provided for this tool call`);this._response=e,this._responded=!0}getResponse(){return this._response}hasResponse(){return this._responded}},eo=class{bridge;eventTarget;provideContextTools;dynamicTools;registrationTimestamps;unregisterFunctions;constructor(e){this.bridge=e,this.eventTarget=new EventTarget,this.provideContextTools=new Map,this.dynamicTools=new Map,this.registrationTimestamps=new Map,this.unregisterFunctions=new Map}addEventListener(e,t,n){this.eventTarget.addEventListener(e,t,n)}removeEventListener(e,t,n){this.eventTarget.removeEventListener(e,t,n)}dispatchEvent(e){return this.eventTarget.dispatchEvent(e)}provideContext(e){console.log(`[Web Model Context] Registering ${e.tools.length} tools via provideContext`),this.provideContextTools.clear();for(let t of e.tools){if(this.dynamicTools.has(t.name))throw Error(`[Web Model Context] Tool name collision: "${t.name}" is already registered via registerTool(). Please use a different name or unregister the dynamic tool first.`);let{jsonSchema:e,zodValidator:n}=Za(t.inputSchema),r=t.outputSchema?Za(t.outputSchema):null,i={name:t.name,description:t.description,inputSchema:e,...r&&{outputSchema:r.jsonSchema},...t.annotations&&{annotations:t.annotations},execute:t.execute,inputValidator:n,...r&&{outputValidator:r.zodValidator}};this.provideContextTools.set(t.name,i)}this.updateBridgeTools(),this.bridge.server.notification&&this.bridge.server.notification({method:`notifications/tools/list_changed`,params:{}})}registerTool(e){console.log(`[Web Model Context] Registering tool dynamically: ${e.name}`);let t=Date.now(),n=this.registrationTimestamps.get(e.name);if(n&&t-n<50){console.warn(`[Web Model Context] Tool "${e.name}" registered multiple times within 50ms. This is likely due to React Strict Mode double-mounting. Ignoring duplicate registration.`);let t=this.unregisterFunctions.get(e.name);if(t)return{unregister:t}}if(this.provideContextTools.has(e.name))throw Error(`[Web Model Context] Tool name collision: "${e.name}" is already registered via provideContext(). Please use a different name or update your provideContext() call.`);if(this.dynamicTools.has(e.name))throw Error(`[Web Model Context] Tool name collision: "${e.name}" is already registered via registerTool(). Please unregister it first or use a different name.`);let{jsonSchema:r,zodValidator:i}=Za(e.inputSchema),a=e.outputSchema?Za(e.outputSchema):null,o={name:e.name,description:e.description,inputSchema:r,...a&&{outputSchema:a.jsonSchema},...e.annotations&&{annotations:e.annotations},execute:e.execute,inputValidator:i,...a&&{outputValidator:a.zodValidator}};this.dynamicTools.set(e.name,o),this.registrationTimestamps.set(e.name,t),this.updateBridgeTools(),this.bridge.server.notification&&this.bridge.server.notification({method:`notifications/tools/list_changed`,params:{}});let s=()=>{if(console.log(`[Web Model Context] Unregistering tool: ${e.name}`),this.provideContextTools.has(e.name))throw Error(`[Web Model Context] Cannot unregister tool "${e.name}": This tool was registered via provideContext(). Use provideContext() to update the base tool set.`);if(!this.dynamicTools.has(e.name)){console.warn(`[Web Model Context] Tool "${e.name}" is not registered, ignoring unregister call`);return}this.dynamicTools.delete(e.name),this.registrationTimestamps.delete(e.name),this.unregisterFunctions.delete(e.name),this.updateBridgeTools(),this.bridge.server.notification&&this.bridge.server.notification({method:`notifications/tools/list_changed`,params:{}})};return this.unregisterFunctions.set(e.name,s),{unregister:s}}updateBridgeTools(){this.bridge.tools.clear();for(let[e,t]of this.provideContextTools)this.bridge.tools.set(e,t);for(let[e,t]of this.dynamicTools)this.bridge.tools.set(e,t);console.log(`[Web Model Context] Updated bridge with ${this.provideContextTools.size} base tools + ${this.dynamicTools.size} dynamic tools = ${this.bridge.tools.size} total`)}async executeTool(e,t){let n=this.bridge.tools.get(e);if(!n)throw Error(`Tool not found: ${e}`);console.log(`[Web Model Context] Validating input for tool: ${e}`);let r=Qa(t,n.inputValidator);if(!r.success)return console.error(`[Web Model Context] Input validation failed for ${e}:`,r.error),{content:[{type:`text`,text:`Input validation error for tool "${e}":\n${r.error}`}],isError:!0};let i=r.data,a=new $a(e,i);if(this.dispatchEvent(a),a.defaultPrevented&&a.hasResponse()){let t=a.getResponse();if(t)return console.log(`[Web Model Context] Tool ${e} handled by event listener`),t}console.log(`[Web Model Context] Executing tool: ${e}`);try{let t=await n.execute(i);if(n.outputValidator&&t.structuredContent){let r=Qa(t.structuredContent,n.outputValidator);r.success||console.warn(`[Web Model Context] Output validation failed for ${e}:`,r.error)}return t}catch(t){return console.error(`[Web Model Context] Error executing tool ${e}:`,t),{content:[{type:`text`,text:`Error: ${t instanceof Error?t.message:String(t)}`}],isError:!0}}}listTools(){return Array.from(this.bridge.tools.values()).map(e=>({name:e.name,description:e.description,inputSchema:e.inputSchema,...e.outputSchema&&{outputSchema:e.outputSchema},...e.annotations&&{annotations:e.annotations}}))}};function to(){console.log(`[Web Model Context] Initializing MCP bridge`);let e=new t.Server({name:window.location.hostname||`localhost`,version:`1.0.0`},{capabilities:{tools:{listChanged:!0}}}),n={server:e,tools:new Map,modelContext:void 0,isInitialized:!0};n.modelContext=new eo(n),e.setRequestHandler(t.ListToolsRequestSchema,async()=>(console.log(`[MCP Bridge] Handling list_tools request`),{tools:n.modelContext.listTools()})),e.setRequestHandler(t.CallToolRequestSchema,async e=>{console.log(`[MCP Bridge] Handling call_tool request: ${e.params.name}`);let t=e.params.name,r=e.params.arguments||{};try{let e=await n.modelContext.executeTool(t,r);return{content:e.content,isError:e.isError}}catch(e){throw console.error(`[MCP Bridge] Error calling tool ${t}:`,e),e}});let r=new Wr({allowedOrigins:[`*`]});return e.connect(r),console.log(`[Web Model Context] MCP server connected`),n}function no(){if(typeof window>`u`){console.warn(`[Web Model Context] Not in browser environment, skipping initialization`);return}if(window.navigator.modelContext){console.warn(`[Web Model Context] window.navigator.modelContext already exists, skipping initialization`);return}try{let e=to();Object.defineProperty(window.navigator,`modelContext`,{value:e.modelContext,writable:!1,configurable:!1}),Object.defineProperty(window,`__mcpBridge`,{value:e,writable:!1,configurable:!0}),console.log(`✅ [Web Model Context] window.navigator.modelContext initialized successfully`)}catch(e){throw console.error(`[Web Model Context] Failed to initialize:`,e),e}}function ro(){if(!(typeof window>`u`)){if(window.__mcpBridge)try{window.__mcpBridge.server.close()}catch(e){console.warn(`[Web Model Context] Error closing MCP server:`,e)}delete window.navigator.modelContext,delete window.__mcpBridge,console.log(`[Web Model Context] Cleaned up`)}}if(typeof window<`u`&&typeof document<`u`)try{no()}catch(e){console.error(`[Web Model Context] Auto-initialization failed:`,e)}return e.cleanupWebModelContext=ro,e.initializeWebModelContext=no,e})({},__mcp_b_webmcp_ts_sdk);
7
+ ${e}`:e}}return n&&(t=t.describe(n)),t},Tc=(e,t,n)=>{if(e.default!==void 0){if(e.default===null&&n?.path.some(e=>e===`anyOf`||e===`oneOf`)&&e.type&&e.type!==`null`&&!e.nullable)return t;t=t.default(e.default)}return t},Ec=(e,t)=>(e.readOnly&&(t=t.readonly()),t),Dc=(e,t)=>sc.a.nullable(e)?vc(e,t):sc.an.object(e)?Sc(e,t):sc.an.array(e)?cc(e,t):sc.an.anyOf(e)?ac(e,t):sc.an.allOf(e)?ic(e,t):sc.a.oneOf(e)?bc(e,t):sc.a.not(e)?hc(e,t):sc.an.enum(e)?fc(e):sc.a.const(e)?uc(e):sc.a.multipleType(e)?mc(e,t):sc.a.primitive(e,`string`)?Cc(e):sc.a.primitive(e,`number`)||sc.a.primitive(e,`integer`)?yc(e):sc.a.primitive(e,`boolean`)?lc(e):sc.a.primitive(e,`null`)?gc(e):sc.a.conditional(e)?pc(e,t):dc(e),Oc=(e,t={seen:new Map,path:[]},n)=>{if(typeof e!=`object`)return e?pa():ha();if(t.parserOverride){let n=t.parserOverride(e,t);if(n instanceof J)return n}let r=t.seen.get(e);if(r){if(r.r!==void 0)return r.r;if(t.depth===void 0||r.n>=t.depth)return pa();r.n+=1}else r={r:void 0,n:0},t.seen.set(e,r);let i=Dc(e,t);return n||(t.withoutDescribes||(i=wc(e,i)),t.withoutDefaults||(i=Tc(e,i,t)),i=Ec(e,i)),r.r=i,i},kc=(e,t={})=>Oc(e,{path:[],seen:new Map,...t});function Ac(e){if(typeof e!=`object`||!e||`type`in e&&typeof e.type==`string`)return!1;let t=Object.values(e);return t.length===0?!1:t.some(e=>e instanceof J)}function jc(e){try{return kc(e)}catch(e){return console.warn(`[Web Model Context] Failed to convert JSON Schema to Zod:`,e),Z({}).passthrough()}}function Mc(e){let t={},n=[];for(let[r,i]of Object.entries(e)){let e=i.description||void 0,a=`string`,o,s;if(i instanceof Ci)a=`string`;else if(i instanceof Ti)a=`number`;else if(i instanceof Di)a=`boolean`;else if(i instanceof Ii){a=`array`;let e=i.element;s=e instanceof Ci?{type:`string`}:e instanceof Ti?{type:`number`}:e instanceof Di?{type:`boolean`}:{type:`string`}}else if(i instanceof Ri)a=`object`;else if(i instanceof Qi){a=`string`;let e=i._def;e?.values&&(o=e.values)}let c={type:a};e&&(c.description=e),o&&(c.enum=o),s&&(c.items=s),t[r]=c,i.isOptional()||n.push(r)}return{type:`object`,properties:t,...n.length>0&&{required:n}}}function Nc(e){if(Ac(e))return{jsonSchema:Mc(e),zodValidator:Z(e)};let t=e;return{jsonSchema:t,zodValidator:jc(t)}}function Pc(e,t){let n=t.safeParse(e);return n.success?{success:!0,data:n.data}:{success:!1,error:`Validation failed:\n${n.error.errors.map(e=>` - ${e.path.join(`.`)||`root`}: ${e.message}`).join(`
8
+ `)}`}}var Fc=class extends Event{name;arguments;_response=null;_responded=!1;constructor(e,t){super(`toolcall`,{cancelable:!0}),this.name=e,this.arguments=t}respondWith(e){if(this._responded)throw Error(`Response already provided for this tool call`);this._response=e,this._responded=!0}getResponse(){return this._response}hasResponse(){return this._responded}},Ic=class{bridge;eventTarget;provideContextTools;dynamicTools;registrationTimestamps;unregisterFunctions;constructor(e){this.bridge=e,this.eventTarget=new EventTarget,this.provideContextTools=new Map,this.dynamicTools=new Map,this.registrationTimestamps=new Map,this.unregisterFunctions=new Map}addEventListener(e,t,n){this.eventTarget.addEventListener(e,t,n)}removeEventListener(e,t,n){this.eventTarget.removeEventListener(e,t,n)}dispatchEvent(e){return this.eventTarget.dispatchEvent(e)}provideContext(e){console.log(`[Web Model Context] Registering ${e.tools.length} tools via provideContext`),this.provideContextTools.clear();for(let t of e.tools){if(this.dynamicTools.has(t.name))throw Error(`[Web Model Context] Tool name collision: "${t.name}" is already registered via registerTool(). Please use a different name or unregister the dynamic tool first.`);let{jsonSchema:e,zodValidator:n}=Nc(t.inputSchema),r=t.outputSchema?Nc(t.outputSchema):null,i={name:t.name,description:t.description,inputSchema:e,...r&&{outputSchema:r.jsonSchema},...t.annotations&&{annotations:t.annotations},execute:t.execute,inputValidator:n,...r&&{outputValidator:r.zodValidator}};this.provideContextTools.set(t.name,i)}this.updateBridgeTools(),this.bridge.server.notification&&this.bridge.server.notification({method:`notifications/tools/list_changed`,params:{}})}registerTool(e){console.log(`[Web Model Context] Registering tool dynamically: ${e.name}`);let t=Date.now(),n=this.registrationTimestamps.get(e.name);if(n&&t-n<50){console.warn(`[Web Model Context] Tool "${e.name}" registered multiple times within 50ms. This is likely due to React Strict Mode double-mounting. Ignoring duplicate registration.`);let t=this.unregisterFunctions.get(e.name);if(t)return{unregister:t}}if(this.provideContextTools.has(e.name))throw Error(`[Web Model Context] Tool name collision: "${e.name}" is already registered via provideContext(). Please use a different name or update your provideContext() call.`);if(this.dynamicTools.has(e.name))throw Error(`[Web Model Context] Tool name collision: "${e.name}" is already registered via registerTool(). Please unregister it first or use a different name.`);let{jsonSchema:r,zodValidator:i}=Nc(e.inputSchema),a=e.outputSchema?Nc(e.outputSchema):null,o={name:e.name,description:e.description,inputSchema:r,...a&&{outputSchema:a.jsonSchema},...e.annotations&&{annotations:e.annotations},execute:e.execute,inputValidator:i,...a&&{outputValidator:a.zodValidator}};this.dynamicTools.set(e.name,o),this.registrationTimestamps.set(e.name,t),this.updateBridgeTools(),this.bridge.server.notification&&this.bridge.server.notification({method:`notifications/tools/list_changed`,params:{}});let s=()=>{if(console.log(`[Web Model Context] Unregistering tool: ${e.name}`),this.provideContextTools.has(e.name))throw Error(`[Web Model Context] Cannot unregister tool "${e.name}": This tool was registered via provideContext(). Use provideContext() to update the base tool set.`);if(!this.dynamicTools.has(e.name)){console.warn(`[Web Model Context] Tool "${e.name}" is not registered, ignoring unregister call`);return}this.dynamicTools.delete(e.name),this.registrationTimestamps.delete(e.name),this.unregisterFunctions.delete(e.name),this.updateBridgeTools(),this.bridge.server.notification&&this.bridge.server.notification({method:`notifications/tools/list_changed`,params:{}})};return this.unregisterFunctions.set(e.name,s),{unregister:s}}updateBridgeTools(){this.bridge.tools.clear();for(let[e,t]of this.provideContextTools)this.bridge.tools.set(e,t);for(let[e,t]of this.dynamicTools)this.bridge.tools.set(e,t);console.log(`[Web Model Context] Updated bridge with ${this.provideContextTools.size} base tools + ${this.dynamicTools.size} dynamic tools = ${this.bridge.tools.size} total`)}async executeTool(e,t){let n=this.bridge.tools.get(e);if(!n)throw Error(`Tool not found: ${e}`);console.log(`[Web Model Context] Validating input for tool: ${e}`);let r=Pc(t,n.inputValidator);if(!r.success)return console.error(`[Web Model Context] Input validation failed for ${e}:`,r.error),{content:[{type:`text`,text:`Input validation error for tool "${e}":\n${r.error}`}],isError:!0};let i=r.data,a=new Fc(e,i);if(this.dispatchEvent(a),a.defaultPrevented&&a.hasResponse()){let t=a.getResponse();if(t)return console.log(`[Web Model Context] Tool ${e} handled by event listener`),t}console.log(`[Web Model Context] Executing tool: ${e}`);try{let t=await n.execute(i);if(n.outputValidator&&t.structuredContent){let r=Pc(t.structuredContent,n.outputValidator);r.success||console.warn(`[Web Model Context] Output validation failed for ${e}:`,r.error)}return t}catch(t){return console.error(`[Web Model Context] Error executing tool ${e}:`,t),{content:[{type:`text`,text:`Error: ${t instanceof Error?t.message:String(t)}`}],isError:!0}}}listTools(){return Array.from(this.bridge.tools.values()).map(e=>({name:e.name,description:e.description,inputSchema:e.inputSchema,...e.outputSchema&&{outputSchema:e.outputSchema},...e.annotations&&{annotations:e.annotations}}))}};function Lc(){console.log(`[Web Model Context] Initializing MCP bridge`);let e=new Zs({name:window.location.hostname||`localhost`,version:`1.0.0`},{capabilities:{tools:{listChanged:!0}}}),t={server:e,tools:new Map,modelContext:void 0,isInitialized:!0};t.modelContext=new Ic(t),e.setRequestHandler(No,async()=>(console.log(`[MCP Bridge] Handling list_tools request`),{tools:t.modelContext.listTools()})),e.setRequestHandler(Io,async e=>{console.log(`[MCP Bridge] Handling call_tool request: ${e.params.name}`);let n=e.params.name,r=e.params.arguments||{};try{let e=await t.modelContext.executeTool(n,r);return{content:e.content,isError:e.isError}}catch(e){throw console.error(`[MCP Bridge] Error calling tool ${n}:`,e),e}});let n=new Lr({allowedOrigins:[`*`]});return e.connect(n),console.log(`[Web Model Context] MCP server connected`),t}function Rc(){if(typeof window>`u`){console.warn(`[Web Model Context] Not in browser environment, skipping initialization`);return}if(window.navigator.modelContext){console.warn(`[Web Model Context] window.navigator.modelContext already exists, skipping initialization`);return}try{let e=Lc();Object.defineProperty(window.navigator,`modelContext`,{value:e.modelContext,writable:!1,configurable:!1}),Object.defineProperty(window,`__mcpBridge`,{value:e,writable:!1,configurable:!0}),console.log(`✅ [Web Model Context] window.navigator.modelContext initialized successfully`)}catch(e){throw console.error(`[Web Model Context] Failed to initialize:`,e),e}}function zc(){if(!(typeof window>`u`)){if(window.__mcpBridge)try{window.__mcpBridge.server.close()}catch(e){console.warn(`[Web Model Context] Error closing MCP server:`,e)}delete window.navigator.modelContext,delete window.__mcpBridge,console.log(`[Web Model Context] Cleaned up`)}}if(typeof window<`u`&&typeof document<`u`)try{Rc()}catch(e){console.error(`[Web Model Context] Auto-initialization failed:`,e)}return e.cleanupWebModelContext=zc,e.initializeWebModelContext=Rc,e})({});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mcp-b/global",
3
- "version": "1.0.14",
3
+ "version": "1.0.15",
4
4
  "description": "W3C Web Model Context API polyfill - implements window.navigator.modelContext bridging to Model Context Protocol",
5
5
  "keywords": [
6
6
  "mcp",