@aiquants/html-to-markdown 1.2.1 → 1.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core-CHYQAf6b.cjs +1 -0
- package/dist/core-CkCUqS2i.js +3 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1 -1
- package/dist/main.cjs +1 -1
- package/dist/main.js +1 -1
- package/dist/mcp-server-BviJ0BJj.js +1 -0
- package/dist/mcp-server-D18WYyj-.cjs +1 -0
- package/dist/mcp-server-streamable-BPxUnvzy.cjs +1 -0
- package/dist/mcp-server-streamable-D4CUcTDr.js +1 -0
- package/dist/mcp-streamable.cjs +1 -1
- package/dist/mcp-streamable.d.ts +1 -0
- package/dist/mcp-streamable.js +1 -1
- package/dist/mcp.cjs +1 -1
- package/dist/mcp.d.ts +1 -0
- package/dist/mcp.js +1 -1
- package/dist/src/mcp-server.d.ts +9 -3
- package/dist/src/plugins/index.d.ts +1 -1
- package/dist/src/simple-logger.d.ts +97 -0
- package/dist/version-Dbzh6HLt.cjs +7 -0
- package/dist/version-Fr0FqrXS.js +24 -0
- package/package.json +5 -4
- package/dist/core-CTBCnkuY.js +0 -3
- package/dist/core-diGadcw4.cjs +0 -1
- package/dist/mcp-server-DSLDlYZX.cjs +0 -1
- package/dist/mcp-server-DmJXoVRZ.js +0 -1
- package/dist/mcp-server-streamable-CgJP5t9P.js +0 -1
- package/dist/mcp-server-streamable-DZ7VyWAg.cjs +0 -1
- package/dist/version-DAQkOvqo.cjs +0 -7
- package/dist/version-yDYKn_vW.js +0 -7
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
const e=new(require("happy-dom").Window);Object.assign(global,{document:e.document,window:e,self:e});const t=require("./core-CHYQAf6b.cjs"),r=require("node:fs"),n=require("node:path"),o=require("node:url");var s,a="undefined"!=typeof document?document.currentScript:null;function i(e,t,r){function n(r,n){if(r._zod||Object.defineProperty(r,"_zod",{value:{def:n,constr:a,traits:new Set},enumerable:!1}),r._zod.traits.has(e))return;r._zod.traits.add(e),t(r,n);const o=a.prototype,s=Object.keys(o);for(let e=0;e<s.length;e++){const t=s[e];t in r||(r[t]=o[t].bind(r))}}const o=r?.Parent??Object;class s extends o{}function a(e){var t;const o=r?.Parent?new s:this;n(o,e),(t=o._zod).deferred??(t.deferred=[]);for(const r of o._zod.deferred)r();return o}return Object.defineProperty(s,"name",{value:e}),Object.defineProperty(a,"init",{value:n}),Object.defineProperty(a,Symbol.hasInstance,{value:t=>!!(r?.Parent&&t instanceof r.Parent)||t?._zod?.traits?.has(e)}),Object.defineProperty(a,"name",{value:e}),a}class c extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class u extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}}(s=globalThis).__zod_globalConfig??(s.__zod_globalConfig={});const d=globalThis.__zod_globalConfig;function l(e){return d}function p(e){const t=Object.values(e).filter(e=>"number"==typeof e);return Object.entries(e).filter(([e,r])=>-1===t.indexOf(+e)).map(([e,t])=>t)}function f(e,t){return"bigint"==typeof t?t.toString():t}function h(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function m(e){return null==e}function y(e){const t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}const g=Symbol("evaluating");function v(e,t,r){let n;Object.defineProperty(e,t,{get(){if(n!==g)return void 0===n&&(n=g,n=r()),n},set(r){Object.defineProperty(e,t,{value:r})},configurable:!0})}function _(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function w(...e){const t={};for(const r of e){const e=Object.getOwnPropertyDescriptors(r);Object.assign(t,e)}return Object.defineProperties({},t)}function $(e){return JSON.stringify(e)}const b="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function k(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}const E=h(()=>{if(d.jitless)return!1;if("undefined"!=typeof navigator&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(e){return!1}});function S(e){if(!1===k(e))return!1;const t=e.constructor;if(void 0===t)return!0;if("function"!=typeof t)return!0;const r=t.prototype;return!1!==k(r)&&!1!==Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")}function P(e){return S(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}const z=new Set(["string","number","symbol"]);function T(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function x(e,t,r){const n=new e._zod.constr(t??e._zod.def);return t&&!r?.parent||(n._zod.parent=e),n}function I(e){const t=e;if(!t)return{};if("string"==typeof t)return{error:()=>t};if(void 0!==t?.message){if(void 0!==t?.error)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,"string"==typeof t.error?{...t,error:()=>t.error}:t}const N={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function j(e,t=0){if(!0===e.aborted)return!0;for(let r=t;r<e.issues.length;r++)if(!0!==e.issues[r]?.continue)return!0;return!1}function O(e,t=0){if(!0===e.aborted)return!0;for(let r=t;r<e.issues.length;r++)if(!1===e.issues[r]?.continue)return!0;return!1}function C(e,t){return t.map(t=>{var r;return(r=t).path??(r.path=[]),t.path.unshift(e),t})}function R(e){return"string"==typeof e?e:e?.message}function A(e,t,r){const n=e.message?e.message:R(e.inst?._zod.def?.error?.(e))??R(t?.error?.(e))??R(r.customError?.(e))??R(r.localeError?.(e))??"Invalid input",{inst:o,continue:s,input:a,...i}=e;return i.path??(i.path=[]),i.message=n,t?.reportInput&&(i.input=a),i}function M(e){return Array.isArray(e)?"array":"string"==typeof e?"string":"unknown"}function q(...e){const[t,r,n]=e;return"string"==typeof t?{message:t,code:"custom",input:r,inst:n}:{...t}}const D=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,f,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},U=i("$ZodError",D),V=i("$ZodError",D,{Parent:Error});const F=e=>(t,r,n,o)=>{const s=n?{...n,async:!1}:{async:!1},a=t._zod.run({value:r,issues:[]},s);if(a instanceof Promise)throw new c;if(a.issues.length){const t=new(o?.Err??e)(a.issues.map(e=>A(e,s,l())));throw b(t,o?.callee),t}return a.value},Z=e=>async(t,r,n,o)=>{const s=n?{...n,async:!0}:{async:!0};let a=t._zod.run({value:r,issues:[]},s);if(a instanceof Promise&&(a=await a),a.issues.length){const t=new(o?.Err??e)(a.issues.map(e=>A(e,s,l())));throw b(t,o?.callee),t}return a.value},L=e=>(t,r,n)=>{const o=n?{...n,async:!1}:{async:!1},s=t._zod.run({value:r,issues:[]},o);if(s instanceof Promise)throw new c;return s.issues.length?{success:!1,error:new(e??U)(s.issues.map(e=>A(e,o,l())))}:{success:!0,data:s.value}},H=L(V),J=e=>async(t,r,n)=>{const o=n?{...n,async:!0}:{async:!0};let s=t._zod.run({value:r,issues:[]},o);return s instanceof Promise&&(s=await s),s.issues.length?{success:!1,error:new e(s.issues.map(e=>A(e,o,l())))}:{success:!0,data:s.value}},K=J(V),G=e=>(t,r,n)=>{const o=n?{...n,direction:"backward"}:{direction:"backward"};return F(e)(t,r,o)},B=e=>(t,r,n)=>F(e)(t,r,n),W=e=>async(t,r,n)=>{const o=n?{...n,direction:"backward"}:{direction:"backward"};return Z(e)(t,r,o)},Q=e=>async(t,r,n)=>Z(e)(t,r,n),Y=e=>(t,r,n)=>{const o=n?{...n,direction:"backward"}:{direction:"backward"};return L(e)(t,r,o)},X=e=>(t,r,n)=>L(e)(t,r,n),ee=e=>async(t,r,n)=>{const o=n?{...n,direction:"backward"}:{direction:"backward"};return J(e)(t,r,o)},te=e=>async(t,r,n)=>J(e)(t,r,n),re=/^[cC][0-9a-z]{6,}$/,ne=/^[0-9a-z]+$/,oe=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,se=/^[0-9a-vA-V]{20}$/,ae=/^[A-Za-z0-9]{27}$/,ie=/^[a-zA-Z0-9_-]{21}$/,ce=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,ue=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,de=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,le=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;const pe=/^(?:(?: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=/^(([0-9a-fA-F]{1,4}:){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}|:))$/,he=/^((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])\/([0-9]|[1-2][0-9]|3[0-2])$/,me=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,ye=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,ge=/^[A-Za-z0-9_-]*$/,ve=/^https?$/,_e=/^\+[1-9]\d{6,14}$/,we="(?:(?:\\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])))",$e=new RegExp(`^${we}$`);function be(e){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return"number"==typeof e.precision?-1===e.precision?`${t}`:0===e.precision?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}const ke=/^-?\d+$/,Ee=/^-?\d+(?:\.\d+)?$/,Se=/^(?:true|false)$/i,Pe=/^null$/i,ze=/^[^A-Z]*$/,Te=/^[^a-z]*$/,xe=i("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),Ie={number:"number",bigint:"bigint",object:"date"},Ne=i("$ZodCheckLessThan",(e,t)=>{xe.init(e,t);const r=Ie[typeof t.value];e._zod.onattach.push(e=>{const r=e._zod.bag,n=(t.inclusive?r.maximum:r.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<n&&(t.inclusive?r.maximum=t.value:r.exclusiveMaximum=t.value)}),e._zod.check=n=>{(t.inclusive?n.value<=t.value:n.value<t.value)||n.issues.push({origin:r,code:"too_big",maximum:"object"==typeof t.value?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),je=i("$ZodCheckGreaterThan",(e,t)=>{xe.init(e,t);const r=Ie[typeof t.value];e._zod.onattach.push(e=>{const r=e._zod.bag,n=(t.inclusive?r.minimum:r.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>n&&(t.inclusive?r.minimum=t.value:r.exclusiveMinimum=t.value)}),e._zod.check=n=>{(t.inclusive?n.value>=t.value:n.value>t.value)||n.issues.push({origin:r,code:"too_small",minimum:"object"==typeof t.value?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Oe=i("$ZodCheckMultipleOf",(e,t)=>{xe.init(e,t),e._zod.onattach.push(e=>{var r;(r=e._zod.bag).multipleOf??(r.multipleOf=t.value)}),e._zod.check=r=>{if(typeof r.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");("bigint"==typeof r.value?r.value%t.value===BigInt(0):0===function(e,t){const r=e/t,n=Math.round(r),o=Number.EPSILON*Math.max(Math.abs(r),1);return Math.abs(r-n)<o?0:r-n}(r.value,t.value))||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}}),Ce=i("$ZodCheckNumberFormat",(e,t)=>{xe.init(e,t),t.format=t.format||"float64";const r=t.format?.includes("int"),n=r?"int":"number",[o,s]=N[t.format];e._zod.onattach.push(e=>{const n=e._zod.bag;n.format=t.format,n.minimum=o,n.maximum=s,r&&(n.pattern=ke)}),e._zod.check=a=>{const i=a.value;if(r){if(!Number.isInteger(i))return void a.issues.push({expected:n,format:t.format,code:"invalid_type",continue:!1,input:i,inst:e});if(!Number.isSafeInteger(i))return void(i>0?a.issues.push({input:i,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort}):a.issues.push({input:i,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort}))}i<o&&a.issues.push({origin:"number",input:i,code:"too_small",minimum:o,inclusive:!0,inst:e,continue:!t.abort}),i>s&&a.issues.push({origin:"number",input:i,code:"too_big",maximum:s,inclusive:!0,inst:e,continue:!t.abort})}}),Re=i("$ZodCheckMaxLength",(e,t)=>{var r;xe.init(e,t),(r=e._zod.def).when??(r.when=e=>{const t=e.value;return!m(t)&&void 0!==t.length}),e._zod.onattach.push(e=>{const r=e._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<r&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=r=>{const n=r.value;if(n.length<=t.maximum)return;const o=M(n);r.issues.push({origin:o,code:"too_big",maximum:t.maximum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),Ae=i("$ZodCheckMinLength",(e,t)=>{var r;xe.init(e,t),(r=e._zod.def).when??(r.when=e=>{const t=e.value;return!m(t)&&void 0!==t.length}),e._zod.onattach.push(e=>{const r=e._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>r&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=r=>{const n=r.value;if(n.length>=t.minimum)return;const o=M(n);r.issues.push({origin:o,code:"too_small",minimum:t.minimum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),Me=i("$ZodCheckLengthEquals",(e,t)=>{var r;xe.init(e,t),(r=e._zod.def).when??(r.when=e=>{const t=e.value;return!m(t)&&void 0!==t.length}),e._zod.onattach.push(e=>{const r=e._zod.bag;r.minimum=t.length,r.maximum=t.length,r.length=t.length}),e._zod.check=r=>{const n=r.value,o=n.length;if(o===t.length)return;const s=M(n),a=o>t.length;r.issues.push({origin:s,...a?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),qe=i("$ZodCheckStringFormat",(e,t)=>{var r,n;xe.init(e,t),e._zod.onattach.push(e=>{const r=e._zod.bag;r.format=t.format,t.pattern&&(r.patterns??(r.patterns=new Set),r.patterns.add(t.pattern))}),t.pattern?(r=e._zod).check??(r.check=r=>{t.pattern.lastIndex=0,t.pattern.test(r.value)||r.issues.push({origin:"string",code:"invalid_format",format:t.format,input:r.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(n=e._zod).check??(n.check=()=>{})}),De=i("$ZodCheckRegex",(e,t)=>{qe.init(e,t),e._zod.check=r=>{t.pattern.lastIndex=0,t.pattern.test(r.value)||r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Ue=i("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=ze),qe.init(e,t)}),Ve=i("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Te),qe.init(e,t)}),Fe=i("$ZodCheckIncludes",(e,t)=>{xe.init(e,t);const r=T(t.includes),n=new RegExp("number"==typeof t.position?`^.{${t.position}}${r}`:r);t.pattern=n,e._zod.onattach.push(e=>{const t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(n)}),e._zod.check=r=>{r.value.includes(t.includes,t.position)||r.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:r.value,inst:e,continue:!t.abort})}}),Ze=i("$ZodCheckStartsWith",(e,t)=>{xe.init(e,t);const r=new RegExp(`^${T(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.onattach.push(e=>{const t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(r)}),e._zod.check=r=>{r.value.startsWith(t.prefix)||r.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:r.value,inst:e,continue:!t.abort})}}),Le=i("$ZodCheckEndsWith",(e,t)=>{xe.init(e,t);const r=new RegExp(`.*${T(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.onattach.push(e=>{const t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(r)}),e._zod.check=r=>{r.value.endsWith(t.suffix)||r.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:r.value,inst:e,continue:!t.abort})}}),He=i("$ZodCheckOverwrite",(e,t)=>{xe.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}});class Je{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if("function"==typeof e)return e(this,{execution:"sync"}),void e(this,{execution:"async"});const t=e.split("\n").filter(e=>e),r=Math.min(...t.map(e=>e.length-e.trimStart().length)),n=t.map(e=>e.slice(r)).map(e=>" ".repeat(2*this.indent)+e);for(const o of n)this.content.push(o)}compile(){const e=Function,t=this?.args;return new e(...t,[...(this?.content??[""]).map(e=>` ${e}`)].join("\n"))}}const Ke={major:4,minor:4,patch:3},Ge=i("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Ke;const n=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&n.unshift(e);for(const o of n)for(const t of o._zod.onattach)t(e);if(0===n.length)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{const t=(e,t,r)=>{let n,o=j(e);for(const s of t){if(s._zod.def.when){if(O(e))continue;if(!s._zod.def.when(e))continue}else if(o)continue;const t=e.issues.length,a=s._zod.check(e);if(a instanceof Promise&&!1===r?.async)throw new c;if(n||a instanceof Promise)n=(n??Promise.resolve()).then(async()=>{await a;e.issues.length!==t&&(o||(o=j(e,t)))});else{if(e.issues.length===t)continue;o||(o=j(e,t))}}return n?n.then(()=>e):e},r=(r,o,s)=>{if(j(r))return r.aborted=!0,r;const a=t(o,n,s);if(a instanceof Promise){if(!1===s.async)throw new c;return a.then(t=>e._zod.parse(t,s))}return e._zod.parse(a,s)};e._zod.run=(o,s)=>{if(s.skipChecks)return e._zod.parse(o,s);if("backward"===s.direction){const t=e._zod.parse({value:o.value,issues:[]},{...s,skipChecks:!0});return t instanceof Promise?t.then(e=>r(e,o,s)):r(t,o,s)}const a=e._zod.parse(o,s);if(a instanceof Promise){if(!1===s.async)throw new c;return a.then(e=>t(e,n,s))}return t(a,n,s)}}v(e,"~standard",()=>({validate:t=>{try{const r=H(e,t);return r.success?{value:r.data}:{issues:r.error?.issues}}catch(r){return K(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:"zod",version:1}))}),Be=i("$ZodString",(e,t)=>{var r;Ge.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??(r=e._zod.bag,new RegExp(`^${r?`[\\s\\S]{${r?.minimum??0},${r?.maximum??""}}`:"[\\s\\S]*"}$`)),e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=String(r.value)}catch(o){}return"string"==typeof r.value||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),We=i("$ZodStringFormat",(e,t)=>{qe.init(e,t),Be.init(e,t)}),Qe=i("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=ue),We.init(e,t)}),Ye=i("$ZodUUID",(e,t)=>{if(t.version){const e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(void 0===e)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=de(e))}else t.pattern??(t.pattern=de());We.init(e,t)}),Xe=i("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=le),We.init(e,t)}),et=i("$ZodURL",(e,t)=>{We.init(e,t),e._zod.check=r=>{try{const n=r.value.trim();if(!t.normalize&&t.protocol?.source===ve.source&&!/^https?:\/\//i.test(n))return void r.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:r.value,inst:e,continue:!t.abort});const o=new URL(n);return t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(o.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:r.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(o.protocol.endsWith(":")?o.protocol.slice(0,-1):o.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort})),void(t.normalize?r.value=o.href:r.value=n)}catch(n){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),tt=i("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),We.init(e,t)}),rt=i("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=ie),We.init(e,t)}),nt=i("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=re),We.init(e,t)}),ot=i("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=ne),We.init(e,t)}),st=i("$ZodULID",(e,t)=>{t.pattern??(t.pattern=oe),We.init(e,t)}),at=i("$ZodXID",(e,t)=>{t.pattern??(t.pattern=se),We.init(e,t)}),it=i("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=ae),We.init(e,t)}),ct=i("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=function(e){const t=be({precision:e.precision}),r=["Z"];e.local&&r.push(""),e.offset&&r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const n=`${t}(?:${r.join("|")})`;return new RegExp(`^${we}T(?:${n})$`)}(t)),We.init(e,t)}),ut=i("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=$e),We.init(e,t)}),dt=i("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=new RegExp(`^${be(t)}$`)),We.init(e,t)}),lt=i("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=ce),We.init(e,t)}),pt=i("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=pe),We.init(e,t),e._zod.bag.format="ipv4"}),ft=i("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=fe),We.init(e,t),e._zod.bag.format="ipv6",e._zod.check=r=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}}}),ht=i("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=he),We.init(e,t)}),mt=i("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=me),We.init(e,t),e._zod.check=r=>{const n=r.value.split("/");try{if(2!==n.length)throw new Error;const[e,t]=n;if(!t)throw new Error;const r=Number(t);if(`${r}`!==t)throw new Error;if(r<0||r>128)throw new Error;new URL(`http://[${e}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}}});function yt(e){if(""===e)return!0;if(/\s/.test(e))return!1;if(e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}const gt=i("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=ye),We.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=r=>{yt(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}});const vt=i("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=ge),We.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=r=>{(function(e){if(!ge.test(e))return!1;const t=e.replace(/[-_]/g,e=>"-"===e?"+":"/");return yt(t.padEnd(4*Math.ceil(t.length/4),"="))})(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),_t=i("$ZodE164",(e,t)=>{t.pattern??(t.pattern=_e),We.init(e,t)});const wt=i("$ZodJWT",(e,t)=>{We.init(e,t),e._zod.check=r=>{(function(e,t=null){try{const r=e.split(".");if(3!==r.length)return!1;const[n]=r;if(!n)return!1;const o=JSON.parse(atob(n));return!("typ"in o&&"JWT"!==o?.typ||!o.alg||t&&(!("alg"in o)||o.alg!==t))}catch{return!1}})(r.value,t.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}}),$t=i("$ZodNumber",(e,t)=>{Ge.init(e,t),e._zod.pattern=e._zod.bag.pattern??Ee,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=Number(r.value)}catch(a){}const o=r.value;if("number"==typeof o&&!Number.isNaN(o)&&Number.isFinite(o))return r;const s="number"==typeof o?Number.isNaN(o)?"NaN":Number.isFinite(o)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:o,inst:e,...s?{received:s}:{}}),r}}),bt=i("$ZodNumberFormat",(e,t)=>{Ce.init(e,t),$t.init(e,t)}),kt=i("$ZodBoolean",(e,t)=>{Ge.init(e,t),e._zod.pattern=Se,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=Boolean(r.value)}catch(s){}const o=r.value;return"boolean"==typeof o||r.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:e}),r}}),Et=i("$ZodNull",(e,t)=>{Ge.init(e,t),e._zod.pattern=Pe,e._zod.values=new Set([null]),e._zod.parse=(t,r)=>{const n=t.value;return null===n||t.issues.push({expected:"null",code:"invalid_type",input:n,inst:e}),t}}),St=i("$ZodUnknown",(e,t)=>{Ge.init(e,t),e._zod.parse=e=>e}),Pt=i("$ZodNever",(e,t)=>{Ge.init(e,t),e._zod.parse=(t,r)=>(t.issues.push({expected:"never",code:"invalid_type",input:t.value,inst:e}),t)});function zt(e,t,r){e.issues.length&&t.issues.push(...C(r,e.issues)),t.value[r]=e.value}const Tt=i("$ZodArray",(e,t)=>{Ge.init(e,t),e._zod.parse=(r,n)=>{const o=r.value;if(!Array.isArray(o))return r.issues.push({expected:"array",code:"invalid_type",input:o,inst:e}),r;r.value=Array(o.length);const s=[];for(let e=0;e<o.length;e++){const a=o[e],i=t.element._zod.run({value:a,issues:[]},n);i instanceof Promise?s.push(i.then(t=>zt(t,r,e))):zt(i,r,e)}return s.length?Promise.all(s).then(()=>r):r}});function xt(e,t,r,n,o,s){const a=r in n;if(e.issues.length){if(o&&s&&!a)return;t.issues.push(...C(r,e.issues))}a||o?void 0===e.value?a&&(t.value[r]=void 0):t.value[r]=e.value:e.issues.length||t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[r]})}function It(e){const t=Object.keys(e.shape);for(const o of t)if(!e.shape?.[o]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${o}": expected a Zod schema`);const r=(n=e.shape,Object.keys(n).filter(e=>"optional"===n[e]._zod.optin&&"optional"===n[e]._zod.optout));var n;return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(r)}}function Nt(e,t,r,n,o,s){const a=[],i=o.keySet,c=o.catchall._zod,u=c.def.type,d="optional"===c.optin,l="optional"===c.optout;for(const p in t){if("__proto__"===p)continue;if(i.has(p))continue;if("never"===u){a.push(p);continue}const o=c.run({value:t[p],issues:[]},n);o instanceof Promise?e.push(o.then(e=>xt(e,r,p,t,d,l))):xt(o,r,p,t,d,l)}return a.length&&r.issues.push({code:"unrecognized_keys",keys:a,input:t,inst:s}),e.length?Promise.all(e).then(()=>r):r}const jt=i("$ZodObject",(e,t)=>{Ge.init(e,t);const r=Object.getOwnPropertyDescriptor(t,"shape");if(!r?.get){const e=t.shape;Object.defineProperty(t,"shape",{get:()=>{const r={...e};return Object.defineProperty(t,"shape",{value:r}),r}})}const n=h(()=>It(t));v(e._zod,"propValues",()=>{const e=t.shape,r={};for(const t in e){const n=e[t]._zod;if(n.values){r[t]??(r[t]=new Set);for(const e of n.values)r[t].add(e)}}return r});const o=k,s=t.catchall;let a;e._zod.parse=(t,r)=>{a??(a=n.value);const i=t.value;if(!o(i))return t.issues.push({expected:"object",code:"invalid_type",input:i,inst:e}),t;t.value={};const c=[],u=a.shape;for(const e of a.keys){const n=u[e],o="optional"===n._zod.optin,s="optional"===n._zod.optout,a=n._zod.run({value:i[e],issues:[]},r);a instanceof Promise?c.push(a.then(r=>xt(r,t,e,i,o,s))):xt(a,t,e,i,o,s)}return s?Nt(c,i,t,r,n.value,e):c.length?Promise.all(c).then(()=>t):t}}),Ot=i("$ZodObjectJIT",(e,t)=>{jt.init(e,t);const r=e._zod.parse,n=h(()=>It(t));let o;const s=k,a=!d.jitless,i=a&&E.value,c=t.catchall;let u;e._zod.parse=(d,l)=>{u??(u=n.value);const p=d.value;return s(p)?a&&i&&!1===l?.async&&!0!==l.jitless?(o||(o=(e=>{const t=new Je(["shape","payload","ctx"]),r=n.value,o=e=>{const t=$(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write("const input = payload.value;");const s=Object.create(null);let a=0;for(const n of r.keys)s[n]="key_"+a++;t.write("const newResult = {};");for(const n of r.keys){const r=s[n],a=$(n),i=e[n],c="optional"===i?._zod?.optin,u="optional"===i?._zod?.optout;t.write(`const ${r} = ${o(n)};`),c&&u?t.write(`\n if (${r}.issues.length) {\n if (${a} in input) {\n payload.issues = payload.issues.concat(${r}.issues.map(iss => ({\n ...iss,\n path: iss.path ? [${a}, ...iss.path] : [${a}]\n })));\n }\n }\n \n if (${r}.value === undefined) {\n if (${a} in input) {\n newResult[${a}] = undefined;\n }\n } else {\n newResult[${a}] = ${r}.value;\n }\n \n `):c?t.write(`\n if (${r}.issues.length) {\n payload.issues = payload.issues.concat(${r}.issues.map(iss => ({\n ...iss,\n path: iss.path ? [${a}, ...iss.path] : [${a}]\n })));\n }\n \n if (${r}.value === undefined) {\n if (${a} in input) {\n newResult[${a}] = undefined;\n }\n } else {\n newResult[${a}] = ${r}.value;\n }\n \n `):t.write(`\n const ${r}_present = ${a} in input;\n if (${r}.issues.length) {\n payload.issues = payload.issues.concat(${r}.issues.map(iss => ({\n ...iss,\n path: iss.path ? [${a}, ...iss.path] : [${a}]\n })));\n }\n if (!${r}_present && !${r}.issues.length) {\n payload.issues.push({\n code: "invalid_type",\n expected: "nonoptional",\n input: undefined,\n path: [${a}]\n });\n }\n\n if (${r}_present) {\n if (${r}.value === undefined) {\n newResult[${a}] = undefined;\n } else {\n newResult[${a}] = ${r}.value;\n }\n }\n\n `)}t.write("payload.value = newResult;"),t.write("return payload;");const i=t.compile();return(t,r)=>i(e,t,r)})(t.shape)),d=o(d,l),c?Nt([],p,d,l,u,e):d):r(d,l):(d.issues.push({expected:"object",code:"invalid_type",input:p,inst:e}),d)}});function Ct(e,t,r,n){for(const s of e)if(0===s.issues.length)return t.value=s.value,t;const o=e.filter(e=>!j(e));return 1===o.length?(t.value=o[0].value,o[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(e=>e.issues.map(e=>A(e,n,l())))}),t)}const Rt=i("$ZodUnion",(e,t)=>{Ge.init(e,t),v(e._zod,"optin",()=>t.options.some(e=>"optional"===e._zod.optin)?"optional":void 0),v(e._zod,"optout",()=>t.options.some(e=>"optional"===e._zod.optout)?"optional":void 0),v(e._zod,"values",()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),v(e._zod,"pattern",()=>{if(t.options.every(e=>e._zod.pattern)){const e=t.options.map(e=>e._zod.pattern);return new RegExp(`^(${e.map(e=>y(e.source)).join("|")})$`)}});const r=1===t.options.length?t.options[0]._zod.run:null;e._zod.parse=(n,o)=>{if(r)return r(n,o);let s=!1;const a=[];for(const e of t.options){const t=e._zod.run({value:n.value,issues:[]},o);if(t instanceof Promise)a.push(t),s=!0;else{if(0===t.issues.length)return t;a.push(t)}}return s?Promise.all(a).then(t=>Ct(t,n,e,o)):Ct(a,n,e,o)}}),At=i("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,Rt.init(e,t);const r=e._zod.parse;v(e._zod,"propValues",()=>{const e={};for(const r of t.options){const n=r._zod.propValues;if(!n||0===Object.keys(n).length)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(r)}"`);for(const[t,r]of Object.entries(n)){e[t]||(e[t]=new Set);for(const n of r)e[t].add(n)}}return e});const n=h(()=>{const e=t.options,r=new Map;for(const n of e){const e=n._zod.propValues?.[t.discriminator];if(!e||0===e.size)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(n)}"`);for(const t of e){if(r.has(t))throw new Error(`Duplicate discriminator value "${String(t)}"`);r.set(t,n)}}return r});e._zod.parse=(o,s)=>{const a=o.value;if(!k(a))return o.issues.push({code:"invalid_type",expected:"object",input:a,inst:e}),o;const i=n.value.get(a?.[t.discriminator]);return i?i._zod.run(o,s):t.unionFallback||"backward"===s.direction?r(o,s):(o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,options:Array.from(n.value.keys()),input:a,path:[t.discriminator],inst:e}),o)}}),Mt=i("$ZodIntersection",(e,t)=>{Ge.init(e,t),e._zod.parse=(e,r)=>{const n=e.value,o=t.left._zod.run({value:n,issues:[]},r),s=t.right._zod.run({value:n,issues:[]},r);return o instanceof Promise||s instanceof Promise?Promise.all([o,s]).then(([t,r])=>Dt(e,t,r)):Dt(e,o,s)}});function qt(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e===+t)return{valid:!0,data:e};if(S(e)&&S(t)){const r=Object.keys(t),n=Object.keys(e).filter(e=>-1!==r.indexOf(e)),o={...e,...t};for(const s of n){const r=qt(e[s],t[s]);if(!r.valid)return{valid:!1,mergeErrorPath:[s,...r.mergeErrorPath]};o[s]=r.data}return{valid:!0,data:o}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const r=[];for(let n=0;n<e.length;n++){const o=qt(e[n],t[n]);if(!o.valid)return{valid:!1,mergeErrorPath:[n,...o.mergeErrorPath]};r.push(o.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function Dt(e,t,r){const n=new Map;let o;for(const i of t.issues)if("unrecognized_keys"===i.code){o??(o=i);for(const e of i.keys)n.has(e)||n.set(e,{}),n.get(e).l=!0}else e.issues.push(i);for(const i of r.issues)if("unrecognized_keys"===i.code)for(const e of i.keys)n.has(e)||n.set(e,{}),n.get(e).r=!0;else e.issues.push(i);const s=[...n].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(s.length&&o&&e.issues.push({...o,keys:s}),j(e))return e;const a=qt(t.value,r.value);if(!a.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(a.mergeErrorPath)}`);return e.value=a.data,e}const Ut=i("$ZodRecord",(e,t)=>{Ge.init(e,t),e._zod.parse=(r,n)=>{const o=r.value;if(!S(o))return r.issues.push({expected:"record",code:"invalid_type",input:o,inst:e}),r;const s=[],a=t.keyType._zod.values;if(a){r.value={};const i=new Set;for(const u of a)if("string"==typeof u||"number"==typeof u||"symbol"==typeof u){i.add("number"==typeof u?u.toString():u);const a=t.keyType._zod.run({value:u,issues:[]},n);if(a instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(a.issues.length){r.issues.push({code:"invalid_key",origin:"record",issues:a.issues.map(e=>A(e,n,l())),input:u,path:[u],inst:e});continue}const c=a.value,d=t.valueType._zod.run({value:o[u],issues:[]},n);d instanceof Promise?s.push(d.then(e=>{e.issues.length&&r.issues.push(...C(u,e.issues)),r.value[c]=e.value})):(d.issues.length&&r.issues.push(...C(u,d.issues)),r.value[c]=d.value)}let c;for(const e in o)i.has(e)||(c=c??[],c.push(e));c&&c.length>0&&r.issues.push({code:"unrecognized_keys",input:o,inst:e,keys:c})}else{r.value={};for(const a of Reflect.ownKeys(o)){if("__proto__"===a)continue;if(!Object.prototype.propertyIsEnumerable.call(o,a))continue;let i=t.keyType._zod.run({value:a,issues:[]},n);if(i instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if("string"==typeof a&&Ee.test(a)&&i.issues.length){const e=t.keyType._zod.run({value:Number(a),issues:[]},n);if(e instanceof Promise)throw new Error("Async schemas not supported in object keys currently");0===e.issues.length&&(i=e)}if(i.issues.length){"loose"===t.mode?r.value[a]=o[a]:r.issues.push({code:"invalid_key",origin:"record",issues:i.issues.map(e=>A(e,n,l())),input:a,path:[a],inst:e});continue}const c=t.valueType._zod.run({value:o[a],issues:[]},n);c instanceof Promise?s.push(c.then(e=>{e.issues.length&&r.issues.push(...C(a,e.issues)),r.value[i.value]=e.value})):(c.issues.length&&r.issues.push(...C(a,c.issues)),r.value[i.value]=c.value)}}return s.length?Promise.all(s).then(()=>r):r}}),Vt=i("$ZodEnum",(e,t)=>{Ge.init(e,t);const r=p(t.entries),n=new Set(r);e._zod.values=n,e._zod.pattern=new RegExp(`^(${r.filter(e=>z.has(typeof e)).map(e=>"string"==typeof e?T(e):e.toString()).join("|")})$`),e._zod.parse=(t,o)=>{const s=t.value;return n.has(s)||t.issues.push({code:"invalid_value",values:r,input:s,inst:e}),t}}),Ft=i("$ZodLiteral",(e,t)=>{if(Ge.init(e,t),0===t.values.length)throw new Error("Cannot create literal schema with no valid values");const r=new Set(t.values);e._zod.values=r,e._zod.pattern=new RegExp(`^(${t.values.map(e=>"string"==typeof e?T(e):e?T(e.toString()):String(e)).join("|")})$`),e._zod.parse=(n,o)=>{const s=n.value;return r.has(s)||n.issues.push({code:"invalid_value",values:t.values,input:s,inst:e}),n}}),Zt=i("$ZodTransform",(e,t)=>{Ge.init(e,t),e._zod.optin="optional",e._zod.parse=(r,n)=>{if("backward"===n.direction)throw new u(e.constructor.name);const o=t.transform(r.value,r);if(n.async){return(o instanceof Promise?o:Promise.resolve(o)).then(e=>(r.value=e,r.fallback=!0,r))}if(o instanceof Promise)throw new c;return r.value=o,r.fallback=!0,r}});function Lt(e,t){return void 0===t&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}const Ht=i("$ZodOptional",(e,t)=>{Ge.init(e,t),e._zod.optin="optional",e._zod.optout="optional",v(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),v(e._zod,"pattern",()=>{const e=t.innerType._zod.pattern;return e?new RegExp(`^(${y(e.source)})?$`):void 0}),e._zod.parse=(e,r)=>{if("optional"===t.innerType._zod.optin){const n=e.value,o=t.innerType._zod.run(e,r);return o instanceof Promise?o.then(e=>Lt(e,n)):Lt(o,n)}return void 0===e.value?e:t.innerType._zod.run(e,r)}}),Jt=i("$ZodExactOptional",(e,t)=>{Ht.init(e,t),v(e._zod,"values",()=>t.innerType._zod.values),v(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(e,r)=>t.innerType._zod.run(e,r)}),Kt=i("$ZodNullable",(e,t)=>{Ge.init(e,t),v(e._zod,"optin",()=>t.innerType._zod.optin),v(e._zod,"optout",()=>t.innerType._zod.optout),v(e._zod,"pattern",()=>{const e=t.innerType._zod.pattern;return e?new RegExp(`^(${y(e.source)}|null)$`):void 0}),v(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(e,r)=>null===e.value?e:t.innerType._zod.run(e,r)}),Gt=i("$ZodDefault",(e,t)=>{Ge.init(e,t),e._zod.optin="optional",v(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,r)=>{if("backward"===r.direction)return t.innerType._zod.run(e,r);if(void 0===e.value)return e.value=t.defaultValue,e;const n=t.innerType._zod.run(e,r);return n instanceof Promise?n.then(e=>Bt(e,t)):Bt(n,t)}});function Bt(e,t){return void 0===e.value&&(e.value=t.defaultValue),e}const Wt=i("$ZodPrefault",(e,t)=>{Ge.init(e,t),e._zod.optin="optional",v(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,r)=>("backward"===r.direction||void 0===e.value&&(e.value=t.defaultValue),t.innerType._zod.run(e,r))}),Qt=i("$ZodNonOptional",(e,t)=>{Ge.init(e,t),v(e._zod,"values",()=>{const e=t.innerType._zod.values;return e?new Set([...e].filter(e=>void 0!==e)):void 0}),e._zod.parse=(r,n)=>{const o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(t=>Yt(t,e)):Yt(o,e)}});function Yt(e,t){return e.issues.length||void 0!==e.value||e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}const Xt=i("$ZodCatch",(e,t)=>{Ge.init(e,t),e._zod.optin="optional",v(e._zod,"optout",()=>t.innerType._zod.optout),v(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,r)=>{if("backward"===r.direction)return t.innerType._zod.run(e,r);const n=t.innerType._zod.run(e,r);return n instanceof Promise?n.then(n=>(e.value=n.value,n.issues.length&&(e.value=t.catchValue({...e,error:{issues:n.issues.map(e=>A(e,r,l()))},input:e.value}),e.issues=[],e.fallback=!0),e)):(e.value=n.value,n.issues.length&&(e.value=t.catchValue({...e,error:{issues:n.issues.map(e=>A(e,r,l()))},input:e.value}),e.issues=[],e.fallback=!0),e)}}),er=i("$ZodPipe",(e,t)=>{Ge.init(e,t),v(e._zod,"values",()=>t.in._zod.values),v(e._zod,"optin",()=>t.in._zod.optin),v(e._zod,"optout",()=>t.out._zod.optout),v(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(e,r)=>{if("backward"===r.direction){const n=t.out._zod.run(e,r);return n instanceof Promise?n.then(e=>tr(e,t.in,r)):tr(n,t.in,r)}const n=t.in._zod.run(e,r);return n instanceof Promise?n.then(e=>tr(e,t.out,r)):tr(n,t.out,r)}});function tr(e,t,r){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues,fallback:e.fallback},r)}const rr=i("$ZodPreprocess",(e,t)=>{er.init(e,t)}),nr=i("$ZodReadonly",(e,t)=>{Ge.init(e,t),v(e._zod,"propValues",()=>t.innerType._zod.propValues),v(e._zod,"values",()=>t.innerType._zod.values),v(e._zod,"optin",()=>t.innerType?._zod?.optin),v(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(e,r)=>{if("backward"===r.direction)return t.innerType._zod.run(e,r);const n=t.innerType._zod.run(e,r);return n instanceof Promise?n.then(or):or(n)}});function or(e){return e.value=Object.freeze(e.value),e}const sr=i("$ZodCustom",(e,t)=>{xe.init(e,t),Ge.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=r=>{const n=r.value,o=t.fn(n);if(o instanceof Promise)return o.then(t=>ar(t,r,n,e));ar(o,r,n,e)}});function ar(e,t,r,n){if(!e){const e={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(e.params=n._zod.def.params),t.issues.push(q(e))}}var ir;class cr{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){const r=t[0];return this._map.set(e,r),r&&"object"==typeof r&&"id"in r&&this._idmap.set(r.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){const t=this._map.get(e);return t&&"object"==typeof t&&"id"in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){const t=e._zod.parent;if(t){const r={...this.get(t)??{}};delete r.id;const n={...r,...this._map.get(e)};return Object.keys(n).length?n:void 0}return this._map.get(e)}has(e){return this._map.has(e)}}(ir=globalThis).__zod_globalRegistry??(ir.__zod_globalRegistry=new cr);const ur=globalThis.__zod_globalRegistry;function dr(e,t){return new e({type:"string",...I(t)})}function lr(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...I(t)})}function pr(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...I(t)})}function fr(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...I(t)})}function hr(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...I(t)})}function mr(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...I(t)})}function yr(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...I(t)})}function gr(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...I(t)})}function vr(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...I(t)})}function _r(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...I(t)})}function wr(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...I(t)})}function $r(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...I(t)})}function br(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...I(t)})}function kr(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...I(t)})}function Er(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...I(t)})}function Sr(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...I(t)})}function Pr(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...I(t)})}function zr(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...I(t)})}function Tr(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...I(t)})}function xr(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...I(t)})}function Ir(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...I(t)})}function Nr(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...I(t)})}function jr(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...I(t)})}function Or(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...I(t)})}function Cr(e,t){return new e({type:"string",format:"date",check:"string_format",...I(t)})}function Rr(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...I(t)})}function Ar(e,t){return new e({type:"string",format:"duration",check:"string_format",...I(t)})}function Mr(e,t){return new e({type:"number",checks:[],...I(t)})}function qr(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...I(t)})}function Dr(e,t){return new e({type:"boolean",...I(t)})}function Ur(e,t){return new e({type:"null",...I(t)})}function Vr(e){return new e({type:"unknown"})}function Fr(e,t){return new e({type:"never",...I(t)})}function Zr(e,t){return new Ne({check:"less_than",...I(t),value:e,inclusive:!1})}function Lr(e,t){return new Ne({check:"less_than",...I(t),value:e,inclusive:!0})}function Hr(e,t){return new je({check:"greater_than",...I(t),value:e,inclusive:!1})}function Jr(e,t){return new je({check:"greater_than",...I(t),value:e,inclusive:!0})}function Kr(e,t){return new Oe({check:"multiple_of",...I(t),value:e})}function Gr(e,t){return new Re({check:"max_length",...I(t),maximum:e})}function Br(e,t){return new Ae({check:"min_length",...I(t),minimum:e})}function Wr(e,t){return new Me({check:"length_equals",...I(t),length:e})}function Qr(e,t){return new De({check:"string_format",format:"regex",...I(t),pattern:e})}function Yr(e){return new Ue({check:"string_format",format:"lowercase",...I(e)})}function Xr(e){return new Ve({check:"string_format",format:"uppercase",...I(e)})}function en(e,t){return new Fe({check:"string_format",format:"includes",...I(t),includes:e})}function tn(e,t){return new Ze({check:"string_format",format:"starts_with",...I(t),prefix:e})}function rn(e,t){return new Le({check:"string_format",format:"ends_with",...I(t),suffix:e})}function nn(e){return new He({check:"overwrite",tx:e})}function on(e){return nn(t=>t.normalize(e))}function sn(){return nn(e=>e.trim())}function an(){return nn(e=>e.toLowerCase())}function cn(){return nn(e=>e.toUpperCase())}function un(){return nn(e=>function(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}(e))}function dn(e,t,r){return new e({type:"array",element:t,...I(r)})}function ln(e,t,r){const n=I(r);n.abort??(n.abort=!0);return new e({type:"custom",check:"custom",fn:t,...n})}function pn(e,t,r){return new e({type:"custom",check:"custom",fn:t,...I(r)})}function fn(e,t){const r=hn(t=>(t.addIssue=e=>{if("string"==typeof e)t.issues.push(q(e,t.value,r._zod.def));else{const n=e;n.fatal&&(n.continue=!1),n.code??(n.code="custom"),n.input??(n.input=t.value),n.inst??(n.inst=r),n.continue??(n.continue=!r._zod.def.abort),t.issues.push(q(n))}},e(t.value,t)),t);return r}function hn(e,t){const r=new xe({check:"custom",...I(t)});return r._zod.check=e,r}function mn(e){let t=e?.target??"draft-2020-12";return"draft-4"===t&&(t="draft-04"),"draft-7"===t&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??ur,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,cycles:e?.cycles??"ref",reused:e?.reused??"inline",external:e?.external??void 0}}function yn(e,t,r={path:[],schemaPath:[]}){var n;const o=e._zod.def,s=t.seen.get(e);if(s){s.count++;return r.schemaPath.includes(e)&&(s.cycle=r.path),s.schema}const a={schema:{},count:1,cycle:void 0,path:r.path};t.seen.set(e,a);const i=e._zod.toJSONSchema?.();if(i)a.schema=i;else{const n={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,a.schema,n);else{const r=a.schema,s=t.processors[o.type];if(!s)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);s(e,t,r,n)}const s=e._zod.parent;s&&(a.ref||(a.ref=s),yn(s,t,n),t.seen.get(s).isParent=!0)}const c=t.metadataRegistry.get(e);c&&Object.assign(a.schema,c),"input"===t.io&&_n(e)&&(delete a.schema.examples,delete a.schema.default),"input"===t.io&&"_prefault"in a.schema&&((n=a.schema).default??(n.default=a.schema._prefault)),delete a.schema._prefault;return t.seen.get(e).schema}function gn(e,t){const r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");const n=new Map;for(const s of e.seen.entries()){const t=e.metadataRegistry.get(s[0])?.id;if(t){const e=n.get(t);if(e&&e!==s[0])throw new Error(`Duplicate schema id "${t}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);n.set(t,s[0])}}const o=t=>{if(t[1].schema.$ref)return;const n=t[1],{ref:o,defId:s}=(t=>{const n="draft-2020-12"===e.target?"$defs":"definitions";if(e.external){const r=e.external.registry.get(t[0])?.id,o=e.external.uri??(e=>e);if(r)return{ref:o(r)};const s=t[1].defId??t[1].schema.id??"schema"+e.counter++;return t[1].defId=s,{defId:s,ref:`${o("__shared")}#/${n}/${s}`}}if(t[1]===r)return{ref:"#"};const o=`#/${n}/`,s=t[1].schema.id??"__schema"+e.counter++;return{defId:s,ref:o+s}})(t);n.def={...n.schema},s&&(n.defId=s);const a=n.schema;for(const e in a)delete a[e];a.$ref=o};if("throw"===e.cycles)for(const s of e.seen.entries()){const e=s[1];if(e.cycle)throw new Error(`Cycle detected: #/${e.cycle?.join("/")}/<root>\n\nSet the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const s of e.seen.entries()){const r=s[1];if(t===s[0]){o(s);continue}if(e.external){const r=e.external.registry.get(s[0])?.id;if(t!==s[0]&&r){o(s);continue}}const n=e.metadataRegistry.get(s[0])?.id;n?o(s):(r.cycle||r.count>1&&"ref"===e.reused)&&o(s)}}function vn(e,t){const r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");const n=t=>{const r=e.seen.get(t);if(null===r.ref)return;const o=r.def??r.schema,s={...o},a=r.ref;if(r.ref=null,a){n(a);const r=e.seen.get(a),i=r.schema;!i.$ref||"draft-07"!==e.target&&"draft-04"!==e.target&&"openapi-3.0"!==e.target?Object.assign(o,i):(o.allOf=o.allOf??[],o.allOf.push(i)),Object.assign(o,s);if(t._zod.parent===a)for(const e in o)"$ref"!==e&&"allOf"!==e&&(e in s||delete o[e]);if(i.$ref&&r.def)for(const e in o)"$ref"!==e&&"allOf"!==e&&e in r.def&&JSON.stringify(o[e])===JSON.stringify(r.def[e])&&delete o[e]}const i=t._zod.parent;if(i&&i!==a){n(i);const t=e.seen.get(i);if(t?.schema.$ref&&(o.$ref=t.schema.$ref,t.def))for(const e in o)"$ref"!==e&&"allOf"!==e&&e in t.def&&JSON.stringify(o[e])===JSON.stringify(t.def[e])&&delete o[e]}e.override({zodSchema:t,jsonSchema:o,path:r.path??[]})};for(const c of[...e.seen.entries()].reverse())n(c[0]);const o={};if("draft-2020-12"===e.target?o.$schema="https://json-schema.org/draft/2020-12/schema":"draft-07"===e.target?o.$schema="http://json-schema.org/draft-07/schema#":"draft-04"===e.target?o.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){const r=e.external.registry.get(t)?.id;if(!r)throw new Error("Schema is missing an `id` property");o.$id=e.external.uri(r)}Object.assign(o,r.def??r.schema);const s=e.metadataRegistry.get(t)?.id;void 0!==s&&o.id===s&&delete o.id;const a=e.external?.defs??{};for(const c of e.seen.entries()){const e=c[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,a[e.defId]=e.def)}e.external||Object.keys(a).length>0&&("draft-2020-12"===e.target?o.$defs=a:o.definitions=a);try{const r=JSON.parse(JSON.stringify(o));return Object.defineProperty(r,"~standard",{value:{...t["~standard"],jsonSchema:{input:wn(t,"input",e.processors),output:wn(t,"output",e.processors)}},enumerable:!1,writable:!1}),r}catch(i){throw new Error("Error converting schema to JSON.")}}function _n(e,t){const r=t??{seen:new Set};if(r.seen.has(e))return!1;r.seen.add(e);const n=e._zod.def;if("transform"===n.type)return!0;if("array"===n.type)return _n(n.element,r);if("set"===n.type)return _n(n.valueType,r);if("lazy"===n.type)return _n(n.getter(),r);if("promise"===n.type||"optional"===n.type||"nonoptional"===n.type||"nullable"===n.type||"readonly"===n.type||"default"===n.type||"prefault"===n.type)return _n(n.innerType,r);if("intersection"===n.type)return _n(n.left,r)||_n(n.right,r);if("record"===n.type||"map"===n.type)return _n(n.keyType,r)||_n(n.valueType,r);if("pipe"===n.type)return!!e._zod.traits.has("$ZodCodec")||(_n(n.in,r)||_n(n.out,r));if("object"===n.type){for(const e in n.shape)if(_n(n.shape[e],r))return!0;return!1}if("union"===n.type){for(const e of n.options)if(_n(e,r))return!0;return!1}if("tuple"===n.type){for(const e of n.items)if(_n(e,r))return!0;return!(!n.rest||!_n(n.rest,r))}return!1}const wn=(e,t,r={})=>n=>{const{libraryOptions:o,target:s}=n??{},a=mn({...o??{},target:s,io:t,processors:r});return yn(e,a),gn(a,e),vn(a,e)},$n={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},bn=(e,t,r,n)=>{const o=e._zod.def;yn(o.innerType,t,n);t.seen.get(e).ref=o.innerType};function kn(e){return!!e._zod}function En(e,t){if(kn(e)){return H(e,t)}return e.safeParse(t)}function Sn(e){if(!e)return;let t;if(kn(e)){const r=e;t=r._zod?.def?.shape}else{t=e.shape}if(t){if("function"==typeof t)try{return t()}catch{return}return t}}const Pn=i("ZodISODateTime",(e,t)=>{ct.init(e,t),Wn.init(e,t)});function zn(e){return Or(Pn,e)}const Tn=i("ZodISODate",(e,t)=>{ut.init(e,t),Wn.init(e,t)});const xn=i("ZodISOTime",(e,t)=>{dt.init(e,t),Wn.init(e,t)});const In=i("ZodISODuration",(e,t)=>{lt.init(e,t),Wn.init(e,t)});const Nn=i("ZodError",(e,t)=>{U.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:t=>function(e,t=e=>e.message){const r={_errors:[]},n=(e,o=[])=>{for(const s of e.issues)if("invalid_union"===s.code&&s.errors.length)s.errors.map(e=>n({issues:e},[...o,...s.path]));else if("invalid_key"===s.code)n({issues:s.issues},[...o,...s.path]);else if("invalid_element"===s.code)n({issues:s.issues},[...o,...s.path]);else{const e=[...o,...s.path];if(0===e.length)r._errors.push(t(s));else{let n=r,o=0;for(;o<e.length;){const r=e[o];o===e.length-1?(n[r]=n[r]||{_errors:[]},n[r]._errors.push(t(s))):n[r]=n[r]||{_errors:[]},n=n[r],o++}}}};return n(e),r}(e,t)},flatten:{value:t=>function(e,t=e=>e.message){const r={},n=[];for(const o of e.issues)o.path.length>0?(r[o.path[0]]=r[o.path[0]]||[],r[o.path[0]].push(t(o))):n.push(t(o));return{formErrors:n,fieldErrors:r}}(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,f,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,f,2)}},isEmpty:{get:()=>0===e.issues.length}})},{Parent:Error}),jn=F(Nn),On=Z(Nn),Cn=L(Nn),Rn=J(Nn),An=G(Nn),Mn=B(Nn),qn=W(Nn),Dn=Q(Nn),Un=Y(Nn),Vn=X(Nn),Fn=ee(Nn),Zn=te(Nn),Ln=new WeakMap;function Hn(e,t,r){const n=Object.getPrototypeOf(e);let o=Ln.get(n);if(o||(o=new Set,Ln.set(n,o)),!o.has(t)){o.add(t);for(const e in r){const t=r[e];Object.defineProperty(n,e,{configurable:!0,enumerable:!1,get(){const r=t.bind(this);return Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:r}),r},set(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:t})}})}}}const Jn=i("ZodType",(e,t)=>(Ge.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:wn(e,"input"),output:wn(e,"output")}}),e.toJSONSchema=((e,t={})=>r=>{const n=mn({...r,processors:t});return yn(e,n),gn(n,e),vn(n,e)})(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(t,r)=>jn(e,t,r,{callee:e.parse}),e.safeParse=(t,r)=>Cn(e,t,r),e.parseAsync=async(t,r)=>On(e,t,r,{callee:e.parseAsync}),e.safeParseAsync=async(t,r)=>Rn(e,t,r),e.spa=e.safeParseAsync,e.encode=(t,r)=>An(e,t,r),e.decode=(t,r)=>Mn(e,t,r),e.encodeAsync=async(t,r)=>qn(e,t,r),e.decodeAsync=async(t,r)=>Dn(e,t,r),e.safeEncode=(t,r)=>Un(e,t,r),e.safeDecode=(t,r)=>Vn(e,t,r),e.safeEncodeAsync=async(t,r)=>Fn(e,t,r),e.safeDecodeAsync=async(t,r)=>Zn(e,t,r),Hn(e,"ZodType",{check(...e){const t=this.def;return this.clone(w(t,{checks:[...t.checks??[],...e.map(e=>"function"==typeof e?{_zod:{check:e,def:{check:"custom"},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return x(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(function(e,t={}){return pn(ss,e,t)}(e,t))},superRefine(e,t){return this.check(function(e,t){return fn(e,t)}(e,t))},overwrite(e){return this.check(nn(e))},optional(){return Ko(this)},exactOptional(){return new Go({type:"optional",innerType:this})},nullable(){return Wo(this)},nullish(){return Ko(Wo(this))},nonoptional(e){return function(e,t){return new Xo({type:"nonoptional",innerType:e,...I(t)})}(this,e)},array(){return To(this)},or(e){return Oo([this,e])},and(e){return Mo(this,e)},transform(e){return rs(this,Ho(e))},default(e){return t=e,new Qo({type:"default",innerType:this,get defaultValue(){return"function"==typeof t?t():P(t)}});var t},prefault(e){return t=e,new Yo({type:"prefault",innerType:this,get defaultValue(){return"function"==typeof t?t():P(t)}});var t},catch(e){return new es({type:"catch",innerType:this,catchValue:"function"==typeof(t=e)?t:()=>t});var t},pipe(e){return rs(this,e)},readonly(){return new os({type:"readonly",innerType:this})},describe(e){const t=this.clone();return ur.add(t,{description:e}),t},meta(...e){if(0===e.length)return ur.get(this);const t=this.clone();return ur.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e){return e(this)}}),Object.defineProperty(e,"description",{get:()=>ur.get(e)?.description,configurable:!0}),e)),Kn=i("_ZodString",(e,t)=>{Be.init(e,t),Jn.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r)=>{const n=r;n.type="string";const{minimum:o,maximum:s,format:a,patterns:i,contentEncoding:c}=e._zod.bag;if("number"==typeof o&&(n.minLength=o),"number"==typeof s&&(n.maxLength=s),a&&(n.format=$n[a]??a,""===n.format&&delete n.format,"time"===a&&delete n.format),c&&(n.contentEncoding=c),i&&i.size>0){const e=[...i];1===e.length?n.pattern=e[0].source:e.length>1&&(n.allOf=[...e.map(e=>({..."draft-07"===t.target||"draft-04"===t.target||"openapi-3.0"===t.target?{type:"string"}:{},pattern:e.source}))])}})(e,t,r);const r=e._zod.bag;e.format=r.format??null,e.minLength=r.minimum??null,e.maxLength=r.maximum??null,Hn(e,"_ZodString",{regex(...e){return this.check(Qr(...e))},includes(...e){return this.check(en(...e))},startsWith(...e){return this.check(tn(...e))},endsWith(...e){return this.check(rn(...e))},min(...e){return this.check(Br(...e))},max(...e){return this.check(Gr(...e))},length(...e){return this.check(Wr(...e))},nonempty(...e){return this.check(Br(1,...e))},lowercase(e){return this.check(Yr(e))},uppercase(e){return this.check(Xr(e))},trim(){return this.check(sn())},normalize(...e){return this.check(on(...e))},toLowerCase(){return this.check(an())},toUpperCase(){return this.check(cn())},slugify(){return this.check(un())}})}),Gn=i("ZodString",(e,t)=>{Be.init(e,t),Kn.init(e,t),e.email=t=>e.check(lr(Qn,t)),e.url=t=>e.check(gr(eo,t)),e.jwt=t=>e.check(jr(yo,t)),e.emoji=t=>e.check(vr(to,t)),e.guid=t=>e.check(pr(Yn,t)),e.uuid=t=>e.check(fr(Xn,t)),e.uuidv4=t=>e.check(hr(Xn,t)),e.uuidv6=t=>e.check(mr(Xn,t)),e.uuidv7=t=>e.check(yr(Xn,t)),e.nanoid=t=>e.check(_r(ro,t)),e.guid=t=>e.check(pr(Yn,t)),e.cuid=t=>e.check(wr(no,t)),e.cuid2=t=>e.check($r(oo,t)),e.ulid=t=>e.check(br(so,t)),e.base64=t=>e.check(xr(fo,t)),e.base64url=t=>e.check(Ir(ho,t)),e.xid=t=>e.check(kr(ao,t)),e.ksuid=t=>e.check(Er(io,t)),e.ipv4=t=>e.check(Sr(co,t)),e.ipv6=t=>e.check(Pr(uo,t)),e.cidrv4=t=>e.check(zr(lo,t)),e.cidrv6=t=>e.check(Tr(po,t)),e.e164=t=>e.check(Nr(mo,t)),e.datetime=t=>e.check(zn(t)),e.date=t=>e.check(function(e){return Cr(Tn,e)}(t)),e.time=t=>e.check(function(e){return Rr(xn,e)}(t)),e.duration=t=>e.check(function(e){return Ar(In,e)}(t))});function Bn(e){return dr(Gn,e)}const Wn=i("ZodStringFormat",(e,t)=>{We.init(e,t),Kn.init(e,t)}),Qn=i("ZodEmail",(e,t)=>{Xe.init(e,t),Wn.init(e,t)}),Yn=i("ZodGUID",(e,t)=>{Qe.init(e,t),Wn.init(e,t)}),Xn=i("ZodUUID",(e,t)=>{Ye.init(e,t),Wn.init(e,t)}),eo=i("ZodURL",(e,t)=>{et.init(e,t),Wn.init(e,t)}),to=i("ZodEmoji",(e,t)=>{tt.init(e,t),Wn.init(e,t)}),ro=i("ZodNanoID",(e,t)=>{rt.init(e,t),Wn.init(e,t)}),no=i("ZodCUID",(e,t)=>{nt.init(e,t),Wn.init(e,t)}),oo=i("ZodCUID2",(e,t)=>{ot.init(e,t),Wn.init(e,t)}),so=i("ZodULID",(e,t)=>{st.init(e,t),Wn.init(e,t)}),ao=i("ZodXID",(e,t)=>{at.init(e,t),Wn.init(e,t)}),io=i("ZodKSUID",(e,t)=>{it.init(e,t),Wn.init(e,t)}),co=i("ZodIPv4",(e,t)=>{pt.init(e,t),Wn.init(e,t)}),uo=i("ZodIPv6",(e,t)=>{ft.init(e,t),Wn.init(e,t)}),lo=i("ZodCIDRv4",(e,t)=>{ht.init(e,t),Wn.init(e,t)}),po=i("ZodCIDRv6",(e,t)=>{mt.init(e,t),Wn.init(e,t)}),fo=i("ZodBase64",(e,t)=>{gt.init(e,t),Wn.init(e,t)}),ho=i("ZodBase64URL",(e,t)=>{vt.init(e,t),Wn.init(e,t)}),mo=i("ZodE164",(e,t)=>{_t.init(e,t),Wn.init(e,t)}),yo=i("ZodJWT",(e,t)=>{wt.init(e,t),Wn.init(e,t)}),go=i("ZodNumber",(e,t)=>{$t.init(e,t),Jn.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r)=>{const n=r,{minimum:o,maximum:s,format:a,multipleOf:i,exclusiveMaximum:c,exclusiveMinimum:u}=e._zod.bag;"string"==typeof a&&a.includes("int")?n.type="integer":n.type="number";const d="number"==typeof u&&u>=(o??Number.NEGATIVE_INFINITY),l="number"==typeof c&&c<=(s??Number.POSITIVE_INFINITY),p="draft-04"===t.target||"openapi-3.0"===t.target;d?p?(n.minimum=u,n.exclusiveMinimum=!0):n.exclusiveMinimum=u:"number"==typeof o&&(n.minimum=o),l?p?(n.maximum=c,n.exclusiveMaximum=!0):n.exclusiveMaximum=c:"number"==typeof s&&(n.maximum=s),"number"==typeof i&&(n.multipleOf=i)})(e,t,r),Hn(e,"ZodNumber",{gt(e,t){return this.check(Hr(e,t))},gte(e,t){return this.check(Jr(e,t))},min(e,t){return this.check(Jr(e,t))},lt(e,t){return this.check(Zr(e,t))},lte(e,t){return this.check(Lr(e,t))},max(e,t){return this.check(Lr(e,t))},int(e){return this.check(wo(e))},safe(e){return this.check(wo(e))},positive(e){return this.check(Hr(0,e))},nonnegative(e){return this.check(Jr(0,e))},negative(e){return this.check(Zr(0,e))},nonpositive(e){return this.check(Lr(0,e))},multipleOf(e,t){return this.check(Kr(e,t))},step(e,t){return this.check(Kr(e,t))},finite(){return this}});const r=e._zod.bag;e.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??.5),e.isFinite=!0,e.format=r.format??null});function vo(e){return Mr(go,e)}const _o=i("ZodNumberFormat",(e,t)=>{bt.init(e,t),go.init(e,t)});function wo(e){return qr(_o,e)}const $o=i("ZodBoolean",(e,t)=>{kt.init(e,t),Jn.init(e,t),e._zod.processJSONSchema=(e,t,r)=>((e,t,r)=>{r.type="boolean"})(0,0,t)});function bo(e){return Dr($o,e)}const ko=i("ZodNull",(e,t)=>{Et.init(e,t),Jn.init(e,t),e._zod.processJSONSchema=(e,t,r)=>((e,t,r)=>{"openapi-3.0"===t.target?(r.type="string",r.nullable=!0,r.enum=[null]):r.type="null"})(0,e,t)});const Eo=i("ZodUnknown",(e,t)=>{St.init(e,t),Jn.init(e,t),e._zod.processJSONSchema=(e,t,r)=>{}});function So(){return Vr(Eo)}const Po=i("ZodNever",(e,t)=>{Pt.init(e,t),Jn.init(e,t),e._zod.processJSONSchema=(e,t,r)=>((e,t,r)=>{r.not={}})(0,0,t)});const zo=i("ZodArray",(e,t)=>{Tt.init(e,t),Jn.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const o=r,s=e._zod.def,{minimum:a,maximum:i}=e._zod.bag;"number"==typeof a&&(o.minItems=a),"number"==typeof i&&(o.maxItems=i),o.type="array",o.items=yn(s.element,t,{...n,path:[...n.path,"items"]})})(e,t,r,n),e.element=t.element,Hn(e,"ZodArray",{min(e,t){return this.check(Br(e,t))},nonempty(e){return this.check(Br(1,e))},max(e,t){return this.check(Gr(e,t))},length(e,t){return this.check(Wr(e,t))},unwrap(){return this.element}})});function To(e,t){return dn(zo,e,t)}const xo=i("ZodObject",(e,t)=>{Ot.init(e,t),Jn.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const o=r,s=e._zod.def;o.type="object",o.properties={};const a=s.shape;for(const u in a)o.properties[u]=yn(a[u],t,{...n,path:[...n.path,"properties",u]});const i=new Set(Object.keys(a)),c=new Set([...i].filter(e=>{const r=s.shape[e]._zod;return"input"===t.io?void 0===r.optin:void 0===r.optout}));c.size>0&&(o.required=Array.from(c)),"never"===s.catchall?._zod.def.type?o.additionalProperties=!1:s.catchall?s.catchall&&(o.additionalProperties=yn(s.catchall,t,{...n,path:[...n.path,"additionalProperties"]})):"output"===t.io&&(o.additionalProperties=!1)})(e,t,r,n),v(e,"shape",()=>t.shape),Hn(e,"ZodObject",{keyof(){return Vo(Object.keys(this._zod.def.shape))},catchall(e){return this.clone({...this._zod.def,catchall:e})},passthrough(){return this.clone({...this._zod.def,catchall:So()})},loose(){return this.clone({...this._zod.def,catchall:So()})},strict(){return this.clone({...this._zod.def,catchall:Fr(Po,e)});var e},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(e){return function(e,t){if(!S(t))throw new Error("Invalid input to extend: expected a plain object");const r=e._zod.def.checks;if(r&&r.length>0){const r=e._zod.def.shape;for(const e in t)if(void 0!==Object.getOwnPropertyDescriptor(r,e))throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const n=w(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t};return _(this,"shape",r),r}});return x(e,n)}(this,e)},safeExtend(e){return function(e,t){if(!S(t))throw new Error("Invalid input to safeExtend: expected a plain object");const r=w(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t};return _(this,"shape",r),r}});return x(e,r)}(this,e)},merge(e){return function(e,t){if(e._zod.def.checks?.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");const r=w(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t._zod.def.shape};return _(this,"shape",r),r},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return x(e,r)}(this,e)},pick(e){return function(e,t){const r=e._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");return x(e,w(e._zod.def,{get shape(){const e={};for(const n in t){if(!(n in r.shape))throw new Error(`Unrecognized key: "${n}"`);t[n]&&(e[n]=r.shape[n])}return _(this,"shape",e),e},checks:[]}))}(this,e)},omit(e){return function(e,t){const r=e._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const o=w(e._zod.def,{get shape(){const n={...e._zod.def.shape};for(const e in t){if(!(e in r.shape))throw new Error(`Unrecognized key: "${e}"`);t[e]&&delete n[e]}return _(this,"shape",n),n},checks:[]});return x(e,o)}(this,e)},partial(...e){return function(e,t,r){const n=t._zod.def.checks;if(n&&n.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");const o=w(t._zod.def,{get shape(){const n=t._zod.def.shape,o={...n};if(r)for(const t in r){if(!(t in n))throw new Error(`Unrecognized key: "${t}"`);r[t]&&(o[t]=e?new e({type:"optional",innerType:n[t]}):n[t])}else for(const t in n)o[t]=e?new e({type:"optional",innerType:n[t]}):n[t];return _(this,"shape",o),o},checks:[]});return x(t,o)}(Jo,this,e[0])},required(...e){return function(e,t,r){const n=w(t._zod.def,{get shape(){const n=t._zod.def.shape,o={...n};if(r)for(const t in r){if(!(t in o))throw new Error(`Unrecognized key: "${t}"`);r[t]&&(o[t]=new e({type:"nonoptional",innerType:n[t]}))}else for(const t in n)o[t]=new e({type:"nonoptional",innerType:n[t]});return _(this,"shape",o),o}});return x(t,n)}(Xo,this,e[0])}})});function Io(e,t){const r={type:"object",shape:e??{},...I(t)};return new xo(r)}function No(e,t){return new xo({type:"object",shape:e,catchall:So(),...I(t)})}const jo=i("ZodUnion",(e,t)=>{Rt.init(e,t),Jn.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const o=e._zod.def,s=!1===o.inclusive,a=o.options.map((e,r)=>yn(e,t,{...n,path:[...n.path,s?"oneOf":"anyOf",r]}));s?r.oneOf=a:r.anyOf=a})(e,t,r,n),e.options=t.options});function Oo(e,t){return new jo({type:"union",options:e,...I(t)})}const Co=i("ZodDiscriminatedUnion",(e,t)=>{jo.init(e,t),At.init(e,t)});function Ro(e,t,r){return new Co({type:"union",options:t,discriminator:e,...I(r)})}const Ao=i("ZodIntersection",(e,t)=>{Mt.init(e,t),Jn.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const o=e._zod.def,s=yn(o.left,t,{...n,path:[...n.path,"allOf",0]}),a=yn(o.right,t,{...n,path:[...n.path,"allOf",1]}),i=e=>"allOf"in e&&1===Object.keys(e).length,c=[...i(s)?s.allOf:[s],...i(a)?a.allOf:[a]];r.allOf=c})(e,t,r,n)});function Mo(e,t){return new Ao({type:"intersection",left:e,right:t})}const qo=i("ZodRecord",(e,t)=>{Ut.init(e,t),Jn.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const o=r,s=e._zod.def;o.type="object";const a=s.keyType,i=a._zod.bag,c=i?.patterns;if("loose"===s.mode&&c&&c.size>0){const e=yn(s.valueType,t,{...n,path:[...n.path,"patternProperties","*"]});o.patternProperties={};for(const t of c)o.patternProperties[t.source]=e}else"draft-07"!==t.target&&"draft-2020-12"!==t.target||(o.propertyNames=yn(s.keyType,t,{...n,path:[...n.path,"propertyNames"]})),o.additionalProperties=yn(s.valueType,t,{...n,path:[...n.path,"additionalProperties"]});const u=a._zod.values;if(u){const e=[...u].filter(e=>"string"==typeof e||"number"==typeof e);e.length>0&&(o.required=e)}})(e,t,r,n),e.keyType=t.keyType,e.valueType=t.valueType});function Do(e,t,r){return t&&t._zod?new qo({type:"record",keyType:e,valueType:t,...I(r)}):new qo({type:"record",keyType:Bn(),valueType:e,...I(t)})}const Uo=i("ZodEnum",(e,t)=>{Vt.init(e,t),Jn.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r)=>{const n=p(e._zod.def.entries);n.every(e=>"number"==typeof e)&&(r.type="number"),n.every(e=>"string"==typeof e)&&(r.type="string"),r.enum=n})(e,0,r),e.enum=t.entries,e.options=Object.values(t.entries);const r=new Set(Object.keys(t.entries));e.extract=(e,n)=>{const o={};for(const s of e){if(!r.has(s))throw new Error(`Key ${s} not found in enum`);o[s]=t.entries[s]}return new Uo({...t,checks:[],...I(n),entries:o})},e.exclude=(e,n)=>{const o={...t.entries};for(const t of e){if(!r.has(t))throw new Error(`Key ${t} not found in enum`);delete o[t]}return new Uo({...t,checks:[],...I(n),entries:o})}});function Vo(e,t){const r=Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e;return new Uo({type:"enum",entries:r,...I(t)})}const Fo=i("ZodLiteral",(e,t)=>{Ft.init(e,t),Jn.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r)=>{const n=e._zod.def,o=[];for(const s of n.values)if(void 0===s){if("throw"===t.unrepresentable)throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if("bigint"==typeof s){if("throw"===t.unrepresentable)throw new Error("BigInt literals cannot be represented in JSON Schema");o.push(Number(s))}else o.push(s);if(0===o.length);else if(1===o.length){const e=o[0];r.type=null===e?"null":typeof e,"draft-04"===t.target||"openapi-3.0"===t.target?r.enum=[e]:r.const=e}else o.every(e=>"number"==typeof e)&&(r.type="number"),o.every(e=>"string"==typeof e)&&(r.type="string"),o.every(e=>"boolean"==typeof e)&&(r.type="boolean"),o.every(e=>null===e)&&(r.type="null"),r.enum=o})(e,t,r),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function Zo(e,t){return new Fo({type:"literal",values:Array.isArray(e)?e:[e],...I(t)})}const Lo=i("ZodTransform",(e,t)=>{Zt.init(e,t),Jn.init(e,t),e._zod.processJSONSchema=(e,t,r)=>((e,t)=>{if("throw"===t.unrepresentable)throw new Error("Transforms cannot be represented in JSON Schema")})(0,e),e._zod.parse=(r,n)=>{if("backward"===n.direction)throw new u(e.constructor.name);r.addIssue=n=>{if("string"==typeof n)r.issues.push(q(n,r.value,t));else{const t=n;t.fatal&&(t.continue=!1),t.code??(t.code="custom"),t.input??(t.input=r.value),t.inst??(t.inst=e),r.issues.push(q(t))}};const o=t.transform(r.value,r);return o instanceof Promise?o.then(e=>(r.value=e,r.fallback=!0,r)):(r.value=o,r.fallback=!0,r)}});function Ho(e){return new Lo({type:"transform",transform:e})}const Jo=i("ZodOptional",(e,t)=>{Ht.init(e,t),Jn.init(e,t),e._zod.processJSONSchema=(t,r,n)=>bn(e,t,0,n),e.unwrap=()=>e._zod.def.innerType});function Ko(e){return new Jo({type:"optional",innerType:e})}const Go=i("ZodExactOptional",(e,t)=>{Jt.init(e,t),Jn.init(e,t),e._zod.processJSONSchema=(t,r,n)=>bn(e,t,0,n),e.unwrap=()=>e._zod.def.innerType});const Bo=i("ZodNullable",(e,t)=>{Kt.init(e,t),Jn.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const o=e._zod.def,s=yn(o.innerType,t,n),a=t.seen.get(e);"openapi-3.0"===t.target?(a.ref=o.innerType,r.nullable=!0):r.anyOf=[s,{type:"null"}]})(e,t,r,n),e.unwrap=()=>e._zod.def.innerType});function Wo(e){return new Bo({type:"nullable",innerType:e})}const Qo=i("ZodDefault",(e,t)=>{Gt.init(e,t),Jn.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const o=e._zod.def;yn(o.innerType,t,n),t.seen.get(e).ref=o.innerType,r.default=JSON.parse(JSON.stringify(o.defaultValue))})(e,t,r,n),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});const Yo=i("ZodPrefault",(e,t)=>{Wt.init(e,t),Jn.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const o=e._zod.def;yn(o.innerType,t,n),t.seen.get(e).ref=o.innerType,"input"===t.io&&(r._prefault=JSON.parse(JSON.stringify(o.defaultValue)))})(e,t,r,n),e.unwrap=()=>e._zod.def.innerType});const Xo=i("ZodNonOptional",(e,t)=>{Qt.init(e,t),Jn.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const o=e._zod.def;yn(o.innerType,t,n),t.seen.get(e).ref=o.innerType})(e,t,0,n),e.unwrap=()=>e._zod.def.innerType});const es=i("ZodCatch",(e,t)=>{Xt.init(e,t),Jn.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const o=e._zod.def;let s;yn(o.innerType,t,n),t.seen.get(e).ref=o.innerType;try{s=o.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}r.default=s})(e,t,r,n),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});const ts=i("ZodPipe",(e,t)=>{er.init(e,t),Jn.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const o=e._zod.def,s=o.in._zod.traits.has("$ZodTransform"),a="input"===t.io?s?o.out:o.in:o.out;yn(a,t,n),t.seen.get(e).ref=a})(e,t,0,n),e.in=t.in,e.out=t.out});function rs(e,t){return new ts({type:"pipe",in:e,out:t})}const ns=i("ZodPreprocess",(e,t)=>{ts.init(e,t),rr.init(e,t)}),os=i("ZodReadonly",(e,t)=>{nr.init(e,t),Jn.init(e,t),e._zod.processJSONSchema=(t,r,n)=>((e,t,r,n)=>{const o=e._zod.def;yn(o.innerType,t,n),t.seen.get(e).ref=o.innerType,r.readOnly=!0})(e,t,r,n),e.unwrap=()=>e._zod.def.innerType});const ss=i("ZodCustom",(e,t)=>{sr.init(e,t),Jn.init(e,t),e._zod.processJSONSchema=(e,t,r)=>((e,t)=>{if("throw"===t.unrepresentable)throw new Error("Custom types cannot be represented in JSON Schema")})(0,e)});function as(e,t){return new ns({type:"pipe",in:Ho(e),out:t})}const is="2025-11-25",cs=[is,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],us="io.modelcontextprotocol/related-task",ds="2.0",ls=ln(ss,(e=>null!==e&&("object"==typeof e||"function"==typeof e))??(()=>!0),ps);var ps;const fs=Oo([Bn(),vo().int()]),hs=Bn();No({ttl:vo().optional(),pollInterval:vo().optional()});const ms=Io({ttl:vo().optional()}),ys=Io({taskId:Bn()}),gs=No({progressToken:fs.optional(),[us]:ys.optional()}),vs=Io({_meta:gs.optional()}),_s=vs.extend({task:ms.optional()}),ws=Io({method:Bn(),params:vs.loose().optional()}),$s=Io({_meta:gs.optional()}),bs=Io({method:Bn(),params:$s.loose().optional()}),ks=No({_meta:gs.optional()}),Es=Oo([Bn(),vo().int()]),Ss=Io({jsonrpc:Zo(ds),id:Es,...ws.shape}).strict(),Ps=e=>Ss.safeParse(e).success,zs=Io({jsonrpc:Zo(ds),...bs.shape}).strict(),Ts=Io({jsonrpc:Zo(ds),id:Es,result:ks}).strict(),xs=e=>Ts.safeParse(e).success;var Is,Ns;(Ns=Is||(Is={}))[Ns.ConnectionClosed=-32e3]="ConnectionClosed",Ns[Ns.RequestTimeout=-32001]="RequestTimeout",Ns[Ns.ParseError=-32700]="ParseError",Ns[Ns.InvalidRequest=-32600]="InvalidRequest",Ns[Ns.MethodNotFound=-32601]="MethodNotFound",Ns[Ns.InvalidParams=-32602]="InvalidParams",Ns[Ns.InternalError=-32603]="InternalError",Ns[Ns.UrlElicitationRequired=-32042]="UrlElicitationRequired";const js=Io({jsonrpc:Zo(ds),id:Es.optional(),error:Io({code:vo().int(),message:Bn(),data:So().optional()})}).strict(),Os=e=>js.safeParse(e).success,Cs=Oo([Ss,zs,Ts,js]);Oo([Ts,js]);const Rs=ks.strict(),As=$s.extend({requestId:Es.optional(),reason:Bn().optional()}),Ms=bs.extend({method:Zo("notifications/cancelled"),params:As}),qs=Io({src:Bn(),mimeType:Bn().optional(),sizes:To(Bn()).optional(),theme:Vo(["light","dark"]).optional()}),Ds=Io({icons:To(qs).optional()}),Us=Io({name:Bn(),title:Bn().optional()}),Vs=Us.extend({...Us.shape,...Ds.shape,version:Bn(),websiteUrl:Bn().optional(),description:Bn().optional()}),Fs=Mo(Io({applyDefaults:bo().optional()}),Do(Bn(),So())),Zs=as(e=>e&&"object"==typeof e&&!Array.isArray(e)&&0===Object.keys(e).length?{form:{}}:e,Mo(Io({form:Fs.optional(),url:ls.optional()}),Do(Bn(),So()).optional())),Ls=No({list:ls.optional(),cancel:ls.optional(),requests:No({sampling:No({createMessage:ls.optional()}).optional(),elicitation:No({create:ls.optional()}).optional()}).optional()}),Hs=No({list:ls.optional(),cancel:ls.optional(),requests:No({tools:No({call:ls.optional()}).optional()}).optional()}),Js=Io({experimental:Do(Bn(),ls).optional(),sampling:Io({context:ls.optional(),tools:ls.optional()}).optional(),elicitation:Zs.optional(),roots:Io({listChanged:bo().optional()}).optional(),tasks:Ls.optional(),extensions:Do(Bn(),ls).optional()}),Ks=vs.extend({protocolVersion:Bn(),capabilities:Js,clientInfo:Vs}),Gs=ws.extend({method:Zo("initialize"),params:Ks}),Bs=Io({experimental:Do(Bn(),ls).optional(),logging:ls.optional(),completions:ls.optional(),prompts:Io({listChanged:bo().optional()}).optional(),resources:Io({subscribe:bo().optional(),listChanged:bo().optional()}).optional(),tools:Io({listChanged:bo().optional()}).optional(),tasks:Hs.optional(),extensions:Do(Bn(),ls).optional()}),Ws=ks.extend({protocolVersion:Bn(),capabilities:Bs,serverInfo:Vs,instructions:Bn().optional()}),Qs=bs.extend({method:Zo("notifications/initialized"),params:$s.optional()}),Ys=ws.extend({method:Zo("ping"),params:vs.optional()}),Xs=Io({progress:vo(),total:Ko(vo()),message:Ko(Bn())}),ea=Io({...$s.shape,...Xs.shape,progressToken:fs}),ta=bs.extend({method:Zo("notifications/progress"),params:ea}),ra=vs.extend({cursor:hs.optional()}),na=ws.extend({params:ra.optional()}),oa=ks.extend({nextCursor:hs.optional()}),sa=Vo(["working","input_required","completed","failed","cancelled"]),aa=Io({taskId:Bn(),status:sa,ttl:Oo([vo(),Ur(ko,ia)]),createdAt:Bn(),lastUpdatedAt:Bn(),pollInterval:Ko(vo()),statusMessage:Ko(Bn())});var ia;const ca=ks.extend({task:aa}),ua=$s.merge(aa),da=bs.extend({method:Zo("notifications/tasks/status"),params:ua}),la=ws.extend({method:Zo("tasks/get"),params:vs.extend({taskId:Bn()})}),pa=ks.merge(aa),fa=ws.extend({method:Zo("tasks/result"),params:vs.extend({taskId:Bn()})});ks.loose();const ha=na.extend({method:Zo("tasks/list")}),ma=oa.extend({tasks:To(aa)}),ya=ws.extend({method:Zo("tasks/cancel"),params:vs.extend({taskId:Bn()})}),ga=ks.merge(aa),va=Io({uri:Bn(),mimeType:Ko(Bn()),_meta:Do(Bn(),So()).optional()}),_a=va.extend({text:Bn()}),wa=Bn().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),$a=va.extend({blob:wa}),ba=Vo(["user","assistant"]),ka=Io({audience:To(ba).optional(),priority:vo().min(0).max(1).optional(),lastModified:zn({offset:!0}).optional()}),Ea=Io({...Us.shape,...Ds.shape,uri:Bn(),description:Ko(Bn()),mimeType:Ko(Bn()),size:Ko(vo()),annotations:ka.optional(),_meta:Ko(No({}))}),Sa=Io({...Us.shape,...Ds.shape,uriTemplate:Bn(),description:Ko(Bn()),mimeType:Ko(Bn()),annotations:ka.optional(),_meta:Ko(No({}))}),Pa=na.extend({method:Zo("resources/list")}),za=oa.extend({resources:To(Ea)}),Ta=na.extend({method:Zo("resources/templates/list")}),xa=oa.extend({resourceTemplates:To(Sa)}),Ia=vs.extend({uri:Bn()}),Na=Ia,ja=ws.extend({method:Zo("resources/read"),params:Na}),Oa=ks.extend({contents:To(Oo([_a,$a]))}),Ca=bs.extend({method:Zo("notifications/resources/list_changed"),params:$s.optional()}),Ra=Ia,Aa=ws.extend({method:Zo("resources/subscribe"),params:Ra}),Ma=Ia,qa=ws.extend({method:Zo("resources/unsubscribe"),params:Ma}),Da=$s.extend({uri:Bn()}),Ua=bs.extend({method:Zo("notifications/resources/updated"),params:Da}),Va=Io({name:Bn(),description:Ko(Bn()),required:Ko(bo())}),Fa=Io({...Us.shape,...Ds.shape,description:Ko(Bn()),arguments:Ko(To(Va)),_meta:Ko(No({}))}),Za=na.extend({method:Zo("prompts/list")}),La=oa.extend({prompts:To(Fa)}),Ha=vs.extend({name:Bn(),arguments:Do(Bn(),Bn()).optional()}),Ja=ws.extend({method:Zo("prompts/get"),params:Ha}),Ka=Io({type:Zo("text"),text:Bn(),annotations:ka.optional(),_meta:Do(Bn(),So()).optional()}),Ga=Io({type:Zo("image"),data:wa,mimeType:Bn(),annotations:ka.optional(),_meta:Do(Bn(),So()).optional()}),Ba=Io({type:Zo("audio"),data:wa,mimeType:Bn(),annotations:ka.optional(),_meta:Do(Bn(),So()).optional()}),Wa=Io({type:Zo("tool_use"),name:Bn(),id:Bn(),input:Do(Bn(),So()),_meta:Do(Bn(),So()).optional()}),Qa=Io({type:Zo("resource"),resource:Oo([_a,$a]),annotations:ka.optional(),_meta:Do(Bn(),So()).optional()}),Ya=Oo([Ka,Ga,Ba,Ea.extend({type:Zo("resource_link")}),Qa]),Xa=Io({role:ba,content:Ya}),ei=ks.extend({description:Bn().optional(),messages:To(Xa)}),ti=bs.extend({method:Zo("notifications/prompts/list_changed"),params:$s.optional()}),ri=Io({title:Bn().optional(),readOnlyHint:bo().optional(),destructiveHint:bo().optional(),idempotentHint:bo().optional(),openWorldHint:bo().optional()}),ni=Io({taskSupport:Vo(["required","optional","forbidden"]).optional()}),oi=Io({...Us.shape,...Ds.shape,description:Bn().optional(),inputSchema:Io({type:Zo("object"),properties:Do(Bn(),ls).optional(),required:To(Bn()).optional()}).catchall(So()),outputSchema:Io({type:Zo("object"),properties:Do(Bn(),ls).optional(),required:To(Bn()).optional()}).catchall(So()).optional(),annotations:ri.optional(),execution:ni.optional(),_meta:Do(Bn(),So()).optional()}),si=na.extend({method:Zo("tools/list")}),ai=oa.extend({tools:To(oi)}),ii=ks.extend({content:To(Ya).default([]),structuredContent:Do(Bn(),So()).optional(),isError:bo().optional()});ii.or(ks.extend({toolResult:So()}));const ci=_s.extend({name:Bn(),arguments:Do(Bn(),So()).optional()}),ui=ws.extend({method:Zo("tools/call"),params:ci}),di=bs.extend({method:Zo("notifications/tools/list_changed"),params:$s.optional()});Io({autoRefresh:bo().default(!0),debounceMs:vo().int().nonnegative().default(300)});const li=Vo(["debug","info","notice","warning","error","critical","alert","emergency"]),pi=vs.extend({level:li}),fi=ws.extend({method:Zo("logging/setLevel"),params:pi}),hi=$s.extend({level:li,logger:Bn().optional(),data:So()}),mi=bs.extend({method:Zo("notifications/message"),params:hi}),yi=Io({name:Bn().optional()}),gi=Io({hints:To(yi).optional(),costPriority:vo().min(0).max(1).optional(),speedPriority:vo().min(0).max(1).optional(),intelligencePriority:vo().min(0).max(1).optional()}),vi=Io({mode:Vo(["auto","required","none"]).optional()}),_i=Io({type:Zo("tool_result"),toolUseId:Bn().describe("The unique identifier for the corresponding tool call."),content:To(Ya).default([]),structuredContent:Io({}).loose().optional(),isError:bo().optional(),_meta:Do(Bn(),So()).optional()}),wi=Ro("type",[Ka,Ga,Ba]),$i=Ro("type",[Ka,Ga,Ba,Wa,_i]),bi=Io({role:ba,content:Oo([$i,To($i)]),_meta:Do(Bn(),So()).optional()}),ki=_s.extend({messages:To(bi),modelPreferences:gi.optional(),systemPrompt:Bn().optional(),includeContext:Vo(["none","thisServer","allServers"]).optional(),temperature:vo().optional(),maxTokens:vo().int(),stopSequences:To(Bn()).optional(),metadata:ls.optional(),tools:To(oi).optional(),toolChoice:vi.optional()}),Ei=ws.extend({method:Zo("sampling/createMessage"),params:ki}),Si=ks.extend({model:Bn(),stopReason:Ko(Vo(["endTurn","stopSequence","maxTokens"]).or(Bn())),role:ba,content:wi}),Pi=ks.extend({model:Bn(),stopReason:Ko(Vo(["endTurn","stopSequence","maxTokens","toolUse"]).or(Bn())),role:ba,content:Oo([$i,To($i)])}),zi=Io({type:Zo("boolean"),title:Bn().optional(),description:Bn().optional(),default:bo().optional()}),Ti=Io({type:Zo("string"),title:Bn().optional(),description:Bn().optional(),minLength:vo().optional(),maxLength:vo().optional(),format:Vo(["email","uri","date","date-time"]).optional(),default:Bn().optional()}),xi=Io({type:Vo(["number","integer"]),title:Bn().optional(),description:Bn().optional(),minimum:vo().optional(),maximum:vo().optional(),default:vo().optional()}),Ii=Io({type:Zo("string"),title:Bn().optional(),description:Bn().optional(),enum:To(Bn()),default:Bn().optional()}),Ni=Io({type:Zo("string"),title:Bn().optional(),description:Bn().optional(),oneOf:To(Io({const:Bn(),title:Bn()})),default:Bn().optional()}),ji=Io({type:Zo("string"),title:Bn().optional(),description:Bn().optional(),enum:To(Bn()),enumNames:To(Bn()).optional(),default:Bn().optional()}),Oi=Oo([Ii,Ni]),Ci=Oo([Io({type:Zo("array"),title:Bn().optional(),description:Bn().optional(),minItems:vo().optional(),maxItems:vo().optional(),items:Io({type:Zo("string"),enum:To(Bn())}),default:To(Bn()).optional()}),Io({type:Zo("array"),title:Bn().optional(),description:Bn().optional(),minItems:vo().optional(),maxItems:vo().optional(),items:Io({anyOf:To(Io({const:Bn(),title:Bn()}))}),default:To(Bn()).optional()})]),Ri=Oo([ji,Oi,Ci]),Ai=Oo([Ri,zi,Ti,xi]),Mi=Oo([_s.extend({mode:Zo("form").optional(),message:Bn(),requestedSchema:Io({type:Zo("object"),properties:Do(Bn(),Ai),required:To(Bn()).optional()})}),_s.extend({mode:Zo("url"),message:Bn(),elicitationId:Bn(),url:Bn().url()})]),qi=ws.extend({method:Zo("elicitation/create"),params:Mi}),Di=$s.extend({elicitationId:Bn()}),Ui=bs.extend({method:Zo("notifications/elicitation/complete"),params:Di}),Vi=ks.extend({action:Vo(["accept","decline","cancel"]),content:as(e=>null===e?void 0:e,Do(Bn(),Oo([Bn(),vo(),bo(),To(Bn())])).optional())}),Fi=Io({type:Zo("ref/resource"),uri:Bn()}),Zi=Io({type:Zo("ref/prompt"),name:Bn()}),Li=vs.extend({ref:Oo([Zi,Fi]),argument:Io({name:Bn(),value:Bn()}),context:Io({arguments:Do(Bn(),Bn()).optional()}).optional()}),Hi=ws.extend({method:Zo("completion/complete"),params:Li}),Ji=ks.extend({completion:No({values:To(Bn()).max(100),total:Ko(vo().int()),hasMore:Ko(bo())})}),Ki=Io({uri:Bn().startsWith("file://"),name:Bn().optional(),_meta:Do(Bn(),So()).optional()}),Gi=ws.extend({method:Zo("roots/list"),params:vs.optional()}),Bi=ks.extend({roots:To(Ki)}),Wi=bs.extend({method:Zo("notifications/roots/list_changed"),params:$s.optional()});Oo([Ys,Gs,Hi,fi,Ja,Za,Pa,Ta,ja,Aa,qa,ui,si,la,fa,ha,ya]),Oo([Ms,ta,Qs,Wi,da]),Oo([Rs,Si,Pi,Vi,Bi,pa,ma,ca]),Oo([Ys,Ei,qi,Gi,la,fa,ha,ya]),Oo([Ms,ta,mi,Ua,Ca,di,ti,da,Ui]),Oo([Rs,Ws,Ji,ei,La,za,xa,Oa,ii,ai,pa,ma,ca]);class Qi extends Error{constructor(e,t,r){super(`MCP error ${e}: ${t}`),this.code=e,this.data=r,this.name="McpError"}static fromError(e,t,r){if(e===Is.UrlElicitationRequired&&r){const e=r;if(e.elicitations)return new Yi(e.elicitations,t)}return new Qi(e,t,r)}}class Yi extends Qi{constructor(e,t=`URL elicitation${e.length>1?"s":""} required`){super(Is.UrlElicitationRequired,t,{elicitations:e})}get elicitations(){return this.data?.elicitations??[]}}function Xi(e){return"completed"===e||"failed"===e||"cancelled"===e}function ec(e){const t=Sn(e),r=t?.method;if(!r)throw new Error("Schema is missing a method literal");const n=function(e){if(kn(e)){const t=e,r=t._zod?.def;if(r){if(void 0!==r.value)return r.value;if(Array.isArray(r.values)&&r.values.length>0)return r.values[0]}}const t=e._def;if(t){if(void 0!==t.value)return t.value;if(Array.isArray(t.values)&&t.values.length>0)return t.values[0]}const r=e.value;if(void 0!==r)return r}(r);if("string"!=typeof n)throw new Error("Schema method literal must be a string");return n}function tc(e,t){const r=En(e,t);if(!r.success)throw r.error;return r.data}new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");class rc{constructor(e){this._options=e,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this._pendingDebouncedNotifications=new Set,this._taskProgressTokens=new Map,this._requestResolvers=new Map,this.setNotificationHandler(Ms,e=>{this._oncancel(e)}),this.setNotificationHandler(ta,e=>{this._onprogress(e)}),this.setRequestHandler(Ys,e=>({})),this._taskStore=e?.taskStore,this._taskMessageQueue=e?.taskMessageQueue,this._taskStore&&(this.setRequestHandler(la,async(e,t)=>{const r=await this._taskStore.getTask(e.params.taskId,t.sessionId);if(!r)throw new Qi(Is.InvalidParams,"Failed to retrieve task: Task not found");return{...r}}),this.setRequestHandler(fa,async(e,t)=>{const r=async()=>{const n=e.params.taskId;if(this._taskMessageQueue){let e;for(;e=await this._taskMessageQueue.dequeue(n,t.sessionId);){if("response"===e.type||"error"===e.type){const t=e.message,r=t.id,n=this._requestResolvers.get(r);if(n)if(this._requestResolvers.delete(r),"response"===e.type)n(t);else{const e=t;n(new Qi(e.error.code,e.error.message,e.error.data))}else{const t="response"===e.type?"Response":"Error";this._onerror(new Error(`${t} handler missing for request ${r}`))}continue}await(this._transport?.send(e.message,{relatedRequestId:t.requestId}))}}const o=await this._taskStore.getTask(n,t.sessionId);if(!o)throw new Qi(Is.InvalidParams,`Task not found: ${n}`);if(!Xi(o.status))return await this._waitForTaskUpdate(n,t.signal),await r();if(Xi(o.status)){const e=await this._taskStore.getTaskResult(n,t.sessionId);return this._clearTaskQueue(n),{...e,_meta:{...e._meta,[us]:{taskId:n}}}}return await r()};return await r()}),this.setRequestHandler(ha,async(e,t)=>{try{const{tasks:r,nextCursor:n}=await this._taskStore.listTasks(e.params?.cursor,t.sessionId);return{tasks:r,nextCursor:n,_meta:{}}}catch(r){throw new Qi(Is.InvalidParams,`Failed to list tasks: ${r instanceof Error?r.message:String(r)}`)}}),this.setRequestHandler(ya,async(e,t)=>{try{const r=await this._taskStore.getTask(e.params.taskId,t.sessionId);if(!r)throw new Qi(Is.InvalidParams,`Task not found: ${e.params.taskId}`);if(Xi(r.status))throw new Qi(Is.InvalidParams,`Cannot cancel task in terminal status: ${r.status}`);await this._taskStore.updateTaskStatus(e.params.taskId,"cancelled","Client cancelled task execution.",t.sessionId),this._clearTaskQueue(e.params.taskId);const n=await this._taskStore.getTask(e.params.taskId,t.sessionId);if(!n)throw new Qi(Is.InvalidParams,`Task not found after cancellation: ${e.params.taskId}`);return{_meta:{},...n}}catch(r){if(r instanceof Qi)throw r;throw new Qi(Is.InvalidRequest,`Failed to cancel task: ${r instanceof Error?r.message:String(r)}`)}}))}async _oncancel(e){if(!e.params.requestId)return;const t=this._requestHandlerAbortControllers.get(e.params.requestId);t?.abort(e.params.reason)}_setupTimeout(e,t,r,n,o=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(n,t),startTime:Date.now(),timeout:t,maxTotalTimeout:r,resetTimeoutOnProgress:o,onTimeout:n})}_resetTimeout(e){const t=this._timeoutInfo.get(e);if(!t)return!1;const r=Date.now()-t.startTime;if(t.maxTotalTimeout&&r>=t.maxTotalTimeout)throw this._timeoutInfo.delete(e),Qi.fromError(Is.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:t.maxTotalTimeout,totalElapsed:r});return clearTimeout(t.timeoutId),t.timeoutId=setTimeout(t.onTimeout,t.timeout),!0}_cleanupTimeout(e){const t=this._timeoutInfo.get(e);t&&(clearTimeout(t.timeoutId),this._timeoutInfo.delete(e))}async connect(e){if(this._transport)throw new Error("Already connected to a transport. Call close() before connecting to a new transport, or use a separate Protocol instance per connection.");this._transport=e;const t=this.transport?.onclose;this._transport.onclose=()=>{t?.(),this._onclose()};const r=this.transport?.onerror;this._transport.onerror=e=>{r?.(e),this._onerror(e)};const n=this._transport?.onmessage;this._transport.onmessage=(e,t)=>{var r;n?.(e,t),xs(e)||Os(e)?this._onresponse(e):Ps(e)?this._onrequest(e,t):(r=e,zs.safeParse(r).success?this._onnotification(e):this._onerror(new Error(`Unknown message type: ${JSON.stringify(e)}`)))},await this._transport.start()}_onclose(){const e=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();for(const r of this._timeoutInfo.values())clearTimeout(r.timeoutId);this._timeoutInfo.clear();for(const r of this._requestHandlerAbortControllers.values())r.abort();this._requestHandlerAbortControllers.clear();const t=Qi.fromError(Is.ConnectionClosed,"Connection closed");this._transport=void 0,this.onclose?.();for(const r of e.values())r(t)}_onerror(e){this.onerror?.(e)}_onnotification(e){const t=this._notificationHandlers.get(e.method)??this.fallbackNotificationHandler;void 0!==t&&Promise.resolve().then(()=>t(e)).catch(e=>this._onerror(new Error(`Uncaught error in notification handler: ${e}`)))}_onrequest(e,t){const r=this._requestHandlers.get(e.method)??this.fallbackRequestHandler,n=this._transport,o=e.params?._meta?.[us]?.taskId;if(void 0===r){const t={jsonrpc:"2.0",id:e.id,error:{code:Is.MethodNotFound,message:"Method not found"}};return void(o&&this._taskMessageQueue?this._enqueueTaskMessage(o,{type:"error",message:t,timestamp:Date.now()},n?.sessionId).catch(e=>this._onerror(new Error(`Failed to enqueue error response: ${e}`))):n?.send(t).catch(e=>this._onerror(new Error(`Failed to send an error response: ${e}`))))}const s=new AbortController;this._requestHandlerAbortControllers.set(e.id,s);const a=(i=e.params,_s.safeParse(i).success?e.params.task:void 0);var i;const c=this._taskStore?this.requestTaskStore(e,n?.sessionId):void 0,u={signal:s.signal,sessionId:n?.sessionId,_meta:e.params?._meta,sendNotification:async t=>{if(s.signal.aborted)return;const r={relatedRequestId:e.id};o&&(r.relatedTask={taskId:o}),await this.notification(t,r)},sendRequest:async(t,r,n)=>{if(s.signal.aborted)throw new Qi(Is.ConnectionClosed,"Request was cancelled");const a={...n,relatedRequestId:e.id};o&&!a.relatedTask&&(a.relatedTask={taskId:o});const i=a.relatedTask?.taskId??o;return i&&c&&await c.updateTaskStatus(i,"input_required"),await this.request(t,r,a)},authInfo:t?.authInfo,requestId:e.id,requestInfo:t?.requestInfo,taskId:o,taskStore:c,taskRequestedTtl:a?.ttl,closeSSEStream:t?.closeSSEStream,closeStandaloneSSEStream:t?.closeStandaloneSSEStream};Promise.resolve().then(()=>{a&&this.assertTaskHandlerCapability(e.method)}).then(()=>r(e,u)).then(async t=>{if(s.signal.aborted)return;const r={result:t,jsonrpc:"2.0",id:e.id};o&&this._taskMessageQueue?await this._enqueueTaskMessage(o,{type:"response",message:r,timestamp:Date.now()},n?.sessionId):await(n?.send(r))},async t=>{if(s.signal.aborted)return;const r={jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(t.code)?t.code:Is.InternalError,message:t.message??"Internal error",...void 0!==t.data&&{data:t.data}}};o&&this._taskMessageQueue?await this._enqueueTaskMessage(o,{type:"error",message:r,timestamp:Date.now()},n?.sessionId):await(n?.send(r))}).catch(e=>this._onerror(new Error(`Failed to send response: ${e}`))).finally(()=>{this._requestHandlerAbortControllers.get(e.id)===s&&this._requestHandlerAbortControllers.delete(e.id)})}_onprogress(e){const{progressToken:t,...r}=e.params,n=Number(t),o=this._progressHandlers.get(n);if(!o)return void this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));const s=this._responseHandlers.get(n),a=this._timeoutInfo.get(n);if(a&&s&&a.resetTimeoutOnProgress)try{this._resetTimeout(n)}catch(i){return this._responseHandlers.delete(n),this._progressHandlers.delete(n),this._cleanupTimeout(n),void s(i)}o(r)}_onresponse(e){const t=Number(e.id),r=this._requestResolvers.get(t);if(r){if(this._requestResolvers.delete(t),xs(e))r(e);else{r(new Qi(e.error.code,e.error.message,e.error.data))}return}const n=this._responseHandlers.get(t);if(void 0===n)return void this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));this._responseHandlers.delete(t),this._cleanupTimeout(t);let o=!1;if(xs(e)&&e.result&&"object"==typeof e.result){const r=e.result;if(r.task&&"object"==typeof r.task){const e=r.task;"string"==typeof e.taskId&&(o=!0,this._taskProgressTokens.set(e.taskId,t))}}if(o||this._progressHandlers.delete(t),xs(e))n(e);else{n(Qi.fromError(e.error.code,e.error.message,e.error.data))}}get transport(){return this._transport}async close(){await(this._transport?.close())}async*requestStream(e,t,r){const{task:n}=r??{};if(!n){try{const n=await this.request(e,t,r);yield{type:"result",result:n}}catch(s){yield{type:"error",error:s instanceof Qi?s:new Qi(Is.InternalError,String(s))}}return}let o;try{const n=await this.request(e,ca,r);if(!n.task)throw new Qi(Is.InternalError,"Task creation did not return a task");for(o=n.task.taskId,yield{type:"taskCreated",task:n.task};;){const e=await this.getTask({taskId:o},r);if(yield{type:"taskStatus",task:e},Xi(e.status)){if("completed"===e.status){const e=await this.getTaskResult({taskId:o},t,r);yield{type:"result",result:e}}else"failed"===e.status?yield{type:"error",error:new Qi(Is.InternalError,`Task ${o} failed`)}:"cancelled"===e.status&&(yield{type:"error",error:new Qi(Is.InternalError,`Task ${o} was cancelled`)});return}if("input_required"===e.status){const e=await this.getTaskResult({taskId:o},t,r);return void(yield{type:"result",result:e})}const n=e.pollInterval??this._options?.defaultTaskPollInterval??1e3;await new Promise(e=>setTimeout(e,n)),r?.signal?.throwIfAborted()}}catch(s){yield{type:"error",error:s instanceof Qi?s:new Qi(Is.InternalError,String(s))}}}request(e,t,r){const{relatedRequestId:n,resumptionToken:o,onresumptiontoken:s,task:a,relatedTask:i}=r??{};return new Promise((c,u)=>{const d=e=>{u(e)};if(!this._transport)return void d(new Error("Not connected"));if(!0===this._options?.enforceStrictCapabilities)try{this.assertCapabilityForMethod(e.method),a&&this.assertTaskCapability(e.method)}catch(y){return void d(y)}r?.signal?.throwIfAborted();const l=this._requestMessageId++,p={...e,jsonrpc:"2.0",id:l};r?.onprogress&&(this._progressHandlers.set(l,r.onprogress),p.params={...e.params,_meta:{...e.params?._meta||{},progressToken:l}}),a&&(p.params={...p.params,task:a}),i&&(p.params={...p.params,_meta:{...p.params?._meta||{},[us]:i}});const f=e=>{this._responseHandlers.delete(l),this._progressHandlers.delete(l),this._cleanupTimeout(l),this._transport?.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:l,reason:String(e)}},{relatedRequestId:n,resumptionToken:o,onresumptiontoken:s}).catch(e=>this._onerror(new Error(`Failed to send cancellation: ${e}`)));const t=e instanceof Qi?e:new Qi(Is.RequestTimeout,String(e));u(t)};this._responseHandlers.set(l,e=>{if(!r?.signal?.aborted){if(e instanceof Error)return u(e);try{const r=En(t,e.result);r.success?c(r.data):u(r.error)}catch(n){u(n)}}}),r?.signal?.addEventListener("abort",()=>{f(r?.signal?.reason)});const h=r?.timeout??6e4;this._setupTimeout(l,h,r?.maxTotalTimeout,()=>f(Qi.fromError(Is.RequestTimeout,"Request timed out",{timeout:h})),r?.resetTimeoutOnProgress??!1);const m=i?.taskId;if(m){const e=e=>{const t=this._responseHandlers.get(l);t?t(e):this._onerror(new Error(`Response handler missing for side-channeled request ${l}`))};this._requestResolvers.set(l,e),this._enqueueTaskMessage(m,{type:"request",message:p,timestamp:Date.now()}).catch(e=>{this._cleanupTimeout(l),u(e)})}else this._transport.send(p,{relatedRequestId:n,resumptionToken:o,onresumptiontoken:s}).catch(e=>{this._cleanupTimeout(l),u(e)})})}async getTask(e,t){return this.request({method:"tasks/get",params:e},pa,t)}async getTaskResult(e,t,r){return this.request({method:"tasks/result",params:e},t,r)}async listTasks(e,t){return this.request({method:"tasks/list",params:e},ma,t)}async cancelTask(e,t){return this.request({method:"tasks/cancel",params:e},ga,t)}async notification(e,t){if(!this._transport)throw new Error("Not connected");this.assertNotificationCapability(e.method);const r=t?.relatedTask?.taskId;if(r){const n={...e,jsonrpc:"2.0",params:{...e.params,_meta:{...e.params?._meta||{},[us]:t.relatedTask}}};return void(await this._enqueueTaskMessage(r,{type:"notification",message:n,timestamp:Date.now()}))}if((this._options?.debouncedNotificationMethods??[]).includes(e.method)&&!e.params&&!t?.relatedRequestId&&!t?.relatedTask){if(this._pendingDebouncedNotifications.has(e.method))return;return this._pendingDebouncedNotifications.add(e.method),void Promise.resolve().then(()=>{if(this._pendingDebouncedNotifications.delete(e.method),!this._transport)return;let r={...e,jsonrpc:"2.0"};t?.relatedTask&&(r={...r,params:{...r.params,_meta:{...r.params?._meta||{},[us]:t.relatedTask}}}),this._transport?.send(r,t).catch(e=>this._onerror(e))})}let n={...e,jsonrpc:"2.0"};t?.relatedTask&&(n={...n,params:{...n.params,_meta:{...n.params?._meta||{},[us]:t.relatedTask}}}),await this._transport.send(n,t)}setRequestHandler(e,t){const r=ec(e);this.assertRequestHandlerCapability(r),this._requestHandlers.set(r,(r,n)=>{const o=tc(e,r);return Promise.resolve(t(o,n))})}removeRequestHandler(e){this._requestHandlers.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw new Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,t){const r=ec(e);this._notificationHandlers.set(r,r=>{const n=tc(e,r);return Promise.resolve(t(n))})}removeNotificationHandler(e){this._notificationHandlers.delete(e)}_cleanupTaskProgressHandler(e){const t=this._taskProgressTokens.get(e);void 0!==t&&(this._progressHandlers.delete(t),this._taskProgressTokens.delete(e))}async _enqueueTaskMessage(e,t,r){if(!this._taskStore||!this._taskMessageQueue)throw new Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");const n=this._options?.maxTaskQueueSize;await this._taskMessageQueue.enqueue(e,t,r,n)}async _clearTaskQueue(e,t){if(this._taskMessageQueue){const r=await this._taskMessageQueue.dequeueAll(e,t);for(const t of r)if("request"===t.type&&Ps(t.message)){const r=t.message.id,n=this._requestResolvers.get(r);n?(n(new Qi(Is.InternalError,"Task cancelled or completed")),this._requestResolvers.delete(r)):this._onerror(new Error(`Resolver missing for request ${r} during task ${e} cleanup`))}}}async _waitForTaskUpdate(e,t){let r=this._options?.defaultTaskPollInterval??1e3;try{const t=await(this._taskStore?.getTask(e));t?.pollInterval&&(r=t.pollInterval)}catch{}return new Promise((e,n)=>{if(t.aborted)return void n(new Qi(Is.InvalidRequest,"Request cancelled"));const o=setTimeout(e,r);t.addEventListener("abort",()=>{clearTimeout(o),n(new Qi(Is.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore(e,t){const r=this._taskStore;if(!r)throw new Error("No task store configured");return{createTask:async n=>{if(!e)throw new Error("No request provided");return await r.createTask(n,e.id,{method:e.method,params:e.params},t)},getTask:async e=>{const n=await r.getTask(e,t);if(!n)throw new Qi(Is.InvalidParams,"Failed to retrieve task: Task not found");return n},storeTaskResult:async(e,n,o)=>{await r.storeTaskResult(e,n,o,t);const s=await r.getTask(e,t);if(s){const t=da.parse({method:"notifications/tasks/status",params:s});await this.notification(t),Xi(s.status)&&this._cleanupTaskProgressHandler(e)}},getTaskResult:e=>r.getTaskResult(e,t),updateTaskStatus:async(e,n,o)=>{const s=await r.getTask(e,t);if(!s)throw new Qi(Is.InvalidParams,`Task "${e}" not found - it may have been cleaned up`);if(Xi(s.status))throw new Qi(Is.InvalidParams,`Cannot update task "${e}" from terminal status "${s.status}" to "${n}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await r.updateTaskStatus(e,n,o,t);const a=await r.getTask(e,t);if(a){const t=da.parse({method:"notifications/tasks/status",params:a});await this.notification(t),Xi(a.status)&&this._cleanupTaskProgressHandler(e)}},listTasks:e=>r.listTasks(e,t)}}}function nc(e){return null!==e&&"object"==typeof e&&!Array.isArray(e)}var oc,sc={exports:{}},ac={},ic={},cc={},uc={},dc={},lc={};function pc(){return oc||(oc=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.regexpCode=e.getEsmExportName=e.getProperty=e.safeStringify=e.stringify=e.strConcat=e.addCodeArg=e.str=e._=e.nil=e._Code=e.Name=e.IDENTIFIER=e._CodeOrName=void 0;class t{}e._CodeOrName=t,e.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class r extends t{constructor(t){if(super(),!e.IDENTIFIER.test(t))throw new Error("CodeGen: name must be a valid identifier");this.str=t}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}}e.Name=r;class n extends t{constructor(e){super(),this._items="string"==typeof e?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;const e=this._items[0];return""===e||'""'===e}get str(){var e;return null!==(e=this._str)&&void 0!==e?e:this._str=this._items.reduce((e,t)=>`${e}${t}`,"")}get names(){var e;return null!==(e=this._names)&&void 0!==e?e:this._names=this._items.reduce((e,t)=>(t instanceof r&&(e[t.str]=(e[t.str]||0)+1),e),{})}}function o(e,...t){const r=[e[0]];let o=0;for(;o<t.length;)i(r,t[o]),r.push(e[++o]);return new n(r)}e._Code=n,e.nil=new n(""),e._=o;const s=new n("+");function a(e,...t){const r=[u(e[0])];let o=0;for(;o<t.length;)r.push(s),i(r,t[o]),r.push(s,u(e[++o]));return function(e){let t=1;for(;t<e.length-1;){if(e[t]===s){const r=c(e[t-1],e[t+1]);if(void 0!==r){e.splice(t-1,3,r);continue}e[t++]="+"}t++}}(r),new n(r)}function i(e,t){var o;t instanceof n?e.push(...t._items):t instanceof r?e.push(t):e.push("number"==typeof(o=t)||"boolean"==typeof o||null===o?o:u(Array.isArray(o)?o.join(","):o))}function c(e,t){if('""'===t)return e;if('""'===e)return t;if("string"==typeof e){if(t instanceof r||'"'!==e[e.length-1])return;return"string"!=typeof t?`${e.slice(0,-1)}${t}"`:'"'===t[0]?e.slice(0,-1)+t.slice(1):void 0}return"string"!=typeof t||'"'!==t[0]||e instanceof r?void 0:`"${e}${t.slice(1)}`}function u(e){return JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}e.str=a,e.addCodeArg=i,e.strConcat=function(e,t){return t.emptyStr()?e:e.emptyStr()?t:a`${e}${t}`},e.stringify=function(e){return new n(u(e))},e.safeStringify=u,e.getProperty=function(t){return"string"==typeof t&&e.IDENTIFIER.test(t)?new n(`.${t}`):o`[${t}]`},e.getEsmExportName=function(t){if("string"==typeof t&&e.IDENTIFIER.test(t))return new n(`${t}`);throw new Error(`CodeGen: invalid export name: ${t}, use explicit $id name mapping`)},e.regexpCode=function(e){return new n(e.toString())}}(lc)),lc}var fc,hc,mc={};function yc(){return fc||(fc=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ValueScope=e.ValueScopeName=e.Scope=e.varKinds=e.UsedValueState=void 0;const t=pc();class r extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}}var n,o;(o=n||(e.UsedValueState=n={}))[o.Started=0]="Started",o[o.Completed=1]="Completed",e.varKinds={const:new t.Name("const"),let:new t.Name("let"),var:new t.Name("var")};class s{constructor({prefixes:e,parent:t}={}){this._names={},this._prefixes=e,this._parent=t}toName(e){return e instanceof t.Name?e:this.name(e)}name(e){return new t.Name(this._newName(e))}_newName(e){return`${e}${(this._names[e]||this._nameGroup(e)).index++}`}_nameGroup(e){var t,r;if((null===(r=null===(t=this._parent)||void 0===t?void 0:t._prefixes)||void 0===r?void 0:r.has(e))||this._prefixes&&!this._prefixes.has(e))throw new Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}}e.Scope=s;class a extends t.Name{constructor(e,t){super(t),this.prefix=e}setValue(e,{property:r,itemIndex:n}){this.value=e,this.scopePath=t._`.${new t.Name(r)}[${n}]`}}e.ValueScopeName=a;const i=t._`\n`;e.ValueScope=class extends s{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?i:t.nil}}get(){return this._scope}name(e){return new a(e,this._newName(e))}value(e,t){var r;if(void 0===t.ref)throw new Error("CodeGen: ref must be passed in value");const n=this.toName(e),{prefix:o}=n,s=null!==(r=t.key)&&void 0!==r?r:t.ref;let a=this._values[o];if(a){const e=a.get(s);if(e)return e}else a=this._values[o]=new Map;a.set(s,n);const i=this._scope[o]||(this._scope[o]=[]),c=i.length;return i[c]=t.ref,n.setValue(t,{property:o,itemIndex:c}),n}getValue(e,t){const r=this._values[e];if(r)return r.get(t)}scopeRefs(e,r=this._values){return this._reduceValues(r,r=>{if(void 0===r.scopePath)throw new Error(`CodeGen: name "${r}" has no value`);return t._`${e}${r.scopePath}`})}scopeCode(e=this._values,t,r){return this._reduceValues(e,e=>{if(void 0===e.value)throw new Error(`CodeGen: name "${e}" has no value`);return e.value.code},t,r)}_reduceValues(o,s,a={},i){let c=t.nil;for(const u in o){const d=o[u];if(!d)continue;const l=a[u]=a[u]||new Map;d.forEach(o=>{if(l.has(o))return;l.set(o,n.Started);let a=s(o);if(a){const r=this.opts.es5?e.varKinds.var:e.varKinds.const;c=t._`${c}${r} ${o} = ${a};${this.opts._n}`}else{if(!(a=null==i?void 0:i(o)))throw new r(o);c=t._`${c}${a}${this.opts._n}`}l.set(o,n.Completed)})}return c}}}(mc)),mc}function gc(){return hc||(hc=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.or=e.and=e.not=e.CodeGen=e.operators=e.varKinds=e.ValueScopeName=e.ValueScope=e.Scope=e.Name=e.regexpCode=e.stringify=e.getProperty=e.nil=e.strConcat=e.str=e._=void 0;const t=pc(),r=yc();var n=pc();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return n._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return n.str}}),Object.defineProperty(e,"strConcat",{enumerable:!0,get:function(){return n.strConcat}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return n.nil}}),Object.defineProperty(e,"getProperty",{enumerable:!0,get:function(){return n.getProperty}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return n.stringify}}),Object.defineProperty(e,"regexpCode",{enumerable:!0,get:function(){return n.regexpCode}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return n.Name}});var o=yc();Object.defineProperty(e,"Scope",{enumerable:!0,get:function(){return o.Scope}}),Object.defineProperty(e,"ValueScope",{enumerable:!0,get:function(){return o.ValueScope}}),Object.defineProperty(e,"ValueScopeName",{enumerable:!0,get:function(){return o.ValueScopeName}}),Object.defineProperty(e,"varKinds",{enumerable:!0,get:function(){return o.varKinds}}),e.operators={GT:new t._Code(">"),GTE:new t._Code(">="),LT:new t._Code("<"),LTE:new t._Code("<="),EQ:new t._Code("==="),NEQ:new t._Code("!=="),NOT:new t._Code("!"),OR:new t._Code("||"),AND:new t._Code("&&"),ADD:new t._Code("+")};class s{optimizeNodes(){return this}optimizeNames(e,t){return this}}class a extends s{constructor(e,t,r){super(),this.varKind=e,this.name=t,this.rhs=r}render({es5:e,_n:t}){const n=e?r.varKinds.var:this.varKind,o=void 0===this.rhs?"":` = ${this.rhs}`;return`${n} ${this.name}${o};`+t}optimizeNames(e,t){if(e[this.name.str])return this.rhs&&(this.rhs=x(this.rhs,e,t)),this}get names(){return this.rhs instanceof t._CodeOrName?this.rhs.names:{}}}class i extends s{constructor(e,t,r){super(),this.lhs=e,this.rhs=t,this.sideEffects=r}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,r){if(!(this.lhs instanceof t.Name)||e[this.lhs.str]||this.sideEffects)return this.rhs=x(this.rhs,e,r),this}get names(){return T(this.lhs instanceof t.Name?{}:{...this.lhs.names},this.rhs)}}class c extends i{constructor(e,t,r,n){super(e,r,n),this.op=t}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}}class u extends s{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}}class d extends s{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}}class l extends s{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}}class p extends s{constructor(e){super(),this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,t){return this.code=x(this.code,e,t),this}get names(){return this.code instanceof t._CodeOrName?this.code.names:{}}}class f extends s{constructor(e=[]){super(),this.nodes=e}render(e){return this.nodes.reduce((t,r)=>t+r.render(e),"")}optimizeNodes(){const{nodes:e}=this;let t=e.length;for(;t--;){const r=e[t].optimizeNodes();Array.isArray(r)?e.splice(t,1,...r):r?e[t]=r:e.splice(t,1)}return e.length>0?this:void 0}optimizeNames(e,t){const{nodes:r}=this;let n=r.length;for(;n--;){const o=r[n];o.optimizeNames(e,t)||(I(e,o.names),r.splice(n,1))}return r.length>0?this:void 0}get names(){return this.nodes.reduce((e,t)=>z(e,t.names),{})}}class h extends f{render(e){return"{"+e._n+super.render(e)+"}"+e._n}}class m extends f{}class y extends h{}y.kind="else";class g extends h{constructor(e,t){super(t),this.condition=e}render(e){let t=`if(${this.condition})`+super.render(e);return this.else&&(t+="else "+this.else.render(e)),t}optimizeNodes(){super.optimizeNodes();const e=this.condition;if(!0===e)return this.nodes;let t=this.else;if(t){const e=t.optimizeNodes();t=this.else=Array.isArray(e)?new y(e):e}return t?!1===e?t instanceof g?t:t.nodes:this.nodes.length?this:new g(N(e),t instanceof g?[t]:t.nodes):!1!==e&&this.nodes.length?this:void 0}optimizeNames(e,t){var r;if(this.else=null===(r=this.else)||void 0===r?void 0:r.optimizeNames(e,t),super.optimizeNames(e,t)||this.else)return this.condition=x(this.condition,e,t),this}get names(){const e=super.names;return T(e,this.condition),this.else&&z(e,this.else.names),e}}g.kind="if";class v extends h{}v.kind="for";class _ extends v{constructor(e){super(),this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,t){if(super.optimizeNames(e,t))return this.iteration=x(this.iteration,e,t),this}get names(){return z(super.names,this.iteration.names)}}class w extends v{constructor(e,t,r,n){super(),this.varKind=e,this.name=t,this.from=r,this.to=n}render(e){const t=e.es5?r.varKinds.var:this.varKind,{name:n,from:o,to:s}=this;return`for(${t} ${n}=${o}; ${n}<${s}; ${n}++)`+super.render(e)}get names(){const e=T(super.names,this.from);return T(e,this.to)}}class $ extends v{constructor(e,t,r,n){super(),this.loop=e,this.varKind=t,this.name=r,this.iterable=n}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,t){if(super.optimizeNames(e,t))return this.iterable=x(this.iterable,e,t),this}get names(){return z(super.names,this.iterable.names)}}class b extends h{constructor(e,t,r){super(),this.name=e,this.args=t,this.async=r}render(e){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(e)}}b.kind="func";class k extends f{render(e){return"return "+super.render(e)}}k.kind="return";class E extends h{render(e){let t="try"+super.render(e);return this.catch&&(t+=this.catch.render(e)),this.finally&&(t+=this.finally.render(e)),t}optimizeNodes(){var e,t;return super.optimizeNodes(),null===(e=this.catch)||void 0===e||e.optimizeNodes(),null===(t=this.finally)||void 0===t||t.optimizeNodes(),this}optimizeNames(e,t){var r,n;return super.optimizeNames(e,t),null===(r=this.catch)||void 0===r||r.optimizeNames(e,t),null===(n=this.finally)||void 0===n||n.optimizeNames(e,t),this}get names(){const e=super.names;return this.catch&&z(e,this.catch.names),this.finally&&z(e,this.finally.names),e}}class S extends h{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}}S.kind="catch";class P extends h{render(e){return"finally"+super.render(e)}}P.kind="finally";function z(e,t){for(const r in t)e[r]=(e[r]||0)+(t[r]||0);return e}function T(e,r){return r instanceof t._CodeOrName?z(e,r.names):e}function x(e,r,n){return e instanceof t.Name?s(e):(o=e)instanceof t._Code&&o._items.some(e=>e instanceof t.Name&&1===r[e.str]&&void 0!==n[e.str])?new t._Code(e._items.reduce((e,r)=>(r instanceof t.Name&&(r=s(r)),r instanceof t._Code?e.push(...r._items):e.push(r),e),[])):e;var o;function s(e){const t=n[e.str];return void 0===t||1!==r[e.str]?e:(delete r[e.str],t)}}function I(e,t){for(const r in t)e[r]=(e[r]||0)-(t[r]||0)}function N(e){return"boolean"==typeof e||"number"==typeof e||null===e?!e:t._`!${R(e)}`}e.CodeGen=class{constructor(e,t={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...t,_n:t.lines?"\n":""},this._extScope=e,this._scope=new r.Scope({parent:e}),this._nodes=[new m]}toString(){return this._root.render(this.opts)}name(e){return this._scope.name(e)}scopeName(e){return this._extScope.name(e)}scopeValue(e,t){const r=this._extScope.value(e,t);return(this._values[r.prefix]||(this._values[r.prefix]=new Set)).add(r),r}getScopeValue(e,t){return this._extScope.getValue(e,t)}scopeRefs(e){return this._extScope.scopeRefs(e,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(e,t,r,n){const o=this._scope.toName(t);return void 0!==r&&n&&(this._constants[o.str]=r),this._leafNode(new a(e,o,r)),o}const(e,t,n){return this._def(r.varKinds.const,e,t,n)}let(e,t,n){return this._def(r.varKinds.let,e,t,n)}var(e,t,n){return this._def(r.varKinds.var,e,t,n)}assign(e,t,r){return this._leafNode(new i(e,t,r))}add(t,r){return this._leafNode(new c(t,e.operators.ADD,r))}code(e){return"function"==typeof e?e():e!==t.nil&&this._leafNode(new p(e)),this}object(...e){const r=["{"];for(const[n,o]of e)r.length>1&&r.push(","),r.push(n),(n!==o||this.opts.es5)&&(r.push(":"),(0,t.addCodeArg)(r,o));return r.push("}"),new t._Code(r)}if(e,t,r){if(this._blockNode(new g(e)),t&&r)this.code(t).else().code(r).endIf();else if(t)this.code(t).endIf();else if(r)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(e){return this._elseNode(new g(e))}else(){return this._elseNode(new y)}endIf(){return this._endBlockNode(g,y)}_for(e,t){return this._blockNode(e),t&&this.code(t).endFor(),this}for(e,t){return this._for(new _(e),t)}forRange(e,t,n,o,s=(this.opts.es5?r.varKinds.var:r.varKinds.let)){const a=this._scope.toName(e);return this._for(new w(s,a,t,n),()=>o(a))}forOf(e,n,o,s=r.varKinds.const){const a=this._scope.toName(e);if(this.opts.es5){const e=n instanceof t.Name?n:this.var("_arr",n);return this.forRange("_i",0,t._`${e}.length`,r=>{this.var(a,t._`${e}[${r}]`),o(a)})}return this._for(new $("of",s,a,n),()=>o(a))}forIn(e,n,o,s=(this.opts.es5?r.varKinds.var:r.varKinds.const)){if(this.opts.ownProperties)return this.forOf(e,t._`Object.keys(${n})`,o);const a=this._scope.toName(e);return this._for(new $("in",s,a,n),()=>o(a))}endFor(){return this._endBlockNode(v)}label(e){return this._leafNode(new u(e))}break(e){return this._leafNode(new d(e))}return(e){const t=new k;if(this._blockNode(t),this.code(e),1!==t.nodes.length)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(k)}try(e,t,r){if(!t&&!r)throw new Error('CodeGen: "try" without "catch" and "finally"');const n=new E;if(this._blockNode(n),this.code(e),t){const e=this.name("e");this._currNode=n.catch=new S(e),t(e)}return r&&(this._currNode=n.finally=new P,this.code(r)),this._endBlockNode(S,P)}throw(e){return this._leafNode(new l(e))}block(e,t){return this._blockStarts.push(this._nodes.length),e&&this.code(e).endBlock(t),this}endBlock(e){const t=this._blockStarts.pop();if(void 0===t)throw new Error("CodeGen: not in self-balancing block");const r=this._nodes.length-t;if(r<0||void 0!==e&&r!==e)throw new Error(`CodeGen: wrong number of nodes: ${r} vs ${e} expected`);return this._nodes.length=t,this}func(e,r=t.nil,n,o){return this._blockNode(new b(e,r,n)),o&&this.code(o).endFunc(),this}endFunc(){return this._endBlockNode(b)}optimize(e=1){for(;e-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(e){return this._currNode.nodes.push(e),this}_blockNode(e){this._currNode.nodes.push(e),this._nodes.push(e)}_endBlockNode(e,t){const r=this._currNode;if(r instanceof e||t&&r instanceof t)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${t?`${e.kind}/${t.kind}`:e.kind}"`)}_elseNode(e){const t=this._currNode;if(!(t instanceof g))throw new Error('CodeGen: "else" without "if"');return this._currNode=t.else=e,this}get _root(){return this._nodes[0]}get _currNode(){const e=this._nodes;return e[e.length-1]}set _currNode(e){const t=this._nodes;t[t.length-1]=e}},e.not=N;const j=C(e.operators.AND);e.and=function(...e){return e.reduce(j)};const O=C(e.operators.OR);function C(e){return(r,n)=>r===t.nil?n:n===t.nil?r:t._`${R(r)} ${e} ${R(n)}`}function R(e){return e instanceof t.Name?e:t._`(${e})`}e.or=function(...e){return e.reduce(O)}}(dc)),dc}var vc,_c={};function wc(){if(vc)return _c;vc=1,Object.defineProperty(_c,"__esModule",{value:!0}),_c.checkStrictMode=_c.getErrorPath=_c.Type=_c.useFunc=_c.setEvaluated=_c.evaluatedPropsToName=_c.mergeEvaluated=_c.eachItem=_c.unescapeJsonPointer=_c.escapeJsonPointer=_c.escapeFragment=_c.unescapeFragment=_c.schemaRefOrVal=_c.schemaHasRulesButRef=_c.schemaHasRules=_c.checkUnknownRules=_c.alwaysValidSchema=_c.toHash=void 0;const e=gc(),t=pc();function r(e,t=e.schema){const{opts:r,self:n}=e;if(!r.strictSchema)return;if("boolean"==typeof t)return;const o=n.RULES.keywords;for(const s in t)o[s]||p(e,`unknown keyword: "${s}"`)}function n(e,t){if("boolean"==typeof e)return!e;for(const r in e)if(t[r])return!0;return!1}function o(e){return"number"==typeof e?`${e}`:e.replace(/~/g,"~0").replace(/\//g,"~1")}function s(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function a({mergeNames:t,mergeToName:r,mergeValues:n,resultToName:o}){return(s,a,i,c)=>{const u=void 0===i?a:i instanceof e.Name?(a instanceof e.Name?t(s,a,i):r(s,a,i),i):a instanceof e.Name?(r(s,i,a),a):n(a,i);return c!==e.Name||u instanceof e.Name?u:o(s,u)}}function i(t,r){if(!0===r)return t.var("props",!0);const n=t.var("props",e._`{}`);return void 0!==r&&c(t,n,r),n}function c(t,r,n){Object.keys(n).forEach(n=>t.assign(e._`${r}${(0,e.getProperty)(n)}`,!0))}_c.toHash=function(e){const t={};for(const r of e)t[r]=!0;return t},_c.alwaysValidSchema=function(e,t){return"boolean"==typeof t?t:0===Object.keys(t).length||(r(e,t),!n(t,e.self.RULES.all))},_c.checkUnknownRules=r,_c.schemaHasRules=n,_c.schemaHasRulesButRef=function(e,t){if("boolean"==typeof e)return!e;for(const r in e)if("$ref"!==r&&t.all[r])return!0;return!1},_c.schemaRefOrVal=function({topSchemaRef:t,schemaPath:r},n,o,s){if(!s){if("number"==typeof n||"boolean"==typeof n)return n;if("string"==typeof n)return e._`${n}`}return e._`${t}${r}${(0,e.getProperty)(o)}`},_c.unescapeFragment=function(e){return s(decodeURIComponent(e))},_c.escapeFragment=function(e){return encodeURIComponent(o(e))},_c.escapeJsonPointer=o,_c.unescapeJsonPointer=s,_c.eachItem=function(e,t){if(Array.isArray(e))for(const r of e)t(r);else t(e)},_c.mergeEvaluated={props:a({mergeNames:(t,r,n)=>t.if(e._`${n} !== true && ${r} !== undefined`,()=>{t.if(e._`${r} === true`,()=>t.assign(n,!0),()=>t.assign(n,e._`${n} || {}`).code(e._`Object.assign(${n}, ${r})`))}),mergeToName:(t,r,n)=>t.if(e._`${n} !== true`,()=>{!0===r?t.assign(n,!0):(t.assign(n,e._`${n} || {}`),c(t,n,r))}),mergeValues:(e,t)=>!0===e||{...e,...t},resultToName:i}),items:a({mergeNames:(t,r,n)=>t.if(e._`${n} !== true && ${r} !== undefined`,()=>t.assign(n,e._`${r} === true ? true : ${n} > ${r} ? ${n} : ${r}`)),mergeToName:(t,r,n)=>t.if(e._`${n} !== true`,()=>t.assign(n,!0===r||e._`${n} > ${r} ? ${n} : ${r}`)),mergeValues:(e,t)=>!0===e||Math.max(e,t),resultToName:(e,t)=>e.var("items",t)})},_c.evaluatedPropsToName=i,_c.setEvaluated=c;const u={};var d,l;function p(e,t,r=e.opts.strictSchema){if(r){if(t=`strict mode: ${t}`,!0===r)throw new Error(t);e.self.logger.warn(t)}}return _c.useFunc=function(e,r){return e.scopeValue("func",{ref:r,code:u[r.code]||(u[r.code]=new t._Code(r.code))})},(l=d||(_c.Type=d={}))[l.Num=0]="Num",l[l.Str=1]="Str",_c.getErrorPath=function(t,r,n){if(t instanceof e.Name){const o=r===d.Num;return n?o?e._`"[" + ${t} + "]"`:e._`"['" + ${t} + "']"`:o?e._`"/" + ${t}`:e._`"/" + ${t}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return n?(0,e.getProperty)(t).toString():"/"+o(t)},_c.checkStrictMode=p,_c}var $c,bc,kc,Ec={};function Sc(){if($c)return Ec;$c=1,Object.defineProperty(Ec,"__esModule",{value:!0});const e=gc(),t={data:new e.Name("data"),valCxt:new e.Name("valCxt"),instancePath:new e.Name("instancePath"),parentData:new e.Name("parentData"),parentDataProperty:new e.Name("parentDataProperty"),rootData:new e.Name("rootData"),dynamicAnchors:new e.Name("dynamicAnchors"),vErrors:new e.Name("vErrors"),errors:new e.Name("errors"),this:new e.Name("this"),self:new e.Name("self"),scope:new e.Name("scope"),json:new e.Name("json"),jsonPos:new e.Name("jsonPos"),jsonLen:new e.Name("jsonLen"),jsonPart:new e.Name("jsonPart")};return Ec.default=t,Ec}function Pc(){return bc||(bc=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.extendErrors=e.resetErrorsCount=e.reportExtraError=e.reportError=e.keyword$DataError=e.keywordError=void 0;const t=gc(),r=wc(),n=Sc();function o(e,r){const o=e.const("err",r);e.if(t._`${n.default.vErrors} === null`,()=>e.assign(n.default.vErrors,t._`[${o}]`),t._`${n.default.vErrors}.push(${o})`),e.code(t._`${n.default.errors}++`)}function s(e,r){const{gen:n,validateName:o,schemaEnv:s}=e;s.$async?n.throw(t._`new ${e.ValidationError}(${r})`):(n.assign(t._`${o}.errors`,r),n.return(!1))}e.keywordError={message:({keyword:e})=>t.str`must pass "${e}" keyword validation`},e.keyword$DataError={message:({keyword:e,schemaType:r})=>r?t.str`"${e}" keyword must be ${r} ($data)`:t.str`"${e}" keyword is invalid ($data)`},e.reportError=function(r,n=e.keywordError,a,c){const{it:u}=r,{gen:d,compositeRule:l,allErrors:p}=u,f=i(r,n,a);(null!=c?c:l||p)?o(d,f):s(u,t._`[${f}]`)},e.reportExtraError=function(t,r=e.keywordError,a){const{it:c}=t,{gen:u,compositeRule:d,allErrors:l}=c;o(u,i(t,r,a)),d||l||s(c,n.default.vErrors)},e.resetErrorsCount=function(e,r){e.assign(n.default.errors,r),e.if(t._`${n.default.vErrors} !== null`,()=>e.if(r,()=>e.assign(t._`${n.default.vErrors}.length`,r),()=>e.assign(n.default.vErrors,null)))},e.extendErrors=function({gen:e,keyword:r,schemaValue:o,data:s,errsCount:a,it:i}){if(void 0===a)throw new Error("ajv implementation error");const c=e.name("err");e.forRange("i",a,n.default.errors,a=>{e.const(c,t._`${n.default.vErrors}[${a}]`),e.if(t._`${c}.instancePath === undefined`,()=>e.assign(t._`${c}.instancePath`,(0,t.strConcat)(n.default.instancePath,i.errorPath))),e.assign(t._`${c}.schemaPath`,t.str`${i.errSchemaPath}/${r}`),i.opts.verbose&&(e.assign(t._`${c}.schema`,o),e.assign(t._`${c}.data`,s))})};const a={keyword:new t.Name("keyword"),schemaPath:new t.Name("schemaPath"),params:new t.Name("params"),propertyName:new t.Name("propertyName"),message:new t.Name("message"),schema:new t.Name("schema"),parentSchema:new t.Name("parentSchema")};function i(e,r,o){const{createErrors:s}=e.it;return!1===s?t._`{}`:function(e,r,o={}){const{gen:s,it:i}=e,d=[c(i,o),u(e,o)];return function(e,{params:r,message:o},s){const{keyword:i,data:c,schemaValue:u,it:d}=e,{opts:l,propertyName:p,topSchemaRef:f,schemaPath:h}=d;s.push([a.keyword,i],[a.params,"function"==typeof r?r(e):r||t._`{}`]),l.messages&&s.push([a.message,"function"==typeof o?o(e):o]);l.verbose&&s.push([a.schema,u],[a.parentSchema,t._`${f}${h}`],[n.default.data,c]);p&&s.push([a.propertyName,p])}(e,r,d),s.object(...d)}(e,r,o)}function c({errorPath:e},{instancePath:o}){const s=o?t.str`${e}${(0,r.getErrorPath)(o,r.Type.Str)}`:e;return[n.default.instancePath,(0,t.strConcat)(n.default.instancePath,s)]}function u({keyword:e,it:{errSchemaPath:n}},{schemaPath:o,parentSchema:s}){let i=s?n:t.str`${n}/${e}`;return o&&(i=t.str`${i}${(0,r.getErrorPath)(o,r.Type.Str)}`),[a.schemaPath,i]}}(uc)),uc}function zc(){if(kc)return cc;kc=1,Object.defineProperty(cc,"__esModule",{value:!0}),cc.boolOrEmptySchema=cc.topBoolOrEmptySchema=void 0;const e=Pc(),t=gc(),r=Sc(),n={message:"boolean schema is false"};function o(t,r){const{gen:o,data:s}=t,a={gen:o,keyword:"false schema",data:s,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:t};(0,e.reportError)(a,n,void 0,r)}return cc.topBoolOrEmptySchema=function(e){const{gen:n,schema:s,validateName:a}=e;!1===s?o(e,!1):"object"==typeof s&&!0===s.$async?n.return(r.default.data):(n.assign(t._`${a}.errors`,null),n.return(!0))},cc.boolOrEmptySchema=function(e,t){const{gen:r,schema:n}=e;!1===n?(r.var(t,!1),o(e)):r.var(t,!0)},cc}var Tc,xc={},Ic={};function Nc(){if(Tc)return Ic;Tc=1,Object.defineProperty(Ic,"__esModule",{value:!0}),Ic.getRules=Ic.isJSONType=void 0;const e=new Set(["string","number","integer","boolean","null","object","array"]);return Ic.isJSONType=function(t){return"string"==typeof t&&e.has(t)},Ic.getRules=function(){const e={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...e,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},e.number,e.string,e.array,e.object],post:{rules:[]},all:{},keywords:{}}},Ic}var jc,Oc,Cc={};function Rc(){if(jc)return Cc;function e(e,r){return r.rules.some(r=>t(e,r))}function t(e,t){var r;return void 0!==e[t.keyword]||(null===(r=t.definition.implements)||void 0===r?void 0:r.some(t=>void 0!==e[t]))}return jc=1,Object.defineProperty(Cc,"__esModule",{value:!0}),Cc.shouldUseRule=Cc.shouldUseGroup=Cc.schemaHasRulesForType=void 0,Cc.schemaHasRulesForType=function({schema:t,self:r},n){const o=r.RULES.types[n];return o&&!0!==o&&e(t,o)},Cc.shouldUseGroup=e,Cc.shouldUseRule=t,Cc}function Ac(){if(Oc)return xc;Oc=1,Object.defineProperty(xc,"__esModule",{value:!0}),xc.reportTypeError=xc.checkDataTypes=xc.checkDataType=xc.coerceAndCheckDataType=xc.getJSONTypes=xc.getSchemaTypes=xc.DataType=void 0;const e=Nc(),t=Rc(),r=Pc(),n=gc(),o=wc();var s,a;function i(t){const r=Array.isArray(t)?t:t?[t]:[];if(r.every(e.isJSONType))return r;throw new Error("type must be JSONType or JSONType[]: "+r.join(","))}(a=s||(xc.DataType=s={}))[a.Correct=0]="Correct",a[a.Wrong=1]="Wrong",xc.getSchemaTypes=function(e){const t=i(e.type);if(t.includes("null")){if(!1===e.nullable)throw new Error("type: null contradicts nullable: false")}else{if(!t.length&&void 0!==e.nullable)throw new Error('"nullable" cannot be used without "type"');!0===e.nullable&&t.push("null")}return t},xc.getJSONTypes=i,xc.coerceAndCheckDataType=function(e,r){const{gen:o,data:a,opts:i}=e,u=function(e,t){return t?e.filter(e=>c.has(e)||"array"===t&&"array"===e):[]}(r,i.coerceTypes),l=r.length>0&&!(0===u.length&&1===r.length&&(0,t.schemaHasRulesForType)(e,r[0]));if(l){const t=d(r,a,i.strictNumbers,s.Wrong);o.if(t,()=>{u.length?function(e,t,r){const{gen:o,data:s,opts:a}=e,i=o.let("dataType",n._`typeof ${s}`),u=o.let("coerced",n._`undefined`);"array"===a.coerceTypes&&o.if(n._`${i} == 'object' && Array.isArray(${s}) && ${s}.length == 1`,()=>o.assign(s,n._`${s}[0]`).assign(i,n._`typeof ${s}`).if(d(t,s,a.strictNumbers),()=>o.assign(u,s)));o.if(n._`${u} !== undefined`);for(const n of r)(c.has(n)||"array"===n&&"array"===a.coerceTypes)&&l(n);function l(e){switch(e){case"string":return void o.elseIf(n._`${i} == "number" || ${i} == "boolean"`).assign(u,n._`"" + ${s}`).elseIf(n._`${s} === null`).assign(u,n._`""`);case"number":return void o.elseIf(n._`${i} == "boolean" || ${s} === null
|
|
2
|
+
|| (${i} == "string" && ${s} && ${s} == +${s})`).assign(u,n._`+${s}`);case"integer":return void o.elseIf(n._`${i} === "boolean" || ${s} === null
|
|
3
|
+
|| (${i} === "string" && ${s} && ${s} == +${s} && !(${s} % 1))`).assign(u,n._`+${s}`);case"boolean":return void o.elseIf(n._`${s} === "false" || ${s} === 0 || ${s} === null`).assign(u,!1).elseIf(n._`${s} === "true" || ${s} === 1`).assign(u,!0);case"null":return o.elseIf(n._`${s} === "" || ${s} === 0 || ${s} === false`),void o.assign(u,null);case"array":o.elseIf(n._`${i} === "string" || ${i} === "number"
|
|
4
|
+
|| ${i} === "boolean" || ${s} === null`).assign(u,n._`[${s}]`)}}o.else(),p(e),o.endIf(),o.if(n._`${u} !== undefined`,()=>{o.assign(s,u),function({gen:e,parentData:t,parentDataProperty:r},o){e.if(n._`${t} !== undefined`,()=>e.assign(n._`${t}[${r}]`,o))}(e,u)})}(e,r,u):p(e)})}return l};const c=new Set(["string","number","integer","boolean","null"]);function u(e,t,r,o=s.Correct){const a=o===s.Correct?n.operators.EQ:n.operators.NEQ;let i;switch(e){case"null":return n._`${t} ${a} null`;case"array":i=n._`Array.isArray(${t})`;break;case"object":i=n._`${t} && typeof ${t} == "object" && !Array.isArray(${t})`;break;case"integer":i=c(n._`!(${t} % 1) && !isNaN(${t})`);break;case"number":i=c();break;default:return n._`typeof ${t} ${a} ${e}`}return o===s.Correct?i:(0,n.not)(i);function c(e=n.nil){return(0,n.and)(n._`typeof ${t} == "number"`,e,r?n._`isFinite(${t})`:n.nil)}}function d(e,t,r,s){if(1===e.length)return u(e[0],t,r,s);let a;const i=(0,o.toHash)(e);if(i.array&&i.object){const e=n._`typeof ${t} != "object"`;a=i.null?e:n._`!${t} || ${e}`,delete i.null,delete i.array,delete i.object}else a=n.nil;i.number&&delete i.integer;for(const o in i)a=(0,n.and)(a,u(o,t,r,s));return a}xc.checkDataType=u,xc.checkDataTypes=d;const l={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>"string"==typeof e?n._`{type: ${e}}`:n._`{type: ${t}}`};function p(e){const t=function(e){const{gen:t,data:r,schema:n}=e,s=(0,o.schemaRefOrVal)(e,n,"type");return{gen:t,keyword:"type",data:r,schema:n.type,schemaCode:s,schemaValue:s,parentSchema:n,params:{},it:e}}(e);(0,r.reportError)(t,l)}return xc.reportTypeError=p,xc}var Mc,qc={};function Dc(){if(Mc)return qc;Mc=1,Object.defineProperty(qc,"__esModule",{value:!0}),qc.assignDefaults=void 0;const e=gc(),t=wc();function r(r,n,o){const{gen:s,compositeRule:a,data:i,opts:c}=r;if(void 0===o)return;const u=e._`${i}${(0,e.getProperty)(n)}`;if(a)return void(0,t.checkStrictMode)(r,`default is ignored for: ${u}`);let d=e._`${u} === undefined`;"empty"===c.useDefaults&&(d=e._`${d} || ${u} === null || ${u} === ""`),s.if(d,e._`${u} = ${(0,e.stringify)(o)}`)}return qc.assignDefaults=function(e,t){const{properties:n,items:o}=e.schema;if("object"===t&&n)for(const s in n)r(e,s,n[s].default);else"array"===t&&Array.isArray(o)&&o.forEach((t,n)=>r(e,n,t.default))},qc}var Uc,Vc,Fc={},Zc={};function Lc(){if(Uc)return Zc;Uc=1,Object.defineProperty(Zc,"__esModule",{value:!0}),Zc.validateUnion=Zc.validateArray=Zc.usePattern=Zc.callValidateCode=Zc.schemaProperties=Zc.allSchemaProperties=Zc.noPropertyInData=Zc.propertyInData=Zc.isOwnProperty=Zc.hasPropFunc=Zc.reportMissingProp=Zc.checkMissingProp=Zc.checkReportMissingProp=void 0;const e=gc(),t=wc(),r=Sc(),n=wc();function o(t){return t.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:e._`Object.prototype.hasOwnProperty`})}function s(t,r,n){return e._`${o(t)}.call(${r}, ${n})`}function a(t,r,n,o){const a=e._`${r}${(0,e.getProperty)(n)} === undefined`;return o?(0,e.or)(a,(0,e.not)(s(t,r,n))):a}function i(e){return e?Object.keys(e).filter(e=>"__proto__"!==e):[]}Zc.checkReportMissingProp=function(t,r){const{gen:n,data:o,it:s}=t;n.if(a(n,o,r,s.opts.ownProperties),()=>{t.setParams({missingProperty:e._`${r}`},!0),t.error()})},Zc.checkMissingProp=function({gen:t,data:r,it:{opts:n}},o,s){return(0,e.or)(...o.map(o=>(0,e.and)(a(t,r,o,n.ownProperties),e._`${s} = ${o}`)))},Zc.reportMissingProp=function(e,t){e.setParams({missingProperty:t},!0),e.error()},Zc.hasPropFunc=o,Zc.isOwnProperty=s,Zc.propertyInData=function(t,r,n,o){const a=e._`${r}${(0,e.getProperty)(n)} !== undefined`;return o?e._`${a} && ${s(t,r,n)}`:a},Zc.noPropertyInData=a,Zc.allSchemaProperties=i,Zc.schemaProperties=function(e,r){return i(r).filter(n=>!(0,t.alwaysValidSchema)(e,r[n]))},Zc.callValidateCode=function({schemaCode:t,data:n,it:{gen:o,topSchemaRef:s,schemaPath:a,errorPath:i},it:c},u,d,l){const p=l?e._`${t}, ${n}, ${s}${a}`:n,f=[[r.default.instancePath,(0,e.strConcat)(r.default.instancePath,i)],[r.default.parentData,c.parentData],[r.default.parentDataProperty,c.parentDataProperty],[r.default.rootData,r.default.rootData]];c.opts.dynamicRef&&f.push([r.default.dynamicAnchors,r.default.dynamicAnchors]);const h=e._`${p}, ${o.object(...f)}`;return d!==e.nil?e._`${u}.call(${d}, ${h})`:e._`${u}(${h})`};const c=e._`new RegExp`;return Zc.usePattern=function({gen:t,it:{opts:r}},o){const s=r.unicodeRegExp?"u":"",{regExp:a}=r.code,i=a(o,s);return t.scopeValue("pattern",{key:i.toString(),ref:i,code:e._`${"new RegExp"===a.code?c:(0,n.useFunc)(t,a)}(${o}, ${s})`})},Zc.validateArray=function(r){const{gen:n,data:o,keyword:s,it:a}=r,i=n.name("valid");if(a.allErrors){const e=n.let("valid",!0);return c(()=>n.assign(e,!1)),e}return n.var(i,!0),c(()=>n.break()),i;function c(a){const c=n.const("len",e._`${o}.length`);n.forRange("i",0,c,o=>{r.subschema({keyword:s,dataProp:o,dataPropType:t.Type.Num},i),n.if((0,e.not)(i),a)})}},Zc.validateUnion=function(r){const{gen:n,schema:o,keyword:s,it:a}=r;if(!Array.isArray(o))throw new Error("ajv implementation error");if(o.some(e=>(0,t.alwaysValidSchema)(a,e))&&!a.opts.unevaluated)return;const i=n.let("valid",!1),c=n.name("_valid");n.block(()=>o.forEach((t,o)=>{const a=r.subschema({keyword:s,schemaProp:o,compositeRule:!0},c);n.assign(i,e._`${i} || ${c}`);r.mergeValidEvaluated(a,c)||n.if((0,e.not)(i))})),r.result(i,()=>r.reset(),()=>r.error(!0))},Zc}function Hc(){if(Vc)return Fc;Vc=1,Object.defineProperty(Fc,"__esModule",{value:!0}),Fc.validateKeywordUsage=Fc.validSchemaType=Fc.funcKeywordCode=Fc.macroKeywordCode=void 0;const e=gc(),t=Sc(),r=Lc(),n=Pc();function o(t){const{gen:r,data:n,it:o}=t;r.if(o.parentData,()=>r.assign(n,e._`${o.parentData}[${o.parentDataProperty}]`))}function s(t,r,n){if(void 0===n)throw new Error(`keyword "${r}" failed to compile`);return t.scopeValue("keyword","function"==typeof n?{ref:n}:{ref:n,code:(0,e.stringify)(n)})}return Fc.macroKeywordCode=function(t,r){const{gen:n,keyword:o,schema:a,parentSchema:i,it:c}=t,u=r.macro.call(c.self,a,i,c),d=s(n,o,u);!1!==c.opts.validateSchema&&c.self.validateSchema(u,!0);const l=n.name("valid");t.subschema({schema:u,schemaPath:e.nil,errSchemaPath:`${c.errSchemaPath}/${o}`,topSchemaRef:d,compositeRule:!0},l),t.pass(l,()=>t.error(!0))},Fc.funcKeywordCode=function(a,i){var c;const{gen:u,keyword:d,schema:l,parentSchema:p,$data:f,it:h}=a;!function({schemaEnv:e},t){if(t.async&&!e.$async)throw new Error("async keyword in sync schema")}(h,i);const m=!f&&i.compile?i.compile.call(h.self,l,p,h):i.validate,y=s(u,d,m),g=u.let("valid");function v(n=(i.async?e._`await `:e.nil)){const o=h.opts.passContext?t.default.this:t.default.self,s=!("compile"in i&&!f||!1===i.schema);u.assign(g,e._`${n}${(0,r.callValidateCode)(a,y,o,s)}`,i.modifying)}function _(t){var r;u.if((0,e.not)(null!==(r=i.valid)&&void 0!==r?r:g),t)}a.block$data(g,function(){if(!1===i.errors)v(),i.modifying&&o(a),_(()=>a.error());else{const r=i.async?function(){const t=u.let("ruleErrs",null);return u.try(()=>v(e._`await `),r=>u.assign(g,!1).if(e._`${r} instanceof ${h.ValidationError}`,()=>u.assign(t,e._`${r}.errors`),()=>u.throw(r))),t}():function(){const t=e._`${y}.errors`;return u.assign(t,null),v(e.nil),t}();i.modifying&&o(a),_(()=>function(r,o){const{gen:s}=r;s.if(e._`Array.isArray(${o})`,()=>{s.assign(t.default.vErrors,e._`${t.default.vErrors} === null ? ${o} : ${t.default.vErrors}.concat(${o})`).assign(t.default.errors,e._`${t.default.vErrors}.length`),(0,n.extendErrors)(r)},()=>r.error())}(a,r))}}),a.ok(null!==(c=i.valid)&&void 0!==c?c:g)},Fc.validSchemaType=function(e,t,r=!1){return!t.length||t.some(t=>"array"===t?Array.isArray(e):"object"===t?e&&"object"==typeof e&&!Array.isArray(e):typeof e==t||r&&void 0===e)},Fc.validateKeywordUsage=function({schema:e,opts:t,self:r,errSchemaPath:n},o,s){if(Array.isArray(o.keyword)?!o.keyword.includes(s):o.keyword!==s)throw new Error("ajv implementation error");const a=o.dependencies;if(null==a?void 0:a.some(t=>!Object.prototype.hasOwnProperty.call(e,t)))throw new Error(`parent schema must have dependencies of ${s}: ${a.join(",")}`);if(o.validateSchema){if(!o.validateSchema(e[s])){const e=`keyword "${s}" value is invalid at path "${n}": `+r.errorsText(o.validateSchema.errors);if("log"!==t.validateSchema)throw new Error(e);r.logger.error(e)}}},Fc}var Jc,Kc={};function Gc(){if(Jc)return Kc;Jc=1,Object.defineProperty(Kc,"__esModule",{value:!0}),Kc.extendSubschemaMode=Kc.extendSubschemaData=Kc.getSubschema=void 0;const e=gc(),t=wc();return Kc.getSubschema=function(r,{keyword:n,schemaProp:o,schema:s,schemaPath:a,errSchemaPath:i,topSchemaRef:c}){if(void 0!==n&&void 0!==s)throw new Error('both "keyword" and "schema" passed, only one allowed');if(void 0!==n){const s=r.schema[n];return void 0===o?{schema:s,schemaPath:e._`${r.schemaPath}${(0,e.getProperty)(n)}`,errSchemaPath:`${r.errSchemaPath}/${n}`}:{schema:s[o],schemaPath:e._`${r.schemaPath}${(0,e.getProperty)(n)}${(0,e.getProperty)(o)}`,errSchemaPath:`${r.errSchemaPath}/${n}/${(0,t.escapeFragment)(o)}`}}if(void 0!==s){if(void 0===a||void 0===i||void 0===c)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:s,schemaPath:a,topSchemaRef:c,errSchemaPath:i}}throw new Error('either "keyword" or "schema" must be passed')},Kc.extendSubschemaData=function(r,n,{dataProp:o,dataPropType:s,data:a,dataTypes:i,propertyName:c}){if(void 0!==a&&void 0!==o)throw new Error('both "data" and "dataProp" passed, only one allowed');const{gen:u}=n;if(void 0!==o){const{errorPath:a,dataPathArr:i,opts:c}=n;d(u.let("data",e._`${n.data}${(0,e.getProperty)(o)}`,!0)),r.errorPath=e.str`${a}${(0,t.getErrorPath)(o,s,c.jsPropertySyntax)}`,r.parentDataProperty=e._`${o}`,r.dataPathArr=[...i,r.parentDataProperty]}if(void 0!==a){d(a instanceof e.Name?a:u.let("data",a,!0)),void 0!==c&&(r.propertyName=c)}function d(e){r.data=e,r.dataLevel=n.dataLevel+1,r.dataTypes=[],n.definedProperties=new Set,r.parentData=n.data,r.dataNames=[...n.dataNames,e]}i&&(r.dataTypes=i)},Kc.extendSubschemaMode=function(e,{jtdDiscriminator:t,jtdMetadata:r,compositeRule:n,createErrors:o,allErrors:s}){void 0!==n&&(e.compositeRule=n),void 0!==o&&(e.createErrors=o),void 0!==s&&(e.allErrors=s),e.jtdDiscriminator=t,e.jtdMetadata=r},Kc}var Bc,Wc,Qc={};function Yc(){return Wc?Bc:(Wc=1,Bc=function e(t,r){if(t===r)return!0;if(t&&r&&"object"==typeof t&&"object"==typeof r){if(t.constructor!==r.constructor)return!1;var n,o,s;if(Array.isArray(t)){if((n=t.length)!=r.length)return!1;for(o=n;0!==o--;)if(!e(t[o],r[o]))return!1;return!0}if(t.constructor===RegExp)return t.source===r.source&&t.flags===r.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===r.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===r.toString();if((n=(s=Object.keys(t)).length)!==Object.keys(r).length)return!1;for(o=n;0!==o--;)if(!Object.prototype.hasOwnProperty.call(r,s[o]))return!1;for(o=n;0!==o--;){var a=s[o];if(!e(t[a],r[a]))return!1}return!0}return t!=t&&r!=r})}var Xc,eu,tu,ru={exports:{}};function nu(){if(Xc)return ru.exports;Xc=1;var e=ru.exports=function(e,r,n){"function"==typeof r&&(n=r,r={}),t(r,"function"==typeof(n=r.cb||n)?n:n.pre||function(){},n.post||function(){},e,"",e)};function t(n,o,s,a,i,c,u,d,l,p){if(a&&"object"==typeof a&&!Array.isArray(a)){for(var f in o(a,i,c,u,d,l,p),a){var h=a[f];if(Array.isArray(h)){if(f in e.arrayKeywords)for(var m=0;m<h.length;m++)t(n,o,s,h[m],i+"/"+f+"/"+m,c,i,f,a,m)}else if(f in e.propsKeywords){if(h&&"object"==typeof h)for(var y in h)t(n,o,s,h[y],i+"/"+f+"/"+r(y),c,i,f,a,y)}else(f in e.keywords||n.allKeys&&!(f in e.skipKeywords))&&t(n,o,s,h,i+"/"+f,c,i,f,a)}s(a,i,c,u,d,l,p)}}function r(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}return e.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0},e.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0},e.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0},e.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0},ru.exports}function ou(){if(eu)return Qc;eu=1,Object.defineProperty(Qc,"__esModule",{value:!0}),Qc.getSchemaRefs=Qc.resolveUrl=Qc.normalizeId=Qc._getFullPath=Qc.getFullPath=Qc.inlineRef=void 0;const e=wc(),t=Yc(),r=nu(),n=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);Qc.inlineRef=function(e,t=!0){return"boolean"==typeof e||(!0===t?!s(e):!!t&&a(e)<=t)};const o=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function s(e){for(const t in e){if(o.has(t))return!0;const r=e[t];if(Array.isArray(r)&&r.some(s))return!0;if("object"==typeof r&&s(r))return!0}return!1}function a(t){let r=0;for(const o in t){if("$ref"===o)return 1/0;if(r++,!n.has(o)&&("object"==typeof t[o]&&(0,e.eachItem)(t[o],e=>r+=a(e)),r===1/0))return 1/0}return r}function i(e,t="",r){!1!==r&&(t=d(t));const n=e.parse(t);return c(e,n)}function c(e,t){return e.serialize(t).split("#")[0]+"#"}Qc.getFullPath=i,Qc._getFullPath=c;const u=/#\/?$/;function d(e){return e?e.replace(u,""):""}Qc.normalizeId=d,Qc.resolveUrl=function(e,t,r){return r=d(r),e.resolve(t,r)};const l=/^[a-z_][-a-z0-9._]*$/i;return Qc.getSchemaRefs=function(e,n){if("boolean"==typeof e)return{};const{schemaId:o,uriResolver:s}=this.opts,a=d(e[o]||n),c={"":a},u=i(s,a,!1),p={},f=new Set;return r(e,{allKeys:!0},(e,t,r,n)=>{if(void 0===n)return;const s=u+t;let a=c[n];function i(t){const r=this.opts.uriResolver.resolve;if(t=d(a?r(a,t):t),f.has(t))throw m(t);f.add(t);let n=this.refs[t];return"string"==typeof n&&(n=this.refs[n]),"object"==typeof n?h(e,n.schema,t):t!==d(s)&&("#"===t[0]?(h(e,p[t],t),p[t]=e):this.refs[t]=s),t}function y(e){if("string"==typeof e){if(!l.test(e))throw new Error(`invalid anchor "${e}"`);i.call(this,`#${e}`)}}"string"==typeof e[o]&&(a=i.call(this,e[o])),y.call(this,e.$anchor),y.call(this,e.$dynamicAnchor),c[t]=a}),p;function h(e,r,n){if(void 0!==r&&!t(e,r))throw m(n)}function m(e){return new Error(`reference "${e}" resolves to more than one schema`)}},Qc}function su(){if(tu)return ic;tu=1,Object.defineProperty(ic,"__esModule",{value:!0}),ic.getData=ic.KeywordCxt=ic.validateFunctionCode=void 0;const e=zc(),t=Ac(),r=Rc(),n=Ac(),o=Dc(),s=Hc(),a=Gc(),i=gc(),c=Sc(),u=ou(),d=wc(),l=Pc();function p({gen:e,validateName:t,schema:r,schemaEnv:n,opts:o},s){o.code.es5?e.func(t,i._`${c.default.data}, ${c.default.valCxt}`,n.$async,()=>{e.code(i._`"use strict"; ${f(r,o)}`),function(e,t){e.if(c.default.valCxt,()=>{e.var(c.default.instancePath,i._`${c.default.valCxt}.${c.default.instancePath}`),e.var(c.default.parentData,i._`${c.default.valCxt}.${c.default.parentData}`),e.var(c.default.parentDataProperty,i._`${c.default.valCxt}.${c.default.parentDataProperty}`),e.var(c.default.rootData,i._`${c.default.valCxt}.${c.default.rootData}`),t.dynamicRef&&e.var(c.default.dynamicAnchors,i._`${c.default.valCxt}.${c.default.dynamicAnchors}`)},()=>{e.var(c.default.instancePath,i._`""`),e.var(c.default.parentData,i._`undefined`),e.var(c.default.parentDataProperty,i._`undefined`),e.var(c.default.rootData,c.default.data),t.dynamicRef&&e.var(c.default.dynamicAnchors,i._`{}`)})}(e,o),e.code(s)}):e.func(t,i._`${c.default.data}, ${function(e){return i._`{${c.default.instancePath}="", ${c.default.parentData}, ${c.default.parentDataProperty}, ${c.default.rootData}=${c.default.data}${e.dynamicRef?i._`, ${c.default.dynamicAnchors}={}`:i.nil}}={}`}(o)}`,n.$async,()=>e.code(f(r,o)).code(s))}function f(e,t){const r="object"==typeof e&&e[t.schemaId];return r&&(t.code.source||t.code.process)?i._`/*# sourceURL=${r} */`:i.nil}function h(t,r){y(t)&&(g(t),m(t))?function(e,t){const{schema:r,gen:n,opts:o}=e;o.$comment&&r.$comment&&_(e);(function(e){const t=e.schema[e.opts.schemaId];t&&(e.baseId=(0,u.resolveUrl)(e.opts.uriResolver,e.baseId,t))})(e),function(e){if(e.schema.$async&&!e.schemaEnv.$async)throw new Error("async schema in sync schema")}(e);const s=n.const("_errs",c.default.errors);v(e,s),n.var(t,i._`${s} === ${c.default.errors}`)}(t,r):(0,e.boolOrEmptySchema)(t,r)}function m({schema:e,self:t}){if("boolean"==typeof e)return!e;for(const r in e)if(t.RULES.all[r])return!0;return!1}function y(e){return"boolean"!=typeof e.schema}function g(e){(0,d.checkUnknownRules)(e),function(e){const{schema:t,errSchemaPath:r,opts:n,self:o}=e;t.$ref&&n.ignoreKeywordsWithRef&&(0,d.schemaHasRulesButRef)(t,o.RULES)&&o.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}(e)}function v(e,r){if(e.opts.jtd)return w(e,[],!1,r);const n=(0,t.getSchemaTypes)(e.schema);w(e,n,!(0,t.coerceAndCheckDataType)(e,n),r)}function _({gen:e,schemaEnv:t,schema:r,errSchemaPath:n,opts:o}){const s=r.$comment;if(!0===o.$comment)e.code(i._`${c.default.self}.logger.log(${s})`);else if("function"==typeof o.$comment){const r=i.str`${n}/$comment`,o=e.scopeValue("root",{ref:t.root});e.code(i._`${c.default.self}.opts.$comment(${s}, ${r}, ${o}.schema)`)}}function w(e,t,o,s){const{gen:a,schema:u,data:l,allErrors:p,opts:f,self:h}=e,{RULES:m}=h;function y(d){(0,r.shouldUseGroup)(u,d)&&(d.type?(a.if((0,n.checkDataType)(d.type,l,f.strictNumbers)),$(e,d),1===t.length&&t[0]===d.type&&o&&(a.else(),(0,n.reportTypeError)(e)),a.endIf()):$(e,d),p||a.if(i._`${c.default.errors} === ${s||0}`))}!u.$ref||!f.ignoreKeywordsWithRef&&(0,d.schemaHasRulesButRef)(u,m)?(f.jtd||function(e,t){if(e.schemaEnv.meta||!e.opts.strictTypes)return;(function(e,t){if(!t.length)return;if(!e.dataTypes.length)return void(e.dataTypes=t);t.forEach(t=>{k(e.dataTypes,t)||E(e,`type "${t}" not allowed by context "${e.dataTypes.join(",")}"`)}),function(e,t){const r=[];for(const n of e.dataTypes)k(t,n)?r.push(n):t.includes("integer")&&"number"===n&&r.push("integer");e.dataTypes=r}(e,t)})(e,t),e.opts.allowUnionTypes||function(e,t){t.length>1&&(2!==t.length||!t.includes("null"))&&E(e,"use allowUnionTypes to allow union type keyword")}(e,t);!function(e,t){const n=e.self.RULES.all;for(const o in n){const s=n[o];if("object"==typeof s&&(0,r.shouldUseRule)(e.schema,s)){const{type:r}=s.definition;r.length&&!r.some(e=>b(t,e))&&E(e,`missing type "${r.join(",")}" for keyword "${o}"`)}}}(e,e.dataTypes)}(e,t),a.block(()=>{for(const e of m.rules)y(e);y(m.post)})):a.block(()=>P(e,"$ref",m.all.$ref.definition))}function $(e,t){const{gen:n,schema:s,opts:{useDefaults:a}}=e;a&&(0,o.assignDefaults)(e,t.type),n.block(()=>{for(const n of t.rules)(0,r.shouldUseRule)(s,n)&&P(e,n.keyword,n.definition,t.type)})}function b(e,t){return e.includes(t)||"number"===t&&e.includes("integer")}function k(e,t){return e.includes(t)||"integer"===t&&e.includes("number")}function E(e,t){t+=` at "${e.schemaEnv.baseId+e.errSchemaPath}" (strictTypes)`,(0,d.checkStrictMode)(e,t,e.opts.strictTypes)}ic.validateFunctionCode=function(t){y(t)&&(g(t),m(t))?function(e){const{schema:t,opts:r,gen:n}=e;p(e,()=>{r.$comment&&t.$comment&&_(e),function(e){const{schema:t,opts:r}=e;void 0!==t.default&&r.useDefaults&&r.strictSchema&&(0,d.checkStrictMode)(e,"default is ignored in the schema root")}(e),n.let(c.default.vErrors,null),n.let(c.default.errors,0),r.unevaluated&&function(e){const{gen:t,validateName:r}=e;e.evaluated=t.const("evaluated",i._`${r}.evaluated`),t.if(i._`${e.evaluated}.dynamicProps`,()=>t.assign(i._`${e.evaluated}.props`,i._`undefined`)),t.if(i._`${e.evaluated}.dynamicItems`,()=>t.assign(i._`${e.evaluated}.items`,i._`undefined`))}(e),v(e),function(e){const{gen:t,schemaEnv:r,validateName:n,ValidationError:o,opts:s}=e;r.$async?t.if(i._`${c.default.errors} === 0`,()=>t.return(c.default.data),()=>t.throw(i._`new ${o}(${c.default.vErrors})`)):(t.assign(i._`${n}.errors`,c.default.vErrors),s.unevaluated&&function({gen:e,evaluated:t,props:r,items:n}){r instanceof i.Name&&e.assign(i._`${t}.props`,r);n instanceof i.Name&&e.assign(i._`${t}.items`,n)}(e),t.return(i._`${c.default.errors} === 0`))}(e)})}(t):p(t,()=>(0,e.topBoolOrEmptySchema)(t))};class S{constructor(e,t,r){if((0,s.validateKeywordUsage)(e,t,r),this.gen=e.gen,this.allErrors=e.allErrors,this.keyword=r,this.data=e.data,this.schema=e.schema[r],this.$data=t.$data&&e.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,d.schemaRefOrVal)(e,this.schema,r,this.$data),this.schemaType=t.schemaType,this.parentSchema=e.schema,this.params={},this.it=e,this.def=t,this.$data)this.schemaCode=e.gen.const("vSchema",x(this.$data,e));else if(this.schemaCode=this.schemaValue,!(0,s.validSchemaType)(this.schema,t.schemaType,t.allowUndefined))throw new Error(`${r} value must be ${JSON.stringify(t.schemaType)}`);("code"in t?t.trackErrors:!1!==t.errors)&&(this.errsCount=e.gen.const("_errs",c.default.errors))}result(e,t,r){this.failResult((0,i.not)(e),t,r)}failResult(e,t,r){this.gen.if(e),r?r():this.error(),t?(this.gen.else(),t(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(e,t){this.failResult((0,i.not)(e),void 0,t)}fail(e){if(void 0===e)return this.error(),void(this.allErrors||this.gen.if(!1));this.gen.if(e),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(e){if(!this.$data)return this.fail(e);const{schemaCode:t}=this;this.fail(i._`${t} !== undefined && (${(0,i.or)(this.invalid$data(),e)})`)}error(e,t,r){if(t)return this.setParams(t),this._error(e,r),void this.setParams({});this._error(e,r)}_error(e,t){(e?l.reportExtraError:l.reportError)(this,this.def.error,t)}$dataError(){(0,l.reportError)(this,this.def.$dataError||l.keyword$DataError)}reset(){if(void 0===this.errsCount)throw new Error('add "trackErrors" to keyword definition');(0,l.resetErrorsCount)(this.gen,this.errsCount)}ok(e){this.allErrors||this.gen.if(e)}setParams(e,t){t?Object.assign(this.params,e):this.params=e}block$data(e,t,r=i.nil){this.gen.block(()=>{this.check$data(e,r),t()})}check$data(e=i.nil,t=i.nil){if(!this.$data)return;const{gen:r,schemaCode:n,schemaType:o,def:s}=this;r.if((0,i.or)(i._`${n} === undefined`,t)),e!==i.nil&&r.assign(e,!0),(o.length||s.validateSchema)&&(r.elseIf(this.invalid$data()),this.$dataError(),e!==i.nil&&r.assign(e,!1)),r.else()}invalid$data(){const{gen:e,schemaCode:t,schemaType:r,def:o,it:s}=this;return(0,i.or)(function(){if(r.length){if(!(t instanceof i.Name))throw new Error("ajv implementation error");const e=Array.isArray(r)?r:[r];return i._`${(0,n.checkDataTypes)(e,t,s.opts.strictNumbers,n.DataType.Wrong)}`}return i.nil}(),function(){if(o.validateSchema){const r=e.scopeValue("validate$data",{ref:o.validateSchema});return i._`!${r}(${t})`}return i.nil}())}subschema(e,t){const r=(0,a.getSubschema)(this.it,e);(0,a.extendSubschemaData)(r,this.it,e),(0,a.extendSubschemaMode)(r,e);const n={...this.it,...r,items:void 0,props:void 0};return h(n,t),n}mergeEvaluated(e,t){const{it:r,gen:n}=this;r.opts.unevaluated&&(!0!==r.props&&void 0!==e.props&&(r.props=d.mergeEvaluated.props(n,e.props,r.props,t)),!0!==r.items&&void 0!==e.items&&(r.items=d.mergeEvaluated.items(n,e.items,r.items,t)))}mergeValidEvaluated(e,t){const{it:r,gen:n}=this;if(r.opts.unevaluated&&(!0!==r.props||!0!==r.items))return n.if(t,()=>this.mergeEvaluated(e,i.Name)),!0}}function P(e,t,r,n){const o=new S(e,r,t);"code"in r?r.code(o,n):o.$data&&r.validate?(0,s.funcKeywordCode)(o,r):"macro"in r?(0,s.macroKeywordCode)(o,r):(r.compile||r.validate)&&(0,s.funcKeywordCode)(o,r)}ic.KeywordCxt=S;const z=/^\/(?:[^~]|~0|~1)*$/,T=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function x(e,{dataLevel:t,dataNames:r,dataPathArr:n}){let o,s;if(""===e)return c.default.rootData;if("/"===e[0]){if(!z.test(e))throw new Error(`Invalid JSON-pointer: ${e}`);o=e,s=c.default.rootData}else{const a=T.exec(e);if(!a)throw new Error(`Invalid JSON-pointer: ${e}`);const i=+a[1];if(o=a[2],"#"===o){if(i>=t)throw new Error(l("property/index",i));return n[t-i]}if(i>t)throw new Error(l("data",i));if(s=r[t-i],!o)return s}let a=s;const u=o.split("/");for(const c of u)c&&(s=i._`${s}${(0,i.getProperty)((0,d.unescapeJsonPointer)(c))}`,a=i._`${a} && ${s}`);return a;function l(e,r){return`Cannot access ${e} ${r} levels up, current level is ${t}`}}return ic.getData=x,ic}var au,iu={};function cu(){if(au)return iu;au=1,Object.defineProperty(iu,"__esModule",{value:!0});class e extends Error{constructor(e){super("validation failed"),this.errors=e,this.ajv=this.validation=!0}}return iu.default=e,iu}var uu,du={};function lu(){if(uu)return du;uu=1,Object.defineProperty(du,"__esModule",{value:!0});const e=ou();class t extends Error{constructor(t,r,n,o){super(o||`can't resolve reference ${n} from id ${r}`),this.missingRef=(0,e.resolveUrl)(t,r,n),this.missingSchema=(0,e.normalizeId)((0,e.getFullPath)(t,this.missingRef))}}return du.default=t,du}var pu,fu={};function hu(){if(pu)return fu;pu=1,Object.defineProperty(fu,"__esModule",{value:!0}),fu.resolveSchema=fu.getCompilingSchema=fu.resolveRef=fu.compileSchema=fu.SchemaEnv=void 0;const e=gc(),t=cu(),r=Sc(),n=ou(),o=wc(),s=su();class a{constructor(e){var t;let r;this.refs={},this.dynamicAnchors={},"object"==typeof e.schema&&(r=e.schema),this.schema=e.schema,this.schemaId=e.schemaId,this.root=e.root||this,this.baseId=null!==(t=e.baseId)&&void 0!==t?t:(0,n.normalizeId)(null==r?void 0:r[e.schemaId||"$id"]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=null==r?void 0:r.$async,this.refs={}}}function i(o){const a=u.call(this,o);if(a)return a;const i=(0,n.getFullPath)(this.opts.uriResolver,o.root.baseId),{es5:c,lines:d}=this.opts.code,{ownProperties:l}=this.opts,p=new e.CodeGen(this.scope,{es5:c,lines:d,ownProperties:l});let f;o.$async&&(f=p.scopeValue("Error",{ref:t.default,code:e._`require("ajv/dist/runtime/validation_error").default`}));const h=p.scopeName("validate");o.validateName=h;const m={gen:p,allErrors:this.opts.allErrors,data:r.default.data,parentData:r.default.parentData,parentDataProperty:r.default.parentDataProperty,dataNames:[r.default.data],dataPathArr:[e.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:p.scopeValue("schema",!0===this.opts.code.source?{ref:o.schema,code:(0,e.stringify)(o.schema)}:{ref:o.schema}),validateName:h,ValidationError:f,schema:o.schema,schemaEnv:o,rootId:i,baseId:o.baseId||i,schemaPath:e.nil,errSchemaPath:o.schemaPath||(this.opts.jtd?"":"#"),errorPath:e._`""`,opts:this.opts,self:this};let y;try{this._compilations.add(o),(0,s.validateFunctionCode)(m),p.optimize(this.opts.code.optimize);const t=p.toString();y=`${p.scopeRefs(r.default.scope)}return ${t}`,this.opts.code.process&&(y=this.opts.code.process(y,o));const n=new Function(`${r.default.self}`,`${r.default.scope}`,y)(this,this.scope.get());if(this.scope.value(h,{ref:n}),n.errors=null,n.schema=o.schema,n.schemaEnv=o,o.$async&&(n.$async=!0),!0===this.opts.code.source&&(n.source={validateName:h,validateCode:t,scopeValues:p._values}),this.opts.unevaluated){const{props:t,items:r}=m;n.evaluated={props:t instanceof e.Name?void 0:t,items:r instanceof e.Name?void 0:r,dynamicProps:t instanceof e.Name,dynamicItems:r instanceof e.Name},n.source&&(n.source.evaluated=(0,e.stringify)(n.evaluated))}return o.validate=n,o}catch(g){throw delete o.validate,delete o.validateName,y&&this.logger.error("Error compiling schema, function code:",y),g}finally{this._compilations.delete(o)}}function c(e){return(0,n.inlineRef)(e.schema,this.opts.inlineRefs)?e.schema:e.validate?e:i.call(this,e)}function u(e){for(const t of this._compilations)if(d(t,e))return t}function d(e,t){return e.schema===t.schema&&e.root===t.root&&e.baseId===t.baseId}function l(e,t){let r;for(;"string"==typeof(r=this.refs[t]);)t=r;return r||this.schemas[t]||p.call(this,e,t)}function p(e,t){const r=this.opts.uriResolver.parse(t),o=(0,n._getFullPath)(this.opts.uriResolver,r);let s=(0,n.getFullPath)(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&o===s)return h.call(this,r,e);const c=(0,n.normalizeId)(o),u=this.refs[c]||this.schemas[c];if("string"==typeof u){const t=p.call(this,e,u);if("object"!=typeof(null==t?void 0:t.schema))return;return h.call(this,r,t)}if("object"==typeof(null==u?void 0:u.schema)){if(u.validate||i.call(this,u),c===(0,n.normalizeId)(t)){const{schema:t}=u,{schemaId:r}=this.opts,o=t[r];return o&&(s=(0,n.resolveUrl)(this.opts.uriResolver,s,o)),new a({schema:t,schemaId:r,root:e,baseId:s})}return h.call(this,r,u)}}fu.SchemaEnv=a,fu.compileSchema=i,fu.resolveRef=function(e,t,r){var o;r=(0,n.resolveUrl)(this.opts.uriResolver,t,r);const s=e.refs[r];if(s)return s;let i=l.call(this,e,r);if(void 0===i){const n=null===(o=e.localRefs)||void 0===o?void 0:o[r],{schemaId:s}=this.opts;n&&(i=new a({schema:n,schemaId:s,root:e,baseId:t}))}return void 0!==i?e.refs[r]=c.call(this,i):void 0},fu.getCompilingSchema=u,fu.resolveSchema=p;const f=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function h(e,{baseId:t,schema:r,root:s}){var i;if("/"!==(null===(i=e.fragment)||void 0===i?void 0:i[0]))return;for(const a of e.fragment.slice(1).split("/")){if("boolean"==typeof r)return;const e=r[(0,o.unescapeFragment)(a)];if(void 0===e)return;const s="object"==typeof(r=e)&&r[this.opts.schemaId];!f.has(a)&&s&&(t=(0,n.resolveUrl)(this.opts.uriResolver,t,s))}let c;if("boolean"!=typeof r&&r.$ref&&!(0,o.schemaHasRulesButRef)(r,this.RULES)){const e=(0,n.resolveUrl)(this.opts.uriResolver,t,r.$ref);c=p.call(this,s,e)}const{schemaId:u}=this.opts;return c=c||new a({schema:r,schemaId:u,root:s,baseId:t}),c.schema!==c.root.schema?c:void 0}return fu}const mu={$id:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",description:"Meta-schema for $data reference (JSON AnySchema extension proposal)",type:"object",required:["$data"],properties:{$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},additionalProperties:!1};var yu,gu,vu,_u,wu,$u,bu,ku={},Eu={exports:{}};function Su(){if(gu)return yu;gu=1;const e=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),t=RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u),r=RegExp.prototype.test.bind(/^[\da-f]{2}$/iu),n=RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu),o=RegExp.prototype.test.bind(/^[\da-z\-._~!$&'()*+,;=:@/]$/iu);function s(e){let t="",r=0,n=0;for(n=0;n<e.length;n++)if(r=e[n].charCodeAt(0),48!==r){if(!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[n];break}for(n+=1;n<e.length;n++){if(r=e[n].charCodeAt(0),!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[n]}return t}const a=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function i(e){return e.length=0,!0}function c(e,t,r){if(e.length){const n=s(e);if(""===n)return r.error=!0,!1;t.push(n),e.length=0}return!0}function u(e){if(function(e,t){let r=0;for(let n=0;n<e.length;n++)e[n]===t&&r++;return r}(e,":")<2)return{host:e,isIPV6:!1};const t=function(e){let t=0;const r={error:!1,address:"",zone:""},n=[],o=[];let a=!1,u=!1,d=c;for(let s=0;s<e.length;s++){const c=e[s];if("["!==c&&"]"!==c)if(":"!==c)if("%"===c){if(!d(o,n,r))break;d=i}else o.push(c);else{if(!0===a&&(u=!0),!d(o,n,r))break;if(++t>7){r.error=!0;break}s>0&&":"===e[s-1]&&(a=!0),n.push(":")}}return o.length&&(d===i?r.zone=o.join(""):u?n.push(o.join("")):n.push(s(o))),r.address=n.join(""),r}(e);if(t.error)return{host:e,isIPV6:!1};{let e=t.address,r=t.address;return t.zone&&(e+="%"+t.zone,r+="%25"+t.zone),{host:e,isIPV6:!0,escapedHost:r}}}const d={"@":"%40","/":"%2F","?":"%3F","#":"%23",":":"%3A"},l=/[@/?#:]/g,p=/[@/?#]/g;function f(e,t){const r=t?p:l;return r.lastIndex=0,e.replace(r,e=>d[e])}return yu={nonSimpleDomain:a,recomposeAuthority:function(e){const r=[];if(void 0!==e.userinfo&&(r.push(e.userinfo),r.push("@")),void 0!==e.host){let n=unescape(e.host);if(!t(n)){const e=u(n);n=!0===e.isIPV6?`[${e.escapedHost}]`:f(n,!1)}r.push(n)}return"number"!=typeof e.port&&"string"!=typeof e.port||(r.push(":"),r.push(String(e.port))),r.length?r.join(""):void 0},reescapeHostDelimiters:f,normalizePercentEncoding:function(e,t=!1){if(-1===e.indexOf("%"))return e;let o="";for(let s=0;s<e.length;s++){if("%"===e[s]&&s+2<e.length){const a=e.slice(s+1,s+3);if(r(a)){const e=a.toUpperCase(),r=String.fromCharCode(parseInt(e,16));t&&n(r)?o+=r:o+="%"+e,s+=2;continue}}o+=e[s]}return o},normalizePathEncoding:function(e){let t="";for(let s=0;s<e.length;s++){if("%"===e[s]&&s+2<e.length){const o=e.slice(s+1,s+3);if(r(o)){const e=o.toUpperCase(),r=String.fromCharCode(parseInt(e,16));"."!==r&&n(r)?t+=r:t+="%"+e,s+=2;continue}}o(e[s])?t+=e[s]:t+=escape(e[s])}return t},escapePreservingEscapes:function(e){let t="";for(let n=0;n<e.length;n++){if("%"===e[n]&&n+2<e.length){const o=e.slice(n+1,n+3);if(r(o)){t+="%"+o.toUpperCase(),n+=2;continue}}t+=escape(e[n])}return t},removeDotSegments:function(e){let t=e;const r=[];let n=-1,o=0;for(;o=t.length;){if(1===o){if("."===t)break;if("/"===t){r.push("/");break}r.push(t);break}if(2===o){if("."===t[0]){if("."===t[1])break;if("/"===t[1]){t=t.slice(2);continue}}else if("/"===t[0]&&("."===t[1]||"/"===t[1])){r.push("/");break}}else if(3===o&&"/.."===t){0!==r.length&&r.pop(),r.push("/");break}if("."===t[0]){if("."===t[1]){if("/"===t[2]){t=t.slice(3);continue}}else if("/"===t[1]){t=t.slice(2);continue}}else if("/"===t[0]&&"."===t[1]){if("/"===t[2]){t=t.slice(2);continue}if("."===t[2]&&"/"===t[3]){t=t.slice(3),0!==r.length&&r.pop();continue}}if(-1===(n=t.indexOf("/",1))){r.push(t);break}r.push(t.slice(0,n)),t=t.slice(n)}return r.join("")},isIPv4:t,isUUID:e,normalizeIPv6:u,stringArrayToHexStripped:s}}function Pu(){if(wu)return Eu.exports;wu=1;const{normalizeIPv6:e,removeDotSegments:t,recomposeAuthority:r,normalizePercentEncoding:n,normalizePathEncoding:o,escapePreservingEscapes:s,reescapeHostDelimiters:a,isIPv4:i,nonSimpleDomain:c}=Su(),{SCHEMES:u,getSchemeHandler:d}=function(){if(_u)return vu;_u=1;const{isUUID:e}=Su(),t=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,r=["http","https","ws","wss","urn","urn:uuid"];function n(e){return!0===e.secure||!1!==e.secure&&!!e.scheme&&!(3!==e.scheme.length||"w"!==e.scheme[0]&&"W"!==e.scheme[0]||"s"!==e.scheme[1]&&"S"!==e.scheme[1]||"s"!==e.scheme[2]&&"S"!==e.scheme[2])}function o(e){return e.host||(e.error=e.error||"HTTP URIs must have a host."),e}function s(e){const t="https"===String(e.scheme).toLowerCase();return e.port!==(t?443:80)&&""!==e.port||(e.port=void 0),e.path||(e.path="/"),e}const a={scheme:"http",domainHost:!0,parse:o,serialize:s},i={scheme:"ws",domainHost:!0,parse:function(e){return e.secure=n(e),e.resourceName=(e.path||"/")+(e.query?"?"+e.query:""),e.path=void 0,e.query=void 0,e},serialize:function(e){if(e.port!==(n(e)?443:80)&&""!==e.port||(e.port=void 0),"boolean"==typeof e.secure&&(e.scheme=e.secure?"wss":"ws",e.secure=void 0),e.resourceName){const[t,r]=e.resourceName.split("?");e.path=t&&"/"!==t?t:void 0,e.query=r,e.resourceName=void 0}return e.fragment=void 0,e}},c={http:a,https:{scheme:"https",domainHost:a.domainHost,parse:o,serialize:s},ws:i,wss:{scheme:"wss",domainHost:i.domainHost,parse:i.parse,serialize:i.serialize},urn:{scheme:"urn",parse:function(e,r){if(!e.path)return e.error="URN can not be parsed",e;const n=e.path.match(t);if(n){const t=r.scheme||e.scheme||"urn";e.nid=n[1].toLowerCase(),e.nss=n[2];const o=u(`${t}:${r.nid||e.nid}`);e.path=void 0,o&&(e=o.parse(e,r))}else e.error=e.error||"URN can not be parsed.";return e},serialize:function(e,t){if(void 0===e.nid)throw new Error("URN without nid cannot be serialized");const r=t.scheme||e.scheme||"urn",n=e.nid.toLowerCase(),o=u(`${r}:${t.nid||n}`);o&&(e=o.serialize(e,t));const s=e,a=e.nss;return s.path=`${n||t.nid}:${a}`,t.skipEscape=!0,s},skipNormalize:!0},"urn:uuid":{scheme:"urn:uuid",parse:function(t,r){const n=t;return n.uuid=n.nss,n.nss=void 0,r.tolerant||n.uuid&&e(n.uuid)||(n.error=n.error||"UUID is not valid."),n},serialize:function(e){const t=e;return t.nss=(e.uuid||"").toLowerCase(),t},skipNormalize:!0}};function u(e){return e&&(c[e]||c[e.toLowerCase()])||void 0}return Object.setPrototypeOf(c,null),vu={wsIsSecure:n,SCHEMES:c,isValidSchemeName:function(e){return-1!==r.indexOf(e)},getSchemeHandler:u}}();function l(e,r,n,o){const s={};return o||(e=m(p(e,n),n),r=m(p(r,n),n)),!(n=n||{}).tolerant&&r.scheme?(s.scheme=r.scheme,s.userinfo=r.userinfo,s.host=r.host,s.port=r.port,s.path=t(r.path||""),s.query=r.query):(void 0!==r.userinfo||void 0!==r.host||void 0!==r.port?(s.userinfo=r.userinfo,s.host=r.host,s.port=r.port,s.path=t(r.path||""),s.query=r.query):(r.path?("/"===r.path[0]?s.path=t(r.path):(void 0===e.userinfo&&void 0===e.host&&void 0===e.port||e.path?e.path?s.path=e.path.slice(0,e.path.lastIndexOf("/")+1)+r.path:s.path=r.path:s.path="/"+r.path,s.path=t(s.path)),s.query=r.query):(s.path=e.path,void 0!==r.query?s.query=r.query:s.query=e.query),s.userinfo=e.userinfo,s.host=e.host,s.port=e.port),s.scheme=e.scheme),s.fragment=r.fragment,s}function p(e,o){const a={host:e.host,scheme:e.scheme,userinfo:e.userinfo,port:e.port,path:e.path,query:e.query,nid:e.nid,nss:e.nss,uuid:e.uuid,fragment:e.fragment,reference:e.reference,resourceName:e.resourceName,secure:e.secure,error:""},i=Object.assign({},o),c=[],u=d(i.scheme||a.scheme);u&&u.serialize&&u.serialize(a,i),void 0!==a.path&&(i.skipEscape?a.path=n(a.path):(a.path=s(a.path),void 0!==a.scheme&&(a.path=a.path.split("%3A").join(":")))),"suffix"!==i.reference&&a.scheme&&c.push(a.scheme,":");const l=r(a);if(void 0!==l&&("suffix"!==i.reference&&c.push("//"),c.push(l),a.path&&"/"!==a.path[0]&&c.push("/")),void 0!==a.path){let e=a.path;i.absolutePath||u&&u.absolutePath||(e=t(e)),void 0===l&&"/"===e[0]&&"/"===e[1]&&(e="/%2F"+e.slice(2)),c.push(e)}return void 0!==a.query&&c.push("?",a.query),void 0!==a.fragment&&c.push("#",a.fragment),c.join("")}const f=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function h(t,r){const n=Object.assign({},r),s={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0};let u=!1,l=!1;"suffix"===n.reference&&(t=n.scheme?n.scheme+":"+t:"//"+t);const p=t.match(f);if(p){s.scheme=p[1],s.userinfo=p[3],s.host=p[4],s.port=parseInt(p[5],10),s.path=p[6]||"",s.query=p[7],s.fragment=p[8],isNaN(s.port)&&(s.port=p[5]);const r=function(e,t){return void 0!==t[2]&&e.path&&"/"!==e.path[0]?'URI path must start with "/" when authority is present.':"number"==typeof e.port&&(e.port<0||e.port>65535)?"URI port is malformed.":void 0}(s,p);if(void 0!==r&&(s.error=s.error||r,u=!0),s.host){if(!1===i(s.host)){const t=e(s.host);s.host=t.host.toLowerCase(),l=t.isIPV6}else l=!0}void 0!==s.scheme||void 0!==s.userinfo||void 0!==s.host||void 0!==s.port||void 0!==s.query||s.path?void 0===s.scheme?s.reference="relative":void 0===s.fragment?s.reference="absolute":s.reference="uri":s.reference="same-document",n.reference&&"suffix"!==n.reference&&n.reference!==s.reference&&(s.error=s.error||"URI is not a "+n.reference+" reference.");const f=d(n.scheme||s.scheme);if(!(n.unicodeSupport||f&&f.unicodeSupport)&&s.host&&(n.domainHost||f&&f.domainHost)&&!1===l&&c(s.host))try{s.host=URL.domainToASCII(s.host.toLowerCase())}catch(h){s.error=s.error||"Host's domain name can not be converted to ASCII: "+h}if((!f||f&&!f.skipNormalize)&&(-1!==t.indexOf("%")&&(void 0!==s.scheme&&(s.scheme=unescape(s.scheme)),void 0!==s.host&&(s.host=a(unescape(s.host),l))),s.path&&(s.path=o(s.path)),s.fragment))try{s.fragment=encodeURI(decodeURIComponent(s.fragment))}catch{s.error=s.error||"URI malformed"}f&&f.parse&&f.parse(s,n)}else s.error=s.error||"URI can not be parsed.";return{parsed:s,malformedAuthorityOrPort:u}}function m(e,t){return h(e,t).parsed}function y(e,t){const{parsed:r,malformedAuthorityOrPort:n}=h(e,t);return{normalized:n?e:p(r,t),malformedAuthorityOrPort:n}}function g(e,t){if("string"==typeof e){const{normalized:r,malformedAuthorityOrPort:n}=y(e,t);return n?void 0:r}if("object"==typeof e)return p(e,t)}const v={SCHEMES:u,normalize:function(e,t){return"string"==typeof e?e=function(e,t){return y(e,t).normalized}(e,t):"object"==typeof e&&(e=m(p(e,t),t)),e},resolve:function(e,t,r){const n=r?Object.assign({scheme:"null"},r):{scheme:"null"},o=l(m(e,n),m(t,n),n,!0);return n.skipEscape=!0,p(o,n)},resolveComponent:l,equal:function(e,t,r){const n=g(e,r),o=g(t,r);return void 0!==n&&void 0!==o&&n.toLowerCase()===o.toLowerCase()},serialize:p,parse:m};return Eu.exports=v,Eu.exports.default=v,Eu.exports.fastUri=v,Eu.exports}function zu(){if($u)return ku;$u=1,Object.defineProperty(ku,"__esModule",{value:!0});const e=Pu();return e.code='require("ajv/dist/runtime/uri").default',ku.default=e,ku}function Tu(){return bu||(bu=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=void 0;var t=su();Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return t.KeywordCxt}});var r=gc();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return r._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return r.str}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return r.stringify}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return r.nil}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return r.Name}}),Object.defineProperty(e,"CodeGen",{enumerable:!0,get:function(){return r.CodeGen}});const n=cu(),o=lu(),s=Nc(),a=hu(),i=gc(),c=ou(),u=Ac(),d=wc(),l=mu,p=zu(),f=(e,t)=>new RegExp(e,t);f.code="new RegExp";const h=["removeAdditional","useDefaults","coerceTypes"],m=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),y={errorDataPath:"",format:"`validateFormats: false` can be used instead.",nullable:'"nullable" keyword is supported by default.',jsonPointers:"Deprecated jsPropertySyntax can be used instead.",extendRefs:"Deprecated ignoreKeywordsWithRef can be used instead.",missingRefs:"Pass empty schema with $id that should be ignored to ajv.addSchema.",processCode:"Use option `code: {process: (code, schemaEnv: object) => string}`",sourceCode:"Use option `code: {source: true}`",strictDefaults:"It is default now, see option `strict`.",strictKeywords:"It is default now, see option `strict`.",uniqueItems:'"uniqueItems" keyword is always validated.',unknownFormats:"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",cache:"Map is used as cache, schema object as key.",serialize:"Map is used as cache, schema object as key.",ajvErrors:"It is default now."},g={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'};function v(e){var t,r,n,o,s,a,i,c,u,d,l,h,m,y,g,v,_,w,$,b,k,E,S,P,z;const T=e.strict,x=null===(t=e.code)||void 0===t?void 0:t.optimize,I=!0===x||void 0===x?1:x||0,N=null!==(n=null===(r=e.code)||void 0===r?void 0:r.regExp)&&void 0!==n?n:f,j=null!==(o=e.uriResolver)&&void 0!==o?o:p.default;return{strictSchema:null===(a=null!==(s=e.strictSchema)&&void 0!==s?s:T)||void 0===a||a,strictNumbers:null===(c=null!==(i=e.strictNumbers)&&void 0!==i?i:T)||void 0===c||c,strictTypes:null!==(d=null!==(u=e.strictTypes)&&void 0!==u?u:T)&&void 0!==d?d:"log",strictTuples:null!==(h=null!==(l=e.strictTuples)&&void 0!==l?l:T)&&void 0!==h?h:"log",strictRequired:null!==(y=null!==(m=e.strictRequired)&&void 0!==m?m:T)&&void 0!==y&&y,code:e.code?{...e.code,optimize:I,regExp:N}:{optimize:I,regExp:N},loopRequired:null!==(g=e.loopRequired)&&void 0!==g?g:200,loopEnum:null!==(v=e.loopEnum)&&void 0!==v?v:200,meta:null===(_=e.meta)||void 0===_||_,messages:null===(w=e.messages)||void 0===w||w,inlineRefs:null===($=e.inlineRefs)||void 0===$||$,schemaId:null!==(b=e.schemaId)&&void 0!==b?b:"$id",addUsedSchema:null===(k=e.addUsedSchema)||void 0===k||k,validateSchema:null===(E=e.validateSchema)||void 0===E||E,validateFormats:null===(S=e.validateFormats)||void 0===S||S,unicodeRegExp:null===(P=e.unicodeRegExp)||void 0===P||P,int32range:null===(z=e.int32range)||void 0===z||z,uriResolver:j}}class _{constructor(e={}){this.schemas={},this.refs={},this.formats=Object.create(null),this._compilations=new Set,this._loading={},this._cache=new Map,e=this.opts={...e,...v(e)};const{es5:t,lines:r}=this.opts.code;this.scope=new i.ValueScope({scope:{},prefixes:m,es5:t,lines:r}),this.logger=function(e){if(!1===e)return P;if(void 0===e)return console;if(e.log&&e.warn&&e.error)return e;throw new Error("logger must implement log, warn and error methods")}(e.logger);const n=e.validateFormats;e.validateFormats=!1,this.RULES=(0,s.getRules)(),w.call(this,y,e,"NOT SUPPORTED"),w.call(this,g,e,"DEPRECATED","warn"),this._metaOpts=S.call(this),e.formats&&k.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords&&E.call(this,e.keywords),"object"==typeof e.meta&&this.addMetaSchema(e.meta),b.call(this),e.validateFormats=n}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){const{$data:e,meta:t,schemaId:r}=this.opts;let n=l;"id"===r&&(n={...l},n.id=n.$id,delete n.$id),t&&e&&this.addMetaSchema(n,n[r],!1)}defaultMeta(){const{meta:e,schemaId:t}=this.opts;return this.opts.defaultMeta="object"==typeof e?e[t]||e:void 0}validate(e,t){let r;if("string"==typeof e){if(r=this.getSchema(e),!r)throw new Error(`no schema with key or ref "${e}"`)}else r=this.compile(e);const n=r(t);return"$async"in r||(this.errors=r.errors),n}compile(e,t){const r=this._addSchema(e,t);return r.validate||this._compileSchemaEnv(r)}compileAsync(e,t){if("function"!=typeof this.opts.loadSchema)throw new Error("options.loadSchema should be a function");const{loadSchema:r}=this.opts;return n.call(this,e,t);async function n(e,t){await s.call(this,e.$schema);const r=this._addSchema(e,t);return r.validate||a.call(this,r)}async function s(e){e&&!this.getSchema(e)&&await n.call(this,{$ref:e},!0)}async function a(e){try{return this._compileSchemaEnv(e)}catch(t){if(!(t instanceof o.default))throw t;return i.call(this,t),await c.call(this,t.missingSchema),a.call(this,e)}}function i({missingSchema:e,missingRef:t}){if(this.refs[e])throw new Error(`AnySchema ${e} is loaded but ${t} cannot be resolved`)}async function c(e){const r=await u.call(this,e);this.refs[e]||await s.call(this,r.$schema),this.refs[e]||this.addSchema(r,e,t)}async function u(e){const t=this._loading[e];if(t)return t;try{return await(this._loading[e]=r(e))}finally{delete this._loading[e]}}}addSchema(e,t,r,n=this.opts.validateSchema){if(Array.isArray(e)){for(const t of e)this.addSchema(t,void 0,r,n);return this}let o;if("object"==typeof e){const{schemaId:t}=this.opts;if(o=e[t],void 0!==o&&"string"!=typeof o)throw new Error(`schema ${t} must be string`)}return t=(0,c.normalizeId)(t||o),this._checkUnique(t),this.schemas[t]=this._addSchema(e,r,t,n,!0),this}addMetaSchema(e,t,r=this.opts.validateSchema){return this.addSchema(e,t,!0,r),this}validateSchema(e,t){if("boolean"==typeof e)return!0;let r;if(r=e.$schema,void 0!==r&&"string"!=typeof r)throw new Error("$schema must be a string");if(r=r||this.opts.defaultMeta||this.defaultMeta(),!r)return this.logger.warn("meta-schema not available"),this.errors=null,!0;const n=this.validate(r,e);if(!n&&t){const e="schema is invalid: "+this.errorsText();if("log"!==this.opts.validateSchema)throw new Error(e);this.logger.error(e)}return n}getSchema(e){let t;for(;"string"==typeof(t=$.call(this,e));)e=t;if(void 0===t){const{schemaId:r}=this.opts,n=new a.SchemaEnv({schema:{},schemaId:r});if(t=a.resolveSchema.call(this,n,e),!t)return;this.refs[e]=t}return t.validate||this._compileSchemaEnv(t)}removeSchema(e){if(e instanceof RegExp)return this._removeAllSchemas(this.schemas,e),this._removeAllSchemas(this.refs,e),this;switch(typeof e){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{const t=$.call(this,e);return"object"==typeof t&&this._cache.delete(t.schema),delete this.schemas[e],delete this.refs[e],this}case"object":{const t=e;this._cache.delete(t);let r=e[this.opts.schemaId];return r&&(r=(0,c.normalizeId)(r),delete this.schemas[r],delete this.refs[r]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(e){for(const t of e)this.addKeyword(t);return this}addKeyword(e,t){let r;if("string"==typeof e)r=e,"object"==typeof t&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),t.keyword=r);else{if("object"!=typeof e||void 0!==t)throw new Error("invalid addKeywords parameters");if(r=(t=e).keyword,Array.isArray(r)&&!r.length)throw new Error("addKeywords: keyword must be string or non-empty array")}if(T.call(this,r,t),!t)return(0,d.eachItem)(r,e=>x.call(this,e)),this;N.call(this,t);const n={...t,type:(0,u.getJSONTypes)(t.type),schemaType:(0,u.getJSONTypes)(t.schemaType)};return(0,d.eachItem)(r,0===n.type.length?e=>x.call(this,e,n):e=>n.type.forEach(t=>x.call(this,e,n,t))),this}getKeyword(e){const t=this.RULES.all[e];return"object"==typeof t?t.definition:!!t}removeKeyword(e){const{RULES:t}=this;delete t.keywords[e],delete t.all[e];for(const r of t.rules){const t=r.rules.findIndex(t=>t.keyword===e);t>=0&&r.rules.splice(t,1)}return this}addFormat(e,t){return"string"==typeof t&&(t=new RegExp(t)),this.formats[e]=t,this}errorsText(e=this.errors,{separator:t=", ",dataVar:r="data"}={}){return e&&0!==e.length?e.map(e=>`${r}${e.instancePath} ${e.message}`).reduce((e,r)=>e+t+r):"No errors"}$dataMetaSchema(e,t){const r=this.RULES.all;e=JSON.parse(JSON.stringify(e));for(const n of t){const t=n.split("/").slice(1);let o=e;for(const e of t)o=o[e];for(const e in r){const t=r[e];if("object"!=typeof t)continue;const{$data:n}=t.definition,s=o[e];n&&s&&(o[e]=O(s))}}return e}_removeAllSchemas(e,t){for(const r in e){const n=e[r];t&&!t.test(r)||("string"==typeof n?delete e[r]:n&&!n.meta&&(this._cache.delete(n.schema),delete e[r]))}}_addSchema(e,t,r,n=this.opts.validateSchema,o=this.opts.addUsedSchema){let s;const{schemaId:i}=this.opts;if("object"==typeof e)s=e[i];else{if(this.opts.jtd)throw new Error("schema must be object");if("boolean"!=typeof e)throw new Error("schema must be object or boolean")}let u=this._cache.get(e);if(void 0!==u)return u;r=(0,c.normalizeId)(s||r);const d=c.getSchemaRefs.call(this,e,r);return u=new a.SchemaEnv({schema:e,schemaId:i,meta:t,baseId:r,localRefs:d}),this._cache.set(u.schema,u),o&&!r.startsWith("#")&&(r&&this._checkUnique(r),this.refs[r]=u),n&&this.validateSchema(e,!0),u}_checkUnique(e){if(this.schemas[e]||this.refs[e])throw new Error(`schema with key or id "${e}" already exists`)}_compileSchemaEnv(e){if(e.meta?this._compileMetaSchema(e):a.compileSchema.call(this,e),!e.validate)throw new Error("ajv implementation error");return e.validate}_compileMetaSchema(e){const t=this.opts;this.opts=this._metaOpts;try{a.compileSchema.call(this,e)}finally{this.opts=t}}}function w(e,t,r,n="error"){for(const o in e){const s=o;s in t&&this.logger[n](`${r}: option ${o}. ${e[s]}`)}}function $(e){return e=(0,c.normalizeId)(e),this.schemas[e]||this.refs[e]}function b(){const e=this.opts.schemas;if(e)if(Array.isArray(e))this.addSchema(e);else for(const t in e)this.addSchema(e[t],t)}function k(){for(const e in this.opts.formats){const t=this.opts.formats[e];t&&this.addFormat(e,t)}}function E(e){if(Array.isArray(e))this.addVocabulary(e);else{this.logger.warn("keywords option as map is deprecated, pass array");for(const t in e){const r=e[t];r.keyword||(r.keyword=t),this.addKeyword(r)}}}function S(){const e={...this.opts};for(const t of h)delete e[t];return e}_.ValidationError=n.default,_.MissingRefError=o.default,e.default=_;const P={log(){},warn(){},error(){}};const z=/^[a-z_$][a-z0-9_$:-]*$/i;function T(e,t){const{RULES:r}=this;if((0,d.eachItem)(e,e=>{if(r.keywords[e])throw new Error(`Keyword ${e} is already defined`);if(!z.test(e))throw new Error(`Keyword ${e} has invalid name`)}),t&&t.$data&&!("code"in t)&&!("validate"in t))throw new Error('$data keyword must have "code" or "validate" function')}function x(e,t,r){var n;const o=null==t?void 0:t.post;if(r&&o)throw new Error('keyword with "post" flag cannot have "type"');const{RULES:s}=this;let a=o?s.post:s.rules.find(({type:e})=>e===r);if(a||(a={type:r,rules:[]},s.rules.push(a)),s.keywords[e]=!0,!t)return;const i={keyword:e,definition:{...t,type:(0,u.getJSONTypes)(t.type),schemaType:(0,u.getJSONTypes)(t.schemaType)}};t.before?I.call(this,a,i,t.before):a.rules.push(i),s.all[e]=i,null===(n=t.implements)||void 0===n||n.forEach(e=>this.addKeyword(e))}function I(e,t,r){const n=e.rules.findIndex(e=>e.keyword===r);n>=0?e.rules.splice(n,0,t):(e.rules.push(t),this.logger.warn(`rule ${r} is not defined`))}function N(e){let{metaSchema:t}=e;void 0!==t&&(e.$data&&this.opts.$data&&(t=O(t)),e.validateSchema=this.compile(t,!0))}const j={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function O(e){return{anyOf:[e,j]}}}(ac)),ac}var xu,Iu={},Nu={},ju={};function Ou(){if(xu)return ju;xu=1,Object.defineProperty(ju,"__esModule",{value:!0});const e={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};return ju.default=e,ju}var Cu,Ru,Au={};function Mu(){if(Cu)return Au;Cu=1,Object.defineProperty(Au,"__esModule",{value:!0}),Au.callRef=Au.getValidate=void 0;const e=lu(),t=Lc(),r=gc(),n=Sc(),o=hu(),s=wc(),a={keyword:"$ref",schemaType:"string",code(t){const{gen:n,schema:s,it:a}=t,{baseId:u,schemaEnv:d,validateName:l,opts:p,self:f}=a,{root:h}=d;if(("#"===s||"#/"===s)&&u===h.baseId)return function(){if(d===h)return c(t,l,d,d.$async);const e=n.scopeValue("root",{ref:h});return c(t,r._`${e}.validate`,h,h.$async)}();const m=o.resolveRef.call(f,h,u,s);if(void 0===m)throw new e.default(a.opts.uriResolver,u,s);return m instanceof o.SchemaEnv?function(e){const r=i(t,e);c(t,r,e,e.$async)}(m):function(e){const o=n.scopeValue("schema",!0===p.code.source?{ref:e,code:(0,r.stringify)(e)}:{ref:e}),a=n.name("valid"),i=t.subschema({schema:e,dataTypes:[],schemaPath:r.nil,topSchemaRef:o,errSchemaPath:s},a);t.mergeEvaluated(i),t.ok(a)}(m)}};function i(e,t){const{gen:n}=e;return t.validate?n.scopeValue("validate",{ref:t.validate}):r._`${n.scopeValue("wrapper",{ref:t})}.validate`}function c(e,o,a,i){const{gen:c,it:u}=e,{allErrors:d,schemaEnv:l,opts:p}=u,f=p.passContext?n.default.this:r.nil;function h(e){const t=r._`${e}.errors`;c.assign(n.default.vErrors,r._`${n.default.vErrors} === null ? ${t} : ${n.default.vErrors}.concat(${t})`),c.assign(n.default.errors,r._`${n.default.vErrors}.length`)}function m(e){var t;if(!u.opts.unevaluated)return;const n=null===(t=null==a?void 0:a.validate)||void 0===t?void 0:t.evaluated;if(!0!==u.props)if(n&&!n.dynamicProps)void 0!==n.props&&(u.props=s.mergeEvaluated.props(c,n.props,u.props));else{const t=c.var("props",r._`${e}.evaluated.props`);u.props=s.mergeEvaluated.props(c,t,u.props,r.Name)}if(!0!==u.items)if(n&&!n.dynamicItems)void 0!==n.items&&(u.items=s.mergeEvaluated.items(c,n.items,u.items));else{const t=c.var("items",r._`${e}.evaluated.items`);u.items=s.mergeEvaluated.items(c,t,u.items,r.Name)}}i?function(){if(!l.$async)throw new Error("async schema referenced by sync schema");const n=c.let("valid");c.try(()=>{c.code(r._`await ${(0,t.callValidateCode)(e,o,f)}`),m(o),d||c.assign(n,!0)},e=>{c.if(r._`!(${e} instanceof ${u.ValidationError})`,()=>c.throw(e)),h(e),d||c.assign(n,!1)}),e.ok(n)}():e.result((0,t.callValidateCode)(e,o,f),()=>m(o),()=>h(o))}return Au.getValidate=i,Au.callRef=c,Au.default=a,Au}function qu(){if(Ru)return Nu;Ru=1,Object.defineProperty(Nu,"__esModule",{value:!0});const e=Ou(),t=Mu(),r=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",e.default,t.default];return Nu.default=r,Nu}var Du,Uu={},Vu={};function Fu(){if(Du)return Vu;Du=1,Object.defineProperty(Vu,"__esModule",{value:!0});const e=gc(),t=e.operators,r={maximum:{okStr:"<=",ok:t.LTE,fail:t.GT},minimum:{okStr:">=",ok:t.GTE,fail:t.LT},exclusiveMaximum:{okStr:"<",ok:t.LT,fail:t.GTE},exclusiveMinimum:{okStr:">",ok:t.GT,fail:t.LTE}},n={message:({keyword:t,schemaCode:n})=>e.str`must be ${r[t].okStr} ${n}`,params:({keyword:t,schemaCode:n})=>e._`{comparison: ${r[t].okStr}, limit: ${n}}`},o={keyword:Object.keys(r),type:"number",schemaType:"number",$data:!0,error:n,code(t){const{keyword:n,data:o,schemaCode:s}=t;t.fail$data(e._`${o} ${r[n].fail} ${s} || isNaN(${o})`)}};return Vu.default=o,Vu}var Zu,Lu={};function Hu(){if(Zu)return Lu;Zu=1,Object.defineProperty(Lu,"__esModule",{value:!0});const e=gc(),t={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:{message:({schemaCode:t})=>e.str`must be multiple of ${t}`,params:({schemaCode:t})=>e._`{multipleOf: ${t}}`},code(t){const{gen:r,data:n,schemaCode:o,it:s}=t,a=s.opts.multipleOfPrecision,i=r.let("res"),c=a?e._`Math.abs(Math.round(${i}) - ${i}) > 1e-${a}`:e._`${i} !== parseInt(${i})`;t.fail$data(e._`(${o} === 0 || (${i} = ${n}/${o}, ${c}))`)}};return Lu.default=t,Lu}var Ju,Ku,Gu={},Bu={};function Wu(){if(Ju)return Bu;function e(e){const t=e.length;let r,n=0,o=0;for(;o<t;)n++,r=e.charCodeAt(o++),r>=55296&&r<=56319&&o<t&&(r=e.charCodeAt(o),56320==(64512&r)&&o++);return n}return Ju=1,Object.defineProperty(Bu,"__esModule",{value:!0}),Bu.default=e,e.code='require("ajv/dist/runtime/ucs2length").default',Bu}function Qu(){if(Ku)return Gu;Ku=1,Object.defineProperty(Gu,"__esModule",{value:!0});const e=gc(),t=wc(),r=Wu(),n={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:{message({keyword:t,schemaCode:r}){const n="maxLength"===t?"more":"fewer";return e.str`must NOT have ${n} than ${r} characters`},params:({schemaCode:t})=>e._`{limit: ${t}}`},code(n){const{keyword:o,data:s,schemaCode:a,it:i}=n,c="maxLength"===o?e.operators.GT:e.operators.LT,u=!1===i.opts.unicode?e._`${s}.length`:e._`${(0,t.useFunc)(n.gen,r.default)}(${s})`;n.fail$data(e._`${u} ${c} ${a}`)}};return Gu.default=n,Gu}var Yu,Xu={};function ed(){if(Yu)return Xu;Yu=1,Object.defineProperty(Xu,"__esModule",{value:!0});const e=Lc(),t=wc(),r=gc(),n={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:{message:({schemaCode:e})=>r.str`must match pattern "${e}"`,params:({schemaCode:e})=>r._`{pattern: ${e}}`},code(n){const{gen:o,data:s,$data:a,schema:i,schemaCode:c,it:u}=n,d=u.opts.unicodeRegExp?"u":"";if(a){const{regExp:e}=u.opts.code,a="new RegExp"===e.code?r._`new RegExp`:(0,t.useFunc)(o,e),i=o.let("valid");o.try(()=>o.assign(i,r._`${a}(${c}, ${d}).test(${s})`),()=>o.assign(i,!1)),n.fail$data(r._`!${i}`)}else{const t=(0,e.usePattern)(n,i);n.fail$data(r._`!${t}.test(${s})`)}}};return Xu.default=n,Xu}var td,rd={};function nd(){if(td)return rd;td=1,Object.defineProperty(rd,"__esModule",{value:!0});const e=gc(),t={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:{message({keyword:t,schemaCode:r}){const n="maxProperties"===t?"more":"fewer";return e.str`must NOT have ${n} than ${r} properties`},params:({schemaCode:t})=>e._`{limit: ${t}}`},code(t){const{keyword:r,data:n,schemaCode:o}=t,s="maxProperties"===r?e.operators.GT:e.operators.LT;t.fail$data(e._`Object.keys(${n}).length ${s} ${o}`)}};return rd.default=t,rd}var od,sd={};function ad(){if(od)return sd;od=1,Object.defineProperty(sd,"__esModule",{value:!0});const e=Lc(),t=gc(),r=wc(),n={keyword:"required",type:"object",schemaType:"array",$data:!0,error:{message:({params:{missingProperty:e}})=>t.str`must have required property '${e}'`,params:({params:{missingProperty:e}})=>t._`{missingProperty: ${e}}`},code(n){const{gen:o,schema:s,schemaCode:a,data:i,$data:c,it:u}=n,{opts:d}=u;if(!c&&0===s.length)return;const l=s.length>=d.loopRequired;if(u.allErrors?function(){if(l||c)n.block$data(t.nil,p);else for(const t of s)(0,e.checkReportMissingProp)(n,t)}():function(){const r=o.let("missing");if(l||c){const s=o.let("valid",!0);n.block$data(s,()=>function(r,s){n.setParams({missingProperty:r}),o.forOf(r,a,()=>{o.assign(s,(0,e.propertyInData)(o,i,r,d.ownProperties)),o.if((0,t.not)(s),()=>{n.error(),o.break()})},t.nil)}(r,s)),n.ok(s)}else o.if((0,e.checkMissingProp)(n,s,r)),(0,e.reportMissingProp)(n,r),o.else()}(),d.strictRequired){const e=n.parentSchema.properties,{definedProperties:t}=n.it;for(const n of s)if(void 0===(null==e?void 0:e[n])&&!t.has(n)){const e=`required property "${n}" is not defined at "${u.schemaEnv.baseId+u.errSchemaPath}" (strictRequired)`;(0,r.checkStrictMode)(u,e,u.opts.strictRequired)}}function p(){o.forOf("prop",a,t=>{n.setParams({missingProperty:t}),o.if((0,e.noPropertyInData)(o,i,t,d.ownProperties),()=>n.error())})}}};return sd.default=n,sd}var id,cd={};function ud(){if(id)return cd;id=1,Object.defineProperty(cd,"__esModule",{value:!0});const e=gc(),t={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:{message({keyword:t,schemaCode:r}){const n="maxItems"===t?"more":"fewer";return e.str`must NOT have ${n} than ${r} items`},params:({schemaCode:t})=>e._`{limit: ${t}}`},code(t){const{keyword:r,data:n,schemaCode:o}=t,s="maxItems"===r?e.operators.GT:e.operators.LT;t.fail$data(e._`${n}.length ${s} ${o}`)}};return cd.default=t,cd}var dd,ld,pd={},fd={};function hd(){if(dd)return fd;dd=1,Object.defineProperty(fd,"__esModule",{value:!0});const e=Yc();return e.code='require("ajv/dist/runtime/equal").default',fd.default=e,fd}function md(){if(ld)return pd;ld=1,Object.defineProperty(pd,"__esModule",{value:!0});const e=Ac(),t=gc(),r=wc(),n=hd(),o={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:{message:({params:{i:e,j:r}})=>t.str`must NOT have duplicate items (items ## ${r} and ${e} are identical)`,params:({params:{i:e,j:r}})=>t._`{i: ${e}, j: ${r}}`},code(o){const{gen:s,data:a,$data:i,schema:c,parentSchema:u,schemaCode:d,it:l}=o;if(!i&&!c)return;const p=s.let("valid"),f=u.items?(0,e.getSchemaTypes)(u.items):[];function h(r,n){const i=s.name("item"),c=(0,e.checkDataTypes)(f,i,l.opts.strictNumbers,e.DataType.Wrong),u=s.const("indices",t._`{}`);s.for(t._`;${r}--;`,()=>{s.let(i,t._`${a}[${r}]`),s.if(c,t._`continue`),f.length>1&&s.if(t._`typeof ${i} == "string"`,t._`${i} += "_"`),s.if(t._`typeof ${u}[${i}] == "number"`,()=>{s.assign(n,t._`${u}[${i}]`),o.error(),s.assign(p,!1).break()}).code(t._`${u}[${i}] = ${r}`)})}function m(e,i){const c=(0,r.useFunc)(s,n.default),u=s.name("outer");s.label(u).for(t._`;${e}--;`,()=>s.for(t._`${i} = ${e}; ${i}--;`,()=>s.if(t._`${c}(${a}[${e}], ${a}[${i}])`,()=>{o.error(),s.assign(p,!1).break(u)})))}o.block$data(p,function(){const e=s.let("i",t._`${a}.length`),r=s.let("j");o.setParams({i:e,j:r}),s.assign(p,!0),s.if(t._`${e} > 1`,()=>(f.length>0&&!f.some(e=>"object"===e||"array"===e)?h:m)(e,r))},t._`${d} === false`),o.ok(p)}};return pd.default=o,pd}var yd,gd={};function vd(){if(yd)return gd;yd=1,Object.defineProperty(gd,"__esModule",{value:!0});const e=gc(),t=wc(),r=hd(),n={keyword:"const",$data:!0,error:{message:"must be equal to constant",params:({schemaCode:t})=>e._`{allowedValue: ${t}}`},code(n){const{gen:o,data:s,$data:a,schemaCode:i,schema:c}=n;a||c&&"object"==typeof c?n.fail$data(e._`!${(0,t.useFunc)(o,r.default)}(${s}, ${i})`):n.fail(e._`${c} !== ${s}`)}};return gd.default=n,gd}var _d,wd,$d={};function bd(){if(_d)return $d;_d=1,Object.defineProperty($d,"__esModule",{value:!0});const e=gc(),t=wc(),r=hd(),n={keyword:"enum",schemaType:"array",$data:!0,error:{message:"must be equal to one of the allowed values",params:({schemaCode:t})=>e._`{allowedValues: ${t}}`},code(n){const{gen:o,data:s,$data:a,schema:i,schemaCode:c,it:u}=n;if(!a&&0===i.length)throw new Error("enum must have non-empty array");const d=i.length>=u.opts.loopEnum;let l;const p=()=>null!=l?l:l=(0,t.useFunc)(o,r.default);let f;if(d||a)f=o.let("valid"),n.block$data(f,function(){o.assign(f,!1),o.forOf("v",c,t=>o.if(e._`${p()}(${s}, ${t})`,()=>o.assign(f,!0).break()))});else{if(!Array.isArray(i))throw new Error("ajv implementation error");const t=o.const("vSchema",c);f=(0,e.or)(...i.map((r,n)=>function(t,r){const n=i[r];return"object"==typeof n&&null!==n?e._`${p()}(${s}, ${t}[${r}])`:e._`${s} === ${n}`}(t,n)))}n.pass(f)}};return $d.default=n,$d}function kd(){if(wd)return Uu;wd=1,Object.defineProperty(Uu,"__esModule",{value:!0});const e=Fu(),t=Hu(),r=Qu(),n=ed(),o=nd(),s=ad(),a=ud(),i=md(),c=vd(),u=bd(),d=[e.default,t.default,r.default,n.default,o.default,s.default,a.default,i.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},c.default,u.default];return Uu.default=d,Uu}var Ed,Sd={},Pd={};function zd(){if(Ed)return Pd;Ed=1,Object.defineProperty(Pd,"__esModule",{value:!0}),Pd.validateAdditionalItems=void 0;const e=gc(),t=wc(),r={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:{message:({params:{len:t}})=>e.str`must NOT have more than ${t} items`,params:({params:{len:t}})=>e._`{limit: ${t}}`},code(e){const{parentSchema:r,it:o}=e,{items:s}=r;Array.isArray(s)?n(e,s):(0,t.checkStrictMode)(o,'"additionalItems" is ignored when "items" is not an array of schemas')}};function n(r,n){const{gen:o,schema:s,data:a,keyword:i,it:c}=r;c.items=!0;const u=o.const("len",e._`${a}.length`);if(!1===s)r.setParams({len:n.length}),r.pass(e._`${u} <= ${n.length}`);else if("object"==typeof s&&!(0,t.alwaysValidSchema)(c,s)){const s=o.var("valid",e._`${u} <= ${n.length}`);o.if((0,e.not)(s),()=>function(s){o.forRange("i",n.length,u,n=>{r.subschema({keyword:i,dataProp:n,dataPropType:t.Type.Num},s),c.allErrors||o.if((0,e.not)(s),()=>o.break())})}(s)),r.ok(s)}}return Pd.validateAdditionalItems=n,Pd.default=r,Pd}var Td,xd,Id={},Nd={};function jd(){if(Td)return Nd;Td=1,Object.defineProperty(Nd,"__esModule",{value:!0}),Nd.validateTuple=void 0;const e=gc(),t=wc(),r=Lc(),n={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){const{schema:n,it:s}=e;if(Array.isArray(n))return o(e,"additionalItems",n);s.items=!0,(0,t.alwaysValidSchema)(s,n)||e.ok((0,r.validateArray)(e))}};function o(r,n,o=r.schema){const{gen:s,parentSchema:a,data:i,keyword:c,it:u}=r;!function(e){const{opts:r,errSchemaPath:s}=u,a=o.length,i=a===e.minItems&&(a===e.maxItems||!1===e[n]);if(r.strictTuples&&!i){const e=`"${c}" is ${a}-tuple, but minItems or maxItems/${n} are not specified or different at path "${s}"`;(0,t.checkStrictMode)(u,e,r.strictTuples)}}(a),u.opts.unevaluated&&o.length&&!0!==u.items&&(u.items=t.mergeEvaluated.items(s,o.length,u.items));const d=s.name("valid"),l=s.const("len",e._`${i}.length`);o.forEach((n,o)=>{(0,t.alwaysValidSchema)(u,n)||(s.if(e._`${l} > ${o}`,()=>r.subschema({keyword:c,schemaProp:o,dataProp:o},d)),r.ok(d))})}return Nd.validateTuple=o,Nd.default=n,Nd}function Od(){if(xd)return Id;xd=1,Object.defineProperty(Id,"__esModule",{value:!0});const e=jd(),t={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:t=>(0,e.validateTuple)(t,"items")};return Id.default=t,Id}var Cd,Rd={};function Ad(){if(Cd)return Rd;Cd=1,Object.defineProperty(Rd,"__esModule",{value:!0});const e=gc(),t=wc(),r=Lc(),n=zd(),o={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:{message:({params:{len:t}})=>e.str`must NOT have more than ${t} items`,params:({params:{len:t}})=>e._`{limit: ${t}}`},code(e){const{schema:o,parentSchema:s,it:a}=e,{prefixItems:i}=s;a.items=!0,(0,t.alwaysValidSchema)(a,o)||(i?(0,n.validateAdditionalItems)(e,i):e.ok((0,r.validateArray)(e)))}};return Rd.default=o,Rd}var Md,qd={};function Dd(){if(Md)return qd;Md=1,Object.defineProperty(qd,"__esModule",{value:!0});const e=gc(),t=wc(),r={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:{message:({params:{min:t,max:r}})=>void 0===r?e.str`must contain at least ${t} valid item(s)`:e.str`must contain at least ${t} and no more than ${r} valid item(s)`,params:({params:{min:t,max:r}})=>void 0===r?e._`{minContains: ${t}}`:e._`{minContains: ${t}, maxContains: ${r}}`},code(r){const{gen:n,schema:o,parentSchema:s,data:a,it:i}=r;let c,u;const{minContains:d,maxContains:l}=s;i.opts.next?(c=void 0===d?1:d,u=l):c=1;const p=n.const("len",e._`${a}.length`);if(r.setParams({min:c,max:u}),void 0===u&&0===c)return void(0,t.checkStrictMode)(i,'"minContains" == 0 without "maxContains": "contains" keyword ignored');if(void 0!==u&&c>u)return(0,t.checkStrictMode)(i,'"minContains" > "maxContains" is always invalid'),void r.fail();if((0,t.alwaysValidSchema)(i,o)){let t=e._`${p} >= ${c}`;return void 0!==u&&(t=e._`${t} && ${p} <= ${u}`),void r.pass(t)}i.items=!0;const f=n.name("valid");function h(){const t=n.name("_valid"),r=n.let("count",0);m(t,()=>n.if(t,()=>function(t){n.code(e._`${t}++`),void 0===u?n.if(e._`${t} >= ${c}`,()=>n.assign(f,!0).break()):(n.if(e._`${t} > ${u}`,()=>n.assign(f,!1).break()),1===c?n.assign(f,!0):n.if(e._`${t} >= ${c}`,()=>n.assign(f,!0)))}(r)))}function m(e,o){n.forRange("i",0,p,n=>{r.subschema({keyword:"contains",dataProp:n,dataPropType:t.Type.Num,compositeRule:!0},e),o()})}void 0===u&&1===c?m(f,()=>n.if(f,()=>n.break())):0===c?(n.let(f,!0),void 0!==u&&n.if(e._`${a}.length > 0`,h)):(n.let(f,!1),h()),r.result(f,()=>r.reset())}};return qd.default=r,qd}var Ud,Vd={};function Fd(){return Ud||(Ud=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.validateSchemaDeps=e.validatePropertyDeps=e.error=void 0;const t=gc(),r=wc(),n=Lc();e.error={message:({params:{property:e,depsCount:r,deps:n}})=>{const o=1===r?"property":"properties";return t.str`must have ${o} ${n} when property ${e} is present`},params:({params:{property:e,depsCount:r,deps:n,missingProperty:o}})=>t._`{property: ${e},
|
|
5
|
+
missingProperty: ${o},
|
|
6
|
+
depsCount: ${r},
|
|
7
|
+
deps: ${n}}`};const o={keyword:"dependencies",type:"object",schemaType:"object",error:e.error,code(e){const[t,r]=function({schema:e}){const t={},r={};for(const n in e){if("__proto__"===n)continue;(Array.isArray(e[n])?t:r)[n]=e[n]}return[t,r]}(e);s(e,t),a(e,r)}};function s(e,r=e.schema){const{gen:o,data:s,it:a}=e;if(0===Object.keys(r).length)return;const i=o.let("missing");for(const c in r){const u=r[c];if(0===u.length)continue;const d=(0,n.propertyInData)(o,s,c,a.opts.ownProperties);e.setParams({property:c,depsCount:u.length,deps:u.join(", ")}),a.allErrors?o.if(d,()=>{for(const t of u)(0,n.checkReportMissingProp)(e,t)}):(o.if(t._`${d} && (${(0,n.checkMissingProp)(e,u,i)})`),(0,n.reportMissingProp)(e,i),o.else())}}function a(e,t=e.schema){const{gen:o,data:s,keyword:a,it:i}=e,c=o.name("valid");for(const u in t)(0,r.alwaysValidSchema)(i,t[u])||(o.if((0,n.propertyInData)(o,s,u,i.opts.ownProperties),()=>{const t=e.subschema({keyword:a,schemaProp:u},c);e.mergeValidEvaluated(t,c)},()=>o.var(c,!0)),e.ok(c))}e.validatePropertyDeps=s,e.validateSchemaDeps=a,e.default=o}(Vd)),Vd}var Zd,Ld={};function Hd(){if(Zd)return Ld;Zd=1,Object.defineProperty(Ld,"__esModule",{value:!0});const e=gc(),t=wc(),r={message:"property name must be valid",params:({params:t})=>e._`{propertyName: ${t.propertyName}}`},n={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:r,code(r){const{gen:n,schema:o,data:s,it:a}=r;if((0,t.alwaysValidSchema)(a,o))return;const i=n.name("valid");n.forIn("key",s,t=>{r.setParams({propertyName:t}),r.subschema({keyword:"propertyNames",data:t,dataTypes:["string"],propertyName:t,compositeRule:!0},i),n.if((0,e.not)(i),()=>{r.error(!0),a.allErrors||n.break()})}),r.ok(i)}};return Ld.default=n,Ld}var Jd,Kd={};function Gd(){if(Jd)return Kd;Jd=1,Object.defineProperty(Kd,"__esModule",{value:!0});const e=Lc(),t=gc(),r=Sc(),n=wc(),o={message:"must NOT have additional properties",params:({params:e})=>t._`{additionalProperty: ${e.additionalProperty}}`},s={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:o,code(o){const{gen:s,schema:a,parentSchema:i,data:c,errsCount:u,it:d}=o;if(!u)throw new Error("ajv implementation error");const{allErrors:l,opts:p}=d;if(d.props=!0,"all"!==p.removeAdditional&&(0,n.alwaysValidSchema)(d,a))return;const f=(0,e.allSchemaProperties)(i.properties),h=(0,e.allSchemaProperties)(i.patternProperties);function m(e){s.code(t._`delete ${c}[${e}]`)}function y(e){if("all"===p.removeAdditional||p.removeAdditional&&!1===a)m(e);else{if(!1===a)return o.setParams({additionalProperty:e}),o.error(),void(l||s.break());if("object"==typeof a&&!(0,n.alwaysValidSchema)(d,a)){const r=s.name("valid");"failing"===p.removeAdditional?(g(e,r,!1),s.if((0,t.not)(r),()=>{o.reset(),m(e)})):(g(e,r),l||s.if((0,t.not)(r),()=>s.break()))}}}function g(e,t,r){const s={keyword:"additionalProperties",dataProp:e,dataPropType:n.Type.Str};!1===r&&Object.assign(s,{compositeRule:!0,createErrors:!1,allErrors:!1}),o.subschema(s,t)}s.forIn("key",c,r=>{f.length||h.length?s.if(function(r){let a;if(f.length>8){const t=(0,n.schemaRefOrVal)(d,i.properties,"properties");a=(0,e.isOwnProperty)(s,t,r)}else a=f.length?(0,t.or)(...f.map(e=>t._`${r} === ${e}`)):t.nil;return h.length&&(a=(0,t.or)(a,...h.map(n=>t._`${(0,e.usePattern)(o,n)}.test(${r})`))),(0,t.not)(a)}(r),()=>y(r)):y(r)}),o.ok(t._`${u} === ${r.default.errors}`)}};return Kd.default=s,Kd}var Bd,Wd={};function Qd(){if(Bd)return Wd;Bd=1,Object.defineProperty(Wd,"__esModule",{value:!0});const e=su(),t=Lc(),r=wc(),n=Gd(),o={keyword:"properties",type:"object",schemaType:"object",code(o){const{gen:s,schema:a,parentSchema:i,data:c,it:u}=o;"all"===u.opts.removeAdditional&&void 0===i.additionalProperties&&n.default.code(new e.KeywordCxt(u,n.default,"additionalProperties"));const d=(0,t.allSchemaProperties)(a);for(const e of d)u.definedProperties.add(e);u.opts.unevaluated&&d.length&&!0!==u.props&&(u.props=r.mergeEvaluated.props(s,(0,r.toHash)(d),u.props));const l=d.filter(e=>!(0,r.alwaysValidSchema)(u,a[e]));if(0===l.length)return;const p=s.name("valid");for(const e of l)f(e)?h(e):(s.if((0,t.propertyInData)(s,c,e,u.opts.ownProperties)),h(e),u.allErrors||s.else().var(p,!0),s.endIf()),o.it.definedProperties.add(e),o.ok(p);function f(e){return u.opts.useDefaults&&!u.compositeRule&&void 0!==a[e].default}function h(e){o.subschema({keyword:"properties",schemaProp:e,dataProp:e},p)}}};return Wd.default=o,Wd}var Yd,Xd={};function el(){if(Yd)return Xd;Yd=1,Object.defineProperty(Xd,"__esModule",{value:!0});const e=Lc(),t=gc(),r=wc(),n=wc(),o={keyword:"patternProperties",type:"object",schemaType:"object",code(o){const{gen:s,schema:a,data:i,parentSchema:c,it:u}=o,{opts:d}=u,l=(0,e.allSchemaProperties)(a),p=l.filter(e=>(0,r.alwaysValidSchema)(u,a[e]));if(0===l.length||p.length===l.length&&(!u.opts.unevaluated||!0===u.props))return;const f=d.strictSchema&&!d.allowMatchingProperties&&c.properties,h=s.name("valid");!0===u.props||u.props instanceof t.Name||(u.props=(0,n.evaluatedPropsToName)(s,u.props));const{props:m}=u;function y(e){for(const t in f)new RegExp(e).test(t)&&(0,r.checkStrictMode)(u,`property ${t} matches pattern ${e} (use allowMatchingProperties)`)}function g(r){s.forIn("key",i,a=>{s.if(t._`${(0,e.usePattern)(o,r)}.test(${a})`,()=>{const e=p.includes(r);e||o.subschema({keyword:"patternProperties",schemaProp:r,dataProp:a,dataPropType:n.Type.Str},h),u.opts.unevaluated&&!0!==m?s.assign(t._`${m}[${a}]`,!0):e||u.allErrors||s.if((0,t.not)(h),()=>s.break())})})}!function(){for(const e of l)f&&y(e),u.allErrors?g(e):(s.var(h,!0),g(e),s.if(h))}()}};return Xd.default=o,Xd}var tl,rl={};function nl(){if(tl)return rl;tl=1,Object.defineProperty(rl,"__esModule",{value:!0});const e=wc(),t={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(t){const{gen:r,schema:n,it:o}=t;if((0,e.alwaysValidSchema)(o,n))return void t.fail();const s=r.name("valid");t.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},s),t.failResult(s,()=>t.reset(),()=>t.error())},error:{message:"must NOT be valid"}};return rl.default=t,rl}var ol,sl={};function al(){if(ol)return sl;ol=1,Object.defineProperty(sl,"__esModule",{value:!0});const e={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:Lc().validateUnion,error:{message:"must match a schema in anyOf"}};return sl.default=e,sl}var il,cl={};function ul(){if(il)return cl;il=1,Object.defineProperty(cl,"__esModule",{value:!0});const e=gc(),t=wc(),r={message:"must match exactly one schema in oneOf",params:({params:t})=>e._`{passingSchemas: ${t.passing}}`},n={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:r,code(r){const{gen:n,schema:o,parentSchema:s,it:a}=r;if(!Array.isArray(o))throw new Error("ajv implementation error");if(a.opts.discriminator&&s.discriminator)return;const i=o,c=n.let("valid",!1),u=n.let("passing",null),d=n.name("_valid");r.setParams({passing:u}),n.block(function(){i.forEach((o,s)=>{let i;(0,t.alwaysValidSchema)(a,o)?n.var(d,!0):i=r.subschema({keyword:"oneOf",schemaProp:s,compositeRule:!0},d),s>0&&n.if(e._`${d} && ${c}`).assign(c,!1).assign(u,e._`[${u}, ${s}]`).else(),n.if(d,()=>{n.assign(c,!0),n.assign(u,s),i&&r.mergeEvaluated(i,e.Name)})})}),r.result(c,()=>r.reset(),()=>r.error(!0))}};return cl.default=n,cl}var dl,ll={};function pl(){if(dl)return ll;dl=1,Object.defineProperty(ll,"__esModule",{value:!0});const e=wc(),t={keyword:"allOf",schemaType:"array",code(t){const{gen:r,schema:n,it:o}=t;if(!Array.isArray(n))throw new Error("ajv implementation error");const s=r.name("valid");n.forEach((r,n)=>{if((0,e.alwaysValidSchema)(o,r))return;const a=t.subschema({keyword:"allOf",schemaProp:n},s);t.ok(s),t.mergeEvaluated(a)})}};return ll.default=t,ll}var fl,hl={};function ml(){if(fl)return hl;fl=1,Object.defineProperty(hl,"__esModule",{value:!0});const e=gc(),t=wc(),r={message:({params:t})=>e.str`must match "${t.ifClause}" schema`,params:({params:t})=>e._`{failingKeyword: ${t.ifClause}}`},n={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:r,code(r){const{gen:n,parentSchema:s,it:a}=r;void 0===s.then&&void 0===s.else&&(0,t.checkStrictMode)(a,'"if" without "then" and "else" is ignored');const i=o(a,"then"),c=o(a,"else");if(!i&&!c)return;const u=n.let("valid",!0),d=n.name("_valid");if(function(){const e=r.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},d);r.mergeEvaluated(e)}(),r.reset(),i&&c){const e=n.let("ifClause");r.setParams({ifClause:e}),n.if(d,l("then",e),l("else",e))}else i?n.if(d,l("then")):n.if((0,e.not)(d),l("else"));function l(t,o){return()=>{const s=r.subschema({keyword:t},d);n.assign(u,d),r.mergeValidEvaluated(s,u),o?n.assign(o,e._`${t}`):r.setParams({ifClause:t})}}r.pass(u,()=>r.error(!0))}};function o(e,r){const n=e.schema[r];return void 0!==n&&!(0,t.alwaysValidSchema)(e,n)}return hl.default=n,hl}var yl,gl,vl={};function _l(){if(yl)return vl;yl=1,Object.defineProperty(vl,"__esModule",{value:!0});const e=wc(),t={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:t,parentSchema:r,it:n}){void 0===r.if&&(0,e.checkStrictMode)(n,`"${t}" without "if" is ignored`)}};return vl.default=t,vl}function wl(){if(gl)return Sd;gl=1,Object.defineProperty(Sd,"__esModule",{value:!0});const e=zd(),t=Od(),r=jd(),n=Ad(),o=Dd(),s=Fd(),a=Hd(),i=Gd(),c=Qd(),u=el(),d=nl(),l=al(),p=ul(),f=pl(),h=ml(),m=_l();return Sd.default=function(y=!1){const g=[d.default,l.default,p.default,f.default,h.default,m.default,a.default,i.default,s.default,c.default,u.default];return y?g.push(t.default,n.default):g.push(e.default,r.default),g.push(o.default),g},Sd}var $l,bl,kl={},El={};function Sl(){if($l)return El;$l=1,Object.defineProperty(El,"__esModule",{value:!0});const e=gc(),t={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:{message:({schemaCode:t})=>e.str`must match format "${t}"`,params:({schemaCode:t})=>e._`{format: ${t}}`},code(t,r){const{gen:n,data:o,$data:s,schema:a,schemaCode:i,it:c}=t,{opts:u,errSchemaPath:d,schemaEnv:l,self:p}=c;u.validateFormats&&(s?function(){const s=n.scopeValue("formats",{ref:p.formats,code:u.code.formats}),a=n.const("fDef",e._`${s}[${i}]`),c=n.let("fType"),d=n.let("format");n.if(e._`typeof ${a} == "object" && !(${a} instanceof RegExp)`,()=>n.assign(c,e._`${a}.type || "string"`).assign(d,e._`${a}.validate`),()=>n.assign(c,e._`"string"`).assign(d,a)),t.fail$data((0,e.or)(!1===u.strictSchema?e.nil:e._`${i} && !${d}`,function(){const t=l.$async?e._`(${a}.async ? await ${d}(${o}) : ${d}(${o}))`:e._`${d}(${o})`,n=e._`(typeof ${d} == "function" ? ${t} : ${d}.test(${o}))`;return e._`${d} && ${d} !== true && ${c} === ${r} && !${n}`}()))}():function(){const s=p.formats[a];if(!s)return void function(){if(!1===u.strictSchema)return void p.logger.warn(e());throw new Error(e());function e(){return`unknown format "${a}" ignored in schema at path "${d}"`}}();if(!0===s)return;const[i,c,f]=function(t){const r=t instanceof RegExp?(0,e.regexpCode)(t):u.code.formats?e._`${u.code.formats}${(0,e.getProperty)(a)}`:void 0,o=n.scopeValue("formats",{key:a,ref:t,code:r});if("object"==typeof t&&!(t instanceof RegExp))return[t.type||"string",t.validate,e._`${o}.validate`];return["string",t,o]}(s);i===r&&t.pass(function(){if("object"==typeof s&&!(s instanceof RegExp)&&s.async){if(!l.$async)throw new Error("async format in sync schema");return e._`await ${f}(${o})`}return"function"==typeof c?e._`${f}(${o})`:e._`${f}.test(${o})`}())}())}};return El.default=t,El}function Pl(){if(bl)return kl;bl=1,Object.defineProperty(kl,"__esModule",{value:!0});const e=[Sl().default];return kl.default=e,kl}var zl,Tl,xl={};function Il(){return zl||(zl=1,Object.defineProperty(xl,"__esModule",{value:!0}),xl.contentVocabulary=xl.metadataVocabulary=void 0,xl.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"],xl.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]),xl}function Nl(){if(Tl)return Iu;Tl=1,Object.defineProperty(Iu,"__esModule",{value:!0});const e=qu(),t=kd(),r=wl(),n=Pl(),o=Il(),s=[e.default,t.default,(0,r.default)(),n.default,o.metadataVocabulary,o.contentVocabulary];return Iu.default=s,Iu}var jl,Ol,Cl={},Rl={};function Al(){return jl||(jl=1,Object.defineProperty(Rl,"__esModule",{value:!0}),Rl.DiscrError=void 0,(t=e||(Rl.DiscrError=e={})).Tag="tag",t.Mapping="mapping"),Rl;var e,t}function Ml(){if(Ol)return Cl;Ol=1,Object.defineProperty(Cl,"__esModule",{value:!0});const e=gc(),t=Al(),r=hu(),n=lu(),o=wc(),s={keyword:"discriminator",type:"object",schemaType:"object",error:{message:({params:{discrError:e,tagName:r}})=>e===t.DiscrError.Tag?`tag "${r}" must be string`:`value of tag "${r}" must be in oneOf`,params:({params:{discrError:t,tag:r,tagName:n}})=>e._`{error: ${t}, tag: ${n}, tagValue: ${r}}`},code(s){const{gen:a,data:i,schema:c,parentSchema:u,it:d}=s,{oneOf:l}=u;if(!d.opts.discriminator)throw new Error("discriminator: requires discriminator option");const p=c.propertyName;if("string"!=typeof p)throw new Error("discriminator: requires propertyName");if(c.mapping)throw new Error("discriminator: mapping is not supported");if(!l)throw new Error("discriminator: requires oneOf keyword");const f=a.let("valid",!1),h=a.const("tag",e._`${i}${(0,e.getProperty)(p)}`);function m(t){const r=a.name("valid"),n=s.subschema({keyword:"oneOf",schemaProp:t},r);return s.mergeEvaluated(n,e.Name),r}a.if(e._`typeof ${h} == "string"`,()=>function(){const i=function(){var e;const t={},s=i(u);let a=!0;for(let u=0;u<l.length;u++){let t=l[u];if((null==t?void 0:t.$ref)&&!(0,o.schemaHasRulesButRef)(t,d.self.RULES)){const e=t.$ref;if(t=r.resolveRef.call(d.self,d.schemaEnv.root,d.baseId,e),t instanceof r.SchemaEnv&&(t=t.schema),void 0===t)throw new n.default(d.opts.uriResolver,d.baseId,e)}const f=null===(e=null==t?void 0:t.properties)||void 0===e?void 0:e[p];if("object"!=typeof f)throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${p}"`);a=a&&(s||i(t)),c(f,u)}if(!a)throw new Error(`discriminator: "${p}" must be required`);return t;function i({required:e}){return Array.isArray(e)&&e.includes(p)}function c(e,t){if(e.const)f(e.const,t);else{if(!e.enum)throw new Error(`discriminator: "properties/${p}" must have "const" or "enum"`);for(const r of e.enum)f(r,t)}}function f(e,r){if("string"!=typeof e||e in t)throw new Error(`discriminator: "${p}" values must be unique strings`);t[e]=r}}();a.if(!1);for(const t in i)a.elseIf(e._`${h} === ${t}`),a.assign(f,m(i[t]));a.else(),s.error(!1,{discrError:t.DiscrError.Mapping,tag:h,tagName:p}),a.endIf()}(),()=>s.error(!1,{discrError:t.DiscrError.Tag,tag:h,tagName:p})),s.ok(f)}};return Cl.default=s,Cl}const ql={$schema:"http://json-schema.org/draft-07/schema#",$id:"http://json-schema.org/draft-07/schema#",title:"Core schema meta-schema",definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},default:!0};var Dl;function Ul(){return Dl||(Dl=1,function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.MissingRefError=t.ValidationError=t.CodeGen=t.Name=t.nil=t.stringify=t.str=t._=t.KeywordCxt=t.Ajv=void 0;const r=Tu(),n=Nl(),o=Ml(),s=ql,a=["/properties"],i="http://json-schema.org/draft-07/schema";class c extends r.default{_addVocabularies(){super._addVocabularies(),n.default.forEach(e=>this.addVocabulary(e)),this.opts.discriminator&&this.addKeyword(o.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;const e=this.opts.$data?this.$dataMetaSchema(s,a):s;this.addMetaSchema(e,i,!1),this.refs["http://json-schema.org/schema"]=i}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(i)?i:void 0)}}t.Ajv=c,e.exports=t=c,e.exports.Ajv=c,Object.defineProperty(t,"__esModule",{value:!0}),t.default=c;var u=su();Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return u.KeywordCxt}});var d=gc();Object.defineProperty(t,"_",{enumerable:!0,get:function(){return d._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return d.str}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return d.stringify}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return d.nil}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return d.Name}}),Object.defineProperty(t,"CodeGen",{enumerable:!0,get:function(){return d.CodeGen}});var l=cu();Object.defineProperty(t,"ValidationError",{enumerable:!0,get:function(){return l.default}});var p=lu();Object.defineProperty(t,"MissingRefError",{enumerable:!0,get:function(){return p.default}})}(sc,sc.exports)),sc.exports}var Vl=Ul();const Fl=t.getDefaultExportFromCjs(Vl);var Zl,Ll={exports:{}},Hl={};var Jl,Kl,Gl={};var Bl=(Kl||(Kl=1,function(e,t){Object.defineProperty(t,"__esModule",{value:!0});const r=(Zl||(Zl=1,function(e){function t(e,t){return{validate:e,compare:t}}Object.defineProperty(e,"__esModule",{value:!0}),e.formatNames=e.fastFormats=e.fullFormats=void 0,e.fullFormats={date:t(o,s),time:t(i(!0),c),"date-time":t(l(!0),p),"iso-time":t(i(),u),"iso-date-time":t(l(),f),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:function(e){return h.test(e)&&m.test(e)},"uri-reference":/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,"uri-template":/^(?:(?:[^\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,url:/^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,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:/^(?=.{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,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/,ipv6:/^((([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}))|:)))$/i,regex:function(e){if(w.test(e))return!1;try{return new RegExp(e),!0}catch(t){return!1}},uuid:/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,"json-pointer":/^(?:\/(?:[^~/]|~0|~1)*)*$/,"json-pointer-uri-fragment":/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,"relative-json-pointer":/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,byte:function(e){return y.lastIndex=0,y.test(e)},int32:{type:"number",validate:function(e){return Number.isInteger(e)&&e<=v&&e>=g}},int64:{type:"number",validate:function(e){return Number.isInteger(e)}},float:{type:"number",validate:_},double:{type:"number",validate:_},password:!0,binary:!0},e.fastFormats={...e.fullFormats,date:t(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,s),time:t(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,c),"date-time":t(/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,p),"iso-time":t(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,u),"iso-date-time":t(/^\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,f),uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,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},e.formatNames=Object.keys(e.fullFormats);const r=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,n=[0,31,28,31,30,31,30,31,31,30,31,30,31];function o(e){const t=r.exec(e);if(!t)return!1;const o=+t[1],s=+t[2],a=+t[3];return s>=1&&s<=12&&a>=1&&a<=(2===s&&function(e){return e%4==0&&(e%100!=0||e%400==0)}(o)?29:n[s])}function s(e,t){if(e&&t)return e>t?1:e<t?-1:0}const a=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function i(e){return function(t){const r=a.exec(t);if(!r)return!1;const n=+r[1],o=+r[2],s=+r[3],i=r[4],c="-"===r[5]?-1:1,u=+(r[6]||0),d=+(r[7]||0);if(u>23||d>59||e&&!i)return!1;if(n<=23&&o<=59&&s<60)return!0;const l=o-d*c,p=n-u*c-(l<0?1:0);return(23===p||-1===p)&&(59===l||-1===l)&&s<61}}function c(e,t){if(!e||!t)return;const r=new Date("2020-01-01T"+e).valueOf(),n=new Date("2020-01-01T"+t).valueOf();return r&&n?r-n:void 0}function u(e,t){if(!e||!t)return;const r=a.exec(e),n=a.exec(t);return r&&n?(e=r[1]+r[2]+r[3])>(t=n[1]+n[2]+n[3])?1:e<t?-1:0:void 0}const d=/t|\s/i;function l(e){const t=i(e);return function(e){const r=e.split(d);return 2===r.length&&o(r[0])&&t(r[1])}}function p(e,t){if(!e||!t)return;const r=new Date(e).valueOf(),n=new Date(t).valueOf();return r&&n?r-n:void 0}function f(e,t){if(!e||!t)return;const[r,n]=e.split(d),[o,a]=t.split(d),i=s(r,o);return void 0!==i?i||c(n,a):void 0}const h=/\/|:/,m=/^(?:[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,y=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm,g=-2147483648,v=2**31-1;function _(){return!0}const w=/[^\\]\\Z/}(Hl)),Hl),n=(Jl||(Jl=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.formatLimitDefinition=void 0;const t=Ul(),r=gc(),n=r.operators,o={formatMaximum:{okStr:"<=",ok:n.LTE,fail:n.GT},formatMinimum:{okStr:">=",ok:n.GTE,fail:n.LT},formatExclusiveMaximum:{okStr:"<",ok:n.LT,fail:n.GTE},formatExclusiveMinimum:{okStr:">",ok:n.GT,fail:n.LTE}},s={message:({keyword:e,schemaCode:t})=>r.str`should be ${o[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>r._`{comparison: ${o[e].okStr}, limit: ${t}}`};e.formatLimitDefinition={keyword:Object.keys(o),type:"string",schemaType:"string",$data:!0,error:s,code(e){const{gen:n,data:s,schemaCode:a,keyword:i,it:c}=e,{opts:u,self:d}=c;if(!u.validateFormats)return;const l=new t.KeywordCxt(c,d.RULES.all.format.definition,"format");function p(e){return r._`${e}.compare(${s}, ${a}) ${o[i].fail} 0`}l.$data?function(){const t=n.scopeValue("formats",{ref:d.formats,code:u.code.formats}),o=n.const("fmt",r._`${t}[${l.schemaCode}]`);e.fail$data((0,r.or)(r._`typeof ${o} != "object"`,r._`${o} instanceof RegExp`,r._`typeof ${o}.compare != "function"`,p(o)))}():function(){const t=l.schema,o=d.formats[t];if(!o||!0===o)return;if("object"!=typeof o||o instanceof RegExp||"function"!=typeof o.compare)throw new Error(`"${i}": format "${t}" does not define "compare" function`);const s=n.scopeValue("formats",{key:t,ref:o,code:u.code.formats?r._`${u.code.formats}${(0,r.getProperty)(t)}`:void 0});e.fail$data(p(s))}()},dependencies:["format"]},e.default=t=>(t.addKeyword(e.formatLimitDefinition),t)}(Gl)),Gl),o=gc(),s=new o.Name("fullFormats"),a=new o.Name("fastFormats"),i=(e,t={keywords:!0})=>{if(Array.isArray(t))return c(e,t,r.fullFormats,s),e;const[o,i]="fast"===t.mode?[r.fastFormats,a]:[r.fullFormats,s];return c(e,t.formats||r.formatNames,o,i),t.keywords&&(0,n.default)(e),e};function c(e,t,r,n){var s,a;null!==(s=(a=e.opts.code).formats)&&void 0!==s||(a.formats=o._`require("ajv-formats/dist/formats").${n}`);for(const o of t)e.addFormat(o,r[o])}i.get=(e,t="full")=>{const n=("fast"===t?r.fastFormats:r.fullFormats)[e];if(!n)throw new Error(`Unknown format "${e}"`);return n},e.exports=t=i,Object.defineProperty(t,"__esModule",{value:!0}),t.default=i}(Ll,Ll.exports)),Ll.exports);const Wl=t.getDefaultExportFromCjs(Bl);class Ql{constructor(e){this._ajv=e??function(){const e=new Fl({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return Wl(e),e}()}getValidator(e){const t="$id"in e&&"string"==typeof e.$id?this._ajv.getSchema(e.$id)??this._ajv.compile(e):this._ajv.compile(e);return e=>t(e)?{valid:!0,data:e,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:this._ajv.errorsText(t.errors)}}}class Yl{constructor(e){this._server=e}requestStream(e,t,r){return this._server.requestStream(e,t,r)}createMessageStream(e,t){const r=this._server.getClientCapabilities();if((e.tools||e.toolChoice)&&!r?.sampling?.tools)throw new Error("Client does not support sampling tools capability.");if(e.messages.length>0){const t=e.messages[e.messages.length-1],r=Array.isArray(t.content)?t.content:[t.content],n=r.some(e=>"tool_result"===e.type),o=e.messages.length>1?e.messages[e.messages.length-2]:void 0,s=o?Array.isArray(o.content)?o.content:[o.content]:[],a=s.some(e=>"tool_use"===e.type);if(n){if(r.some(e=>"tool_result"!==e.type))throw new Error("The last message must contain only tool_result content if any is present");if(!a)throw new Error("tool_result blocks are not matching any tool_use from the previous message")}if(a){const e=new Set(s.filter(e=>"tool_use"===e.type).map(e=>e.id)),t=new Set(r.filter(e=>"tool_result"===e.type).map(e=>e.toolUseId));if(e.size!==t.size||![...e].every(e=>t.has(e)))throw new Error("ids of tool_result blocks and tool_use blocks from previous message do not match")}}return this.requestStream({method:"sampling/createMessage",params:e},Si,t)}elicitInputStream(e,t){const r=this._server.getClientCapabilities(),n=e.mode??"form";switch(n){case"url":if(!r?.elicitation?.url)throw new Error("Client does not support url elicitation.");break;case"form":if(!r?.elicitation?.form)throw new Error("Client does not support form elicitation.")}const o="form"===n&&void 0===e.mode?{...e,mode:"form"}:e;return this.requestStream({method:"elicitation/create",params:o},Vi,t)}async getTask(e,t){return this._server.getTask({taskId:e},t)}async getTaskResult(e,t,r){return this._server.getTaskResult({taskId:e},t,r)}async listTasks(e,t){return this._server.listTasks(e?{cursor:e}:void 0,t)}async cancelTask(e,t){return this._server.cancelTask({taskId:e},t)}}const Xl=new t.Logger(t.LogLevel.WARN,"[html-to-markdown]");exports.CallToolRequestSchema=ui,exports.DEFAULT_NEGOTIATED_PROTOCOL_VERSION="2025-03-26",exports.InitializeRequestSchema=Gs,exports.JSONRPCMessageSchema=Cs,exports.ListToolsRequestSchema=si,exports.MCP_TOOL_SCHEMAS={htmlToMarkdown:{type:"object",properties:{url:{type:"string",description:"URL of the web page to convert (e.g., https://example.com). Handles JavaScript-rendered dynamic content effectively."},html_content:{type:"string",description:"HTML string to convert directly. Use instead of URL for local files or API response HTML content."},locale:{type:"string",description:"Browser locale setting. Use 'ja-JP' for Japanese sites, 'en-US' for English sites. Affects content rendering and language detection.",enum:["en-US","ja-JP"],default:"en-US"}},anyOf:[{required:["url"]},{required:["html_content"]}]},saveContentToFile:{type:"object",properties:{content:{type:"string",description:"Text content to save to file. Will be saved as Markdown format."},save_path:{type:"string",description:"Complete file path including filename to save content (e.g., '/home/user/output.md'). Cannot be used with save_directory."},save_directory:{type:"string",description:"Directory path to save content with auto-generated filename (e.g., '/home/user/downloads'). Cannot be used with save_path."},filename:{type:"string",description:"Base filename to use when save_directory is specified (e.g., 'my-document'). Extension .md will be added automatically."}},required:["content"],anyOf:[{required:["save_path"]},{required:["save_directory"]}]},urlToMarkdownFile:{type:"object",properties:{url:{type:"string",description:"URL of the web page to convert and save as Markdown file (e.g., https://example.com). Handles JavaScript-rendered dynamic content effectively."},html_content:{type:"string",description:"HTML string to convert directly and save as Markdown file. Use instead of URL for local files or API response HTML content."},locale:{type:"string",description:"Browser locale setting. Use 'ja-JP' for Japanese sites, 'en-US' for English sites. Affects content rendering and language detection.",enum:["en-US","ja-JP"],default:"en-US"},save_path:{type:"string",description:"Complete file path including filename to save the converted Markdown content (e.g., '/home/user/output.md'). Cannot be used with save_directory."},save_directory:{type:"string",description:"Directory path to save the converted Markdown content with auto-generated filename (e.g., '/home/user/downloads'). Cannot be used with save_path."},filename:{type:"string",description:"Base filename to use when save_directory is specified (e.g., 'my-document'). Extension .md will be added automatically."}},anyOf:[{required:["url","save_path"]},{required:["url","save_directory"]},{required:["html_content","save_path"]},{required:["html_content","save_directory"]}]}},exports.SUPPORTED_PROTOCOL_VERSIONS=cs,exports.Server=class extends rc{constructor(e,t){super(t),this._serverInfo=e,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(li.options.map((e,t)=>[e,t])),this.isMessageIgnored=(e,t)=>{const r=this._loggingLevels.get(t);return!!r&&this.LOG_LEVEL_SEVERITY.get(e)<this.LOG_LEVEL_SEVERITY.get(r)},this._capabilities=t?.capabilities??{},this._instructions=t?.instructions,this._jsonSchemaValidator=t?.jsonSchemaValidator??new Ql,this.setRequestHandler(Gs,e=>this._oninitialize(e)),this.setNotificationHandler(Qs,()=>this.oninitialized?.()),this._capabilities.logging&&this.setRequestHandler(fi,async(e,t)=>{const r=t.sessionId||t.requestInfo?.headers["mcp-session-id"]||void 0,{level:n}=e.params,o=li.safeParse(n);return o.success&&this._loggingLevels.set(r,o.data),{}})}get experimental(){return this._experimental||(this._experimental={tasks:new Yl(this)}),this._experimental}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=function(e,t){const r={...e};for(const n in t){const e=n,o=t[e];if(void 0===o)continue;const s=r[e];nc(s)&&nc(o)?r[e]={...s,...o}:r[e]=o}return r}(this._capabilities,e)}setRequestHandler(e,t){const r=Sn(e),n=r?.method;if(!n)throw new Error("Schema is missing a method literal");let o;if(kn(n)){const e=n,t=e._zod?.def;o=t?.value??e.value}else{const e=n,t=e._def;o=t?.value??e.value}if("string"!=typeof o)throw new Error("Schema method literal must be a string");if("tools/call"===o){const r=async(e,r)=>{const n=En(ui,e);if(!n.success){const e=n.error instanceof Error?n.error.message:String(n.error);throw new Qi(Is.InvalidParams,`Invalid tools/call request: ${e}`)}const{params:o}=n.data,s=await Promise.resolve(t(e,r));if(o.task){const e=En(ca,s);if(!e.success){const t=e.error instanceof Error?e.error.message:String(e.error);throw new Qi(Is.InvalidParams,`Invalid task creation result: ${t}`)}return e.data}const a=En(ii,s);if(!a.success){const e=a.error instanceof Error?a.error.message:String(a.error);throw new Qi(Is.InvalidParams,`Invalid tools/call result: ${e}`)}return a.data};return super.setRequestHandler(e,r)}return super.setRequestHandler(e,t)}assertCapabilityForMethod(e){switch(e){case"sampling/createMessage":if(!this._clientCapabilities?.sampling)throw new Error(`Client does not support sampling (required for ${e})`);break;case"elicitation/create":if(!this._clientCapabilities?.elicitation)throw new Error(`Client does not support elicitation (required for ${e})`);break;case"roots/list":if(!this._clientCapabilities?.roots)throw new Error(`Client does not support listing roots (required for ${e})`)}}assertNotificationCapability(e){switch(e){case"notifications/message":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${e})`);break;case"notifications/resources/updated":case"notifications/resources/list_changed":if(!this._capabilities.resources)throw new Error(`Server does not support notifying about resources (required for ${e})`);break;case"notifications/tools/list_changed":if(!this._capabilities.tools)throw new Error(`Server does not support notifying of tool list changes (required for ${e})`);break;case"notifications/prompts/list_changed":if(!this._capabilities.prompts)throw new Error(`Server does not support notifying of prompt list changes (required for ${e})`);break;case"notifications/elicitation/complete":if(!this._clientCapabilities?.elicitation?.url)throw new Error(`Client does not support URL elicitation (required for ${e})`)}}assertRequestHandlerCapability(e){if(this._capabilities)switch(e){case"completion/complete":if(!this._capabilities.completions)throw new Error(`Server does not support completions (required for ${e})`);break;case"logging/setLevel":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!this._capabilities.prompts)throw new Error(`Server does not support prompts (required for ${e})`);break;case"resources/list":case"resources/templates/list":case"resources/read":if(!this._capabilities.resources)throw new Error(`Server does not support resources (required for ${e})`);break;case"tools/call":case"tools/list":if(!this._capabilities.tools)throw new Error(`Server does not support tools (required for ${e})`);break;case"tasks/get":case"tasks/list":case"tasks/result":case"tasks/cancel":if(!this._capabilities.tasks)throw new Error(`Server does not support tasks capability (required for ${e})`)}}assertTaskCapability(e){!function(e,t,r){if(!e)throw new Error(`${r} does not support task creation (required for ${t})`);switch(t){case"sampling/createMessage":if(!e.sampling?.createMessage)throw new Error(`${r} does not support task creation for sampling/createMessage (required for ${t})`);break;case"elicitation/create":if(!e.elicitation?.create)throw new Error(`${r} does not support task creation for elicitation/create (required for ${t})`)}}(this._clientCapabilities?.tasks?.requests,e,"Client")}assertTaskHandlerCapability(e){this._capabilities&&function(e,t,r){if(!e)throw new Error(`${r} does not support task creation (required for ${t})`);if("tools/call"===t&&!e.tools?.call)throw new Error(`${r} does not support task creation for tools/call (required for ${t})`)}(this._capabilities.tasks?.requests,e,"Server")}async _oninitialize(e){const t=e.params.protocolVersion;this._clientCapabilities=e.params.capabilities,this._clientVersion=e.params.clientInfo;return{protocolVersion:cs.includes(t)?t:is,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"},Rs)}async createMessage(e,t){if((e.tools||e.toolChoice)&&!this._clientCapabilities?.sampling?.tools)throw new Error("Client does not support sampling tools capability.");if(e.messages.length>0){const t=e.messages[e.messages.length-1],r=Array.isArray(t.content)?t.content:[t.content],n=r.some(e=>"tool_result"===e.type),o=e.messages.length>1?e.messages[e.messages.length-2]:void 0,s=o?Array.isArray(o.content)?o.content:[o.content]:[],a=s.some(e=>"tool_use"===e.type);if(n){if(r.some(e=>"tool_result"!==e.type))throw new Error("The last message must contain only tool_result content if any is present");if(!a)throw new Error("tool_result blocks are not matching any tool_use from the previous message")}if(a){const e=new Set(s.filter(e=>"tool_use"===e.type).map(e=>e.id)),t=new Set(r.filter(e=>"tool_result"===e.type).map(e=>e.toolUseId));if(e.size!==t.size||![...e].every(e=>t.has(e)))throw new Error("ids of tool_result blocks and tool_use blocks from previous message do not match")}}return e.tools?this.request({method:"sampling/createMessage",params:e},Pi,t):this.request({method:"sampling/createMessage",params:e},Si,t)}async elicitInput(e,t){switch(e.mode??"form"){case"url":{if(!this._clientCapabilities?.elicitation?.url)throw new Error("Client does not support url elicitation.");const r=e;return this.request({method:"elicitation/create",params:r},Vi,t)}case"form":{if(!this._clientCapabilities?.elicitation?.form)throw new Error("Client does not support form elicitation.");const n="form"===e.mode?e:{...e,mode:"form"},o=await this.request({method:"elicitation/create",params:n},Vi,t);if("accept"===o.action&&o.content&&n.requestedSchema)try{const e=this._jsonSchemaValidator.getValidator(n.requestedSchema)(o.content);if(!e.valid)throw new Qi(Is.InvalidParams,`Elicitation response content does not match requested schema: ${e.errorMessage}`)}catch(r){if(r instanceof Qi)throw r;throw new Qi(Is.InternalError,`Error validating elicitation response: ${r instanceof Error?r.message:String(r)}`)}return o}}}createElicitationCompletionNotifier(e,t){if(!this._clientCapabilities?.elicitation?.url)throw new Error("Client does not support URL elicitation (required for notifications/elicitation/complete)");return()=>this.notification({method:"notifications/elicitation/complete",params:{elicitationId:e}},t)}async listRoots(e,t){return this.request({method:"roots/list",params:e},Bi,t)}async sendLoggingMessage(e,t){if(this._capabilities.logging&&!this.isMessageIgnored(e.level,t))return this.notification({method:"notifications/message",params:e})}async sendResourceUpdated(e){return this.notification({method:"notifications/resources/updated",params:e})}async sendResourceListChanged(){return this.notification({method:"notifications/resources/list_changed"})}async sendToolListChanged(){return this.notification({method:"notifications/tools/list_changed"})}async sendPromptListChanged(){return this.notification({method:"notifications/prompts/list_changed"})}},exports.createErrorResult=function(e){return{content:[{type:"text",text:`Error: ${e instanceof Error?e.message:String(e)}`}],isError:!0}},exports.createSuccessResult=function(e){return{content:[{type:"text",text:e}],isError:!1}},exports.getPackageVersion=()=>{try{const e=o.fileURLToPath("undefined"==typeof document?require("url").pathToFileURL(e).href:a&&"SCRIPT"===a.tagName.toUpperCase()&&a.src||new URL("version-Dbzh6HLt.cjs",document.baseURI).href),t=n.dirname(e),s=n.resolve(t,"../package.json");return JSON.parse(r.readFileSync(s,"utf-8")).version||"0.0.0"}catch(e){return Xl.warn("Failed to read package version:",e),"0.0.0"}},exports.isInitializeRequest=e=>Gs.safeParse(e).success,exports.isJSONRPCErrorResponse=Os,exports.isJSONRPCRequest=Ps,exports.isJSONRPCResultResponse=xs,exports.parseHtmlToMarkdownArgs=function(e){if(!e||"object"!=typeof e)throw new Error("Arguments are required");const{url:t,html_content:r,locale:n="en-US"}=e;if(!t&&!r)throw new Error("Either 'url' or 'html_content' is required");if(t&&"string"!=typeof t)throw new Error("'url' must be a string");if(r&&"string"!=typeof r)throw new Error("'html_content' must be a string");if(n&&!["en-US","ja-JP"].includes(n))throw new Error("'locale' must be 'en-US' or 'ja-JP'");return{url:t,html_content:r,locale:n}},exports.parseSaveContentArgs=function(e){if(!e||"object"!=typeof e)throw new Error("Arguments are required");const{content:t,save_path:r,save_directory:n,filename:o}=e;if(!t||"string"!=typeof t)throw new Error("'content' is required and must be a string");if(!r&&!n)throw new Error("Either 'save_path' or 'save_directory' is required");if(r&&"string"!=typeof r)throw new Error("'save_path' must be a string");if(n&&"string"!=typeof n)throw new Error("'save_directory' must be a string");if(o&&"string"!=typeof o)throw new Error("'filename' must be a string");if(r&&n)throw new Error("Cannot specify both 'save_path' and 'save_directory'");return{content:t,save_path:r,save_directory:n,filename:o}},exports.parseUrlToMarkdownFileArgs=function(e){if(!e||"object"!=typeof e)throw new Error("Arguments are required");const{url:t,html_content:r,locale:n="en-US",save_path:o,save_directory:s,filename:a}=e;if(!t&&!r)throw new Error("Either 'url' or 'html_content' is required");if(t&&"string"!=typeof t)throw new Error("'url' must be a string");if(r&&"string"!=typeof r)throw new Error("'html_content' must be a string");if(n&&!["en-US","ja-JP"].includes(n))throw new Error("'locale' must be 'en-US' or 'ja-JP'");if(!o&&!s)throw new Error("Either 'save_path' or 'save_directory' is required");if(o&&"string"!=typeof o)throw new Error("'save_path' must be a string");if(s&&"string"!=typeof s)throw new Error("'save_directory' must be a string");if(a&&"string"!=typeof a)throw new Error("'filename' must be a string");if(o&&s)throw new Error("Cannot specify both 'save_path' and 'save_directory'");return{url:t,html_content:r,locale:n,save_path:o,save_directory:s,filename:a}},exports.saveContentToFile=async function(e,t,o,s){let a;if(t)a=n.resolve(t);else{if(!o)throw new Error("Either save_path or save_directory must be specified");{const e=s||"page",t=".md";a=n.resolve(o,`${e}${t}`)}}return await r.promises.mkdir(n.dirname(a),{recursive:!0}),await r.promises.writeFile(a,e,"utf-8"),a};
|