@softspark/jira-mcp 1.0.0
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/CHANGELOG.md +73 -0
- package/LICENSE +21 -0
- package/README.md +261 -0
- package/dist/cli.js +176 -0
- package/dist/index.d.ts +20 -0
- package/dist/index.js +149 -0
- package/package.json +81 -0
package/dist/cli.js
ADDED
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {homedir}from'os';import {join,dirname,resolve}from'path';import {mkdir,writeFile,readFile,rename,access}from'fs/promises';import uv from'process';import {Command}from'commander';var ik=Object.create;var la=Object.defineProperty;var ak=Object.getOwnPropertyDescriptor;var ck=Object.getOwnPropertyNames;var uk=Object.getPrototypeOf,lk=Object.prototype.hasOwnProperty;var g=(t,e)=>()=>(t&&(e=t(t=0)),e);var T=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Gn=(t,e)=>{for(var r in e)la(t,r,{get:e[r],enumerable:true});},dk=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of ck(e))!lk.call(t,o)&&o!==r&&la(t,o,{get:()=>e[o],enumerable:!(n=ak(e,o))||n.enumerable});return t};var Td=(t,e,r)=>(r=t!=null?ik(uk(t)):{},dk(la(r,"default",{value:t,enumerable:true}),t));var ls,da=g(()=>{ls="1.0.0";});var Pd={};Gn(Pd,{GLOBAL_CACHE_DIR:()=>rr,GLOBAL_CONFIG_DIR:()=>ye,GLOBAL_CONFIG_PATH:()=>fa,GLOBAL_CREDENTIALS_PATH:()=>ma,GLOBAL_STATE_PATH:()=>fk,GLOBAL_TASK_TEMPLATES_DIR:()=>en,GLOBAL_TEMPLATES_DIR:()=>zd,GLOBAL_USERS_PATH:()=>Wn,GLOBAL_WORKFLOWS_PATH:()=>Hn,ensureGlobalDirs:()=>mk});async function mk(){await mkdir(ye,{recursive:true}),await mkdir(rr,{recursive:true}),await mkdir(en,{recursive:true});}var ye,fa,ma,rr,Hn,Wn,fk,zd,en,we=g(()=>{ye=join(homedir(),".softspark","jira-mcp"),fa=join(ye,"config.json"),ma=join(ye,"credentials.json"),rr=join(ye,"cache"),Hn=join(rr,"workflows.json"),Wn=join(rr,"users.json"),fk=join(ye,"state.json"),zd=join(ye,"templates"),en=join(zd,"tasks");});async function Je(t){try{return await access(t),!0}catch{return false}}async function ds(t,e){await writeFile(t,e,{encoding:"utf-8",mode:384});}async function ft(t){let e=await readFile(t,"utf-8");return JSON.parse(e)}async function Ut(t,e){await writeFile(t,JSON.stringify(e,null,2),"utf-8");}var Xe=g(()=>{});var V,ya,z,zt,Yn=g(()=>{(function(t){t.assertEqual=o=>{};function e(o){}t.assertIs=e;function r(o){throw new Error}t.assertNever=r,t.arrayToEnum=o=>{let s={};for(let i of o)s[i]=i;return s},t.getValidEnumValues=o=>{let s=t.objectKeys(o).filter(a=>typeof o[o[a]]!="number"),i={};for(let a of s)i[a]=o[a];return t.objectValues(i)},t.objectValues=o=>t.objectKeys(o).map(function(s){return o[s]}),t.objectKeys=typeof Object.keys=="function"?o=>Object.keys(o):o=>{let s=[];for(let i in o)Object.prototype.hasOwnProperty.call(o,i)&&s.push(i);return s},t.find=(o,s)=>{for(let i of o)if(s(i))return i},t.isInteger=typeof Number.isInteger=="function"?o=>Number.isInteger(o):o=>typeof o=="number"&&Number.isFinite(o)&&Math.floor(o)===o;function n(o,s=" | "){return o.map(i=>typeof i=="string"?`'${i}'`:i).join(s)}t.joinValues=n,t.jsonStringifyReplacer=(o,s)=>typeof s=="bigint"?s.toString():s;})(V||(V={}));(function(t){t.mergeShapes=(e,r)=>({...e,...r});})(ya||(ya={}));z=V.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),zt=t=>{switch(typeof t){case "undefined":return z.undefined;case "string":return z.string;case "number":return Number.isNaN(t)?z.nan:z.number;case "boolean":return z.boolean;case "function":return z.function;case "bigint":return z.bigint;case "symbol":return z.symbol;case "object":return Array.isArray(t)?z.array:t===null?z.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?z.promise:typeof Map<"u"&&t instanceof Map?z.map:typeof Set<"u"&&t instanceof Set?z.set:typeof Date<"u"&&t instanceof Date?z.date:z.object;default:return z.unknown}};});var v,Zk,Ve,fs=g(()=>{Yn();v=V.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),Zk=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:"),Ve=class t extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n];},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n];};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=e;}format(e){let r=e||function(s){return s.message},n={_errors:[]},o=s=>{for(let i of s.issues)if(i.code==="invalid_union")i.unionErrors.map(o);else if(i.code==="invalid_return_type")o(i.returnTypeError);else if(i.code==="invalid_arguments")o(i.argumentsError);else if(i.path.length===0)n._errors.push(r(i));else {let a=n,c=0;for(;c<i.path.length;){let u=i.path[c];c===i.path.length-1?(a[u]=a[u]||{_errors:[]},a[u]._errors.push(r(i))):a[u]=a[u]||{_errors:[]},a=a[u],c++;}}};return o(this),n}static assert(e){if(!(e instanceof t))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,V.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=r=>r.message){let r={},n=[];for(let o of this.issues)if(o.path.length>0){let s=o.path[0];r[s]=r[s]||[],r[s].push(e(o));}else n.push(e(o));return {formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};Ve.create=t=>new Ve(t);});var Mk,Ft,_a=g(()=>{fs();Yn();Mk=(t,e)=>{let r;switch(t.code){case v.invalid_type:t.received===z.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case v.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,V.jsonStringifyReplacer)}`;break;case v.unrecognized_keys:r=`Unrecognized key(s) in object: ${V.joinValues(t.keys,", ")}`;break;case v.invalid_union:r="Invalid input";break;case v.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${V.joinValues(t.options)}`;break;case v.invalid_enum_value:r=`Invalid enum value. Expected ${V.joinValues(t.options)}, received '${t.received}'`;break;case v.invalid_arguments:r="Invalid function arguments";break;case v.invalid_return_type:r="Invalid function return type";break;case v.invalid_date:r="Invalid date";break;case v.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(r=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?r=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?r=`Invalid input: must end with "${t.validation.endsWith}"`:V.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case v.too_small:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:r="Invalid input";break;case v.too_big:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?r=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:r="Invalid input";break;case v.custom:r="Invalid input";break;case v.invalid_intersection_types:r="Intersection results could not be merged";break;case v.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case v.not_finite:r="Number must be finite";break;default:r=e.defaultError,V.assertNever(t);}return {message:r}},Ft=Mk;});function Dk(t){Ad=t;}function rn(){return Ad}var Ad,ms=g(()=>{_a();Ad=Ft;});function S(t,e){let r=rn(),n=Qn({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===Ft?void 0:Ft].filter(o=>!!o)});t.common.issues.push(n);}var Qn,qk,Se,O,xr,Ie,hs,gs,nr,nn,va=g(()=>{ms();_a();Qn=t=>{let{data:e,path:r,errorMaps:n,issueData:o}=t,s=[...r,...o.path||[]],i={...o,path:s};if(o.message!==void 0)return {...o,path:s,message:o.message};let a="",c=n.filter(u=>!!u).slice().reverse();for(let u of c)a=u(i,{data:e,defaultError:a}).message;return {...o,path:s,message:a}},qk=[];Se=class t{constructor(){this.value="valid";}dirty(){this.value==="valid"&&(this.value="dirty");}abort(){this.value!=="aborted"&&(this.value="aborted");}static mergeArray(e,r){let n=[];for(let o of r){if(o.status==="aborted")return O;o.status==="dirty"&&e.dirty(),n.push(o.value);}return {status:e.value,value:n}}static async mergeObjectAsync(e,r){let n=[];for(let o of r){let s=await o.key,i=await o.value;n.push({key:s,value:i});}return t.mergeObjectSync(e,n)}static mergeObjectSync(e,r){let n={};for(let o of r){let{key:s,value:i}=o;if(s.status==="aborted"||i.status==="aborted")return O;s.status==="dirty"&&e.dirty(),i.status==="dirty"&&e.dirty(),s.value!=="__proto__"&&(typeof i.value<"u"||o.alwaysSet)&&(n[s.value]=i.value);}return {status:e.value,value:n}}},O=Object.freeze({status:"aborted"}),xr=t=>({status:"dirty",value:t}),Ie=t=>({status:"valid",value:t}),hs=t=>t.status==="aborted",gs=t=>t.status==="dirty",nr=t=>t.status==="valid",nn=t=>typeof Promise<"u"&&t instanceof Promise;});var Zd=g(()=>{});var E,Md=g(()=>{(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message;})(E||(E={}));});function M(t){if(!t)return {};let{errorMap:e,invalid_type_error:r,required_error:n,description:o}=t;if(e&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:o}:{errorMap:(i,a)=>{let{message:c}=t;return i.code==="invalid_enum_value"?{message:c??a.defaultError}:typeof a.data>"u"?{message:c??n??a.defaultError}:i.code!=="invalid_type"?{message:a.defaultError}:{message:c??r??a.defaultError}},description:o}}function Ud(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);let r=t.precision?"+":"?";return `([01]\\d|2[0-3]):[0-5]\\d(:${e})${r}`}function nw(t){return new RegExp(`^${Ud(t)}$`)}function Fd(t){let e=`${Ld}T${Ud(t)}`,r=[];return r.push(t.local?"Z?":"Z"),t.offset&&r.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${r.join("|")})`,new RegExp(`^${e}$`)}function ow(t,e){return !!((e==="v4"||!e)&&Kk.test(t)||(e==="v6"||!e)&&Qk.test(t))}function sw(t,e){if(!Bk.test(t))return false;try{let[r]=t.split(".");if(!r)return !1;let n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),o=JSON.parse(atob(n));return !(typeof o!="object"||o===null||"typ"in o&&o?.typ!=="JWT"||!o.alg||e&&o.alg!==e)}catch{return false}}function iw(t,e){return !!((e==="v4"||!e)&&Yk.test(t)||(e==="v6"||!e)&&Xk.test(t))}function aw(t,e){let r=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,o=r>n?r:n,s=Number.parseInt(t.toFixed(o).replace(".","")),i=Number.parseInt(e.toFixed(o).replace(".",""));return s%i/10**o}function on(t){if(t instanceof Be){let e={};for(let r in t.shape){let n=t.shape[r];e[r]=et.create(on(n));}return new Be({...t._def,shape:()=>e})}else return t instanceof Bt?new Bt({...t._def,type:on(t.element)}):t instanceof et?et.create(on(t.unwrap())):t instanceof Et?Et.create(on(t.unwrap())):t instanceof Pt?Pt.create(t.items.map(e=>on(e))):t}function wa(t,e){let r=zt(t),n=zt(e);if(t===e)return {valid:true,data:t};if(r===z.object&&n===z.object){let o=V.objectKeys(e),s=V.objectKeys(t).filter(a=>o.indexOf(a)!==-1),i={...t,...e};for(let a of s){let c=wa(t[a],e[a]);if(!c.valid)return {valid:false};i[a]=c.data;}return {valid:true,data:i}}else if(r===z.array&&n===z.array){if(t.length!==e.length)return {valid:false};let o=[];for(let s=0;s<t.length;s++){let i=t[s],a=e[s],c=wa(i,a);if(!c.valid)return {valid:false};o.push(c.data);}return {valid:true,data:o}}else return r===z.date&&n===z.date&&+t==+e?{valid:true,data:t}:{valid:false}}function Jd(t,e){return new Ir({values:t,typeName:A.ZodEnum,...M(e)})}function qd(t,e){let r=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof r=="string"?{message:r}:r}function Vd(t,e={},r){return t?sr.create().superRefine((n,o)=>{let s=t(n);if(s instanceof Promise)return s.then(i=>{if(!i){let a=qd(e,n),c=a.fatal??r??true;o.addIssue({code:"custom",...a,fatal:c});}});if(!s){let i=qd(e,n),a=i.fatal??r??true;o.addIssue({code:"custom",...i,fatal:a});}}):sr.create()}var tt,Dd,L,Lk,Uk,Fk,Jk,Vk,Bk,Gk,Hk,Wk,ka,Kk,Yk,Qk,Xk,ew,tw,Ld,rw,or,br,$r,Sr,Tr,sn,zr,Pr,sr,Vt,mt,an,Bt,Be,Er,Jt,ys,Cr,Pt,_s,cn,un,vs,jr,Rr,Ir,Or,ir,rt,et,Et,Nr,Ar,ln,cw,Xn,eo,Zr,uw,A,lw,Bd,Gd,dw,pw,Hd,fw,mw,hw,gw,yw,_w,vw,kw,ww,xw,bw,$w,Sw,Tw,zw,Pw,Ew,Cw,jw,Rw,Iw,Ow,Nw,Aw,Zw,Mw,Dw,qw,Lw,Uw,Fw,Jw,Vw,Bw,Wd=g(()=>{fs();ms();Md();va();Yn();tt=class{constructor(e,r,n,o){this._cachedPath=[],this.parent=e,this.data=r,this._path=n,this._key=o;}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},Dd=(t,e)=>{if(nr(e))return {success:true,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return {success:false,get error(){if(this._error)return this._error;let r=new Ve(t.common.issues);return this._error=r,this._error}}};L=class{get description(){return this._def.description}_getType(e){return zt(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:zt(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return {status:new Se,ctx:{common:e.parent.common,data:e.data,parsedType:zt(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let r=this._parse(e);if(nn(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(e){let r=this._parse(e);return Promise.resolve(r)}parse(e,r){let n=this.safeParse(e,r);if(n.success)return n.data;throw n.error}safeParse(e,r){let n={common:{issues:[],async:r?.async??false,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:zt(e)},o=this._parseSync({data:e,path:n.path,parent:n});return Dd(n,o)}"~validate"(e){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:zt(e)};if(!this["~standard"].async)try{let n=this._parseSync({data:e,path:[],parent:r});return nr(n)?{value:n.value}:{issues:r.common.issues}}catch(n){n?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=true),r.common={issues:[],async:true};}return this._parseAsync({data:e,path:[],parent:r}).then(n=>nr(n)?{value:n.value}:{issues:r.common.issues})}async parseAsync(e,r){let n=await this.safeParseAsync(e,r);if(n.success)return n.data;throw n.error}async safeParseAsync(e,r){let n={common:{issues:[],contextualErrorMap:r?.errorMap,async:true},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:zt(e)},o=this._parse({data:e,path:n.path,parent:n}),s=await(nn(o)?o:Promise.resolve(o));return Dd(n,s)}refine(e,r){let n=o=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(o):r;return this._refinement((o,s)=>{let i=e(o),a=()=>s.addIssue({code:v.custom,...n(o)});return typeof Promise<"u"&&i instanceof Promise?i.then(c=>c?true:(a(),false)):i?true:(a(),false)})}refinement(e,r){return this._refinement((n,o)=>e(n)?true:(o.addIssue(typeof r=="function"?r(n,o):r),false))}_refinement(e){return new rt({schema:this,typeName:A.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:r=>this["~validate"](r)};}optional(){return et.create(this,this._def)}nullable(){return Et.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Bt.create(this)}promise(){return ir.create(this,this._def)}or(e){return Er.create([this,e],this._def)}and(e){return Cr.create(this,e,this._def)}transform(e){return new rt({...M(this._def),schema:this,typeName:A.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new Nr({...M(this._def),innerType:this,defaultValue:r,typeName:A.ZodDefault})}brand(){return new Xn({typeName:A.ZodBranded,type:this,...M(this._def)})}catch(e){let r=typeof e=="function"?e:()=>e;return new Ar({...M(this._def),innerType:this,catchValue:r,typeName:A.ZodCatch})}describe(e){let r=this.constructor;return new r({...this._def,description:e})}pipe(e){return eo.create(this,e)}readonly(){return Zr.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},Lk=/^c[^\s-]{8,}$/i,Uk=/^[0-9a-z]+$/,Fk=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Jk=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,Vk=/^[a-z0-9_-]{21}$/i,Bk=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Gk=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Hk=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Wk="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Kk=/^(?:(?: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])$/,Yk=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,Qk=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,Xk=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,ew=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,tw=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Ld="((\\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])))",rw=new RegExp(`^${Ld}$`);or=class t extends L{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==z.string){let s=this._getOrReturnCtx(e);return S(s,{code:v.invalid_type,expected:z.string,received:s.parsedType}),O}let n=new Se,o;for(let s of this._def.checks)if(s.kind==="min")e.data.length<s.value&&(o=this._getOrReturnCtx(e,o),S(o,{code:v.too_small,minimum:s.value,type:"string",inclusive:true,exact:false,message:s.message}),n.dirty());else if(s.kind==="max")e.data.length>s.value&&(o=this._getOrReturnCtx(e,o),S(o,{code:v.too_big,maximum:s.value,type:"string",inclusive:true,exact:false,message:s.message}),n.dirty());else if(s.kind==="length"){let i=e.data.length>s.value,a=e.data.length<s.value;(i||a)&&(o=this._getOrReturnCtx(e,o),i?S(o,{code:v.too_big,maximum:s.value,type:"string",inclusive:true,exact:true,message:s.message}):a&&S(o,{code:v.too_small,minimum:s.value,type:"string",inclusive:true,exact:true,message:s.message}),n.dirty());}else if(s.kind==="email")Hk.test(e.data)||(o=this._getOrReturnCtx(e,o),S(o,{validation:"email",code:v.invalid_string,message:s.message}),n.dirty());else if(s.kind==="emoji")ka||(ka=new RegExp(Wk,"u")),ka.test(e.data)||(o=this._getOrReturnCtx(e,o),S(o,{validation:"emoji",code:v.invalid_string,message:s.message}),n.dirty());else if(s.kind==="uuid")Jk.test(e.data)||(o=this._getOrReturnCtx(e,o),S(o,{validation:"uuid",code:v.invalid_string,message:s.message}),n.dirty());else if(s.kind==="nanoid")Vk.test(e.data)||(o=this._getOrReturnCtx(e,o),S(o,{validation:"nanoid",code:v.invalid_string,message:s.message}),n.dirty());else if(s.kind==="cuid")Lk.test(e.data)||(o=this._getOrReturnCtx(e,o),S(o,{validation:"cuid",code:v.invalid_string,message:s.message}),n.dirty());else if(s.kind==="cuid2")Uk.test(e.data)||(o=this._getOrReturnCtx(e,o),S(o,{validation:"cuid2",code:v.invalid_string,message:s.message}),n.dirty());else if(s.kind==="ulid")Fk.test(e.data)||(o=this._getOrReturnCtx(e,o),S(o,{validation:"ulid",code:v.invalid_string,message:s.message}),n.dirty());else if(s.kind==="url")try{new URL(e.data);}catch{o=this._getOrReturnCtx(e,o),S(o,{validation:"url",code:v.invalid_string,message:s.message}),n.dirty();}else s.kind==="regex"?(s.regex.lastIndex=0,s.regex.test(e.data)||(o=this._getOrReturnCtx(e,o),S(o,{validation:"regex",code:v.invalid_string,message:s.message}),n.dirty())):s.kind==="trim"?e.data=e.data.trim():s.kind==="includes"?e.data.includes(s.value,s.position)||(o=this._getOrReturnCtx(e,o),S(o,{code:v.invalid_string,validation:{includes:s.value,position:s.position},message:s.message}),n.dirty()):s.kind==="toLowerCase"?e.data=e.data.toLowerCase():s.kind==="toUpperCase"?e.data=e.data.toUpperCase():s.kind==="startsWith"?e.data.startsWith(s.value)||(o=this._getOrReturnCtx(e,o),S(o,{code:v.invalid_string,validation:{startsWith:s.value},message:s.message}),n.dirty()):s.kind==="endsWith"?e.data.endsWith(s.value)||(o=this._getOrReturnCtx(e,o),S(o,{code:v.invalid_string,validation:{endsWith:s.value},message:s.message}),n.dirty()):s.kind==="datetime"?Fd(s).test(e.data)||(o=this._getOrReturnCtx(e,o),S(o,{code:v.invalid_string,validation:"datetime",message:s.message}),n.dirty()):s.kind==="date"?rw.test(e.data)||(o=this._getOrReturnCtx(e,o),S(o,{code:v.invalid_string,validation:"date",message:s.message}),n.dirty()):s.kind==="time"?nw(s).test(e.data)||(o=this._getOrReturnCtx(e,o),S(o,{code:v.invalid_string,validation:"time",message:s.message}),n.dirty()):s.kind==="duration"?Gk.test(e.data)||(o=this._getOrReturnCtx(e,o),S(o,{validation:"duration",code:v.invalid_string,message:s.message}),n.dirty()):s.kind==="ip"?ow(e.data,s.version)||(o=this._getOrReturnCtx(e,o),S(o,{validation:"ip",code:v.invalid_string,message:s.message}),n.dirty()):s.kind==="jwt"?sw(e.data,s.alg)||(o=this._getOrReturnCtx(e,o),S(o,{validation:"jwt",code:v.invalid_string,message:s.message}),n.dirty()):s.kind==="cidr"?iw(e.data,s.version)||(o=this._getOrReturnCtx(e,o),S(o,{validation:"cidr",code:v.invalid_string,message:s.message}),n.dirty()):s.kind==="base64"?ew.test(e.data)||(o=this._getOrReturnCtx(e,o),S(o,{validation:"base64",code:v.invalid_string,message:s.message}),n.dirty()):s.kind==="base64url"?tw.test(e.data)||(o=this._getOrReturnCtx(e,o),S(o,{validation:"base64url",code:v.invalid_string,message:s.message}),n.dirty()):V.assertNever(s);return {status:n.value,value:e.data}}_regex(e,r,n){return this.refinement(o=>e.test(o),{validation:r,code:v.invalid_string,...E.errToObj(n)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...E.errToObj(e)})}url(e){return this._addCheck({kind:"url",...E.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...E.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...E.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...E.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...E.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...E.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...E.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...E.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...E.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...E.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...E.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...E.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:false,local:false,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??false,local:e?.local??false,...E.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...E.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...E.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...E.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r?.position,...E.errToObj(r?.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...E.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...E.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...E.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...E.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...E.errToObj(r)})}nonempty(e){return this.min(1,E.errToObj(e))}trim(){return new t({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return !!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return !!this._def.checks.find(e=>e.kind==="date")}get isTime(){return !!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return !!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return !!this._def.checks.find(e=>e.kind==="email")}get isURL(){return !!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return !!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return !!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return !!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return !!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return !!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return !!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return !!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return !!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return !!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return !!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxLength(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};or.create=t=>new or({checks:[],typeName:A.ZodString,coerce:t?.coerce??false,...M(t)});br=class t extends L{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf;}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==z.number){let s=this._getOrReturnCtx(e);return S(s,{code:v.invalid_type,expected:z.number,received:s.parsedType}),O}let n,o=new Se;for(let s of this._def.checks)s.kind==="int"?V.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),S(n,{code:v.invalid_type,expected:"integer",received:"float",message:s.message}),o.dirty()):s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(n=this._getOrReturnCtx(e,n),S(n,{code:v.too_small,minimum:s.value,type:"number",inclusive:s.inclusive,exact:false,message:s.message}),o.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(n=this._getOrReturnCtx(e,n),S(n,{code:v.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:false,message:s.message}),o.dirty()):s.kind==="multipleOf"?aw(e.data,s.value)!==0&&(n=this._getOrReturnCtx(e,n),S(n,{code:v.not_multiple_of,multipleOf:s.value,message:s.message}),o.dirty()):s.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),S(n,{code:v.not_finite,message:s.message}),o.dirty()):V.assertNever(s);return {status:o.value,value:e.data}}gte(e,r){return this.setLimit("min",e,true,E.toString(r))}gt(e,r){return this.setLimit("min",e,false,E.toString(r))}lte(e,r){return this.setLimit("max",e,true,E.toString(r))}lt(e,r){return this.setLimit("max",e,false,E.toString(r))}setLimit(e,r,n,o){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:E.toString(o)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:E.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:false,message:E.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:false,message:E.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:true,message:E.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:true,message:E.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:E.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:E.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:true,value:Number.MIN_SAFE_INTEGER,message:E.toString(e)})._addCheck({kind:"max",inclusive:true,value:Number.MAX_SAFE_INTEGER,message:E.toString(e)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}get isInt(){return !!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&V.isInteger(e.value))}get isFinite(){let e=null,r=null;for(let n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return true;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);}return Number.isFinite(r)&&Number.isFinite(e)}};br.create=t=>new br({checks:[],typeName:A.ZodNumber,coerce:t?.coerce||false,...M(t)});$r=class t extends L{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte;}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data);}catch{return this._getInvalidInput(e)}if(this._getType(e)!==z.bigint)return this._getInvalidInput(e);let n,o=new Se;for(let s of this._def.checks)s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(n=this._getOrReturnCtx(e,n),S(n,{code:v.too_small,type:"bigint",minimum:s.value,inclusive:s.inclusive,message:s.message}),o.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(n=this._getOrReturnCtx(e,n),S(n,{code:v.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),o.dirty()):s.kind==="multipleOf"?e.data%s.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),S(n,{code:v.not_multiple_of,multipleOf:s.value,message:s.message}),o.dirty()):V.assertNever(s);return {status:o.value,value:e.data}}_getInvalidInput(e){let r=this._getOrReturnCtx(e);return S(r,{code:v.invalid_type,expected:z.bigint,received:r.parsedType}),O}gte(e,r){return this.setLimit("min",e,true,E.toString(r))}gt(e,r){return this.setLimit("min",e,false,E.toString(r))}lte(e,r){return this.setLimit("max",e,true,E.toString(r))}lt(e,r){return this.setLimit("max",e,false,E.toString(r))}setLimit(e,r,n,o){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:E.toString(o)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:false,message:E.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:false,message:E.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:true,message:E.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:true,message:E.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:E.toString(r)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};$r.create=t=>new $r({checks:[],typeName:A.ZodBigInt,coerce:t?.coerce??false,...M(t)});Sr=class extends L{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==z.boolean){let n=this._getOrReturnCtx(e);return S(n,{code:v.invalid_type,expected:z.boolean,received:n.parsedType}),O}return Ie(e.data)}};Sr.create=t=>new Sr({typeName:A.ZodBoolean,coerce:t?.coerce||false,...M(t)});Tr=class t extends L{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==z.date){let s=this._getOrReturnCtx(e);return S(s,{code:v.invalid_type,expected:z.date,received:s.parsedType}),O}if(Number.isNaN(e.data.getTime())){let s=this._getOrReturnCtx(e);return S(s,{code:v.invalid_date}),O}let n=new Se,o;for(let s of this._def.checks)s.kind==="min"?e.data.getTime()<s.value&&(o=this._getOrReturnCtx(e,o),S(o,{code:v.too_small,message:s.message,inclusive:true,exact:false,minimum:s.value,type:"date"}),n.dirty()):s.kind==="max"?e.data.getTime()>s.value&&(o=this._getOrReturnCtx(e,o),S(o,{code:v.too_big,message:s.message,inclusive:true,exact:false,maximum:s.value,type:"date"}),n.dirty()):V.assertNever(s);return {status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}min(e,r){return this._addCheck({kind:"min",value:e.getTime(),message:E.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:E.toString(r)})}get minDate(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e!=null?new Date(e):null}};Tr.create=t=>new Tr({checks:[],coerce:t?.coerce||false,typeName:A.ZodDate,...M(t)});sn=class extends L{_parse(e){if(this._getType(e)!==z.symbol){let n=this._getOrReturnCtx(e);return S(n,{code:v.invalid_type,expected:z.symbol,received:n.parsedType}),O}return Ie(e.data)}};sn.create=t=>new sn({typeName:A.ZodSymbol,...M(t)});zr=class extends L{_parse(e){if(this._getType(e)!==z.undefined){let n=this._getOrReturnCtx(e);return S(n,{code:v.invalid_type,expected:z.undefined,received:n.parsedType}),O}return Ie(e.data)}};zr.create=t=>new zr({typeName:A.ZodUndefined,...M(t)});Pr=class extends L{_parse(e){if(this._getType(e)!==z.null){let n=this._getOrReturnCtx(e);return S(n,{code:v.invalid_type,expected:z.null,received:n.parsedType}),O}return Ie(e.data)}};Pr.create=t=>new Pr({typeName:A.ZodNull,...M(t)});sr=class extends L{constructor(){super(...arguments),this._any=true;}_parse(e){return Ie(e.data)}};sr.create=t=>new sr({typeName:A.ZodAny,...M(t)});Vt=class extends L{constructor(){super(...arguments),this._unknown=true;}_parse(e){return Ie(e.data)}};Vt.create=t=>new Vt({typeName:A.ZodUnknown,...M(t)});mt=class extends L{_parse(e){let r=this._getOrReturnCtx(e);return S(r,{code:v.invalid_type,expected:z.never,received:r.parsedType}),O}};mt.create=t=>new mt({typeName:A.ZodNever,...M(t)});an=class extends L{_parse(e){if(this._getType(e)!==z.undefined){let n=this._getOrReturnCtx(e);return S(n,{code:v.invalid_type,expected:z.void,received:n.parsedType}),O}return Ie(e.data)}};an.create=t=>new an({typeName:A.ZodVoid,...M(t)});Bt=class t extends L{_parse(e){let{ctx:r,status:n}=this._processInputParams(e),o=this._def;if(r.parsedType!==z.array)return S(r,{code:v.invalid_type,expected:z.array,received:r.parsedType}),O;if(o.exactLength!==null){let i=r.data.length>o.exactLength.value,a=r.data.length<o.exactLength.value;(i||a)&&(S(r,{code:i?v.too_big:v.too_small,minimum:a?o.exactLength.value:void 0,maximum:i?o.exactLength.value:void 0,type:"array",inclusive:true,exact:true,message:o.exactLength.message}),n.dirty());}if(o.minLength!==null&&r.data.length<o.minLength.value&&(S(r,{code:v.too_small,minimum:o.minLength.value,type:"array",inclusive:true,exact:false,message:o.minLength.message}),n.dirty()),o.maxLength!==null&&r.data.length>o.maxLength.value&&(S(r,{code:v.too_big,maximum:o.maxLength.value,type:"array",inclusive:true,exact:false,message:o.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((i,a)=>o.type._parseAsync(new tt(r,i,r.path,a)))).then(i=>Se.mergeArray(n,i));let s=[...r.data].map((i,a)=>o.type._parseSync(new tt(r,i,r.path,a)));return Se.mergeArray(n,s)}get element(){return this._def.type}min(e,r){return new t({...this._def,minLength:{value:e,message:E.toString(r)}})}max(e,r){return new t({...this._def,maxLength:{value:e,message:E.toString(r)}})}length(e,r){return new t({...this._def,exactLength:{value:e,message:E.toString(r)}})}nonempty(e){return this.min(1,e)}};Bt.create=(t,e)=>new Bt({type:t,minLength:null,maxLength:null,exactLength:null,typeName:A.ZodArray,...M(e)});Be=class t extends L{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend;}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),r=V.objectKeys(e);return this._cached={shape:e,keys:r},this._cached}_parse(e){if(this._getType(e)!==z.object){let u=this._getOrReturnCtx(e);return S(u,{code:v.invalid_type,expected:z.object,received:u.parsedType}),O}let{status:n,ctx:o}=this._processInputParams(e),{shape:s,keys:i}=this._getCached(),a=[];if(!(this._def.catchall instanceof mt&&this._def.unknownKeys==="strip"))for(let u in o.data)i.includes(u)||a.push(u);let c=[];for(let u of i){let l=s[u],d=o.data[u];c.push({key:{status:"valid",value:u},value:l._parse(new tt(o,d,o.path,u)),alwaysSet:u in o.data});}if(this._def.catchall instanceof mt){let u=this._def.unknownKeys;if(u==="passthrough")for(let l of a)c.push({key:{status:"valid",value:l},value:{status:"valid",value:o.data[l]}});else if(u==="strict")a.length>0&&(S(o,{code:v.unrecognized_keys,keys:a}),n.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else {let u=this._def.catchall;for(let l of a){let d=o.data[l];c.push({key:{status:"valid",value:l},value:u._parse(new tt(o,d,o.path,l)),alwaysSet:l in o.data});}}return o.common.async?Promise.resolve().then(async()=>{let u=[];for(let l of c){let d=await l.key,p=await l.value;u.push({key:d,value:p,alwaysSet:l.alwaysSet});}return u}).then(u=>Se.mergeObjectSync(n,u)):Se.mergeObjectSync(n,c)}get shape(){return this._def.shape()}strict(e){return E.errToObj,new t({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,n)=>{let o=this._def.errorMap?.(r,n).message??n.defaultError;return r.code==="unrecognized_keys"?{message:E.errToObj(e).message??o}:{message:o}}}:{}})}strip(){return new t({...this._def,unknownKeys:"strip"})}passthrough(){return new t({...this._def,unknownKeys:"passthrough"})}extend(e){return new t({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new t({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:A.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new t({...this._def,catchall:e})}pick(e){let r={};for(let n of V.objectKeys(e))e[n]&&this.shape[n]&&(r[n]=this.shape[n]);return new t({...this._def,shape:()=>r})}omit(e){let r={};for(let n of V.objectKeys(this.shape))e[n]||(r[n]=this.shape[n]);return new t({...this._def,shape:()=>r})}deepPartial(){return on(this)}partial(e){let r={};for(let n of V.objectKeys(this.shape)){let o=this.shape[n];e&&!e[n]?r[n]=o:r[n]=o.optional();}return new t({...this._def,shape:()=>r})}required(e){let r={};for(let n of V.objectKeys(this.shape))if(e&&!e[n])r[n]=this.shape[n];else {let s=this.shape[n];for(;s instanceof et;)s=s._def.innerType;r[n]=s;}return new t({...this._def,shape:()=>r})}keyof(){return Jd(V.objectKeys(this.shape))}};Be.create=(t,e)=>new Be({shape:()=>t,unknownKeys:"strip",catchall:mt.create(),typeName:A.ZodObject,...M(e)});Be.strictCreate=(t,e)=>new Be({shape:()=>t,unknownKeys:"strict",catchall:mt.create(),typeName:A.ZodObject,...M(e)});Be.lazycreate=(t,e)=>new Be({shape:t,unknownKeys:"strip",catchall:mt.create(),typeName:A.ZodObject,...M(e)});Er=class extends L{_parse(e){let{ctx:r}=this._processInputParams(e),n=this._def.options;function o(s){for(let a of s)if(a.result.status==="valid")return a.result;for(let a of s)if(a.result.status==="dirty")return r.common.issues.push(...a.ctx.common.issues),a.result;let i=s.map(a=>new Ve(a.ctx.common.issues));return S(r,{code:v.invalid_union,unionErrors:i}),O}if(r.common.async)return Promise.all(n.map(async s=>{let i={...r,common:{...r.common,issues:[]},parent:null};return {result:await s._parseAsync({data:r.data,path:r.path,parent:i}),ctx:i}})).then(o);{let s,i=[];for(let c of n){let u={...r,common:{...r.common,issues:[]},parent:null},l=c._parseSync({data:r.data,path:r.path,parent:u});if(l.status==="valid")return l;l.status==="dirty"&&!s&&(s={result:l,ctx:u}),u.common.issues.length&&i.push(u.common.issues);}if(s)return r.common.issues.push(...s.ctx.common.issues),s.result;let a=i.map(c=>new Ve(c));return S(r,{code:v.invalid_union,unionErrors:a}),O}}get options(){return this._def.options}};Er.create=(t,e)=>new Er({options:t,typeName:A.ZodUnion,...M(e)});Jt=t=>t instanceof jr?Jt(t.schema):t instanceof rt?Jt(t.innerType()):t instanceof Rr?[t.value]:t instanceof Ir?t.options:t instanceof Or?V.objectValues(t.enum):t instanceof Nr?Jt(t._def.innerType):t instanceof zr?[void 0]:t instanceof Pr?[null]:t instanceof et?[void 0,...Jt(t.unwrap())]:t instanceof Et?[null,...Jt(t.unwrap())]:t instanceof Xn||t instanceof Zr?Jt(t.unwrap()):t instanceof Ar?Jt(t._def.innerType):[],ys=class t extends L{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==z.object)return S(r,{code:v.invalid_type,expected:z.object,received:r.parsedType}),O;let n=this.discriminator,o=r.data[n],s=this.optionsMap.get(o);return s?r.common.async?s._parseAsync({data:r.data,path:r.path,parent:r}):s._parseSync({data:r.data,path:r.path,parent:r}):(S(r,{code:v.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),O)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,r,n){let o=new Map;for(let s of r){let i=Jt(s.shape[e]);if(!i.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let a of i){if(o.has(a))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(a)}`);o.set(a,s);}}return new t({typeName:A.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:o,...M(n)})}};Cr=class extends L{_parse(e){let{status:r,ctx:n}=this._processInputParams(e),o=(s,i)=>{if(hs(s)||hs(i))return O;let a=wa(s.value,i.value);return a.valid?((gs(s)||gs(i))&&r.dirty(),{status:r.value,value:a.data}):(S(n,{code:v.invalid_intersection_types}),O)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([s,i])=>o(s,i)):o(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};Cr.create=(t,e,r)=>new Cr({left:t,right:e,typeName:A.ZodIntersection,...M(r)});Pt=class t extends L{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==z.array)return S(n,{code:v.invalid_type,expected:z.array,received:n.parsedType}),O;if(n.data.length<this._def.items.length)return S(n,{code:v.too_small,minimum:this._def.items.length,inclusive:true,exact:false,type:"array"}),O;!this._def.rest&&n.data.length>this._def.items.length&&(S(n,{code:v.too_big,maximum:this._def.items.length,inclusive:true,exact:false,type:"array"}),r.dirty());let s=[...n.data].map((i,a)=>{let c=this._def.items[a]||this._def.rest;return c?c._parse(new tt(n,i,n.path,a)):null}).filter(i=>!!i);return n.common.async?Promise.all(s).then(i=>Se.mergeArray(r,i)):Se.mergeArray(r,s)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};Pt.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Pt({items:t,typeName:A.ZodTuple,rest:null,...M(e)})};_s=class t extends L{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==z.object)return S(n,{code:v.invalid_type,expected:z.object,received:n.parsedType}),O;let o=[],s=this._def.keyType,i=this._def.valueType;for(let a in n.data)o.push({key:s._parse(new tt(n,a,n.path,a)),value:i._parse(new tt(n,n.data[a],n.path,a)),alwaysSet:a in n.data});return n.common.async?Se.mergeObjectAsync(r,o):Se.mergeObjectSync(r,o)}get element(){return this._def.valueType}static create(e,r,n){return r instanceof L?new t({keyType:e,valueType:r,typeName:A.ZodRecord,...M(n)}):new t({keyType:or.create(),valueType:e,typeName:A.ZodRecord,...M(r)})}},cn=class extends L{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==z.map)return S(n,{code:v.invalid_type,expected:z.map,received:n.parsedType}),O;let o=this._def.keyType,s=this._def.valueType,i=[...n.data.entries()].map(([a,c],u)=>({key:o._parse(new tt(n,a,n.path,[u,"key"])),value:s._parse(new tt(n,c,n.path,[u,"value"]))}));if(n.common.async){let a=new Map;return Promise.resolve().then(async()=>{for(let c of i){let u=await c.key,l=await c.value;if(u.status==="aborted"||l.status==="aborted")return O;(u.status==="dirty"||l.status==="dirty")&&r.dirty(),a.set(u.value,l.value);}return {status:r.value,value:a}})}else {let a=new Map;for(let c of i){let u=c.key,l=c.value;if(u.status==="aborted"||l.status==="aborted")return O;(u.status==="dirty"||l.status==="dirty")&&r.dirty(),a.set(u.value,l.value);}return {status:r.value,value:a}}}};cn.create=(t,e,r)=>new cn({valueType:e,keyType:t,typeName:A.ZodMap,...M(r)});un=class t extends L{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==z.set)return S(n,{code:v.invalid_type,expected:z.set,received:n.parsedType}),O;let o=this._def;o.minSize!==null&&n.data.size<o.minSize.value&&(S(n,{code:v.too_small,minimum:o.minSize.value,type:"set",inclusive:true,exact:false,message:o.minSize.message}),r.dirty()),o.maxSize!==null&&n.data.size>o.maxSize.value&&(S(n,{code:v.too_big,maximum:o.maxSize.value,type:"set",inclusive:true,exact:false,message:o.maxSize.message}),r.dirty());let s=this._def.valueType;function i(c){let u=new Set;for(let l of c){if(l.status==="aborted")return O;l.status==="dirty"&&r.dirty(),u.add(l.value);}return {status:r.value,value:u}}let a=[...n.data.values()].map((c,u)=>s._parse(new tt(n,c,n.path,u)));return n.common.async?Promise.all(a).then(c=>i(c)):i(a)}min(e,r){return new t({...this._def,minSize:{value:e,message:E.toString(r)}})}max(e,r){return new t({...this._def,maxSize:{value:e,message:E.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};un.create=(t,e)=>new un({valueType:t,minSize:null,maxSize:null,typeName:A.ZodSet,...M(e)});vs=class t extends L{constructor(){super(...arguments),this.validate=this.implement;}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==z.function)return S(r,{code:v.invalid_type,expected:z.function,received:r.parsedType}),O;function n(a,c){return Qn({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,rn(),Ft].filter(u=>!!u),issueData:{code:v.invalid_arguments,argumentsError:c}})}function o(a,c){return Qn({data:a,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,rn(),Ft].filter(u=>!!u),issueData:{code:v.invalid_return_type,returnTypeError:c}})}let s={errorMap:r.common.contextualErrorMap},i=r.data;if(this._def.returns instanceof ir){let a=this;return Ie(async function(...c){let u=new Ve([]),l=await a._def.args.parseAsync(c,s).catch(f=>{throw u.addIssue(n(c,f)),u}),d=await Reflect.apply(i,this,l);return await a._def.returns._def.type.parseAsync(d,s).catch(f=>{throw u.addIssue(o(d,f)),u})})}else {let a=this;return Ie(function(...c){let u=a._def.args.safeParse(c,s);if(!u.success)throw new Ve([n(c,u.error)]);let l=Reflect.apply(i,this,u.data),d=a._def.returns.safeParse(l,s);if(!d.success)throw new Ve([o(l,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new t({...this._def,args:Pt.create(e).rest(Vt.create())})}returns(e){return new t({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,r,n){return new t({args:e||Pt.create([]).rest(Vt.create()),returns:r||Vt.create(),typeName:A.ZodFunction,...M(n)})}},jr=class extends L{get schema(){return this._def.getter()}_parse(e){let{ctx:r}=this._processInputParams(e);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};jr.create=(t,e)=>new jr({getter:t,typeName:A.ZodLazy,...M(e)});Rr=class extends L{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return S(r,{received:r.data,code:v.invalid_literal,expected:this._def.value}),O}return {status:"valid",value:e.data}}get value(){return this._def.value}};Rr.create=(t,e)=>new Rr({value:t,typeName:A.ZodLiteral,...M(e)});Ir=class t extends L{_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),n=this._def.values;return S(r,{expected:V.joinValues(n),received:r.parsedType,code:v.invalid_type}),O}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let r=this._getOrReturnCtx(e),n=this._def.values;return S(r,{received:r.data,code:v.invalid_enum_value,options:n}),O}return Ie(e.data)}get options(){return this._def.values}get enum(){let e={};for(let r of this._def.values)e[r]=r;return e}get Values(){let e={};for(let r of this._def.values)e[r]=r;return e}get Enum(){let e={};for(let r of this._def.values)e[r]=r;return e}extract(e,r=this._def){return t.create(e,{...this._def,...r})}exclude(e,r=this._def){return t.create(this.options.filter(n=>!e.includes(n)),{...this._def,...r})}};Ir.create=Jd;Or=class extends L{_parse(e){let r=V.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==z.string&&n.parsedType!==z.number){let o=V.objectValues(r);return S(n,{expected:V.joinValues(o),received:n.parsedType,code:v.invalid_type}),O}if(this._cache||(this._cache=new Set(V.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let o=V.objectValues(r);return S(n,{received:n.data,code:v.invalid_enum_value,options:o}),O}return Ie(e.data)}get enum(){return this._def.values}};Or.create=(t,e)=>new Or({values:t,typeName:A.ZodNativeEnum,...M(e)});ir=class extends L{unwrap(){return this._def.type}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==z.promise&&r.common.async===false)return S(r,{code:v.invalid_type,expected:z.promise,received:r.parsedType}),O;let n=r.parsedType===z.promise?r.data:Promise.resolve(r.data);return Ie(n.then(o=>this._def.type.parseAsync(o,{path:r.path,errorMap:r.common.contextualErrorMap})))}};ir.create=(t,e)=>new ir({type:t,typeName:A.ZodPromise,...M(e)});rt=class extends L{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===A.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:r,ctx:n}=this._processInputParams(e),o=this._def.effect||null,s={addIssue:i=>{S(n,i),i.fatal?r.abort():r.dirty();},get path(){return n.path}};if(s.addIssue=s.addIssue.bind(s),o.type==="preprocess"){let i=o.transform(n.data,s);if(n.common.async)return Promise.resolve(i).then(async a=>{if(r.value==="aborted")return O;let c=await this._def.schema._parseAsync({data:a,path:n.path,parent:n});return c.status==="aborted"?O:c.status==="dirty"?xr(c.value):r.value==="dirty"?xr(c.value):c});{if(r.value==="aborted")return O;let a=this._def.schema._parseSync({data:i,path:n.path,parent:n});return a.status==="aborted"?O:a.status==="dirty"?xr(a.value):r.value==="dirty"?xr(a.value):a}}if(o.type==="refinement"){let i=a=>{let c=o.refinement(a,s);if(n.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(n.common.async===false){let a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?O:(a.status==="dirty"&&r.dirty(),i(a.value),{status:r.value,value:a.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>a.status==="aborted"?O:(a.status==="dirty"&&r.dirty(),i(a.value).then(()=>({status:r.value,value:a.value}))))}if(o.type==="transform")if(n.common.async===false){let i=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!nr(i))return O;let a=o.transform(i.value,s);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return {status:r.value,value:a}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(i=>nr(i)?Promise.resolve(o.transform(i.value,s)).then(a=>({status:r.value,value:a})):O);V.assertNever(o);}};rt.create=(t,e,r)=>new rt({schema:t,typeName:A.ZodEffects,effect:e,...M(r)});rt.createWithPreprocess=(t,e,r)=>new rt({schema:e,effect:{type:"preprocess",transform:t},typeName:A.ZodEffects,...M(r)});et=class extends L{_parse(e){return this._getType(e)===z.undefined?Ie(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};et.create=(t,e)=>new et({innerType:t,typeName:A.ZodOptional,...M(e)});Et=class extends L{_parse(e){return this._getType(e)===z.null?Ie(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Et.create=(t,e)=>new Et({innerType:t,typeName:A.ZodNullable,...M(e)});Nr=class extends L{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return r.parsedType===z.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};Nr.create=(t,e)=>new Nr({innerType:t,typeName:A.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...M(e)});Ar=class extends L{_parse(e){let{ctx:r}=this._processInputParams(e),n={...r,common:{...r.common,issues:[]}},o=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return nn(o)?o.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new Ve(n.common.issues)},input:n.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new Ve(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};Ar.create=(t,e)=>new Ar({innerType:t,typeName:A.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...M(e)});ln=class extends L{_parse(e){if(this._getType(e)!==z.nan){let n=this._getOrReturnCtx(e);return S(n,{code:v.invalid_type,expected:z.nan,received:n.parsedType}),O}return {status:"valid",value:e.data}}};ln.create=t=>new ln({typeName:A.ZodNaN,...M(t)});cw=Symbol("zod_brand"),Xn=class extends L{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}},eo=class t extends L{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.common.async)return (async()=>{let s=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?O:s.status==="dirty"?(r.dirty(),xr(s.value)):this._def.out._parseAsync({data:s.value,path:n.path,parent:n})})();{let o=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?O:o.status==="dirty"?(r.dirty(),{status:"dirty",value:o.value}):this._def.out._parseSync({data:o.value,path:n.path,parent:n})}}static create(e,r){return new t({in:e,out:r,typeName:A.ZodPipeline})}},Zr=class extends L{_parse(e){let r=this._def.innerType._parse(e),n=o=>(nr(o)&&(o.value=Object.freeze(o.value)),o);return nn(r)?r.then(o=>n(o)):n(r)}unwrap(){return this._def.innerType}};Zr.create=(t,e)=>new Zr({innerType:t,typeName:A.ZodReadonly,...M(e)});uw={object:Be.lazycreate};(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly";})(A||(A={}));lw=(t,e={message:`Input not instance of ${t.name}`})=>Vd(r=>r instanceof t,e),Bd=or.create,Gd=br.create,dw=ln.create,pw=$r.create,Hd=Sr.create,fw=Tr.create,mw=sn.create,hw=zr.create,gw=Pr.create,yw=sr.create,_w=Vt.create,vw=mt.create,kw=an.create,ww=Bt.create,xw=Be.create,bw=Be.strictCreate,$w=Er.create,Sw=ys.create,Tw=Cr.create,zw=Pt.create,Pw=_s.create,Ew=cn.create,Cw=un.create,jw=vs.create,Rw=jr.create,Iw=Rr.create,Ow=Ir.create,Nw=Or.create,Aw=ir.create,Zw=rt.create,Mw=et.create,Dw=Et.create,qw=rt.createWithPreprocess,Lw=eo.create,Uw=()=>Bd().optional(),Fw=()=>Gd().optional(),Jw=()=>Hd().optional(),Vw={string:(t=>or.create({...t,coerce:true})),number:(t=>br.create({...t,coerce:true})),boolean:(t=>Sr.create({...t,coerce:true})),bigint:(t=>$r.create({...t,coerce:true})),date:(t=>Tr.create({...t,coerce:true}))},Bw=O;});var k={};Gn(k,{BRAND:()=>cw,DIRTY:()=>xr,EMPTY_PATH:()=>qk,INVALID:()=>O,NEVER:()=>Bw,OK:()=>Ie,ParseStatus:()=>Se,Schema:()=>L,ZodAny:()=>sr,ZodArray:()=>Bt,ZodBigInt:()=>$r,ZodBoolean:()=>Sr,ZodBranded:()=>Xn,ZodCatch:()=>Ar,ZodDate:()=>Tr,ZodDefault:()=>Nr,ZodDiscriminatedUnion:()=>ys,ZodEffects:()=>rt,ZodEnum:()=>Ir,ZodError:()=>Ve,ZodFirstPartyTypeKind:()=>A,ZodFunction:()=>vs,ZodIntersection:()=>Cr,ZodIssueCode:()=>v,ZodLazy:()=>jr,ZodLiteral:()=>Rr,ZodMap:()=>cn,ZodNaN:()=>ln,ZodNativeEnum:()=>Or,ZodNever:()=>mt,ZodNull:()=>Pr,ZodNullable:()=>Et,ZodNumber:()=>br,ZodObject:()=>Be,ZodOptional:()=>et,ZodParsedType:()=>z,ZodPipeline:()=>eo,ZodPromise:()=>ir,ZodReadonly:()=>Zr,ZodRecord:()=>_s,ZodSchema:()=>L,ZodSet:()=>un,ZodString:()=>or,ZodSymbol:()=>sn,ZodTransformer:()=>rt,ZodTuple:()=>Pt,ZodType:()=>L,ZodUndefined:()=>zr,ZodUnion:()=>Er,ZodUnknown:()=>Vt,ZodVoid:()=>an,addIssueToContext:()=>S,any:()=>yw,array:()=>ww,bigint:()=>pw,boolean:()=>Hd,coerce:()=>Vw,custom:()=>Vd,date:()=>fw,datetimeRegex:()=>Fd,defaultErrorMap:()=>Ft,discriminatedUnion:()=>Sw,effect:()=>Zw,enum:()=>Ow,function:()=>jw,getErrorMap:()=>rn,getParsedType:()=>zt,instanceof:()=>lw,intersection:()=>Tw,isAborted:()=>hs,isAsync:()=>nn,isDirty:()=>gs,isValid:()=>nr,late:()=>uw,lazy:()=>Rw,literal:()=>Iw,makeIssue:()=>Qn,map:()=>Ew,nan:()=>dw,nativeEnum:()=>Nw,never:()=>vw,null:()=>gw,nullable:()=>Dw,number:()=>Gd,object:()=>xw,objectUtil:()=>ya,oboolean:()=>Jw,onumber:()=>Fw,optional:()=>Mw,ostring:()=>Uw,pipeline:()=>Lw,preprocess:()=>qw,promise:()=>Aw,quotelessJson:()=>Zk,record:()=>Pw,set:()=>Cw,setErrorMap:()=>Dk,strictObject:()=>bw,string:()=>Bd,symbol:()=>mw,transformer:()=>Zw,tuple:()=>zw,undefined:()=>hw,union:()=>$w,unknown:()=>_w,util:()=>V,void:()=>kw});var xa=g(()=>{ms();va();Zd();Yn();Wd();fs();});var dn=g(()=>{xa();xa();});var to,ar,Mr,Gw,Kd,pn,ba,Yd,$a,ro=g(()=>{dn();to=["pl","en","de","es","fr","pt","it","nl"],ar=k.enum(to),Mr="pl",Gw=k.object({url:k.string().url(),language:ar.optional()}),Kd=k.object({projects:k.record(k.string(),Gw),default_project:k.string(),default_language:ar.optional()}).refine(t=>t.default_project in t.projects,{message:"default_project must reference a configured project"}),pn=k.object({username:k.string().email(),api_token:k.string().min(1)}),ba=k.object({default:pn,instances:k.record(k.string().url(),pn).optional()}),Yd=k.union([pn,ba]),$a=k.object({url:k.string().url(),username:k.string().email(),api_token:k.string().min(1),language:ar}),k.object({projects:k.record(k.string(),$a),default_project:k.string(),default_language:ar,credentials:pn});});var ht,ks,no,gt,yt,ws,xs,oo,Ct,Oe,Dr,Sa,bs,_t=g(()=>{ht=class extends Error{code;constructor(e,r){super(e),this.name="JiraMcpError",this.code=r;}},ks=class extends ht{constructor(e,r="CONFIG_ERROR"){super(e,r),this.name="ConfigError";}},no=class extends ks{constructor(e){super(e,"CONFIG_NOT_FOUND"),this.name="ConfigNotFoundError";}},gt=class extends ks{constructor(e){super(e,"CONFIG_VALIDATION"),this.name="ConfigValidationError";}},yt=class extends ht{constructor(e,r="JIRA_CONNECTION"){super(e,r),this.name="JiraConnectionError";}},ws=class extends yt{constructor(e){super(e,"JIRA_AUTH"),this.name="JiraAuthenticationError";}},xs=class extends yt{constructor(e){super(e,"JIRA_PERMISSION"),this.name="JiraPermissionError";}},oo=class extends ht{constructor(e,r="CACHE_ERROR"){super(e,r),this.name="CacheError";}},Ct=class extends oo{constructor(e){super(e,"CACHE_NOT_FOUND"),this.name="CacheNotFoundError";}},Oe=class extends oo{constructor(e){super(e,"CACHE_CORRUPTION"),this.name="CacheCorruptionError";}},Dr=class extends oo{constructor(e){super(e,"TASK_NOT_FOUND"),this.name="TaskNotFoundError";}},Sa=class extends ht{constructor(e,r="TEMPLATE_ERROR"){super(e,r),this.name="TemplateError";}},bs=class extends Sa{constructor(e){super(e,"TEMPLATE_NOT_FOUND"),this.name="TemplateNotFoundError";}};});async function Yw(t){if(t?.configPath)return resolve(t.configPath);let e=process.env.JIRA_CONFIG_PATH;if(e)return resolve(e);let r=resolve(process.cwd(),"config.json");return await Je(r)?r:fa}async function Qw(t){if(t?.credentialsPath)return resolve(t.credentialsPath);let e=process.env.JIRA_CREDENTIALS_PATH;if(e)return resolve(e);let r=resolve(process.cwd(),"credentials.json");return await Je(r)?r:ma}async function rp(t,e){if(!await Je(t))throw new no(`${e} not found: ${t}`);let r;try{r=await readFile(t,"utf-8");}catch(n){let o=n instanceof Error?n.message:String(n);throw new no(`Failed to read ${e}: ${o}`)}try{return JSON.parse(r)}catch(n){let o=n instanceof Error?n.message:String(n);throw new gt(`Invalid JSON in ${e}: ${o}`)}}function Xw(t){let e=pn.safeParse(t);if(e.success&&!("default"in t))return {default:e.data,instances:{}};let r=ba.safeParse(t);if(r.success)return {default:r.data.default,instances:r.data.instances??{}};throw new gt("Credentials file format not recognized. Expected { username, api_token } or { default: { username, api_token }, instances?: {} }.")}function ex(t,e){return t.instances[e]??t.default}async function jt(t){let e=await Yw(t),r=await Qw(t),n=await rp(e,"configuration file"),o=Kd.safeParse(n);if(!o.success)throw new gt(`Configuration validation failed: ${o.error.message}`);let s=o.data,i=await rp(r,"credentials file"),a=Yd.safeParse(i);if(!a.success)throw new gt(`Credentials validation failed: ${a.error.message}`);let c=Xw(a.data),u=s.default_language??Mr,l={};for(let[d,p]of Object.entries(s.projects)){let f=ex(c,p.url),h={url:p.url,username:f.username,api_token:f.api_token,language:p.language??u},_=$a.safeParse(h);if(!_.success)throw new gt(`Project '${d}' validation failed: ${_.error.message}`);l[d]=_.data;}return {projects:l,default_project:s.default_project,default_language:u,credentials:c.default}}function np(t){let e=new Map;for(let[n,o]of Object.entries(t.projects)){let s=e.get(o.url);s?s.keys.push(n):e.set(o.url,{keys:[n]});}let r=[];for(let[n,{keys:o}]of e){let s=o[0];if(!s)continue;let i=t.projects[s];i&&r.push({url:n,username:i.username,api_token:i.api_token,projectKeys:o});}return r}var qr=g(()=>{Xe();ro();_t();we();});var tx,rx,$s,op=g(()=>{_t();tx=1e3,rx=["summary","status","assignee","priority","issuetype","created","updated","project","customfield_10014"],$s=class{authToken;instanceUrl;constructor(e){this.instanceUrl=e.url,this.authToken=Buffer.from(`${e.username}:${e.api_token}`).toString("base64");}async request(e,r,n,o){let s=new URL(r,this.instanceUrl);if(o)for(let[c,u]of Object.entries(o))s.searchParams.set(c,u);let i={Authorization:`Basic ${this.authToken}`,Accept:"application/json"};n!==void 0&&(i["Content-Type"]="application/json");let a=await fetch(s.toString(),{method:e,headers:i,body:n!==void 0?JSON.stringify(n):void 0});if(!a.ok){let u=await a.text()||a.statusText;throw a.status===401?new ws(`Authentication failed: ${u}`):a.status===403?new xs(`Permission denied: ${u}`):new yt(`Jira API error (${a.status}): ${u}`)}if(a.status!==204)return await a.json()}async searchIssues(e,r){return ((await this.request("GET","/rest/api/3/search",void 0,{jql:e,fields:(r?[...r]:rx).join(","),maxResults:String(tx)})).issues??[]).map(s=>{let i=s.fields;return {key:s.key,summary:i.summary,status:i.status?.name??"Unknown",assignee:i.assignee?.emailAddress??null,priority:i.priority?.name??"None",issueType:i.issuetype?.name??i.issueType?.name??"Unknown",created:i.created,updated:i.updated,projectKey:s.key.split("-")[0]??"",epicLink:i.customfield_10014??null}})}async getIssue(e){let r=["summary","description","status","assignee","priority","issuetype","created","updated","project","comment","timetracking"],n=await this.request("GET",`/rest/api/3/issue/${encodeURIComponent(e)}`,void 0,{fields:r.join(",")}),o=n.fields,s=(o.comment?.comments??[]).map(i=>({id:i.id??"",author:i.author?.emailAddress??i.author?.displayName??"Unknown",body:i.body??null,created:i.created??""}));return {key:n.key,summary:o.summary,description:o.description??null,status:o.status?.name??"Unknown",assignee:o.assignee?.emailAddress??null,priority:o.priority?.name??"None",issueType:o.issuetype?.name??o.issueType?.name??"Unknown",created:o.created,updated:o.updated,projectKey:n.key.split("-")[0]??"",comments:s,timeTracking:{originalEstimate:o.timetracking?.originalEstimate??null,remainingEstimate:o.timetracking?.remainingEstimate??null,timeSpent:o.timetracking?.timeSpent??null,originalEstimateSeconds:o.timetracking?.originalEstimateSeconds??null,remainingEstimateSeconds:o.timetracking?.remainingEstimateSeconds??null,timeSpentSeconds:o.timetracking?.timeSpentSeconds??null}}}async addComment(e,r){let n=await this.request("POST",`/rest/api/3/issue/${encodeURIComponent(e)}/comment`,{body:r});return {id:n.id??"",author:n.author?.emailAddress??n.author?.displayName??"Unknown",body:n.body??null,created:n.created??""}}async getTransitions(e){return ((await this.request("GET",`/rest/api/3/issue/${encodeURIComponent(e)}/transitions`)).transitions??[]).map(n=>({id:n.id??"",name:n.name??"",toStatus:n.to?.name??""}))}async doTransition(e,r){await this.request("POST",`/rest/api/3/issue/${encodeURIComponent(e)}/transitions`,{transition:{id:r}});}async assignIssue(e,r){await this.request("PUT",`/rest/api/3/issue/${encodeURIComponent(e)}/assignee`,{accountId:r});}async findUser(e){let n=(await this.request("GET","/rest/api/3/user/search",void 0,{query:e,maxResults:"1"}))?.[0];if(!n?.accountId)throw new yt(`User not found for email: ${e}`);return n.accountId}async addWorklog(e,r,n){let o={timeSpentSeconds:r};n&&(o.comment=n);let s=await this.request("POST",`/rest/api/3/issue/${encodeURIComponent(e)}/worklog`,o);return {id:s.id??"",timeSpent:s.timeSpent??"",timeSpentSeconds:s.timeSpentSeconds??r,created:s.created??""}}async getTimeTracking(e){let n=(await this.request("GET",`/rest/api/3/issue/${encodeURIComponent(e)}`,void 0,{fields:"timetracking"})).fields.timetracking;return {originalEstimate:n?.originalEstimate??null,remainingEstimate:n?.remainingEstimate??null,timeSpent:n?.timeSpent??null,originalEstimateSeconds:n?.originalEstimateSeconds??null,remainingEstimateSeconds:n?.remainingEstimateSeconds??null,timeSpentSeconds:n?.timeSpentSeconds??null}}async createIssue(e){let r=await this.request("POST","/rest/api/3/issue",{fields:e});return {key:r.key,id:r.id,url:`${this.instanceUrl}/browse/${r.key}`}}async updateIssue(e,r){await this.request("PUT",`/rest/api/3/issue/${encodeURIComponent(e)}`,{fields:r});}async getFields(){return (await this.request("GET","/rest/api/3/field")).map(r=>({id:r.id??"",name:r.name??"",custom:r.custom??false,...r.schema?.custom!==void 0?{schema:{custom:r.schema.custom}}:{}}))}async searchUsers(e,r=50){return (await this.request("GET","/rest/api/3/user/search",void 0,{query:e,maxResults:String(r)})??[]).map(o=>({accountId:o.accountId,emailAddress:o.emailAddress??null,displayName:o.displayName??"Unknown",active:o.active}))}async getProjectStatuses(e){return (await this.request("GET",`/rest/api/3/project/${encodeURIComponent(e)}/statuses`)).map(n=>({id:n.id,name:n.name,statuses:n.statuses.map(o=>({name:o.name??"",id:o.id??""}))}))}};});var nt,mn=g(()=>{_t();op();nt=class{byProject=new Map;byUrl=new Map;config;constructor(e){this.config=e,this.#e();}getConnector(e){let r=this.byProject.get(e);if(!r)throw new gt(`Project '${e}' not found in configuration`);return r}getConnectorForTask(e){let r=e.split("-")[0];if(!r)throw new gt(`Invalid task key format: '${e}'. Expected 'PROJECT-NUMBER'.`);return this.getConnector(r)}getInstances(){return this.byUrl}#e(){let e=new Map;for(let[r,n]of Object.entries(this.config.projects)){let o=e.get(n.url);o?o.push(r):e.set(n.url,[r]);}for(let[r,n]of e){let o=n[0];if(!o)continue;let s=this.config.projects[o];if(!s)continue;let i=new $s(s),a={connector:i,projectKeys:n};this.byUrl.set(r,a);for(let c of n)this.byProject.set(c,i);}}};});function Pa(t){return {version:1,type:"doc",content:[{type:"paragraph",content:[{type:"text",text:t}]}]}}function Rt(t){let e=t.replace(/\\n/g,`
|
|
3
|
+
`);if(e.trim().length===0)return Pa(e);try{let r=mp(e);return r.length===0?Pa(e):{version:1,type:"doc",content:r}}catch{return Pa(e)}}function zx(t){return {lines:t.split(`
|
|
4
|
+
`),pos:0}}function io(t){return t.lines[t.pos]}function Gt(t){let e=t.lines[t.pos]??"";return t.pos++,e}function ao(t){return t.pos<t.lines.length}function mp(t){let e=zx(t),r=[];for(;ao(e);){let n=io(e);if(n===void 0)break;if(n.trim()===""){Gt(e);continue}let o=pp.exec(n);if(o){r.push(Px(e,o[1]??""));continue}if(fp.test(n)){Gt(e),r.push({type:"rule"});continue}let s=dp.exec(n);if(s){Gt(e);let i=(s[1]??"#").length,a=s[2]??"";r.push({type:"heading",attrs:{level:i},content:gp(a)});continue}if(Ra.test(n)){r.push(Ex(e));continue}if(Ca.test(n)){r.push(Cx(e));continue}if(ja.test(n)){r.push(jx(e));continue}r.push(Rx(e));}return r}function Px(t,e){Gt(t);let r=[];for(;ao(t);){let o=io(t);if(o!==void 0&&/^```\s*$/.test(o)){Gt(t);break}r.push(Gt(t));}let n=r.join(`
|
|
5
|
+
`);return {type:"codeBlock",attrs:{language:e||"text"},content:n.length>0?[{type:"text",text:n}]:[]}}function Ex(t){let e=[];for(;ao(t);){let o=io(t);if(o===void 0)break;let s=Ra.exec(o);if(!s)break;Gt(t),e.push(s[1]??"");}let r=e.join(`
|
|
6
|
+
`),n=mp(r);return {type:"blockquote",content:n.length>0?n:[Ia([])]}}function Cx(t){return {type:"bulletList",content:hp(t,Ca)}}function jx(t){let e=hp(t,ja);return {type:"orderedList",attrs:{order:1},content:e}}function hp(t,e){let r=[];for(;ao(t);){let n=io(t);if(n===void 0)break;let o=e.exec(n);if(!o)break;Gt(t);let s=o[2]??"";r.push({type:"listItem",content:[Ia(gp(s))]});}return r}function Rx(t){let e=[];for(;ao(t);){let n=io(t);if(n===void 0||n.trim()===""||dp.test(n)||pp.test(n)||fp.test(n)||Ra.test(n)||Ca.test(n)||ja.test(n))break;let o=Gt(t);if(o.endsWith(" ")||o.endsWith("\\")){let s=o.endsWith("\\")?o.slice(0,-1):o.trimEnd();e.push(s),e.push(`
|
|
7
|
+
`);}else e.push(o);}let r=e.join(" ").replace(/ \n /g,`
|
|
8
|
+
`);return Ia(Ix(r))}function Ia(t){return {type:"paragraph",content:t.length>0?t:[{type:"text",text:" "}]}}function gp(t){return t.length===0?[]:so(t)}function Ix(t){if(t.length===0)return [];let e=t.split(`
|
|
9
|
+
`),r=[];for(let n=0;n<e.length;n++){let o=e[n];o!==void 0&&o.length>0&&r.push(...so(o)),n<e.length-1&&r.push({type:"hardBreak"});}return r}function so(t){let e=[],r=0,n="";function o(){n.length>0&&(e.push({type:"text",text:n}),n="");}for(;r<t.length;){let s=t[r],i=t[r+1];if(s==="\\"&&r+1<t.length){n+=t[r+1]??"",r+=2;continue}if(s==="`"){let a=t.indexOf("`",r+1);if(a!==-1){o();let c=t.slice(r+1,a);e.push(lp(c,[{type:"code"}])),r=a+1;continue}}if(s==="*"&&i==="*"||s==="_"&&i==="_"){let a=t.slice(r,r+2),c=t.indexOf(a,r+2);if(c!==-1){o();let u=t.slice(r+2,c),l=so(u);for(let d of l)e.push(Ea(d,{type:"strong"}));r=c+2;continue}}if(s==="~"&&i==="~"){let a=t.indexOf("~~",r+2);if(a!==-1){o();let c=t.slice(r+2,a),u=so(c);for(let l of u)e.push(Ea(l,{type:"strike"}));r=a+2;continue}}if((s==="*"||s==="_")&&i!==s){let a=Ox(t,s,r+1);if(a!==-1){o();let c=t.slice(r+1,a),u=so(c);for(let l of u)e.push(Ea(l,{type:"em"}));r=a+1;continue}}if(s==="["){let a=Nx(t,r);if(a){o(),e.push(lp(a.text,[{type:"link",attrs:{href:a.href}}])),r=a.endPos;continue}}n+=s,r++;}return o(),e}function Ox(t,e,r){let n=r;for(;n<t.length;){if(t[n]==="\\"){n+=2;continue}if(t[n]===e){if(t[n+1]===e){n+=2;continue}return n}n++;}return -1}function Nx(t,e){if(t[e]!=="[")return;let r=t.indexOf("]",e+1);if(r===-1||t[r+1]!=="(")return;let n=t.indexOf(")",r+2);if(n!==-1)return {text:t.slice(e+1,r),href:t.slice(r+2,n),endPos:n+1}}function lp(t,e){return e.length===0?{type:"text",text:t}:{type:"text",text:t,marks:e}}function Ea(t,e){if(t.type!=="text")return t;let r=t.marks??[];return {type:"text",text:t.text??"",marks:[...r,e]}}var dp,Ca,ja,pp,Ra,fp,co=g(()=>{dp=/^(#{1,6})\s+(.+)$/,Ca=/^(\s*)[-*+]\s+(.*)$/,ja=/^(\s*)\d+\.\s+(.*)$/,pp=/^```(\w*)$/,Ra=/^>\s?(.*)$/,fp=/^(?:---+|\*\*\*+|___+)\s*$/;});function zs(t){return t.replace(/([+\-&|!(){}[\]^~*?\\:"])/g,"\\$1")}var Oa=g(()=>{});function y(t,e,r){function n(a,c){var u;Object.defineProperty(a,"_zod",{value:a._zod??{},enumerable:false}),(u=a._zod).traits??(u.traits=new Set),a._zod.traits.add(t),e(a,c);for(let l in i.prototype)l in a||Object.defineProperty(a,l,{value:i.prototype[l].bind(a)});a._zod.constr=i,a._zod.def=c;}let o=r?.Parent??Object;class s extends o{}Object.defineProperty(s,"name",{value:t});function i(a){var c;let u=r?.Parent?new s:this;n(u,a),(c=u._zod).deferred??(c.deferred=[]);for(let l of u._zod.deferred)l();return u}return Object.defineProperty(i,"init",{value:n}),Object.defineProperty(i,Symbol.hasInstance,{value:a=>r?.Parent&&a instanceof r.Parent?true:a?._zod?.traits?.has(t)}),Object.defineProperty(i,"name",{value:t}),i}function ot(t){return t&&Object.assign(Cs,t),Cs}var Ht,Cs,_n=g(()=>{Ht=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.");}},Cs={};});var X={};Gn(X,{BIGINT_FORMAT_RANGES:()=>wp,Class:()=>Za,NUMBER_FORMAT_RANGES:()=>Va,aborted:()=>Ur,allowsEval:()=>Ua,assert:()=>Bx,assertEqual:()=>Ux,assertIs:()=>Jx,assertNever:()=>Vx,assertNotEqual:()=>Fx,assignProp:()=>La,cached:()=>lo,captureStackTrace:()=>Rs,cleanEnum:()=>sb,cleanRegex:()=>fo,clone:()=>It,createTransparentProxy:()=>Qx,defineLazy:()=>ie,esc:()=>Lr,escapeRegex:()=>cr,extend:()=>tb,finalizeIssue:()=>vt,floatSafeRemainder:()=>qa,getElementAtPath:()=>Gx,getEnumValues:()=>Ma,getLengthableOrigin:()=>mo,getParsedType:()=>Yx,getSizableOrigin:()=>xp,isObject:()=>vn,isPlainObject:()=>kn,issue:()=>Ba,joinValues:()=>js,jsonStringifyReplacer:()=>Da,merge:()=>rb,normalizeParams:()=>N,nullish:()=>po,numKeys:()=>Kx,omit:()=>eb,optionalKeys:()=>Ja,partial:()=>nb,pick:()=>Xx,prefixIssues:()=>Ot,primitiveTypes:()=>kp,promiseAllObject:()=>Hx,propertyKeyTypes:()=>Fa,randomString:()=>Wx,required:()=>ob,stringifyPrimitive:()=>Is,unwrapMessage:()=>uo});function Ux(t){return t}function Fx(t){return t}function Jx(t){}function Vx(t){throw new Error}function Bx(t){}function Ma(t){let e=Object.values(t).filter(n=>typeof n=="number");return Object.entries(t).filter(([n,o])=>e.indexOf(+n)===-1).map(([n,o])=>o)}function js(t,e="|"){return t.map(r=>Is(r)).join(e)}function Da(t,e){return typeof e=="bigint"?e.toString():e}function lo(t){return {get value(){{let r=t();return Object.defineProperty(this,"value",{value:r}),r}}}}function po(t){return t==null}function fo(t){let e=t.startsWith("^")?1:0,r=t.endsWith("$")?t.length-1:t.length;return t.slice(e,r)}function qa(t,e){let r=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,o=r>n?r:n,s=Number.parseInt(t.toFixed(o).replace(".","")),i=Number.parseInt(e.toFixed(o).replace(".",""));return s%i/10**o}function ie(t,e,r){Object.defineProperty(t,e,{get(){{let o=r();return t[e]=o,o}},set(o){Object.defineProperty(t,e,{value:o});},configurable:true});}function La(t,e,r){Object.defineProperty(t,e,{value:r,writable:true,enumerable:true,configurable:true});}function Gx(t,e){return e?e.reduce((r,n)=>r?.[n],t):t}function Hx(t){let e=Object.keys(t),r=e.map(n=>t[n]);return Promise.all(r).then(n=>{let o={};for(let s=0;s<e.length;s++)o[e[s]]=n[s];return o})}function Wx(t=10){let e="abcdefghijklmnopqrstuvwxyz",r="";for(let n=0;n<t;n++)r+=e[Math.floor(Math.random()*e.length)];return r}function Lr(t){return JSON.stringify(t)}function vn(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function kn(t){if(vn(t)===false)return false;let e=t.constructor;if(e===void 0)return true;let r=e.prototype;return !(vn(r)===false||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===false)}function Kx(t){let e=0;for(let r in t)Object.prototype.hasOwnProperty.call(t,r)&&e++;return e}function cr(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function It(t,e,r){let n=new t._zod.constr(e??t._zod.def);return (!e||r?.parent)&&(n._zod.parent=t),n}function N(t){let e=t;if(!e)return {};if(typeof e=="string")return {error:()=>e};if(e?.message!==void 0){if(e?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");e.error=e.message;}return delete e.message,typeof e.error=="string"?{...e,error:()=>e.error}:e}function Qx(t){let e;return new Proxy({},{get(r,n,o){return e??(e=t()),Reflect.get(e,n,o)},set(r,n,o,s){return e??(e=t()),Reflect.set(e,n,o,s)},has(r,n){return e??(e=t()),Reflect.has(e,n)},deleteProperty(r,n){return e??(e=t()),Reflect.deleteProperty(e,n)},ownKeys(r){return e??(e=t()),Reflect.ownKeys(e)},getOwnPropertyDescriptor(r,n){return e??(e=t()),Reflect.getOwnPropertyDescriptor(e,n)},defineProperty(r,n,o){return e??(e=t()),Reflect.defineProperty(e,n,o)}})}function Is(t){return typeof t=="bigint"?t.toString()+"n":typeof t=="string"?`"${t}"`:`${t}`}function Ja(t){return Object.keys(t).filter(e=>t[e]._zod.optin==="optional"&&t[e]._zod.optout==="optional")}function Xx(t,e){let r={},n=t._zod.def;for(let o in e){if(!(o in n.shape))throw new Error(`Unrecognized key: "${o}"`);e[o]&&(r[o]=n.shape[o]);}return It(t,{...t._zod.def,shape:r,checks:[]})}function eb(t,e){let r={...t._zod.def.shape},n=t._zod.def;for(let o in e){if(!(o in n.shape))throw new Error(`Unrecognized key: "${o}"`);e[o]&&delete r[o];}return It(t,{...t._zod.def,shape:r,checks:[]})}function tb(t,e){if(!kn(e))throw new Error("Invalid input to extend: expected a plain object");let r={...t._zod.def,get shape(){let n={...t._zod.def.shape,...e};return La(this,"shape",n),n},checks:[]};return It(t,r)}function rb(t,e){return It(t,{...t._zod.def,get shape(){let r={...t._zod.def.shape,...e._zod.def.shape};return La(this,"shape",r),r},catchall:e._zod.def.catchall,checks:[]})}function nb(t,e,r){let n=e._zod.def.shape,o={...n};if(r)for(let s in r){if(!(s in n))throw new Error(`Unrecognized key: "${s}"`);r[s]&&(o[s]=t?new t({type:"optional",innerType:n[s]}):n[s]);}else for(let s in n)o[s]=t?new t({type:"optional",innerType:n[s]}):n[s];return It(e,{...e._zod.def,shape:o,checks:[]})}function ob(t,e,r){let n=e._zod.def.shape,o={...n};if(r)for(let s in r){if(!(s in o))throw new Error(`Unrecognized key: "${s}"`);r[s]&&(o[s]=new t({type:"nonoptional",innerType:n[s]}));}else for(let s in n)o[s]=new t({type:"nonoptional",innerType:n[s]});return It(e,{...e._zod.def,shape:o,checks:[]})}function Ur(t,e=0){for(let r=e;r<t.issues.length;r++)if(t.issues[r]?.continue!==true)return true;return false}function Ot(t,e){return e.map(r=>{var n;return (n=r).path??(n.path=[]),r.path.unshift(t),r})}function uo(t){return typeof t=="string"?t:t?.message}function vt(t,e,r){let n={...t,path:t.path??[]};if(!t.message){let o=uo(t.inst?._zod.def?.error?.(t))??uo(e?.error?.(t))??uo(r.customError?.(t))??uo(r.localeError?.(t))??"Invalid input";n.message=o;}return delete n.inst,delete n.continue,e?.reportInput||delete n.input,n}function xp(t){return t instanceof Set?"set":t instanceof Map?"map":t instanceof File?"file":"unknown"}function mo(t){return Array.isArray(t)?"array":typeof t=="string"?"string":"unknown"}function Ba(...t){let[e,r,n]=t;return typeof e=="string"?{message:e,code:"custom",input:r,inst:n}:{...e}}function sb(t){return Object.entries(t).filter(([e,r])=>Number.isNaN(Number.parseInt(e,10))).map(e=>e[1])}var Rs,Ua,Yx,Fa,kp,Va,wp,Za,Wt=g(()=>{Rs=Error.captureStackTrace?Error.captureStackTrace:(...t)=>{};Ua=lo(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return false;try{let t=Function;return new t(""),!0}catch{return false}});Yx=t=>{let e=typeof t;switch(e){case "undefined":return "undefined";case "string":return "string";case "number":return Number.isNaN(t)?"nan":"number";case "boolean":return "boolean";case "function":return "function";case "bigint":return "bigint";case "symbol":return "symbol";case "object":return Array.isArray(t)?"array":t===null?"null":t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?"promise":typeof Map<"u"&&t instanceof Map?"map":typeof Set<"u"&&t instanceof Set?"set":typeof Date<"u"&&t instanceof Date?"date":typeof File<"u"&&t instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${e}`)}},Fa=new Set(["string","number","symbol"]),kp=new Set(["string","number","bigint","boolean","symbol","undefined"]);Va={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]},wp={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};Za=class{constructor(...e){}};});function $p(t,e=r=>r.message){let r={},n=[];for(let o of t.issues)o.path.length>0?(r[o.path[0]]=r[o.path[0]]||[],r[o.path[0]].push(e(o))):n.push(e(o));return {formErrors:n,fieldErrors:r}}function Sp(t,e){let r=e||function(s){return s.message},n={_errors:[]},o=s=>{for(let i of s.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map(a=>o({issues:a}));else if(i.code==="invalid_key")o({issues:i.issues});else if(i.code==="invalid_element")o({issues:i.issues});else if(i.path.length===0)n._errors.push(r(i));else {let a=n,c=0;for(;c<i.path.length;){let u=i.path[c];c===i.path.length-1?(a[u]=a[u]||{_errors:[]},a[u]._errors.push(r(i))):a[u]=a[u]||{_errors:[]},a=a[u],c++;}}};return o(t),n}var bp,Os,Ga,Ha=g(()=>{_n();Wt();bp=(t,e)=>{t.name="$ZodError",Object.defineProperty(t,"_zod",{value:t._zod,enumerable:false}),Object.defineProperty(t,"issues",{value:e,enumerable:false}),Object.defineProperty(t,"message",{get(){return JSON.stringify(e,Da,2)},enumerable:true}),Object.defineProperty(t,"toString",{value:()=>t.message,enumerable:false});},Os=y("$ZodError",bp),Ga=y("$ZodError",bp,{Parent:Error});});var Tp,zp,Wa,ho,Ka,Ns,Ya=g(()=>{_n();Ha();Wt();Tp=t=>(e,r,n,o)=>{let s=n?Object.assign(n,{async:false}):{async:false},i=e._zod.run({value:r,issues:[]},s);if(i instanceof Promise)throw new Ht;if(i.issues.length){let a=new(o?.Err??t)(i.issues.map(c=>vt(c,s,ot())));throw Rs(a,o?.callee),a}return i.value},zp=t=>async(e,r,n,o)=>{let s=n?Object.assign(n,{async:true}):{async:true},i=e._zod.run({value:r,issues:[]},s);if(i instanceof Promise&&(i=await i),i.issues.length){let a=new(o?.Err??t)(i.issues.map(c=>vt(c,s,ot())));throw Rs(a,o?.callee),a}return i.value},Wa=t=>(e,r,n)=>{let o=n?{...n,async:false}:{async:false},s=e._zod.run({value:r,issues:[]},o);if(s instanceof Promise)throw new Ht;return s.issues.length?{success:false,error:new(t??Os)(s.issues.map(i=>vt(i,o,ot())))}:{success:true,data:s.value}},ho=Wa(Ga),Ka=t=>async(e,r,n)=>{let o=n?Object.assign(n,{async:true}):{async:true},s=e._zod.run({value:r,issues:[]},o);return s instanceof Promise&&(s=await s),s.issues.length?{success:false,error:new t(s.issues.map(i=>vt(i,o,ot())))}:{success:true,data:s.value}},Ns=Ka(Ga);});function Zp(){return new RegExp(ab,"u")}function Gp(t){let e="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof t.precision=="number"?t.precision===-1?`${e}`:t.precision===0?`${e}:[0-5]\\d`:`${e}:[0-5]\\d\\.\\d{${t.precision}}`:`${e}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Hp(t){return new RegExp(`^${Gp(t)}$`)}function Wp(t){let e=Gp({precision:t.precision}),r=["Z"];t.local&&r.push(""),t.offset&&r.push("([+-]\\d{2}:\\d{2})");let n=`${e}(?:${r.join("|")})`;return new RegExp(`^${Vp}T(?:${n})$`)}var Pp,Ep,Cp,jp,Rp,Ip,Op,Np,Qa,Ap,ab,Mp,Dp,qp,Lp,Up,Xa,Fp,Jp,Vp,Bp,Kp,Yp,Qp,Xp,ef,tf,rf,As=g(()=>{Pp=/^[cC][^\s-]{8,}$/,Ep=/^[0-9a-z]+$/,Cp=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,jp=/^[0-9a-vA-V]{20}$/,Rp=/^[A-Za-z0-9]{27}$/,Ip=/^[a-zA-Z0-9_-]{21}$/,Op=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Np=/^([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})$/,Qa=t=>t?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${t}[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)$/,Ap=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,ab="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";Mp=/^(?:(?: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])$/,Dp=/^(([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})$/,qp=/^((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])$/,Lp=/^(([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])$/,Up=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Xa=/^[A-Za-z0-9_-]*$/,Fp=/^([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+$/,Jp=/^\+(?:[0-9]){6,14}[0-9]$/,Vp="(?:(?:\\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])))",Bp=new RegExp(`^${Vp}$`);Kp=t=>{let e=t?`[\\s\\S]{${t?.minimum??0},${t?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${e}$`)},Yp=/^\d+$/,Qp=/^-?\d+(?:\.\d+)?/i,Xp=/true|false/i,ef=/null/i,tf=/^[^A-Z]*$/,rf=/^[^a-z]*$/;});var Ne,nf,tc,rc,of,sf,af,cf,uf,go,lf,df,pf,ff,mf,hf,gf,Zs=g(()=>{_n();As();Wt();Ne=y("$ZodCheck",(t,e)=>{var r;t._zod??(t._zod={}),t._zod.def=e,(r=t._zod).onattach??(r.onattach=[]);}),nf={number:"number",bigint:"bigint",object:"date"},tc=y("$ZodCheckLessThan",(t,e)=>{Ne.init(t,e);let r=nf[typeof e.value];t._zod.onattach.push(n=>{let o=n._zod.bag,s=(e.inclusive?o.maximum:o.exclusiveMaximum)??Number.POSITIVE_INFINITY;e.value<s&&(e.inclusive?o.maximum=e.value:o.exclusiveMaximum=e.value);}),t._zod.check=n=>{(e.inclusive?n.value<=e.value:n.value<e.value)||n.issues.push({origin:r,code:"too_big",maximum:e.value,input:n.value,inclusive:e.inclusive,inst:t,continue:!e.abort});};}),rc=y("$ZodCheckGreaterThan",(t,e)=>{Ne.init(t,e);let r=nf[typeof e.value];t._zod.onattach.push(n=>{let o=n._zod.bag,s=(e.inclusive?o.minimum:o.exclusiveMinimum)??Number.NEGATIVE_INFINITY;e.value>s&&(e.inclusive?o.minimum=e.value:o.exclusiveMinimum=e.value);}),t._zod.check=n=>{(e.inclusive?n.value>=e.value:n.value>e.value)||n.issues.push({origin:r,code:"too_small",minimum:e.value,input:n.value,inclusive:e.inclusive,inst:t,continue:!e.abort});};}),of=y("$ZodCheckMultipleOf",(t,e)=>{Ne.init(t,e),t._zod.onattach.push(r=>{var n;(n=r._zod.bag).multipleOf??(n.multipleOf=e.value);}),t._zod.check=r=>{if(typeof r.value!=typeof e.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof r.value=="bigint"?r.value%e.value===BigInt(0):qa(r.value,e.value)===0)||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:e.value,input:r.value,inst:t,continue:!e.abort});};}),sf=y("$ZodCheckNumberFormat",(t,e)=>{Ne.init(t,e),e.format=e.format||"float64";let r=e.format?.includes("int"),n=r?"int":"number",[o,s]=Va[e.format];t._zod.onattach.push(i=>{let a=i._zod.bag;a.format=e.format,a.minimum=o,a.maximum=s,r&&(a.pattern=Yp);}),t._zod.check=i=>{let a=i.value;if(r){if(!Number.isInteger(a)){i.issues.push({expected:n,format:e.format,code:"invalid_type",input:a,inst:t});return}if(!Number.isSafeInteger(a)){a>0?i.issues.push({input:a,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:n,continue:!e.abort}):i.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:n,continue:!e.abort});return}}a<o&&i.issues.push({origin:"number",input:a,code:"too_small",minimum:o,inclusive:true,inst:t,continue:!e.abort}),a>s&&i.issues.push({origin:"number",input:a,code:"too_big",maximum:s,inst:t});};}),af=y("$ZodCheckMaxLength",(t,e)=>{var r;Ne.init(t,e),(r=t._zod.def).when??(r.when=n=>{let o=n.value;return !po(o)&&o.length!==void 0}),t._zod.onattach.push(n=>{let o=n._zod.bag.maximum??Number.POSITIVE_INFINITY;e.maximum<o&&(n._zod.bag.maximum=e.maximum);}),t._zod.check=n=>{let o=n.value;if(o.length<=e.maximum)return;let i=mo(o);n.issues.push({origin:i,code:"too_big",maximum:e.maximum,inclusive:true,input:o,inst:t,continue:!e.abort});};}),cf=y("$ZodCheckMinLength",(t,e)=>{var r;Ne.init(t,e),(r=t._zod.def).when??(r.when=n=>{let o=n.value;return !po(o)&&o.length!==void 0}),t._zod.onattach.push(n=>{let o=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;e.minimum>o&&(n._zod.bag.minimum=e.minimum);}),t._zod.check=n=>{let o=n.value;if(o.length>=e.minimum)return;let i=mo(o);n.issues.push({origin:i,code:"too_small",minimum:e.minimum,inclusive:true,input:o,inst:t,continue:!e.abort});};}),uf=y("$ZodCheckLengthEquals",(t,e)=>{var r;Ne.init(t,e),(r=t._zod.def).when??(r.when=n=>{let o=n.value;return !po(o)&&o.length!==void 0}),t._zod.onattach.push(n=>{let o=n._zod.bag;o.minimum=e.length,o.maximum=e.length,o.length=e.length;}),t._zod.check=n=>{let o=n.value,s=o.length;if(s===e.length)return;let i=mo(o),a=s>e.length;n.issues.push({origin:i,...a?{code:"too_big",maximum:e.length}:{code:"too_small",minimum:e.length},inclusive:true,exact:true,input:n.value,inst:t,continue:!e.abort});};}),go=y("$ZodCheckStringFormat",(t,e)=>{var r,n;Ne.init(t,e),t._zod.onattach.push(o=>{let s=o._zod.bag;s.format=e.format,e.pattern&&(s.patterns??(s.patterns=new Set),s.patterns.add(e.pattern));}),e.pattern?(r=t._zod).check??(r.check=o=>{e.pattern.lastIndex=0,!e.pattern.test(o.value)&&o.issues.push({origin:"string",code:"invalid_format",format:e.format,input:o.value,...e.pattern?{pattern:e.pattern.toString()}:{},inst:t,continue:!e.abort});}):(n=t._zod).check??(n.check=()=>{});}),lf=y("$ZodCheckRegex",(t,e)=>{go.init(t,e),t._zod.check=r=>{e.pattern.lastIndex=0,!e.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:e.pattern.toString(),inst:t,continue:!e.abort});};}),df=y("$ZodCheckLowerCase",(t,e)=>{e.pattern??(e.pattern=tf),go.init(t,e);}),pf=y("$ZodCheckUpperCase",(t,e)=>{e.pattern??(e.pattern=rf),go.init(t,e);}),ff=y("$ZodCheckIncludes",(t,e)=>{Ne.init(t,e);let r=cr(e.includes),n=new RegExp(typeof e.position=="number"?`^.{${e.position}}${r}`:r);e.pattern=n,t._zod.onattach.push(o=>{let s=o._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(n);}),t._zod.check=o=>{o.value.includes(e.includes,e.position)||o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:e.includes,input:o.value,inst:t,continue:!e.abort});};}),mf=y("$ZodCheckStartsWith",(t,e)=>{Ne.init(t,e);let r=new RegExp(`^${cr(e.prefix)}.*`);e.pattern??(e.pattern=r),t._zod.onattach.push(n=>{let o=n._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(r);}),t._zod.check=n=>{n.value.startsWith(e.prefix)||n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:e.prefix,input:n.value,inst:t,continue:!e.abort});};}),hf=y("$ZodCheckEndsWith",(t,e)=>{Ne.init(t,e);let r=new RegExp(`.*${cr(e.suffix)}$`);e.pattern??(e.pattern=r),t._zod.onattach.push(n=>{let o=n._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(r);}),t._zod.check=n=>{n.value.endsWith(e.suffix)||n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:e.suffix,input:n.value,inst:t,continue:!e.abort});};}),gf=y("$ZodCheckOverwrite",(t,e)=>{Ne.init(t,e),t._zod.check=r=>{r.value=e.tx(r.value);};});});var Ms,nc=g(()=>{Ms=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e);}indented(e){this.indent+=1,e(this),this.indent-=1;}write(e){if(typeof e=="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}let n=e.split(`
|
|
10
|
+
`).filter(i=>i),o=Math.min(...n.map(i=>i.length-i.trimStart().length)),s=n.map(i=>i.slice(o)).map(i=>" ".repeat(this.indent*2)+i);for(let i of s)this.content.push(i);}compile(){let e=Function,r=this?.args,o=[...(this?.content??[""]).map(s=>` ${s}`)];return new e(...r,o.join(`
|
|
11
|
+
`))}};});var _f,oc=g(()=>{_f={major:4,minor:0,patch:0};});function Gf(t){if(t==="")return true;if(t.length%4!==0)return false;try{return atob(t),!0}catch{return false}}function cb(t){if(!Xa.test(t))return false;let e=t.replace(/[-_]/g,n=>n==="-"?"+":"/"),r=e.padEnd(Math.ceil(e.length/4)*4,"=");return Gf(r)}function ub(t,e=null){try{let r=t.split(".");if(r.length!==3)return !1;let[n]=r;if(!n)return !1;let o=JSON.parse(atob(n));return !("typ"in o&&o?.typ!=="JWT"||!o.alg||e&&(!("alg"in o)||o.alg!==e))}catch{return false}}function vf(t,e,r){t.issues.length&&e.issues.push(...Ot(r,t.issues)),e.value[r]=t.value;}function Ds(t,e,r){t.issues.length&&e.issues.push(...Ot(r,t.issues)),e.value[r]=t.value;}function kf(t,e,r,n){t.issues.length?n[r]===void 0?r in n?e.value[r]=void 0:e.value[r]=t.value:e.issues.push(...Ot(r,t.issues)):t.value===void 0?r in n&&(e.value[r]=void 0):e.value[r]=t.value;}function wf(t,e,r,n){for(let o of t)if(o.issues.length===0)return e.value=o.value,e;return e.issues.push({code:"invalid_union",input:e.value,inst:r,errors:t.map(o=>o.issues.map(s=>vt(s,n,ot())))}),e}function sc(t,e){if(t===e)return {valid:true,data:t};if(t instanceof Date&&e instanceof Date&&+t==+e)return {valid:true,data:t};if(kn(t)&&kn(e)){let r=Object.keys(e),n=Object.keys(t).filter(s=>r.indexOf(s)!==-1),o={...t,...e};for(let s of n){let i=sc(t[s],e[s]);if(!i.valid)return {valid:false,mergeErrorPath:[s,...i.mergeErrorPath]};o[s]=i.data;}return {valid:true,data:o}}if(Array.isArray(t)&&Array.isArray(e)){if(t.length!==e.length)return {valid:false,mergeErrorPath:[]};let r=[];for(let n=0;n<t.length;n++){let o=t[n],s=e[n],i=sc(o,s);if(!i.valid)return {valid:false,mergeErrorPath:[n,...i.mergeErrorPath]};r.push(i.data);}return {valid:true,data:r}}return {valid:false,mergeErrorPath:[]}}function xf(t,e,r){if(e.issues.length&&t.issues.push(...e.issues),r.issues.length&&t.issues.push(...r.issues),Ur(t))return t;let n=sc(e.value,r.value);if(!n.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(n.mergeErrorPath)}`);return t.value=n.data,t}function bf(t,e){return t.value===void 0&&(t.value=e.defaultValue),t}function $f(t,e){return !t.issues.length&&t.value===void 0&&t.issues.push({code:"invalid_type",expected:"nonoptional",input:t.value,inst:e}),t}function Sf(t,e,r){return Ur(t)?t:e.out._zod.run({value:t.value,issues:t.issues},r)}function Tf(t){return t.value=Object.freeze(t.value),t}function zf(t,e,r,n){if(!t){let o={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(o.params=n._zod.def.params),e.issues.push(Ba(o));}}var ae,qs,ue,Pf,Ef,Cf,jf,Rf,If,Of,Nf,Af,Zf,Mf,Df,qf,Lf,Uf,Ff,Jf,Vf,Bf,Hf,Wf,Kf,Yf,ic,Qf,Xf,em,tm,rm,nm,om,ac,sm,im,am,cm,um,lm,dm,pm,fm,mm,hm,gm,ym,_m,vm,km=g(()=>{Zs();_n();nc();Ya();As();Wt();oc();Wt();ae=y("$ZodType",(t,e)=>{var r;t??(t={}),t._zod.def=e,t._zod.bag=t._zod.bag||{},t._zod.version=_f;let n=[...t._zod.def.checks??[]];t._zod.traits.has("$ZodCheck")&&n.unshift(t);for(let o of n)for(let s of o._zod.onattach)s(t);if(n.length===0)(r=t._zod).deferred??(r.deferred=[]),t._zod.deferred?.push(()=>{t._zod.run=t._zod.parse;});else {let o=(s,i,a)=>{let c=Ur(s),u;for(let l of i){if(l._zod.def.when){if(!l._zod.def.when(s))continue}else if(c)continue;let d=s.issues.length,p=l._zod.check(s);if(p instanceof Promise&&a?.async===false)throw new Ht;if(u||p instanceof Promise)u=(u??Promise.resolve()).then(async()=>{await p,s.issues.length!==d&&(c||(c=Ur(s,d)));});else {if(s.issues.length===d)continue;c||(c=Ur(s,d));}}return u?u.then(()=>s):s};t._zod.run=(s,i)=>{let a=t._zod.parse(s,i);if(a instanceof Promise){if(i.async===false)throw new Ht;return a.then(c=>o(c,n,i))}return o(a,n,i)};}t["~standard"]={validate:o=>{try{let s=ho(t,o);return s.success?{value:s.data}:{issues:s.error?.issues}}catch{return Ns(t,o).then(i=>i.success?{value:i.data}:{issues:i.error?.issues})}},vendor:"zod",version:1};}),qs=y("$ZodString",(t,e)=>{ae.init(t,e),t._zod.pattern=[...t?._zod.bag?.patterns??[]].pop()??Kp(t._zod.bag),t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=String(r.value);}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:t}),r};}),ue=y("$ZodStringFormat",(t,e)=>{go.init(t,e),qs.init(t,e);}),Pf=y("$ZodGUID",(t,e)=>{e.pattern??(e.pattern=Np),ue.init(t,e);}),Ef=y("$ZodUUID",(t,e)=>{if(e.version){let n={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[e.version];if(n===void 0)throw new Error(`Invalid UUID version: "${e.version}"`);e.pattern??(e.pattern=Qa(n));}else e.pattern??(e.pattern=Qa());ue.init(t,e);}),Cf=y("$ZodEmail",(t,e)=>{e.pattern??(e.pattern=Ap),ue.init(t,e);}),jf=y("$ZodURL",(t,e)=>{ue.init(t,e),t._zod.check=r=>{try{let n=r.value,o=new URL(n),s=o.href;e.hostname&&(e.hostname.lastIndex=0,e.hostname.test(o.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:Fp.source,input:r.value,inst:t,continue:!e.abort})),e.protocol&&(e.protocol.lastIndex=0,e.protocol.test(o.protocol.endsWith(":")?o.protocol.slice(0,-1):o.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:e.protocol.source,input:r.value,inst:t,continue:!e.abort})),!n.endsWith("/")&&s.endsWith("/")?r.value=s.slice(0,-1):r.value=s;return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:t,continue:!e.abort});}};}),Rf=y("$ZodEmoji",(t,e)=>{e.pattern??(e.pattern=Zp()),ue.init(t,e);}),If=y("$ZodNanoID",(t,e)=>{e.pattern??(e.pattern=Ip),ue.init(t,e);}),Of=y("$ZodCUID",(t,e)=>{e.pattern??(e.pattern=Pp),ue.init(t,e);}),Nf=y("$ZodCUID2",(t,e)=>{e.pattern??(e.pattern=Ep),ue.init(t,e);}),Af=y("$ZodULID",(t,e)=>{e.pattern??(e.pattern=Cp),ue.init(t,e);}),Zf=y("$ZodXID",(t,e)=>{e.pattern??(e.pattern=jp),ue.init(t,e);}),Mf=y("$ZodKSUID",(t,e)=>{e.pattern??(e.pattern=Rp),ue.init(t,e);}),Df=y("$ZodISODateTime",(t,e)=>{e.pattern??(e.pattern=Wp(e)),ue.init(t,e);}),qf=y("$ZodISODate",(t,e)=>{e.pattern??(e.pattern=Bp),ue.init(t,e);}),Lf=y("$ZodISOTime",(t,e)=>{e.pattern??(e.pattern=Hp(e)),ue.init(t,e);}),Uf=y("$ZodISODuration",(t,e)=>{e.pattern??(e.pattern=Op),ue.init(t,e);}),Ff=y("$ZodIPv4",(t,e)=>{e.pattern??(e.pattern=Mp),ue.init(t,e),t._zod.onattach.push(r=>{let n=r._zod.bag;n.format="ipv4";});}),Jf=y("$ZodIPv6",(t,e)=>{e.pattern??(e.pattern=Dp),ue.init(t,e),t._zod.onattach.push(r=>{let n=r._zod.bag;n.format="ipv6";}),t._zod.check=r=>{try{new URL(`http://[${r.value}]`);}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:t,continue:!e.abort});}};}),Vf=y("$ZodCIDRv4",(t,e)=>{e.pattern??(e.pattern=qp),ue.init(t,e);}),Bf=y("$ZodCIDRv6",(t,e)=>{e.pattern??(e.pattern=Lp),ue.init(t,e),t._zod.check=r=>{let[n,o]=r.value.split("/");try{if(!o)throw new Error;let s=Number(o);if(`${s}`!==o)throw new Error;if(s<0||s>128)throw new Error;new URL(`http://[${n}]`);}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:t,continue:!e.abort});}};});Hf=y("$ZodBase64",(t,e)=>{e.pattern??(e.pattern=Up),ue.init(t,e),t._zod.onattach.push(r=>{r._zod.bag.contentEncoding="base64";}),t._zod.check=r=>{Gf(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:t,continue:!e.abort});};});Wf=y("$ZodBase64URL",(t,e)=>{e.pattern??(e.pattern=Xa),ue.init(t,e),t._zod.onattach.push(r=>{r._zod.bag.contentEncoding="base64url";}),t._zod.check=r=>{cb(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:t,continue:!e.abort});};}),Kf=y("$ZodE164",(t,e)=>{e.pattern??(e.pattern=Jp),ue.init(t,e);});Yf=y("$ZodJWT",(t,e)=>{ue.init(t,e),t._zod.check=r=>{ub(r.value,e.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:t,continue:!e.abort});};}),ic=y("$ZodNumber",(t,e)=>{ae.init(t,e),t._zod.pattern=t._zod.bag.pattern??Qp,t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=Number(r.value);}catch{}let o=r.value;if(typeof o=="number"&&!Number.isNaN(o)&&Number.isFinite(o))return r;let s=typeof o=="number"?Number.isNaN(o)?"NaN":Number.isFinite(o)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:o,inst:t,...s?{received:s}:{}}),r};}),Qf=y("$ZodNumber",(t,e)=>{sf.init(t,e),ic.init(t,e);}),Xf=y("$ZodBoolean",(t,e)=>{ae.init(t,e),t._zod.pattern=Xp,t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=!!r.value;}catch{}let o=r.value;return typeof o=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:t}),r};}),em=y("$ZodNull",(t,e)=>{ae.init(t,e),t._zod.pattern=ef,t._zod.values=new Set([null]),t._zod.parse=(r,n)=>{let o=r.value;return o===null||r.issues.push({expected:"null",code:"invalid_type",input:o,inst:t}),r};}),tm=y("$ZodUnknown",(t,e)=>{ae.init(t,e),t._zod.parse=r=>r;}),rm=y("$ZodNever",(t,e)=>{ae.init(t,e),t._zod.parse=(r,n)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:t}),r);});nm=y("$ZodArray",(t,e)=>{ae.init(t,e),t._zod.parse=(r,n)=>{let o=r.value;if(!Array.isArray(o))return r.issues.push({expected:"array",code:"invalid_type",input:o,inst:t}),r;r.value=Array(o.length);let s=[];for(let i=0;i<o.length;i++){let a=o[i],c=e.element._zod.run({value:a,issues:[]},n);c instanceof Promise?s.push(c.then(u=>vf(u,r,i))):vf(c,r,i);}return s.length?Promise.all(s).then(()=>r):r};});om=y("$ZodObject",(t,e)=>{ae.init(t,e);let r=lo(()=>{let d=Object.keys(e.shape);for(let f of d)if(!(e.shape[f]instanceof ae))throw new Error(`Invalid element at key "${f}": expected a Zod schema`);let p=Ja(e.shape);return {shape:e.shape,keys:d,keySet:new Set(d),numKeys:d.length,optionalKeys:new Set(p)}});ie(t._zod,"propValues",()=>{let d=e.shape,p={};for(let f in d){let h=d[f]._zod;if(h.values){p[f]??(p[f]=new Set);for(let _ of h.values)p[f].add(_);}}return p});let n=d=>{let p=new Ms(["shape","payload","ctx"]),f=r.value,h=$=>{let b=Lr($);return `shape[${b}]._zod.run({ value: input[${b}], issues: [] }, ctx)`};p.write("const input = payload.value;");let _=Object.create(null),w=0;for(let $ of f.keys)_[$]=`key_${w++}`;p.write("const newResult = {}");for(let $ of f.keys)if(f.optionalKeys.has($)){let b=_[$];p.write(`const ${b} = ${h($)};`);let R=Lr($);p.write(`
|
|
12
|
+
if (${b}.issues.length) {
|
|
13
|
+
if (input[${R}] === undefined) {
|
|
14
|
+
if (${R} in input) {
|
|
15
|
+
newResult[${R}] = undefined;
|
|
16
|
+
}
|
|
17
|
+
} else {
|
|
18
|
+
payload.issues = payload.issues.concat(
|
|
19
|
+
${b}.issues.map((iss) => ({
|
|
20
|
+
...iss,
|
|
21
|
+
path: iss.path ? [${R}, ...iss.path] : [${R}],
|
|
22
|
+
}))
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
} else if (${b}.value === undefined) {
|
|
26
|
+
if (${R} in input) newResult[${R}] = undefined;
|
|
27
|
+
} else {
|
|
28
|
+
newResult[${R}] = ${b}.value;
|
|
29
|
+
}
|
|
30
|
+
`);}else {let b=_[$];p.write(`const ${b} = ${h($)};`),p.write(`
|
|
31
|
+
if (${b}.issues.length) payload.issues = payload.issues.concat(${b}.issues.map(iss => ({
|
|
32
|
+
...iss,
|
|
33
|
+
path: iss.path ? [${Lr($)}, ...iss.path] : [${Lr($)}]
|
|
34
|
+
})));`),p.write(`newResult[${Lr($)}] = ${b}.value`);}p.write("payload.value = newResult;"),p.write("return payload;");let x=p.compile();return ($,b)=>x(d,$,b)},o,s=vn,i=!Cs.jitless,c=i&&Ua.value,u=e.catchall,l;t._zod.parse=(d,p)=>{l??(l=r.value);let f=d.value;if(!s(f))return d.issues.push({expected:"object",code:"invalid_type",input:f,inst:t}),d;let h=[];if(i&&c&&p?.async===false&&p.jitless!==true)o||(o=n(e.shape)),d=o(d,p);else {d.value={};let b=l.shape;for(let R of l.keys){let I=b[R],be=I._zod.run({value:f[R],issues:[]},p),$e=I._zod.optin==="optional"&&I._zod.optout==="optional";be instanceof Promise?h.push(be.then(Tt=>$e?kf(Tt,d,R,f):Ds(Tt,d,R))):$e?kf(be,d,R,f):Ds(be,d,R);}}if(!u)return h.length?Promise.all(h).then(()=>d):d;let _=[],w=l.keySet,x=u._zod,$=x.def.type;for(let b of Object.keys(f)){if(w.has(b))continue;if($==="never"){_.push(b);continue}let R=x.run({value:f[b],issues:[]},p);R instanceof Promise?h.push(R.then(I=>Ds(I,d,b))):Ds(R,d,b);}return _.length&&d.issues.push({code:"unrecognized_keys",keys:_,input:f,inst:t}),h.length?Promise.all(h).then(()=>d):d};});ac=y("$ZodUnion",(t,e)=>{ae.init(t,e),ie(t._zod,"optin",()=>e.options.some(r=>r._zod.optin==="optional")?"optional":void 0),ie(t._zod,"optout",()=>e.options.some(r=>r._zod.optout==="optional")?"optional":void 0),ie(t._zod,"values",()=>{if(e.options.every(r=>r._zod.values))return new Set(e.options.flatMap(r=>Array.from(r._zod.values)))}),ie(t._zod,"pattern",()=>{if(e.options.every(r=>r._zod.pattern)){let r=e.options.map(n=>n._zod.pattern);return new RegExp(`^(${r.map(n=>fo(n.source)).join("|")})$`)}}),t._zod.parse=(r,n)=>{let o=false,s=[];for(let i of e.options){let a=i._zod.run({value:r.value,issues:[]},n);if(a instanceof Promise)s.push(a),o=true;else {if(a.issues.length===0)return a;s.push(a);}}return o?Promise.all(s).then(i=>wf(i,r,t,n)):wf(s,r,t,n)};}),sm=y("$ZodDiscriminatedUnion",(t,e)=>{ac.init(t,e);let r=t._zod.parse;ie(t._zod,"propValues",()=>{let o={};for(let s of e.options){let i=s._zod.propValues;if(!i||Object.keys(i).length===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(s)}"`);for(let[a,c]of Object.entries(i)){o[a]||(o[a]=new Set);for(let u of c)o[a].add(u);}}return o});let n=lo(()=>{let o=e.options,s=new Map;for(let i of o){let a=i._zod.propValues[e.discriminator];if(!a||a.size===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(i)}"`);for(let c of a){if(s.has(c))throw new Error(`Duplicate discriminator value "${String(c)}"`);s.set(c,i);}}return s});t._zod.parse=(o,s)=>{let i=o.value;if(!vn(i))return o.issues.push({code:"invalid_type",expected:"object",input:i,inst:t}),o;let a=n.value.get(i?.[e.discriminator]);return a?a._zod.run(o,s):e.unionFallback?r(o,s):(o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",input:i,path:[e.discriminator],inst:t}),o)};}),im=y("$ZodIntersection",(t,e)=>{ae.init(t,e),t._zod.parse=(r,n)=>{let o=r.value,s=e.left._zod.run({value:o,issues:[]},n),i=e.right._zod.run({value:o,issues:[]},n);return s instanceof Promise||i instanceof Promise?Promise.all([s,i]).then(([c,u])=>xf(r,c,u)):xf(r,s,i)};});am=y("$ZodRecord",(t,e)=>{ae.init(t,e),t._zod.parse=(r,n)=>{let o=r.value;if(!kn(o))return r.issues.push({expected:"record",code:"invalid_type",input:o,inst:t}),r;let s=[];if(e.keyType._zod.values){let i=e.keyType._zod.values;r.value={};for(let c of i)if(typeof c=="string"||typeof c=="number"||typeof c=="symbol"){let u=e.valueType._zod.run({value:o[c],issues:[]},n);u instanceof Promise?s.push(u.then(l=>{l.issues.length&&r.issues.push(...Ot(c,l.issues)),r.value[c]=l.value;})):(u.issues.length&&r.issues.push(...Ot(c,u.issues)),r.value[c]=u.value);}let a;for(let c in o)i.has(c)||(a=a??[],a.push(c));a&&a.length>0&&r.issues.push({code:"unrecognized_keys",input:o,inst:t,keys:a});}else {r.value={};for(let i of Reflect.ownKeys(o)){if(i==="__proto__")continue;let a=e.keyType._zod.run({value:i,issues:[]},n);if(a instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(a.issues.length){r.issues.push({origin:"record",code:"invalid_key",issues:a.issues.map(u=>vt(u,n,ot())),input:i,path:[i],inst:t}),r.value[a.value]=a.value;continue}let c=e.valueType._zod.run({value:o[i],issues:[]},n);c instanceof Promise?s.push(c.then(u=>{u.issues.length&&r.issues.push(...Ot(i,u.issues)),r.value[a.value]=u.value;})):(c.issues.length&&r.issues.push(...Ot(i,c.issues)),r.value[a.value]=c.value);}}return s.length?Promise.all(s).then(()=>r):r};}),cm=y("$ZodEnum",(t,e)=>{ae.init(t,e);let r=Ma(e.entries);t._zod.values=new Set(r),t._zod.pattern=new RegExp(`^(${r.filter(n=>Fa.has(typeof n)).map(n=>typeof n=="string"?cr(n):n.toString()).join("|")})$`),t._zod.parse=(n,o)=>{let s=n.value;return t._zod.values.has(s)||n.issues.push({code:"invalid_value",values:r,input:s,inst:t}),n};}),um=y("$ZodLiteral",(t,e)=>{ae.init(t,e),t._zod.values=new Set(e.values),t._zod.pattern=new RegExp(`^(${e.values.map(r=>typeof r=="string"?cr(r):r?r.toString():String(r)).join("|")})$`),t._zod.parse=(r,n)=>{let o=r.value;return t._zod.values.has(o)||r.issues.push({code:"invalid_value",values:e.values,input:o,inst:t}),r};}),lm=y("$ZodTransform",(t,e)=>{ae.init(t,e),t._zod.parse=(r,n)=>{let o=e.transform(r.value,r);if(n.async)return (o instanceof Promise?o:Promise.resolve(o)).then(i=>(r.value=i,r));if(o instanceof Promise)throw new Ht;return r.value=o,r};}),dm=y("$ZodOptional",(t,e)=>{ae.init(t,e),t._zod.optin="optional",t._zod.optout="optional",ie(t._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,void 0]):void 0),ie(t._zod,"pattern",()=>{let r=e.innerType._zod.pattern;return r?new RegExp(`^(${fo(r.source)})?$`):void 0}),t._zod.parse=(r,n)=>e.innerType._zod.optin==="optional"?e.innerType._zod.run(r,n):r.value===void 0?r:e.innerType._zod.run(r,n);}),pm=y("$ZodNullable",(t,e)=>{ae.init(t,e),ie(t._zod,"optin",()=>e.innerType._zod.optin),ie(t._zod,"optout",()=>e.innerType._zod.optout),ie(t._zod,"pattern",()=>{let r=e.innerType._zod.pattern;return r?new RegExp(`^(${fo(r.source)}|null)$`):void 0}),ie(t._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,null]):void 0),t._zod.parse=(r,n)=>r.value===null?r:e.innerType._zod.run(r,n);}),fm=y("$ZodDefault",(t,e)=>{ae.init(t,e),t._zod.optin="optional",ie(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,n)=>{if(r.value===void 0)return r.value=e.defaultValue,r;let o=e.innerType._zod.run(r,n);return o instanceof Promise?o.then(s=>bf(s,e)):bf(o,e)};});mm=y("$ZodPrefault",(t,e)=>{ae.init(t,e),t._zod.optin="optional",ie(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,n)=>(r.value===void 0&&(r.value=e.defaultValue),e.innerType._zod.run(r,n));}),hm=y("$ZodNonOptional",(t,e)=>{ae.init(t,e),ie(t._zod,"values",()=>{let r=e.innerType._zod.values;return r?new Set([...r].filter(n=>n!==void 0)):void 0}),t._zod.parse=(r,n)=>{let o=e.innerType._zod.run(r,n);return o instanceof Promise?o.then(s=>$f(s,t)):$f(o,t)};});gm=y("$ZodCatch",(t,e)=>{ae.init(t,e),t._zod.optin="optional",ie(t._zod,"optout",()=>e.innerType._zod.optout),ie(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,n)=>{let o=e.innerType._zod.run(r,n);return o instanceof Promise?o.then(s=>(r.value=s.value,s.issues.length&&(r.value=e.catchValue({...r,error:{issues:s.issues.map(i=>vt(i,n,ot()))},input:r.value}),r.issues=[]),r)):(r.value=o.value,o.issues.length&&(r.value=e.catchValue({...r,error:{issues:o.issues.map(s=>vt(s,n,ot()))},input:r.value}),r.issues=[]),r)};}),ym=y("$ZodPipe",(t,e)=>{ae.init(t,e),ie(t._zod,"values",()=>e.in._zod.values),ie(t._zod,"optin",()=>e.in._zod.optin),ie(t._zod,"optout",()=>e.out._zod.optout),t._zod.parse=(r,n)=>{let o=e.in._zod.run(r,n);return o instanceof Promise?o.then(s=>Sf(s,e,n)):Sf(o,e,n)};});_m=y("$ZodReadonly",(t,e)=>{ae.init(t,e),ie(t._zod,"propValues",()=>e.innerType._zod.propValues),ie(t._zod,"values",()=>e.innerType._zod.values),ie(t._zod,"optin",()=>e.innerType._zod.optin),ie(t._zod,"optout",()=>e.innerType._zod.optout),t._zod.parse=(r,n)=>{let o=e.innerType._zod.run(r,n);return o instanceof Promise?o.then(Tf):Tf(o)};});vm=y("$ZodCustom",(t,e)=>{Ne.init(t,e),ae.init(t,e),t._zod.parse=(r,n)=>r,t._zod.check=r=>{let n=r.value,o=e.fn(n);if(o instanceof Promise)return o.then(s=>zf(s,r,n,t));zf(o,r,n,t);};});});function wm(){return {localeError:db()}}var lb,db,xm=g(()=>{Wt();lb=t=>{let e=typeof t;switch(e){case "number":return Number.isNaN(t)?"NaN":"number";case "object":{if(Array.isArray(t))return "array";if(t===null)return "null";if(Object.getPrototypeOf(t)!==Object.prototype&&t.constructor)return t.constructor.name}}return e},db=()=>{let t={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"}};function e(n){return t[n]??null}let r={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"};return n=>{switch(n.code){case "invalid_type":return `Invalid input: expected ${n.expected}, received ${lb(n.input)}`;case "invalid_value":return n.values.length===1?`Invalid input: expected ${Is(n.values[0])}`:`Invalid option: expected one of ${js(n.values,"|")}`;case "too_big":{let o=n.inclusive?"<=":"<",s=e(n.origin);return s?`Too big: expected ${n.origin??"value"} to have ${o}${n.maximum.toString()} ${s.unit??"elements"}`:`Too big: expected ${n.origin??"value"} to be ${o}${n.maximum.toString()}`}case "too_small":{let o=n.inclusive?">=":">",s=e(n.origin);return s?`Too small: expected ${n.origin} to have ${o}${n.minimum.toString()} ${s.unit}`:`Too small: expected ${n.origin} to be ${o}${n.minimum.toString()}`}case "invalid_format":{let o=n;return o.format==="starts_with"?`Invalid string: must start with "${o.prefix}"`:o.format==="ends_with"?`Invalid string: must end with "${o.suffix}"`:o.format==="includes"?`Invalid string: must include "${o.includes}"`:o.format==="regex"?`Invalid string: must match pattern ${o.pattern}`:`Invalid ${r[o.format]??n.format}`}case "not_multiple_of":return `Invalid number: must be a multiple of ${n.divisor}`;case "unrecognized_keys":return `Unrecognized key${n.keys.length>1?"s":""}: ${js(n.keys,", ")}`;case "invalid_key":return `Invalid key in ${n.origin}`;case "invalid_union":return "Invalid input";case "invalid_element":return `Invalid value in ${n.origin}`;default:return "Invalid input"}}};});var Ls=g(()=>{});function pb(){return new uc}var uc,yo,bm=g(()=>{uc=class{constructor(){this._map=new Map,this._idmap=new Map;}add(e,...r){let n=r[0];if(this._map.set(e,n),n&&typeof n=="object"&&"id"in n){if(this._idmap.has(n.id))throw new Error(`ID ${n.id} already exists in the registry`);this._idmap.set(n.id,e);}return this}clear(){return this._map=new Map,this._idmap=new Map,this}remove(e){let r=this._map.get(e);return r&&typeof r=="object"&&"id"in r&&this._idmap.delete(r.id),this._map.delete(e),this}get(e){let r=e._zod.parent;if(r){let n={...this.get(r)??{}};return delete n.id,{...n,...this._map.get(e)}}return this._map.get(e)}has(e){return this._map.has(e)}};yo=pb();});function $m(t,e){return new t({type:"string",...N(e)})}function Sm(t,e){return new t({type:"string",format:"email",check:"string_format",abort:false,...N(e)})}function lc(t,e){return new t({type:"string",format:"guid",check:"string_format",abort:false,...N(e)})}function Tm(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:false,...N(e)})}function zm(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:false,version:"v4",...N(e)})}function Pm(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:false,version:"v6",...N(e)})}function Em(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:false,version:"v7",...N(e)})}function Cm(t,e){return new t({type:"string",format:"url",check:"string_format",abort:false,...N(e)})}function jm(t,e){return new t({type:"string",format:"emoji",check:"string_format",abort:false,...N(e)})}function Rm(t,e){return new t({type:"string",format:"nanoid",check:"string_format",abort:false,...N(e)})}function Im(t,e){return new t({type:"string",format:"cuid",check:"string_format",abort:false,...N(e)})}function Om(t,e){return new t({type:"string",format:"cuid2",check:"string_format",abort:false,...N(e)})}function Nm(t,e){return new t({type:"string",format:"ulid",check:"string_format",abort:false,...N(e)})}function Am(t,e){return new t({type:"string",format:"xid",check:"string_format",abort:false,...N(e)})}function Zm(t,e){return new t({type:"string",format:"ksuid",check:"string_format",abort:false,...N(e)})}function Mm(t,e){return new t({type:"string",format:"ipv4",check:"string_format",abort:false,...N(e)})}function Dm(t,e){return new t({type:"string",format:"ipv6",check:"string_format",abort:false,...N(e)})}function qm(t,e){return new t({type:"string",format:"cidrv4",check:"string_format",abort:false,...N(e)})}function Lm(t,e){return new t({type:"string",format:"cidrv6",check:"string_format",abort:false,...N(e)})}function Um(t,e){return new t({type:"string",format:"base64",check:"string_format",abort:false,...N(e)})}function Fm(t,e){return new t({type:"string",format:"base64url",check:"string_format",abort:false,...N(e)})}function Jm(t,e){return new t({type:"string",format:"e164",check:"string_format",abort:false,...N(e)})}function Vm(t,e){return new t({type:"string",format:"jwt",check:"string_format",abort:false,...N(e)})}function Bm(t,e){return new t({type:"string",format:"datetime",check:"string_format",offset:false,local:false,precision:null,...N(e)})}function Gm(t,e){return new t({type:"string",format:"date",check:"string_format",...N(e)})}function Hm(t,e){return new t({type:"string",format:"time",check:"string_format",precision:null,...N(e)})}function Wm(t,e){return new t({type:"string",format:"duration",check:"string_format",...N(e)})}function Km(t,e){return new t({type:"number",checks:[],...N(e)})}function Ym(t,e){return new t({type:"number",check:"number_format",abort:false,format:"safeint",...N(e)})}function Qm(t,e){return new t({type:"boolean",...N(e)})}function Xm(t,e){return new t({type:"null",...N(e)})}function eh(t){return new t({type:"unknown"})}function th(t,e){return new t({type:"never",...N(e)})}function Us(t,e){return new tc({check:"less_than",...N(e),value:t,inclusive:false})}function _o(t,e){return new tc({check:"less_than",...N(e),value:t,inclusive:true})}function Fs(t,e){return new rc({check:"greater_than",...N(e),value:t,inclusive:false})}function vo(t,e){return new rc({check:"greater_than",...N(e),value:t,inclusive:true})}function Js(t,e){return new of({check:"multiple_of",...N(e),value:t})}function Vs(t,e){return new af({check:"max_length",...N(e),maximum:t})}function wn(t,e){return new cf({check:"min_length",...N(e),minimum:t})}function Bs(t,e){return new uf({check:"length_equals",...N(e),length:t})}function dc(t,e){return new lf({check:"string_format",format:"regex",...N(e),pattern:t})}function pc(t){return new df({check:"string_format",format:"lowercase",...N(t)})}function fc(t){return new pf({check:"string_format",format:"uppercase",...N(t)})}function mc(t,e){return new ff({check:"string_format",format:"includes",...N(e),includes:t})}function hc(t,e){return new mf({check:"string_format",format:"starts_with",...N(e),prefix:t})}function gc(t,e){return new hf({check:"string_format",format:"ends_with",...N(e),suffix:t})}function Fr(t){return new gf({check:"overwrite",tx:t})}function yc(t){return Fr(e=>e.normalize(t))}function _c(){return Fr(t=>t.trim())}function vc(){return Fr(t=>t.toLowerCase())}function kc(){return Fr(t=>t.toUpperCase())}function rh(t,e,r){return new t({type:"array",element:e,...N(r)})}function nh(t,e,r){let n=N(r);return n.abort??(n.abort=true),new t({type:"custom",check:"custom",fn:e,...n})}function oh(t,e,r){return new t({type:"custom",check:"custom",fn:e,...N(r)})}var sh=g(()=>{Zs();Wt();});var ih=g(()=>{});var ah=g(()=>{});var ch=g(()=>{});var st=g(()=>{_n();Ya();Ha();km();Zs();oc();Wt();As();Ls();bm();nc();ih();sh();ah();ch();});var uh=g(()=>{st();});var lh=g(()=>{});var dh=g(()=>{});var ph=g(()=>{});var fh=g(()=>{});var mh=g(()=>{st();uh();lh();dh();Ls();ph();fh();});var hh=g(()=>{mh();});var gh=g(()=>{hh();});function bn(t){return !!t._zod}function ur(t,e){return bn(t)?ho(t,e):t.safeParse(e)}function Gs(t){if(!t)return;let e;if(bn(t)?e=t._zod?.def?.shape:e=t.shape,!!e){if(typeof e=="function")try{return e()}catch{return}return e}}function yh(t){if(bn(t)){let s=t._zod?.def;if(s){if(s.value!==void 0)return s.value;if(Array.isArray(s.values)&&s.values.length>0)return s.values[0]}}let r=t._def;if(r){if(r.value!==void 0)return r.value;if(Array.isArray(r.values)&&r.values.length>0)return r.values[0]}let n=t.value;if(n!==void 0)return n}var Hs=g(()=>{gh();});var wc=g(()=>{st();});var ko={};Gn(ko,{ZodISODate:()=>vh,ZodISODateTime:()=>_h,ZodISODuration:()=>wh,ZodISOTime:()=>kh,date:()=>bc,datetime:()=>xc,duration:()=>Sc,time:()=>$c});function xc(t){return Bm(_h,t)}function bc(t){return Gm(vh,t)}function $c(t){return Hm(kh,t)}function Sc(t){return Wm(wh,t)}var _h,vh,kh,wh,Tc=g(()=>{st();zc();_h=y("ZodISODateTime",(t,e)=>{Df.init(t,e),fe.init(t,e);});vh=y("ZodISODate",(t,e)=>{qf.init(t,e),fe.init(t,e);});kh=y("ZodISOTime",(t,e)=>{Lf.init(t,e),fe.init(t,e);});wh=y("ZodISODuration",(t,e)=>{Uf.init(t,e),fe.init(t,e);});});var xh,wo,Pc=g(()=>{st();st();xh=(t,e)=>{Os.init(t,e),t.name="ZodError",Object.defineProperties(t,{format:{value:r=>Sp(t,r)},flatten:{value:r=>$p(t,r)},addIssue:{value:r=>t.issues.push(r)},addIssues:{value:r=>t.issues.push(...r)},isEmpty:{get(){return t.issues.length===0}}});},y("ZodError",xh),wo=y("ZodError",xh,{Parent:Error});});var bh,$h,Sh,Th,Ec=g(()=>{st();Pc();bh=Tp(wo),$h=zp(wo),Sh=Wa(wo),Th=Ka(wo);});function m(t){return $m(bb,t)}function re(t){return Km(jh,t)}function Ph(t){return Ym(Lb,t)}function xe(t){return Qm(Ub,t)}function Rh(t){return Xm(Fb,t)}function me(){return eh(Jb)}function Bb(t){return th(Vb,t)}function H(t,e){return rh(Gb,t,e)}function P(t,e){let r={type:"object",get shape(){return X.assignProp(this,"shape",{...t}),this.shape},...X.normalizeParams(e)};return new Ih(r)}function Le(t,e){return new Ih({type:"object",get shape(){return X.assignProp(this,"shape",{...t}),this.shape},catchall:me(),...X.normalizeParams(e)})}function le(t,e){return new Oh({type:"union",options:t,...X.normalizeParams(e)})}function Rc(t,e,r){return new Hb({type:"union",options:e,discriminator:t,...X.normalizeParams(r)})}function Ks(t,e){return new Wb({type:"intersection",left:t,right:e})}function ce(t,e,r){return new Kb({type:"record",keyType:t,valueType:e,...X.normalizeParams(r)})}function Ge(t,e){let r=Array.isArray(t)?Object.fromEntries(t.map(n=>[n,n])):t;return new Cc({type:"enum",entries:r,...X.normalizeParams(e)})}function C(t,e){return new Yb({type:"literal",values:Array.isArray(t)?t:[t],...X.normalizeParams(e)})}function Nh(t){return new Qb({type:"transform",transform:t})}function he(t){return new Ah({type:"optional",innerType:t})}function Eh(t){return new Xb({type:"nullable",innerType:t})}function t$(t,e){return new e$({type:"default",innerType:t,get defaultValue(){return typeof e=="function"?e():e}})}function n$(t,e){return new r$({type:"prefault",innerType:t,get defaultValue(){return typeof e=="function"?e():e}})}function o$(t,e){return new Zh({type:"nonoptional",innerType:t,...X.normalizeParams(e)})}function i$(t,e){return new s$({type:"catch",innerType:t,catchValue:typeof e=="function"?e:()=>e})}function jc(t,e){return new a$({type:"pipe",in:t,out:e})}function u$(t){return new c$({type:"readonly",innerType:t})}function l$(t){let e=new Ne({check:"custom"});return e._zod.check=t,e}function Dh(t,e){return nh(Mh,t??(()=>true),e)}function d$(t,e={}){return oh(Mh,t,e)}function p$(t){let e=l$(r=>(r.addIssue=n=>{if(typeof n=="string")r.issues.push(X.issue(n,r.value,e._zod.def));else {let o=n;o.fatal&&(o.continue=false),o.code??(o.code="custom"),o.input??(o.input=r.value),o.inst??(o.inst=e),o.continue??(o.continue=!e._zod.def.abort),r.issues.push(X.issue(o));}},t(r.value,r)));return e}function Ic(t,e){return jc(Nh(t),e)}var ge,Ch,bb,fe,$b,zh,Ws,Sb,Tb,zb,Pb,Eb,Cb,jb,Rb,Ib,Ob,Nb,Ab,Zb,Mb,Db,qb,jh,Lb,Ub,Fb,Jb,Vb,Gb,Ih,Oh,Hb,Wb,Kb,Cc,Yb,Qb,Ah,Xb,e$,r$,Zh,s$,a$,c$,Mh,zc=g(()=>{st();st();wc();Tc();Ec();ge=y("ZodType",(t,e)=>(ae.init(t,e),t.def=e,Object.defineProperty(t,"_def",{value:e}),t.check=(...r)=>t.clone({...e,checks:[...e.checks??[],...r.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]}),t.clone=(r,n)=>It(t,r,n),t.brand=()=>t,t.register=((r,n)=>(r.add(t,n),t)),t.parse=(r,n)=>bh(t,r,n,{callee:t.parse}),t.safeParse=(r,n)=>Sh(t,r,n),t.parseAsync=async(r,n)=>$h(t,r,n,{callee:t.parseAsync}),t.safeParseAsync=async(r,n)=>Th(t,r,n),t.spa=t.safeParseAsync,t.refine=(r,n)=>t.check(d$(r,n)),t.superRefine=r=>t.check(p$(r)),t.overwrite=r=>t.check(Fr(r)),t.optional=()=>he(t),t.nullable=()=>Eh(t),t.nullish=()=>he(Eh(t)),t.nonoptional=r=>o$(t,r),t.array=()=>H(t),t.or=r=>le([t,r]),t.and=r=>Ks(t,r),t.transform=r=>jc(t,Nh(r)),t.default=r=>t$(t,r),t.prefault=r=>n$(t,r),t.catch=r=>i$(t,r),t.pipe=r=>jc(t,r),t.readonly=()=>u$(t),t.describe=r=>{let n=t.clone();return yo.add(n,{description:r}),n},Object.defineProperty(t,"description",{get(){return yo.get(t)?.description},configurable:true}),t.meta=(...r)=>{if(r.length===0)return yo.get(t);let n=t.clone();return yo.add(n,r[0]),n},t.isOptional=()=>t.safeParse(void 0).success,t.isNullable=()=>t.safeParse(null).success,t)),Ch=y("_ZodString",(t,e)=>{qs.init(t,e),ge.init(t,e);let r=t._zod.bag;t.format=r.format??null,t.minLength=r.minimum??null,t.maxLength=r.maximum??null,t.regex=(...n)=>t.check(dc(...n)),t.includes=(...n)=>t.check(mc(...n)),t.startsWith=(...n)=>t.check(hc(...n)),t.endsWith=(...n)=>t.check(gc(...n)),t.min=(...n)=>t.check(wn(...n)),t.max=(...n)=>t.check(Vs(...n)),t.length=(...n)=>t.check(Bs(...n)),t.nonempty=(...n)=>t.check(wn(1,...n)),t.lowercase=n=>t.check(pc(n)),t.uppercase=n=>t.check(fc(n)),t.trim=()=>t.check(_c()),t.normalize=(...n)=>t.check(yc(...n)),t.toLowerCase=()=>t.check(vc()),t.toUpperCase=()=>t.check(kc());}),bb=y("ZodString",(t,e)=>{qs.init(t,e),Ch.init(t,e),t.email=r=>t.check(Sm($b,r)),t.url=r=>t.check(Cm(Sb,r)),t.jwt=r=>t.check(Vm(qb,r)),t.emoji=r=>t.check(jm(Tb,r)),t.guid=r=>t.check(lc(zh,r)),t.uuid=r=>t.check(Tm(Ws,r)),t.uuidv4=r=>t.check(zm(Ws,r)),t.uuidv6=r=>t.check(Pm(Ws,r)),t.uuidv7=r=>t.check(Em(Ws,r)),t.nanoid=r=>t.check(Rm(zb,r)),t.guid=r=>t.check(lc(zh,r)),t.cuid=r=>t.check(Im(Pb,r)),t.cuid2=r=>t.check(Om(Eb,r)),t.ulid=r=>t.check(Nm(Cb,r)),t.base64=r=>t.check(Um(Zb,r)),t.base64url=r=>t.check(Fm(Mb,r)),t.xid=r=>t.check(Am(jb,r)),t.ksuid=r=>t.check(Zm(Rb,r)),t.ipv4=r=>t.check(Mm(Ib,r)),t.ipv6=r=>t.check(Dm(Ob,r)),t.cidrv4=r=>t.check(qm(Nb,r)),t.cidrv6=r=>t.check(Lm(Ab,r)),t.e164=r=>t.check(Jm(Db,r)),t.datetime=r=>t.check(xc(r)),t.date=r=>t.check(bc(r)),t.time=r=>t.check($c(r)),t.duration=r=>t.check(Sc(r));});fe=y("ZodStringFormat",(t,e)=>{ue.init(t,e),Ch.init(t,e);}),$b=y("ZodEmail",(t,e)=>{Cf.init(t,e),fe.init(t,e);}),zh=y("ZodGUID",(t,e)=>{Pf.init(t,e),fe.init(t,e);}),Ws=y("ZodUUID",(t,e)=>{Ef.init(t,e),fe.init(t,e);}),Sb=y("ZodURL",(t,e)=>{jf.init(t,e),fe.init(t,e);}),Tb=y("ZodEmoji",(t,e)=>{Rf.init(t,e),fe.init(t,e);}),zb=y("ZodNanoID",(t,e)=>{If.init(t,e),fe.init(t,e);}),Pb=y("ZodCUID",(t,e)=>{Of.init(t,e),fe.init(t,e);}),Eb=y("ZodCUID2",(t,e)=>{Nf.init(t,e),fe.init(t,e);}),Cb=y("ZodULID",(t,e)=>{Af.init(t,e),fe.init(t,e);}),jb=y("ZodXID",(t,e)=>{Zf.init(t,e),fe.init(t,e);}),Rb=y("ZodKSUID",(t,e)=>{Mf.init(t,e),fe.init(t,e);}),Ib=y("ZodIPv4",(t,e)=>{Ff.init(t,e),fe.init(t,e);}),Ob=y("ZodIPv6",(t,e)=>{Jf.init(t,e),fe.init(t,e);}),Nb=y("ZodCIDRv4",(t,e)=>{Vf.init(t,e),fe.init(t,e);}),Ab=y("ZodCIDRv6",(t,e)=>{Bf.init(t,e),fe.init(t,e);}),Zb=y("ZodBase64",(t,e)=>{Hf.init(t,e),fe.init(t,e);}),Mb=y("ZodBase64URL",(t,e)=>{Wf.init(t,e),fe.init(t,e);}),Db=y("ZodE164",(t,e)=>{Kf.init(t,e),fe.init(t,e);}),qb=y("ZodJWT",(t,e)=>{Yf.init(t,e),fe.init(t,e);}),jh=y("ZodNumber",(t,e)=>{ic.init(t,e),ge.init(t,e),t.gt=(n,o)=>t.check(Fs(n,o)),t.gte=(n,o)=>t.check(vo(n,o)),t.min=(n,o)=>t.check(vo(n,o)),t.lt=(n,o)=>t.check(Us(n,o)),t.lte=(n,o)=>t.check(_o(n,o)),t.max=(n,o)=>t.check(_o(n,o)),t.int=n=>t.check(Ph(n)),t.safe=n=>t.check(Ph(n)),t.positive=n=>t.check(Fs(0,n)),t.nonnegative=n=>t.check(vo(0,n)),t.negative=n=>t.check(Us(0,n)),t.nonpositive=n=>t.check(_o(0,n)),t.multipleOf=(n,o)=>t.check(Js(n,o)),t.step=(n,o)=>t.check(Js(n,o)),t.finite=()=>t;let r=t._zod.bag;t.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,t.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,t.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??.5),t.isFinite=true,t.format=r.format??null;});Lb=y("ZodNumberFormat",(t,e)=>{Qf.init(t,e),jh.init(t,e);});Ub=y("ZodBoolean",(t,e)=>{Xf.init(t,e),ge.init(t,e);});Fb=y("ZodNull",(t,e)=>{em.init(t,e),ge.init(t,e);});Jb=y("ZodUnknown",(t,e)=>{tm.init(t,e),ge.init(t,e);});Vb=y("ZodNever",(t,e)=>{rm.init(t,e),ge.init(t,e);});Gb=y("ZodArray",(t,e)=>{nm.init(t,e),ge.init(t,e),t.element=e.element,t.min=(r,n)=>t.check(wn(r,n)),t.nonempty=r=>t.check(wn(1,r)),t.max=(r,n)=>t.check(Vs(r,n)),t.length=(r,n)=>t.check(Bs(r,n)),t.unwrap=()=>t.element;});Ih=y("ZodObject",(t,e)=>{om.init(t,e),ge.init(t,e),X.defineLazy(t,"shape",()=>e.shape),t.keyof=()=>Ge(Object.keys(t._zod.def.shape)),t.catchall=r=>t.clone({...t._zod.def,catchall:r}),t.passthrough=()=>t.clone({...t._zod.def,catchall:me()}),t.loose=()=>t.clone({...t._zod.def,catchall:me()}),t.strict=()=>t.clone({...t._zod.def,catchall:Bb()}),t.strip=()=>t.clone({...t._zod.def,catchall:void 0}),t.extend=r=>X.extend(t,r),t.merge=r=>X.merge(t,r),t.pick=r=>X.pick(t,r),t.omit=r=>X.omit(t,r),t.partial=(...r)=>X.partial(Ah,t,r[0]),t.required=(...r)=>X.required(Zh,t,r[0]);});Oh=y("ZodUnion",(t,e)=>{ac.init(t,e),ge.init(t,e),t.options=e.options;});Hb=y("ZodDiscriminatedUnion",(t,e)=>{Oh.init(t,e),sm.init(t,e);});Wb=y("ZodIntersection",(t,e)=>{im.init(t,e),ge.init(t,e);});Kb=y("ZodRecord",(t,e)=>{am.init(t,e),ge.init(t,e),t.keyType=e.keyType,t.valueType=e.valueType;});Cc=y("ZodEnum",(t,e)=>{cm.init(t,e),ge.init(t,e),t.enum=e.entries,t.options=Object.values(e.entries);let r=new Set(Object.keys(e.entries));t.extract=(n,o)=>{let s={};for(let i of n)if(r.has(i))s[i]=e.entries[i];else throw new Error(`Key ${i} not found in enum`);return new Cc({...e,checks:[],...X.normalizeParams(o),entries:s})},t.exclude=(n,o)=>{let s={...e.entries};for(let i of n)if(r.has(i))delete s[i];else throw new Error(`Key ${i} not found in enum`);return new Cc({...e,checks:[],...X.normalizeParams(o),entries:s})};});Yb=y("ZodLiteral",(t,e)=>{um.init(t,e),ge.init(t,e),t.values=new Set(e.values),Object.defineProperty(t,"value",{get(){if(e.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return e.values[0]}});});Qb=y("ZodTransform",(t,e)=>{lm.init(t,e),ge.init(t,e),t._zod.parse=(r,n)=>{r.addIssue=s=>{if(typeof s=="string")r.issues.push(X.issue(s,r.value,e));else {let i=s;i.fatal&&(i.continue=false),i.code??(i.code="custom"),i.input??(i.input=r.value),i.inst??(i.inst=t),i.continue??(i.continue=true),r.issues.push(X.issue(i));}};let o=e.transform(r.value,r);return o instanceof Promise?o.then(s=>(r.value=s,r)):(r.value=o,r)};});Ah=y("ZodOptional",(t,e)=>{dm.init(t,e),ge.init(t,e),t.unwrap=()=>t._zod.def.innerType;});Xb=y("ZodNullable",(t,e)=>{pm.init(t,e),ge.init(t,e),t.unwrap=()=>t._zod.def.innerType;});e$=y("ZodDefault",(t,e)=>{fm.init(t,e),ge.init(t,e),t.unwrap=()=>t._zod.def.innerType,t.removeDefault=t.unwrap;});r$=y("ZodPrefault",(t,e)=>{mm.init(t,e),ge.init(t,e),t.unwrap=()=>t._zod.def.innerType;});Zh=y("ZodNonOptional",(t,e)=>{hm.init(t,e),ge.init(t,e),t.unwrap=()=>t._zod.def.innerType;});s$=y("ZodCatch",(t,e)=>{gm.init(t,e),ge.init(t,e),t.unwrap=()=>t._zod.def.innerType,t.removeCatch=t.unwrap;});a$=y("ZodPipe",(t,e)=>{ym.init(t,e),ge.init(t,e),t.in=e.in,t.out=e.out;});c$=y("ZodReadonly",(t,e)=>{_m.init(t,e),ge.init(t,e);});Mh=y("ZodCustom",(t,e)=>{vm.init(t,e),ge.init(t,e);});});var qh=g(()=>{});var Lh=g(()=>{});var Uh=g(()=>{st();zc();wc();Pc();Ec();qh();st();xm();Ls();Tc();Lh();ot(wm());});var Fh=g(()=>{Uh();});var Jh=g(()=>{Fh();});var Nc,Vh,lr,Qs,ke,Bh,Gh,h$,g$,Ac,Qe,xo,Hh,Te,it,at,ze,Xs,Wh,Zc,Kh,Yh,Mc,bo,G,Dc,Qh,Xh,ei,y$,ti,_$,$o,$n,eg,v$,k$,w$,x$,b$,$$,qc,S$,T$,Lc,ri,z$,P$,ni,E$,So,To,C$,zo,Sn,j$,Po,oi,si,ii,ai,ci,ui,tg,rg,ng,Uc,og,Eo,Tn,sg,R$,I$,O$,N$,A$,Fc,Z$,M$,D$,q$,L$,U$,F$,J$,V$,B$,G$,H$,W$,K$,Y$,Q$,Jc,Vc,Bc,X$,e0,t0,Gc,r0,n0,o0,s0,i0,ig,Hc,a0,li,c0,Co,u0,jo,l0,Wc,d0,p0,f0,m0,h0,g0,y0,Ys,_0,v0,k0,Ro,Kc,w0,x0,b0,$0,S0,T0,z0,P0,E0,C0,j0,R0,I0,O0,N0,A0,Z0,M0,zn,D0,q0,L0,U0,F0,J0,V0,Yc,B0,D,Oc,Pn=g(()=>{Jh();Nc="2025-11-25",Vh=[Nc,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],lr="io.modelcontextprotocol/related-task",Qs="2.0",ke=Dh(t=>t!==null&&(typeof t=="object"||typeof t=="function")),Bh=le([m(),re().int()]),Gh=m(),Le({ttl:re().optional(),pollInterval:re().optional()}),h$=P({ttl:re().optional()}),g$=P({taskId:m()}),Ac=Le({progressToken:Bh.optional(),[lr]:g$.optional()}),Qe=P({_meta:Ac.optional()}),xo=Qe.extend({task:h$.optional()}),Hh=t=>xo.safeParse(t).success,Te=P({method:m(),params:Qe.loose().optional()}),it=P({_meta:Ac.optional()}),at=P({method:m(),params:it.loose().optional()}),ze=Le({_meta:Ac.optional()}),Xs=le([m(),re().int()]),Wh=P({jsonrpc:C(Qs),id:Xs,...Te.shape}).strict(),Zc=t=>Wh.safeParse(t).success,Kh=P({jsonrpc:C(Qs),...at.shape}).strict(),Yh=t=>Kh.safeParse(t).success,Mc=P({jsonrpc:C(Qs),id:Xs,result:ze}).strict(),bo=t=>Mc.safeParse(t).success;(function(t){t[t.ConnectionClosed=-32e3]="ConnectionClosed",t[t.RequestTimeout=-32001]="RequestTimeout",t[t.ParseError=-32700]="ParseError",t[t.InvalidRequest=-32600]="InvalidRequest",t[t.MethodNotFound=-32601]="MethodNotFound",t[t.InvalidParams=-32602]="InvalidParams",t[t.InternalError=-32603]="InternalError",t[t.UrlElicitationRequired=-32042]="UrlElicitationRequired";})(G||(G={}));Dc=P({jsonrpc:C(Qs),id:Xs.optional(),error:P({code:re().int(),message:m(),data:me().optional()})}).strict(),Qh=t=>Dc.safeParse(t).success,Xh=le([Wh,Kh,Mc,Dc]),le([Mc,Dc]),ei=ze.strict(),y$=it.extend({requestId:Xs.optional(),reason:m().optional()}),ti=at.extend({method:C("notifications/cancelled"),params:y$}),_$=P({src:m(),mimeType:m().optional(),sizes:H(m()).optional(),theme:Ge(["light","dark"]).optional()}),$o=P({icons:H(_$).optional()}),$n=P({name:m(),title:m().optional()}),eg=$n.extend({...$n.shape,...$o.shape,version:m(),websiteUrl:m().optional(),description:m().optional()}),v$=Ks(P({applyDefaults:xe().optional()}),ce(m(),me())),k$=Ic(t=>t&&typeof t=="object"&&!Array.isArray(t)&&Object.keys(t).length===0?{form:{}}:t,Ks(P({form:v$.optional(),url:ke.optional()}),ce(m(),me()).optional())),w$=Le({list:ke.optional(),cancel:ke.optional(),requests:Le({sampling:Le({createMessage:ke.optional()}).optional(),elicitation:Le({create:ke.optional()}).optional()}).optional()}),x$=Le({list:ke.optional(),cancel:ke.optional(),requests:Le({tools:Le({call:ke.optional()}).optional()}).optional()}),b$=P({experimental:ce(m(),ke).optional(),sampling:P({context:ke.optional(),tools:ke.optional()}).optional(),elicitation:k$.optional(),roots:P({listChanged:xe().optional()}).optional(),tasks:w$.optional(),extensions:ce(m(),ke).optional()}),$$=Qe.extend({protocolVersion:m(),capabilities:b$,clientInfo:eg}),qc=Te.extend({method:C("initialize"),params:$$}),S$=P({experimental:ce(m(),ke).optional(),logging:ke.optional(),completions:ke.optional(),prompts:P({listChanged:xe().optional()}).optional(),resources:P({subscribe:xe().optional(),listChanged:xe().optional()}).optional(),tools:P({listChanged:xe().optional()}).optional(),tasks:x$.optional(),extensions:ce(m(),ke).optional()}),T$=ze.extend({protocolVersion:m(),capabilities:S$,serverInfo:eg,instructions:m().optional()}),Lc=at.extend({method:C("notifications/initialized"),params:it.optional()}),ri=Te.extend({method:C("ping"),params:Qe.optional()}),z$=P({progress:re(),total:he(re()),message:he(m())}),P$=P({...it.shape,...z$.shape,progressToken:Bh}),ni=at.extend({method:C("notifications/progress"),params:P$}),E$=Qe.extend({cursor:Gh.optional()}),So=Te.extend({params:E$.optional()}),To=ze.extend({nextCursor:Gh.optional()}),C$=Ge(["working","input_required","completed","failed","cancelled"]),zo=P({taskId:m(),status:C$,ttl:le([re(),Rh()]),createdAt:m(),lastUpdatedAt:m(),pollInterval:he(re()),statusMessage:he(m())}),Sn=ze.extend({task:zo}),j$=it.merge(zo),Po=at.extend({method:C("notifications/tasks/status"),params:j$}),oi=Te.extend({method:C("tasks/get"),params:Qe.extend({taskId:m()})}),si=ze.merge(zo),ii=Te.extend({method:C("tasks/result"),params:Qe.extend({taskId:m()})}),ze.loose(),ai=So.extend({method:C("tasks/list")}),ci=To.extend({tasks:H(zo)}),ui=Te.extend({method:C("tasks/cancel"),params:Qe.extend({taskId:m()})}),tg=ze.merge(zo),rg=P({uri:m(),mimeType:he(m()),_meta:ce(m(),me()).optional()}),ng=rg.extend({text:m()}),Uc=m().refine(t=>{try{return atob(t),!0}catch{return false}},{message:"Invalid Base64 string"}),og=rg.extend({blob:Uc}),Eo=Ge(["user","assistant"]),Tn=P({audience:H(Eo).optional(),priority:re().min(0).max(1).optional(),lastModified:ko.datetime({offset:true}).optional()}),sg=P({...$n.shape,...$o.shape,uri:m(),description:he(m()),mimeType:he(m()),size:he(re()),annotations:Tn.optional(),_meta:he(Le({}))}),R$=P({...$n.shape,...$o.shape,uriTemplate:m(),description:he(m()),mimeType:he(m()),annotations:Tn.optional(),_meta:he(Le({}))}),I$=So.extend({method:C("resources/list")}),O$=To.extend({resources:H(sg)}),N$=So.extend({method:C("resources/templates/list")}),A$=To.extend({resourceTemplates:H(R$)}),Fc=Qe.extend({uri:m()}),Z$=Fc,M$=Te.extend({method:C("resources/read"),params:Z$}),D$=ze.extend({contents:H(le([ng,og]))}),q$=at.extend({method:C("notifications/resources/list_changed"),params:it.optional()}),L$=Fc,U$=Te.extend({method:C("resources/subscribe"),params:L$}),F$=Fc,J$=Te.extend({method:C("resources/unsubscribe"),params:F$}),V$=it.extend({uri:m()}),B$=at.extend({method:C("notifications/resources/updated"),params:V$}),G$=P({name:m(),description:he(m()),required:he(xe())}),H$=P({...$n.shape,...$o.shape,description:he(m()),arguments:he(H(G$)),_meta:he(Le({}))}),W$=So.extend({method:C("prompts/list")}),K$=To.extend({prompts:H(H$)}),Y$=Qe.extend({name:m(),arguments:ce(m(),m()).optional()}),Q$=Te.extend({method:C("prompts/get"),params:Y$}),Jc=P({type:C("text"),text:m(),annotations:Tn.optional(),_meta:ce(m(),me()).optional()}),Vc=P({type:C("image"),data:Uc,mimeType:m(),annotations:Tn.optional(),_meta:ce(m(),me()).optional()}),Bc=P({type:C("audio"),data:Uc,mimeType:m(),annotations:Tn.optional(),_meta:ce(m(),me()).optional()}),X$=P({type:C("tool_use"),name:m(),id:m(),input:ce(m(),me()),_meta:ce(m(),me()).optional()}),e0=P({type:C("resource"),resource:le([ng,og]),annotations:Tn.optional(),_meta:ce(m(),me()).optional()}),t0=sg.extend({type:C("resource_link")}),Gc=le([Jc,Vc,Bc,t0,e0]),r0=P({role:Eo,content:Gc}),n0=ze.extend({description:m().optional(),messages:H(r0)}),o0=at.extend({method:C("notifications/prompts/list_changed"),params:it.optional()}),s0=P({title:m().optional(),readOnlyHint:xe().optional(),destructiveHint:xe().optional(),idempotentHint:xe().optional(),openWorldHint:xe().optional()}),i0=P({taskSupport:Ge(["required","optional","forbidden"]).optional()}),ig=P({...$n.shape,...$o.shape,description:m().optional(),inputSchema:P({type:C("object"),properties:ce(m(),ke).optional(),required:H(m()).optional()}).catchall(me()),outputSchema:P({type:C("object"),properties:ce(m(),ke).optional(),required:H(m()).optional()}).catchall(me()).optional(),annotations:s0.optional(),execution:i0.optional(),_meta:ce(m(),me()).optional()}),Hc=So.extend({method:C("tools/list")}),a0=To.extend({tools:H(ig)}),li=ze.extend({content:H(Gc).default([]),structuredContent:ce(m(),me()).optional(),isError:xe().optional()}),li.or(ze.extend({toolResult:me()})),c0=xo.extend({name:m(),arguments:ce(m(),me()).optional()}),Co=Te.extend({method:C("tools/call"),params:c0}),u0=at.extend({method:C("notifications/tools/list_changed"),params:it.optional()}),P({autoRefresh:xe().default(true),debounceMs:re().int().nonnegative().default(300)}),jo=Ge(["debug","info","notice","warning","error","critical","alert","emergency"]),l0=Qe.extend({level:jo}),Wc=Te.extend({method:C("logging/setLevel"),params:l0}),d0=it.extend({level:jo,logger:m().optional(),data:me()}),p0=at.extend({method:C("notifications/message"),params:d0}),f0=P({name:m().optional()}),m0=P({hints:H(f0).optional(),costPriority:re().min(0).max(1).optional(),speedPriority:re().min(0).max(1).optional(),intelligencePriority:re().min(0).max(1).optional()}),h0=P({mode:Ge(["auto","required","none"]).optional()}),g0=P({type:C("tool_result"),toolUseId:m().describe("The unique identifier for the corresponding tool call."),content:H(Gc).default([]),structuredContent:P({}).loose().optional(),isError:xe().optional(),_meta:ce(m(),me()).optional()}),y0=Rc("type",[Jc,Vc,Bc]),Ys=Rc("type",[Jc,Vc,Bc,X$,g0]),_0=P({role:Eo,content:le([Ys,H(Ys)]),_meta:ce(m(),me()).optional()}),v0=xo.extend({messages:H(_0),modelPreferences:m0.optional(),systemPrompt:m().optional(),includeContext:Ge(["none","thisServer","allServers"]).optional(),temperature:re().optional(),maxTokens:re().int(),stopSequences:H(m()).optional(),metadata:ke.optional(),tools:H(ig).optional(),toolChoice:h0.optional()}),k0=Te.extend({method:C("sampling/createMessage"),params:v0}),Ro=ze.extend({model:m(),stopReason:he(Ge(["endTurn","stopSequence","maxTokens"]).or(m())),role:Eo,content:y0}),Kc=ze.extend({model:m(),stopReason:he(Ge(["endTurn","stopSequence","maxTokens","toolUse"]).or(m())),role:Eo,content:le([Ys,H(Ys)])}),w0=P({type:C("boolean"),title:m().optional(),description:m().optional(),default:xe().optional()}),x0=P({type:C("string"),title:m().optional(),description:m().optional(),minLength:re().optional(),maxLength:re().optional(),format:Ge(["email","uri","date","date-time"]).optional(),default:m().optional()}),b0=P({type:Ge(["number","integer"]),title:m().optional(),description:m().optional(),minimum:re().optional(),maximum:re().optional(),default:re().optional()}),$0=P({type:C("string"),title:m().optional(),description:m().optional(),enum:H(m()),default:m().optional()}),S0=P({type:C("string"),title:m().optional(),description:m().optional(),oneOf:H(P({const:m(),title:m()})),default:m().optional()}),T0=P({type:C("string"),title:m().optional(),description:m().optional(),enum:H(m()),enumNames:H(m()).optional(),default:m().optional()}),z0=le([$0,S0]),P0=P({type:C("array"),title:m().optional(),description:m().optional(),minItems:re().optional(),maxItems:re().optional(),items:P({type:C("string"),enum:H(m())}),default:H(m()).optional()}),E0=P({type:C("array"),title:m().optional(),description:m().optional(),minItems:re().optional(),maxItems:re().optional(),items:P({anyOf:H(P({const:m(),title:m()}))}),default:H(m()).optional()}),C0=le([P0,E0]),j0=le([T0,z0,C0]),R0=le([j0,w0,x0,b0]),I0=xo.extend({mode:C("form").optional(),message:m(),requestedSchema:P({type:C("object"),properties:ce(m(),R0),required:H(m()).optional()})}),O0=xo.extend({mode:C("url"),message:m(),elicitationId:m(),url:m().url()}),N0=le([I0,O0]),A0=Te.extend({method:C("elicitation/create"),params:N0}),Z0=it.extend({elicitationId:m()}),M0=at.extend({method:C("notifications/elicitation/complete"),params:Z0}),zn=ze.extend({action:Ge(["accept","decline","cancel"]),content:Ic(t=>t===null?void 0:t,ce(m(),le([m(),re(),xe(),H(m())])).optional())}),D0=P({type:C("ref/resource"),uri:m()}),q0=P({type:C("ref/prompt"),name:m()}),L0=Qe.extend({ref:le([q0,D0]),argument:P({name:m(),value:m()}),context:P({arguments:ce(m(),m()).optional()}).optional()}),U0=Te.extend({method:C("completion/complete"),params:L0}),F0=ze.extend({completion:Le({values:H(m()).max(100),total:he(re().int()),hasMore:he(xe())})}),J0=P({uri:m().startsWith("file://"),name:m().optional(),_meta:ce(m(),me()).optional()}),V0=Te.extend({method:C("roots/list"),params:Qe.optional()}),Yc=ze.extend({roots:H(J0)}),B0=at.extend({method:C("notifications/roots/list_changed"),params:it.optional()}),le([ri,qc,U0,Wc,Q$,W$,I$,N$,M$,U$,J$,Co,Hc,oi,ii,ai,ui]),le([ti,ni,Lc,B0,Po]),le([ei,Ro,Kc,zn,Yc,si,ci,Sn]),le([ri,k0,A0,V0,oi,ii,ai,ui]),le([ti,ni,p0,B$,q$,u0,o0,Po,M0]),le([ei,T$,F0,n0,K$,O$,A$,D$,li,a0,si,ci,Sn]),D=class t extends Error{constructor(e,r,n){super(`MCP error ${e}: ${r}`),this.code=e,this.data=n,this.name="McpError";}static fromError(e,r,n){if(e===G.UrlElicitationRequired&&n){let o=n;if(o.elicitations)return new Oc(o.elicitations,r)}return new t(e,r,n)}},Oc=class extends D{constructor(e,r=`URL elicitation${e.length>1?"s":""} required`){super(G.UrlElicitationRequired,r,{elicitations:e});}get elicitations(){return this.data?.elicitations??[]}};});function dr(t){return t==="completed"||t==="failed"||t==="cancelled"}var ag=g(()=>{});var di=g(()=>{});var Qc=g(()=>{di();});var pr=g(()=>{});var pi=g(()=>{});var ct=g(()=>{pi();});var Xc=g(()=>{pr();ve();});var eu=g(()=>{pr();});var tu=g(()=>{});var fi=g(()=>{ve();});var ru=g(()=>{ve();});var nu=g(()=>{pr();});var ou=g(()=>{ve();});var su=g(()=>{ve();ct();});var iu=g(()=>{});var au=g(()=>{ve();});var cu=g(()=>{});var mi=g(()=>{pr();new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");});var hi=g(()=>{ve();mi();fi();ct();});var uu=g(()=>{ve();hi();ct();});var lu=g(()=>{});var du=g(()=>{ct();});var pu=g(()=>{});var gi=g(()=>{ve();});var fu=g(()=>{ve();gi();});var mu=g(()=>{pr();});var hu=g(()=>{ve();});var gu=g(()=>{ve();ct();});var yu=g(()=>{ve();});var _u=g(()=>{ve();});var vu=g(()=>{pr();ve();});var ku=g(()=>{ve();});var wu=g(()=>{ct();});var xu=g(()=>{ct();});var bu=g(()=>{ve();});var $u=g(()=>{ct();Xc();eu();tu();fi();ru();nu();ou();su();iu();au();cu();uu();lu();du();pu();fu();mu();hu();gu();yu();_u();hi();vu();mi();ku();wu();gi();xu();bu();});var ve=g(()=>{di();$u();pi();ct();});var cg=g(()=>{});var Su=g(()=>{ve();Qc();ct();});var ug=g(()=>{di();Qc();pr();pi();ve();cg();ct();Xc();eu();tu();fi();ru();nu();ou();su();iu();au();cu();uu();lu();du();pu();fu();mu();hu();gu();yu();_u();bu();hi();vu();mi();ku();wu();gi();xu();$u();Su();Su();});function Tu(t){let r=Gs(t)?.method;if(!r)throw new Error("Schema is missing a method literal");let n=yh(r);if(typeof n!="string")throw new Error("Schema method literal must be a string");return n}function zu(t,e){let r=ur(t,e);if(!r.success)throw r.error;return r.data}var lg=g(()=>{Hs();ug();});function dg(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}function pg(t,e){let r={...t};for(let n in e){let o=n,s=e[o];if(s===void 0)continue;let i=r[o];dg(i)&&dg(s)?r[o]={...i,...s}:r[o]=s;}return r}var Q0,yi,fg=g(()=>{Hs();Pn();ag();lg();Q0=6e4,yi=class{constructor(e){this._options=e,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this._pendingDebouncedNotifications=new Set,this._taskProgressTokens=new Map,this._requestResolvers=new Map,this.setNotificationHandler(ti,r=>{this._oncancel(r);}),this.setNotificationHandler(ni,r=>{this._onprogress(r);}),this.setRequestHandler(ri,r=>({})),this._taskStore=e?.taskStore,this._taskMessageQueue=e?.taskMessageQueue,this._taskStore&&(this.setRequestHandler(oi,async(r,n)=>{let o=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!o)throw new D(G.InvalidParams,"Failed to retrieve task: Task not found");return {...o}}),this.setRequestHandler(ii,async(r,n)=>{let o=async()=>{let s=r.params.taskId;if(this._taskMessageQueue){let a;for(;a=await this._taskMessageQueue.dequeue(s,n.sessionId);){if(a.type==="response"||a.type==="error"){let c=a.message,u=c.id,l=this._requestResolvers.get(u);if(l)if(this._requestResolvers.delete(u),a.type==="response")l(c);else {let d=c,p=new D(d.error.code,d.error.message,d.error.data);l(p);}else {let d=a.type==="response"?"Response":"Error";this._onerror(new Error(`${d} handler missing for request ${u}`));}continue}await this._transport?.send(a.message,{relatedRequestId:n.requestId});}}let i=await this._taskStore.getTask(s,n.sessionId);if(!i)throw new D(G.InvalidParams,`Task not found: ${s}`);if(!dr(i.status))return await this._waitForTaskUpdate(s,n.signal),await o();if(dr(i.status)){let a=await this._taskStore.getTaskResult(s,n.sessionId);return this._clearTaskQueue(s),{...a,_meta:{...a._meta,[lr]:{taskId:s}}}}return await o()};return await o()}),this.setRequestHandler(ai,async(r,n)=>{try{let{tasks:o,nextCursor:s}=await this._taskStore.listTasks(r.params?.cursor,n.sessionId);return {tasks:o,nextCursor:s,_meta:{}}}catch(o){throw new D(G.InvalidParams,`Failed to list tasks: ${o instanceof Error?o.message:String(o)}`)}}),this.setRequestHandler(ui,async(r,n)=>{try{let o=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!o)throw new D(G.InvalidParams,`Task not found: ${r.params.taskId}`);if(dr(o.status))throw new D(G.InvalidParams,`Cannot cancel task in terminal status: ${o.status}`);await this._taskStore.updateTaskStatus(r.params.taskId,"cancelled","Client cancelled task execution.",n.sessionId),this._clearTaskQueue(r.params.taskId);let s=await this._taskStore.getTask(r.params.taskId,n.sessionId);if(!s)throw new D(G.InvalidParams,`Task not found after cancellation: ${r.params.taskId}`);return {_meta:{},...s}}catch(o){throw o instanceof D?o:new D(G.InvalidRequest,`Failed to cancel task: ${o instanceof Error?o.message:String(o)}`)}}));}async _oncancel(e){if(!e.params.requestId)return;this._requestHandlerAbortControllers.get(e.params.requestId)?.abort(e.params.reason);}_setupTimeout(e,r,n,o,s=false){this._timeoutInfo.set(e,{timeoutId:setTimeout(o,r),startTime:Date.now(),timeout:r,maxTotalTimeout:n,resetTimeoutOnProgress:s,onTimeout:o});}_resetTimeout(e){let r=this._timeoutInfo.get(e);if(!r)return false;let n=Date.now()-r.startTime;if(r.maxTotalTimeout&&n>=r.maxTotalTimeout)throw this._timeoutInfo.delete(e),D.fromError(G.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:r.maxTotalTimeout,totalElapsed:n});return clearTimeout(r.timeoutId),r.timeoutId=setTimeout(r.onTimeout,r.timeout),true}_cleanupTimeout(e){let r=this._timeoutInfo.get(e);r&&(clearTimeout(r.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;let r=this.transport?.onclose;this._transport.onclose=()=>{r?.(),this._onclose();};let n=this.transport?.onerror;this._transport.onerror=s=>{n?.(s),this._onerror(s);};let o=this._transport?.onmessage;this._transport.onmessage=(s,i)=>{o?.(s,i),bo(s)||Qh(s)?this._onresponse(s):Zc(s)?this._onrequest(s,i):Yh(s)?this._onnotification(s):this._onerror(new Error(`Unknown message type: ${JSON.stringify(s)}`));},await this._transport.start();}_onclose(){let e=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();for(let n of this._timeoutInfo.values())clearTimeout(n.timeoutId);this._timeoutInfo.clear();for(let n of this._requestHandlerAbortControllers.values())n.abort();this._requestHandlerAbortControllers.clear();let r=D.fromError(G.ConnectionClosed,"Connection closed");this._transport=void 0,this.onclose?.();for(let n of e.values())n(r);}_onerror(e){this.onerror?.(e);}_onnotification(e){let r=this._notificationHandlers.get(e.method)??this.fallbackNotificationHandler;r!==void 0&&Promise.resolve().then(()=>r(e)).catch(n=>this._onerror(new Error(`Uncaught error in notification handler: ${n}`)));}_onrequest(e,r){let n=this._requestHandlers.get(e.method)??this.fallbackRequestHandler,o=this._transport,s=e.params?._meta?.[lr]?.taskId;if(n===void 0){let l={jsonrpc:"2.0",id:e.id,error:{code:G.MethodNotFound,message:"Method not found"}};s&&this._taskMessageQueue?this._enqueueTaskMessage(s,{type:"error",message:l,timestamp:Date.now()},o?.sessionId).catch(d=>this._onerror(new Error(`Failed to enqueue error response: ${d}`))):o?.send(l).catch(d=>this._onerror(new Error(`Failed to send an error response: ${d}`)));return}let i=new AbortController;this._requestHandlerAbortControllers.set(e.id,i);let a=Hh(e.params)?e.params.task:void 0,c=this._taskStore?this.requestTaskStore(e,o?.sessionId):void 0,u={signal:i.signal,sessionId:o?.sessionId,_meta:e.params?._meta,sendNotification:async l=>{if(i.signal.aborted)return;let d={relatedRequestId:e.id};s&&(d.relatedTask={taskId:s}),await this.notification(l,d);},sendRequest:async(l,d,p)=>{if(i.signal.aborted)throw new D(G.ConnectionClosed,"Request was cancelled");let f={...p,relatedRequestId:e.id};s&&!f.relatedTask&&(f.relatedTask={taskId:s});let h=f.relatedTask?.taskId??s;return h&&c&&await c.updateTaskStatus(h,"input_required"),await this.request(l,d,f)},authInfo:r?.authInfo,requestId:e.id,requestInfo:r?.requestInfo,taskId:s,taskStore:c,taskRequestedTtl:a?.ttl,closeSSEStream:r?.closeSSEStream,closeStandaloneSSEStream:r?.closeStandaloneSSEStream};Promise.resolve().then(()=>{a&&this.assertTaskHandlerCapability(e.method);}).then(()=>n(e,u)).then(async l=>{if(i.signal.aborted)return;let d={result:l,jsonrpc:"2.0",id:e.id};s&&this._taskMessageQueue?await this._enqueueTaskMessage(s,{type:"response",message:d,timestamp:Date.now()},o?.sessionId):await o?.send(d);},async l=>{if(i.signal.aborted)return;let d={jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(l.code)?l.code:G.InternalError,message:l.message??"Internal error",...l.data!==void 0&&{data:l.data}}};s&&this._taskMessageQueue?await this._enqueueTaskMessage(s,{type:"error",message:d,timestamp:Date.now()},o?.sessionId):await o?.send(d);}).catch(l=>this._onerror(new Error(`Failed to send response: ${l}`))).finally(()=>{this._requestHandlerAbortControllers.get(e.id)===i&&this._requestHandlerAbortControllers.delete(e.id);});}_onprogress(e){let{progressToken:r,...n}=e.params,o=Number(r),s=this._progressHandlers.get(o);if(!s){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}let i=this._responseHandlers.get(o),a=this._timeoutInfo.get(o);if(a&&i&&a.resetTimeoutOnProgress)try{this._resetTimeout(o);}catch(c){this._responseHandlers.delete(o),this._progressHandlers.delete(o),this._cleanupTimeout(o),i(c);return}s(n);}_onresponse(e){let r=Number(e.id),n=this._requestResolvers.get(r);if(n){if(this._requestResolvers.delete(r),bo(e))n(e);else {let i=new D(e.error.code,e.error.message,e.error.data);n(i);}return}let o=this._responseHandlers.get(r);if(o===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}this._responseHandlers.delete(r),this._cleanupTimeout(r);let s=false;if(bo(e)&&e.result&&typeof e.result=="object"){let i=e.result;if(i.task&&typeof i.task=="object"){let a=i.task;typeof a.taskId=="string"&&(s=true,this._taskProgressTokens.set(a.taskId,r));}}if(s||this._progressHandlers.delete(r),bo(e))o(e);else {let i=D.fromError(e.error.code,e.error.message,e.error.data);o(i);}}get transport(){return this._transport}async close(){await this._transport?.close();}async*requestStream(e,r,n){let{task:o}=n??{};if(!o){try{yield {type:"result",result:await this.request(e,r,n)};}catch(i){yield {type:"error",error:i instanceof D?i:new D(G.InternalError,String(i))};}return}let s;try{let i=await this.request(e,Sn,n);if(i.task)s=i.task.taskId,yield {type:"taskCreated",task:i.task};else throw new D(G.InternalError,"Task creation did not return a task");for(;;){let a=await this.getTask({taskId:s},n);if(yield {type:"taskStatus",task:a},dr(a.status)){a.status==="completed"?yield {type:"result",result:await this.getTaskResult({taskId:s},r,n)}:a.status==="failed"?yield {type:"error",error:new D(G.InternalError,`Task ${s} failed`)}:a.status==="cancelled"&&(yield {type:"error",error:new D(G.InternalError,`Task ${s} was cancelled`)});return}if(a.status==="input_required"){yield {type:"result",result:await this.getTaskResult({taskId:s},r,n)};return}let c=a.pollInterval??this._options?.defaultTaskPollInterval??1e3;await new Promise(u=>setTimeout(u,c)),n?.signal?.throwIfAborted();}}catch(i){yield {type:"error",error:i instanceof D?i:new D(G.InternalError,String(i))};}}request(e,r,n){let{relatedRequestId:o,resumptionToken:s,onresumptiontoken:i,task:a,relatedTask:c}=n??{};return new Promise((u,l)=>{let d=$=>{l($);};if(!this._transport){d(new Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===true)try{this.assertCapabilityForMethod(e.method),a&&this.assertTaskCapability(e.method);}catch($){d($);return}n?.signal?.throwIfAborted();let p=this._requestMessageId++,f={...e,jsonrpc:"2.0",id:p};n?.onprogress&&(this._progressHandlers.set(p,n.onprogress),f.params={...e.params,_meta:{...e.params?._meta||{},progressToken:p}}),a&&(f.params={...f.params,task:a}),c&&(f.params={...f.params,_meta:{...f.params?._meta||{},[lr]:c}});let h=$=>{this._responseHandlers.delete(p),this._progressHandlers.delete(p),this._cleanupTimeout(p),this._transport?.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:p,reason:String($)}},{relatedRequestId:o,resumptionToken:s,onresumptiontoken:i}).catch(R=>this._onerror(new Error(`Failed to send cancellation: ${R}`)));let b=$ instanceof D?$:new D(G.RequestTimeout,String($));l(b);};this._responseHandlers.set(p,$=>{if(!n?.signal?.aborted){if($ instanceof Error)return l($);try{let b=ur(r,$.result);b.success?u(b.data):l(b.error);}catch(b){l(b);}}}),n?.signal?.addEventListener("abort",()=>{h(n?.signal?.reason);});let _=n?.timeout??Q0,w=()=>h(D.fromError(G.RequestTimeout,"Request timed out",{timeout:_}));this._setupTimeout(p,_,n?.maxTotalTimeout,w,n?.resetTimeoutOnProgress??false);let x=c?.taskId;if(x){let $=b=>{let R=this._responseHandlers.get(p);R?R(b):this._onerror(new Error(`Response handler missing for side-channeled request ${p}`));};this._requestResolvers.set(p,$),this._enqueueTaskMessage(x,{type:"request",message:f,timestamp:Date.now()}).catch(b=>{this._cleanupTimeout(p),l(b);});}else this._transport.send(f,{relatedRequestId:o,resumptionToken:s,onresumptiontoken:i}).catch($=>{this._cleanupTimeout(p),l($);});})}async getTask(e,r){return this.request({method:"tasks/get",params:e},si,r)}async getTaskResult(e,r,n){return this.request({method:"tasks/result",params:e},r,n)}async listTasks(e,r){return this.request({method:"tasks/list",params:e},ci,r)}async cancelTask(e,r){return this.request({method:"tasks/cancel",params:e},tg,r)}async notification(e,r){if(!this._transport)throw new Error("Not connected");this.assertNotificationCapability(e.method);let n=r?.relatedTask?.taskId;if(n){let a={...e,jsonrpc:"2.0",params:{...e.params,_meta:{...e.params?._meta||{},[lr]:r.relatedTask}}};await this._enqueueTaskMessage(n,{type:"notification",message:a,timestamp:Date.now()});return}if((this._options?.debouncedNotificationMethods??[]).includes(e.method)&&!e.params&&!r?.relatedRequestId&&!r?.relatedTask){if(this._pendingDebouncedNotifications.has(e.method))return;this._pendingDebouncedNotifications.add(e.method),Promise.resolve().then(()=>{if(this._pendingDebouncedNotifications.delete(e.method),!this._transport)return;let a={...e,jsonrpc:"2.0"};r?.relatedTask&&(a={...a,params:{...a.params,_meta:{...a.params?._meta||{},[lr]:r.relatedTask}}}),this._transport?.send(a,r).catch(c=>this._onerror(c));});return}let i={...e,jsonrpc:"2.0"};r?.relatedTask&&(i={...i,params:{...i.params,_meta:{...i.params?._meta||{},[lr]:r.relatedTask}}}),await this._transport.send(i,r);}setRequestHandler(e,r){let n=Tu(e);this.assertRequestHandlerCapability(n),this._requestHandlers.set(n,(o,s)=>{let i=zu(e,o);return Promise.resolve(r(i,s))});}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,r){let n=Tu(e);this._notificationHandlers.set(n,o=>{let s=zu(e,o);return Promise.resolve(r(s))});}removeNotificationHandler(e){this._notificationHandlers.delete(e);}_cleanupTaskProgressHandler(e){let r=this._taskProgressTokens.get(e);r!==void 0&&(this._progressHandlers.delete(r),this._taskProgressTokens.delete(e));}async _enqueueTaskMessage(e,r,n){if(!this._taskStore||!this._taskMessageQueue)throw new Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");let o=this._options?.maxTaskQueueSize;await this._taskMessageQueue.enqueue(e,r,n,o);}async _clearTaskQueue(e,r){if(this._taskMessageQueue){let n=await this._taskMessageQueue.dequeueAll(e,r);for(let o of n)if(o.type==="request"&&Zc(o.message)){let s=o.message.id,i=this._requestResolvers.get(s);i?(i(new D(G.InternalError,"Task cancelled or completed")),this._requestResolvers.delete(s)):this._onerror(new Error(`Resolver missing for request ${s} during task ${e} cleanup`));}}}async _waitForTaskUpdate(e,r){let n=this._options?.defaultTaskPollInterval??1e3;try{let o=await this._taskStore?.getTask(e);o?.pollInterval&&(n=o.pollInterval);}catch{}return new Promise((o,s)=>{if(r.aborted){s(new D(G.InvalidRequest,"Request cancelled"));return}let i=setTimeout(o,n);r.addEventListener("abort",()=>{clearTimeout(i),s(new D(G.InvalidRequest,"Request cancelled"));},{once:true});})}requestTaskStore(e,r){let n=this._taskStore;if(!n)throw new Error("No task store configured");return {createTask:async o=>{if(!e)throw new Error("No request provided");return await n.createTask(o,e.id,{method:e.method,params:e.params},r)},getTask:async o=>{let s=await n.getTask(o,r);if(!s)throw new D(G.InvalidParams,"Failed to retrieve task: Task not found");return s},storeTaskResult:async(o,s,i)=>{await n.storeTaskResult(o,s,i,r);let a=await n.getTask(o,r);if(a){let c=Po.parse({method:"notifications/tasks/status",params:a});await this.notification(c),dr(a.status)&&this._cleanupTaskProgressHandler(o);}},getTaskResult:o=>n.getTaskResult(o,r),updateTaskStatus:async(o,s,i)=>{let a=await n.getTask(o,r);if(!a)throw new D(G.InvalidParams,`Task "${o}" not found - it may have been cleaned up`);if(dr(a.status))throw new D(G.InvalidParams,`Cannot update task "${o}" from terminal status "${a.status}" to "${s}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await n.updateTaskStatus(o,s,i,r);let c=await n.getTask(o,r);if(c){let u=Po.parse({method:"notifications/tasks/status",params:c});await this.notification(u),dr(c.status)&&this._cleanupTaskProgressHandler(o);}},listTasks:o=>n.listTasks(o,r)}}};});var Ao=T(Q=>{Object.defineProperty(Q,"__esModule",{value:true});Q.regexpCode=Q.getEsmExportName=Q.getProperty=Q.safeStringify=Q.stringify=Q.strConcat=Q.addCodeArg=Q.str=Q._=Q.nil=Q._Code=Q.Name=Q.IDENTIFIER=Q._CodeOrName=void 0;var Oo=class{};Q._CodeOrName=Oo;Q.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var Jr=class extends Oo{constructor(e){if(super(),!Q.IDENTIFIER.test(e))throw new Error("CodeGen: name must be a valid identifier");this.str=e;}toString(){return this.str}emptyStr(){return false}get names(){return {[this.str]:1}}};Q.Name=Jr;var ut=class extends Oo{constructor(e){super(),this._items=typeof e=="string"?[e]:e;}toString(){return this.str}emptyStr(){if(this._items.length>1)return false;let e=this._items[0];return e===""||e==='""'}get str(){var e;return (e=this._str)!==null&&e!==void 0?e:this._str=this._items.reduce((r,n)=>`${r}${n}`,"")}get names(){var e;return (e=this._names)!==null&&e!==void 0?e:this._names=this._items.reduce((r,n)=>(n instanceof Jr&&(r[n.str]=(r[n.str]||0)+1),r),{})}};Q._Code=ut;Q.nil=new ut("");function mg(t,...e){let r=[t[0]],n=0;for(;n<e.length;)Eu(r,e[n]),r.push(t[++n]);return new ut(r)}Q._=mg;var Pu=new ut("+");function hg(t,...e){let r=[No(t[0])],n=0;for(;n<e.length;)r.push(Pu),Eu(r,e[n]),r.push(Pu,No(t[++n]));return X0(r),new ut(r)}Q.str=hg;function Eu(t,e){e instanceof ut?t.push(...e._items):e instanceof Jr?t.push(e):t.push(rS(e));}Q.addCodeArg=Eu;function X0(t){let e=1;for(;e<t.length-1;){if(t[e]===Pu){let r=eS(t[e-1],t[e+1]);if(r!==void 0){t.splice(e-1,3,r);continue}t[e++]="+";}e++;}}function eS(t,e){if(e==='""')return t;if(t==='""')return e;if(typeof t=="string")return e instanceof Jr||t[t.length-1]!=='"'?void 0:typeof e!="string"?`${t.slice(0,-1)}${e}"`:e[0]==='"'?t.slice(0,-1)+e.slice(1):void 0;if(typeof e=="string"&&e[0]==='"'&&!(t instanceof Jr))return `"${t}${e.slice(1)}`}function tS(t,e){return e.emptyStr()?t:t.emptyStr()?e:hg`${t}${e}`}Q.strConcat=tS;function rS(t){return typeof t=="number"||typeof t=="boolean"||t===null?t:No(Array.isArray(t)?t.join(","):t)}function nS(t){return new ut(No(t))}Q.stringify=nS;function No(t){return JSON.stringify(t).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}Q.safeStringify=No;function oS(t){return typeof t=="string"&&Q.IDENTIFIER.test(t)?new ut(`.${t}`):mg`[${t}]`}Q.getProperty=oS;function sS(t){if(typeof t=="string"&&Q.IDENTIFIER.test(t))return new ut(`${t}`);throw new Error(`CodeGen: invalid export name: ${t}, use explicit $id name mapping`)}Q.getEsmExportName=sS;function iS(t){return new ut(t.toString())}Q.regexpCode=iS;});var Ru=T(We=>{Object.defineProperty(We,"__esModule",{value:true});We.ValueScope=We.ValueScopeName=We.Scope=We.varKinds=We.UsedValueState=void 0;var He=Ao(),Cu=class extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value;}},_i;(function(t){t[t.Started=0]="Started",t[t.Completed=1]="Completed";})(_i||(We.UsedValueState=_i={}));We.varKinds={const:new He.Name("const"),let:new He.Name("let"),var:new He.Name("var")};var vi=class{constructor({prefixes:e,parent:r}={}){this._names={},this._prefixes=e,this._parent=r;}toName(e){return e instanceof He.Name?e:this.name(e)}name(e){return new He.Name(this._newName(e))}_newName(e){let r=this._names[e]||this._nameGroup(e);return `${e}${r.index++}`}_nameGroup(e){var r,n;if(!((n=(r=this._parent)===null||r===void 0?void 0:r._prefixes)===null||n===void 0)&&n.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}}};We.Scope=vi;var ki=class extends He.Name{constructor(e,r){super(r),this.prefix=e;}setValue(e,{property:r,itemIndex:n}){this.value=e,this.scopePath=(0, He._)`.${new He.Name(r)}[${n}]`;}};We.ValueScopeName=ki;var aS=(0, He._)`\n`,ju=class extends vi{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?aS:He.nil};}get(){return this._scope}name(e){return new ki(e,this._newName(e))}value(e,r){var n;if(r.ref===void 0)throw new Error("CodeGen: ref must be passed in value");let o=this.toName(e),{prefix:s}=o,i=(n=r.key)!==null&&n!==void 0?n:r.ref,a=this._values[s];if(a){let l=a.get(i);if(l)return l}else a=this._values[s]=new Map;a.set(i,o);let c=this._scope[s]||(this._scope[s]=[]),u=c.length;return c[u]=r.ref,o.setValue(r,{property:s,itemIndex:u}),o}getValue(e,r){let n=this._values[e];if(n)return n.get(r)}scopeRefs(e,r=this._values){return this._reduceValues(r,n=>{if(n.scopePath===void 0)throw new Error(`CodeGen: name "${n}" has no value`);return (0, He._)`${e}${n.scopePath}`})}scopeCode(e=this._values,r,n){return this._reduceValues(e,o=>{if(o.value===void 0)throw new Error(`CodeGen: name "${o}" has no value`);return o.value.code},r,n)}_reduceValues(e,r,n={},o){let s=He.nil;for(let i in e){let a=e[i];if(!a)continue;let c=n[i]=n[i]||new Map;a.forEach(u=>{if(c.has(u))return;c.set(u,_i.Started);let l=r(u);if(l){let d=this.opts.es5?We.varKinds.var:We.varKinds.const;s=(0, He._)`${s}${d} ${u} = ${l};${this.opts._n}`;}else if(l=o?.(u))s=(0, He._)`${s}${l}${this.opts._n}`;else throw new Cu(u);c.set(u,_i.Completed);});}return s}};We.ValueScope=ju;});var U=T(F=>{Object.defineProperty(F,"__esModule",{value:true});F.or=F.and=F.not=F.CodeGen=F.operators=F.varKinds=F.ValueScopeName=F.ValueScope=F.Scope=F.Name=F.regexpCode=F.stringify=F.getProperty=F.nil=F.strConcat=F.str=F._=void 0;var W=Ao(),kt=Ru(),fr=Ao();Object.defineProperty(F,"_",{enumerable:true,get:function(){return fr._}});Object.defineProperty(F,"str",{enumerable:true,get:function(){return fr.str}});Object.defineProperty(F,"strConcat",{enumerable:true,get:function(){return fr.strConcat}});Object.defineProperty(F,"nil",{enumerable:true,get:function(){return fr.nil}});Object.defineProperty(F,"getProperty",{enumerable:true,get:function(){return fr.getProperty}});Object.defineProperty(F,"stringify",{enumerable:true,get:function(){return fr.stringify}});Object.defineProperty(F,"regexpCode",{enumerable:true,get:function(){return fr.regexpCode}});Object.defineProperty(F,"Name",{enumerable:true,get:function(){return fr.Name}});var $i=Ru();Object.defineProperty(F,"Scope",{enumerable:true,get:function(){return $i.Scope}});Object.defineProperty(F,"ValueScope",{enumerable:true,get:function(){return $i.ValueScope}});Object.defineProperty(F,"ValueScopeName",{enumerable:true,get:function(){return $i.ValueScopeName}});Object.defineProperty(F,"varKinds",{enumerable:true,get:function(){return $i.varKinds}});F.operators={GT:new W._Code(">"),GTE:new W._Code(">="),LT:new W._Code("<"),LTE:new W._Code("<="),EQ:new W._Code("==="),NEQ:new W._Code("!=="),NOT:new W._Code("!"),OR:new W._Code("||"),AND:new W._Code("&&"),ADD:new W._Code("+")};var Yt=class{optimizeNodes(){return this}optimizeNames(e,r){return this}},Iu=class extends Yt{constructor(e,r,n){super(),this.varKind=e,this.name=r,this.rhs=n;}render({es5:e,_n:r}){let n=e?kt.varKinds.var:this.varKind,o=this.rhs===void 0?"":` = ${this.rhs}`;return `${n} ${this.name}${o};`+r}optimizeNames(e,r){if(e[this.name.str])return this.rhs&&(this.rhs=Cn(this.rhs,e,r)),this}get names(){return this.rhs instanceof W._CodeOrName?this.rhs.names:{}}},wi=class extends Yt{constructor(e,r,n){super(),this.lhs=e,this.rhs=r,this.sideEffects=n;}render({_n:e}){return `${this.lhs} = ${this.rhs};`+e}optimizeNames(e,r){if(!(this.lhs instanceof W.Name&&!e[this.lhs.str]&&!this.sideEffects))return this.rhs=Cn(this.rhs,e,r),this}get names(){let e=this.lhs instanceof W.Name?{}:{...this.lhs.names};return bi(e,this.rhs)}},Ou=class extends wi{constructor(e,r,n,o){super(e,n,o),this.op=r;}render({_n:e}){return `${this.lhs} ${this.op}= ${this.rhs};`+e}},Nu=class extends Yt{constructor(e){super(),this.label=e,this.names={};}render({_n:e}){return `${this.label}:`+e}},Au=class extends Yt{constructor(e){super(),this.label=e,this.names={};}render({_n:e}){return `break${this.label?` ${this.label}`:""};`+e}},Zu=class extends Yt{constructor(e){super(),this.error=e;}render({_n:e}){return `throw ${this.error};`+e}get names(){return this.error.names}},Mu=class extends Yt{constructor(e){super(),this.code=e;}render({_n:e}){return `${this.code};`+e}optimizeNodes(){return `${this.code}`?this:void 0}optimizeNames(e,r){return this.code=Cn(this.code,e,r),this}get names(){return this.code instanceof W._CodeOrName?this.code.names:{}}},Zo=class extends Yt{constructor(e=[]){super(),this.nodes=e;}render(e){return this.nodes.reduce((r,n)=>r+n.render(e),"")}optimizeNodes(){let{nodes:e}=this,r=e.length;for(;r--;){let n=e[r].optimizeNodes();Array.isArray(n)?e.splice(r,1,...n):n?e[r]=n:e.splice(r,1);}return e.length>0?this:void 0}optimizeNames(e,r){let{nodes:n}=this,o=n.length;for(;o--;){let s=n[o];s.optimizeNames(e,r)||(cS(e,s.names),n.splice(o,1));}return n.length>0?this:void 0}get names(){return this.nodes.reduce((e,r)=>Gr(e,r.names),{})}},Qt=class extends Zo{render(e){return "{"+e._n+super.render(e)+"}"+e._n}},Du=class extends Zo{},En=class extends Qt{};En.kind="else";var Vr=class t extends Qt{constructor(e,r){super(r),this.condition=e;}render(e){let r=`if(${this.condition})`+super.render(e);return this.else&&(r+="else "+this.else.render(e)),r}optimizeNodes(){super.optimizeNodes();let e=this.condition;if(e===true)return this.nodes;let r=this.else;if(r){let n=r.optimizeNodes();r=this.else=Array.isArray(n)?new En(n):n;}if(r)return e===false?r instanceof t?r:r.nodes:this.nodes.length?this:new t(gg(e),r instanceof t?[r]:r.nodes);if(!(e===false||!this.nodes.length))return this}optimizeNames(e,r){var n;if(this.else=(n=this.else)===null||n===void 0?void 0:n.optimizeNames(e,r),!!(super.optimizeNames(e,r)||this.else))return this.condition=Cn(this.condition,e,r),this}get names(){let e=super.names;return bi(e,this.condition),this.else&&Gr(e,this.else.names),e}};Vr.kind="if";var Br=class extends Qt{};Br.kind="for";var qu=class extends Br{constructor(e){super(),this.iteration=e;}render(e){return `for(${this.iteration})`+super.render(e)}optimizeNames(e,r){if(super.optimizeNames(e,r))return this.iteration=Cn(this.iteration,e,r),this}get names(){return Gr(super.names,this.iteration.names)}},Lu=class extends Br{constructor(e,r,n,o){super(),this.varKind=e,this.name=r,this.from=n,this.to=o;}render(e){let r=e.es5?kt.varKinds.var:this.varKind,{name:n,from:o,to:s}=this;return `for(${r} ${n}=${o}; ${n}<${s}; ${n}++)`+super.render(e)}get names(){let e=bi(super.names,this.from);return bi(e,this.to)}},xi=class extends Br{constructor(e,r,n,o){super(),this.loop=e,this.varKind=r,this.name=n,this.iterable=o;}render(e){return `for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,r){if(super.optimizeNames(e,r))return this.iterable=Cn(this.iterable,e,r),this}get names(){return Gr(super.names,this.iterable.names)}},Mo=class extends Qt{constructor(e,r,n){super(),this.name=e,this.args=r,this.async=n;}render(e){return `${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(e)}};Mo.kind="func";var Do=class extends Zo{render(e){return "return "+super.render(e)}};Do.kind="return";var Uu=class extends Qt{render(e){let r="try"+super.render(e);return this.catch&&(r+=this.catch.render(e)),this.finally&&(r+=this.finally.render(e)),r}optimizeNodes(){var e,r;return super.optimizeNodes(),(e=this.catch)===null||e===void 0||e.optimizeNodes(),(r=this.finally)===null||r===void 0||r.optimizeNodes(),this}optimizeNames(e,r){var n,o;return super.optimizeNames(e,r),(n=this.catch)===null||n===void 0||n.optimizeNames(e,r),(o=this.finally)===null||o===void 0||o.optimizeNames(e,r),this}get names(){let e=super.names;return this.catch&&Gr(e,this.catch.names),this.finally&&Gr(e,this.finally.names),e}},qo=class extends Qt{constructor(e){super(),this.error=e;}render(e){return `catch(${this.error})`+super.render(e)}};qo.kind="catch";var Lo=class extends Qt{render(e){return "finally"+super.render(e)}};Lo.kind="finally";var Fu=class{constructor(e,r={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...r,_n:r.lines?`
|
|
35
|
+
`:""},this._extScope=e,this._scope=new kt.Scope({parent:e}),this._nodes=[new Du];}toString(){return this._root.render(this.opts)}name(e){return this._scope.name(e)}scopeName(e){return this._extScope.name(e)}scopeValue(e,r){let n=this._extScope.value(e,r);return (this._values[n.prefix]||(this._values[n.prefix]=new Set)).add(n),n}getScopeValue(e,r){return this._extScope.getValue(e,r)}scopeRefs(e){return this._extScope.scopeRefs(e,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(e,r,n,o){let s=this._scope.toName(r);return n!==void 0&&o&&(this._constants[s.str]=n),this._leafNode(new Iu(e,s,n)),s}const(e,r,n){return this._def(kt.varKinds.const,e,r,n)}let(e,r,n){return this._def(kt.varKinds.let,e,r,n)}var(e,r,n){return this._def(kt.varKinds.var,e,r,n)}assign(e,r,n){return this._leafNode(new wi(e,r,n))}add(e,r){return this._leafNode(new Ou(e,F.operators.ADD,r))}code(e){return typeof e=="function"?e():e!==W.nil&&this._leafNode(new Mu(e)),this}object(...e){let r=["{"];for(let[n,o]of e)r.length>1&&r.push(","),r.push(n),(n!==o||this.opts.es5)&&(r.push(":"),(0, W.addCodeArg)(r,o));return r.push("}"),new W._Code(r)}if(e,r,n){if(this._blockNode(new Vr(e)),r&&n)this.code(r).else().code(n).endIf();else if(r)this.code(r).endIf();else if(n)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(e){return this._elseNode(new Vr(e))}else(){return this._elseNode(new En)}endIf(){return this._endBlockNode(Vr,En)}_for(e,r){return this._blockNode(e),r&&this.code(r).endFor(),this}for(e,r){return this._for(new qu(e),r)}forRange(e,r,n,o,s=this.opts.es5?kt.varKinds.var:kt.varKinds.let){let i=this._scope.toName(e);return this._for(new Lu(s,i,r,n),()=>o(i))}forOf(e,r,n,o=kt.varKinds.const){let s=this._scope.toName(e);if(this.opts.es5){let i=r instanceof W.Name?r:this.var("_arr",r);return this.forRange("_i",0,(0, W._)`${i}.length`,a=>{this.var(s,(0, W._)`${i}[${a}]`),n(s);})}return this._for(new xi("of",o,s,r),()=>n(s))}forIn(e,r,n,o=this.opts.es5?kt.varKinds.var:kt.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,(0, W._)`Object.keys(${r})`,n);let s=this._scope.toName(e);return this._for(new xi("in",o,s,r),()=>n(s))}endFor(){return this._endBlockNode(Br)}label(e){return this._leafNode(new Nu(e))}break(e){return this._leafNode(new Au(e))}return(e){let r=new Do;if(this._blockNode(r),this.code(e),r.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(Do)}try(e,r,n){if(!r&&!n)throw new Error('CodeGen: "try" without "catch" and "finally"');let o=new Uu;if(this._blockNode(o),this.code(e),r){let s=this.name("e");this._currNode=o.catch=new qo(s),r(s);}return n&&(this._currNode=o.finally=new Lo,this.code(n)),this._endBlockNode(qo,Lo)}throw(e){return this._leafNode(new Zu(e))}block(e,r){return this._blockStarts.push(this._nodes.length),e&&this.code(e).endBlock(r),this}endBlock(e){let r=this._blockStarts.pop();if(r===void 0)throw new Error("CodeGen: not in self-balancing block");let n=this._nodes.length-r;if(n<0||e!==void 0&&n!==e)throw new Error(`CodeGen: wrong number of nodes: ${n} vs ${e} expected`);return this._nodes.length=r,this}func(e,r=W.nil,n,o){return this._blockNode(new Mo(e,r,n)),o&&this.code(o).endFunc(),this}endFunc(){return this._endBlockNode(Mo)}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,r){let n=this._currNode;if(n instanceof e||r&&n instanceof r)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${r?`${e.kind}/${r.kind}`:e.kind}"`)}_elseNode(e){let r=this._currNode;if(!(r instanceof Vr))throw new Error('CodeGen: "else" without "if"');return this._currNode=r.else=e,this}get _root(){return this._nodes[0]}get _currNode(){let e=this._nodes;return e[e.length-1]}set _currNode(e){let r=this._nodes;r[r.length-1]=e;}};F.CodeGen=Fu;function Gr(t,e){for(let r in e)t[r]=(t[r]||0)+(e[r]||0);return t}function bi(t,e){return e instanceof W._CodeOrName?Gr(t,e.names):t}function Cn(t,e,r){if(t instanceof W.Name)return n(t);if(!o(t))return t;return new W._Code(t._items.reduce((s,i)=>(i instanceof W.Name&&(i=n(i)),i instanceof W._Code?s.push(...i._items):s.push(i),s),[]));function n(s){let i=r[s.str];return i===void 0||e[s.str]!==1?s:(delete e[s.str],i)}function o(s){return s instanceof W._Code&&s._items.some(i=>i instanceof W.Name&&e[i.str]===1&&r[i.str]!==void 0)}}function cS(t,e){for(let r in e)t[r]=(t[r]||0)-(e[r]||0);}function gg(t){return typeof t=="boolean"||typeof t=="number"||t===null?!t:(0, W._)`!${Ju(t)}`}F.not=gg;var uS=yg(F.operators.AND);function lS(...t){return t.reduce(uS)}F.and=lS;var dS=yg(F.operators.OR);function pS(...t){return t.reduce(dS)}F.or=pS;function yg(t){return (e,r)=>e===W.nil?r:r===W.nil?e:(0, W._)`${Ju(e)} ${t} ${Ju(r)}`}function Ju(t){return t instanceof W.Name?t:(0, W._)`(${t})`}});var K=T(J=>{Object.defineProperty(J,"__esModule",{value:true});J.checkStrictMode=J.getErrorPath=J.Type=J.useFunc=J.setEvaluated=J.evaluatedPropsToName=J.mergeEvaluated=J.eachItem=J.unescapeJsonPointer=J.escapeJsonPointer=J.escapeFragment=J.unescapeFragment=J.schemaRefOrVal=J.schemaHasRulesButRef=J.schemaHasRules=J.checkUnknownRules=J.alwaysValidSchema=J.toHash=void 0;var oe=U(),fS=Ao();function mS(t){let e={};for(let r of t)e[r]=true;return e}J.toHash=mS;function hS(t,e){return typeof e=="boolean"?e:Object.keys(e).length===0?true:(kg(t,e),!wg(e,t.self.RULES.all))}J.alwaysValidSchema=hS;function kg(t,e=t.schema){let{opts:r,self:n}=t;if(!r.strictSchema||typeof e=="boolean")return;let o=n.RULES.keywords;for(let s in e)o[s]||$g(t,`unknown keyword: "${s}"`);}J.checkUnknownRules=kg;function wg(t,e){if(typeof t=="boolean")return !t;for(let r in t)if(e[r])return true;return false}J.schemaHasRules=wg;function gS(t,e){if(typeof t=="boolean")return !t;for(let r in t)if(r!=="$ref"&&e.all[r])return true;return false}J.schemaHasRulesButRef=gS;function yS({topSchemaRef:t,schemaPath:e},r,n,o){if(!o){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return (0, oe._)`${r}`}return (0, oe._)`${t}${e}${(0, oe.getProperty)(n)}`}J.schemaRefOrVal=yS;function _S(t){return xg(decodeURIComponent(t))}J.unescapeFragment=_S;function vS(t){return encodeURIComponent(Bu(t))}J.escapeFragment=vS;function Bu(t){return typeof t=="number"?`${t}`:t.replace(/~/g,"~0").replace(/\//g,"~1")}J.escapeJsonPointer=Bu;function xg(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}J.unescapeJsonPointer=xg;function kS(t,e){if(Array.isArray(t))for(let r of t)e(r);else e(t);}J.eachItem=kS;function _g({mergeNames:t,mergeToName:e,mergeValues:r,resultToName:n}){return (o,s,i,a)=>{let c=i===void 0?s:i instanceof oe.Name?(s instanceof oe.Name?t(o,s,i):e(o,s,i),i):s instanceof oe.Name?(e(o,i,s),s):r(s,i);return a===oe.Name&&!(c instanceof oe.Name)?n(o,c):c}}J.mergeEvaluated={props:_g({mergeNames:(t,e,r)=>t.if((0, oe._)`${r} !== true && ${e} !== undefined`,()=>{t.if((0, oe._)`${e} === true`,()=>t.assign(r,true),()=>t.assign(r,(0, oe._)`${r} || {}`).code((0, oe._)`Object.assign(${r}, ${e})`));}),mergeToName:(t,e,r)=>t.if((0, oe._)`${r} !== true`,()=>{e===true?t.assign(r,true):(t.assign(r,(0, oe._)`${r} || {}`),Gu(t,r,e));}),mergeValues:(t,e)=>t===true?true:{...t,...e},resultToName:bg}),items:_g({mergeNames:(t,e,r)=>t.if((0, oe._)`${r} !== true && ${e} !== undefined`,()=>t.assign(r,(0, oe._)`${e} === true ? true : ${r} > ${e} ? ${r} : ${e}`)),mergeToName:(t,e,r)=>t.if((0, oe._)`${r} !== true`,()=>t.assign(r,e===true?true:(0, oe._)`${r} > ${e} ? ${r} : ${e}`)),mergeValues:(t,e)=>t===true?true:Math.max(t,e),resultToName:(t,e)=>t.var("items",e)})};function bg(t,e){if(e===true)return t.var("props",true);let r=t.var("props",(0, oe._)`{}`);return e!==void 0&&Gu(t,r,e),r}J.evaluatedPropsToName=bg;function Gu(t,e,r){Object.keys(r).forEach(n=>t.assign((0, oe._)`${e}${(0, oe.getProperty)(n)}`,true));}J.setEvaluated=Gu;var vg={};function wS(t,e){return t.scopeValue("func",{ref:e,code:vg[e.code]||(vg[e.code]=new fS._Code(e.code))})}J.useFunc=wS;var Vu;(function(t){t[t.Num=0]="Num",t[t.Str=1]="Str";})(Vu||(J.Type=Vu={}));function xS(t,e,r){if(t instanceof oe.Name){let n=e===Vu.Num;return r?n?(0, oe._)`"[" + ${t} + "]"`:(0, oe._)`"['" + ${t} + "']"`:n?(0, oe._)`"/" + ${t}`:(0, oe._)`"/" + ${t}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0, oe.getProperty)(t).toString():"/"+Bu(t)}J.getErrorPath=xS;function $g(t,e,r=t.opts.strictSchema){if(r){if(e=`strict mode: ${e}`,r===true)throw new Error(e);t.self.logger.warn(e);}}J.checkStrictMode=$g;});var Xt=T(Hu=>{Object.defineProperty(Hu,"__esModule",{value:true});var Ae=U(),bS={data:new Ae.Name("data"),valCxt:new Ae.Name("valCxt"),instancePath:new Ae.Name("instancePath"),parentData:new Ae.Name("parentData"),parentDataProperty:new Ae.Name("parentDataProperty"),rootData:new Ae.Name("rootData"),dynamicAnchors:new Ae.Name("dynamicAnchors"),vErrors:new Ae.Name("vErrors"),errors:new Ae.Name("errors"),this:new Ae.Name("this"),self:new Ae.Name("self"),scope:new Ae.Name("scope"),json:new Ae.Name("json"),jsonPos:new Ae.Name("jsonPos"),jsonLen:new Ae.Name("jsonLen"),jsonPart:new Ae.Name("jsonPart")};Hu.default=bS;});var Uo=T(Ze=>{Object.defineProperty(Ze,"__esModule",{value:true});Ze.extendErrors=Ze.resetErrorsCount=Ze.reportExtraError=Ze.reportError=Ze.keyword$DataError=Ze.keywordError=void 0;var Y=U(),Si=K(),Ue=Xt();Ze.keywordError={message:({keyword:t})=>(0, Y.str)`must pass "${t}" keyword validation`};Ze.keyword$DataError={message:({keyword:t,schemaType:e})=>e?(0, Y.str)`"${t}" keyword must be ${e} ($data)`:(0, Y.str)`"${t}" keyword is invalid ($data)`};function $S(t,e=Ze.keywordError,r,n){let{it:o}=t,{gen:s,compositeRule:i,allErrors:a}=o,c=zg(t,e,r);n??(i||a)?Sg(s,c):Tg(o,(0, Y._)`[${c}]`);}Ze.reportError=$S;function SS(t,e=Ze.keywordError,r){let{it:n}=t,{gen:o,compositeRule:s,allErrors:i}=n,a=zg(t,e,r);Sg(o,a),s||i||Tg(n,Ue.default.vErrors);}Ze.reportExtraError=SS;function TS(t,e){t.assign(Ue.default.errors,e),t.if((0, Y._)`${Ue.default.vErrors} !== null`,()=>t.if(e,()=>t.assign((0, Y._)`${Ue.default.vErrors}.length`,e),()=>t.assign(Ue.default.vErrors,null)));}Ze.resetErrorsCount=TS;function zS({gen:t,keyword:e,schemaValue:r,data:n,errsCount:o,it:s}){if(o===void 0)throw new Error("ajv implementation error");let i=t.name("err");t.forRange("i",o,Ue.default.errors,a=>{t.const(i,(0, Y._)`${Ue.default.vErrors}[${a}]`),t.if((0, Y._)`${i}.instancePath === undefined`,()=>t.assign((0, Y._)`${i}.instancePath`,(0, Y.strConcat)(Ue.default.instancePath,s.errorPath))),t.assign((0, Y._)`${i}.schemaPath`,(0, Y.str)`${s.errSchemaPath}/${e}`),s.opts.verbose&&(t.assign((0, Y._)`${i}.schema`,r),t.assign((0, Y._)`${i}.data`,n));});}Ze.extendErrors=zS;function Sg(t,e){let r=t.const("err",e);t.if((0, Y._)`${Ue.default.vErrors} === null`,()=>t.assign(Ue.default.vErrors,(0, Y._)`[${r}]`),(0, Y._)`${Ue.default.vErrors}.push(${r})`),t.code((0, Y._)`${Ue.default.errors}++`);}function Tg(t,e){let{gen:r,validateName:n,schemaEnv:o}=t;o.$async?r.throw((0, Y._)`new ${t.ValidationError}(${e})`):(r.assign((0, Y._)`${n}.errors`,e),r.return(false));}var Hr={keyword:new Y.Name("keyword"),schemaPath:new Y.Name("schemaPath"),params:new Y.Name("params"),propertyName:new Y.Name("propertyName"),message:new Y.Name("message"),schema:new Y.Name("schema"),parentSchema:new Y.Name("parentSchema")};function zg(t,e,r){let{createErrors:n}=t.it;return n===false?(0, Y._)`{}`:PS(t,e,r)}function PS(t,e,r={}){let{gen:n,it:o}=t,s=[ES(o,r),CS(t,r)];return jS(t,e,s),n.object(...s)}function ES({errorPath:t},{instancePath:e}){let r=e?(0, Y.str)`${t}${(0, Si.getErrorPath)(e,Si.Type.Str)}`:t;return [Ue.default.instancePath,(0, Y.strConcat)(Ue.default.instancePath,r)]}function CS({keyword:t,it:{errSchemaPath:e}},{schemaPath:r,parentSchema:n}){let o=n?e:(0, Y.str)`${e}/${t}`;return r&&(o=(0, Y.str)`${o}${(0, Si.getErrorPath)(r,Si.Type.Str)}`),[Hr.schemaPath,o]}function jS(t,{params:e,message:r},n){let{keyword:o,data:s,schemaValue:i,it:a}=t,{opts:c,propertyName:u,topSchemaRef:l,schemaPath:d}=a;n.push([Hr.keyword,o],[Hr.params,typeof e=="function"?e(t):e||(0, Y._)`{}`]),c.messages&&n.push([Hr.message,typeof r=="function"?r(t):r]),c.verbose&&n.push([Hr.schema,i],[Hr.parentSchema,(0, Y._)`${l}${d}`],[Ue.default.data,s]),u&&n.push([Hr.propertyName,u]);}});var Eg=T(jn=>{Object.defineProperty(jn,"__esModule",{value:true});jn.boolOrEmptySchema=jn.topBoolOrEmptySchema=void 0;var RS=Uo(),IS=U(),OS=Xt(),NS={message:"boolean schema is false"};function AS(t){let{gen:e,schema:r,validateName:n}=t;r===false?Pg(t,false):typeof r=="object"&&r.$async===true?e.return(OS.default.data):(e.assign((0, IS._)`${n}.errors`,null),e.return(true));}jn.topBoolOrEmptySchema=AS;function ZS(t,e){let{gen:r,schema:n}=t;n===false?(r.var(e,false),Pg(t)):r.var(e,true);}jn.boolOrEmptySchema=ZS;function Pg(t,e){let{gen:r,data:n}=t,o={gen:r,keyword:"false schema",data:n,schema:false,schemaCode:false,schemaValue:false,params:{},it:t};(0, RS.reportError)(o,NS,void 0,e);}});var Wu=T(Rn=>{Object.defineProperty(Rn,"__esModule",{value:true});Rn.getRules=Rn.isJSONType=void 0;var MS=["string","number","integer","boolean","null","object","array"],DS=new Set(MS);function qS(t){return typeof t=="string"&&DS.has(t)}Rn.isJSONType=qS;function LS(){let t={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return {types:{...t,integer:true,boolean:true,null:true},rules:[{rules:[]},t.number,t.string,t.array,t.object],post:{rules:[]},all:{},keywords:{}}}Rn.getRules=LS;});var Ku=T(mr=>{Object.defineProperty(mr,"__esModule",{value:true});mr.shouldUseRule=mr.shouldUseGroup=mr.schemaHasRulesForType=void 0;function US({schema:t,self:e},r){let n=e.RULES.types[r];return n&&n!==true&&Cg(t,n)}mr.schemaHasRulesForType=US;function Cg(t,e){return e.rules.some(r=>jg(t,r))}mr.shouldUseGroup=Cg;function jg(t,e){var r;return t[e.keyword]!==void 0||((r=e.definition.implements)===null||r===void 0?void 0:r.some(n=>t[n]!==void 0))}mr.shouldUseRule=jg;});var Fo=T(Me=>{Object.defineProperty(Me,"__esModule",{value:true});Me.reportTypeError=Me.checkDataTypes=Me.checkDataType=Me.coerceAndCheckDataType=Me.getJSONTypes=Me.getSchemaTypes=Me.DataType=void 0;var FS=Wu(),JS=Ku(),VS=Uo(),q=U(),Rg=K(),In;(function(t){t[t.Correct=0]="Correct",t[t.Wrong=1]="Wrong";})(In||(Me.DataType=In={}));function BS(t){let e=Ig(t.type);if(e.includes("null")){if(t.nullable===false)throw new Error("type: null contradicts nullable: false")}else {if(!e.length&&t.nullable!==void 0)throw new Error('"nullable" cannot be used without "type"');t.nullable===true&&e.push("null");}return e}Me.getSchemaTypes=BS;function Ig(t){let e=Array.isArray(t)?t:t?[t]:[];if(e.every(FS.isJSONType))return e;throw new Error("type must be JSONType or JSONType[]: "+e.join(","))}Me.getJSONTypes=Ig;function GS(t,e){let{gen:r,data:n,opts:o}=t,s=HS(e,o.coerceTypes),i=e.length>0&&!(s.length===0&&e.length===1&&(0, JS.schemaHasRulesForType)(t,e[0]));if(i){let a=Qu(e,n,o.strictNumbers,In.Wrong);r.if(a,()=>{s.length?WS(t,e,s):Xu(t);});}return i}Me.coerceAndCheckDataType=GS;var Og=new Set(["string","number","integer","boolean","null"]);function HS(t,e){return e?t.filter(r=>Og.has(r)||e==="array"&&r==="array"):[]}function WS(t,e,r){let{gen:n,data:o,opts:s}=t,i=n.let("dataType",(0, q._)`typeof ${o}`),a=n.let("coerced",(0, q._)`undefined`);s.coerceTypes==="array"&&n.if((0, q._)`${i} == 'object' && Array.isArray(${o}) && ${o}.length == 1`,()=>n.assign(o,(0, q._)`${o}[0]`).assign(i,(0, q._)`typeof ${o}`).if(Qu(e,o,s.strictNumbers),()=>n.assign(a,o))),n.if((0, q._)`${a} !== undefined`);for(let u of r)(Og.has(u)||u==="array"&&s.coerceTypes==="array")&&c(u);n.else(),Xu(t),n.endIf(),n.if((0, q._)`${a} !== undefined`,()=>{n.assign(o,a),KS(t,a);});function c(u){switch(u){case "string":n.elseIf((0, q._)`${i} == "number" || ${i} == "boolean"`).assign(a,(0, q._)`"" + ${o}`).elseIf((0, q._)`${o} === null`).assign(a,(0, q._)`""`);return;case "number":n.elseIf((0, q._)`${i} == "boolean" || ${o} === null
|
|
36
|
+
|| (${i} == "string" && ${o} && ${o} == +${o})`).assign(a,(0, q._)`+${o}`);return;case "integer":n.elseIf((0, q._)`${i} === "boolean" || ${o} === null
|
|
37
|
+
|| (${i} === "string" && ${o} && ${o} == +${o} && !(${o} % 1))`).assign(a,(0, q._)`+${o}`);return;case "boolean":n.elseIf((0, q._)`${o} === "false" || ${o} === 0 || ${o} === null`).assign(a,false).elseIf((0, q._)`${o} === "true" || ${o} === 1`).assign(a,true);return;case "null":n.elseIf((0, q._)`${o} === "" || ${o} === 0 || ${o} === false`),n.assign(a,null);return;case "array":n.elseIf((0, q._)`${i} === "string" || ${i} === "number"
|
|
38
|
+
|| ${i} === "boolean" || ${o} === null`).assign(a,(0, q._)`[${o}]`);}}}function KS({gen:t,parentData:e,parentDataProperty:r},n){t.if((0, q._)`${e} !== undefined`,()=>t.assign((0, q._)`${e}[${r}]`,n));}function Yu(t,e,r,n=In.Correct){let o=n===In.Correct?q.operators.EQ:q.operators.NEQ,s;switch(t){case "null":return (0, q._)`${e} ${o} null`;case "array":s=(0, q._)`Array.isArray(${e})`;break;case "object":s=(0, q._)`${e} && typeof ${e} == "object" && !Array.isArray(${e})`;break;case "integer":s=i((0, q._)`!(${e} % 1) && !isNaN(${e})`);break;case "number":s=i();break;default:return (0, q._)`typeof ${e} ${o} ${t}`}return n===In.Correct?s:(0, q.not)(s);function i(a=q.nil){return (0, q.and)((0, q._)`typeof ${e} == "number"`,a,r?(0, q._)`isFinite(${e})`:q.nil)}}Me.checkDataType=Yu;function Qu(t,e,r,n){if(t.length===1)return Yu(t[0],e,r,n);let o,s=(0, Rg.toHash)(t);if(s.array&&s.object){let i=(0, q._)`typeof ${e} != "object"`;o=s.null?i:(0, q._)`!${e} || ${i}`,delete s.null,delete s.array,delete s.object;}else o=q.nil;s.number&&delete s.integer;for(let i in s)o=(0, q.and)(o,Yu(i,e,r,n));return o}Me.checkDataTypes=Qu;var YS={message:({schema:t})=>`must be ${t}`,params:({schema:t,schemaValue:e})=>typeof t=="string"?(0, q._)`{type: ${t}}`:(0, q._)`{type: ${e}}`};function Xu(t){let e=QS(t);(0, VS.reportError)(e,YS);}Me.reportTypeError=Xu;function QS(t){let{gen:e,data:r,schema:n}=t,o=(0, Rg.schemaRefOrVal)(t,n,"type");return {gen:e,keyword:"type",data:r,schema:n.type,schemaCode:o,schemaValue:o,parentSchema:n,params:{},it:t}}});var Ag=T(Ti=>{Object.defineProperty(Ti,"__esModule",{value:true});Ti.assignDefaults=void 0;var On=U(),XS=K();function eT(t,e){let{properties:r,items:n}=t.schema;if(e==="object"&&r)for(let o in r)Ng(t,o,r[o].default);else e==="array"&&Array.isArray(n)&&n.forEach((o,s)=>Ng(t,s,o.default));}Ti.assignDefaults=eT;function Ng(t,e,r){let{gen:n,compositeRule:o,data:s,opts:i}=t;if(r===void 0)return;let a=(0, On._)`${s}${(0, On.getProperty)(e)}`;if(o){(0, XS.checkStrictMode)(t,`default is ignored for: ${a}`);return}let c=(0, On._)`${a} === undefined`;i.useDefaults==="empty"&&(c=(0, On._)`${c} || ${a} === null || ${a} === ""`),n.if(c,(0, On._)`${a} = ${(0, On.stringify)(r)}`);}});var lt=T(ne=>{Object.defineProperty(ne,"__esModule",{value:true});ne.validateUnion=ne.validateArray=ne.usePattern=ne.callValidateCode=ne.schemaProperties=ne.allSchemaProperties=ne.noPropertyInData=ne.propertyInData=ne.isOwnProperty=ne.hasPropFunc=ne.reportMissingProp=ne.checkMissingProp=ne.checkReportMissingProp=void 0;var de=U(),el=K(),hr=Xt(),tT=K();function rT(t,e){let{gen:r,data:n,it:o}=t;r.if(rl(r,n,e,o.opts.ownProperties),()=>{t.setParams({missingProperty:(0, de._)`${e}`},true),t.error();});}ne.checkReportMissingProp=rT;function nT({gen:t,data:e,it:{opts:r}},n,o){return (0, de.or)(...n.map(s=>(0, de.and)(rl(t,e,s,r.ownProperties),(0, de._)`${o} = ${s}`)))}ne.checkMissingProp=nT;function oT(t,e){t.setParams({missingProperty:e},true),t.error();}ne.reportMissingProp=oT;function Zg(t){return t.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0, de._)`Object.prototype.hasOwnProperty`})}ne.hasPropFunc=Zg;function tl(t,e,r){return (0, de._)`${Zg(t)}.call(${e}, ${r})`}ne.isOwnProperty=tl;function sT(t,e,r,n){let o=(0, de._)`${e}${(0, de.getProperty)(r)} !== undefined`;return n?(0, de._)`${o} && ${tl(t,e,r)}`:o}ne.propertyInData=sT;function rl(t,e,r,n){let o=(0, de._)`${e}${(0, de.getProperty)(r)} === undefined`;return n?(0, de.or)(o,(0, de.not)(tl(t,e,r))):o}ne.noPropertyInData=rl;function Mg(t){return t?Object.keys(t).filter(e=>e!=="__proto__"):[]}ne.allSchemaProperties=Mg;function iT(t,e){return Mg(e).filter(r=>!(0, el.alwaysValidSchema)(t,e[r]))}ne.schemaProperties=iT;function aT({schemaCode:t,data:e,it:{gen:r,topSchemaRef:n,schemaPath:o,errorPath:s},it:i},a,c,u){let l=u?(0, de._)`${t}, ${e}, ${n}${o}`:e,d=[[hr.default.instancePath,(0, de.strConcat)(hr.default.instancePath,s)],[hr.default.parentData,i.parentData],[hr.default.parentDataProperty,i.parentDataProperty],[hr.default.rootData,hr.default.rootData]];i.opts.dynamicRef&&d.push([hr.default.dynamicAnchors,hr.default.dynamicAnchors]);let p=(0, de._)`${l}, ${r.object(...d)}`;return c!==de.nil?(0, de._)`${a}.call(${c}, ${p})`:(0, de._)`${a}(${p})`}ne.callValidateCode=aT;var cT=(0, de._)`new RegExp`;function uT({gen:t,it:{opts:e}},r){let n=e.unicodeRegExp?"u":"",{regExp:o}=e.code,s=o(r,n);return t.scopeValue("pattern",{key:s.toString(),ref:s,code:(0, de._)`${o.code==="new RegExp"?cT:(0, tT.useFunc)(t,o)}(${r}, ${n})`})}ne.usePattern=uT;function lT(t){let{gen:e,data:r,keyword:n,it:o}=t,s=e.name("valid");if(o.allErrors){let a=e.let("valid",true);return i(()=>e.assign(a,false)),a}return e.var(s,true),i(()=>e.break()),s;function i(a){let c=e.const("len",(0, de._)`${r}.length`);e.forRange("i",0,c,u=>{t.subschema({keyword:n,dataProp:u,dataPropType:el.Type.Num},s),e.if((0, de.not)(s),a);});}}ne.validateArray=lT;function dT(t){let{gen:e,schema:r,keyword:n,it:o}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");if(r.some(c=>(0, el.alwaysValidSchema)(o,c))&&!o.opts.unevaluated)return;let i=e.let("valid",false),a=e.name("_valid");e.block(()=>r.forEach((c,u)=>{let l=t.subschema({keyword:n,schemaProp:u,compositeRule:true},a);e.assign(i,(0, de._)`${i} || ${a}`),t.mergeValidEvaluated(l,a)||e.if((0, de.not)(i));})),t.result(i,()=>t.reset(),()=>t.error(true));}ne.validateUnion=dT;});var Lg=T(Nt=>{Object.defineProperty(Nt,"__esModule",{value:true});Nt.validateKeywordUsage=Nt.validSchemaType=Nt.funcKeywordCode=Nt.macroKeywordCode=void 0;var Fe=U(),Wr=Xt(),pT=lt(),fT=Uo();function mT(t,e){let{gen:r,keyword:n,schema:o,parentSchema:s,it:i}=t,a=e.macro.call(i.self,o,s,i),c=qg(r,n,a);i.opts.validateSchema!==false&&i.self.validateSchema(a,true);let u=r.name("valid");t.subschema({schema:a,schemaPath:Fe.nil,errSchemaPath:`${i.errSchemaPath}/${n}`,topSchemaRef:c,compositeRule:true},u),t.pass(u,()=>t.error(true));}Nt.macroKeywordCode=mT;function hT(t,e){var r;let{gen:n,keyword:o,schema:s,parentSchema:i,$data:a,it:c}=t;yT(c,e);let u=!a&&e.compile?e.compile.call(c.self,s,i,c):e.validate,l=qg(n,o,u),d=n.let("valid");t.block$data(d,p),t.ok((r=e.valid)!==null&&r!==void 0?r:d);function p(){if(e.errors===false)_(),e.modifying&&Dg(t),w(()=>t.error());else {let x=e.async?f():h();e.modifying&&Dg(t),w(()=>gT(t,x));}}function f(){let x=n.let("ruleErrs",null);return n.try(()=>_((0, Fe._)`await `),$=>n.assign(d,false).if((0, Fe._)`${$} instanceof ${c.ValidationError}`,()=>n.assign(x,(0, Fe._)`${$}.errors`),()=>n.throw($))),x}function h(){let x=(0, Fe._)`${l}.errors`;return n.assign(x,null),_(Fe.nil),x}function _(x=e.async?(0, Fe._)`await `:Fe.nil){let $=c.opts.passContext?Wr.default.this:Wr.default.self,b=!("compile"in e&&!a||e.schema===false);n.assign(d,(0, Fe._)`${x}${(0, pT.callValidateCode)(t,l,$,b)}`,e.modifying);}function w(x){var $;n.if((0, Fe.not)(($=e.valid)!==null&&$!==void 0?$:d),x);}}Nt.funcKeywordCode=hT;function Dg(t){let{gen:e,data:r,it:n}=t;e.if(n.parentData,()=>e.assign(r,(0, Fe._)`${n.parentData}[${n.parentDataProperty}]`));}function gT(t,e){let{gen:r}=t;r.if((0, Fe._)`Array.isArray(${e})`,()=>{r.assign(Wr.default.vErrors,(0, Fe._)`${Wr.default.vErrors} === null ? ${e} : ${Wr.default.vErrors}.concat(${e})`).assign(Wr.default.errors,(0, Fe._)`${Wr.default.vErrors}.length`),(0, fT.extendErrors)(t);},()=>t.error());}function yT({schemaEnv:t},e){if(e.async&&!t.$async)throw new Error("async keyword in sync schema")}function qg(t,e,r){if(r===void 0)throw new Error(`keyword "${e}" failed to compile`);return t.scopeValue("keyword",typeof r=="function"?{ref:r}:{ref:r,code:(0, Fe.stringify)(r)})}function _T(t,e,r=false){return !e.length||e.some(n=>n==="array"?Array.isArray(t):n==="object"?t&&typeof t=="object"&&!Array.isArray(t):typeof t==n||r&&typeof t>"u")}Nt.validSchemaType=_T;function vT({schema:t,opts:e,self:r,errSchemaPath:n},o,s){if(Array.isArray(o.keyword)?!o.keyword.includes(s):o.keyword!==s)throw new Error("ajv implementation error");let i=o.dependencies;if(i?.some(a=>!Object.prototype.hasOwnProperty.call(t,a)))throw new Error(`parent schema must have dependencies of ${s}: ${i.join(",")}`);if(o.validateSchema&&!o.validateSchema(t[s])){let c=`keyword "${s}" value is invalid at path "${n}": `+r.errorsText(o.validateSchema.errors);if(e.validateSchema==="log")r.logger.error(c);else throw new Error(c)}}Nt.validateKeywordUsage=vT;});var Fg=T(gr=>{Object.defineProperty(gr,"__esModule",{value:true});gr.extendSubschemaMode=gr.extendSubschemaData=gr.getSubschema=void 0;var At=U(),Ug=K();function kT(t,{keyword:e,schemaProp:r,schema:n,schemaPath:o,errSchemaPath:s,topSchemaRef:i}){if(e!==void 0&&n!==void 0)throw new Error('both "keyword" and "schema" passed, only one allowed');if(e!==void 0){let a=t.schema[e];return r===void 0?{schema:a,schemaPath:(0, At._)`${t.schemaPath}${(0, At.getProperty)(e)}`,errSchemaPath:`${t.errSchemaPath}/${e}`}:{schema:a[r],schemaPath:(0, At._)`${t.schemaPath}${(0, At.getProperty)(e)}${(0, At.getProperty)(r)}`,errSchemaPath:`${t.errSchemaPath}/${e}/${(0, Ug.escapeFragment)(r)}`}}if(n!==void 0){if(o===void 0||s===void 0||i===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return {schema:n,schemaPath:o,topSchemaRef:i,errSchemaPath:s}}throw new Error('either "keyword" or "schema" must be passed')}gr.getSubschema=kT;function wT(t,e,{dataProp:r,dataPropType:n,data:o,dataTypes:s,propertyName:i}){if(o!==void 0&&r!==void 0)throw new Error('both "data" and "dataProp" passed, only one allowed');let{gen:a}=e;if(r!==void 0){let{errorPath:u,dataPathArr:l,opts:d}=e,p=a.let("data",(0, At._)`${e.data}${(0, At.getProperty)(r)}`,true);c(p),t.errorPath=(0, At.str)`${u}${(0, Ug.getErrorPath)(r,n,d.jsPropertySyntax)}`,t.parentDataProperty=(0, At._)`${r}`,t.dataPathArr=[...l,t.parentDataProperty];}if(o!==void 0){let u=o instanceof At.Name?o:a.let("data",o,true);c(u),i!==void 0&&(t.propertyName=i);}s&&(t.dataTypes=s);function c(u){t.data=u,t.dataLevel=e.dataLevel+1,t.dataTypes=[],e.definedProperties=new Set,t.parentData=e.data,t.dataNames=[...e.dataNames,u];}}gr.extendSubschemaData=wT;function xT(t,{jtdDiscriminator:e,jtdMetadata:r,compositeRule:n,createErrors:o,allErrors:s}){n!==void 0&&(t.compositeRule=n),o!==void 0&&(t.createErrors=o),s!==void 0&&(t.allErrors=s),t.jtdDiscriminator=e,t.jtdMetadata=r;}gr.extendSubschemaMode=xT;});var nl=T((CD,Jg)=>{Jg.exports=function t(e,r){if(e===r)return true;if(e&&r&&typeof e=="object"&&typeof r=="object"){if(e.constructor!==r.constructor)return false;var n,o,s;if(Array.isArray(e)){if(n=e.length,n!=r.length)return false;for(o=n;o--!==0;)if(!t(e[o],r[o]))return false;return true}if(e.constructor===RegExp)return e.source===r.source&&e.flags===r.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===r.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===r.toString();if(s=Object.keys(e),n=s.length,n!==Object.keys(r).length)return false;for(o=n;o--!==0;)if(!Object.prototype.hasOwnProperty.call(r,s[o]))return false;for(o=n;o--!==0;){var i=s[o];if(!t(e[i],r[i]))return false}return true}return e!==e&&r!==r};});var Bg=T((jD,Vg)=>{var yr=Vg.exports=function(t,e,r){typeof e=="function"&&(r=e,e={}),r=e.cb||r;var n=typeof r=="function"?r:r.pre||function(){},o=r.post||function(){};zi(e,n,o,t,"",t);};yr.keywords={additionalItems:true,items:true,contains:true,additionalProperties:true,propertyNames:true,not:true,if:true,then:true,else:true};yr.arrayKeywords={items:true,allOf:true,anyOf:true,oneOf:true};yr.propsKeywords={$defs:true,definitions:true,properties:true,patternProperties:true,dependencies:true};yr.skipKeywords={default:true,enum:true,const:true,required:true,maximum:true,minimum:true,exclusiveMaximum:true,exclusiveMinimum:true,multipleOf:true,maxLength:true,minLength:true,pattern:true,format:true,maxItems:true,minItems:true,uniqueItems:true,maxProperties:true,minProperties:true};function zi(t,e,r,n,o,s,i,a,c,u){if(n&&typeof n=="object"&&!Array.isArray(n)){e(n,o,s,i,a,c,u);for(var l in n){var d=n[l];if(Array.isArray(d)){if(l in yr.arrayKeywords)for(var p=0;p<d.length;p++)zi(t,e,r,d[p],o+"/"+l+"/"+p,s,o,l,n,p);}else if(l in yr.propsKeywords){if(d&&typeof d=="object")for(var f in d)zi(t,e,r,d[f],o+"/"+l+"/"+bT(f),s,o,l,n,f);}else (l in yr.keywords||t.allKeys&&!(l in yr.skipKeywords))&&zi(t,e,r,d,o+"/"+l,s,o,l,n);}r(n,o,s,i,a,c,u);}}function bT(t){return t.replace(/~/g,"~0").replace(/\//g,"~1")}});var Jo=T(Ke=>{Object.defineProperty(Ke,"__esModule",{value:true});Ke.getSchemaRefs=Ke.resolveUrl=Ke.normalizeId=Ke._getFullPath=Ke.getFullPath=Ke.inlineRef=void 0;var $T=K(),ST=nl(),TT=Bg(),zT=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function PT(t,e=true){return typeof t=="boolean"?true:e===true?!ol(t):e?Gg(t)<=e:false}Ke.inlineRef=PT;var ET=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function ol(t){for(let e in t){if(ET.has(e))return true;let r=t[e];if(Array.isArray(r)&&r.some(ol)||typeof r=="object"&&ol(r))return true}return false}function Gg(t){let e=0;for(let r in t){if(r==="$ref")return 1/0;if(e++,!zT.has(r)&&(typeof t[r]=="object"&&(0, $T.eachItem)(t[r],n=>e+=Gg(n)),e===1/0))return 1/0}return e}function Hg(t,e="",r){r!==false&&(e=Nn(e));let n=t.parse(e);return Wg(t,n)}Ke.getFullPath=Hg;function Wg(t,e){return t.serialize(e).split("#")[0]+"#"}Ke._getFullPath=Wg;var CT=/#\/?$/;function Nn(t){return t?t.replace(CT,""):""}Ke.normalizeId=Nn;function jT(t,e,r){return r=Nn(r),t.resolve(e,r)}Ke.resolveUrl=jT;var RT=/^[a-z_][-a-z0-9._]*$/i;function IT(t,e){if(typeof t=="boolean")return {};let{schemaId:r,uriResolver:n}=this.opts,o=Nn(t[r]||e),s={"":o},i=Hg(n,o,false),a={},c=new Set;return TT(t,{allKeys:true},(d,p,f,h)=>{if(h===void 0)return;let _=i+p,w=s[h];typeof d[r]=="string"&&(w=x.call(this,d[r])),$.call(this,d.$anchor),$.call(this,d.$dynamicAnchor),s[p]=w;function x(b){let R=this.opts.uriResolver.resolve;if(b=Nn(w?R(w,b):b),c.has(b))throw l(b);c.add(b);let I=this.refs[b];return typeof I=="string"&&(I=this.refs[I]),typeof I=="object"?u(d,I.schema,b):b!==Nn(_)&&(b[0]==="#"?(u(d,a[b],b),a[b]=d):this.refs[b]=_),b}function $(b){if(typeof b=="string"){if(!RT.test(b))throw new Error(`invalid anchor "${b}"`);x.call(this,`#${b}`);}}}),a;function u(d,p,f){if(p!==void 0&&!ST(d,p))throw l(f)}function l(d){return new Error(`reference "${d}" resolves to more than one schema`)}}Ke.getSchemaRefs=IT;});var Go=T(_r=>{Object.defineProperty(_r,"__esModule",{value:true});_r.getData=_r.KeywordCxt=_r.validateFunctionCode=void 0;var ey=Eg(),Kg=Fo(),il=Ku(),Pi=Fo(),OT=Ag(),Bo=Lg(),sl=Fg(),j=U(),Z=Xt(),NT=Jo(),er=K(),Vo=Uo();function AT(t){if(ny(t)&&(oy(t),ry(t))){DT(t);return}ty(t,()=>(0, ey.topBoolOrEmptySchema)(t));}_r.validateFunctionCode=AT;function ty({gen:t,validateName:e,schema:r,schemaEnv:n,opts:o},s){o.code.es5?t.func(e,(0, j._)`${Z.default.data}, ${Z.default.valCxt}`,n.$async,()=>{t.code((0, j._)`"use strict"; ${Yg(r,o)}`),MT(t,o),t.code(s);}):t.func(e,(0, j._)`${Z.default.data}, ${ZT(o)}`,n.$async,()=>t.code(Yg(r,o)).code(s));}function ZT(t){return (0, j._)`{${Z.default.instancePath}="", ${Z.default.parentData}, ${Z.default.parentDataProperty}, ${Z.default.rootData}=${Z.default.data}${t.dynamicRef?(0, j._)`, ${Z.default.dynamicAnchors}={}`:j.nil}}={}`}function MT(t,e){t.if(Z.default.valCxt,()=>{t.var(Z.default.instancePath,(0, j._)`${Z.default.valCxt}.${Z.default.instancePath}`),t.var(Z.default.parentData,(0, j._)`${Z.default.valCxt}.${Z.default.parentData}`),t.var(Z.default.parentDataProperty,(0, j._)`${Z.default.valCxt}.${Z.default.parentDataProperty}`),t.var(Z.default.rootData,(0, j._)`${Z.default.valCxt}.${Z.default.rootData}`),e.dynamicRef&&t.var(Z.default.dynamicAnchors,(0, j._)`${Z.default.valCxt}.${Z.default.dynamicAnchors}`);},()=>{t.var(Z.default.instancePath,(0, j._)`""`),t.var(Z.default.parentData,(0, j._)`undefined`),t.var(Z.default.parentDataProperty,(0, j._)`undefined`),t.var(Z.default.rootData,Z.default.data),e.dynamicRef&&t.var(Z.default.dynamicAnchors,(0, j._)`{}`);});}function DT(t){let{schema:e,opts:r,gen:n}=t;ty(t,()=>{r.$comment&&e.$comment&&iy(t),JT(t),n.let(Z.default.vErrors,null),n.let(Z.default.errors,0),r.unevaluated&&qT(t),sy(t),GT(t);});}function qT(t){let{gen:e,validateName:r}=t;t.evaluated=e.const("evaluated",(0, j._)`${r}.evaluated`),e.if((0, j._)`${t.evaluated}.dynamicProps`,()=>e.assign((0, j._)`${t.evaluated}.props`,(0, j._)`undefined`)),e.if((0, j._)`${t.evaluated}.dynamicItems`,()=>e.assign((0, j._)`${t.evaluated}.items`,(0, j._)`undefined`));}function Yg(t,e){let r=typeof t=="object"&&t[e.schemaId];return r&&(e.code.source||e.code.process)?(0, j._)`/*# sourceURL=${r} */`:j.nil}function LT(t,e){if(ny(t)&&(oy(t),ry(t))){UT(t,e);return}(0, ey.boolOrEmptySchema)(t,e);}function ry({schema:t,self:e}){if(typeof t=="boolean")return !t;for(let r in t)if(e.RULES.all[r])return true;return false}function ny(t){return typeof t.schema!="boolean"}function UT(t,e){let{schema:r,gen:n,opts:o}=t;o.$comment&&r.$comment&&iy(t),VT(t),BT(t);let s=n.const("_errs",Z.default.errors);sy(t,s),n.var(e,(0, j._)`${s} === ${Z.default.errors}`);}function oy(t){(0, er.checkUnknownRules)(t),FT(t);}function sy(t,e){if(t.opts.jtd)return Qg(t,[],false,e);let r=(0, Kg.getSchemaTypes)(t.schema),n=(0, Kg.coerceAndCheckDataType)(t,r);Qg(t,r,!n,e);}function FT(t){let{schema:e,errSchemaPath:r,opts:n,self:o}=t;e.$ref&&n.ignoreKeywordsWithRef&&(0, er.schemaHasRulesButRef)(e,o.RULES)&&o.logger.warn(`$ref: keywords ignored in schema at path "${r}"`);}function JT(t){let{schema:e,opts:r}=t;e.default!==void 0&&r.useDefaults&&r.strictSchema&&(0, er.checkStrictMode)(t,"default is ignored in the schema root");}function VT(t){let e=t.schema[t.opts.schemaId];e&&(t.baseId=(0, NT.resolveUrl)(t.opts.uriResolver,t.baseId,e));}function BT(t){if(t.schema.$async&&!t.schemaEnv.$async)throw new Error("async schema in sync schema")}function iy({gen:t,schemaEnv:e,schema:r,errSchemaPath:n,opts:o}){let s=r.$comment;if(o.$comment===true)t.code((0, j._)`${Z.default.self}.logger.log(${s})`);else if(typeof o.$comment=="function"){let i=(0, j.str)`${n}/$comment`,a=t.scopeValue("root",{ref:e.root});t.code((0, j._)`${Z.default.self}.opts.$comment(${s}, ${i}, ${a}.schema)`);}}function GT(t){let{gen:e,schemaEnv:r,validateName:n,ValidationError:o,opts:s}=t;r.$async?e.if((0, j._)`${Z.default.errors} === 0`,()=>e.return(Z.default.data),()=>e.throw((0, j._)`new ${o}(${Z.default.vErrors})`)):(e.assign((0, j._)`${n}.errors`,Z.default.vErrors),s.unevaluated&&HT(t),e.return((0, j._)`${Z.default.errors} === 0`));}function HT({gen:t,evaluated:e,props:r,items:n}){r instanceof j.Name&&t.assign((0, j._)`${e}.props`,r),n instanceof j.Name&&t.assign((0, j._)`${e}.items`,n);}function Qg(t,e,r,n){let{gen:o,schema:s,data:i,allErrors:a,opts:c,self:u}=t,{RULES:l}=u;if(s.$ref&&(c.ignoreKeywordsWithRef||!(0, er.schemaHasRulesButRef)(s,l))){o.block(()=>cy(t,"$ref",l.all.$ref.definition));return}c.jtd||WT(t,e),o.block(()=>{for(let p of l.rules)d(p);d(l.post);});function d(p){(0, il.shouldUseGroup)(s,p)&&(p.type?(o.if((0, Pi.checkDataType)(p.type,i,c.strictNumbers)),Xg(t,p),e.length===1&&e[0]===p.type&&r&&(o.else(),(0, Pi.reportTypeError)(t)),o.endIf()):Xg(t,p),a||o.if((0, j._)`${Z.default.errors} === ${n||0}`));}}function Xg(t,e){let{gen:r,schema:n,opts:{useDefaults:o}}=t;o&&(0, OT.assignDefaults)(t,e.type),r.block(()=>{for(let s of e.rules)(0, il.shouldUseRule)(n,s)&&cy(t,s.keyword,s.definition,e.type);});}function WT(t,e){t.schemaEnv.meta||!t.opts.strictTypes||(KT(t,e),t.opts.allowUnionTypes||YT(t,e),QT(t,t.dataTypes));}function KT(t,e){if(e.length){if(!t.dataTypes.length){t.dataTypes=e;return}e.forEach(r=>{ay(t.dataTypes,r)||al(t,`type "${r}" not allowed by context "${t.dataTypes.join(",")}"`);}),ez(t,e);}}function YT(t,e){e.length>1&&!(e.length===2&&e.includes("null"))&&al(t,"use allowUnionTypes to allow union type keyword");}function QT(t,e){let r=t.self.RULES.all;for(let n in r){let o=r[n];if(typeof o=="object"&&(0, il.shouldUseRule)(t.schema,o)){let{type:s}=o.definition;s.length&&!s.some(i=>XT(e,i))&&al(t,`missing type "${s.join(",")}" for keyword "${n}"`);}}}function XT(t,e){return t.includes(e)||e==="number"&&t.includes("integer")}function ay(t,e){return t.includes(e)||e==="integer"&&t.includes("number")}function ez(t,e){let r=[];for(let n of t.dataTypes)ay(e,n)?r.push(n):e.includes("integer")&&n==="number"&&r.push("integer");t.dataTypes=r;}function al(t,e){let r=t.schemaEnv.baseId+t.errSchemaPath;e+=` at "${r}" (strictTypes)`,(0, er.checkStrictMode)(t,e,t.opts.strictTypes);}var Ei=class{constructor(e,r,n){if((0, Bo.validateKeywordUsage)(e,r,n),this.gen=e.gen,this.allErrors=e.allErrors,this.keyword=n,this.data=e.data,this.schema=e.schema[n],this.$data=r.$data&&e.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0, er.schemaRefOrVal)(e,this.schema,n,this.$data),this.schemaType=r.schemaType,this.parentSchema=e.schema,this.params={},this.it=e,this.def=r,this.$data)this.schemaCode=e.gen.const("vSchema",uy(this.$data,e));else if(this.schemaCode=this.schemaValue,!(0, Bo.validSchemaType)(this.schema,r.schemaType,r.allowUndefined))throw new Error(`${n} value must be ${JSON.stringify(r.schemaType)}`);("code"in r?r.trackErrors:r.errors!==false)&&(this.errsCount=e.gen.const("_errs",Z.default.errors));}result(e,r,n){this.failResult((0, j.not)(e),r,n);}failResult(e,r,n){this.gen.if(e),n?n():this.error(),r?(this.gen.else(),r(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else();}pass(e,r){this.failResult((0, j.not)(e),void 0,r);}fail(e){if(e===void 0){this.error(),this.allErrors||this.gen.if(false);return}this.gen.if(e),this.error(),this.allErrors?this.gen.endIf():this.gen.else();}fail$data(e){if(!this.$data)return this.fail(e);let{schemaCode:r}=this;this.fail((0, j._)`${r} !== undefined && (${(0, j.or)(this.invalid$data(),e)})`);}error(e,r,n){if(r){this.setParams(r),this._error(e,n),this.setParams({});return}this._error(e,n);}_error(e,r){(e?Vo.reportExtraError:Vo.reportError)(this,this.def.error,r);}$dataError(){(0, Vo.reportError)(this,this.def.$dataError||Vo.keyword$DataError);}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0, Vo.resetErrorsCount)(this.gen,this.errsCount);}ok(e){this.allErrors||this.gen.if(e);}setParams(e,r){r?Object.assign(this.params,e):this.params=e;}block$data(e,r,n=j.nil){this.gen.block(()=>{this.check$data(e,n),r();});}check$data(e=j.nil,r=j.nil){if(!this.$data)return;let{gen:n,schemaCode:o,schemaType:s,def:i}=this;n.if((0, j.or)((0, j._)`${o} === undefined`,r)),e!==j.nil&&n.assign(e,true),(s.length||i.validateSchema)&&(n.elseIf(this.invalid$data()),this.$dataError(),e!==j.nil&&n.assign(e,false)),n.else();}invalid$data(){let{gen:e,schemaCode:r,schemaType:n,def:o,it:s}=this;return (0, j.or)(i(),a());function i(){if(n.length){if(!(r instanceof j.Name))throw new Error("ajv implementation error");let c=Array.isArray(n)?n:[n];return (0, j._)`${(0, Pi.checkDataTypes)(c,r,s.opts.strictNumbers,Pi.DataType.Wrong)}`}return j.nil}function a(){if(o.validateSchema){let c=e.scopeValue("validate$data",{ref:o.validateSchema});return (0, j._)`!${c}(${r})`}return j.nil}}subschema(e,r){let n=(0, sl.getSubschema)(this.it,e);(0, sl.extendSubschemaData)(n,this.it,e),(0, sl.extendSubschemaMode)(n,e);let o={...this.it,...n,items:void 0,props:void 0};return LT(o,r),o}mergeEvaluated(e,r){let{it:n,gen:o}=this;n.opts.unevaluated&&(n.props!==true&&e.props!==void 0&&(n.props=er.mergeEvaluated.props(o,e.props,n.props,r)),n.items!==true&&e.items!==void 0&&(n.items=er.mergeEvaluated.items(o,e.items,n.items,r)));}mergeValidEvaluated(e,r){let{it:n,gen:o}=this;if(n.opts.unevaluated&&(n.props!==true||n.items!==true))return o.if(r,()=>this.mergeEvaluated(e,j.Name)),true}};_r.KeywordCxt=Ei;function cy(t,e,r,n){let o=new Ei(t,r,e);"code"in r?r.code(o,n):o.$data&&r.validate?(0, Bo.funcKeywordCode)(o,r):"macro"in r?(0, Bo.macroKeywordCode)(o,r):(r.compile||r.validate)&&(0, Bo.funcKeywordCode)(o,r);}var tz=/^\/(?:[^~]|~0|~1)*$/,rz=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function uy(t,{dataLevel:e,dataNames:r,dataPathArr:n}){let o,s;if(t==="")return Z.default.rootData;if(t[0]==="/"){if(!tz.test(t))throw new Error(`Invalid JSON-pointer: ${t}`);o=t,s=Z.default.rootData;}else {let u=rz.exec(t);if(!u)throw new Error(`Invalid JSON-pointer: ${t}`);let l=+u[1];if(o=u[2],o==="#"){if(l>=e)throw new Error(c("property/index",l));return n[e-l]}if(l>e)throw new Error(c("data",l));if(s=r[e-l],!o)return s}let i=s,a=o.split("/");for(let u of a)u&&(s=(0, j._)`${s}${(0, j.getProperty)((0, er.unescapeJsonPointer)(u))}`,i=(0, j._)`${i} && ${s}`);return i;function c(u,l){return `Cannot access ${u} ${l} levels up, current level is ${e}`}}_r.getData=uy;});var Ci=T(ul=>{Object.defineProperty(ul,"__esModule",{value:true});var cl=class extends Error{constructor(e){super("validation failed"),this.errors=e,this.ajv=this.validation=true;}};ul.default=cl;});var Ho=T(pl=>{Object.defineProperty(pl,"__esModule",{value:true});var ll=Jo(),dl=class extends Error{constructor(e,r,n,o){super(o||`can't resolve reference ${n} from id ${r}`),this.missingRef=(0, ll.resolveUrl)(e,r,n),this.missingSchema=(0, ll.normalizeId)((0, ll.getFullPath)(e,this.missingRef));}};pl.default=dl;});var Ri=T(dt=>{Object.defineProperty(dt,"__esModule",{value:true});dt.resolveSchema=dt.getCompilingSchema=dt.resolveRef=dt.compileSchema=dt.SchemaEnv=void 0;var wt=U(),nz=Ci(),Kr=Xt(),xt=Jo(),ly=K(),oz=Go(),An=class{constructor(e){var r;this.refs={},this.dynamicAnchors={};let n;typeof e.schema=="object"&&(n=e.schema),this.schema=e.schema,this.schemaId=e.schemaId,this.root=e.root||this,this.baseId=(r=e.baseId)!==null&&r!==void 0?r:(0, xt.normalizeId)(n?.[e.schemaId||"$id"]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=n?.$async,this.refs={};}};dt.SchemaEnv=An;function ml(t){let e=dy.call(this,t);if(e)return e;let r=(0, xt.getFullPath)(this.opts.uriResolver,t.root.baseId),{es5:n,lines:o}=this.opts.code,{ownProperties:s}=this.opts,i=new wt.CodeGen(this.scope,{es5:n,lines:o,ownProperties:s}),a;t.$async&&(a=i.scopeValue("Error",{ref:nz.default,code:(0, wt._)`require("ajv/dist/runtime/validation_error").default`}));let c=i.scopeName("validate");t.validateName=c;let u={gen:i,allErrors:this.opts.allErrors,data:Kr.default.data,parentData:Kr.default.parentData,parentDataProperty:Kr.default.parentDataProperty,dataNames:[Kr.default.data],dataPathArr:[wt.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:i.scopeValue("schema",this.opts.code.source===true?{ref:t.schema,code:(0, wt.stringify)(t.schema)}:{ref:t.schema}),validateName:c,ValidationError:a,schema:t.schema,schemaEnv:t,rootId:r,baseId:t.baseId||r,schemaPath:wt.nil,errSchemaPath:t.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0, wt._)`""`,opts:this.opts,self:this},l;try{this._compilations.add(t),(0,oz.validateFunctionCode)(u),i.optimize(this.opts.code.optimize);let d=i.toString();l=`${i.scopeRefs(Kr.default.scope)}return ${d}`,this.opts.code.process&&(l=this.opts.code.process(l,t));let f=new Function(`${Kr.default.self}`,`${Kr.default.scope}`,l)(this,this.scope.get());if(this.scope.value(c,{ref:f}),f.errors=null,f.schema=t.schema,f.schemaEnv=t,t.$async&&(f.$async=!0),this.opts.code.source===!0&&(f.source={validateName:c,validateCode:d,scopeValues:i._values}),this.opts.unevaluated){let{props:h,items:_}=u;f.evaluated={props:h instanceof wt.Name?void 0:h,items:_ instanceof wt.Name?void 0:_,dynamicProps:h instanceof wt.Name,dynamicItems:_ instanceof wt.Name},f.source&&(f.source.evaluated=(0,wt.stringify)(f.evaluated));}return t.validate=f,t}catch(d){throw delete t.validate,delete t.validateName,l&&this.logger.error("Error compiling schema, function code:",l),d}finally{this._compilations.delete(t);}}dt.compileSchema=ml;function sz(t,e,r){var n;r=(0, xt.resolveUrl)(this.opts.uriResolver,e,r);let o=t.refs[r];if(o)return o;let s=cz.call(this,t,r);if(s===void 0){let i=(n=t.localRefs)===null||n===void 0?void 0:n[r],{schemaId:a}=this.opts;i&&(s=new An({schema:i,schemaId:a,root:t,baseId:e}));}if(s!==void 0)return t.refs[r]=iz.call(this,s)}dt.resolveRef=sz;function iz(t){return (0, xt.inlineRef)(t.schema,this.opts.inlineRefs)?t.schema:t.validate?t:ml.call(this,t)}function dy(t){for(let e of this._compilations)if(az(e,t))return e}dt.getCompilingSchema=dy;function az(t,e){return t.schema===e.schema&&t.root===e.root&&t.baseId===e.baseId}function cz(t,e){let r;for(;typeof(r=this.refs[e])=="string";)e=r;return r||this.schemas[e]||ji.call(this,t,e)}function ji(t,e){let r=this.opts.uriResolver.parse(e),n=(0, xt._getFullPath)(this.opts.uriResolver,r),o=(0, xt.getFullPath)(this.opts.uriResolver,t.baseId,void 0);if(Object.keys(t.schema).length>0&&n===o)return fl.call(this,r,t);let s=(0, xt.normalizeId)(n),i=this.refs[s]||this.schemas[s];if(typeof i=="string"){let a=ji.call(this,t,i);return typeof a?.schema!="object"?void 0:fl.call(this,r,a)}if(typeof i?.schema=="object"){if(i.validate||ml.call(this,i),s===(0, xt.normalizeId)(e)){let{schema:a}=i,{schemaId:c}=this.opts,u=a[c];return u&&(o=(0, xt.resolveUrl)(this.opts.uriResolver,o,u)),new An({schema:a,schemaId:c,root:t,baseId:o})}return fl.call(this,r,i)}}dt.resolveSchema=ji;var uz=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function fl(t,{baseId:e,schema:r,root:n}){var o;if(((o=t.fragment)===null||o===void 0?void 0:o[0])!=="/")return;for(let a of t.fragment.slice(1).split("/")){if(typeof r=="boolean")return;let c=r[(0, ly.unescapeFragment)(a)];if(c===void 0)return;r=c;let u=typeof r=="object"&&r[this.opts.schemaId];!uz.has(a)&&u&&(e=(0, xt.resolveUrl)(this.opts.uriResolver,e,u));}let s;if(typeof r!="boolean"&&r.$ref&&!(0, ly.schemaHasRulesButRef)(r,this.RULES)){let a=(0, xt.resolveUrl)(this.opts.uriResolver,e,r.$ref);s=ji.call(this,n,a);}let{schemaId:i}=this.opts;if(s=s||new An({schema:r,schemaId:i,root:n,baseId:e}),s.schema!==s.root.schema)return s}});var py=T((ZD,lz)=>{lz.exports={$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:false};});var gl=T((MD,gy)=>{var dz=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),my=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);function hl(t){let e="",r=0,n=0;for(n=0;n<t.length;n++)if(r=t[n].charCodeAt(0),r!==48){if(!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return "";e+=t[n];break}for(n+=1;n<t.length;n++){if(r=t[n].charCodeAt(0),!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return "";e+=t[n];}return e}var pz=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function fy(t){return t.length=0,true}function fz(t,e,r){if(t.length){let n=hl(t);if(n!=="")e.push(n);else return r.error=true,false;t.length=0;}return true}function mz(t){let e=0,r={error:false,address:"",zone:""},n=[],o=[],s=false,i=false,a=fz;for(let c=0;c<t.length;c++){let u=t[c];if(!(u==="["||u==="]"))if(u===":"){if(s===true&&(i=true),!a(o,n,r))break;if(++e>7){r.error=true;break}c>0&&t[c-1]===":"&&(s=true),n.push(":");continue}else if(u==="%"){if(!a(o,n,r))break;a=fy;}else {o.push(u);continue}}return o.length&&(a===fy?r.zone=o.join(""):i?n.push(o.join("")):n.push(hl(o))),r.address=n.join(""),r}function hy(t){if(hz(t,":")<2)return {host:t,isIPV6:false};let e=mz(t);if(e.error)return {host:t,isIPV6:false};{let r=e.address,n=e.address;return e.zone&&(r+="%"+e.zone,n+="%25"+e.zone),{host:r,isIPV6:true,escapedHost:n}}}function hz(t,e){let r=0;for(let n=0;n<t.length;n++)t[n]===e&&r++;return r}function gz(t){let e=t,r=[],n=-1,o=0;for(;o=e.length;){if(o===1){if(e===".")break;if(e==="/"){r.push("/");break}else {r.push(e);break}}else if(o===2){if(e[0]==="."){if(e[1]===".")break;if(e[1]==="/"){e=e.slice(2);continue}}else if(e[0]==="/"&&(e[1]==="."||e[1]==="/")){r.push("/");break}}else if(o===3&&e==="/.."){r.length!==0&&r.pop(),r.push("/");break}if(e[0]==="."){if(e[1]==="."){if(e[2]==="/"){e=e.slice(3);continue}}else if(e[1]==="/"){e=e.slice(2);continue}}else if(e[0]==="/"&&e[1]==="."){if(e[2]==="/"){e=e.slice(2);continue}else if(e[2]==="."&&e[3]==="/"){e=e.slice(3),r.length!==0&&r.pop();continue}}if((n=e.indexOf("/",1))===-1){r.push(e);break}else r.push(e.slice(0,n)),e=e.slice(n);}return r.join("")}function yz(t,e){let r=e!==true?escape:unescape;return t.scheme!==void 0&&(t.scheme=r(t.scheme)),t.userinfo!==void 0&&(t.userinfo=r(t.userinfo)),t.host!==void 0&&(t.host=r(t.host)),t.path!==void 0&&(t.path=r(t.path)),t.query!==void 0&&(t.query=r(t.query)),t.fragment!==void 0&&(t.fragment=r(t.fragment)),t}function _z(t){let e=[];if(t.userinfo!==void 0&&(e.push(t.userinfo),e.push("@")),t.host!==void 0){let r=unescape(t.host);if(!my(r)){let n=hy(r);n.isIPV6===true?r=`[${n.escapedHost}]`:r=t.host;}e.push(r);}return (typeof t.port=="number"||typeof t.port=="string")&&(e.push(":"),e.push(String(t.port))),e.length?e.join(""):void 0}gy.exports={nonSimpleDomain:pz,recomposeAuthority:_z,normalizeComponentEncoding:yz,removeDotSegments:gz,isIPv4:my,isUUID:dz,normalizeIPv6:hy,stringArrayToHexStripped:hl};});var wy=T((DD,ky)=>{var{isUUID:vz}=gl(),kz=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,wz=["http","https","ws","wss","urn","urn:uuid"];function xz(t){return wz.indexOf(t)!==-1}function yl(t){return t.secure===true?true:t.secure===false?false:t.scheme?t.scheme.length===3&&(t.scheme[0]==="w"||t.scheme[0]==="W")&&(t.scheme[1]==="s"||t.scheme[1]==="S")&&(t.scheme[2]==="s"||t.scheme[2]==="S"):false}function yy(t){return t.host||(t.error=t.error||"HTTP URIs must have a host."),t}function _y(t){let e=String(t.scheme).toLowerCase()==="https";return (t.port===(e?443:80)||t.port==="")&&(t.port=void 0),t.path||(t.path="/"),t}function bz(t){return t.secure=yl(t),t.resourceName=(t.path||"/")+(t.query?"?"+t.query:""),t.path=void 0,t.query=void 0,t}function $z(t){if((t.port===(yl(t)?443:80)||t.port==="")&&(t.port=void 0),typeof t.secure=="boolean"&&(t.scheme=t.secure?"wss":"ws",t.secure=void 0),t.resourceName){let[e,r]=t.resourceName.split("?");t.path=e&&e!=="/"?e:void 0,t.query=r,t.resourceName=void 0;}return t.fragment=void 0,t}function Sz(t,e){if(!t.path)return t.error="URN can not be parsed",t;let r=t.path.match(kz);if(r){let n=e.scheme||t.scheme||"urn";t.nid=r[1].toLowerCase(),t.nss=r[2];let o=`${n}:${e.nid||t.nid}`,s=_l(o);t.path=void 0,s&&(t=s.parse(t,e));}else t.error=t.error||"URN can not be parsed.";return t}function Tz(t,e){if(t.nid===void 0)throw new Error("URN without nid cannot be serialized");let r=e.scheme||t.scheme||"urn",n=t.nid.toLowerCase(),o=`${r}:${e.nid||n}`,s=_l(o);s&&(t=s.serialize(t,e));let i=t,a=t.nss;return i.path=`${n||e.nid}:${a}`,e.skipEscape=true,i}function zz(t,e){let r=t;return r.uuid=r.nss,r.nss=void 0,!e.tolerant&&(!r.uuid||!vz(r.uuid))&&(r.error=r.error||"UUID is not valid."),r}function Pz(t){let e=t;return e.nss=(t.uuid||"").toLowerCase(),e}var vy={scheme:"http",domainHost:true,parse:yy,serialize:_y},Ez={scheme:"https",domainHost:vy.domainHost,parse:yy,serialize:_y},Ii={scheme:"ws",domainHost:true,parse:bz,serialize:$z},Cz={scheme:"wss",domainHost:Ii.domainHost,parse:Ii.parse,serialize:Ii.serialize},jz={scheme:"urn",parse:Sz,serialize:Tz,skipNormalize:true},Rz={scheme:"urn:uuid",parse:zz,serialize:Pz,skipNormalize:true},Oi={http:vy,https:Ez,ws:Ii,wss:Cz,urn:jz,"urn:uuid":Rz};Object.setPrototypeOf(Oi,null);function _l(t){return t&&(Oi[t]||Oi[t.toLowerCase()])||void 0}ky.exports={wsIsSecure:yl,SCHEMES:Oi,isValidSchemeName:xz,getSchemeHandler:_l};});var $y=T((qD,Ai)=>{var{normalizeIPv6:Iz,removeDotSegments:Wo,recomposeAuthority:Oz,normalizeComponentEncoding:Ni,isIPv4:Nz,nonSimpleDomain:Az}=gl(),{SCHEMES:Zz,getSchemeHandler:xy}=wy();function Mz(t,e){return typeof t=="string"?t=Zt(tr(t,e),e):typeof t=="object"&&(t=tr(Zt(t,e),e)),t}function Dz(t,e,r){let n=r?Object.assign({scheme:"null"},r):{scheme:"null"},o=by(tr(t,n),tr(e,n),n,true);return n.skipEscape=true,Zt(o,n)}function by(t,e,r,n){let o={};return n||(t=tr(Zt(t,r),r),e=tr(Zt(e,r),r)),r=r||{},!r.tolerant&&e.scheme?(o.scheme=e.scheme,o.userinfo=e.userinfo,o.host=e.host,o.port=e.port,o.path=Wo(e.path||""),o.query=e.query):(e.userinfo!==void 0||e.host!==void 0||e.port!==void 0?(o.userinfo=e.userinfo,o.host=e.host,o.port=e.port,o.path=Wo(e.path||""),o.query=e.query):(e.path?(e.path[0]==="/"?o.path=Wo(e.path):((t.userinfo!==void 0||t.host!==void 0||t.port!==void 0)&&!t.path?o.path="/"+e.path:t.path?o.path=t.path.slice(0,t.path.lastIndexOf("/")+1)+e.path:o.path=e.path,o.path=Wo(o.path)),o.query=e.query):(o.path=t.path,e.query!==void 0?o.query=e.query:o.query=t.query),o.userinfo=t.userinfo,o.host=t.host,o.port=t.port),o.scheme=t.scheme),o.fragment=e.fragment,o}function qz(t,e,r){return typeof t=="string"?(t=unescape(t),t=Zt(Ni(tr(t,r),true),{...r,skipEscape:true})):typeof t=="object"&&(t=Zt(Ni(t,true),{...r,skipEscape:true})),typeof e=="string"?(e=unescape(e),e=Zt(Ni(tr(e,r),true),{...r,skipEscape:true})):typeof e=="object"&&(e=Zt(Ni(e,true),{...r,skipEscape:true})),t.toLowerCase()===e.toLowerCase()}function Zt(t,e){let r={host:t.host,scheme:t.scheme,userinfo:t.userinfo,port:t.port,path:t.path,query:t.query,nid:t.nid,nss:t.nss,uuid:t.uuid,fragment:t.fragment,reference:t.reference,resourceName:t.resourceName,secure:t.secure,error:""},n=Object.assign({},e),o=[],s=xy(n.scheme||r.scheme);s&&s.serialize&&s.serialize(r,n),r.path!==void 0&&(n.skipEscape?r.path=unescape(r.path):(r.path=escape(r.path),r.scheme!==void 0&&(r.path=r.path.split("%3A").join(":")))),n.reference!=="suffix"&&r.scheme&&o.push(r.scheme,":");let i=Oz(r);if(i!==void 0&&(n.reference!=="suffix"&&o.push("//"),o.push(i),r.path&&r.path[0]!=="/"&&o.push("/")),r.path!==void 0){let a=r.path;!n.absolutePath&&(!s||!s.absolutePath)&&(a=Wo(a)),i===void 0&&a[0]==="/"&&a[1]==="/"&&(a="/%2F"+a.slice(2)),o.push(a);}return r.query!==void 0&&o.push("?",r.query),r.fragment!==void 0&&o.push("#",r.fragment),o.join("")}var Lz=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function tr(t,e){let r=Object.assign({},e),n={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},o=false;r.reference==="suffix"&&(r.scheme?t=r.scheme+":"+t:t="//"+t);let s=t.match(Lz);if(s){if(n.scheme=s[1],n.userinfo=s[3],n.host=s[4],n.port=parseInt(s[5],10),n.path=s[6]||"",n.query=s[7],n.fragment=s[8],isNaN(n.port)&&(n.port=s[5]),n.host)if(Nz(n.host)===false){let c=Iz(n.host);n.host=c.host.toLowerCase(),o=c.isIPV6;}else o=true;n.scheme===void 0&&n.userinfo===void 0&&n.host===void 0&&n.port===void 0&&n.query===void 0&&!n.path?n.reference="same-document":n.scheme===void 0?n.reference="relative":n.fragment===void 0?n.reference="absolute":n.reference="uri",r.reference&&r.reference!=="suffix"&&r.reference!==n.reference&&(n.error=n.error||"URI is not a "+r.reference+" reference.");let i=xy(r.scheme||n.scheme);if(!r.unicodeSupport&&(!i||!i.unicodeSupport)&&n.host&&(r.domainHost||i&&i.domainHost)&&o===false&&Az(n.host))try{n.host=URL.domainToASCII(n.host.toLowerCase());}catch(a){n.error=n.error||"Host's domain name can not be converted to ASCII: "+a;}(!i||i&&!i.skipNormalize)&&(t.indexOf("%")!==-1&&(n.scheme!==void 0&&(n.scheme=unescape(n.scheme)),n.host!==void 0&&(n.host=unescape(n.host))),n.path&&(n.path=escape(unescape(n.path))),n.fragment&&(n.fragment=encodeURI(decodeURIComponent(n.fragment)))),i&&i.parse&&i.parse(n,r);}else n.error=n.error||"URI can not be parsed.";return n}var vl={SCHEMES:Zz,normalize:Mz,resolve:Dz,resolveComponent:by,equal:qz,serialize:Zt,parse:tr};Ai.exports=vl;Ai.exports.default=vl;Ai.exports.fastUri=vl;});var Ty=T(kl=>{Object.defineProperty(kl,"__esModule",{value:true});var Sy=$y();Sy.code='require("ajv/dist/runtime/uri").default';kl.default=Sy;});var Oy=T(Ee=>{Object.defineProperty(Ee,"__esModule",{value:true});Ee.CodeGen=Ee.Name=Ee.nil=Ee.stringify=Ee.str=Ee._=Ee.KeywordCxt=void 0;var Uz=Go();Object.defineProperty(Ee,"KeywordCxt",{enumerable:true,get:function(){return Uz.KeywordCxt}});var Zn=U();Object.defineProperty(Ee,"_",{enumerable:true,get:function(){return Zn._}});Object.defineProperty(Ee,"str",{enumerable:true,get:function(){return Zn.str}});Object.defineProperty(Ee,"stringify",{enumerable:true,get:function(){return Zn.stringify}});Object.defineProperty(Ee,"nil",{enumerable:true,get:function(){return Zn.nil}});Object.defineProperty(Ee,"Name",{enumerable:true,get:function(){return Zn.Name}});Object.defineProperty(Ee,"CodeGen",{enumerable:true,get:function(){return Zn.CodeGen}});var Fz=Ci(),jy=Ho(),Jz=Wu(),Ko=Ri(),Vz=U(),Yo=Jo(),Zi=Fo(),xl=K(),zy=py(),Bz=Ty(),Ry=(t,e)=>new RegExp(t,e);Ry.code="new RegExp";var Gz=["removeAdditional","useDefaults","coerceTypes"],Hz=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),Wz={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."},Kz={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},Py=200;function Yz(t){var e,r,n,o,s,i,a,c,u,l,d,p,f,h,_,w,x,$,b,R,I,be,$e,Tt,Bn;let wr=t.strict,ua=(e=t.code)===null||e===void 0?void 0:e.optimize,$d=ua===true||ua===void 0?1:ua||0,Sd=(n=(r=t.code)===null||r===void 0?void 0:r.regExp)!==null&&n!==void 0?n:Ry,sk=(o=t.uriResolver)!==null&&o!==void 0?o:Bz.default;return {strictSchema:(i=(s=t.strictSchema)!==null&&s!==void 0?s:wr)!==null&&i!==void 0?i:true,strictNumbers:(c=(a=t.strictNumbers)!==null&&a!==void 0?a:wr)!==null&&c!==void 0?c:true,strictTypes:(l=(u=t.strictTypes)!==null&&u!==void 0?u:wr)!==null&&l!==void 0?l:"log",strictTuples:(p=(d=t.strictTuples)!==null&&d!==void 0?d:wr)!==null&&p!==void 0?p:"log",strictRequired:(h=(f=t.strictRequired)!==null&&f!==void 0?f:wr)!==null&&h!==void 0?h:false,code:t.code?{...t.code,optimize:$d,regExp:Sd}:{optimize:$d,regExp:Sd},loopRequired:(_=t.loopRequired)!==null&&_!==void 0?_:Py,loopEnum:(w=t.loopEnum)!==null&&w!==void 0?w:Py,meta:(x=t.meta)!==null&&x!==void 0?x:true,messages:($=t.messages)!==null&&$!==void 0?$:true,inlineRefs:(b=t.inlineRefs)!==null&&b!==void 0?b:true,schemaId:(R=t.schemaId)!==null&&R!==void 0?R:"$id",addUsedSchema:(I=t.addUsedSchema)!==null&&I!==void 0?I:true,validateSchema:(be=t.validateSchema)!==null&&be!==void 0?be:true,validateFormats:($e=t.validateFormats)!==null&&$e!==void 0?$e:true,unicodeRegExp:(Tt=t.unicodeRegExp)!==null&&Tt!==void 0?Tt:true,int32range:(Bn=t.int32range)!==null&&Bn!==void 0?Bn:true,uriResolver:sk}}var Qo=class{constructor(e={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,e=this.opts={...e,...Yz(e)};let{es5:r,lines:n}=this.opts.code;this.scope=new Vz.ValueScope({scope:{},prefixes:Hz,es5:r,lines:n}),this.logger=nP(e.logger);let o=e.validateFormats;e.validateFormats=false,this.RULES=(0, Jz.getRules)(),Ey.call(this,Wz,e,"NOT SUPPORTED"),Ey.call(this,Kz,e,"DEPRECATED","warn"),this._metaOpts=tP.call(this),e.formats&&Xz.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords&&eP.call(this,e.keywords),typeof e.meta=="object"&&this.addMetaSchema(e.meta),Qz.call(this),e.validateFormats=o;}_addVocabularies(){this.addKeyword("$async");}_addDefaultMetaSchema(){let{$data:e,meta:r,schemaId:n}=this.opts,o=zy;n==="id"&&(o={...zy},o.id=o.$id,delete o.$id),r&&e&&this.addMetaSchema(o,o[n],false);}defaultMeta(){let{meta:e,schemaId:r}=this.opts;return this.opts.defaultMeta=typeof e=="object"?e[r]||e:void 0}validate(e,r){let n;if(typeof e=="string"){if(n=this.getSchema(e),!n)throw new Error(`no schema with key or ref "${e}"`)}else n=this.compile(e);let o=n(r);return "$async"in n||(this.errors=n.errors),o}compile(e,r){let n=this._addSchema(e,r);return n.validate||this._compileSchemaEnv(n)}compileAsync(e,r){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");let{loadSchema:n}=this.opts;return o.call(this,e,r);async function o(l,d){await s.call(this,l.$schema);let p=this._addSchema(l,d);return p.validate||i.call(this,p)}async function s(l){l&&!this.getSchema(l)&&await o.call(this,{$ref:l},true);}async function i(l){try{return this._compileSchemaEnv(l)}catch(d){if(!(d instanceof jy.default))throw d;return a.call(this,d),await c.call(this,d.missingSchema),i.call(this,l)}}function a({missingSchema:l,missingRef:d}){if(this.refs[l])throw new Error(`AnySchema ${l} is loaded but ${d} cannot be resolved`)}async function c(l){let d=await u.call(this,l);this.refs[l]||await s.call(this,d.$schema),this.refs[l]||this.addSchema(d,l,r);}async function u(l){let d=this._loading[l];if(d)return d;try{return await(this._loading[l]=n(l))}finally{delete this._loading[l];}}}addSchema(e,r,n,o=this.opts.validateSchema){if(Array.isArray(e)){for(let i of e)this.addSchema(i,void 0,n,o);return this}let s;if(typeof e=="object"){let{schemaId:i}=this.opts;if(s=e[i],s!==void 0&&typeof s!="string")throw new Error(`schema ${i} must be string`)}return r=(0, Yo.normalizeId)(r||s),this._checkUnique(r),this.schemas[r]=this._addSchema(e,n,r,o,true),this}addMetaSchema(e,r,n=this.opts.validateSchema){return this.addSchema(e,r,true,n),this}validateSchema(e,r){if(typeof e=="boolean")return true;let n;if(n=e.$schema,n!==void 0&&typeof n!="string")throw new Error("$schema must be a string");if(n=n||this.opts.defaultMeta||this.defaultMeta(),!n)return this.logger.warn("meta-schema not available"),this.errors=null,true;let o=this.validate(n,e);if(!o&&r){let s="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(s);else throw new Error(s)}return o}getSchema(e){let r;for(;typeof(r=Cy.call(this,e))=="string";)e=r;if(r===void 0){let{schemaId:n}=this.opts,o=new Ko.SchemaEnv({schema:{},schemaId:n});if(r=Ko.resolveSchema.call(this,o,e),!r)return;this.refs[e]=r;}return r.validate||this._compileSchemaEnv(r)}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":{let r=Cy.call(this,e);return typeof r=="object"&&this._cache.delete(r.schema),delete this.schemas[e],delete this.refs[e],this}case "object":{let r=e;this._cache.delete(r);let n=e[this.opts.schemaId];return n&&(n=(0, Yo.normalizeId)(n),delete this.schemas[n],delete this.refs[n]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(e){for(let r of e)this.addKeyword(r);return this}addKeyword(e,r){let n;if(typeof e=="string")n=e,typeof r=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),r.keyword=n);else if(typeof e=="object"&&r===void 0){if(r=e,n=r.keyword,Array.isArray(n)&&!n.length)throw new Error("addKeywords: keyword must be string or non-empty array")}else throw new Error("invalid addKeywords parameters");if(sP.call(this,n,r),!r)return (0, xl.eachItem)(n,s=>wl.call(this,s)),this;aP.call(this,r);let o={...r,type:(0, Zi.getJSONTypes)(r.type),schemaType:(0, Zi.getJSONTypes)(r.schemaType)};return (0, xl.eachItem)(n,o.type.length===0?s=>wl.call(this,s,o):s=>o.type.forEach(i=>wl.call(this,s,o,i))),this}getKeyword(e){let r=this.RULES.all[e];return typeof r=="object"?r.definition:!!r}removeKeyword(e){let{RULES:r}=this;delete r.keywords[e],delete r.all[e];for(let n of r.rules){let o=n.rules.findIndex(s=>s.keyword===e);o>=0&&n.rules.splice(o,1);}return this}addFormat(e,r){return typeof r=="string"&&(r=new RegExp(r)),this.formats[e]=r,this}errorsText(e=this.errors,{separator:r=", ",dataVar:n="data"}={}){return !e||e.length===0?"No errors":e.map(o=>`${n}${o.instancePath} ${o.message}`).reduce((o,s)=>o+r+s)}$dataMetaSchema(e,r){let n=this.RULES.all;e=JSON.parse(JSON.stringify(e));for(let o of r){let s=o.split("/").slice(1),i=e;for(let a of s)i=i[a];for(let a in n){let c=n[a];if(typeof c!="object")continue;let{$data:u}=c.definition,l=i[a];u&&l&&(i[a]=Iy(l));}}return e}_removeAllSchemas(e,r){for(let n in e){let o=e[n];(!r||r.test(n))&&(typeof o=="string"?delete e[n]:o&&!o.meta&&(this._cache.delete(o.schema),delete e[n]));}}_addSchema(e,r,n,o=this.opts.validateSchema,s=this.opts.addUsedSchema){let i,{schemaId:a}=this.opts;if(typeof e=="object")i=e[a];else {if(this.opts.jtd)throw new Error("schema must be object");if(typeof e!="boolean")throw new Error("schema must be object or boolean")}let c=this._cache.get(e);if(c!==void 0)return c;n=(0, Yo.normalizeId)(i||n);let u=Yo.getSchemaRefs.call(this,e,n);return c=new Ko.SchemaEnv({schema:e,schemaId:a,meta:r,baseId:n,localRefs:u}),this._cache.set(c.schema,c),s&&!n.startsWith("#")&&(n&&this._checkUnique(n),this.refs[n]=c),o&&this.validateSchema(e,true),c}_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):Ko.compileSchema.call(this,e),!e.validate)throw new Error("ajv implementation error");return e.validate}_compileMetaSchema(e){let r=this.opts;this.opts=this._metaOpts;try{Ko.compileSchema.call(this,e);}finally{this.opts=r;}}};Qo.ValidationError=Fz.default;Qo.MissingRefError=jy.default;Ee.default=Qo;function Ey(t,e,r,n="error"){for(let o in t){let s=o;s in e&&this.logger[n](`${r}: option ${o}. ${t[s]}`);}}function Cy(t){return t=(0, Yo.normalizeId)(t),this.schemas[t]||this.refs[t]}function Qz(){let t=this.opts.schemas;if(t)if(Array.isArray(t))this.addSchema(t);else for(let e in t)this.addSchema(t[e],e);}function Xz(){for(let t in this.opts.formats){let e=this.opts.formats[t];e&&this.addFormat(t,e);}}function eP(t){if(Array.isArray(t)){this.addVocabulary(t);return}this.logger.warn("keywords option as map is deprecated, pass array");for(let e in t){let r=t[e];r.keyword||(r.keyword=e),this.addKeyword(r);}}function tP(){let t={...this.opts};for(let e of Gz)delete t[e];return t}var rP={log(){},warn(){},error(){}};function nP(t){if(t===false)return rP;if(t===void 0)return console;if(t.log&&t.warn&&t.error)return t;throw new Error("logger must implement log, warn and error methods")}var oP=/^[a-z_$][a-z0-9_$:-]*$/i;function sP(t,e){let{RULES:r}=this;if((0, xl.eachItem)(t,n=>{if(r.keywords[n])throw new Error(`Keyword ${n} is already defined`);if(!oP.test(n))throw new Error(`Keyword ${n} has invalid name`)}),!!e&&e.$data&&!("code"in e||"validate"in e))throw new Error('$data keyword must have "code" or "validate" function')}function wl(t,e,r){var n;let o=e?.post;if(r&&o)throw new Error('keyword with "post" flag cannot have "type"');let{RULES:s}=this,i=o?s.post:s.rules.find(({type:c})=>c===r);if(i||(i={type:r,rules:[]},s.rules.push(i)),s.keywords[t]=true,!e)return;let a={keyword:t,definition:{...e,type:(0, Zi.getJSONTypes)(e.type),schemaType:(0, Zi.getJSONTypes)(e.schemaType)}};e.before?iP.call(this,i,a,e.before):i.rules.push(a),s.all[t]=a,(n=e.implements)===null||n===void 0||n.forEach(c=>this.addKeyword(c));}function iP(t,e,r){let n=t.rules.findIndex(o=>o.keyword===r);n>=0?t.rules.splice(n,0,e):(t.rules.push(e),this.logger.warn(`rule ${r} is not defined`));}function aP(t){let{metaSchema:e}=t;e!==void 0&&(t.$data&&this.opts.$data&&(e=Iy(e)),t.validateSchema=this.compile(e,true));}var cP={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function Iy(t){return {anyOf:[t,cP]}}});var Ny=T(bl=>{Object.defineProperty(bl,"__esModule",{value:true});var uP={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};bl.default=uP;});var Dy=T(Yr=>{Object.defineProperty(Yr,"__esModule",{value:true});Yr.callRef=Yr.getValidate=void 0;var lP=Ho(),Ay=lt(),Ye=U(),Mn=Xt(),Zy=Ri(),Mi=K(),dP={keyword:"$ref",schemaType:"string",code(t){let{gen:e,schema:r,it:n}=t,{baseId:o,schemaEnv:s,validateName:i,opts:a,self:c}=n,{root:u}=s;if((r==="#"||r==="#/")&&o===u.baseId)return d();let l=Zy.resolveRef.call(c,u,o,r);if(l===void 0)throw new lP.default(n.opts.uriResolver,o,r);if(l instanceof Zy.SchemaEnv)return p(l);return f(l);function d(){if(s===u)return Di(t,i,s,s.$async);let h=e.scopeValue("root",{ref:u});return Di(t,(0, Ye._)`${h}.validate`,u,u.$async)}function p(h){let _=My(t,h);Di(t,_,h,h.$async);}function f(h){let _=e.scopeValue("schema",a.code.source===true?{ref:h,code:(0, Ye.stringify)(h)}:{ref:h}),w=e.name("valid"),x=t.subschema({schema:h,dataTypes:[],schemaPath:Ye.nil,topSchemaRef:_,errSchemaPath:r},w);t.mergeEvaluated(x),t.ok(w);}}};function My(t,e){let{gen:r}=t;return e.validate?r.scopeValue("validate",{ref:e.validate}):(0, Ye._)`${r.scopeValue("wrapper",{ref:e})}.validate`}Yr.getValidate=My;function Di(t,e,r,n){let{gen:o,it:s}=t,{allErrors:i,schemaEnv:a,opts:c}=s,u=c.passContext?Mn.default.this:Ye.nil;n?l():d();function l(){if(!a.$async)throw new Error("async schema referenced by sync schema");let h=o.let("valid");o.try(()=>{o.code((0, Ye._)`await ${(0, Ay.callValidateCode)(t,e,u)}`),f(e),i||o.assign(h,true);},_=>{o.if((0, Ye._)`!(${_} instanceof ${s.ValidationError})`,()=>o.throw(_)),p(_),i||o.assign(h,false);}),t.ok(h);}function d(){t.result((0, Ay.callValidateCode)(t,e,u),()=>f(e),()=>p(e));}function p(h){let _=(0, Ye._)`${h}.errors`;o.assign(Mn.default.vErrors,(0, Ye._)`${Mn.default.vErrors} === null ? ${_} : ${Mn.default.vErrors}.concat(${_})`),o.assign(Mn.default.errors,(0, Ye._)`${Mn.default.vErrors}.length`);}function f(h){var _;if(!s.opts.unevaluated)return;let w=(_=r?.validate)===null||_===void 0?void 0:_.evaluated;if(s.props!==true)if(w&&!w.dynamicProps)w.props!==void 0&&(s.props=Mi.mergeEvaluated.props(o,w.props,s.props));else {let x=o.var("props",(0, Ye._)`${h}.evaluated.props`);s.props=Mi.mergeEvaluated.props(o,x,s.props,Ye.Name);}if(s.items!==true)if(w&&!w.dynamicItems)w.items!==void 0&&(s.items=Mi.mergeEvaluated.items(o,w.items,s.items));else {let x=o.var("items",(0, Ye._)`${h}.evaluated.items`);s.items=Mi.mergeEvaluated.items(o,x,s.items,Ye.Name);}}}Yr.callRef=Di;Yr.default=dP;});var qy=T($l=>{Object.defineProperty($l,"__esModule",{value:true});var pP=Ny(),fP=Dy(),mP=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",pP.default,fP.default];$l.default=mP;});var Ly=T(Sl=>{Object.defineProperty(Sl,"__esModule",{value:true});var qi=U(),vr=qi.operators,Li={maximum:{okStr:"<=",ok:vr.LTE,fail:vr.GT},minimum:{okStr:">=",ok:vr.GTE,fail:vr.LT},exclusiveMaximum:{okStr:"<",ok:vr.LT,fail:vr.GTE},exclusiveMinimum:{okStr:">",ok:vr.GT,fail:vr.LTE}},hP={message:({keyword:t,schemaCode:e})=>(0, qi.str)`must be ${Li[t].okStr} ${e}`,params:({keyword:t,schemaCode:e})=>(0, qi._)`{comparison: ${Li[t].okStr}, limit: ${e}}`},gP={keyword:Object.keys(Li),type:"number",schemaType:"number",$data:true,error:hP,code(t){let{keyword:e,data:r,schemaCode:n}=t;t.fail$data((0, qi._)`${r} ${Li[e].fail} ${n} || isNaN(${r})`);}};Sl.default=gP;});var Uy=T(Tl=>{Object.defineProperty(Tl,"__esModule",{value:true});var Xo=U(),yP={message:({schemaCode:t})=>(0, Xo.str)`must be multiple of ${t}`,params:({schemaCode:t})=>(0, Xo._)`{multipleOf: ${t}}`},_P={keyword:"multipleOf",type:"number",schemaType:"number",$data:true,error:yP,code(t){let{gen:e,data:r,schemaCode:n,it:o}=t,s=o.opts.multipleOfPrecision,i=e.let("res"),a=s?(0, Xo._)`Math.abs(Math.round(${i}) - ${i}) > 1e-${s}`:(0, Xo._)`${i} !== parseInt(${i})`;t.fail$data((0, Xo._)`(${n} === 0 || (${i} = ${r}/${n}, ${a}))`);}};Tl.default=_P;});var Jy=T(zl=>{Object.defineProperty(zl,"__esModule",{value:true});function Fy(t){let e=t.length,r=0,n=0,o;for(;n<e;)r++,o=t.charCodeAt(n++),o>=55296&&o<=56319&&n<e&&(o=t.charCodeAt(n),(o&64512)===56320&&n++);return r}zl.default=Fy;Fy.code='require("ajv/dist/runtime/ucs2length").default';});var Vy=T(Pl=>{Object.defineProperty(Pl,"__esModule",{value:true});var Qr=U(),vP=K(),kP=Jy(),wP={message({keyword:t,schemaCode:e}){let r=t==="maxLength"?"more":"fewer";return (0, Qr.str)`must NOT have ${r} than ${e} characters`},params:({schemaCode:t})=>(0, Qr._)`{limit: ${t}}`},xP={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:true,error:wP,code(t){let{keyword:e,data:r,schemaCode:n,it:o}=t,s=e==="maxLength"?Qr.operators.GT:Qr.operators.LT,i=o.opts.unicode===false?(0, Qr._)`${r}.length`:(0, Qr._)`${(0, vP.useFunc)(t.gen,kP.default)}(${r})`;t.fail$data((0, Qr._)`${i} ${s} ${n}`);}};Pl.default=xP;});var By=T(El=>{Object.defineProperty(El,"__esModule",{value:true});var bP=lt(),$P=K(),Dn=U(),SP={message:({schemaCode:t})=>(0, Dn.str)`must match pattern "${t}"`,params:({schemaCode:t})=>(0, Dn._)`{pattern: ${t}}`},TP={keyword:"pattern",type:"string",schemaType:"string",$data:true,error:SP,code(t){let{gen:e,data:r,$data:n,schema:o,schemaCode:s,it:i}=t,a=i.opts.unicodeRegExp?"u":"";if(n){let{regExp:c}=i.opts.code,u=c.code==="new RegExp"?(0, Dn._)`new RegExp`:(0, $P.useFunc)(e,c),l=e.let("valid");e.try(()=>e.assign(l,(0, Dn._)`${u}(${s}, ${a}).test(${r})`),()=>e.assign(l,false)),t.fail$data((0, Dn._)`!${l}`);}else {let c=(0, bP.usePattern)(t,o);t.fail$data((0, Dn._)`!${c}.test(${r})`);}}};El.default=TP;});var Gy=T(Cl=>{Object.defineProperty(Cl,"__esModule",{value:true});var es=U(),zP={message({keyword:t,schemaCode:e}){let r=t==="maxProperties"?"more":"fewer";return (0, es.str)`must NOT have ${r} than ${e} properties`},params:({schemaCode:t})=>(0, es._)`{limit: ${t}}`},PP={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:true,error:zP,code(t){let{keyword:e,data:r,schemaCode:n}=t,o=e==="maxProperties"?es.operators.GT:es.operators.LT;t.fail$data((0, es._)`Object.keys(${r}).length ${o} ${n}`);}};Cl.default=PP;});var Hy=T(jl=>{Object.defineProperty(jl,"__esModule",{value:true});var ts=lt(),rs=U(),EP=K(),CP={message:({params:{missingProperty:t}})=>(0, rs.str)`must have required property '${t}'`,params:({params:{missingProperty:t}})=>(0, rs._)`{missingProperty: ${t}}`},jP={keyword:"required",type:"object",schemaType:"array",$data:true,error:CP,code(t){let{gen:e,schema:r,schemaCode:n,data:o,$data:s,it:i}=t,{opts:a}=i;if(!s&&r.length===0)return;let c=r.length>=a.loopRequired;if(i.allErrors?u():l(),a.strictRequired){let f=t.parentSchema.properties,{definedProperties:h}=t.it;for(let _ of r)if(f?.[_]===void 0&&!h.has(_)){let w=i.schemaEnv.baseId+i.errSchemaPath,x=`required property "${_}" is not defined at "${w}" (strictRequired)`;(0, EP.checkStrictMode)(i,x,i.opts.strictRequired);}}function u(){if(c||s)t.block$data(rs.nil,d);else for(let f of r)(0, ts.checkReportMissingProp)(t,f);}function l(){let f=e.let("missing");if(c||s){let h=e.let("valid",true);t.block$data(h,()=>p(f,h)),t.ok(h);}else e.if((0, ts.checkMissingProp)(t,r,f)),(0, ts.reportMissingProp)(t,f),e.else();}function d(){e.forOf("prop",n,f=>{t.setParams({missingProperty:f}),e.if((0, ts.noPropertyInData)(e,o,f,a.ownProperties),()=>t.error());});}function p(f,h){t.setParams({missingProperty:f}),e.forOf(f,n,()=>{e.assign(h,(0, ts.propertyInData)(e,o,f,a.ownProperties)),e.if((0, rs.not)(h),()=>{t.error(),e.break();});},rs.nil);}}};jl.default=jP;});var Wy=T(Rl=>{Object.defineProperty(Rl,"__esModule",{value:true});var ns=U(),RP={message({keyword:t,schemaCode:e}){let r=t==="maxItems"?"more":"fewer";return (0, ns.str)`must NOT have ${r} than ${e} items`},params:({schemaCode:t})=>(0, ns._)`{limit: ${t}}`},IP={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:true,error:RP,code(t){let{keyword:e,data:r,schemaCode:n}=t,o=e==="maxItems"?ns.operators.GT:ns.operators.LT;t.fail$data((0, ns._)`${r}.length ${o} ${n}`);}};Rl.default=IP;});var Ui=T(Il=>{Object.defineProperty(Il,"__esModule",{value:true});var Ky=nl();Ky.code='require("ajv/dist/runtime/equal").default';Il.default=Ky;});var Yy=T(Nl=>{Object.defineProperty(Nl,"__esModule",{value:true});var Ol=Fo(),Ce=U(),OP=K(),NP=Ui(),AP={message:({params:{i:t,j:e}})=>(0, Ce.str)`must NOT have duplicate items (items ## ${e} and ${t} are identical)`,params:({params:{i:t,j:e}})=>(0, Ce._)`{i: ${t}, j: ${e}}`},ZP={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:true,error:AP,code(t){let{gen:e,data:r,$data:n,schema:o,parentSchema:s,schemaCode:i,it:a}=t;if(!n&&!o)return;let c=e.let("valid"),u=s.items?(0, Ol.getSchemaTypes)(s.items):[];t.block$data(c,l,(0, Ce._)`${i} === false`),t.ok(c);function l(){let h=e.let("i",(0, Ce._)`${r}.length`),_=e.let("j");t.setParams({i:h,j:_}),e.assign(c,true),e.if((0, Ce._)`${h} > 1`,()=>(d()?p:f)(h,_));}function d(){return u.length>0&&!u.some(h=>h==="object"||h==="array")}function p(h,_){let w=e.name("item"),x=(0, Ol.checkDataTypes)(u,w,a.opts.strictNumbers,Ol.DataType.Wrong),$=e.const("indices",(0, Ce._)`{}`);e.for((0, Ce._)`;${h}--;`,()=>{e.let(w,(0, Ce._)`${r}[${h}]`),e.if(x,(0, Ce._)`continue`),u.length>1&&e.if((0, Ce._)`typeof ${w} == "string"`,(0, Ce._)`${w} += "_"`),e.if((0, Ce._)`typeof ${$}[${w}] == "number"`,()=>{e.assign(_,(0, Ce._)`${$}[${w}]`),t.error(),e.assign(c,false).break();}).code((0, Ce._)`${$}[${w}] = ${h}`);});}function f(h,_){let w=(0, OP.useFunc)(e,NP.default),x=e.name("outer");e.label(x).for((0, Ce._)`;${h}--;`,()=>e.for((0, Ce._)`${_} = ${h}; ${_}--;`,()=>e.if((0, Ce._)`${w}(${r}[${h}], ${r}[${_}])`,()=>{t.error(),e.assign(c,false).break(x);})));}}};Nl.default=ZP;});var Qy=T(Zl=>{Object.defineProperty(Zl,"__esModule",{value:true});var Al=U(),MP=K(),DP=Ui(),qP={message:"must be equal to constant",params:({schemaCode:t})=>(0, Al._)`{allowedValue: ${t}}`},LP={keyword:"const",$data:true,error:qP,code(t){let{gen:e,data:r,$data:n,schemaCode:o,schema:s}=t;n||s&&typeof s=="object"?t.fail$data((0, Al._)`!${(0, MP.useFunc)(e,DP.default)}(${r}, ${o})`):t.fail((0, Al._)`${s} !== ${r}`);}};Zl.default=LP;});var Xy=T(Ml=>{Object.defineProperty(Ml,"__esModule",{value:true});var os=U(),UP=K(),FP=Ui(),JP={message:"must be equal to one of the allowed values",params:({schemaCode:t})=>(0, os._)`{allowedValues: ${t}}`},VP={keyword:"enum",schemaType:"array",$data:true,error:JP,code(t){let{gen:e,data:r,$data:n,schema:o,schemaCode:s,it:i}=t;if(!n&&o.length===0)throw new Error("enum must have non-empty array");let a=o.length>=i.opts.loopEnum,c,u=()=>c??(c=(0, UP.useFunc)(e,FP.default)),l;if(a||n)l=e.let("valid"),t.block$data(l,d);else {if(!Array.isArray(o))throw new Error("ajv implementation error");let f=e.const("vSchema",s);l=(0, os.or)(...o.map((h,_)=>p(f,_)));}t.pass(l);function d(){e.assign(l,false),e.forOf("v",s,f=>e.if((0, os._)`${u()}(${r}, ${f})`,()=>e.assign(l,true).break()));}function p(f,h){let _=o[h];return typeof _=="object"&&_!==null?(0, os._)`${u()}(${r}, ${f}[${h}])`:(0, os._)`${r} === ${_}`}}};Ml.default=VP;});var e_=T(Dl=>{Object.defineProperty(Dl,"__esModule",{value:true});var BP=Ly(),GP=Uy(),HP=Vy(),WP=By(),KP=Gy(),YP=Hy(),QP=Wy(),XP=Yy(),eE=Qy(),tE=Xy(),rE=[BP.default,GP.default,HP.default,WP.default,KP.default,YP.default,QP.default,XP.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},eE.default,tE.default];Dl.default=rE;});var Ll=T(ss=>{Object.defineProperty(ss,"__esModule",{value:true});ss.validateAdditionalItems=void 0;var Xr=U(),ql=K(),nE={message:({params:{len:t}})=>(0, Xr.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0, Xr._)`{limit: ${t}}`},oE={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:nE,code(t){let{parentSchema:e,it:r}=t,{items:n}=e;if(!Array.isArray(n)){(0, ql.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}t_(t,n);}};function t_(t,e){let{gen:r,schema:n,data:o,keyword:s,it:i}=t;i.items=true;let a=r.const("len",(0, Xr._)`${o}.length`);if(n===false)t.setParams({len:e.length}),t.pass((0, Xr._)`${a} <= ${e.length}`);else if(typeof n=="object"&&!(0, ql.alwaysValidSchema)(i,n)){let u=r.var("valid",(0, Xr._)`${a} <= ${e.length}`);r.if((0, Xr.not)(u),()=>c(u)),t.ok(u);}function c(u){r.forRange("i",e.length,a,l=>{t.subschema({keyword:s,dataProp:l,dataPropType:ql.Type.Num},u),i.allErrors||r.if((0, Xr.not)(u),()=>r.break());});}}ss.validateAdditionalItems=t_;ss.default=oE;});var Ul=T(is=>{Object.defineProperty(is,"__esModule",{value:true});is.validateTuple=void 0;var r_=U(),Fi=K(),sE=lt(),iE={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(t){let{schema:e,it:r}=t;if(Array.isArray(e))return n_(t,"additionalItems",e);r.items=true,!(0, Fi.alwaysValidSchema)(r,e)&&t.ok((0, sE.validateArray)(t));}};function n_(t,e,r=t.schema){let{gen:n,parentSchema:o,data:s,keyword:i,it:a}=t;l(o),a.opts.unevaluated&&r.length&&a.items!==true&&(a.items=Fi.mergeEvaluated.items(n,r.length,a.items));let c=n.name("valid"),u=n.const("len",(0, r_._)`${s}.length`);r.forEach((d,p)=>{(0, Fi.alwaysValidSchema)(a,d)||(n.if((0, r_._)`${u} > ${p}`,()=>t.subschema({keyword:i,schemaProp:p,dataProp:p},c)),t.ok(c));});function l(d){let{opts:p,errSchemaPath:f}=a,h=r.length,_=h===d.minItems&&(h===d.maxItems||d[e]===false);if(p.strictTuples&&!_){let w=`"${i}" is ${h}-tuple, but minItems or maxItems/${e} are not specified or different at path "${f}"`;(0, Fi.checkStrictMode)(a,w,p.strictTuples);}}}is.validateTuple=n_;is.default=iE;});var o_=T(Fl=>{Object.defineProperty(Fl,"__esModule",{value:true});var aE=Ul(),cE={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:t=>(0, aE.validateTuple)(t,"items")};Fl.default=cE;});var i_=T(Jl=>{Object.defineProperty(Jl,"__esModule",{value:true});var s_=U(),uE=K(),lE=lt(),dE=Ll(),pE={message:({params:{len:t}})=>(0, s_.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0, s_._)`{limit: ${t}}`},fE={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:pE,code(t){let{schema:e,parentSchema:r,it:n}=t,{prefixItems:o}=r;n.items=true,!(0, uE.alwaysValidSchema)(n,e)&&(o?(0, dE.validateAdditionalItems)(t,o):t.ok((0, lE.validateArray)(t)));}};Jl.default=fE;});var a_=T(Vl=>{Object.defineProperty(Vl,"__esModule",{value:true});var pt=U(),Ji=K(),mE={message:({params:{min:t,max:e}})=>e===void 0?(0, pt.str)`must contain at least ${t} valid item(s)`:(0, pt.str)`must contain at least ${t} and no more than ${e} valid item(s)`,params:({params:{min:t,max:e}})=>e===void 0?(0, pt._)`{minContains: ${t}}`:(0, pt._)`{minContains: ${t}, maxContains: ${e}}`},hE={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:true,error:mE,code(t){let{gen:e,schema:r,parentSchema:n,data:o,it:s}=t,i,a,{minContains:c,maxContains:u}=n;s.opts.next?(i=c===void 0?1:c,a=u):i=1;let l=e.const("len",(0, pt._)`${o}.length`);if(t.setParams({min:i,max:a}),a===void 0&&i===0){(0, Ji.checkStrictMode)(s,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(a!==void 0&&i>a){(0, Ji.checkStrictMode)(s,'"minContains" > "maxContains" is always invalid'),t.fail();return}if((0, Ji.alwaysValidSchema)(s,r)){let _=(0, pt._)`${l} >= ${i}`;a!==void 0&&(_=(0, pt._)`${_} && ${l} <= ${a}`),t.pass(_);return}s.items=true;let d=e.name("valid");a===void 0&&i===1?f(d,()=>e.if(d,()=>e.break())):i===0?(e.let(d,true),a!==void 0&&e.if((0, pt._)`${o}.length > 0`,p)):(e.let(d,false),p()),t.result(d,()=>t.reset());function p(){let _=e.name("_valid"),w=e.let("count",0);f(_,()=>e.if(_,()=>h(w)));}function f(_,w){e.forRange("i",0,l,x=>{t.subschema({keyword:"contains",dataProp:x,dataPropType:Ji.Type.Num,compositeRule:true},_),w();});}function h(_){e.code((0, pt._)`${_}++`),a===void 0?e.if((0, pt._)`${_} >= ${i}`,()=>e.assign(d,true).break()):(e.if((0, pt._)`${_} > ${a}`,()=>e.assign(d,false).break()),i===1?e.assign(d,true):e.if((0, pt._)`${_} >= ${i}`,()=>e.assign(d,true)));}}};Vl.default=hE;});var l_=T(Mt=>{Object.defineProperty(Mt,"__esModule",{value:true});Mt.validateSchemaDeps=Mt.validatePropertyDeps=Mt.error=void 0;var Bl=U(),gE=K(),as=lt();Mt.error={message:({params:{property:t,depsCount:e,deps:r}})=>{let n=e===1?"property":"properties";return (0, Bl.str)`must have ${n} ${r} when property ${t} is present`},params:({params:{property:t,depsCount:e,deps:r,missingProperty:n}})=>(0, Bl._)`{property: ${t},
|
|
39
|
+
missingProperty: ${n},
|
|
40
|
+
depsCount: ${e},
|
|
41
|
+
deps: ${r}}`};var yE={keyword:"dependencies",type:"object",schemaType:"object",error:Mt.error,code(t){let[e,r]=_E(t);c_(t,e),u_(t,r);}};function _E({schema:t}){let e={},r={};for(let n in t){if(n==="__proto__")continue;let o=Array.isArray(t[n])?e:r;o[n]=t[n];}return [e,r]}function c_(t,e=t.schema){let{gen:r,data:n,it:o}=t;if(Object.keys(e).length===0)return;let s=r.let("missing");for(let i in e){let a=e[i];if(a.length===0)continue;let c=(0, as.propertyInData)(r,n,i,o.opts.ownProperties);t.setParams({property:i,depsCount:a.length,deps:a.join(", ")}),o.allErrors?r.if(c,()=>{for(let u of a)(0, as.checkReportMissingProp)(t,u);}):(r.if((0, Bl._)`${c} && (${(0, as.checkMissingProp)(t,a,s)})`),(0, as.reportMissingProp)(t,s),r.else());}}Mt.validatePropertyDeps=c_;function u_(t,e=t.schema){let{gen:r,data:n,keyword:o,it:s}=t,i=r.name("valid");for(let a in e)(0, gE.alwaysValidSchema)(s,e[a])||(r.if((0, as.propertyInData)(r,n,a,s.opts.ownProperties),()=>{let c=t.subschema({keyword:o,schemaProp:a},i);t.mergeValidEvaluated(c,i);},()=>r.var(i,true)),t.ok(i));}Mt.validateSchemaDeps=u_;Mt.default=yE;});var p_=T(Gl=>{Object.defineProperty(Gl,"__esModule",{value:true});var d_=U(),vE=K(),kE={message:"property name must be valid",params:({params:t})=>(0, d_._)`{propertyName: ${t.propertyName}}`},wE={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:kE,code(t){let{gen:e,schema:r,data:n,it:o}=t;if((0, vE.alwaysValidSchema)(o,r))return;let s=e.name("valid");e.forIn("key",n,i=>{t.setParams({propertyName:i}),t.subschema({keyword:"propertyNames",data:i,dataTypes:["string"],propertyName:i,compositeRule:true},s),e.if((0, d_.not)(s),()=>{t.error(true),o.allErrors||e.break();});}),t.ok(s);}};Gl.default=wE;});var Wl=T(Hl=>{Object.defineProperty(Hl,"__esModule",{value:true});var Vi=lt(),bt=U(),xE=Xt(),Bi=K(),bE={message:"must NOT have additional properties",params:({params:t})=>(0, bt._)`{additionalProperty: ${t.additionalProperty}}`},$E={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:true,trackErrors:true,error:bE,code(t){let{gen:e,schema:r,parentSchema:n,data:o,errsCount:s,it:i}=t;if(!s)throw new Error("ajv implementation error");let{allErrors:a,opts:c}=i;if(i.props=true,c.removeAdditional!=="all"&&(0, Bi.alwaysValidSchema)(i,r))return;let u=(0, Vi.allSchemaProperties)(n.properties),l=(0, Vi.allSchemaProperties)(n.patternProperties);d(),t.ok((0, bt._)`${s} === ${xE.default.errors}`);function d(){e.forIn("key",o,w=>{!u.length&&!l.length?h(w):e.if(p(w),()=>h(w));});}function p(w){let x;if(u.length>8){let $=(0, Bi.schemaRefOrVal)(i,n.properties,"properties");x=(0, Vi.isOwnProperty)(e,$,w);}else u.length?x=(0, bt.or)(...u.map($=>(0, bt._)`${w} === ${$}`)):x=bt.nil;return l.length&&(x=(0, bt.or)(x,...l.map($=>(0, bt._)`${(0, Vi.usePattern)(t,$)}.test(${w})`))),(0, bt.not)(x)}function f(w){e.code((0, bt._)`delete ${o}[${w}]`);}function h(w){if(c.removeAdditional==="all"||c.removeAdditional&&r===false){f(w);return}if(r===false){t.setParams({additionalProperty:w}),t.error(),a||e.break();return}if(typeof r=="object"&&!(0, Bi.alwaysValidSchema)(i,r)){let x=e.name("valid");c.removeAdditional==="failing"?(_(w,x,false),e.if((0, bt.not)(x),()=>{t.reset(),f(w);})):(_(w,x),a||e.if((0, bt.not)(x),()=>e.break()));}}function _(w,x,$){let b={keyword:"additionalProperties",dataProp:w,dataPropType:Bi.Type.Str};$===false&&Object.assign(b,{compositeRule:true,createErrors:false,allErrors:false}),t.subschema(b,x);}}};Hl.default=$E;});var h_=T(Yl=>{Object.defineProperty(Yl,"__esModule",{value:true});var SE=Go(),f_=lt(),Kl=K(),m_=Wl(),TE={keyword:"properties",type:"object",schemaType:"object",code(t){let{gen:e,schema:r,parentSchema:n,data:o,it:s}=t;s.opts.removeAdditional==="all"&&n.additionalProperties===void 0&&m_.default.code(new SE.KeywordCxt(s,m_.default,"additionalProperties"));let i=(0, f_.allSchemaProperties)(r);for(let d of i)s.definedProperties.add(d);s.opts.unevaluated&&i.length&&s.props!==true&&(s.props=Kl.mergeEvaluated.props(e,(0, Kl.toHash)(i),s.props));let a=i.filter(d=>!(0, Kl.alwaysValidSchema)(s,r[d]));if(a.length===0)return;let c=e.name("valid");for(let d of a)u(d)?l(d):(e.if((0, f_.propertyInData)(e,o,d,s.opts.ownProperties)),l(d),s.allErrors||e.else().var(c,true),e.endIf()),t.it.definedProperties.add(d),t.ok(c);function u(d){return s.opts.useDefaults&&!s.compositeRule&&r[d].default!==void 0}function l(d){t.subschema({keyword:"properties",schemaProp:d,dataProp:d},c);}}};Yl.default=TE;});var v_=T(Ql=>{Object.defineProperty(Ql,"__esModule",{value:true});var g_=lt(),Gi=U(),y_=K(),__=K(),zE={keyword:"patternProperties",type:"object",schemaType:"object",code(t){let{gen:e,schema:r,data:n,parentSchema:o,it:s}=t,{opts:i}=s,a=(0, g_.allSchemaProperties)(r),c=a.filter(_=>(0, y_.alwaysValidSchema)(s,r[_]));if(a.length===0||c.length===a.length&&(!s.opts.unevaluated||s.props===true))return;let u=i.strictSchema&&!i.allowMatchingProperties&&o.properties,l=e.name("valid");s.props!==true&&!(s.props instanceof Gi.Name)&&(s.props=(0, __.evaluatedPropsToName)(e,s.props));let{props:d}=s;p();function p(){for(let _ of a)u&&f(_),s.allErrors?h(_):(e.var(l,true),h(_),e.if(l));}function f(_){for(let w in u)new RegExp(_).test(w)&&(0, y_.checkStrictMode)(s,`property ${w} matches pattern ${_} (use allowMatchingProperties)`);}function h(_){e.forIn("key",n,w=>{e.if((0, Gi._)`${(0, g_.usePattern)(t,_)}.test(${w})`,()=>{let x=c.includes(_);x||t.subschema({keyword:"patternProperties",schemaProp:_,dataProp:w,dataPropType:__.Type.Str},l),s.opts.unevaluated&&d!==true?e.assign((0, Gi._)`${d}[${w}]`,true):!x&&!s.allErrors&&e.if((0, Gi.not)(l),()=>e.break());});});}}};Ql.default=zE;});var k_=T(Xl=>{Object.defineProperty(Xl,"__esModule",{value:true});var PE=K(),EE={keyword:"not",schemaType:["object","boolean"],trackErrors:true,code(t){let{gen:e,schema:r,it:n}=t;if((0, PE.alwaysValidSchema)(n,r)){t.fail();return}let o=e.name("valid");t.subschema({keyword:"not",compositeRule:true,createErrors:false,allErrors:false},o),t.failResult(o,()=>t.reset(),()=>t.error());},error:{message:"must NOT be valid"}};Xl.default=EE;});var w_=T(ed=>{Object.defineProperty(ed,"__esModule",{value:true});var CE=lt(),jE={keyword:"anyOf",schemaType:"array",trackErrors:true,code:CE.validateUnion,error:{message:"must match a schema in anyOf"}};ed.default=jE;});var x_=T(td=>{Object.defineProperty(td,"__esModule",{value:true});var Hi=U(),RE=K(),IE={message:"must match exactly one schema in oneOf",params:({params:t})=>(0, Hi._)`{passingSchemas: ${t.passing}}`},OE={keyword:"oneOf",schemaType:"array",trackErrors:true,error:IE,code(t){let{gen:e,schema:r,parentSchema:n,it:o}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");if(o.opts.discriminator&&n.discriminator)return;let s=r,i=e.let("valid",false),a=e.let("passing",null),c=e.name("_valid");t.setParams({passing:a}),e.block(u),t.result(i,()=>t.reset(),()=>t.error(true));function u(){s.forEach((l,d)=>{let p;(0, RE.alwaysValidSchema)(o,l)?e.var(c,true):p=t.subschema({keyword:"oneOf",schemaProp:d,compositeRule:true},c),d>0&&e.if((0, Hi._)`${c} && ${i}`).assign(i,false).assign(a,(0, Hi._)`[${a}, ${d}]`).else(),e.if(c,()=>{e.assign(i,true),e.assign(a,d),p&&t.mergeEvaluated(p,Hi.Name);});});}}};td.default=OE;});var b_=T(rd=>{Object.defineProperty(rd,"__esModule",{value:true});var NE=K(),AE={keyword:"allOf",schemaType:"array",code(t){let{gen:e,schema:r,it:n}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");let o=e.name("valid");r.forEach((s,i)=>{if((0, NE.alwaysValidSchema)(n,s))return;let a=t.subschema({keyword:"allOf",schemaProp:i},o);t.ok(o),t.mergeEvaluated(a);});}};rd.default=AE;});var T_=T(nd=>{Object.defineProperty(nd,"__esModule",{value:true});var Wi=U(),S_=K(),ZE={message:({params:t})=>(0, Wi.str)`must match "${t.ifClause}" schema`,params:({params:t})=>(0, Wi._)`{failingKeyword: ${t.ifClause}}`},ME={keyword:"if",schemaType:["object","boolean"],trackErrors:true,error:ZE,code(t){let{gen:e,parentSchema:r,it:n}=t;r.then===void 0&&r.else===void 0&&(0, S_.checkStrictMode)(n,'"if" without "then" and "else" is ignored');let o=$_(n,"then"),s=$_(n,"else");if(!o&&!s)return;let i=e.let("valid",true),a=e.name("_valid");if(c(),t.reset(),o&&s){let l=e.let("ifClause");t.setParams({ifClause:l}),e.if(a,u("then",l),u("else",l));}else o?e.if(a,u("then")):e.if((0, Wi.not)(a),u("else"));t.pass(i,()=>t.error(true));function c(){let l=t.subschema({keyword:"if",compositeRule:true,createErrors:false,allErrors:false},a);t.mergeEvaluated(l);}function u(l,d){return ()=>{let p=t.subschema({keyword:l},a);e.assign(i,a),t.mergeValidEvaluated(p,i),d?e.assign(d,(0, Wi._)`${l}`):t.setParams({ifClause:l});}}}};function $_(t,e){let r=t.schema[e];return r!==void 0&&!(0, S_.alwaysValidSchema)(t,r)}nd.default=ME;});var z_=T(od=>{Object.defineProperty(od,"__esModule",{value:true});var DE=K(),qE={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:t,parentSchema:e,it:r}){e.if===void 0&&(0, DE.checkStrictMode)(r,`"${t}" without "if" is ignored`);}};od.default=qE;});var P_=T(sd=>{Object.defineProperty(sd,"__esModule",{value:true});var LE=Ll(),UE=o_(),FE=Ul(),JE=i_(),VE=a_(),BE=l_(),GE=p_(),HE=Wl(),WE=h_(),KE=v_(),YE=k_(),QE=w_(),XE=x_(),eC=b_(),tC=T_(),rC=z_();function nC(t=false){let e=[YE.default,QE.default,XE.default,eC.default,tC.default,rC.default,GE.default,HE.default,BE.default,WE.default,KE.default];return t?e.push(UE.default,JE.default):e.push(LE.default,FE.default),e.push(VE.default),e}sd.default=nC;});var E_=T(id=>{Object.defineProperty(id,"__esModule",{value:true});var _e=U(),oC={message:({schemaCode:t})=>(0, _e.str)`must match format "${t}"`,params:({schemaCode:t})=>(0, _e._)`{format: ${t}}`},sC={keyword:"format",type:["number","string"],schemaType:"string",$data:true,error:oC,code(t,e){let{gen:r,data:n,$data:o,schema:s,schemaCode:i,it:a}=t,{opts:c,errSchemaPath:u,schemaEnv:l,self:d}=a;if(!c.validateFormats)return;o?p():f();function p(){let h=r.scopeValue("formats",{ref:d.formats,code:c.code.formats}),_=r.const("fDef",(0, _e._)`${h}[${i}]`),w=r.let("fType"),x=r.let("format");r.if((0, _e._)`typeof ${_} == "object" && !(${_} instanceof RegExp)`,()=>r.assign(w,(0, _e._)`${_}.type || "string"`).assign(x,(0, _e._)`${_}.validate`),()=>r.assign(w,(0, _e._)`"string"`).assign(x,_)),t.fail$data((0, _e.or)($(),b()));function $(){return c.strictSchema===false?_e.nil:(0, _e._)`${i} && !${x}`}function b(){let R=l.$async?(0, _e._)`(${_}.async ? await ${x}(${n}) : ${x}(${n}))`:(0, _e._)`${x}(${n})`,I=(0, _e._)`(typeof ${x} == "function" ? ${R} : ${x}.test(${n}))`;return (0, _e._)`${x} && ${x} !== true && ${w} === ${e} && !${I}`}}function f(){let h=d.formats[s];if(!h){$();return}if(h===true)return;let[_,w,x]=b(h);_===e&&t.pass(R());function $(){if(c.strictSchema===false){d.logger.warn(I());return}throw new Error(I());function I(){return `unknown format "${s}" ignored in schema at path "${u}"`}}function b(I){let be=I instanceof RegExp?(0, _e.regexpCode)(I):c.code.formats?(0, _e._)`${c.code.formats}${(0, _e.getProperty)(s)}`:void 0,$e=r.scopeValue("formats",{key:s,ref:I,code:be});return typeof I=="object"&&!(I instanceof RegExp)?[I.type||"string",I.validate,(0, _e._)`${$e}.validate`]:["string",I,$e]}function R(){if(typeof h=="object"&&!(h instanceof RegExp)&&h.async){if(!l.$async)throw new Error("async format in sync schema");return (0, _e._)`await ${x}(${n})`}return typeof w=="function"?(0, _e._)`${x}(${n})`:(0, _e._)`${x}.test(${n})`}}}};id.default=sC;});var C_=T(ad=>{Object.defineProperty(ad,"__esModule",{value:true});var iC=E_(),aC=[iC.default];ad.default=aC;});var j_=T(qn=>{Object.defineProperty(qn,"__esModule",{value:true});qn.contentVocabulary=qn.metadataVocabulary=void 0;qn.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];qn.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"];});var I_=T(cd=>{Object.defineProperty(cd,"__esModule",{value:true});var cC=qy(),uC=e_(),lC=P_(),dC=C_(),R_=j_(),pC=[cC.default,uC.default,(0, lC.default)(),dC.default,R_.metadataVocabulary,R_.contentVocabulary];cd.default=pC;});var N_=T(Ki=>{Object.defineProperty(Ki,"__esModule",{value:true});Ki.DiscrError=void 0;var O_;(function(t){t.Tag="tag",t.Mapping="mapping";})(O_||(Ki.DiscrError=O_={}));});var Z_=T(ld=>{Object.defineProperty(ld,"__esModule",{value:true});var Ln=U(),ud=N_(),A_=Ri(),fC=Ho(),mC=K(),hC={message:({params:{discrError:t,tagName:e}})=>t===ud.DiscrError.Tag?`tag "${e}" must be string`:`value of tag "${e}" must be in oneOf`,params:({params:{discrError:t,tag:e,tagName:r}})=>(0, Ln._)`{error: ${t}, tag: ${r}, tagValue: ${e}}`},gC={keyword:"discriminator",type:"object",schemaType:"object",error:hC,code(t){let{gen:e,data:r,schema:n,parentSchema:o,it:s}=t,{oneOf:i}=o;if(!s.opts.discriminator)throw new Error("discriminator: requires discriminator option");let a=n.propertyName;if(typeof a!="string")throw new Error("discriminator: requires propertyName");if(n.mapping)throw new Error("discriminator: mapping is not supported");if(!i)throw new Error("discriminator: requires oneOf keyword");let c=e.let("valid",false),u=e.const("tag",(0, Ln._)`${r}${(0, Ln.getProperty)(a)}`);e.if((0, Ln._)`typeof ${u} == "string"`,()=>l(),()=>t.error(false,{discrError:ud.DiscrError.Tag,tag:u,tagName:a})),t.ok(c);function l(){let f=p();e.if(false);for(let h in f)e.elseIf((0, Ln._)`${u} === ${h}`),e.assign(c,d(f[h]));e.else(),t.error(false,{discrError:ud.DiscrError.Mapping,tag:u,tagName:a}),e.endIf();}function d(f){let h=e.name("valid"),_=t.subschema({keyword:"oneOf",schemaProp:f},h);return t.mergeEvaluated(_,Ln.Name),h}function p(){var f;let h={},_=x(o),w=true;for(let R=0;R<i.length;R++){let I=i[R];if(I?.$ref&&!(0, mC.schemaHasRulesButRef)(I,s.self.RULES)){let $e=I.$ref;if(I=A_.resolveRef.call(s.self,s.schemaEnv.root,s.baseId,$e),I instanceof A_.SchemaEnv&&(I=I.schema),I===void 0)throw new fC.default(s.opts.uriResolver,s.baseId,$e)}let be=(f=I?.properties)===null||f===void 0?void 0:f[a];if(typeof be!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${a}"`);w=w&&(_||x(I)),$(be,R);}if(!w)throw new Error(`discriminator: "${a}" must be required`);return h;function x({required:R}){return Array.isArray(R)&&R.includes(a)}function $(R,I){if(R.const)b(R.const,I);else if(R.enum)for(let be of R.enum)b(be,I);else throw new Error(`discriminator: "properties/${a}" must have "const" or "enum"`)}function b(R,I){if(typeof R!="string"||R in h)throw new Error(`discriminator: "${a}" values must be unique strings`);h[R]=I;}}}};ld.default=gC;});var M_=T((Pq,yC)=>{yC.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"http://json-schema.org/draft-07/schema#",title:"Core schema meta-schema",definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:true,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:true,readOnly:{type:"boolean",default:false},examples:{type:"array",items:true},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:true},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:false},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:true,enum:{type:"array",items:true,minItems:1,uniqueItems:true},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:true}]},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:true};});var pd=T((pe,dd)=>{Object.defineProperty(pe,"__esModule",{value:true});pe.MissingRefError=pe.ValidationError=pe.CodeGen=pe.Name=pe.nil=pe.stringify=pe.str=pe._=pe.KeywordCxt=pe.Ajv=void 0;var _C=Oy(),vC=I_(),kC=Z_(),D_=M_(),wC=["/properties"],Yi="http://json-schema.org/draft-07/schema",Un=class extends _C.default{_addVocabularies(){super._addVocabularies(),vC.default.forEach(e=>this.addVocabulary(e)),this.opts.discriminator&&this.addKeyword(kC.default);}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let e=this.opts.$data?this.$dataMetaSchema(D_,wC):D_;this.addMetaSchema(e,Yi,false),this.refs["http://json-schema.org/schema"]=Yi;}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(Yi)?Yi:void 0)}};pe.Ajv=Un;dd.exports=pe=Un;dd.exports.Ajv=Un;Object.defineProperty(pe,"__esModule",{value:true});pe.default=Un;var xC=Go();Object.defineProperty(pe,"KeywordCxt",{enumerable:true,get:function(){return xC.KeywordCxt}});var Fn=U();Object.defineProperty(pe,"_",{enumerable:true,get:function(){return Fn._}});Object.defineProperty(pe,"str",{enumerable:true,get:function(){return Fn.str}});Object.defineProperty(pe,"stringify",{enumerable:true,get:function(){return Fn.stringify}});Object.defineProperty(pe,"nil",{enumerable:true,get:function(){return Fn.nil}});Object.defineProperty(pe,"Name",{enumerable:true,get:function(){return Fn.Name}});Object.defineProperty(pe,"CodeGen",{enumerable:true,get:function(){return Fn.CodeGen}});var bC=Ci();Object.defineProperty(pe,"ValidationError",{enumerable:true,get:function(){return bC.default}});var $C=Ho();Object.defineProperty(pe,"MissingRefError",{enumerable:true,get:function(){return $C.default}});});var G_=T(qt=>{Object.defineProperty(qt,"__esModule",{value:true});qt.formatNames=qt.fastFormats=qt.fullFormats=void 0;function Dt(t,e){return {validate:t,compare:e}}qt.fullFormats={date:Dt(F_,gd),time:Dt(md(true),yd),"date-time":Dt(q_(true),V_),"iso-time":Dt(md(),J_),"iso-date-time":Dt(q_(),B_),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:CC,"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:ZC,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:jC,int32:{type:"number",validate:OC},int64:{type:"number",validate:NC},float:{type:"number",validate:U_},double:{type:"number",validate:U_},password:true,binary:true};qt.fastFormats={...qt.fullFormats,date:Dt(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,gd),time:Dt(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,yd),"date-time":Dt(/^\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,V_),"iso-time":Dt(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,J_),"iso-date-time":Dt(/^\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,B_),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};qt.formatNames=Object.keys(qt.fullFormats);function SC(t){return t%4===0&&(t%100!==0||t%400===0)}var TC=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,zC=[0,31,28,31,30,31,30,31,31,30,31,30,31];function F_(t){let e=TC.exec(t);if(!e)return false;let r=+e[1],n=+e[2],o=+e[3];return n>=1&&n<=12&&o>=1&&o<=(n===2&&SC(r)?29:zC[n])}function gd(t,e){if(t&&e)return t>e?1:t<e?-1:0}var fd=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function md(t){return function(r){let n=fd.exec(r);if(!n)return false;let o=+n[1],s=+n[2],i=+n[3],a=n[4],c=n[5]==="-"?-1:1,u=+(n[6]||0),l=+(n[7]||0);if(u>23||l>59||t&&!a)return false;if(o<=23&&s<=59&&i<60)return true;let d=s-l*c,p=o-u*c-(d<0?1:0);return (p===23||p===-1)&&(d===59||d===-1)&&i<61}}function yd(t,e){if(!(t&&e))return;let r=new Date("2020-01-01T"+t).valueOf(),n=new Date("2020-01-01T"+e).valueOf();if(r&&n)return r-n}function J_(t,e){if(!(t&&e))return;let r=fd.exec(t),n=fd.exec(e);if(r&&n)return t=r[1]+r[2]+r[3],e=n[1]+n[2]+n[3],t>e?1:t<e?-1:0}var hd=/t|\s/i;function q_(t){let e=md(t);return function(n){let o=n.split(hd);return o.length===2&&F_(o[0])&&e(o[1])}}function V_(t,e){if(!(t&&e))return;let r=new Date(t).valueOf(),n=new Date(e).valueOf();if(r&&n)return r-n}function B_(t,e){if(!(t&&e))return;let[r,n]=t.split(hd),[o,s]=e.split(hd),i=gd(r,o);if(i!==void 0)return i||yd(n,s)}var PC=/\/|:/,EC=/^(?:[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;function CC(t){return PC.test(t)&&EC.test(t)}var L_=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function jC(t){return L_.lastIndex=0,L_.test(t)}var RC=-2147483648,IC=2**31-1;function OC(t){return Number.isInteger(t)&&t<=IC&&t>=RC}function NC(t){return Number.isInteger(t)}function U_(){return true}var AC=/[^\\]\\Z/;function ZC(t){if(AC.test(t))return false;try{return new RegExp(t),!0}catch{return false}}});var H_=T(Jn=>{Object.defineProperty(Jn,"__esModule",{value:true});Jn.formatLimitDefinition=void 0;var MC=pd(),$t=U(),kr=$t.operators,Qi={formatMaximum:{okStr:"<=",ok:kr.LTE,fail:kr.GT},formatMinimum:{okStr:">=",ok:kr.GTE,fail:kr.LT},formatExclusiveMaximum:{okStr:"<",ok:kr.LT,fail:kr.GTE},formatExclusiveMinimum:{okStr:">",ok:kr.GT,fail:kr.LTE}},DC={message:({keyword:t,schemaCode:e})=>(0, $t.str)`should be ${Qi[t].okStr} ${e}`,params:({keyword:t,schemaCode:e})=>(0, $t._)`{comparison: ${Qi[t].okStr}, limit: ${e}}`};Jn.formatLimitDefinition={keyword:Object.keys(Qi),type:"string",schemaType:"string",$data:true,error:DC,code(t){let{gen:e,data:r,schemaCode:n,keyword:o,it:s}=t,{opts:i,self:a}=s;if(!i.validateFormats)return;let c=new MC.KeywordCxt(s,a.RULES.all.format.definition,"format");c.$data?u():l();function u(){let p=e.scopeValue("formats",{ref:a.formats,code:i.code.formats}),f=e.const("fmt",(0, $t._)`${p}[${c.schemaCode}]`);t.fail$data((0, $t.or)((0, $t._)`typeof ${f} != "object"`,(0, $t._)`${f} instanceof RegExp`,(0, $t._)`typeof ${f}.compare != "function"`,d(f)));}function l(){let p=c.schema,f=a.formats[p];if(!f||f===true)return;if(typeof f!="object"||f instanceof RegExp||typeof f.compare!="function")throw new Error(`"${o}": format "${p}" does not define "compare" function`);let h=e.scopeValue("formats",{key:p,ref:f,code:i.code.formats?(0, $t._)`${i.code.formats}${(0, $t.getProperty)(p)}`:void 0});t.fail$data(d(h));}function d(p){return (0, $t._)`${p}.compare(${r}, ${n}) ${Qi[o].fail} 0`}},dependencies:["format"]};var qC=t=>(t.addKeyword(Jn.formatLimitDefinition),t);Jn.default=qC;});var Q_=T((cs,Y_)=>{Object.defineProperty(cs,"__esModule",{value:true});var Vn=G_(),LC=H_(),_d=U(),W_=new _d.Name("fullFormats"),UC=new _d.Name("fastFormats"),vd=(t,e={keywords:true})=>{if(Array.isArray(e))return K_(t,e,Vn.fullFormats,W_),t;let[r,n]=e.mode==="fast"?[Vn.fastFormats,UC]:[Vn.fullFormats,W_],o=e.formats||Vn.formatNames;return K_(t,o,r,n),e.keywords&&(0, LC.default)(t),t};vd.get=(t,e="full")=>{let n=(e==="fast"?Vn.fastFormats:Vn.fullFormats)[t];if(!n)throw new Error(`Unknown format "${t}"`);return n};function K_(t,e,r,n){var o,s;(o=(s=t.opts.code).formats)!==null&&o!==void 0||(s.formats=(0, _d._)`require("ajv-formats/dist/formats").${n}`);for(let i of e)t.addFormat(i,r[i]);}Y_.exports=cs=vd;Object.defineProperty(cs,"__esModule",{value:true});cs.default=vd;});function FC(){let t=new X_.default({strict:false,validateFormats:true,validateSchema:false,allErrors:true});return (0, ev.default)(t),t}var X_,ev,Xi,tv=g(()=>{X_=Td(pd()),ev=Td(Q_());Xi=class{constructor(e){this._ajv=e??FC();}getValidator(e){let r="$id"in e&&typeof e.$id=="string"?this._ajv.getSchema(e.$id)??this._ajv.compile(e):this._ajv.compile(e);return n=>r(n)?{valid:true,data:n,errorMessage:void 0}:{valid:false,data:void 0,errorMessage:this._ajv.errorsText(r.errors)}}};});var ea,rv=g(()=>{Pn();ea=class{constructor(e){this._server=e;}requestStream(e,r,n){return this._server.requestStream(e,r,n)}createMessageStream(e,r){let n=this._server.getClientCapabilities();if((e.tools||e.toolChoice)&&!n?.sampling?.tools)throw new Error("Client does not support sampling tools capability.");if(e.messages.length>0){let o=e.messages[e.messages.length-1],s=Array.isArray(o.content)?o.content:[o.content],i=s.some(l=>l.type==="tool_result"),a=e.messages.length>1?e.messages[e.messages.length-2]:void 0,c=a?Array.isArray(a.content)?a.content:[a.content]:[],u=c.some(l=>l.type==="tool_use");if(i){if(s.some(l=>l.type!=="tool_result"))throw new Error("The last message must contain only tool_result content if any is present");if(!u)throw new Error("tool_result blocks are not matching any tool_use from the previous message")}if(u){let l=new Set(c.filter(p=>p.type==="tool_use").map(p=>p.id)),d=new Set(s.filter(p=>p.type==="tool_result").map(p=>p.toolUseId));if(l.size!==d.size||![...l].every(p=>d.has(p)))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},Ro,r)}elicitInputStream(e,r){let n=this._server.getClientCapabilities(),o=e.mode??"form";switch(o){case "url":{if(!n?.elicitation?.url)throw new Error("Client does not support url elicitation.");break}case "form":{if(!n?.elicitation?.form)throw new Error("Client does not support form elicitation.");break}}let s=o==="form"&&e.mode===void 0?{...e,mode:"form"}:e;return this.requestStream({method:"elicitation/create",params:s},zn,r)}async getTask(e,r){return this._server.getTask({taskId:e},r)}async getTaskResult(e,r,n){return this._server.getTaskResult({taskId:e},r,n)}async listTasks(e,r){return this._server.listTasks(e?{cursor:e}:void 0,r)}async cancelTask(e,r){return this._server.cancelTask({taskId:e},r)}};});function nv(t,e,r){if(!t)throw new Error(`${r} does not support task creation (required for ${e})`);switch(e){case "tools/call":if(!t.tools?.call)throw new Error(`${r} does not support task creation for tools/call (required for ${e})`);break;}}function ov(t,e,r){if(!t)throw new Error(`${r} does not support task creation (required for ${e})`);switch(e){case "sampling/createMessage":if(!t.sampling?.createMessage)throw new Error(`${r} does not support task creation for sampling/createMessage (required for ${e})`);break;case "elicitation/create":if(!t.elicitation?.create)throw new Error(`${r} does not support task creation for elicitation/create (required for ${e})`);break;}}var sv=g(()=>{});var ta,iv=g(()=>{fg();Pn();tv();Hs();rv();sv();ta=class extends yi{constructor(e,r){super(r),this._serverInfo=e,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(jo.options.map((n,o)=>[n,o])),this.isMessageIgnored=(n,o)=>{let s=this._loggingLevels.get(o);return s?this.LOG_LEVEL_SEVERITY.get(n)<this.LOG_LEVEL_SEVERITY.get(s):false},this._capabilities=r?.capabilities??{},this._instructions=r?.instructions,this._jsonSchemaValidator=r?.jsonSchemaValidator??new Xi,this.setRequestHandler(qc,n=>this._oninitialize(n)),this.setNotificationHandler(Lc,()=>this.oninitialized?.()),this._capabilities.logging&&this.setRequestHandler(Wc,async(n,o)=>{let s=o.sessionId||o.requestInfo?.headers["mcp-session-id"]||void 0,{level:i}=n.params,a=jo.safeParse(i);return a.success&&this._loggingLevels.set(s,a.data),{}});}get experimental(){return this._experimental||(this._experimental={tasks:new ea(this)}),this._experimental}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=pg(this._capabilities,e);}setRequestHandler(e,r){let o=Gs(e)?.method;if(!o)throw new Error("Schema is missing a method literal");let s;if(bn(o)){let a=o;s=a._zod?.def?.value??a.value;}else {let a=o;s=a._def?.value??a.value;}if(typeof s!="string")throw new Error("Schema method literal must be a string");if(s==="tools/call"){let a=async(c,u)=>{let l=ur(Co,c);if(!l.success){let h=l.error instanceof Error?l.error.message:String(l.error);throw new D(G.InvalidParams,`Invalid tools/call request: ${h}`)}let{params:d}=l.data,p=await Promise.resolve(r(c,u));if(d.task){let h=ur(Sn,p);if(!h.success){let _=h.error instanceof Error?h.error.message:String(h.error);throw new D(G.InvalidParams,`Invalid task creation result: ${_}`)}return h.data}let f=ur(li,p);if(!f.success){let h=f.error instanceof Error?f.error.message:String(f.error);throw new D(G.InvalidParams,`Invalid tools/call result: ${h}`)}return f.data};return super.setRequestHandler(e,a)}return super.setRequestHandler(e,r)}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})`);break;}}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})`);break;}}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})`);break;}}assertTaskCapability(e){ov(this._clientCapabilities?.tasks?.requests,e,"Client");}assertTaskHandlerCapability(e){this._capabilities&&nv(this._capabilities.tasks?.requests,e,"Server");}async _oninitialize(e){let r=e.params.protocolVersion;return this._clientCapabilities=e.params.capabilities,this._clientVersion=e.params.clientInfo,{protocolVersion:Vh.includes(r)?r:Nc,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"},ei)}async createMessage(e,r){if((e.tools||e.toolChoice)&&!this._clientCapabilities?.sampling?.tools)throw new Error("Client does not support sampling tools capability.");if(e.messages.length>0){let n=e.messages[e.messages.length-1],o=Array.isArray(n.content)?n.content:[n.content],s=o.some(u=>u.type==="tool_result"),i=e.messages.length>1?e.messages[e.messages.length-2]:void 0,a=i?Array.isArray(i.content)?i.content:[i.content]:[],c=a.some(u=>u.type==="tool_use");if(s){if(o.some(u=>u.type!=="tool_result"))throw new Error("The last message must contain only tool_result content if any is present");if(!c)throw new Error("tool_result blocks are not matching any tool_use from the previous message")}if(c){let u=new Set(a.filter(d=>d.type==="tool_use").map(d=>d.id)),l=new Set(o.filter(d=>d.type==="tool_result").map(d=>d.toolUseId));if(u.size!==l.size||![...u].every(d=>l.has(d)))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},Kc,r):this.request({method:"sampling/createMessage",params:e},Ro,r)}async elicitInput(e,r){switch(e.mode??"form"){case "url":{if(!this._clientCapabilities?.elicitation?.url)throw new Error("Client does not support url elicitation.");let o=e;return this.request({method:"elicitation/create",params:o},zn,r)}case "form":{if(!this._clientCapabilities?.elicitation?.form)throw new Error("Client does not support form elicitation.");let o=e.mode==="form"?e:{...e,mode:"form"},s=await this.request({method:"elicitation/create",params:o},zn,r);if(s.action==="accept"&&s.content&&o.requestedSchema)try{let a=this._jsonSchemaValidator.getValidator(o.requestedSchema)(s.content);if(!a.valid)throw new D(G.InvalidParams,`Elicitation response content does not match requested schema: ${a.errorMessage}`)}catch(i){throw i instanceof D?i:new D(G.InternalError,`Error validating elicitation response: ${i instanceof Error?i.message:String(i)}`)}return s}}}createElicitationCompletionNotifier(e,r){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}},r)}async listRoots(e,r){return this.request({method:"roots/list",params:e},Yc,r)}async sendLoggingMessage(e,r){if(this._capabilities.logging&&!this.isMessageIgnored(e.level,r))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"})}};});function JC(t){return Xh.parse(JSON.parse(t))}function av(t){return JSON.stringify(t)+`
|
|
42
|
+
`}var ra,cv=g(()=>{Pn();ra=class{append(e){this._buffer=this._buffer?Buffer.concat([this._buffer,e]):e;}readMessage(){if(!this._buffer)return null;let e=this._buffer.indexOf(`
|
|
43
|
+
`);if(e===-1)return null;let r=this._buffer.toString("utf8",0,e).replace(/\r$/,"");return this._buffer=this._buffer.subarray(e+1),JC(r)}clear(){this._buffer=void 0;}};});var na,lv=g(()=>{cv();na=class{constructor(e=uv.stdin,r=uv.stdout){this._stdin=e,this._stdout=r,this._readBuffer=new ra,this._started=false,this._ondata=n=>{this._readBuffer.append(n),this.processReadBuffer();},this._onerror=n=>{this.onerror?.(n);};}async start(){if(this._started)throw new Error("StdioServerTransport already started! If using Server class, note that connect() calls start() automatically.");this._started=true,this._stdin.on("data",this._ondata),this._stdin.on("error",this._onerror);}processReadBuffer(){for(;;)try{let e=this._readBuffer.readMessage();if(e===null)break;this.onmessage?.(e);}catch(e){this.onerror?.(e);}}async close(){this._stdin.off("data",this._ondata),this._stdin.off("error",this._onerror),this._stdin.listenerCount("data")===0&&this._stdin.pause(),this._readBuffer.clear(),this.onclose?.();}send(e){return new Promise(r=>{let n=av(e);this._stdout.write(n)?r():this._stdout.once("drain",r);})}};});var us,VC,BC,kd,dv=g(()=>{dn();us="1.0",VC=k.object({key:k.string(),summary:k.string(),status:k.string(),assignee:k.string().nullable(),priority:k.string(),issue_type:k.string(),created:k.string(),updated:k.string(),project_key:k.string(),project_url:k.string().url(),epic_link:k.string().nullable()}),BC=k.object({version:k.string(),last_sync:k.string(),jira_user:k.string()}),kd=k.object({metadata:BC,tasks:k.array(VC)});});function QC(t){return t.replaceAll("@","_at_").replaceAll(".","_")}var oa,pv=g(()=>{dv();_t();Xe();oa=class{cacheDir;jiraUser;cachePath;constructor(e,r){this.cacheDir=e,this.jiraUser=r,this.cachePath=join(e,`tasks_${QC(r)}.json`);}async initialize(){if(await mkdir(this.cacheDir,{recursive:true}),await Je(this.cachePath)){try{await this.load();}catch(r){if(!(r instanceof Ct)){let n=r instanceof Error?r.message:String(r);throw new Oe(`Existing cache is corrupted: ${n}`)}}return}let e={metadata:{version:us,last_sync:new Date().toISOString(),jira_user:this.jiraUser},tasks:[]};await this.#e(e);}async load(){if(!await Je(this.cachePath))throw new Ct(`Cache not found: ${this.cachePath}`);let e;try{e=await readFile(this.cachePath,"utf-8");}catch(o){let s=o instanceof Error?o.message:String(o);throw new Ct(`Failed to read cache file: ${s}`)}let r;try{r=JSON.parse(e);}catch(o){let s=o instanceof Error?o.message:String(o);throw new Oe(`Cache file is corrupted (invalid JSON): ${s}`)}let n=kd.safeParse(r);if(!n.success)throw new Oe(`Cache data failed validation: ${n.error.message}`);if(n.data.metadata.version!==us)throw new Oe(`Cache version ${n.data.metadata.version} !== ${us}`);return n.data}async save(e){let r={metadata:{version:us,last_sync:new Date().toISOString(),jira_user:this.jiraUser},tasks:[...e]},n=kd.safeParse(r);if(!n.success)throw new Oe(`Task data failed validation: ${n.error.message}`);await this.#e(n.data);}async getTask(e){let n=(await this.load()).tasks.find(o=>o.key===e);if(!n)throw new Dr(`Task ${e} not found in cache`);return n}async getAllTasks(){return (await this.load()).tasks}async updateTask(e,r){let n=await this.load(),o=n.tasks.findIndex(c=>c.key===e);if(o===-1)throw new Dr(`Task ${e} not found in cache`);let s=n.tasks[o];if(!s)throw new Dr(`Task ${e} not found in cache`);let i={...s,...r,key:e,updated:new Date().toISOString()},a=[...n.tasks.slice(0,o),i,...n.tasks.slice(o+1)];return await this.save(a),i}async deleteTask(e){let r=await this.load(),n=r.tasks.filter(o=>o.key!==e);if(n.length===r.tasks.length)throw new Dr(`Task ${e} not found in cache`);await this.save(n);}async getMetadata(){return (await this.load()).metadata}async#e(e){let r=`${this.cachePath}.tmp`,n=JSON.stringify(e,null,2);await writeFile(r,n,"utf-8"),await rename(r,this.cachePath);}};});var sa,fv=g(()=>{qr();Oa();sa=class{#e;#t;#r;constructor(e,r,n){this.#e=e,this.#t=r,this.#r=n;}async sync(e){let r=e?.jql??`assignee = "${zs(this.#t.credentials.username)}" ORDER BY updated DESC`,n=np(this.#t);if(e?.projectKey){let s=this.#t.projects[e.projectKey];s&&(n=n.filter(i=>i.url===s.url));}let o=[];for(let s of n){let c=(await this.#r(s.url,s.username,s.api_token).searchIssues(r)).map(u=>this.#n(u,s.url));o.push(...c);}return await this.#e.save(o),o.length}#n(e,r){let n=e.fields.assignee?.emailAddress??null,o=e.fields.priority?.name??"None",s=e.fields.customfield_10014??null;return {key:e.key,summary:e.fields.summary,status:e.fields.status.name,assignee:n,priority:o,issue_type:e.fields.issuetype.name,created:e.fields.created,updated:e.fields.updated,project_key:e.fields.project.key,project_url:r,epic_link:s}}};});var mv,hv=g(()=>{mv=[{id:"status-update",name:"Status Update",description:"Standard status update with completed work, next steps, and blockers",category:"workflow",variables:[{name:"completed",description:"Work completed since last update",required:true,example:"Implemented user authentication flow"},{name:"next_steps",description:"Planned next steps",required:true,example:"Add unit tests for auth module"},{name:"blockers",description:"Current blockers or impediments",required:false,defaultValue:"None",example:"Waiting for API credentials"}],body:`## Status Update
|
|
44
|
+
|
|
45
|
+
### Completed
|
|
46
|
+
{{completed}}
|
|
47
|
+
|
|
48
|
+
### Next Steps
|
|
49
|
+
{{next_steps}}
|
|
50
|
+
|
|
51
|
+
{{#blockers}}### Blockers
|
|
52
|
+
{{blockers}}{{/blockers}}`},{id:"blocker-notification",name:"Blocker Notification",description:"Notify about a blocking issue with impact and needed action",category:"communication",variables:[{name:"blocked_by",description:"What is causing the blockage",required:true,example:"Missing database credentials for staging"},{name:"impact",description:"Impact if blocker is not resolved",required:true,example:"Cannot proceed with integration testing"},{name:"needed_action",description:"What action is needed to unblock",required:true,example:"DevOps to provision staging DB credentials"},{name:"deadline",description:"When this needs to be resolved",required:false,defaultValue:"ASAP",example:"2026-04-15"}],body:`## Blocker
|
|
53
|
+
|
|
54
|
+
**Blocked by:** {{blocked_by}}
|
|
55
|
+
|
|
56
|
+
### Impact
|
|
57
|
+
{{impact}}
|
|
58
|
+
|
|
59
|
+
### Action Needed
|
|
60
|
+
{{needed_action}}
|
|
61
|
+
|
|
62
|
+
**Deadline:** {{deadline}}`},{id:"handoff-transition",name:"Task Handoff",description:"Provide context when handing off a task to another person",category:"workflow",variables:[{name:"from_person",description:"Person handing off",required:true,example:"John"},{name:"to_person",description:"Person receiving",required:true,example:"Jane"},{name:"context",description:"Current state and context",required:true,example:"Auth module is 80% complete, all tests passing"},{name:"remaining_work",description:"What still needs to be done",required:true,example:"Add OAuth2 provider support"},{name:"decisions",description:"Key decisions already made",required:false,example:"Using JWT for session management"}],body:`## Task Handoff
|
|
63
|
+
|
|
64
|
+
**From:** {{from_person}} **To:** {{to_person}}
|
|
65
|
+
|
|
66
|
+
### Context
|
|
67
|
+
{{context}}
|
|
68
|
+
|
|
69
|
+
### Remaining Work
|
|
70
|
+
{{remaining_work}}
|
|
71
|
+
|
|
72
|
+
{{#decisions}}### Key Decisions Made
|
|
73
|
+
{{decisions}}{{/decisions}}`},{id:"review-request",name:"Review Request",description:"Request a code review with context and focus areas",category:"communication",variables:[{name:"reviewer",description:"Who should review",required:true,example:"Jane"},{name:"summary",description:"Summary of changes",required:true,example:"Added user authentication with JWT"},{name:"link",description:"PR or branch link",required:true,example:"https://github.com/org/repo/pull/123"},{name:"focus_areas",description:"What to focus the review on",required:false,example:"Security of token generation"}],body:`## Review Request
|
|
74
|
+
|
|
75
|
+
**Reviewer:** {{reviewer}}
|
|
76
|
+
|
|
77
|
+
### Changes
|
|
78
|
+
{{summary}}
|
|
79
|
+
|
|
80
|
+
**Link:** {{link}}
|
|
81
|
+
|
|
82
|
+
{{#focus_areas}}### Focus Areas
|
|
83
|
+
{{focus_areas}}{{/focus_areas}}`},{id:"sprint-update",name:"Sprint Update",description:"Sprint progress report with risks and decisions needed",category:"reporting",variables:[{name:"progress",description:"Sprint progress summary",required:true,example:"7 of 10 stories completed"},{name:"risks",description:"Current risks to sprint goal",required:true,example:"Auth integration may slip to next sprint"},{name:"decisions_needed",description:"Decisions that need to be made",required:false,example:"Should we de-scope OAuth2 support?"}],body:`## Sprint Update
|
|
84
|
+
|
|
85
|
+
### Progress
|
|
86
|
+
{{progress}}
|
|
87
|
+
|
|
88
|
+
### Risks
|
|
89
|
+
{{risks}}
|
|
90
|
+
|
|
91
|
+
{{#decisions_needed}}### Decisions Needed
|
|
92
|
+
{{decisions_needed}}{{/decisions_needed}}`},{id:"bug-report",name:"Bug Report",description:"Structured bug report with reproduction steps",category:"development",variables:[{name:"steps",description:"Steps to reproduce",required:true,example:`1. Login as admin
|
|
93
|
+
2. Navigate to /settings
|
|
94
|
+
3. Click "Save"`},{name:"expected",description:"Expected behavior",required:true,example:"Settings should be saved"},{name:"actual",description:"Actual behavior",required:true,example:"Error 500 returned"},{name:"environment",description:"Environment details",required:false,example:"Chrome 120, macOS 14.2"}],body:`## Bug Report
|
|
95
|
+
|
|
96
|
+
### Steps to Reproduce
|
|
97
|
+
{{steps}}
|
|
98
|
+
|
|
99
|
+
### Expected
|
|
100
|
+
{{expected}}
|
|
101
|
+
|
|
102
|
+
### Actual
|
|
103
|
+
{{actual}}
|
|
104
|
+
|
|
105
|
+
{{#environment}}### Environment
|
|
106
|
+
{{environment}}{{/environment}}`},{id:"deployment-note",name:"Deployment Note",description:"Document a deployment with changes and rollback plan",category:"development",variables:[{name:"changes",description:"What was deployed",required:true,example:"User auth module v2.1"},{name:"rollback_plan",description:"How to rollback if needed",required:true,example:"Revert to tag v2.0.3"},{name:"monitoring",description:"What to monitor after deploy",required:false,example:"Watch error rate on /api/auth/*"}],body:`## Deployment Note
|
|
107
|
+
|
|
108
|
+
### Changes
|
|
109
|
+
{{changes}}
|
|
110
|
+
|
|
111
|
+
### Rollback Plan
|
|
112
|
+
{{rollback_plan}}
|
|
113
|
+
|
|
114
|
+
{{#monitoring}}### Monitoring
|
|
115
|
+
{{monitoring}}{{/monitoring}}`},{id:"time-log-summary",name:"Time Log Summary",description:"Summary of work performed with time spent",category:"reporting",variables:[{name:"duration",description:"Time spent",required:true,example:"2h 30m"},{name:"work_description",description:"What was done",required:true,example:"Refactored authentication middleware"}],body:`## Time Logged
|
|
116
|
+
|
|
117
|
+
**Duration:** {{duration}}
|
|
118
|
+
|
|
119
|
+
### Work Performed
|
|
120
|
+
{{work_description}}`}];});var ia,gv=g(()=>{hv();_t();ia=class{templates;constructor(e){let r=new Map;for(let n of mv)r.set(n.id,n);if(e)for(let n of e)r.set(n.id,n);this.templates=r;}getTemplate(e){let r=this.templates.get(e);if(!r)throw new bs(`Template "${e}" not found. Use listTemplates() to see available templates.`);return r}listTemplates(e){let r=[...this.templates.values()];return e?r.filter(n=>n.category===e):r}listCategories(){let e=new Set;for(let r of this.templates.values())e.add(r.category);return [...e]}};});function aa(t){if(t==null)return yv;try{let e=St(t.content??[]).trim();return e.length>0?e:yv}catch{return `[ADF conversion failed]
|
|
121
|
+
|
|
122
|
+
${JSON.stringify(t,null,2)}`}}function St(t){return t.map(XC).join("")}function XC(t){switch(t.type){case "text":return ej(t.text??"",t.marks??[]);case "paragraph":return St(t.content??[])+`
|
|
123
|
+
|
|
124
|
+
`;case "heading":{let e=t.attrs?.level??1;return `${"#".repeat(Math.min(e,6))} ${St(t.content??[]).trim()}
|
|
125
|
+
|
|
126
|
+
`}case "bulletList":return _v(t.content??[],"-")+`
|
|
127
|
+
`;case "orderedList":return _v(t.content??[],"1.")+`
|
|
128
|
+
`;case "listItem":return St(t.content??[]);case "codeBlock":{let e=t.attrs?.language??"",r=St(t.content??[]).trim();return `\`\`\`${e}
|
|
129
|
+
${r}
|
|
130
|
+
\`\`\`
|
|
131
|
+
|
|
132
|
+
`}case "blockquote":return St(t.content??[]).trim().split(`
|
|
133
|
+
`).map(e=>`> ${e}`).join(`
|
|
134
|
+
`)+`
|
|
135
|
+
|
|
136
|
+
`;case "rule":return `---
|
|
137
|
+
|
|
138
|
+
`;case "hardBreak":return `
|
|
139
|
+
`;case "mention":return t.attrs?.text??"@unknown";case "emoji":return t.attrs?.shortName??"";case "inlineCard":{let e=t.attrs?.url;return e?`[${e}](${e})`:""}case "panel":{let e=t.attrs?.panelType??"info",r=St(t.content??[]).trim();return `> **${e.toUpperCase()}:** ${r}
|
|
140
|
+
|
|
141
|
+
`}case "table":return tj(t.content??[])+`
|
|
142
|
+
`;case "tableRow":case "tableHeader":case "tableCell":return St(t.content??[]);case "mediaSingle":case "media":return `[media]
|
|
143
|
+
|
|
144
|
+
`;case "status":{let e=t.attrs?.text;return e?`[${e}]`:""}default:return t.content?St(t.content):t.text??""}}function ej(t,e){let r=t;for(let n of e)switch(n.type){case "strong":r=`**${r}**`;break;case "em":r=`*${r}*`;break;case "strike":r=`~~${r}~~`;break;case "code":r=`\`${r}\``;break;case "link":{let o=n.attrs?.href;o&&(r=`[${r}](${o})`);break}case "underline":r=`<u>${r}</u>`;break;}return r}function _v(t,e){return t.map(r=>{let n=St(r.content??[]).trim();return `${e} ${n}`}).join(`
|
|
145
|
+
`)}function tj(t){if(t.length===0)return "";let e=[],r=false;for(let s of t){let i=[];for(let a of s.content??[])a.type==="tableHeader"&&(r=true),i.push(St(a.content??[]).trim());e.push(i);}if(e.length===0)return "";let n=[],o=e[0]??[];if(n.push("| "+o.join(" | ")+" |"),r){n.push("| "+o.map(()=>"---").join(" | ")+" |");for(let s=1;s<e.length;s++){let i=e[s]??[];n.push("| "+i.join(" | ")+" |");}}else {n.push("| "+o.map(()=>"---").join(" | ")+" |");for(let s=1;s<e.length;s++){let i=e[s]??[];n.push("| "+i.join(" | ")+" |");}}return n.join(`
|
|
146
|
+
`)+`
|
|
147
|
+
`}var yv,vv=g(()=>{yv="(No content)";});function kv(t){let e=t.trim();if(e.length===0)throw new Error("Invalid time format: empty string. Use: '2h', '30m', or '2h 30m'");if(oj.test(e))throw new Error("Days (d) not supported. Use hours (h) and minutes (m) only. Example: '2h', '30m', or '2h 30m'");let r=0,n=rj.exec(e);n?.[1]&&(r+=parseInt(n[1],10)*3600);let o=nj.exec(e);if(o?.[1]&&(r+=parseInt(o[1],10)*60),r===0)throw new Error(`Invalid time format: '${t}'. Use: '2h', '30m', or '2h 30m'`);return r}var rj,nj,oj,wv=g(()=>{rj=/(\d+)\s*h/i,nj=/(\d+)\s*m/i,oj=/\d+\s*d/i;});var ca,xv=g(()=>{co();vv();wv();_t();ca=class{constructor(e,r){this.connector=e;this.cacheManager=r;}connector;cacheManager;async changeStatus(e,r){let n=await this.connector.getTransitions(e),o=n.find(i=>i.toStatus.toLowerCase()===r.toLowerCase())??n.find(i=>i.name.toLowerCase()===r.toLowerCase());if(!o){let i=n.map(a=>`${a.name} -> ${a.toStatus}`).join(", ");throw new yt(`Status '${r}' not available for ${e}. Available transitions: ${i}`)}await this.connector.doTransition(e,o.id);let s=await this.cacheManager.updateTask(e,{status:o.toStatus||r});return {taskKey:e,updatedTask:s}}async getAvailableStatuses(e){return (await this.connector.getTransitions(e)).map(n=>({id:n.id,name:n.name,toStatus:n.toStatus}))}async addComment(e,r){let n=Rt(r),o=await this.connector.addComment(e,n);return {taskKey:e,commentId:o.id,author:o.author,bodyMarkdown:aa(o.body),created:o.created}}async reassign(e,r){if(r){let o=await this.connector.findUser(r);await this.connector.assignIssue(e,o);}else await this.connector.assignIssue(e,null);let n=await this.cacheManager.updateTask(e,{assignee:r??null});return {taskKey:e,updatedTask:n}}async getTaskDetails(e){let r=await this.connector.getIssue(e),n=r.comments.map(o=>({id:o.id,author:o.author,body:aa(o.body),created:o.created}));return {key:r.key,summary:r.summary,description:aa(r.description),status:r.status,assignee:r.assignee,priority:r.priority,issueType:r.issueType,created:r.created,updated:r.updated,comments:n}}async logTime(e,r,n){let o=kv(r),s=n?Rt(n):void 0,i=await this.connector.addWorklog(e,o,s);try{await this.cacheManager.deleteTask(e);}catch{}return {taskKey:e,worklogId:i.id,timeSpent:r,timeSpentSeconds:i.timeSpentSeconds}}async getTimeTracking(e){let r=await this.connector.getTimeTracking(e);return {taskKey:e,originalEstimate:r.originalEstimate,remainingEstimate:r.remainingEstimate,timeSpent:r.timeSpent}}};});function te(t){return {content:[{type:"text",text:JSON.stringify({success:true,...t},null,2)}]}}function B(t){let e=t instanceof Error?t.message:String(t),r=t instanceof ht?t.code:"UNKNOWN_ERROR";return {content:[{type:"text",text:JSON.stringify({success:false,error:e,code:r},null,2)}],isError:true}}function De(t,e,r){let n=t.getConnectorForTask(r);return new ca(n,e)}var je=g(()=>{xv();_t();});async function bv(t,e){try{let r={...t.jql?{jql:t.jql}:{},...t.project_key?{projectKey:t.project_key}:{}},n=await e.syncer.sync(r);return te({tasks_synced:n,message:`Synced ${n} tasks`})}catch(r){return B(r)}}var $v=g(()=>{je();});async function Sv(t,e){try{if(t.task_key){let n=await e.cacheManager.getTask(t.task_key);return te({task:n})}let r=await e.cacheManager.getAllTasks();return te({tasks:r,count:r.length})}catch(r){return B(r)}}var Tv=g(()=>{je();});async function zv(t,e){try{let n=await De(e.pool,e.cacheManager,t.task_key).changeStatus(t.task_key,t.status);return te({task:n.updatedTask,message:`Updated ${t.task_key} status to '${t.status}'`})}catch(r){return B(r)}}var Pv=g(()=>{je();});async function Ev(t,e){try{let n=await De(e.pool,e.cacheManager,t.task_key).addComment(t.task_key,t.comment);return te({comment:{id:n.commentId,author:n.author,body:n.bodyMarkdown,created:n.created},message:`Added comment to ${t.task_key}`})}catch(r){return B(r)}}var Cv=g(()=>{je();});async function jv(t,e){try{let r=De(e.pool,e.cacheManager,t.task_key),n=t.assignee_email?.trim()||null,o=await r.reassign(t.task_key,n),s=n?`Reassigned ${t.task_key} to ${n}`:`Unassigned ${t.task_key}`;return te({task:o.updatedTask,message:s})}catch(r){return B(r)}}var Rv=g(()=>{je();});async function Iv(t,e){try{let n=await De(e.pool,e.cacheManager,t.task_key).getAvailableStatuses(t.task_key);return te({task_key:t.task_key,statuses:n.map(o=>({id:o.id,name:o.name,to_status:o.toStatus}))})}catch(r){return B(r)}}var Ov=g(()=>{je();});async function Nv(t,e){try{let n=await De(e.pool,e.cacheManager,t.task_key).getTaskDetails(t.task_key),o=t.task_key.split("-")[0]??"",s=e.config.projects[o]?.language??e.config.default_language;return te({task:n,language:s,message:`Retrieved details for ${t.task_key}`})}catch(r){return B(r)}}var Av=g(()=>{je();});async function Zv(t,e){try{let r=e.config.projects[t.project_key],n=r?.language??e.config.default_language;return te({project_key:t.project_key,language:n,source:r?.language?"project":"default",message:`Project ${t.project_key} language: ${n}`})}catch(r){return B(r)}}var Mv=g(()=>{je();});async function Dv(t,e){try{let n=await De(e.pool,e.cacheManager,t.task_key).logTime(t.task_key,t.time_spent,t.comment);return te({message:`Logged ${t.time_spent} to ${t.task_key}`,worklog_id:n.worklogId,time_spent:n.timeSpent,time_spent_seconds:n.timeSpentSeconds})}catch(r){return B(r)}}var qv=g(()=>{je();});async function Lv(t,e){try{let n=await De(e.pool,e.cacheManager,t.task_key).getTimeTracking(t.task_key);return te({task_key:t.task_key,time_tracking:{original_estimate:n.originalEstimate,time_spent:n.timeSpent,remaining_estimate:n.remainingEstimate},message:`Retrieved time tracking for ${t.task_key}`})}catch(r){return B(r)}}var Uv=g(()=>{je();});var wd,Fv=g(()=>{wd={WORKFLOW:"workflow",COMMUNICATION:"communication",REPORTING:"reporting",DEVELOPMENT:"development"};});function sj(t){return Object.values(wd).includes(t)}async function Jv(t,e){try{let r;if(t.category){if(!sj(t.category)){let s=Object.values(wd).join(", ");return B(new Error(`Invalid category '${t.category}'. Valid categories: ${s}`))}r=t.category;}let n=e.templateRegistry.listTemplates(r),o=e.templateRegistry.listCategories();return te({templates:n.map(s=>({id:s.id,name:s.name,description:s.description,category:s.category,variables:s.variables.map(i=>({name:i.name,description:i.description,required:i.required,example:i.example}))})),categories:o,count:n.length})}catch(r){return B(r)}}var Vv=g(()=>{Fv();je();});function cj(t){let e=new Map;for(let r of t.variables)r.defaultValue!==void 0&&e.set(r.name,r.defaultValue);return e}function uj(t,e){let r=[];for(let n of t.variables)n.required&&!(n.name in e)&&r.push(n.name);return r}function lj(t){return t.replace(/\n{3,}/g,`
|
|
148
|
+
|
|
149
|
+
`)}function Bv(t,e){let r=uj(t,e);if(r.length>0)return {success:false,error:`Missing required variables: ${r.join(", ")}`,missingVariables:r};let n=cj(t),o=t.body;return o=o.replace(ij,(s,i,a)=>{let c=e[i];return c!==void 0&&c!==""?a:""}),o=o.replace(aj,(s,i)=>{if(i in e)return e[i]??"";let a=n.get(i);return a!==void 0?a:""}),o=lj(o).trim(),{success:true,markdown:o}}var ij,aj,Gv=g(()=>{ij=/\{\{#(\w+)\}\}([\s\S]*?)\{\{\/\1\}\}/g,aj=/\{\{(\w+)\}\}/g;});async function Hv(t,e){try{if(t.template_id&&t.markdown)return B(new Error("Provide either template_id or markdown, not both."));if(!t.template_id&&!t.markdown)return B(new Error("Provide either template_id (with variables) or markdown."));let r,n;if(t.template_id){let i=e.templateRegistry.getTemplate(t.template_id),a=Bv(i,t.variables??{});if(!a.success)return B(new Error(a.error));r=a.markdown,n={template_id:i.id,template_name:i.name};}else r=t.markdown??"";let s=await De(e.pool,e.cacheManager,t.task_key).addComment(t.task_key,r);return te({comment:{id:s.commentId,author:s.author,body:s.bodyMarkdown,created:s.created},...n?{template:n}:{},message:`Added comment to ${t.task_key}`})}catch(r){return B(r)}}var Wv=g(()=>{Gv();je();});async function dj(t){return (await t.getFields()).find(n=>n.custom&&n.name.toLowerCase()==="epic link")?.id}async function Kv(t,e){try{let r=e.pool.getConnector(t.project_key),n={project:{key:t.project_key},summary:t.summary,issuetype:{name:t.type??"Task"},priority:{name:t.priority??"Medium"}};if(t.description&&(n.description=Rt(t.description)),t.labels&&t.labels.length>0&&(n.labels=t.labels),t.assignee_email){let s=await r.findUser(t.assignee_email);n.assignee={accountId:s};}if(t.epic_key){let s=await dj(r);s&&(n[s]=t.epic_key);}let o=await r.createIssue(n);return te({issue_key:o.key,url:o.url,summary:t.summary,message:`Created ${o.key}: ${t.summary}`})}catch(r){return B(r)}}var Yv=g(()=>{je();co();});async function Qv(t,e){try{let r=t.task_key.split("-")[0]??"",n=e.pool.getConnector(r),o={};if(t.summary!==void 0&&(o.summary=t.summary),t.description!==void 0&&(o.description=Rt(t.description)),t.priority!==void 0&&(o.priority={name:t.priority}),t.labels!==void 0&&(o.labels=t.labels),Object.keys(o).length===0)return B(new Error("No fields to update. Provide at least one of: summary, description, priority, labels."));await n.updateIssue(t.task_key,o);let s=Object.keys(o).join(", ");return te({task_key:t.task_key,updated_fields:s,message:`Updated ${t.task_key}: ${s}`})}catch(r){return B(r)}}var Xv=g(()=>{je();co();});async function ek(t,e){try{let r=t.project_key??e.config.default_project,n=e.pool.getConnector(r),o=t.max_results??pj,s=await n.searchIssues(t.jql,fj),i=s.slice(0,o);return te({results:i,count:i.length,total_available:s.length,message:`Found ${i.length} issue(s) matching JQL query`})}catch(r){return B(r)}}var pj,fj,tk=g(()=>{je();pj=50,fj=["summary","status","assignee","priority","issuetype","created","updated","project","customfield_10014"];});var xd={};Gn(xd,{createServer:()=>nk,startServer:()=>gj});function mj(t){return {instanceUrl:t.instanceUrl,async searchIssues(e){return (await t.searchIssues(e)).map(n=>({key:n.key,fields:{summary:n.summary,status:{name:n.status},assignee:n.assignee?{emailAddress:n.assignee}:null,priority:n.priority?{name:n.priority}:null,issuetype:{name:n.issueType},created:n.created,updated:n.updated,project:{key:n.projectKey},customfield_10014:n.epicLink}}))}}}function nk(){return new ta({name:"@softspark/jira-mcp",version:ls},{capabilities:{tools:{}}})}async function gj(){let t=await jt(),e=new nt(t),{GLOBAL_CACHE_DIR:r}=await Promise.resolve().then(()=>(we(),Pd)),n=r,o=new oa(n,t.credentials.username);await o.initialize();let s=new ia,i=new sa(o,t,(u,l,d)=>mj(e.getConnector(vj(t,u)??""))),a=nk();a.setRequestHandler(Hc,()=>({tools:hj})),a.setRequestHandler(Co,async u=>{let{name:l}=u.params,d=u.params.arguments??{};switch(l){case "sync_tasks":return bv({project_key:Re(d.project_key),jql:Re(d.jql)},{syncer:i});case "read_cached_tasks":return Sv({task_key:Re(d.task_key)},{cacheManager:o});case "update_task_status":return zv({task_key:qe(d.task_key,"task_key"),status:qe(d.status,"status")},{pool:e,cacheManager:o});case "add_task_comment":return Ev({task_key:qe(d.task_key,"task_key"),comment:qe(d.comment,"comment")},{pool:e,cacheManager:o});case "reassign_task":return jv({task_key:qe(d.task_key,"task_key"),assignee_email:Re(d.assignee_email)},{pool:e,cacheManager:o});case "get_task_statuses":return Iv({task_key:qe(d.task_key,"task_key")},{pool:e,cacheManager:o});case "get_task_details":return Nv({task_key:qe(d.task_key,"task_key")},{pool:e,cacheManager:o,config:t});case "log_task_time":return Dv({task_key:qe(d.task_key,"task_key"),time_spent:qe(d.time_spent,"time_spent"),comment:Re(d.comment)},{pool:e,cacheManager:o});case "get_task_time_tracking":return Lv({task_key:qe(d.task_key,"task_key")},{pool:e,cacheManager:o});case "list_comment_templates":return Jv({category:Re(d.category)},{templateRegistry:s});case "add_templated_comment":return Hv({task_key:qe(d.task_key,"task_key"),template_id:Re(d.template_id),variables:_j(d.variables),markdown:Re(d.markdown)},{pool:e,cacheManager:o,templateRegistry:s});case "create_task":return Kv({project_key:qe(d.project_key,"project_key"),summary:qe(d.summary,"summary"),description:Re(d.description),type:Re(d.type),priority:Re(d.priority),assignee_email:Re(d.assignee_email),labels:rk(d.labels),epic_key:Re(d.epic_key)},{pool:e,cacheManager:o});case "get_project_language":return Zv({project_key:qe(d.project_key,"project_key")},{config:t});case "update_task":return Qv({task_key:qe(d.task_key,"task_key"),summary:Re(d.summary),description:Re(d.description),priority:Re(d.priority),labels:rk(d.labels)},{pool:e});case "search_tasks":return ek({jql:qe(d.jql,"jql"),max_results:yj(d.max_results),project_key:Re(d.project_key)},{pool:e,config:t});default:return B(new Error(`Unknown tool: ${l}`))}});let c=new na;await a.connect(c);}function Re(t){return typeof t=="string"?t:void 0}function qe(t,e){if(typeof t!="string"||t.length===0)throw new Error(`Missing required parameter: ${e}`);return t}function yj(t){return typeof t=="number"?t:void 0}function rk(t){if(Array.isArray(t))return t.map(e=>String(e))}function _j(t){if(t==null||typeof t!="object"||Array.isArray(t))return;let e={};for(let[r,n]of Object.entries(t))e[r]=String(n);return e}function vj(t,e){for(let[r,n]of Object.entries(t.projects))if(n.url===e)return r}var hj,bd=g(()=>{iv();lv();Pn();da();qr();mn();pv();fv();gv();je();$v();Tv();Pv();Cv();Rv();Ov();Av();Mv();qv();Uv();Vv();Wv();Yv();Xv();tk();hj=[{name:"sync_tasks",description:"Sync tasks from Jira to local cache. By default syncs from all configured instances. Optionally scope to a single project or provide a custom JQL query.",inputSchema:{type:"object",properties:{project_key:{type:"string",description:"Optional project key to sync from a single instance."},jql:{type:"string",description:"Optional JQL query. If omitted, fetches tasks assigned to the current user."}}}},{name:"read_cached_tasks",description:"Read tasks from local cache without hitting the Jira API. Returns a single task when task_key is provided, or all cached tasks otherwise.",inputSchema:{type:"object",properties:{task_key:{type:"string",description:'Optional task key (e.g. "PROJ-123"). If omitted, returns all cached tasks.'}}}},{name:"update_task_status",description:"Change a task status via Jira workflow transition and update the local cache.",inputSchema:{type:"object",properties:{task_key:{type:"string",description:'Task key (e.g. "PROJ-123").'},status:{type:"string",description:'Target status name (e.g. "In Progress", "Done"). Use get_task_statuses first to check valid transitions.'}},required:["task_key","status"]}},{name:"add_task_comment",description:"Add a markdown comment to a Jira task. The markdown is automatically converted to ADF format.",inputSchema:{type:"object",properties:{task_key:{type:"string",description:'Task key (e.g. "PROJ-123").'},comment:{type:"string",description:"Comment text in markdown format."}},required:["task_key","comment"]}},{name:"reassign_task",description:"Reassign a task to a different user by email, or unassign by providing an empty string or omitting assignee_email.",inputSchema:{type:"object",properties:{task_key:{type:"string",description:'Task key (e.g. "PROJ-123").'},assignee_email:{type:"string",description:"Email of the new assignee. Empty string or omit to unassign."}},required:["task_key"]}},{name:"get_task_statuses",description:"Get available workflow transitions for a task. Call this before update_task_status to see valid target statuses.",inputSchema:{type:"object",properties:{task_key:{type:"string",description:'Task key (e.g. "PROJ-123").'}},required:["task_key"]}},{name:"get_task_details",description:"Get full task details from Jira including description and all comments, with ADF content converted to markdown.",inputSchema:{type:"object",properties:{task_key:{type:"string",description:'Task key (e.g. "PROJ-123").'}},required:["task_key"]}},{name:"log_task_time",description:"Log work time to a Jira task. Uses hours and minutes format only (no days). Invalidates cache after logging.",inputSchema:{type:"object",properties:{task_key:{type:"string",description:'Task key (e.g. "PROJ-123").'},time_spent:{type:"string",description:'Time in format "2h", "30m", or "2h 30m". Days are not supported.'},comment:{type:"string",description:"Optional work description."}},required:["task_key","time_spent"]}},{name:"get_task_time_tracking",description:"Get time tracking information for a Jira task (original estimate, time spent, remaining estimate).",inputSchema:{type:"object",properties:{task_key:{type:"string",description:'Task key (e.g. "PROJ-123").'}},required:["task_key"]}},{name:"list_comment_templates",description:"List all available comment templates with optional category filter. Returns template metadata including required variables.",inputSchema:{type:"object",properties:{category:{type:"string",description:'Optional category filter: "workflow", "communication", "reporting", or "development".',enum:["workflow","communication","reporting","development"]}}}},{name:"add_templated_comment",description:"Add a comment using a registered template (with variable substitution) or raw markdown. Provide exactly one of template_id or markdown.",inputSchema:{type:"object",properties:{task_key:{type:"string",description:'Task key (e.g. "PROJ-123").'},template_id:{type:"string",description:"Template identifier. Use list_comment_templates to see available templates."},variables:{type:"object",description:"Key-value map of template variables. Required when using template_id.",additionalProperties:{type:"string"}},markdown:{type:"string",description:"Raw markdown comment. Use instead of template_id for freeform comments."}},required:["task_key"]}},{name:"create_task",description:"Create a new Jira issue with optional description, assignee, labels, and epic link.",inputSchema:{type:"object",properties:{project_key:{type:"string",description:'Project key (e.g. "DEVOPS"). Determines which Jira instance to use.'},summary:{type:"string",description:"Issue title / summary."},description:{type:"string",description:"Optional issue description in markdown format. Automatically converted to ADF."},type:{type:"string",description:'Issue type name (default "Task"). E.g. "Bug", "Story", "Epic".'},priority:{type:"string",description:'Priority name (default "Medium"). E.g. "High", "Low", "Critical".'},assignee_email:{type:"string",description:"Email of the assignee. Resolved to Jira account ID."},labels:{type:"array",items:{type:"string"},description:"Array of label strings to apply to the issue."},epic_key:{type:"string",description:'Epic issue key to link this issue under (e.g. "PROJ-100").'}},required:["project_key","summary"]}},{name:"get_project_language",description:"Get the configured language for a project. Use before writing comments or descriptions to determine the correct language.",inputSchema:{type:"object",properties:{project_key:{type:"string",description:'Project key (e.g. "DEVOPS"). Inferred from task key prefix.'}},required:["project_key"]}},{name:"update_task",description:"Update an existing Jira issue. Only provided fields are changed; omitted fields are left untouched.",inputSchema:{type:"object",properties:{task_key:{type:"string",description:'Task key (e.g. "DEVOPS-37"). Project is inferred from the key prefix.'},summary:{type:"string",description:"New issue title / summary."},description:{type:"string",description:"New issue description in markdown format. Automatically converted to ADF."},priority:{type:"string",description:'New priority name. E.g. "Medium", "Low", "Critical".'},labels:{type:"array",items:{type:"string"},description:"New set of label strings (replaces existing labels)."}},required:["task_key"]}},{name:"search_tasks",description:"Search Jira issues using JQL. Returns results directly without caching.",inputSchema:{type:"object",properties:{jql:{type:"string",description:"JQL query string."},max_results:{type:"number",description:"Maximum number of results to return (default 50)."},project_key:{type:"string",description:"Optional project key to determine which Jira instance to query. Defaults to the configured default project."}},required:["jql"]}}];});da();we();Xe();function ee(t){console.log(t);}function ps(t){console.warn(`Warning: ${t}`);}function se(t){console.error(`Error: ${t}`);}function tn(t,e){let r=t.map((s,i)=>Math.max(s.length,...e.map(a=>(a[i]??"").length))),n=t.map((s,i)=>s.padEnd(r[i]??0)).join(" "),o=r.map(s=>"-".repeat(s)).join(" ");console.log(n),console.log(o);for(let s of e)console.log(s.map((i,a)=>(i??"").padEnd(r[a]??0)).join(" "));}var vk=JSON.stringify({projects:{},default_project:""},null,2),kk=JSON.stringify({username:"",api_token:""},null,2),wk=JSON.stringify({version:"0.3.0"},null,2);async function ha(t,e){await Je(t)?e.push({path:t,kind:"directory",action:"skipped"}):(await mkdir(t,{recursive:true}),e.push({path:t,kind:"directory",action:"created"}));}async function ga(t,e,r,n=false){await Je(t)?r.push({path:t,kind:"file",action:"skipped"}):n?(await ds(t,e),r.push({path:t,kind:"file",action:"created"})):(await writeFile(t,e,"utf-8"),r.push({path:t,kind:"file",action:"created"}));}async function xk(t){let e=[];return await ha(t,e),await ha(join(t,"cache"),e),await ha(join(t,"templates","tasks"),e),await ga(join(t,"config.json"),vk,e),await ga(join(t,"credentials.json"),kk,e,true),await ga(join(t,"state.json"),wk,e),e}function Cd(t){t.command("init").description("Create global config directory with skeleton files").action(async()=>{let e=await xk(ye);for(let o of e){let s=o.action==="created"?"+":"=";ee(` ${s} ${o.kind}: ${o.path}`);}let r=e.filter(o=>o.action==="created").length,n=e.filter(o=>o.action==="skipped").length;ee(`
|
|
150
|
+
Done: ${String(r)} created, ${String(n)} skipped.`);});}we();Xe();var $k=/^[A-Z][A-Z0-9]*$/;function Sk(t){return $k.test(t)}function Tk(t){return t.startsWith("https://")}async function zk(t,e,r){if(!Sk(e))throw new Error(`Invalid project key "${e}": must be uppercase alphanumeric starting with a letter (e.g. PROJ, E8A).`);if(!Tk(r))throw new Error(`Invalid URL "${r}": must start with https://.`);let n=join(t,"config.json"),o=await ft(n),s={...o.projects,[e]:{url:r}},i=o.default_project===""?e:o.default_project;await Ut(n,{projects:s,default_project:i});}function jd(t){t.command("add-project").description("Add a project mapping to config").argument("<key>","Uppercase project key (e.g. PROJ)").argument("<url>","Jira instance URL (https://...)").action(async(e,r)=>{try{await zk(ye,e,r),ee(`Added project ${e} -> ${r}`);}catch(n){let o=n instanceof Error?n.message:String(n);se(o),process.exitCode=1;}});}we();Xe();async function Ek(t,e){let r=join(t,"config.json"),n=await ft(r);if(!(e in n.projects))throw new Error(`Project "${e}" is not configured.`);let o={};for(let[c,u]of Object.entries(n.projects))c!==e&&(o[c]=u);let s=n.default_project===e,i=s?"":n.default_project;return await Ut(r,{projects:o,default_project:i}),{defaultCleared:s}}function Rd(t){t.command("remove-project").description("Remove a project mapping from config").argument("<key>","Project key to remove").action(async e=>{try{let{defaultCleared:r}=await Ek(ye,e);ee(`Removed project ${e}.`),r&&ps("Default project was cleared. Set a new default with add-project.");}catch(r){let n=r instanceof Error?r.message:String(r);se(n),process.exitCode=1;}});}we();Xe();async function jk(t){let e=join(t,"config.json"),r=await ft(e),n=r.default_language??"pl";return Object.entries(r.projects).map(([o,s])=>({key:o,url:s.url,isDefault:o===r.default_project,language:s.language??n,languageSource:s.language?"project":"default"}))}function Id(t){t.command("list-projects").description("Show all configured projects").action(async()=>{try{let e=await jk(ye);if(e.length===0){ee("No projects configured. Run: jira-mcp config add-project <key> <url>");return}let r=e.map(n=>[n.key,n.url,n.isDefault?"*":"",n.languageSource==="project"?n.language:`${n.language} (default)`]);tn(["KEY","URL","DEFAULT","LANGUAGE"],r),ee(`
|
|
151
|
+
${String(e.length)} project(s) configured.`);}catch(e){let r=e instanceof Error?e.message:String(e);se(r),process.exitCode=1;}});}we();Xe();function Ik(t){return t.length<=4?"****":`${t.slice(0,4)}${"*".repeat(t.length-4)}`}async function Ok(t,e,r){let n=join(t,"credentials.json"),o=JSON.stringify({username:e,api_token:r},null,2);await ds(n,o);}function Od(t){t.command("set-credentials").description("Set Jira API credentials. Token is read from JIRA_API_TOKEN env var or --token option (avoid passing as positional arg \u2014 visible in process list).").argument("<email>","Jira account email").option("--token <token>","Jira API token (prefer JIRA_API_TOKEN env var)").action(async(e,r)=>{try{let n=r.token??process.env.JIRA_API_TOKEN;if(!n){se("API token required. Provide via --token flag or JIRA_API_TOKEN env var."),process.exitCode=1;return}await Ok(ye,e,n),ee(`Credentials saved for ${e} (token: ${Ik(n)})`);}catch(n){let o=n instanceof Error?n.message:String(n);se(o),process.exitCode=1;}});}we();Xe();async function Ak(t,e){let r=join(t,"config.json"),n=await ft(r);if(!(e in n.projects))throw new Error(`Project "${e}" is not configured. Add it first with: jira-mcp config add-project ${e} <url>`);let o={...n,default_project:e};await Ut(r,o);}function Nd(t){t.command("set-default").description("Set the default project").argument("<key>","Project key to set as default").action(async e=>{try{await Ak(ye,e),ee(`Default project set to ${e}`);}catch(r){let n=r instanceof Error?r.message:String(r);se(n),process.exitCode=1;}});}we();ro();Xe();function Xd(t){let e=ar.safeParse(t);if(!e.success)throw new Error(`Invalid language "${t}". Supported: ${to.join(", ")}`);return e.data}async function Hw(t,e){let r=Xd(e),n=join(t,"config.json"),o=await ft(n);await Ut(n,{...o,default_language:r});}async function Ww(t,e,r){let n=Xd(r),o=join(t,"config.json"),s=await ft(o);if(!(e in s.projects))throw new Error(`Project "${e}" is not configured. Add it first with: jira-mcp config add-project ${e} <url>`);let i=s.projects[e];if(!i)throw new Error(`Project "${e}" not found.`);let a={...s,projects:{...s.projects,[e]:{...i,language:n}}};await Ut(o,a);}function ep(t){t.command("set-language").description(`Set the default language (${to.join(", ")})`).argument("<lang>","Language code").action(async e=>{try{await Hw(ye,e),ee(`Default language set to "${e}"`);}catch(r){let n=r instanceof Error?r.message:String(r);se(n),process.exitCode=1;}}),t.command("set-project-language").description(`Set language for a specific project (${to.join(", ")})`).argument("<key>","Project key").argument("<lang>","Language code").action(async(e,r)=>{try{await Ww(ye,e,r),ee(`Language for project "${e}" set to "${r}"`);}catch(n){let o=n instanceof Error?n.message:String(n);se(o),process.exitCode=1;}});}function tp(t){let e=t.command("config").description("Manage Jira configuration");Cd(e),jd(e),Rd(e),Id(e),Od(e),Nd(e),ep(e);}qr();mn();dn();var nx=k.object({id:k.string(),name:k.string()}),ox=k.object({statuses:k.array(k.string()),transitions:k.record(k.string(),k.array(nx))}),sx=k.object({issue_types:k.record(k.string(),ox)}),Ta=k.object({last_sync:k.string(),projects:k.record(k.string(),sx)});we();_t();Xe();var hn=class{cachePath;data=null;constructor(e){this.cachePath=e??Hn;}async load(){if(!await Je(this.cachePath))return null;let e;try{e=await readFile(this.cachePath,"utf-8");}catch(o){let s=o instanceof Error?o.message:String(o);throw new Ct(`Failed to read workflow cache: ${s}`)}let r;try{r=JSON.parse(e);}catch(o){let s=o instanceof Error?o.message:String(o);throw new Oe(`Workflow cache is corrupted (invalid JSON): ${s}`)}let n=Ta.safeParse(r);if(!n.success)throw new Oe(`Workflow cache failed validation: ${n.error.message}`);return this.data=n.data,n.data}async save(e){let r=Ta.safeParse(e);if(!r.success)throw new Oe(`Workflow data failed validation: ${r.error.message}`);await mkdir(dirname(this.cachePath),{recursive:true});let n=`${this.cachePath}.tmp`,o=JSON.stringify(r.data,null,2);await writeFile(n,o,"utf-8"),await rename(n,this.cachePath),this.data=r.data;}async syncProject(e,r){let n=await r.getProjectStatuses(e),o={};for(let c of n)o[c.name]={statuses:c.statuses.map(u=>u.name),transitions:{}};let s={issue_types:o},i=this.data??{last_sync:new Date().toISOString(),projects:{}},a={last_sync:new Date().toISOString(),projects:{...i.projects,[e]:s}};await this.save(a);}async syncAll(e,r){await this.load();let n=Object.keys(r.projects),o=0;for(let s of n){let i=e.getConnector(s);await this.syncProject(s,i),o++;}return o}getProjectWorkflow(e){return this.data?this.data.projects[e]??null:null}};we();async function dx(t){let e=await jt(),r=new nt(e);return {projectCount:await new hn(t).syncAll(r,e)}}function sp(t){t.command("sync-workflows").description("Sync workflow statuses for all configured projects").action(async()=>{try{let e=await dx(Hn);ee(`Synced workflows for ${String(e.projectCount)} project(s).`);}catch(e){let r=e instanceof Error?e.message:String(e);se(r),process.exitCode=1;}});}qr();mn();dn();var px=k.object({account_id:k.string(),email:k.string().nullable(),display_name:k.string(),active:k.boolean()}),fx=k.object({users:k.array(px)}),za=k.object({last_sync:k.string(),instances:k.record(k.string(),fx)});we();_t();Xe();var gn=class{cachePath;data=null;constructor(e){this.cachePath=e??Wn;}async load(){if(!await Je(this.cachePath))return null;let e;try{e=await readFile(this.cachePath,"utf-8");}catch(o){let s=o instanceof Error?o.message:String(o);throw new Ct(`Failed to read user cache: ${s}`)}let r;try{r=JSON.parse(e);}catch(o){let s=o instanceof Error?o.message:String(o);throw new Oe(`User cache is corrupted (invalid JSON): ${s}`)}let n=za.safeParse(r);if(!n.success)throw new Oe(`User cache failed validation: ${n.error.message}`);return this.data=n.data,n.data}async save(e){let r=za.safeParse(e);if(!r.success)throw new Oe(`User data failed validation: ${r.error.message}`);await mkdir(dirname(this.cachePath),{recursive:true});let n=`${this.cachePath}.tmp`,o=JSON.stringify(r.data,null,2);await writeFile(n,o,"utf-8"),await rename(n,this.cachePath),this.data=r.data;}async syncInstance(e,r){let o=(await r.searchUsers("",1e3)).map(a=>({account_id:a.accountId,email:a.emailAddress,display_name:a.displayName,active:a.active})),s=this.data??{last_sync:new Date().toISOString(),instances:{}},i={last_sync:new Date().toISOString(),instances:{...s.instances,[e]:{users:o}}};return await this.save(i),o.length}async syncAll(e){await this.load();let r=0,n=e.getInstances();for(let[o,s]of n){let i=await this.syncInstance(o,s.connector);r+=i;}return r}resolveEmail(e,r){if(!this.data)return null;let n=this.data.instances[e];if(!n)return null;let o=r.toLowerCase();return n.users.find(i=>i.email?.toLowerCase()===o)?.account_id??null}getAllUsers(){if(!this.data)return [];let e=new Set,r=[];for(let n of Object.values(this.data.instances))for(let o of n.users)e.has(o.account_id)||(e.add(o.account_id),r.push(o));return r}};we();async function vx(t){let e=await jt(),r=new nt(e);return {userCount:await new gn(t).syncAll(r)}}function ip(t){t.command("sync-users").description("Sync users from all configured Jira instances").action(async()=>{try{let e=await vx(Wn);ee(`Synced ${String(e.userCount)} user(s).`);}catch(e){let r=e instanceof Error?e.message:String(e);se(r),process.exitCode=1;}});}we();async function wx(t,e){let r=join(t,"workflows.json"),n=new hn(r);await n.load();let o=n.getProjectWorkflow(e);if(!o)return {projectKey:e,rows:[]};let s=Object.entries(o.issue_types).map(([i,a])=>({issueType:i,statuses:a.statuses}));return {projectKey:e,rows:s}}function ap(t){t.command("list-workflows <project>").description("Show cached workflow statuses for a project").action(async e=>{try{let r=await wx(rr,e);if(r.rows.length===0){ee(`No workflow data cached for project '${e}'. Run: jira-mcp cache sync-workflows`);return}let n=r.rows.map(o=>[o.issueType,o.statuses.join(", ")]);tn(["ISSUE TYPE","STATUSES"],n),ee(`
|
|
152
|
+
${String(r.rows.length)} issue type(s) for project '${e}'.`);}catch(r){let n=r instanceof Error?r.message:String(r);se(n),process.exitCode=1;}});}we();async function bx(t){let e=join(t,"users.json"),r=new gn(e);return await r.load(),r.getAllUsers()}function cp(t){t.command("list-users").description("Show all cached Jira users").action(async()=>{try{let e=await bx(rr);if(e.length===0){ee("No users cached. Run: jira-mcp cache sync-users");return}let r=e.map(n=>[n.display_name,n.email??"-",n.account_id,n.active?"yes":"no"]);tn(["NAME","EMAIL","ACCOUNT ID","ACTIVE"],r),ee(`
|
|
153
|
+
${String(e.length)} user(s) cached.`);}catch(e){let r=e instanceof Error?e.message:String(e);se(r),process.exitCode=1;}});}function up(t){let e=t.command("cache").description("Manage workflow and user caches");sp(e),ip(e),ap(e),cp(e);}dn();ro();var $x=k.object({summary:k.string().min(1,"Summary is required").max(255),description:k.string().optional().default(""),type:k.string().default("Task"),assignee:k.string().email("Invalid assignee email format").optional(),priority:k.enum(["Highest","High","Medium","Low","Lowest"]).default("Medium"),labels:k.array(k.string()).default([]),estimate_hours:k.number().positive("Estimate must be positive").optional(),status:k.string().optional()}).catchall(k.string().optional()),Sx=k.object({dry_run:k.boolean().default(true),update_existing:k.boolean().default(false),match_field:k.string().default("summary"),rate_limit_ms:k.number().int().min(0).default(500),force_reassign:k.boolean().default(false),reassign_delay_ms:k.number().int().min(0).default(0),language:ar.default(Mr)}),Ss=k.object({epic_key:k.string().regex(/^[A-Z][A-Z0-9]*-\d+$/,"Invalid epic key format (e.g., PROJ-123)"),tasks:k.array($x).min(1,"At least one task is required"),options:Sx.default({})});function Tx(t){let e=new Date;return {MONTH:`${String(e.getMonth()+1).padStart(2,"0")}.${e.getFullYear()}`,YEAR:String(e.getFullYear()),DATE:e.toISOString().slice(0,10)}}function Ts(t,e){let r=Tx(),n=JSON.stringify(t);return n=n.replaceAll("{MONTH}",r.MONTH),n=n.replaceAll("{YEAR}",r.YEAR),n=n.replaceAll("{DATE}",r.DATE),JSON.parse(n)}ro();co();_t();Oa();function yp(t){return new Promise(e=>setTimeout(e,t))}var Na=class extends ht{constructor(e){super(e,"EPIC_NOT_FOUND"),this.name="EpicNotFoundError";}},Ps=class extends ht{constructor(e){super(e,"EPIC_LINK_FIELD_NOT_FOUND"),this.name="EpicLinkFieldNotFoundError";}},yn=class{constructor(e,r){this.connector=e;this.projectKey=r;}connector;projectKey;epicLinkFieldId=null;assigneeCache=new Map;async execute(e){let r=Date.now(),n=e.epic_key,o=e.options;if(!await this.validateEpic(n))throw new Na(`Epic '${n}' not found or not accessible`);this.epicLinkFieldId=await this.discoverEpicLinkField();let i=new Set;for(let l of e.tasks)l.assignee&&i.add(l.assignee);for(let l of i)try{await this.resolveAssignee(l);}catch{}let a=[];for(let l=0;l<e.tasks.length;l++){l>0&&o.rate_limit_ms>0&&await yp(o.rate_limit_ms);let d=e.tasks[l];if(!d)continue;let p=await this.processTask(d,n,o);a.push(p);}let c=Ax(a),u=Date.now()-r;return {results:a,summary:c,dry_run:o.dry_run,total_time_ms:u}}async validateEpic(e){try{return await this.connector.getIssue(e),!0}catch{return false}}async discoverEpicLinkField(){let e;try{e=await this.connector.getFields();}catch(r){let n=r instanceof Error?r.message:String(r);throw new Ps(`Failed to fetch fields from Jira: ${n}`)}for(let r of e){if(r.name.toLowerCase().includes("epic link"))return r.id;let o=r.schema?.custom??"";if(o.includes("epic-link")||o.includes("gh-epic-link"))return r.id}throw new Ps("Epic Link custom field not found. Ensure Jira instance has Epic support enabled.")}async resolveAssignee(e){let r=this.assigneeCache.get(e);if(r!==void 0)return r;let n=await this.connector.findUser(e);return this.assigneeCache.set(e,n),n}async processTask(e,r,n){let o=this.selectSummary(e,n.language);if(n.dry_run)return {summary:o,issue_key:null,action:"preview",error:null,url:null};try{let s=await this.findExistingTask(o,this.projectKey);if(s!==null)return n.update_existing?(await this.updateTask(s,e,r,this.epicLinkFieldId,n),{summary:o,issue_key:s,action:"updated",error:null,url:`${this.connector.instanceUrl}/browse/${s}`}):{summary:o,issue_key:s,action:"skipped",error:null,url:`${this.connector.instanceUrl}/browse/${s}`};let i=await this.createTask(e,r,this.epicLinkFieldId,n);return e.status&&await this.setStatus(i.key,e.status),n.force_reassign&&e.assignee&&await this.forceReassign(i.key,e.assignee,n.reassign_delay_ms),{summary:o,issue_key:i.key,action:"created",error:null,url:i.url}}catch(s){let i=s instanceof Error?s.message:String(s);return {summary:o,issue_key:null,action:"failed",error:i,url:null}}}async createTask(e,r,n,o){let s=this.selectSummary(e,o.language),i=this.selectDescription(e,o.language),a={project:{key:this.projectKey},summary:s,issuetype:{name:e.type??"Task"},priority:{name:e.priority??"Medium"}};if(i&&(a.description=Rt(i)),e.labels&&e.labels.length>0&&(a.labels=[...e.labels]),e.estimate_hours&&(a.timetracking={originalEstimate:`${e.estimate_hours}h`}),e.assignee){let u=this.assigneeCache.get(e.assignee);if(u!==void 0)a.assignee={accountId:u};else throw new yt(`Assignee not resolved: ${e.assignee}`)}n&&(a[n]=r);let c=await this.connector.createIssue(a);return {key:c.key,url:c.url}}async updateTask(e,r,n,o,s){let i=this.selectDescription(r,s.language),a={};if(i&&(a.description=Rt(i)),r.priority&&(a.priority={name:r.priority}),r.labels&&r.labels.length>0&&(a.labels=[...r.labels]),r.estimate_hours&&(a.timetracking={originalEstimate:`${r.estimate_hours}h`}),r.assignee){let c=this.assigneeCache.get(r.assignee);c!==void 0&&(a.assignee={accountId:c});}o&&(a[o]=n),Object.keys(a).length>0&&await this.connector.updateIssue(e,a),r.status&&await this.setStatus(e,r.status);}async findExistingTask(e,r){try{let n=zs(e),o=`project = "${r}" AND summary = "${n}"`,i=(await this.connector.searchIssues(o))[0];return i?i.key:null}catch{return null}}async setStatus(e,r){try{let o=(await this.connector.getTransitions(e)).find(s=>s.toStatus.toLowerCase()===r.toLowerCase());o&&await this.connector.doTransition(e,o.id);}catch{}}async forceReassign(e,r,n){let o=this.assigneeCache.get(r);if(o!==void 0){n>0&&await yp(n);try{await this.connector.assignIssue(e,o);}catch{}}}selectSummary(e,r){if(r!==Mr){let n=e[`summary_${r}`];if(n)return n}return e.summary}selectDescription(e,r){if(r!==Mr){let n=e[`description_${r}`];if(n)return n}return e.description||void 0}};function Ax(t){let e=0,r=0,n=0,o=0,s=0;for(let i of t)switch(i.action){case "created":e++;break;case "updated":r++;break;case "failed":n++;break;case "skipped":o++;break;case "preview":s++;break}return {created:e,updated:r,failed:n,skipped:o,previewed:s}}function Es(t){let e=[];e.push(t.dry_run?"=== DRY RUN ===":"=== EXECUTION RESULTS ==="),e.push("");for(let n of t.results){let o=n.action.toUpperCase(),s=n.issue_key??"(no key)",i=n.error?` - ${n.error}`:"";e.push(` [${o}] ${s}: ${n.summary}${i}`);}e.push(""),e.push("--- Summary ---");let{summary:r}=t;return t.dry_run?e.push(` Previewed: ${r.previewed}`):(e.push(` Created: ${r.created}`),e.push(` Updated: ${r.updated}`),e.push(` Skipped: ${r.skipped}`),e.push(` Failed: ${r.failed}`)),e.push(` Time: ${t.total_time_ms}ms`),e.join(`
|
|
154
|
+
`)}qr();mn();we();async function Zx(t,e){let{resolve:r,join:n}=await import('path'),{access:o}=await import('fs/promises'),s=en;if(t.endsWith(".json")){let c=r(t);try{return await o(c),c}catch{}}let i=r(t.endsWith(".json")?t:`${t}.json`);try{return await o(i),i}catch{}let a=n(s,t.endsWith(".json")?t:`${t}.json`);try{return await o(a),a}catch{}throw new Error(`Config not found: tried ${i} and ${a}`)}async function Mx(t,e,r){let{readFile:n}=await import('fs/promises'),o=await Zx(t),s=await n(o,"utf-8"),i=JSON.parse(s),a=Ss.safeParse(i);if(!a.success)throw new Error(`Invalid config: ${a.error.message}`);let c=Ts(a.data),l=await(jt)(),f="language"in(i.options??{}),h=c.epic_key.split("-")[0]??"",_=l.projects[h]?.language??l.default_language,w={...c,options:{...c.options,dry_run:e.execute!==true,...!f&&_?{language:_}:{}}},$=(($e=>new nt($e)))(l);if(!h)throw new Error(`Invalid epic_key format: '${w.epic_key}'. Expected 'PROJECT-NUMBER'.`);let b=$.getConnector(h);return await(r?.createBulkCreator??(($e,Tt)=>new yn($e,Tt)))(b,h).execute(w)}function _p(t){t.command("create <config-path>").description("Create tasks from a bulk config file (dry-run by default)").option("--execute","Execute for real (default is dry-run)").action(async(e,r)=>{try{let n=await Mx(e,r);ee(Es(n));}catch(n){let o=n instanceof Error?n.message:String(n);se(o),process.exitCode=1;}});}qr();mn();we();async function Dx(t,e){let{readdir:r,stat:n,access:o}=await import('fs/promises'),{join:s}=await import('path'),i=en,a=[],c;try{let u=await r(i);c=(await Promise.all(u.map(async d=>{let p=await n(s(i,d));return {name:d,isDir:p.isDirectory()}}))).filter(d=>d.isDir).map(d=>d.name);}catch{return []}for(let u of c){if(t&&u.toUpperCase()!==t.toUpperCase())continue;let l=s(i,u,"monthly_admin.json");try{await o(l),a.push({projectKey:u.toUpperCase(),configPath:l});}catch{}}return a.sort((u,l)=>u.projectKey.localeCompare(l.projectKey)),a}async function qx(t,e){let{readFile:r}=await import('fs/promises'),n=await Dx(t.project);if(n.length===0)return {configs:[],totalProcessed:0,totalFailed:0};let s=await(jt)(),a=((l=>new nt(l)))(s),c=[],u=0;for(let l of n)try{let d=await r(l.configPath,"utf-8"),p=JSON.parse(d),f=Ss.safeParse(p);if(!f.success){c.push({projectKey:l.projectKey,configPath:l.configPath,error:`Invalid config: ${f.error.message}`}),u++;continue}let h=Ts(f.data),x="language"in(p.options??{}),$=h.epic_key.split("-")[0]??"",b=s.projects[$]?.language??s.default_language,R={...h,options:{...h.options,dry_run:t.execute!==!0,...!x&&b?{language:b}:{}}};if(!$){c.push({projectKey:l.projectKey,configPath:l.configPath,error:`Invalid epic_key format: '${R.epic_key}'`}),u++;continue}let I=a.getConnector($),Tt=await(e?.createBulkCreator??((Bn,wr)=>new yn(Bn,wr)))(I,$).execute(R);c.push({projectKey:l.projectKey,configPath:l.configPath,result:Tt});}catch(d){let p=d instanceof Error?d.message:String(d);c.push({projectKey:l.projectKey,configPath:l.configPath,error:p}),u++;}return {configs:c,totalProcessed:n.length,totalFailed:u}}function Lx(t){let e=[];if(t.totalProcessed===0)return e.push("No monthly_admin.json configs found."),e.join(`
|
|
155
|
+
`);e.push(`Processing ${String(t.totalProcessed)} monthly config(s)...`),e.push("");for(let r of t.configs)e.push(`--- ${r.projectKey} ---`),r.error?e.push(` Error: ${r.error}`):r.result&&e.push(Es(r.result)),e.push("");return e.push(`Completed: ${String(t.totalProcessed-t.totalFailed)} succeeded, ${String(t.totalFailed)} failed`),e.join(`
|
|
156
|
+
`)}function vp(t){t.command("create-monthly").description("Run all monthly_admin.json configs from templates (dry-run by default)").option("--execute","Execute for real (default is dry-run)").option("--project <key>","Filter to a specific project key").action(async e=>{try{let r=await qx(e);if(r.totalProcessed===0){ps("No monthly_admin.json configs found in templates directory.");return}ee(Lx(r));}catch(r){let n=r instanceof Error?r.message:String(r);se(n),process.exitCode=1;}});}function ok(){let t=new Command().name("jira-mcp").description("Jira MCP server and CLI tools").version(ls,"-v, --version");return t.action(async()=>{let{startServer:e}=await Promise.resolve().then(()=>(bd(),xd));await e();}),t.command("serve").description("Start the MCP server (default behavior)").action(async()=>{let{startServer:e}=await Promise.resolve().then(()=>(bd(),xd));await e();}),tp(t),up(t),_p(t),vp(t),t.addHelpText("after",`
|
|
157
|
+
All commands:
|
|
158
|
+
serve Start the MCP server (default behavior)
|
|
159
|
+
create <config-path> Create tasks from a bulk config file (dry-run by default)
|
|
160
|
+
create-monthly Run all monthly_admin.json configs from templates
|
|
161
|
+
|
|
162
|
+
config init Initialize global config at ~/.softspark/jira-mcp/
|
|
163
|
+
config add-project <key> <url> Add a Jira project
|
|
164
|
+
config remove-project <key> Remove a project
|
|
165
|
+
config list-projects List configured projects
|
|
166
|
+
config set-credentials Set API credentials
|
|
167
|
+
config set-default <key> Set default project
|
|
168
|
+
config set-language <lang> Set default language (pl, en, de, es, fr, pt, it, nl)
|
|
169
|
+
config set-project-language <key> <lang> Set language for a specific project
|
|
170
|
+
|
|
171
|
+
cache sync-workflows Sync workflow status transitions
|
|
172
|
+
cache sync-users Sync user list
|
|
173
|
+
cache list-workflows Show cached workflows
|
|
174
|
+
cache list-users Show cached users
|
|
175
|
+
`),t}var wj=ok();wj.parseAsync(process.argv).catch(t=>{console.error("Fatal error:",t),process.exit(1);});//# sourceMappingURL=cli.js.map
|
|
176
|
+
//# sourceMappingURL=cli.js.map
|