@agent-sandbox/mcp 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/stdio.js ADDED
@@ -0,0 +1,194 @@
1
+ #!/usr/bin/env node
2
+ (()=>{"use strict";var e,t,r,a,s={731(e){e.exports=require("bun")},499(e,t,r){r.d(t,{E3:()=>s,ES:()=>i,Yl:()=>a});let a={"src/tools/as_attach.ts":()=>r.e("335").then(r.bind(r,914)),"src/tools/as_create.ts":()=>r.e("268").then(r.bind(r,359)),"src/tools/as_delete.ts":()=>r.e("397").then(r.bind(r,588)),"src/tools/as_detach.ts":()=>r.e("165").then(r.bind(r,876)),"src/tools/as_read.ts":()=>r.e("952").then(r.bind(r,851)),"src/tools/as_write.ts":()=>r.e("437").then(r.bind(r,828))},s={},i={}}},i={};function n(e){var t=i[e];if(void 0!==t)return t.exports;var r=i[e]={exports:{}};return s[e](r,r.exports,n),r.exports}n.m=s,n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.f={},n.e=e=>Promise.all(Object.keys(n.f).reduce((t,r)=>(n.f[r](e,t),t),[])),n.u=e=>""+e+".js",n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},e={435:1},n.f.require=(t,r)=>{e[t]||(t=>{var r=t.modules,a=t.ids,s=t.runtime;for(var i in r)n.o(r,i)&&(n.m[i]=r[i]);s&&s(n);for(var o=0;o<a.length;o++)e[a[o]]=1})(require("./"+n.u(t)))};var o={};n.r(o),t=n(499).Yl,r=n(499).E3,a=n(499).ES,function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var r=t();for(var a in r)("object"==typeof exports?exports:e)[a]=r[a]}}(void 0,()=>(()=>{var e={2058(e,t){function r(e,t){return{validate:e,compare:t}}Object.defineProperty(t,"__esModule",{value:!0}),t.formatNames=t.fastFormats=t.fullFormats=void 0,t.fullFormats={date:r(i,n),time:r(l(!0),d),"date-time":r(p(!0),h),"iso-time":r(l(),u),"iso-date-time":r(p(),m),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:function(e){return f.test(e)&&g.test(e)},"uri-reference":/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,"uri-template":/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,url:/^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/,ipv6:/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,regex:function(e){if(w.test(e))return!1;try{return new RegExp(e),!0}catch(e){return!1}},uuid:/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,"json-pointer":/^(?:\/(?:[^~/]|~0|~1)*)*$/,"json-pointer-uri-fragment":/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,"relative-json-pointer":/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,byte:function(e){return y.lastIndex=0,y.test(e)},int32:{type:"number",validate:function(e){return Number.isInteger(e)&&e<=_&&e>=v}},int64:{type:"number",validate:function(e){return Number.isInteger(e)}},float:{type:"number",validate:b},double:{type:"number",validate:b},password:!0,binary:!0},t.fastFormats={...t.fullFormats,date:r(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,n),time:r(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,d),"date-time":r(/^\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,h),"iso-time":r(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,u),"iso-date-time":r(/^\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,m),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},t.formatNames=Object.keys(t.fullFormats);let a=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,s=[0,31,28,31,30,31,30,31,31,30,31,30,31];function i(e){var t;let r=a.exec(e);if(!r)return!1;let i=+r[1],n=+r[2],o=+r[3];return n>=1&&n<=12&&o>=1&&o<=(2===n&&(t=i)%4==0&&(t%100!=0||t%400==0)?29:s[n])}function n(e,t){if(e&&t)return e>t?1:e<t?-1:0}let o=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function l(e){return function(t){let r=o.exec(t);if(!r)return!1;let a=+r[1],s=+r[2],i=+r[3],n=r[4],l="-"===r[5]?-1:1,d=+(r[6]||0),u=+(r[7]||0);if(d>23||u>59||e&&!n)return!1;if(a<=23&&s<=59&&i<60)return!0;let c=s-u*l,p=a-d*l-(c<0);return(23===p||-1===p)&&(59===c||-1===c)&&i<61}}function d(e,t){if(!(e&&t))return;let r=new Date("2020-01-01T"+e).valueOf(),a=new Date("2020-01-01T"+t).valueOf();if(r&&a)return r-a}function u(e,t){if(!(e&&t))return;let r=o.exec(e),a=o.exec(t);if(r&&a)return(e=r[1]+r[2]+r[3])>(t=a[1]+a[2]+a[3])?1:e<t?-1:0}let c=/t|\s/i;function p(e){let t=l(e);return function(e){let r=e.split(c);return 2===r.length&&i(r[0])&&t(r[1])}}function h(e,t){if(!(e&&t))return;let r=new Date(e).valueOf(),a=new Date(t).valueOf();if(r&&a)return r-a}function m(e,t){if(!(e&&t))return;let[r,a]=e.split(c),[s,i]=t.split(c),o=n(r,s);if(void 0!==o)return o||d(a,i)}let f=/\/|:/,g=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,y=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm,v=-0x80000000,_=0x7fffffff;function b(){return!0}let w=/[^\\]\\Z/},494(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});let a=r(2058),s=r(7122),i=r(6556),n=new i.Name("fullFormats"),o=new i.Name("fastFormats"),l=(e,t={keywords:!0})=>{if(Array.isArray(t))return d(e,t,a.fullFormats,n),e;let[r,i]="fast"===t.mode?[a.fastFormats,o]:[a.fullFormats,n];return d(e,t.formats||a.formatNames,r,i),t.keywords&&(0,s.default)(e),e};function d(e,t,r,a){var s;for(let n of(null!=(s=e.opts.code).formats||(s.formats=(0,i._)`require("ajv-formats/dist/formats").${a}`),t))e.addFormat(n,r[n])}l.get=(e,t="full")=>{let r=("fast"===t?a.fastFormats:a.fullFormats)[e];if(!r)throw Error(`Unknown format "${e}"`);return r},e.exports=t=l,Object.defineProperty(t,"__esModule",{value:!0}),t.default=l},7122(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.formatLimitDefinition=void 0;let a=r(4319),s=r(6556),i=s.operators,n={formatMaximum:{okStr:"<=",ok:i.LTE,fail:i.GT},formatMinimum:{okStr:">=",ok:i.GTE,fail:i.LT},formatExclusiveMaximum:{okStr:"<",ok:i.LT,fail:i.GTE},formatExclusiveMinimum:{okStr:">",ok:i.GT,fail:i.LTE}};t.formatLimitDefinition={keyword:Object.keys(n),type:"string",schemaType:"string",$data:!0,error:{message:({keyword:e,schemaCode:t})=>(0,s.str)`should be ${n[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>(0,s._)`{comparison: ${n[e].okStr}, limit: ${t}}`},code(e){let t,r,{gen:i,data:o,schemaCode:l,keyword:d,it:u}=e,{opts:c,self:p}=u;if(!c.validateFormats)return;let h=new a.KeywordCxt(u,p.RULES.all.format.definition,"format");function m(e){return(0,s._)`${e}.compare(${o}, ${l}) ${n[d].fail} 0`}h.$data?(t=i.scopeValue("formats",{ref:p.formats,code:c.code.formats}),r=i.const("fmt",(0,s._)`${t}[${h.schemaCode}]`),e.fail$data((0,s.or)((0,s._)`typeof ${r} != "object"`,(0,s._)`${r} instanceof RegExp`,(0,s._)`typeof ${r}.compare != "function"`,m(r)))):function(){let t=h.schema,r=p.formats[t];if(!r||!0===r)return;if("object"!=typeof r||r instanceof RegExp||"function"!=typeof r.compare)throw Error(`"${d}": format "${t}" does not define "compare" function`);let a=i.scopeValue("formats",{key:t,ref:r,code:c.code.formats?(0,s._)`${c.code.formats}${(0,s.getProperty)(t)}`:void 0});e.fail$data(m(a))}()},dependencies:["format"]},t.default=e=>(e.addKeyword(t.formatLimitDefinition),e)},4319(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.MissingRefError=t.ValidationError=t.CodeGen=t.Name=t.nil=t.stringify=t.str=t._=t.KeywordCxt=t.Ajv=void 0;let a=r(7285),s=r(8181),i=r(2278),n=r(7578),o=["/properties"],l="http://json-schema.org/draft-07/schema";class d extends a.default{_addVocabularies(){super._addVocabularies(),s.default.forEach(e=>this.addVocabulary(e)),this.opts.discriminator&&this.addKeyword(i.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let e=this.opts.$data?this.$dataMetaSchema(n,o):n;this.addMetaSchema(e,l,!1),this.refs["http://json-schema.org/schema"]=l}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(l)?l:void 0)}}t.Ajv=d,e.exports=t=d,e.exports.Ajv=d,Object.defineProperty(t,"__esModule",{value:!0}),t.default=d;var u=r(6889);Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return u.KeywordCxt}});var c=r(6556);Object.defineProperty(t,"_",{enumerable:!0,get:function(){return c._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return c.str}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return c.stringify}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return c.nil}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return c.Name}}),Object.defineProperty(t,"CodeGen",{enumerable:!0,get:function(){return c.CodeGen}});var p=r(9645);Object.defineProperty(t,"ValidationError",{enumerable:!0,get:function(){return p.default}});var h=r(218);Object.defineProperty(t,"MissingRefError",{enumerable:!0,get:function(){return h.default}})},1175(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.regexpCode=t.getEsmExportName=t.getProperty=t.safeStringify=t.stringify=t.strConcat=t.addCodeArg=t.str=t._=t.nil=t._Code=t.Name=t.IDENTIFIER=t._CodeOrName=void 0;class r{}t._CodeOrName=r,t.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class a extends r{constructor(e){if(super(),!t.IDENTIFIER.test(e))throw Error("CodeGen: name must be a valid identifier");this.str=e}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}}t.Name=a;class s extends r{constructor(e){super(),this._items="string"==typeof e?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let e=this._items[0];return""===e||'""'===e}get str(){var e;return null!=(e=this._str)?e:this._str=this._items.reduce((e,t)=>`${e}${t}`,"")}get names(){var e;return null!=(e=this._names)?e:this._names=this._items.reduce((e,t)=>(t instanceof a&&(e[t.str]=(e[t.str]||0)+1),e),{})}}function i(e,...t){let r=[e[0]],a=0;for(;a<t.length;)l(r,t[a]),r.push(e[++a]);return new s(r)}t._Code=s,t.nil=new s(""),t._=i;let n=new s("+");function o(e,...t){let r=[d(e[0])],i=0;for(;i<t.length;)r.push(n),l(r,t[i]),r.push(n,d(e[++i]));return function(e){let t=1;for(;t<e.length-1;){if(e[t]===n){var r,s;let i=(r=e[t-1],'""'===(s=e[t+1])?r:'""'===r?s:"string"==typeof r?s instanceof a||'"'!==r[r.length-1]?void 0:"string"!=typeof s?`${r.slice(0,-1)}${s}"`:'"'===s[0]?r.slice(0,-1)+s.slice(1):void 0:"string"!=typeof s||'"'!==s[0]||r instanceof a?void 0:`"${r}${s.slice(1)}`);if(void 0!==i){e.splice(t-1,3,i);continue}e[t++]="+"}t++}}(r),new s(r)}function l(e,t){t instanceof s?e.push(...t._items):t instanceof a?e.push(t):e.push("number"==typeof t||"boolean"==typeof t||null===t?t:d(Array.isArray(t)?t.join(","):t))}function d(e){return JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}t.str=o,t.addCodeArg=l,t.strConcat=function(e,t){return t.emptyStr()?e:e.emptyStr()?t:o`${e}${t}`},t.stringify=function(e){return new s(d(e))},t.safeStringify=d,t.getProperty=function(e){return"string"==typeof e&&t.IDENTIFIER.test(e)?new s(`.${e}`):i`[${e}]`},t.getEsmExportName=function(e){if("string"==typeof e&&t.IDENTIFIER.test(e))return new s(`${e}`);throw Error(`CodeGen: invalid export name: ${e}, use explicit $id name mapping`)},t.regexpCode=function(e){return new s(e.toString())}},6556(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.or=t.and=t.not=t.CodeGen=t.operators=t.varKinds=t.ValueScopeName=t.ValueScope=t.Scope=t.Name=t.regexpCode=t.stringify=t.getProperty=t.nil=t.strConcat=t.str=t._=void 0;let a=r(1175),s=r(7100);var i=r(1175);Object.defineProperty(t,"_",{enumerable:!0,get:function(){return i._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return i.str}}),Object.defineProperty(t,"strConcat",{enumerable:!0,get:function(){return i.strConcat}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return i.nil}}),Object.defineProperty(t,"getProperty",{enumerable:!0,get:function(){return i.getProperty}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return i.stringify}}),Object.defineProperty(t,"regexpCode",{enumerable:!0,get:function(){return i.regexpCode}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return i.Name}});var n=r(7100);Object.defineProperty(t,"Scope",{enumerable:!0,get:function(){return n.Scope}}),Object.defineProperty(t,"ValueScope",{enumerable:!0,get:function(){return n.ValueScope}}),Object.defineProperty(t,"ValueScopeName",{enumerable:!0,get:function(){return n.ValueScopeName}}),Object.defineProperty(t,"varKinds",{enumerable:!0,get:function(){return n.varKinds}}),t.operators={GT:new a._Code(">"),GTE:new a._Code(">="),LT:new a._Code("<"),LTE:new a._Code("<="),EQ:new a._Code("==="),NEQ:new a._Code("!=="),NOT:new a._Code("!"),OR:new a._Code("||"),AND:new a._Code("&&"),ADD:new a._Code("+")};class o{optimizeNodes(){return this}optimizeNames(e,t){return this}}class l extends o{constructor(e,t,r){super(),this.varKind=e,this.name=t,this.rhs=r}render({es5:e,_n:t}){let r=e?s.varKinds.var:this.varKind,a=void 0===this.rhs?"":` = ${this.rhs}`;return`${r} ${this.name}${a};`+t}optimizeNames(e,t){if(e[this.name.str])return this.rhs&&(this.rhs=I(this.rhs,e,t)),this}get names(){return this.rhs instanceof a._CodeOrName?this.rhs.names:{}}}class d extends o{constructor(e,t,r){super(),this.lhs=e,this.rhs=t,this.sideEffects=r}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,t){if(!(this.lhs instanceof a.Name)||e[this.lhs.str]||this.sideEffects)return this.rhs=I(this.rhs,e,t),this}get names(){return O(this.lhs instanceof a.Name?{}:{...this.lhs.names},this.rhs)}}class u extends d{constructor(e,t,r,a){super(e,r,a),this.op=t}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}}class c extends o{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}}class p extends o{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){let t=this.label?` ${this.label}`:"";return`break${t};`+e}}class h extends o{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}}class m extends o{constructor(e){super(),this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,t){return this.code=I(this.code,e,t),this}get names(){return this.code instanceof a._CodeOrName?this.code.names:{}}}class f extends o{constructor(e=[]){super(),this.nodes=e}render(e){return this.nodes.reduce((t,r)=>t+r.render(e),"")}optimizeNodes(){let{nodes:e}=this,t=e.length;for(;t--;){let r=e[t].optimizeNodes();Array.isArray(r)?e.splice(t,1,...r):r?e[t]=r:e.splice(t,1)}return e.length>0?this:void 0}optimizeNames(e,t){let{nodes:r}=this,a=r.length;for(;a--;){let s=r[a];s.optimizeNames(e,t)||(function(e,t){for(let r in t)e[r]=(e[r]||0)-(t[r]||0)}(e,s.names),r.splice(a,1))}return r.length>0?this:void 0}get names(){return this.nodes.reduce((e,t)=>j(e,t.names),{})}}class g extends f{render(e){return"{"+e._n+super.render(e)+"}"+e._n}}class y extends f{}class v extends g{}v.kind="else";class _ extends g{constructor(e,t){super(t),this.condition=e}render(e){let t=`if(${this.condition})`+super.render(e);return this.else&&(t+="else "+this.else.render(e)),t}optimizeNodes(){super.optimizeNodes();let e=this.condition;if(!0===e)return this.nodes;let t=this.else;if(t){let e=t.optimizeNodes();t=this.else=Array.isArray(e)?new v(e):e}return t?!1===e?t instanceof _?t:t.nodes:this.nodes.length?this:new _(N(e),t instanceof _?[t]:t.nodes):!1!==e&&this.nodes.length?this:void 0}optimizeNames(e,t){var r;if(this.else=null==(r=this.else)?void 0:r.optimizeNames(e,t),super.optimizeNames(e,t)||this.else)return this.condition=I(this.condition,e,t),this}get names(){let e=super.names;return O(e,this.condition),this.else&&j(e,this.else.names),e}}_.kind="if";class b extends g{}b.kind="for";class w extends b{constructor(e){super(),this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,t){if(super.optimizeNames(e,t))return this.iteration=I(this.iteration,e,t),this}get names(){return j(super.names,this.iteration.names)}}class $ extends b{constructor(e,t,r,a){super(),this.varKind=e,this.name=t,this.from=r,this.to=a}render(e){let t=e.es5?s.varKinds.var:this.varKind,{name:r,from:a,to:i}=this;return`for(${t} ${r}=${a}; ${r}<${i}; ${r}++)`+super.render(e)}get names(){let e=O(super.names,this.from);return O(e,this.to)}}class k extends b{constructor(e,t,r,a){super(),this.loop=e,this.varKind=t,this.name=r,this.iterable=a}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,t){if(super.optimizeNames(e,t))return this.iterable=I(this.iterable,e,t),this}get names(){return j(super.names,this.iterable.names)}}class x extends g{constructor(e,t,r){super(),this.name=e,this.args=t,this.async=r}render(e){let t=this.async?"async ":"";return`${t}function ${this.name}(${this.args})`+super.render(e)}}x.kind="func";class S extends f{render(e){return"return "+super.render(e)}}S.kind="return";class T extends g{render(e){let t="try"+super.render(e);return this.catch&&(t+=this.catch.render(e)),this.finally&&(t+=this.finally.render(e)),t}optimizeNodes(){var e,t;return super.optimizeNodes(),null==(e=this.catch)||e.optimizeNodes(),null==(t=this.finally)||t.optimizeNodes(),this}optimizeNames(e,t){var r,a;return super.optimizeNames(e,t),null==(r=this.catch)||r.optimizeNames(e,t),null==(a=this.finally)||a.optimizeNames(e,t),this}get names(){let e=super.names;return this.catch&&j(e,this.catch.names),this.finally&&j(e,this.finally.names),e}}class E extends g{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}}E.kind="catch";class P extends g{render(e){return"finally"+super.render(e)}}function j(e,t){for(let r in t)e[r]=(e[r]||0)+(t[r]||0);return e}function O(e,t){return t instanceof a._CodeOrName?j(e,t.names):e}function I(e,t,r){if(e instanceof a.Name)return s(e);if(!(e instanceof a._Code&&e._items.some(e=>e instanceof a.Name&&1===t[e.str]&&void 0!==r[e.str])))return e;return new a._Code(e._items.reduce((e,t)=>(t instanceof a.Name&&(t=s(t)),t instanceof a._Code?e.push(...t._items):e.push(t),e),[]));function s(e){let a=r[e.str];return void 0===a||1!==t[e.str]?e:(delete t[e.str],a)}}function N(e){return"boolean"==typeof e||"number"==typeof e||null===e?!e:(0,a._)`!${A(e)}`}P.kind="finally",t.CodeGen=class{constructor(e,t={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...t,_n:t.lines?"\n":""},this._extScope=e,this._scope=new s.Scope({parent:e}),this._nodes=[new y]}toString(){return this._root.render(this.opts)}name(e){return this._scope.name(e)}scopeName(e){return this._extScope.name(e)}scopeValue(e,t){let r=this._extScope.value(e,t);return(this._values[r.prefix]||(this._values[r.prefix]=new Set)).add(r),r}getScopeValue(e,t){return this._extScope.getValue(e,t)}scopeRefs(e){return this._extScope.scopeRefs(e,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(e,t,r,a){let s=this._scope.toName(t);return void 0!==r&&a&&(this._constants[s.str]=r),this._leafNode(new l(e,s,r)),s}const(e,t,r){return this._def(s.varKinds.const,e,t,r)}let(e,t,r){return this._def(s.varKinds.let,e,t,r)}var(e,t,r){return this._def(s.varKinds.var,e,t,r)}assign(e,t,r){return this._leafNode(new d(e,t,r))}add(e,r){return this._leafNode(new u(e,t.operators.ADD,r))}code(e){return"function"==typeof e?e():e!==a.nil&&this._leafNode(new m(e)),this}object(...e){let t=["{"];for(let[r,s]of e)t.length>1&&t.push(","),t.push(r),(r!==s||this.opts.es5)&&(t.push(":"),(0,a.addCodeArg)(t,s));return t.push("}"),new a._Code(t)}if(e,t,r){if(this._blockNode(new _(e)),t&&r)this.code(t).else().code(r).endIf();else if(t)this.code(t).endIf();else if(r)throw Error('CodeGen: "else" body without "then" body');return this}elseIf(e){return this._elseNode(new _(e))}else(){return this._elseNode(new v)}endIf(){return this._endBlockNode(_,v)}_for(e,t){return this._blockNode(e),t&&this.code(t).endFor(),this}for(e,t){return this._for(new w(e),t)}forRange(e,t,r,a,i=this.opts.es5?s.varKinds.var:s.varKinds.let){let n=this._scope.toName(e);return this._for(new $(i,n,t,r),()=>a(n))}forOf(e,t,r,i=s.varKinds.const){let n=this._scope.toName(e);if(this.opts.es5){let e=t instanceof a.Name?t:this.var("_arr",t);return this.forRange("_i",0,(0,a._)`${e}.length`,t=>{this.var(n,(0,a._)`${e}[${t}]`),r(n)})}return this._for(new k("of",i,n,t),()=>r(n))}forIn(e,t,r,i=this.opts.es5?s.varKinds.var:s.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,(0,a._)`Object.keys(${t})`,r);let n=this._scope.toName(e);return this._for(new k("in",i,n,t),()=>r(n))}endFor(){return this._endBlockNode(b)}label(e){return this._leafNode(new c(e))}break(e){return this._leafNode(new p(e))}return(e){let t=new S;if(this._blockNode(t),this.code(e),1!==t.nodes.length)throw Error('CodeGen: "return" should have one node');return this._endBlockNode(S)}try(e,t,r){if(!t&&!r)throw Error('CodeGen: "try" without "catch" and "finally"');let a=new T;if(this._blockNode(a),this.code(e),t){let e=this.name("e");this._currNode=a.catch=new E(e),t(e)}return r&&(this._currNode=a.finally=new P,this.code(r)),this._endBlockNode(E,P)}throw(e){return this._leafNode(new h(e))}block(e,t){return this._blockStarts.push(this._nodes.length),e&&this.code(e).endBlock(t),this}endBlock(e){let t=this._blockStarts.pop();if(void 0===t)throw Error("CodeGen: not in self-balancing block");let r=this._nodes.length-t;if(r<0||void 0!==e&&r!==e)throw Error(`CodeGen: wrong number of nodes: ${r} vs ${e} expected`);return this._nodes.length=t,this}func(e,t=a.nil,r,s){return this._blockNode(new x(e,t,r)),s&&this.code(s).endFunc(),this}endFunc(){return this._endBlockNode(x)}optimize(e=1){for(;e-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(e){return this._currNode.nodes.push(e),this}_blockNode(e){this._currNode.nodes.push(e),this._nodes.push(e)}_endBlockNode(e,t){let r=this._currNode;if(r instanceof e||t&&r instanceof t)return this._nodes.pop(),this;throw Error(`CodeGen: not in block "${t?`${e.kind}/${t.kind}`:e.kind}"`)}_elseNode(e){let t=this._currNode;if(!(t instanceof _))throw Error('CodeGen: "else" without "if"');return this._currNode=t.else=e,this}get _root(){return this._nodes[0]}get _currNode(){let e=this._nodes;return e[e.length-1]}set _currNode(e){let t=this._nodes;t[t.length-1]=e}},t.not=N;let z=C(t.operators.AND);t.and=function(...e){return e.reduce(z)};let R=C(t.operators.OR);function C(e){return(t,r)=>t===a.nil?r:r===a.nil?t:(0,a._)`${A(t)} ${e} ${A(r)}`}function A(e){return e instanceof a.Name?e:(0,a._)`(${e})`}t.or=function(...e){return e.reduce(R)}},7100(e,t,r){var a,s;Object.defineProperty(t,"__esModule",{value:!0}),t.ValueScope=t.ValueScopeName=t.Scope=t.varKinds=t.UsedValueState=void 0;let i=r(1175);class n extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}}(s=a||(t.UsedValueState=a={}))[s.Started=0]="Started",s[s.Completed=1]="Completed",t.varKinds={const:new i.Name("const"),let:new i.Name("let"),var:new i.Name("var")};class o{constructor({prefixes:e,parent:t}={}){this._names={},this._prefixes=e,this._parent=t}toName(e){return e instanceof i.Name?e:this.name(e)}name(e){return new i.Name(this._newName(e))}_newName(e){let t=this._names[e]||this._nameGroup(e);return`${e}${t.index++}`}_nameGroup(e){var t,r;if((null==(r=null==(t=this._parent)?void 0:t._prefixes)?void 0:r.has(e))||this._prefixes&&!this._prefixes.has(e))throw Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}}t.Scope=o;class l extends i.Name{constructor(e,t){super(t),this.prefix=e}setValue(e,{property:t,itemIndex:r}){this.value=e,this.scopePath=(0,i._)`.${new i.Name(t)}[${r}]`}}t.ValueScopeName=l;let d=(0,i._)`\n`;t.ValueScope=class extends o{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?d:i.nil}}get(){return this._scope}name(e){return new l(e,this._newName(e))}value(e,t){var r;if(void 0===t.ref)throw Error("CodeGen: ref must be passed in value");let a=this.toName(e),{prefix:s}=a,i=null!=(r=t.key)?r:t.ref,n=this._values[s];if(n){let e=n.get(i);if(e)return e}else n=this._values[s]=new Map;n.set(i,a);let o=this._scope[s]||(this._scope[s]=[]),l=o.length;return o[l]=t.ref,a.setValue(t,{property:s,itemIndex:l}),a}getValue(e,t){let r=this._values[e];if(r)return r.get(t)}scopeRefs(e,t=this._values){return this._reduceValues(t,t=>{if(void 0===t.scopePath)throw Error(`CodeGen: name "${t}" has no value`);return(0,i._)`${e}${t.scopePath}`})}scopeCode(e=this._values,t,r){return this._reduceValues(e,e=>{if(void 0===e.value)throw Error(`CodeGen: name "${e}" has no value`);return e.value.code},t,r)}_reduceValues(e,r,s={},o){let l=i.nil;for(let d in e){let u=e[d];if(!u)continue;let c=s[d]=s[d]||new Map;u.forEach(e=>{if(c.has(e))return;c.set(e,a.Started);let s=r(e);if(s){let r=this.opts.es5?t.varKinds.var:t.varKinds.const;l=(0,i._)`${l}${r} ${e} = ${s};${this.opts._n}`}else if(s=null==o?void 0:o(e))l=(0,i._)`${l}${s}${this.opts._n}`;else throw new n(e);c.set(e,a.Completed)})}return l}}},7747(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.extendErrors=t.resetErrorsCount=t.reportExtraError=t.reportError=t.keyword$DataError=t.keywordError=void 0;let a=r(6556),s=r(8512),i=r(4614);function n(e,t){let r=e.const("err",t);e.if((0,a._)`${i.default.vErrors} === null`,()=>e.assign(i.default.vErrors,(0,a._)`[${r}]`),(0,a._)`${i.default.vErrors}.push(${r})`),e.code((0,a._)`${i.default.errors}++`)}function o(e,t){let{gen:r,validateName:s,schemaEnv:i}=e;i.$async?r.throw((0,a._)`new ${e.ValidationError}(${t})`):(r.assign((0,a._)`${s}.errors`,t),r.return(!1))}t.keywordError={message:({keyword:e})=>(0,a.str)`must pass "${e}" keyword validation`},t.keyword$DataError={message:({keyword:e,schemaType:t})=>t?(0,a.str)`"${e}" keyword must be ${t} ($data)`:(0,a.str)`"${e}" keyword is invalid ($data)`},t.reportError=function(e,r=t.keywordError,s,i){let{it:l}=e,{gen:u,compositeRule:c,allErrors:p}=l,h=d(e,r,s);(null!=i?i:c||p)?n(u,h):o(l,(0,a._)`[${h}]`)},t.reportExtraError=function(e,r=t.keywordError,a){let{it:s}=e,{gen:l,compositeRule:u,allErrors:c}=s;n(l,d(e,r,a)),u||c||o(s,i.default.vErrors)},t.resetErrorsCount=function(e,t){e.assign(i.default.errors,t),e.if((0,a._)`${i.default.vErrors} !== null`,()=>e.if(t,()=>e.assign((0,a._)`${i.default.vErrors}.length`,t),()=>e.assign(i.default.vErrors,null)))},t.extendErrors=function({gen:e,keyword:t,schemaValue:r,data:s,errsCount:n,it:o}){if(void 0===n)throw Error("ajv implementation error");let l=e.name("err");e.forRange("i",n,i.default.errors,n=>{e.const(l,(0,a._)`${i.default.vErrors}[${n}]`),e.if((0,a._)`${l}.instancePath === undefined`,()=>e.assign((0,a._)`${l}.instancePath`,(0,a.strConcat)(i.default.instancePath,o.errorPath))),e.assign((0,a._)`${l}.schemaPath`,(0,a.str)`${o.errSchemaPath}/${t}`),o.opts.verbose&&(e.assign((0,a._)`${l}.schema`,r),e.assign((0,a._)`${l}.data`,s))})};let l={keyword:new a.Name("keyword"),schemaPath:new a.Name("schemaPath"),params:new a.Name("params"),propertyName:new a.Name("propertyName"),message:new a.Name("message"),schema:new a.Name("schema"),parentSchema:new a.Name("parentSchema")};function d(e,t,r){let{createErrors:n}=e.it;return!1===n?(0,a._)`{}`:function(e,t,r={}){let{gen:n,it:o}=e,d=[function({errorPath:e},{instancePath:t}){let r=t?(0,a.str)`${e}${(0,s.getErrorPath)(t,s.Type.Str)}`:e;return[i.default.instancePath,(0,a.strConcat)(i.default.instancePath,r)]}(o,r),function({keyword:e,it:{errSchemaPath:t}},{schemaPath:r,parentSchema:i}){let n=i?t:(0,a.str)`${t}/${e}`;return r&&(n=(0,a.str)`${n}${(0,s.getErrorPath)(r,s.Type.Str)}`),[l.schemaPath,n]}(e,r)];return function(e,{params:t,message:r},s){let{keyword:n,data:o,schemaValue:d,it:u}=e,{opts:c,propertyName:p,topSchemaRef:h,schemaPath:m}=u;s.push([l.keyword,n],[l.params,"function"==typeof t?t(e):t||(0,a._)`{}`]),c.messages&&s.push([l.message,"function"==typeof r?r(e):r]),c.verbose&&s.push([l.schema,d],[l.parentSchema,(0,a._)`${h}${m}`],[i.default.data,o]),p&&s.push([l.propertyName,p])}(e,t,d),n.object(...d)}(e,t,r)}},9198(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.resolveSchema=t.getCompilingSchema=t.resolveRef=t.compileSchema=t.SchemaEnv=void 0;let a=r(6556),s=r(9645),i=r(4614),n=r(234),o=r(8512),l=r(6889);class d{constructor(e){var t;let r;this.refs={},this.dynamicAnchors={},"object"==typeof e.schema&&(r=e.schema),this.schema=e.schema,this.schemaId=e.schemaId,this.root=e.root||this,this.baseId=null!=(t=e.baseId)?t:(0,n.normalizeId)(null==r?void 0:r[e.schemaId||"$id"]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=null==r?void 0:r.$async,this.refs={}}}function u(e){let t,r,o=p.call(this,e);if(o)return o;let d=(0,n.getFullPath)(this.opts.uriResolver,e.root.baseId),{es5:u,lines:c}=this.opts.code,{ownProperties:h}=this.opts,m=new a.CodeGen(this.scope,{es5:u,lines:c,ownProperties:h});e.$async&&(t=m.scopeValue("Error",{ref:s.default,code:(0,a._)`require("ajv/dist/runtime/validation_error").default`}));let f=m.scopeName("validate");e.validateName=f;let g={gen:m,allErrors:this.opts.allErrors,data:i.default.data,parentData:i.default.parentData,parentDataProperty:i.default.parentDataProperty,dataNames:[i.default.data],dataPathArr:[a.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:m.scopeValue("schema",!0===this.opts.code.source?{ref:e.schema,code:(0,a.stringify)(e.schema)}:{ref:e.schema}),validateName:f,ValidationError:t,schema:e.schema,schemaEnv:e,rootId:d,baseId:e.baseId||d,schemaPath:a.nil,errSchemaPath:e.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,a._)`""`,opts:this.opts,self:this};try{this._compilations.add(e),(0,l.validateFunctionCode)(g),m.optimize(this.opts.code.optimize);let t=m.toString();r=`${m.scopeRefs(i.default.scope)}return ${t}`,this.opts.code.process&&(r=this.opts.code.process(r,e));let s=Function(`${i.default.self}`,`${i.default.scope}`,r)(this,this.scope.get());if(this.scope.value(f,{ref:s}),s.errors=null,s.schema=e.schema,s.schemaEnv=e,e.$async&&(s.$async=!0),!0===this.opts.code.source&&(s.source={validateName:f,validateCode:t,scopeValues:m._values}),this.opts.unevaluated){let{props:e,items:t}=g;s.evaluated={props:e instanceof a.Name?void 0:e,items:t instanceof a.Name?void 0:t,dynamicProps:e instanceof a.Name,dynamicItems:t instanceof a.Name},s.source&&(s.source.evaluated=(0,a.stringify)(s.evaluated))}return e.validate=s,e}catch(t){throw delete e.validate,delete e.validateName,r&&this.logger.error("Error compiling schema, function code:",r),t}finally{this._compilations.delete(e)}}function c(e){return(0,n.inlineRef)(e.schema,this.opts.inlineRefs)?e.schema:e.validate?e:u.call(this,e)}function p(e){for(let t of this._compilations)if(t.schema===e.schema&&t.root===e.root&&t.baseId===e.baseId)return t}function h(e,t){let r;for(;"string"==typeof(r=this.refs[t]);)t=r;return r||this.schemas[t]||m.call(this,e,t)}function m(e,t){let r=this.opts.uriResolver.parse(t),a=(0,n._getFullPath)(this.opts.uriResolver,r),s=(0,n.getFullPath)(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&a===s)return g.call(this,r,e);let i=(0,n.normalizeId)(a),o=this.refs[i]||this.schemas[i];if("string"==typeof o){let t=m.call(this,e,o);if("object"!=typeof(null==t?void 0:t.schema))return;return g.call(this,r,t)}if("object"==typeof(null==o?void 0:o.schema)){if(o.validate||u.call(this,o),i===(0,n.normalizeId)(t)){let{schema:t}=o,{schemaId:r}=this.opts,a=t[r];return a&&(s=(0,n.resolveUrl)(this.opts.uriResolver,s,a)),new d({schema:t,schemaId:r,root:e,baseId:s})}return g.call(this,r,o)}}t.SchemaEnv=d,t.compileSchema=u,t.resolveRef=function(e,t,r){var a;r=(0,n.resolveUrl)(this.opts.uriResolver,t,r);let s=e.refs[r];if(s)return s;let i=h.call(this,e,r);if(void 0===i){let s=null==(a=e.localRefs)?void 0:a[r],{schemaId:n}=this.opts;s&&(i=new d({schema:s,schemaId:n,root:e,baseId:t}))}if(void 0!==i)return e.refs[r]=c.call(this,i)},t.getCompilingSchema=p,t.resolveSchema=m;let f=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function g(e,{baseId:t,schema:r,root:a}){var s;let i;if((null==(s=e.fragment)?void 0:s[0])!=="/")return;for(let a of e.fragment.slice(1).split("/")){if("boolean"==typeof r)return;let e=r[(0,o.unescapeFragment)(a)];if(void 0===e)return;let s="object"==typeof(r=e)&&r[this.opts.schemaId];!f.has(a)&&s&&(t=(0,n.resolveUrl)(this.opts.uriResolver,t,s))}if("boolean"!=typeof r&&r.$ref&&!(0,o.schemaHasRulesButRef)(r,this.RULES)){let e=(0,n.resolveUrl)(this.opts.uriResolver,t,r.$ref);i=m.call(this,a,e)}let{schemaId:l}=this.opts;if((i=i||new d({schema:r,schemaId:l,root:a,baseId:t})).schema!==i.root.schema)return i}},4614(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});let a=r(6556);t.default={data:new a.Name("data"),valCxt:new a.Name("valCxt"),instancePath:new a.Name("instancePath"),parentData:new a.Name("parentData"),parentDataProperty:new a.Name("parentDataProperty"),rootData:new a.Name("rootData"),dynamicAnchors:new a.Name("dynamicAnchors"),vErrors:new a.Name("vErrors"),errors:new a.Name("errors"),this:new a.Name("this"),self:new a.Name("self"),scope:new a.Name("scope"),json:new a.Name("json"),jsonPos:new a.Name("jsonPos"),jsonLen:new a.Name("jsonLen"),jsonPart:new a.Name("jsonPart")}},218(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});let a=r(234);t.default=class extends Error{constructor(e,t,r,s){super(s||`can't resolve reference ${r} from id ${t}`),this.missingRef=(0,a.resolveUrl)(e,t,r),this.missingSchema=(0,a.normalizeId)((0,a.getFullPath)(e,this.missingRef))}}},234(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.getSchemaRefs=t.resolveUrl=t.normalizeId=t._getFullPath=t.getFullPath=t.inlineRef=void 0;let a=r(8512),s=r(7371),i=r(205),n=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);t.inlineRef=function(e,t=!0){return"boolean"==typeof e||(!0===t?!function e(t){for(let r in t){if(o.has(r))return!0;let a=t[r];if(Array.isArray(a)&&a.some(e)||"object"==typeof a&&e(a))return!0}return!1}(e):!!t&&function e(t){let r=0;for(let s in t)if("$ref"===s||(r++,!n.has(s)&&("object"==typeof t[s]&&(0,a.eachItem)(t[s],t=>r+=e(t)),r===1/0)))return 1/0;return r}(e)<=t)};let o=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function l(e,t="",r){!1!==r&&(t=c(t));let a=e.parse(t);return d(e,a)}function d(e,t){return e.serialize(t).split("#")[0]+"#"}t.getFullPath=l,t._getFullPath=d;let u=/#\/?$/;function c(e){return e?e.replace(u,""):""}t.normalizeId=c,t.resolveUrl=function(e,t,r){return r=c(r),e.resolve(t,r)};let p=/^[a-z_][-a-z0-9._]*$/i;t.getSchemaRefs=function(e,t){if("boolean"==typeof e)return{};let{schemaId:r,uriResolver:a}=this.opts,n=c(e[r]||t),o={"":n},d=l(a,n,!1),u={},h=new Set;return i(e,{allKeys:!0},(e,t,a,s)=>{if(void 0===s)return;let i=d+t,n=o[s];function l(t){let r=this.opts.uriResolver.resolve;if(t=c(n?r(n,t):t),h.has(t))throw f(t);h.add(t);let a=this.refs[t];return"string"==typeof a&&(a=this.refs[a]),"object"==typeof a?m(e,a.schema,t):t!==c(i)&&("#"===t[0]?(m(e,u[t],t),u[t]=e):this.refs[t]=i),t}function g(e){if("string"==typeof e){if(!p.test(e))throw Error(`invalid anchor "${e}"`);l.call(this,`#${e}`)}}"string"==typeof e[r]&&(n=l.call(this,e[r])),g.call(this,e.$anchor),g.call(this,e.$dynamicAnchor),o[t]=n}),u;function m(e,t,r){if(void 0!==t&&!s(e,t))throw f(r)}function f(e){return Error(`reference "${e}" resolves to more than one schema`)}}},9881(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.getRules=t.isJSONType=void 0;let r=new Set(["string","number","integer","boolean","null","object","array"]);t.isJSONType=function(e){return"string"==typeof e&&r.has(e)},t.getRules=function(){let e={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...e,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},e.number,e.string,e.array,e.object],post:{rules:[]},all:{},keywords:{}}}},8512(e,t,r){var a,s;Object.defineProperty(t,"__esModule",{value:!0}),t.checkStrictMode=t.getErrorPath=t.Type=t.useFunc=t.setEvaluated=t.evaluatedPropsToName=t.mergeEvaluated=t.eachItem=t.unescapeJsonPointer=t.escapeJsonPointer=t.escapeFragment=t.unescapeFragment=t.schemaRefOrVal=t.schemaHasRulesButRef=t.schemaHasRules=t.checkUnknownRules=t.alwaysValidSchema=t.toHash=void 0;let i=r(6556),n=r(1175);function o(e,t=e.schema){let{opts:r,self:a}=e;if(!r.strictSchema||"boolean"==typeof t)return;let s=a.RULES.keywords;for(let r in t)s[r]||f(e,`unknown keyword: "${r}"`)}function l(e,t){if("boolean"==typeof e)return!e;for(let r in e)if(t[r])return!0;return!1}function d(e){return"number"==typeof e?`${e}`:e.replace(/~/g,"~0").replace(/\//g,"~1")}function u(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function c({mergeNames:e,mergeToName:t,mergeValues:r,resultToName:a}){return(s,n,o,l)=>{let d=void 0===o?n:o instanceof i.Name?(n instanceof i.Name?e(s,n,o):t(s,n,o),o):n instanceof i.Name?(t(s,o,n),n):r(n,o);return l!==i.Name||d instanceof i.Name?d:a(s,d)}}function p(e,t){if(!0===t)return e.var("props",!0);let r=e.var("props",(0,i._)`{}`);return void 0!==t&&h(e,r,t),r}function h(e,t,r){Object.keys(r).forEach(r=>e.assign((0,i._)`${t}${(0,i.getProperty)(r)}`,!0))}t.toHash=function(e){let t={};for(let r of e)t[r]=!0;return t},t.alwaysValidSchema=function(e,t){return"boolean"==typeof t?t:0===Object.keys(t).length||(o(e,t),!l(t,e.self.RULES.all))},t.checkUnknownRules=o,t.schemaHasRules=l,t.schemaHasRulesButRef=function(e,t){if("boolean"==typeof e)return!e;for(let r in e)if("$ref"!==r&&t.all[r])return!0;return!1},t.schemaRefOrVal=function({topSchemaRef:e,schemaPath:t},r,a,s){if(!s){if("number"==typeof r||"boolean"==typeof r)return r;if("string"==typeof r)return(0,i._)`${r}`}return(0,i._)`${e}${t}${(0,i.getProperty)(a)}`},t.unescapeFragment=function(e){return u(decodeURIComponent(e))},t.escapeFragment=function(e){return encodeURIComponent(d(e))},t.escapeJsonPointer=d,t.unescapeJsonPointer=u,t.eachItem=function(e,t){if(Array.isArray(e))for(let r of e)t(r);else t(e)},t.mergeEvaluated={props:c({mergeNames:(e,t,r)=>e.if((0,i._)`${r} !== true && ${t} !== undefined`,()=>{e.if((0,i._)`${t} === true`,()=>e.assign(r,!0),()=>e.assign(r,(0,i._)`${r} || {}`).code((0,i._)`Object.assign(${r}, ${t})`))}),mergeToName:(e,t,r)=>e.if((0,i._)`${r} !== true`,()=>{!0===t?e.assign(r,!0):(e.assign(r,(0,i._)`${r} || {}`),h(e,r,t))}),mergeValues:(e,t)=>!0===e||{...e,...t},resultToName:p}),items:c({mergeNames:(e,t,r)=>e.if((0,i._)`${r} !== true && ${t} !== undefined`,()=>e.assign(r,(0,i._)`${t} === true ? true : ${r} > ${t} ? ${r} : ${t}`)),mergeToName:(e,t,r)=>e.if((0,i._)`${r} !== true`,()=>e.assign(r,!0===t||(0,i._)`${r} > ${t} ? ${r} : ${t}`)),mergeValues:(e,t)=>!0===e||Math.max(e,t),resultToName:(e,t)=>e.var("items",t)})},t.evaluatedPropsToName=p,t.setEvaluated=h;let m={};function f(e,t,r=e.opts.strictSchema){if(r){if(t=`strict mode: ${t}`,!0===r)throw Error(t);e.self.logger.warn(t)}}t.useFunc=function(e,t){return e.scopeValue("func",{ref:t,code:m[t.code]||(m[t.code]=new n._Code(t.code))})},(s=a||(t.Type=a={}))[s.Num=0]="Num",s[s.Str=1]="Str",t.getErrorPath=function(e,t,r){if(e instanceof i.Name){let s=t===a.Num;return r?s?(0,i._)`"[" + ${e} + "]"`:(0,i._)`"['" + ${e} + "']"`:s?(0,i._)`"/" + ${e}`:(0,i._)`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,i.getProperty)(e).toString():"/"+d(e)},t.checkStrictMode=f},4204(e,t){function r(e,t){return t.rules.some(t=>a(e,t))}function a(e,t){var r;return void 0!==e[t.keyword]||(null==(r=t.definition.implements)?void 0:r.some(t=>void 0!==e[t]))}Object.defineProperty(t,"__esModule",{value:!0}),t.shouldUseRule=t.shouldUseGroup=t.schemaHasRulesForType=void 0,t.schemaHasRulesForType=function({schema:e,self:t},a){let s=t.RULES.types[a];return s&&!0!==s&&r(e,s)},t.shouldUseGroup=r,t.shouldUseRule=a},2882(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.boolOrEmptySchema=t.topBoolOrEmptySchema=void 0;let a=r(7747),s=r(6556),i=r(4614),n={message:"boolean schema is false"};function o(e,t){let{gen:r,data:s}=e;(0,a.reportError)({gen:r,keyword:"false schema",data:s,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:e},n,void 0,t)}t.topBoolOrEmptySchema=function(e){let{gen:t,schema:r,validateName:a}=e;!1===r?o(e,!1):"object"==typeof r&&!0===r.$async?t.return(i.default.data):(t.assign((0,s._)`${a}.errors`,null),t.return(!0))},t.boolOrEmptySchema=function(e,t){let{gen:r,schema:a}=e;!1===a?(r.var(t,!1),o(e)):r.var(t,!0)}},4029(e,t,r){var a,s;Object.defineProperty(t,"__esModule",{value:!0}),t.reportTypeError=t.checkDataTypes=t.checkDataType=t.coerceAndCheckDataType=t.getJSONTypes=t.getSchemaTypes=t.DataType=void 0;let i=r(9881),n=r(4204),o=r(7747),l=r(6556),d=r(8512);function u(e){let t=Array.isArray(e)?e:e?[e]:[];if(t.every(i.isJSONType))return t;throw Error("type must be JSONType or JSONType[]: "+t.join(","))}(s=a||(t.DataType=a={}))[s.Correct=0]="Correct",s[s.Wrong=1]="Wrong",t.getSchemaTypes=function(e){let t=u(e.type);if(t.includes("null")){if(!1===e.nullable)throw Error("type: null contradicts nullable: false")}else{if(!t.length&&void 0!==e.nullable)throw Error('"nullable" cannot be used without "type"');!0===e.nullable&&t.push("null")}return t},t.getJSONTypes=u,t.coerceAndCheckDataType=function(e,t){var r;let{gen:s,data:i,opts:o}=e,d=(r=o.coerceTypes)?t.filter(e=>c.has(e)||"array"===r&&"array"===e):[],u=t.length>0&&!(0===d.length&&1===t.length&&(0,n.schemaHasRulesForType)(e,t[0]));if(u){let r=h(t,i,o.strictNumbers,a.Wrong);s.if(r,()=>{d.length?function(e,t,r){let{gen:a,data:s,opts:i}=e,n=a.let("dataType",(0,l._)`typeof ${s}`),o=a.let("coerced",(0,l._)`undefined`);for(let e of("array"===i.coerceTypes&&a.if((0,l._)`${n} == 'object' && Array.isArray(${s}) && ${s}.length == 1`,()=>a.assign(s,(0,l._)`${s}[0]`).assign(n,(0,l._)`typeof ${s}`).if(h(t,s,i.strictNumbers),()=>a.assign(o,s))),a.if((0,l._)`${o} !== undefined`),r))(c.has(e)||"array"===e&&"array"===i.coerceTypes)&&function(e){switch(e){case"string":a.elseIf((0,l._)`${n} == "number" || ${n} == "boolean"`).assign(o,(0,l._)`"" + ${s}`).elseIf((0,l._)`${s} === null`).assign(o,(0,l._)`""`);return;case"number":a.elseIf((0,l._)`${n} == "boolean" || ${s} === null
3
+ || (${n} == "string" && ${s} && ${s} == +${s})`).assign(o,(0,l._)`+${s}`);return;case"integer":a.elseIf((0,l._)`${n} === "boolean" || ${s} === null
4
+ || (${n} === "string" && ${s} && ${s} == +${s} && !(${s} % 1))`).assign(o,(0,l._)`+${s}`);return;case"boolean":a.elseIf((0,l._)`${s} === "false" || ${s} === 0 || ${s} === null`).assign(o,!1).elseIf((0,l._)`${s} === "true" || ${s} === 1`).assign(o,!0);return;case"null":a.elseIf((0,l._)`${s} === "" || ${s} === 0 || ${s} === false`),a.assign(o,null);return;case"array":a.elseIf((0,l._)`${n} === "string" || ${n} === "number"
5
+ || ${n} === "boolean" || ${s} === null`).assign(o,(0,l._)`[${s}]`)}}(e);a.else(),f(e),a.endIf(),a.if((0,l._)`${o} !== undefined`,()=>{a.assign(s,o),function({gen:e,parentData:t,parentDataProperty:r},a){e.if((0,l._)`${t} !== undefined`,()=>e.assign((0,l._)`${t}[${r}]`,a))}(e,o)})}(e,t,d):f(e)})}return u};let c=new Set(["string","number","integer","boolean","null"]);function p(e,t,r,s=a.Correct){let i,n=s===a.Correct?l.operators.EQ:l.operators.NEQ;switch(e){case"null":return(0,l._)`${t} ${n} null`;case"array":i=(0,l._)`Array.isArray(${t})`;break;case"object":i=(0,l._)`${t} && typeof ${t} == "object" && !Array.isArray(${t})`;break;case"integer":i=o((0,l._)`!(${t} % 1) && !isNaN(${t})`);break;case"number":i=o();break;default:return(0,l._)`typeof ${t} ${n} ${e}`}return s===a.Correct?i:(0,l.not)(i);function o(e=l.nil){return(0,l.and)((0,l._)`typeof ${t} == "number"`,e,r?(0,l._)`isFinite(${t})`:l.nil)}}function h(e,t,r,a){let s;if(1===e.length)return p(e[0],t,r,a);let i=(0,d.toHash)(e);if(i.array&&i.object){let e=(0,l._)`typeof ${t} != "object"`;s=i.null?e:(0,l._)`!${t} || ${e}`,delete i.null,delete i.array,delete i.object}else s=l.nil;for(let e in i.number&&delete i.integer,i)s=(0,l.and)(s,p(e,t,r,a));return s}t.checkDataType=p,t.checkDataTypes=h;let m={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>"string"==typeof e?(0,l._)`{type: ${e}}`:(0,l._)`{type: ${t}}`};function f(e){let t=function(e){let{gen:t,data:r,schema:a}=e,s=(0,d.schemaRefOrVal)(e,a,"type");return{gen:t,keyword:"type",data:r,schema:a.type,schemaCode:s,schemaValue:s,parentSchema:a,params:{},it:e}}(e);(0,o.reportError)(t,m)}t.reportTypeError=f},6899(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.assignDefaults=void 0;let a=r(6556),s=r(8512);function i(e,t,r){let{gen:i,compositeRule:n,data:o,opts:l}=e;if(void 0===r)return;let d=(0,a._)`${o}${(0,a.getProperty)(t)}`;if(n)return void(0,s.checkStrictMode)(e,`default is ignored for: ${d}`);let u=(0,a._)`${d} === undefined`;"empty"===l.useDefaults&&(u=(0,a._)`${u} || ${d} === null || ${d} === ""`),i.if(u,(0,a._)`${d} = ${(0,a.stringify)(r)}`)}t.assignDefaults=function(e,t){let{properties:r,items:a}=e.schema;if("object"===t&&r)for(let t in r)i(e,t,r[t].default);else"array"===t&&Array.isArray(a)&&a.forEach((t,r)=>i(e,r,t.default))}},6889(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.getData=t.KeywordCxt=t.validateFunctionCode=void 0;let a=r(2882),s=r(4029),i=r(4204),n=r(4029),o=r(6899),l=r(1074),d=r(4456),u=r(6556),c=r(4614),p=r(234),h=r(8512),m=r(7747);function f({gen:e,validateName:t,schema:r,schemaEnv:a,opts:s},i){s.code.es5?e.func(t,(0,u._)`${c.default.data}, ${c.default.valCxt}`,a.$async,()=>{e.code((0,u._)`"use strict"; ${g(r,s)}`),e.if(c.default.valCxt,()=>{e.var(c.default.instancePath,(0,u._)`${c.default.valCxt}.${c.default.instancePath}`),e.var(c.default.parentData,(0,u._)`${c.default.valCxt}.${c.default.parentData}`),e.var(c.default.parentDataProperty,(0,u._)`${c.default.valCxt}.${c.default.parentDataProperty}`),e.var(c.default.rootData,(0,u._)`${c.default.valCxt}.${c.default.rootData}`),s.dynamicRef&&e.var(c.default.dynamicAnchors,(0,u._)`${c.default.valCxt}.${c.default.dynamicAnchors}`)},()=>{e.var(c.default.instancePath,(0,u._)`""`),e.var(c.default.parentData,(0,u._)`undefined`),e.var(c.default.parentDataProperty,(0,u._)`undefined`),e.var(c.default.rootData,c.default.data),s.dynamicRef&&e.var(c.default.dynamicAnchors,(0,u._)`{}`)}),e.code(i)}):e.func(t,(0,u._)`${c.default.data}, ${(0,u._)`{${c.default.instancePath}="", ${c.default.parentData}, ${c.default.parentDataProperty}, ${c.default.rootData}=${c.default.data}${s.dynamicRef?(0,u._)`, ${c.default.dynamicAnchors}={}`:u.nil}}={}`}`,a.$async,()=>e.code(g(r,s)).code(i))}function g(e,t){let r="object"==typeof e&&e[t.schemaId];return r&&(t.code.source||t.code.process)?(0,u._)`/*# sourceURL=${r} */`:u.nil}function y({schema:e,self:t}){if("boolean"==typeof e)return!e;for(let r in e)if(t.RULES.all[r])return!0;return!1}function v(e){return"boolean"!=typeof e.schema}function _(e){(0,h.checkUnknownRules)(e),function(e){let{schema:t,errSchemaPath:r,opts:a,self:s}=e;t.$ref&&a.ignoreKeywordsWithRef&&(0,h.schemaHasRulesButRef)(t,s.RULES)&&s.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}(e)}function b(e,t){if(e.opts.jtd)return $(e,[],!1,t);let r=(0,s.getSchemaTypes)(e.schema),a=(0,s.coerceAndCheckDataType)(e,r);$(e,r,!a,t)}function w({gen:e,schemaEnv:t,schema:r,errSchemaPath:a,opts:s}){let i=r.$comment;if(!0===s.$comment)e.code((0,u._)`${c.default.self}.logger.log(${i})`);else if("function"==typeof s.$comment){let r=(0,u.str)`${a}/$comment`,s=e.scopeValue("root",{ref:t.root});e.code((0,u._)`${c.default.self}.opts.$comment(${i}, ${r}, ${s}.schema)`)}}function $(e,t,r,a){let{gen:s,schema:o,data:l,allErrors:d,opts:p,self:m}=e,{RULES:f}=m;if(o.$ref&&(p.ignoreKeywordsWithRef||!(0,h.schemaHasRulesButRef)(o,f)))return void s.block(()=>E(e,"$ref",f.all.$ref.definition));function g(h){(0,i.shouldUseGroup)(o,h)&&(h.type?(s.if((0,n.checkDataType)(h.type,l,p.strictNumbers)),k(e,h),1===t.length&&t[0]===h.type&&r&&(s.else(),(0,n.reportTypeError)(e)),s.endIf()):k(e,h),d||s.if((0,u._)`${c.default.errors} === ${a||0}`))}p.jtd||!e.schemaEnv.meta&&e.opts.strictTypes&&(function(e,t){if(t.length){if(!e.dataTypes.length){e.dataTypes=t;return}t.forEach(t=>{x(e.dataTypes,t)||S(e,`type "${t}" not allowed by context "${e.dataTypes.join(",")}"`)}),function(e,t){let r=[];for(let a of e.dataTypes)x(t,a)?r.push(a):t.includes("integer")&&"number"===a&&r.push("integer");e.dataTypes=r}(e,t)}}(e,t),e.opts.allowUnionTypes||t.length>1&&!(2===t.length&&t.includes("null"))&&S(e,"use allowUnionTypes to allow union type keyword"),function(e,t){let r=e.self.RULES.all;for(let a in r){let s=r[a];if("object"==typeof s&&(0,i.shouldUseRule)(e.schema,s)){let{type:r}=s.definition;r.length&&!r.some(e=>t.includes(e)||"number"===e&&t.includes("integer"))&&S(e,`missing type "${r.join(",")}" for keyword "${a}"`)}}}(e,e.dataTypes)),s.block(()=>{for(let e of f.rules)g(e);g(f.post)})}function k(e,t){let{gen:r,schema:a,opts:{useDefaults:s}}=e;s&&(0,o.assignDefaults)(e,t.type),r.block(()=>{for(let r of t.rules)(0,i.shouldUseRule)(a,r)&&E(e,r.keyword,r.definition,t.type)})}function x(e,t){return e.includes(t)||"integer"===t&&e.includes("number")}function S(e,t){let r=e.schemaEnv.baseId+e.errSchemaPath;t+=` at "${r}" (strictTypes)`,(0,h.checkStrictMode)(e,t,e.opts.strictTypes)}t.validateFunctionCode=function(e){v(e)&&(_(e),y(e))?function(e){let{schema:t,opts:r,gen:a}=e;f(e,()=>{r.$comment&&t.$comment&&w(e),function(e){let{schema:t,opts:r}=e;void 0!==t.default&&r.useDefaults&&r.strictSchema&&(0,h.checkStrictMode)(e,"default is ignored in the schema root")}(e),a.let(c.default.vErrors,null),a.let(c.default.errors,0),r.unevaluated&&function(e){let{gen:t,validateName:r}=e;e.evaluated=t.const("evaluated",(0,u._)`${r}.evaluated`),t.if((0,u._)`${e.evaluated}.dynamicProps`,()=>t.assign((0,u._)`${e.evaluated}.props`,(0,u._)`undefined`)),t.if((0,u._)`${e.evaluated}.dynamicItems`,()=>t.assign((0,u._)`${e.evaluated}.items`,(0,u._)`undefined`))}(e),b(e),function(e){let{gen:t,schemaEnv:r,validateName:a,ValidationError:s,opts:i}=e;r.$async?t.if((0,u._)`${c.default.errors} === 0`,()=>t.return(c.default.data),()=>t.throw((0,u._)`new ${s}(${c.default.vErrors})`)):(t.assign((0,u._)`${a}.errors`,c.default.vErrors),i.unevaluated&&function({gen:e,evaluated:t,props:r,items:a}){r instanceof u.Name&&e.assign((0,u._)`${t}.props`,r),a instanceof u.Name&&e.assign((0,u._)`${t}.items`,a)}(e),t.return((0,u._)`${c.default.errors} === 0`))}(e)})}(e):f(e,()=>(0,a.topBoolOrEmptySchema)(e))};class T{constructor(e,t,r){if((0,l.validateKeywordUsage)(e,t,r),this.gen=e.gen,this.allErrors=e.allErrors,this.keyword=r,this.data=e.data,this.schema=e.schema[r],this.$data=t.$data&&e.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,h.schemaRefOrVal)(e,this.schema,r,this.$data),this.schemaType=t.schemaType,this.parentSchema=e.schema,this.params={},this.it=e,this.def=t,this.$data)this.schemaCode=e.gen.const("vSchema",O(this.$data,e));else if(this.schemaCode=this.schemaValue,!(0,l.validSchemaType)(this.schema,t.schemaType,t.allowUndefined))throw Error(`${r} value must be ${JSON.stringify(t.schemaType)}`);("code"in t?t.trackErrors:!1!==t.errors)&&(this.errsCount=e.gen.const("_errs",c.default.errors))}result(e,t,r){this.failResult((0,u.not)(e),t,r)}failResult(e,t,r){this.gen.if(e),r?r():this.error(),t?(this.gen.else(),t(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(e,t){this.failResult((0,u.not)(e),void 0,t)}fail(e){if(void 0===e){this.error(),this.allErrors||this.gen.if(!1);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:t}=this;this.fail((0,u._)`${t} !== undefined && (${(0,u.or)(this.invalid$data(),e)})`)}error(e,t,r){if(t){this.setParams(t),this._error(e,r),this.setParams({});return}this._error(e,r)}_error(e,t){(e?m.reportExtraError:m.reportError)(this,this.def.error,t)}$dataError(){(0,m.reportError)(this,this.def.$dataError||m.keyword$DataError)}reset(){if(void 0===this.errsCount)throw Error('add "trackErrors" to keyword definition');(0,m.resetErrorsCount)(this.gen,this.errsCount)}ok(e){this.allErrors||this.gen.if(e)}setParams(e,t){t?Object.assign(this.params,e):this.params=e}block$data(e,t,r=u.nil){this.gen.block(()=>{this.check$data(e,r),t()})}check$data(e=u.nil,t=u.nil){if(!this.$data)return;let{gen:r,schemaCode:a,schemaType:s,def:i}=this;r.if((0,u.or)((0,u._)`${a} === undefined`,t)),e!==u.nil&&r.assign(e,!0),(s.length||i.validateSchema)&&(r.elseIf(this.invalid$data()),this.$dataError(),e!==u.nil&&r.assign(e,!1)),r.else()}invalid$data(){let{gen:e,schemaCode:t,schemaType:r,def:a,it:s}=this;return(0,u.or)(function(){if(r.length){if(!(t instanceof u.Name))throw Error("ajv implementation error");let e=Array.isArray(r)?r:[r];return(0,u._)`${(0,n.checkDataTypes)(e,t,s.opts.strictNumbers,n.DataType.Wrong)}`}return u.nil}(),function(){if(a.validateSchema){let r=e.scopeValue("validate$data",{ref:a.validateSchema});return(0,u._)`!${r}(${t})`}return u.nil}())}subschema(e,t){let r=(0,d.getSubschema)(this.it,e);(0,d.extendSubschemaData)(r,this.it,e),(0,d.extendSubschemaMode)(r,e);let s={...this.it,...r,items:void 0,props:void 0};return!function(e,t){if(v(e)&&(_(e),y(e)))return function(e,t){let r,{schema:a,gen:s,opts:i}=e;i.$comment&&a.$comment&&w(e),(r=e.schema[e.opts.schemaId])&&(e.baseId=(0,p.resolveUrl)(e.opts.uriResolver,e.baseId,r)),function(e){if(e.schema.$async&&!e.schemaEnv.$async)throw Error("async schema in sync schema")}(e);let n=s.const("_errs",c.default.errors);b(e,n),s.var(t,(0,u._)`${n} === ${c.default.errors}`)}(e,t);(0,a.boolOrEmptySchema)(e,t)}(s,t),s}mergeEvaluated(e,t){let{it:r,gen:a}=this;r.opts.unevaluated&&(!0!==r.props&&void 0!==e.props&&(r.props=h.mergeEvaluated.props(a,e.props,r.props,t)),!0!==r.items&&void 0!==e.items&&(r.items=h.mergeEvaluated.items(a,e.items,r.items,t)))}mergeValidEvaluated(e,t){let{it:r,gen:a}=this;if(r.opts.unevaluated&&(!0!==r.props||!0!==r.items))return a.if(t,()=>this.mergeEvaluated(e,u.Name)),!0}}function E(e,t,r,a){let s=new T(e,r,t);"code"in r?r.code(s,a):s.$data&&r.validate?(0,l.funcKeywordCode)(s,r):"macro"in r?(0,l.macroKeywordCode)(s,r):(r.compile||r.validate)&&(0,l.funcKeywordCode)(s,r)}t.KeywordCxt=T;let P=/^\/(?:[^~]|~0|~1)*$/,j=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function O(e,{dataLevel:t,dataNames:r,dataPathArr:a}){let s,i;if(""===e)return c.default.rootData;if("/"===e[0]){if(!P.test(e))throw Error(`Invalid JSON-pointer: ${e}`);s=e,i=c.default.rootData}else{let n=j.exec(e);if(!n)throw Error(`Invalid JSON-pointer: ${e}`);let l=+n[1];if("#"===(s=n[2])){if(l>=t)throw Error(o("property/index",l));return a[t-l]}if(l>t)throw Error(o("data",l));if(i=r[t-l],!s)return i}let n=i;for(let e of s.split("/"))e&&(i=(0,u._)`${i}${(0,u.getProperty)((0,h.unescapeJsonPointer)(e))}`,n=(0,u._)`${n} && ${i}`);return n;function o(e,r){return`Cannot access ${e} ${r} levels up, current level is ${t}`}}t.getData=O},1074(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.validateKeywordUsage=t.validSchemaType=t.funcKeywordCode=t.macroKeywordCode=void 0;let a=r(6556),s=r(4614),i=r(3716),n=r(7747);function o(e){let{gen:t,data:r,it:s}=e;t.if(s.parentData,()=>t.assign(r,(0,a._)`${s.parentData}[${s.parentDataProperty}]`))}function l(e,t,r){if(void 0===r)throw Error(`keyword "${t}" failed to compile`);return e.scopeValue("keyword","function"==typeof r?{ref:r}:{ref:r,code:(0,a.stringify)(r)})}t.macroKeywordCode=function(e,t){let{gen:r,keyword:s,schema:i,parentSchema:n,it:o}=e,d=t.macro.call(o.self,i,n,o),u=l(r,s,d);!1!==o.opts.validateSchema&&o.self.validateSchema(d,!0);let c=r.name("valid");e.subschema({schema:d,schemaPath:a.nil,errSchemaPath:`${o.errSchemaPath}/${s}`,topSchemaRef:u,compositeRule:!0},c),e.pass(c,()=>e.error(!0))},t.funcKeywordCode=function(e,t){var r;let{gen:d,keyword:u,schema:c,parentSchema:p,$data:h,it:m}=e;!function({schemaEnv:e},t){if(t.async&&!e.$async)throw Error("async keyword in sync schema")}(m,t);let f=l(d,u,!h&&t.compile?t.compile.call(m.self,c,p,m):t.validate),g=d.let("valid");function y(r=t.async?(0,a._)`await `:a.nil){let n=m.opts.passContext?s.default.this:s.default.self,o=!("compile"in t&&!h||!1===t.schema);d.assign(g,(0,a._)`${r}${(0,i.callValidateCode)(e,f,n,o)}`,t.modifying)}function v(e){var r;d.if((0,a.not)(null!=(r=t.valid)?r:g),e)}e.block$data(g,function(){if(!1===t.errors)y(),t.modifying&&o(e),v(()=>e.error());else{let r,i,l=t.async?(r=d.let("ruleErrs",null),d.try(()=>y((0,a._)`await `),e=>d.assign(g,!1).if((0,a._)`${e} instanceof ${m.ValidationError}`,()=>d.assign(r,(0,a._)`${e}.errors`),()=>d.throw(e))),r):(i=(0,a._)`${f}.errors`,d.assign(i,null),y(a.nil),i);t.modifying&&o(e),v(()=>(function(e,t){let{gen:r}=e;r.if((0,a._)`Array.isArray(${t})`,()=>{r.assign(s.default.vErrors,(0,a._)`${s.default.vErrors} === null ? ${t} : ${s.default.vErrors}.concat(${t})`).assign(s.default.errors,(0,a._)`${s.default.vErrors}.length`),(0,n.extendErrors)(e)},()=>e.error())})(e,l))}}),e.ok(null!=(r=t.valid)?r:g)},t.validSchemaType=function(e,t,r=!1){return!t.length||t.some(t=>"array"===t?Array.isArray(e):"object"===t?e&&"object"==typeof e&&!Array.isArray(e):typeof e==t||r&&void 0===e)},t.validateKeywordUsage=function({schema:e,opts:t,self:r,errSchemaPath:a},s,i){if(Array.isArray(s.keyword)?!s.keyword.includes(i):s.keyword!==i)throw Error("ajv implementation error");let n=s.dependencies;if(null==n?void 0:n.some(t=>!Object.prototype.hasOwnProperty.call(e,t)))throw Error(`parent schema must have dependencies of ${i}: ${n.join(",")}`);if(s.validateSchema&&!s.validateSchema(e[i])){let e=`keyword "${i}" value is invalid at path "${a}": `+r.errorsText(s.validateSchema.errors);if("log"===t.validateSchema)r.logger.error(e);else throw Error(e)}}},4456(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.extendSubschemaMode=t.extendSubschemaData=t.getSubschema=void 0;let a=r(6556),s=r(8512);t.getSubschema=function(e,{keyword:t,schemaProp:r,schema:i,schemaPath:n,errSchemaPath:o,topSchemaRef:l}){if(void 0!==t&&void 0!==i)throw Error('both "keyword" and "schema" passed, only one allowed');if(void 0!==t){let i=e.schema[t];return void 0===r?{schema:i,schemaPath:(0,a._)`${e.schemaPath}${(0,a.getProperty)(t)}`,errSchemaPath:`${e.errSchemaPath}/${t}`}:{schema:i[r],schemaPath:(0,a._)`${e.schemaPath}${(0,a.getProperty)(t)}${(0,a.getProperty)(r)}`,errSchemaPath:`${e.errSchemaPath}/${t}/${(0,s.escapeFragment)(r)}`}}if(void 0!==i){if(void 0===n||void 0===o||void 0===l)throw Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:i,schemaPath:n,topSchemaRef:l,errSchemaPath:o}}throw Error('either "keyword" or "schema" must be passed')},t.extendSubschemaData=function(e,t,{dataProp:r,dataPropType:i,data:n,dataTypes:o,propertyName:l}){if(void 0!==n&&void 0!==r)throw Error('both "data" and "dataProp" passed, only one allowed');let{gen:d}=t;if(void 0!==r){let{errorPath:n,dataPathArr:o,opts:l}=t;u(d.let("data",(0,a._)`${t.data}${(0,a.getProperty)(r)}`,!0)),e.errorPath=(0,a.str)`${n}${(0,s.getErrorPath)(r,i,l.jsPropertySyntax)}`,e.parentDataProperty=(0,a._)`${r}`,e.dataPathArr=[...o,e.parentDataProperty]}function u(r){e.data=r,e.dataLevel=t.dataLevel+1,e.dataTypes=[],t.definedProperties=new Set,e.parentData=t.data,e.dataNames=[...t.dataNames,r]}void 0!==n&&(u(n instanceof a.Name?n:d.let("data",n,!0)),void 0!==l&&(e.propertyName=l)),o&&(e.dataTypes=o)},t.extendSubschemaMode=function(e,{jtdDiscriminator:t,jtdMetadata:r,compositeRule:a,createErrors:s,allErrors:i}){void 0!==a&&(e.compositeRule=a),void 0!==s&&(e.createErrors=s),void 0!==i&&(e.allErrors=i),e.jtdDiscriminator=t,e.jtdMetadata=r}},7285(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.CodeGen=t.Name=t.nil=t.stringify=t.str=t._=t.KeywordCxt=void 0;var a=r(6889);Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return a.KeywordCxt}});var s=r(6556);Object.defineProperty(t,"_",{enumerable:!0,get:function(){return s._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return s.str}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return s.stringify}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return s.nil}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return s.Name}}),Object.defineProperty(t,"CodeGen",{enumerable:!0,get:function(){return s.CodeGen}});let i=r(9645),n=r(218),o=r(9881),l=r(9198),d=r(6556),u=r(234),c=r(4029),p=r(8512),h=r(2200),m=r(8669),f=(e,t)=>new RegExp(e,t);f.code="new RegExp";let g=["removeAdditional","useDefaults","coerceTypes"],y=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),v={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."},_={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'};class b{constructor(e={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,e=this.opts={...e,...function(e){var t,r,a,s,i,n,o,l,d,u,c,p,h,g,y,v,_,b,w,$,k,x,S,T,E;let P=e.strict,j=null==(t=e.code)?void 0:t.optimize,O=!0===j||void 0===j?1:j||0,I=null!=(a=null==(r=e.code)?void 0:r.regExp)?a:f,N=null!=(s=e.uriResolver)?s:m.default;return{strictSchema:null==(n=null!=(i=e.strictSchema)?i:P)||n,strictNumbers:null==(l=null!=(o=e.strictNumbers)?o:P)||l,strictTypes:null!=(u=null!=(d=e.strictTypes)?d:P)?u:"log",strictTuples:null!=(p=null!=(c=e.strictTuples)?c:P)?p:"log",strictRequired:null!=(g=null!=(h=e.strictRequired)?h:P)&&g,code:e.code?{...e.code,optimize:O,regExp:I}:{optimize:O,regExp:I},loopRequired:null!=(y=e.loopRequired)?y:200,loopEnum:null!=(v=e.loopEnum)?v:200,meta:null==(_=e.meta)||_,messages:null==(b=e.messages)||b,inlineRefs:null==(w=e.inlineRefs)||w,schemaId:null!=($=e.schemaId)?$:"$id",addUsedSchema:null==(k=e.addUsedSchema)||k,validateSchema:null==(x=e.validateSchema)||x,validateFormats:null==(S=e.validateFormats)||S,unicodeRegExp:null==(T=e.unicodeRegExp)||T,int32range:null==(E=e.int32range)||E,uriResolver:N}}(e)};const{es5:t,lines:r}=this.opts.code;this.scope=new d.ValueScope({scope:{},prefixes:y,es5:t,lines:r}),this.logger=function(e){if(!1===e)return E;if(void 0===e)return console;if(e.log&&e.warn&&e.error)return e;throw Error("logger must implement log, warn and error methods")}(e.logger);const a=e.validateFormats;e.validateFormats=!1,this.RULES=(0,o.getRules)(),w.call(this,v,e,"NOT SUPPORTED"),w.call(this,_,e,"DEPRECATED","warn"),this._metaOpts=T.call(this),e.formats&&x.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords&&S.call(this,e.keywords),"object"==typeof e.meta&&this.addMetaSchema(e.meta),k.call(this),e.validateFormats=a}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:e,meta:t,schemaId:r}=this.opts,a=h;"id"===r&&((a={...h}).id=a.$id,delete a.$id),t&&e&&this.addMetaSchema(a,a[r],!1)}defaultMeta(){let{meta:e,schemaId:t}=this.opts;return this.opts.defaultMeta="object"==typeof e?e[t]||e:void 0}validate(e,t){let r;if("string"==typeof e){if(!(r=this.getSchema(e)))throw Error(`no schema with key or ref "${e}"`)}else r=this.compile(e);let a=r(t);return"$async"in r||(this.errors=r.errors),a}compile(e,t){let r=this._addSchema(e,t);return r.validate||this._compileSchemaEnv(r)}compileAsync(e,t){if("function"!=typeof this.opts.loadSchema)throw Error("options.loadSchema should be a function");let{loadSchema:r}=this.opts;return a.call(this,e,t);async function a(e,t){await s.call(this,e.$schema);let r=this._addSchema(e,t);return r.validate||i.call(this,r)}async function s(e){e&&!this.getSchema(e)&&await a.call(this,{$ref:e},!0)}async function i(e){try{return this._compileSchemaEnv(e)}catch(t){if(!(t instanceof n.default))throw t;return o.call(this,t),await l.call(this,t.missingSchema),i.call(this,e)}}function o({missingSchema:e,missingRef:t}){if(this.refs[e])throw Error(`AnySchema ${e} is loaded but ${t} cannot be resolved`)}async function l(e){let r=await d.call(this,e);this.refs[e]||await s.call(this,r.$schema),this.refs[e]||this.addSchema(r,e,t)}async function d(e){let t=this._loading[e];if(t)return t;try{return await (this._loading[e]=r(e))}finally{delete this._loading[e]}}}addSchema(e,t,r,a=this.opts.validateSchema){let s;if(Array.isArray(e)){for(let t of e)this.addSchema(t,void 0,r,a);return this}if("object"==typeof e){let{schemaId:t}=this.opts;if(void 0!==(s=e[t])&&"string"!=typeof s)throw Error(`schema ${t} must be string`)}return t=(0,u.normalizeId)(t||s),this._checkUnique(t),this.schemas[t]=this._addSchema(e,r,t,a,!0),this}addMetaSchema(e,t,r=this.opts.validateSchema){return this.addSchema(e,t,!0,r),this}validateSchema(e,t){let r;if("boolean"==typeof e)return!0;if(void 0!==(r=e.$schema)&&"string"!=typeof r)throw Error("$schema must be a string");if(!(r=r||this.opts.defaultMeta||this.defaultMeta()))return this.logger.warn("meta-schema not available"),this.errors=null,!0;let a=this.validate(r,e);if(!a&&t){let e="schema is invalid: "+this.errorsText();if("log"===this.opts.validateSchema)this.logger.error(e);else throw Error(e)}return a}getSchema(e){let t;for(;"string"==typeof(t=$.call(this,e));)e=t;if(void 0===t){let{schemaId:r}=this.opts,a=new l.SchemaEnv({schema:{},schemaId:r});if(!(t=l.resolveSchema.call(this,a,e)))return;this.refs[e]=t}return t.validate||this._compileSchemaEnv(t)}removeSchema(e){if(e instanceof RegExp)return this._removeAllSchemas(this.schemas,e),this._removeAllSchemas(this.refs,e),this;switch(typeof e){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let t=$.call(this,e);return"object"==typeof t&&this._cache.delete(t.schema),delete this.schemas[e],delete this.refs[e],this}case"object":{this._cache.delete(e);let t=e[this.opts.schemaId];return t&&(t=(0,u.normalizeId)(t),delete this.schemas[t],delete this.refs[t]),this}default:throw Error("ajv.removeSchema: invalid parameter")}}addVocabulary(e){for(let t of e)this.addKeyword(t);return this}addKeyword(e,t){let r;if("string"==typeof e)r=e,"object"==typeof t&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),t.keyword=r);else if("object"==typeof e&&void 0===t){if(Array.isArray(r=(t=e).keyword)&&!r.length)throw Error("addKeywords: keyword must be string or non-empty array")}else throw Error("invalid addKeywords parameters");if(j.call(this,r,t),!t)return(0,p.eachItem)(r,e=>O.call(this,e)),this;N.call(this,t);let a={...t,type:(0,c.getJSONTypes)(t.type),schemaType:(0,c.getJSONTypes)(t.schemaType)};return(0,p.eachItem)(r,0===a.type.length?e=>O.call(this,e,a):e=>a.type.forEach(t=>O.call(this,e,a,t))),this}getKeyword(e){let t=this.RULES.all[e];return"object"==typeof t?t.definition:!!t}removeKeyword(e){let{RULES:t}=this;for(let r of(delete t.keywords[e],delete t.all[e],t.rules)){let t=r.rules.findIndex(t=>t.keyword===e);t>=0&&r.rules.splice(t,1)}return this}addFormat(e,t){return"string"==typeof t&&(t=new RegExp(t)),this.formats[e]=t,this}errorsText(e=this.errors,{separator:t=", ",dataVar:r="data"}={}){return e&&0!==e.length?e.map(e=>`${r}${e.instancePath} ${e.message}`).reduce((e,r)=>e+t+r):"No errors"}$dataMetaSchema(e,t){let r=this.RULES.all;for(let a of(e=JSON.parse(JSON.stringify(e)),t)){let t=a.split("/").slice(1),s=e;for(let e of t)s=s[e];for(let e in r){let t=r[e];if("object"!=typeof t)continue;let{$data:a}=t.definition,i=s[e];a&&i&&(s[e]=R(i))}}return e}_removeAllSchemas(e,t){for(let r in e){let a=e[r];(!t||t.test(r))&&("string"==typeof a?delete e[r]:a&&!a.meta&&(this._cache.delete(a.schema),delete e[r]))}}_addSchema(e,t,r,a=this.opts.validateSchema,s=this.opts.addUsedSchema){let i,{schemaId:n}=this.opts;if("object"==typeof e)i=e[n];else if(this.opts.jtd)throw Error("schema must be object");else if("boolean"!=typeof e)throw Error("schema must be object or boolean");let o=this._cache.get(e);if(void 0!==o)return o;r=(0,u.normalizeId)(i||r);let d=u.getSchemaRefs.call(this,e,r);return o=new l.SchemaEnv({schema:e,schemaId:n,meta:t,baseId:r,localRefs:d}),this._cache.set(o.schema,o),s&&!r.startsWith("#")&&(r&&this._checkUnique(r),this.refs[r]=o),a&&this.validateSchema(e,!0),o}_checkUnique(e){if(this.schemas[e]||this.refs[e])throw Error(`schema with key or id "${e}" already exists`)}_compileSchemaEnv(e){if(e.meta?this._compileMetaSchema(e):l.compileSchema.call(this,e),!e.validate)throw Error("ajv implementation error");return e.validate}_compileMetaSchema(e){let t=this.opts;this.opts=this._metaOpts;try{l.compileSchema.call(this,e)}finally{this.opts=t}}}function w(e,t,r,a="error"){for(let s in e)s in t&&this.logger[a](`${r}: option ${s}. ${e[s]}`)}function $(e){return e=(0,u.normalizeId)(e),this.schemas[e]||this.refs[e]}function k(){let e=this.opts.schemas;if(e)if(Array.isArray(e))this.addSchema(e);else for(let t in e)this.addSchema(e[t],t)}function x(){for(let e in this.opts.formats){let t=this.opts.formats[e];t&&this.addFormat(e,t)}}function S(e){if(Array.isArray(e))return void this.addVocabulary(e);for(let t in this.logger.warn("keywords option as map is deprecated, pass array"),e){let r=e[t];r.keyword||(r.keyword=t),this.addKeyword(r)}}function T(){let e={...this.opts};for(let t of g)delete e[t];return e}b.ValidationError=i.default,b.MissingRefError=n.default,t.default=b;let E={log(){},warn(){},error(){}},P=/^[a-z_$][a-z0-9_$:-]*$/i;function j(e,t){let{RULES:r}=this;if((0,p.eachItem)(e,e=>{if(r.keywords[e])throw Error(`Keyword ${e} is already defined`);if(!P.test(e))throw Error(`Keyword ${e} has invalid name`)}),t&&t.$data&&!("code"in t||"validate"in t))throw Error('$data keyword must have "code" or "validate" function')}function O(e,t,r){var a;let s=null==t?void 0:t.post;if(r&&s)throw Error('keyword with "post" flag cannot have "type"');let{RULES:i}=this,n=s?i.post:i.rules.find(({type:e})=>e===r);if(n||(n={type:r,rules:[]},i.rules.push(n)),i.keywords[e]=!0,!t)return;let o={keyword:e,definition:{...t,type:(0,c.getJSONTypes)(t.type),schemaType:(0,c.getJSONTypes)(t.schemaType)}};t.before?I.call(this,n,o,t.before):n.rules.push(o),i.all[e]=o,null==(a=t.implements)||a.forEach(e=>this.addKeyword(e))}function I(e,t,r){let a=e.rules.findIndex(e=>e.keyword===r);a>=0?e.rules.splice(a,0,t):(e.rules.push(t),this.logger.warn(`rule ${r} is not defined`))}function N(e){let{metaSchema:t}=e;void 0!==t&&(e.$data&&this.opts.$data&&(t=R(t)),e.validateSchema=this.compile(t,!0))}let z={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function R(e){return{anyOf:[e,z]}}},6935(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});let a=r(7371);a.code='require("ajv/dist/runtime/equal").default',t.default=a},5014(e,t){function r(e){let t,r=e.length,a=0,s=0;for(;s<r;)a++,(t=e.charCodeAt(s++))>=55296&&t<=56319&&s<r&&(64512&(t=e.charCodeAt(s)))==56320&&s++;return a}Object.defineProperty(t,"__esModule",{value:!0}),t.default=r,r.code='require("ajv/dist/runtime/ucs2length").default'},8669(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});let a=r(5019);a.code='require("ajv/dist/runtime/uri").default',t.default=a},9645(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=class extends Error{constructor(e){super("validation failed"),this.errors=e,this.ajv=this.validation=!0}}},8440(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.validateAdditionalItems=void 0;let a=r(6556),s=r(8512);function i(e,t){let{gen:r,schema:i,data:n,keyword:o,it:l}=e;l.items=!0;let d=r.const("len",(0,a._)`${n}.length`);if(!1===i)e.setParams({len:t.length}),e.pass((0,a._)`${d} <= ${t.length}`);else if("object"==typeof i&&!(0,s.alwaysValidSchema)(l,i)){let i=r.var("valid",(0,a._)`${d} <= ${t.length}`);r.if((0,a.not)(i),()=>{r.forRange("i",t.length,d,t=>{e.subschema({keyword:o,dataProp:t,dataPropType:s.Type.Num},i),l.allErrors||r.if((0,a.not)(i),()=>r.break())})}),e.ok(i)}}t.validateAdditionalItems=i,t.default={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:{message:({params:{len:e}})=>(0,a.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,a._)`{limit: ${e}}`},code(e){let{parentSchema:t,it:r}=e,{items:a}=t;Array.isArray(a)?i(e,a):(0,s.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas')}}},3439(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});let a=r(3716),s=r(6556),i=r(4614),n=r(8512);t.default={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:{message:"must NOT have additional properties",params:({params:e})=>(0,s._)`{additionalProperty: ${e.additionalProperty}}`},code(e){let{gen:t,schema:r,parentSchema:o,data:l,errsCount:d,it:u}=e;if(!d)throw Error("ajv implementation error");let{allErrors:c,opts:p}=u;if(u.props=!0,"all"!==p.removeAdditional&&(0,n.alwaysValidSchema)(u,r))return;let h=(0,a.allSchemaProperties)(o.properties),m=(0,a.allSchemaProperties)(o.patternProperties);function f(e){t.code((0,s._)`delete ${l}[${e}]`)}function g(a){if("all"===p.removeAdditional||p.removeAdditional&&!1===r)return void f(a);if(!1===r){e.setParams({additionalProperty:a}),e.error(),c||t.break();return}if("object"==typeof r&&!(0,n.alwaysValidSchema)(u,r)){let r=t.name("valid");"failing"===p.removeAdditional?(y(a,r,!1),t.if((0,s.not)(r),()=>{e.reset(),f(a)})):(y(a,r),c||t.if((0,s.not)(r),()=>t.break()))}}function y(t,r,a){let s={keyword:"additionalProperties",dataProp:t,dataPropType:n.Type.Str};!1===a&&Object.assign(s,{compositeRule:!0,createErrors:!1,allErrors:!1}),e.subschema(s,r)}t.forIn("key",l,r=>{h.length||m.length?t.if(function(r){let i;if(h.length>8){let e=(0,n.schemaRefOrVal)(u,o.properties,"properties");i=(0,a.isOwnProperty)(t,e,r)}else i=h.length?(0,s.or)(...h.map(e=>(0,s._)`${r} === ${e}`)):s.nil;return m.length&&(i=(0,s.or)(i,...m.map(t=>(0,s._)`${(0,a.usePattern)(e,t)}.test(${r})`))),(0,s.not)(i)}(r),()=>g(r)):g(r)}),e.ok((0,s._)`${d} === ${i.default.errors}`)}}},4741(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});let a=r(8512);t.default={keyword:"allOf",schemaType:"array",code(e){let{gen:t,schema:r,it:s}=e;if(!Array.isArray(r))throw Error("ajv implementation error");let i=t.name("valid");r.forEach((t,r)=>{if((0,a.alwaysValidSchema)(s,t))return;let n=e.subschema({keyword:"allOf",schemaProp:r},i);e.ok(i),e.mergeEvaluated(n)})}}},5988(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.default={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:r(3716).validateUnion,error:{message:"must match a schema in anyOf"}}},5078(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});let a=r(6556),s=r(8512);t.default={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:{message:({params:{min:e,max:t}})=>void 0===t?(0,a.str)`must contain at least ${e} valid item(s)`:(0,a.str)`must contain at least ${e} and no more than ${t} valid item(s)`,params:({params:{min:e,max:t}})=>void 0===t?(0,a._)`{minContains: ${e}}`:(0,a._)`{minContains: ${e}, maxContains: ${t}}`},code(e){let t,r,{gen:i,schema:n,parentSchema:o,data:l,it:d}=e,{minContains:u,maxContains:c}=o;d.opts.next?(t=void 0===u?1:u,r=c):t=1;let p=i.const("len",(0,a._)`${l}.length`);if(e.setParams({min:t,max:r}),void 0===r&&0===t)return void(0,s.checkStrictMode)(d,'"minContains" == 0 without "maxContains": "contains" keyword ignored');if(void 0!==r&&t>r){(0,s.checkStrictMode)(d,'"minContains" > "maxContains" is always invalid'),e.fail();return}if((0,s.alwaysValidSchema)(d,n)){let s=(0,a._)`${p} >= ${t}`;void 0!==r&&(s=(0,a._)`${s} && ${p} <= ${r}`),e.pass(s);return}d.items=!0;let h=i.name("valid");function m(){let e=i.name("_valid"),s=i.let("count",0);f(e,()=>i.if(e,()=>{i.code((0,a._)`${s}++`),void 0===r?i.if((0,a._)`${s} >= ${t}`,()=>i.assign(h,!0).break()):(i.if((0,a._)`${s} > ${r}`,()=>i.assign(h,!1).break()),1===t?i.assign(h,!0):i.if((0,a._)`${s} >= ${t}`,()=>i.assign(h,!0)))}))}function f(t,r){i.forRange("i",0,p,a=>{e.subschema({keyword:"contains",dataProp:a,dataPropType:s.Type.Num,compositeRule:!0},t),r()})}void 0===r&&1===t?f(h,()=>i.if(h,()=>i.break())):0===t?(i.let(h,!0),void 0!==r&&i.if((0,a._)`${l}.length > 0`,m)):(i.let(h,!1),m()),e.result(h,()=>e.reset())}}},7394(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.validateSchemaDeps=t.validatePropertyDeps=t.error=void 0;let a=r(6556),s=r(8512),i=r(3716);t.error={message:({params:{property:e,depsCount:t,deps:r}})=>(0,a.str)`must have ${1===t?"property":"properties"} ${r} when property ${e} is present`,params:({params:{property:e,depsCount:t,deps:r,missingProperty:s}})=>(0,a._)`{property: ${e},
6
+ missingProperty: ${s},
7
+ depsCount: ${t},
8
+ deps: ${r}}`};let n={keyword:"dependencies",type:"object",schemaType:"object",error:t.error,code(e){let[t,r]=function({schema:e}){let t={},r={};for(let a in e)"__proto__"!==a&&((Array.isArray(e[a])?t:r)[a]=e[a]);return[t,r]}(e);o(e,t),l(e,r)}};function o(e,t=e.schema){let{gen:r,data:s,it:n}=e;if(0===Object.keys(t).length)return;let l=r.let("missing");for(let o in t){let d=t[o];if(0===d.length)continue;let u=(0,i.propertyInData)(r,s,o,n.opts.ownProperties);e.setParams({property:o,depsCount:d.length,deps:d.join(", ")}),n.allErrors?r.if(u,()=>{for(let t of d)(0,i.checkReportMissingProp)(e,t)}):(r.if((0,a._)`${u} && (${(0,i.checkMissingProp)(e,d,l)})`),(0,i.reportMissingProp)(e,l),r.else())}}function l(e,t=e.schema){let{gen:r,data:a,keyword:n,it:o}=e,d=r.name("valid");for(let l in t)(0,s.alwaysValidSchema)(o,t[l])||(r.if((0,i.propertyInData)(r,a,l,o.opts.ownProperties),()=>{let t=e.subschema({keyword:n,schemaProp:l},d);e.mergeValidEvaluated(t,d)},()=>r.var(d,!0)),e.ok(d))}t.validatePropertyDeps=o,t.validateSchemaDeps=l,t.default=n},9352(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});let a=r(6556),s=r(8512);function i(e,t){let r=e.schema[t];return void 0!==r&&!(0,s.alwaysValidSchema)(e,r)}t.default={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:{message:({params:e})=>(0,a.str)`must match "${e.ifClause}" schema`,params:({params:e})=>(0,a._)`{failingKeyword: ${e.ifClause}}`},code(e){let t,{gen:r,parentSchema:n,it:o}=e;void 0===n.then&&void 0===n.else&&(0,s.checkStrictMode)(o,'"if" without "then" and "else" is ignored');let l=i(o,"then"),d=i(o,"else");if(!l&&!d)return;let u=r.let("valid",!0),c=r.name("_valid");if(t=e.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},c),e.mergeEvaluated(t),e.reset(),l&&d){let t=r.let("ifClause");e.setParams({ifClause:t}),r.if(c,p("then",t),p("else",t))}else l?r.if(c,p("then")):r.if((0,a.not)(c),p("else"));function p(t,s){return()=>{let i=e.subschema({keyword:t},c);r.assign(u,c),e.mergeValidEvaluated(i,u),s?r.assign(s,(0,a._)`${t}`):e.setParams({ifClause:t})}}e.pass(u,()=>e.error(!0))}}},3591(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});let a=r(8440),s=r(9315),i=r(9135),n=r(6447),o=r(5078),l=r(7394),d=r(508),u=r(3439),c=r(3210),p=r(9880),h=r(3278),m=r(5988),f=r(4218),g=r(4741),y=r(9352),v=r(925);t.default=function(e=!1){let t=[h.default,m.default,f.default,g.default,y.default,v.default,d.default,u.default,l.default,c.default,p.default];return e?t.push(s.default,n.default):t.push(a.default,i.default),t.push(o.default),t}},9135(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.validateTuple=void 0;let a=r(6556),s=r(8512),i=r(3716);function n(e,t,r=e.schema){let{gen:i,parentSchema:o,data:l,keyword:d,it:u}=e;(function(e){let{opts:a,errSchemaPath:i}=u,n=r.length,o=n===e.minItems&&(n===e.maxItems||!1===e[t]);if(a.strictTuples&&!o){let e=`"${d}" is ${n}-tuple, but minItems or maxItems/${t} are not specified or different at path "${i}"`;(0,s.checkStrictMode)(u,e,a.strictTuples)}})(o),u.opts.unevaluated&&r.length&&!0!==u.items&&(u.items=s.mergeEvaluated.items(i,r.length,u.items));let c=i.name("valid"),p=i.const("len",(0,a._)`${l}.length`);r.forEach((t,r)=>{(0,s.alwaysValidSchema)(u,t)||(i.if((0,a._)`${p} > ${r}`,()=>e.subschema({keyword:d,schemaProp:r,dataProp:r},c)),e.ok(c))})}t.validateTuple=n,t.default={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){let{schema:t,it:r}=e;if(Array.isArray(t))return n(e,"additionalItems",t);r.items=!0,(0,s.alwaysValidSchema)(r,t)||e.ok((0,i.validateArray)(e))}}},6447(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});let a=r(6556),s=r(8512),i=r(3716),n=r(8440);t.default={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:{message:({params:{len:e}})=>(0,a.str)`must NOT have more than ${e} items`,params:({params:{len:e}})=>(0,a._)`{limit: ${e}}`},code(e){let{schema:t,parentSchema:r,it:a}=e,{prefixItems:o}=r;a.items=!0,(0,s.alwaysValidSchema)(a,t)||(o?(0,n.validateAdditionalItems)(e,o):e.ok((0,i.validateArray)(e)))}}},3278(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});let a=r(8512);t.default={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(e){let{gen:t,schema:r,it:s}=e;if((0,a.alwaysValidSchema)(s,r))return void e.fail();let i=t.name("valid");e.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},i),e.failResult(i,()=>e.reset(),()=>e.error())},error:{message:"must NOT be valid"}}},4218(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});let a=r(6556),s=r(8512);t.default={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:{message:"must match exactly one schema in oneOf",params:({params:e})=>(0,a._)`{passingSchemas: ${e.passing}}`},code(e){let{gen:t,schema:r,parentSchema:i,it:n}=e;if(!Array.isArray(r))throw Error("ajv implementation error");if(n.opts.discriminator&&i.discriminator)return;let o=t.let("valid",!1),l=t.let("passing",null),d=t.name("_valid");e.setParams({passing:l}),t.block(function(){r.forEach((r,i)=>{let u;(0,s.alwaysValidSchema)(n,r)?t.var(d,!0):u=e.subschema({keyword:"oneOf",schemaProp:i,compositeRule:!0},d),i>0&&t.if((0,a._)`${d} && ${o}`).assign(o,!1).assign(l,(0,a._)`[${l}, ${i}]`).else(),t.if(d,()=>{t.assign(o,!0),t.assign(l,i),u&&e.mergeEvaluated(u,a.Name)})})}),e.result(o,()=>e.reset(),()=>e.error(!0))}}},9880(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});let a=r(3716),s=r(6556),i=r(8512),n=r(8512);t.default={keyword:"patternProperties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,data:o,parentSchema:l,it:d}=e,{opts:u}=d,c=(0,a.allSchemaProperties)(r),p=c.filter(e=>(0,i.alwaysValidSchema)(d,r[e]));if(0===c.length||p.length===c.length&&(!d.opts.unevaluated||!0===d.props))return;let h=u.strictSchema&&!u.allowMatchingProperties&&l.properties,m=t.name("valid");!0===d.props||d.props instanceof s.Name||(d.props=(0,n.evaluatedPropsToName)(t,d.props));let{props:f}=d;for(let e of c)h&&function(e){for(let t in h)new RegExp(e).test(t)&&(0,i.checkStrictMode)(d,`property ${t} matches pattern ${e} (use allowMatchingProperties)`)}(e),d.allErrors?g(e):(t.var(m,!0),g(e),t.if(m));function g(r){t.forIn("key",o,i=>{t.if((0,s._)`${(0,a.usePattern)(e,r)}.test(${i})`,()=>{let a=p.includes(r);a||e.subschema({keyword:"patternProperties",schemaProp:r,dataProp:i,dataPropType:n.Type.Str},m),d.opts.unevaluated&&!0!==f?t.assign((0,s._)`${f}[${i}]`,!0):a||d.allErrors||t.if((0,s.not)(m),()=>t.break())})})}}}},9315(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});let a=r(9135);t.default={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:e=>(0,a.validateTuple)(e,"items")}},3210(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});let a=r(6889),s=r(3716),i=r(8512),n=r(3439);t.default={keyword:"properties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,parentSchema:o,data:l,it:d}=e;"all"===d.opts.removeAdditional&&void 0===o.additionalProperties&&n.default.code(new a.KeywordCxt(d,n.default,"additionalProperties"));let u=(0,s.allSchemaProperties)(r);for(let e of u)d.definedProperties.add(e);d.opts.unevaluated&&u.length&&!0!==d.props&&(d.props=i.mergeEvaluated.props(t,(0,i.toHash)(u),d.props));let c=u.filter(e=>!(0,i.alwaysValidSchema)(d,r[e]));if(0===c.length)return;let p=t.name("valid");for(let a of c)d.opts.useDefaults&&!d.compositeRule&&void 0!==r[a].default?h(a):(t.if((0,s.propertyInData)(t,l,a,d.opts.ownProperties)),h(a),d.allErrors||t.else().var(p,!0),t.endIf()),e.it.definedProperties.add(a),e.ok(p);function h(t){e.subschema({keyword:"properties",schemaProp:t,dataProp:t},p)}}}},508(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});let a=r(6556),s=r(8512);t.default={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:{message:"property name must be valid",params:({params:e})=>(0,a._)`{propertyName: ${e.propertyName}}`},code(e){let{gen:t,schema:r,data:i,it:n}=e;if((0,s.alwaysValidSchema)(n,r))return;let o=t.name("valid");t.forIn("key",i,r=>{e.setParams({propertyName:r}),e.subschema({keyword:"propertyNames",data:r,dataTypes:["string"],propertyName:r,compositeRule:!0},o),t.if((0,a.not)(o),()=>{e.error(!0),n.allErrors||t.break()})}),e.ok(o)}}},925(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});let a=r(8512);t.default={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:t,it:r}){void 0===t.if&&(0,a.checkStrictMode)(r,`"${e}" without "if" is ignored`)}}},3716(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.validateUnion=t.validateArray=t.usePattern=t.callValidateCode=t.schemaProperties=t.allSchemaProperties=t.noPropertyInData=t.propertyInData=t.isOwnProperty=t.hasPropFunc=t.reportMissingProp=t.checkMissingProp=t.checkReportMissingProp=void 0;let a=r(6556),s=r(8512),i=r(4614),n=r(8512);function o(e){return e.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,a._)`Object.prototype.hasOwnProperty`})}function l(e,t,r){return(0,a._)`${o(e)}.call(${t}, ${r})`}function d(e,t,r,s){let i=(0,a._)`${t}${(0,a.getProperty)(r)} === undefined`;return s?(0,a.or)(i,(0,a.not)(l(e,t,r))):i}function u(e){return e?Object.keys(e).filter(e=>"__proto__"!==e):[]}t.checkReportMissingProp=function(e,t){let{gen:r,data:s,it:i}=e;r.if(d(r,s,t,i.opts.ownProperties),()=>{e.setParams({missingProperty:(0,a._)`${t}`},!0),e.error()})},t.checkMissingProp=function({gen:e,data:t,it:{opts:r}},s,i){return(0,a.or)(...s.map(s=>(0,a.and)(d(e,t,s,r.ownProperties),(0,a._)`${i} = ${s}`)))},t.reportMissingProp=function(e,t){e.setParams({missingProperty:t},!0),e.error()},t.hasPropFunc=o,t.isOwnProperty=l,t.propertyInData=function(e,t,r,s){let i=(0,a._)`${t}${(0,a.getProperty)(r)} !== undefined`;return s?(0,a._)`${i} && ${l(e,t,r)}`:i},t.noPropertyInData=d,t.allSchemaProperties=u,t.schemaProperties=function(e,t){return u(t).filter(r=>!(0,s.alwaysValidSchema)(e,t[r]))},t.callValidateCode=function({schemaCode:e,data:t,it:{gen:r,topSchemaRef:s,schemaPath:n,errorPath:o},it:l},d,u,c){let p=c?(0,a._)`${e}, ${t}, ${s}${n}`:t,h=[[i.default.instancePath,(0,a.strConcat)(i.default.instancePath,o)],[i.default.parentData,l.parentData],[i.default.parentDataProperty,l.parentDataProperty],[i.default.rootData,i.default.rootData]];l.opts.dynamicRef&&h.push([i.default.dynamicAnchors,i.default.dynamicAnchors]);let m=(0,a._)`${p}, ${r.object(...h)}`;return u!==a.nil?(0,a._)`${d}.call(${u}, ${m})`:(0,a._)`${d}(${m})`};let c=(0,a._)`new RegExp`;t.usePattern=function({gen:e,it:{opts:t}},r){let s=t.unicodeRegExp?"u":"",{regExp:i}=t.code,o=i(r,s);return e.scopeValue("pattern",{key:o.toString(),ref:o,code:(0,a._)`${"new RegExp"===i.code?c:(0,n.useFunc)(e,i)}(${r}, ${s})`})},t.validateArray=function(e){let{gen:t,data:r,keyword:i,it:n}=e,o=t.name("valid");if(n.allErrors){let e=t.let("valid",!0);return l(()=>t.assign(e,!1)),e}return t.var(o,!0),l(()=>t.break()),o;function l(n){let l=t.const("len",(0,a._)`${r}.length`);t.forRange("i",0,l,r=>{e.subschema({keyword:i,dataProp:r,dataPropType:s.Type.Num},o),t.if((0,a.not)(o),n)})}},t.validateUnion=function(e){let{gen:t,schema:r,keyword:i,it:n}=e;if(!Array.isArray(r))throw Error("ajv implementation error");if(r.some(e=>(0,s.alwaysValidSchema)(n,e))&&!n.opts.unevaluated)return;let o=t.let("valid",!1),l=t.name("_valid");t.block(()=>r.forEach((r,s)=>{let n=e.subschema({keyword:i,schemaProp:s,compositeRule:!0},l);t.assign(o,(0,a._)`${o} || ${l}`),e.mergeValidEvaluated(n,l)||t.if((0,a.not)(o))})),e.result(o,()=>e.reset(),()=>e.error(!0))}},6464(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default={keyword:"id",code(){throw Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}}},5861(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});let a=r(6464),s=r(5140);t.default=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",a.default,s.default]},5140(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.callRef=t.getValidate=void 0;let a=r(218),s=r(3716),i=r(6556),n=r(4614),o=r(9198),l=r(8512);function d(e,t){let{gen:r}=e;return t.validate?r.scopeValue("validate",{ref:t.validate}):(0,i._)`${r.scopeValue("wrapper",{ref:t})}.validate`}function u(e,t,r,a){let{gen:o,it:d}=e,{allErrors:u,schemaEnv:c,opts:p}=d,h=p.passContext?n.default.this:i.nil;function m(e){let t=(0,i._)`${e}.errors`;o.assign(n.default.vErrors,(0,i._)`${n.default.vErrors} === null ? ${t} : ${n.default.vErrors}.concat(${t})`),o.assign(n.default.errors,(0,i._)`${n.default.vErrors}.length`)}function f(e){var t;if(!d.opts.unevaluated)return;let a=null==(t=null==r?void 0:r.validate)?void 0:t.evaluated;if(!0!==d.props)if(a&&!a.dynamicProps)void 0!==a.props&&(d.props=l.mergeEvaluated.props(o,a.props,d.props));else{let t=o.var("props",(0,i._)`${e}.evaluated.props`);d.props=l.mergeEvaluated.props(o,t,d.props,i.Name)}if(!0!==d.items)if(a&&!a.dynamicItems)void 0!==a.items&&(d.items=l.mergeEvaluated.items(o,a.items,d.items));else{let t=o.var("items",(0,i._)`${e}.evaluated.items`);d.items=l.mergeEvaluated.items(o,t,d.items,i.Name)}}a?function(){if(!c.$async)throw Error("async schema referenced by sync schema");let r=o.let("valid");o.try(()=>{o.code((0,i._)`await ${(0,s.callValidateCode)(e,t,h)}`),f(t),u||o.assign(r,!0)},e=>{o.if((0,i._)`!(${e} instanceof ${d.ValidationError})`,()=>o.throw(e)),m(e),u||o.assign(r,!1)}),e.ok(r)}():e.result((0,s.callValidateCode)(e,t,h),()=>f(t),()=>m(t))}t.getValidate=d,t.callRef=u,t.default={keyword:"$ref",schemaType:"string",code(e){let t,r,s,n,{gen:l,schema:c,it:p}=e,{baseId:h,schemaEnv:m,validateName:f,opts:g,self:y}=p,{root:v}=m;if(("#"===c||"#/"===c)&&h===v.baseId){if(m===v)return u(e,f,m,m.$async);let t=l.scopeValue("root",{ref:v});return u(e,(0,i._)`${t}.validate`,v,v.$async)}let _=o.resolveRef.call(y,v,h,c);if(void 0===_)throw new a.default(p.opts.uriResolver,h,c);return _ instanceof o.SchemaEnv?(t=d(e,_),void u(e,t,_,_.$async)):(r=l.scopeValue("schema",!0===g.code.source?{ref:_,code:(0,i.stringify)(_)}:{ref:_}),s=l.name("valid"),n=e.subschema({schema:_,dataTypes:[],schemaPath:i.nil,topSchemaRef:r,errSchemaPath:c},s),void(e.mergeEvaluated(n),e.ok(s)))}}},2278(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});let a=r(6556),s=r(1403),i=r(9198),n=r(218),o=r(8512);t.default={keyword:"discriminator",type:"object",schemaType:"object",error:{message:({params:{discrError:e,tagName:t}})=>e===s.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:t,tagName:r}})=>(0,a._)`{error: ${e}, tag: ${r}, tagValue: ${t}}`},code(e){let{gen:t,data:r,schema:l,parentSchema:d,it:u}=e,{oneOf:c}=d;if(!u.opts.discriminator)throw Error("discriminator: requires discriminator option");let p=l.propertyName;if("string"!=typeof p)throw Error("discriminator: requires propertyName");if(l.mapping)throw Error("discriminator: mapping is not supported");if(!c)throw Error("discriminator: requires oneOf keyword");let h=t.let("valid",!1),m=t.const("tag",(0,a._)`${r}${(0,a.getProperty)(p)}`);t.if((0,a._)`typeof ${m} == "string"`,()=>(function(){let r=function(){var e;let t={},r=s(d),a=!0;for(let t=0;t<c.length;t++){let d=c[t];if((null==d?void 0:d.$ref)&&!(0,o.schemaHasRulesButRef)(d,u.self.RULES)){let e=d.$ref;if((d=i.resolveRef.call(u.self,u.schemaEnv.root,u.baseId,e))instanceof i.SchemaEnv&&(d=d.schema),void 0===d)throw new n.default(u.opts.uriResolver,u.baseId,e)}let h=null==(e=null==d?void 0:d.properties)?void 0:e[p];if("object"!=typeof h)throw Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${p}"`);a=a&&(r||s(d)),function(e,t){if(e.const)l(e.const,t);else if(e.enum)for(let r of e.enum)l(r,t);else throw Error(`discriminator: "properties/${p}" must have "const" or "enum"`)}(h,t)}if(!a)throw Error(`discriminator: "${p}" must be required`);return t;function s({required:e}){return Array.isArray(e)&&e.includes(p)}function l(e,r){if("string"!=typeof e||e in t)throw Error(`discriminator: "${p}" values must be unique strings`);t[e]=r}}();for(let s in t.if(!1),r)t.elseIf((0,a._)`${m} === ${s}`),t.assign(h,function(r){let s=t.name("valid"),i=e.subschema({keyword:"oneOf",schemaProp:r},s);return e.mergeEvaluated(i,a.Name),s}(r[s]));t.else(),e.error(!1,{discrError:s.DiscrError.Mapping,tag:m,tagName:p}),t.endIf()})(),()=>e.error(!1,{discrError:s.DiscrError.Tag,tag:m,tagName:p})),e.ok(h)}}},1403(e,t){var r,a;Object.defineProperty(t,"__esModule",{value:!0}),t.DiscrError=void 0,(a=r||(t.DiscrError=r={})).Tag="tag",a.Mapping="mapping"},8181(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});let a=r(5861),s=r(4057),i=r(3591),n=r(9961),o=r(6780);t.default=[a.default,s.default,(0,i.default)(),n.default,o.metadataVocabulary,o.contentVocabulary]},2898(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});let a=r(6556);t.default={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:{message:({schemaCode:e})=>(0,a.str)`must match format "${e}"`,params:({schemaCode:e})=>(0,a._)`{format: ${e}}`},code(e,t){let r,s,i,n,o,l,{gen:d,data:u,$data:c,schema:p,schemaCode:h,it:m}=e,{opts:f,errSchemaPath:g,schemaEnv:y,self:v}=m;f.validateFormats&&(c?(r=d.scopeValue("formats",{ref:v.formats,code:f.code.formats}),s=d.const("fDef",(0,a._)`${r}[${h}]`),i=d.let("fType"),n=d.let("format"),d.if((0,a._)`typeof ${s} == "object" && !(${s} instanceof RegExp)`,()=>d.assign(i,(0,a._)`${s}.type || "string"`).assign(n,(0,a._)`${s}.validate`),()=>d.assign(i,(0,a._)`"string"`).assign(n,s)),e.fail$data((0,a.or)(!1===f.strictSchema?a.nil:(0,a._)`${h} && !${n}`,(o=y.$async?(0,a._)`(${s}.async ? await ${n}(${u}) : ${n}(${u}))`:(0,a._)`${n}(${u})`,l=(0,a._)`(typeof ${n} == "function" ? ${o} : ${n}.test(${u}))`,(0,a._)`${n} && ${n} !== true && ${i} === ${t} && !${l}`)))):function(){let r,s,i=v.formats[p];if(!i){if(!1===f.strictSchema)return v.logger.warn(n());throw Error(n());function n(){return`unknown format "${p}" ignored in schema at path "${g}"`}}if(!0===i)return;let[o,l,c]=(r=i instanceof RegExp?(0,a.regexpCode)(i):f.code.formats?(0,a._)`${f.code.formats}${(0,a.getProperty)(p)}`:void 0,s=d.scopeValue("formats",{key:p,ref:i,code:r}),"object"!=typeof i||i instanceof RegExp?["string",i,s]:[i.type||"string",i.validate,(0,a._)`${s}.validate`]);o===t&&e.pass(function(){if("object"==typeof i&&!(i instanceof RegExp)&&i.async){if(!y.$async)throw Error("async format in sync schema");return(0,a._)`await ${c}(${u})`}return"function"==typeof l?(0,a._)`${c}(${u})`:(0,a._)`${c}.test(${u})`}())}())}}},9961(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.default=[r(2898).default]},6780(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.contentVocabulary=t.metadataVocabulary=void 0,t.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"],t.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]},8762(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});let a=r(6556),s=r(8512),i=r(6935);t.default={keyword:"const",$data:!0,error:{message:"must be equal to constant",params:({schemaCode:e})=>(0,a._)`{allowedValue: ${e}}`},code(e){let{gen:t,data:r,$data:n,schemaCode:o,schema:l}=e;n||l&&"object"==typeof l?e.fail$data((0,a._)`!${(0,s.useFunc)(t,i.default)}(${r}, ${o})`):e.fail((0,a._)`${l} !== ${r}`)}}},5344(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});let a=r(6556),s=r(8512),i=r(6935);t.default={keyword:"enum",schemaType:"array",$data:!0,error:{message:"must be equal to one of the allowed values",params:({schemaCode:e})=>(0,a._)`{allowedValues: ${e}}`},code(e){let t,r,{gen:n,data:o,$data:l,schema:d,schemaCode:u,it:c}=e;if(!l&&0===d.length)throw Error("enum must have non-empty array");let p=d.length>=c.opts.loopEnum,h=()=>null!=t?t:t=(0,s.useFunc)(n,i.default);if(p||l)r=n.let("valid"),e.block$data(r,function(){n.assign(r,!1),n.forOf("v",u,e=>n.if((0,a._)`${h()}(${o}, ${e})`,()=>n.assign(r,!0).break()))});else{if(!Array.isArray(d))throw Error("ajv implementation error");let e=n.const("vSchema",u);r=(0,a.or)(...d.map((t,r)=>{let s;return"object"==typeof(s=d[r])&&null!==s?(0,a._)`${h()}(${o}, ${e}[${r}])`:(0,a._)`${o} === ${s}`}))}e.pass(r)}}},4057(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});let a=r(5579),s=r(9812),i=r(1378),n=r(647),o=r(8079),l=r(9240),d=r(1128),u=r(1628),c=r(8762),p=r(5344);t.default=[a.default,s.default,i.default,n.default,o.default,l.default,d.default,u.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},c.default,p.default]},1128(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});let a=r(6556);t.default={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:{message:({keyword:e,schemaCode:t})=>(0,a.str)`must NOT have ${"maxItems"===e?"more":"fewer"} than ${t} items`,params:({schemaCode:e})=>(0,a._)`{limit: ${e}}`},code(e){let{keyword:t,data:r,schemaCode:s}=e,i="maxItems"===t?a.operators.GT:a.operators.LT;e.fail$data((0,a._)`${r}.length ${i} ${s}`)}}},1378(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});let a=r(6556),s=r(8512),i=r(5014);t.default={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:{message:({keyword:e,schemaCode:t})=>(0,a.str)`must NOT have ${"maxLength"===e?"more":"fewer"} than ${t} characters`,params:({schemaCode:e})=>(0,a._)`{limit: ${e}}`},code(e){let{keyword:t,data:r,schemaCode:n,it:o}=e,l="maxLength"===t?a.operators.GT:a.operators.LT,d=!1===o.opts.unicode?(0,a._)`${r}.length`:(0,a._)`${(0,s.useFunc)(e.gen,i.default)}(${r})`;e.fail$data((0,a._)`${d} ${l} ${n}`)}}},5579(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});let a=r(6556),s=a.operators,i={maximum:{okStr:"<=",ok:s.LTE,fail:s.GT},minimum:{okStr:">=",ok:s.GTE,fail:s.LT},exclusiveMaximum:{okStr:"<",ok:s.LT,fail:s.GTE},exclusiveMinimum:{okStr:">",ok:s.GT,fail:s.LTE}};t.default={keyword:Object.keys(i),type:"number",schemaType:"number",$data:!0,error:{message:({keyword:e,schemaCode:t})=>(0,a.str)`must be ${i[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>(0,a._)`{comparison: ${i[e].okStr}, limit: ${t}}`},code(e){let{keyword:t,data:r,schemaCode:s}=e;e.fail$data((0,a._)`${r} ${i[t].fail} ${s} || isNaN(${r})`)}}},8079(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});let a=r(6556);t.default={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:{message:({keyword:e,schemaCode:t})=>(0,a.str)`must NOT have ${"maxProperties"===e?"more":"fewer"} than ${t} properties`,params:({schemaCode:e})=>(0,a._)`{limit: ${e}}`},code(e){let{keyword:t,data:r,schemaCode:s}=e,i="maxProperties"===t?a.operators.GT:a.operators.LT;e.fail$data((0,a._)`Object.keys(${r}).length ${i} ${s}`)}}},9812(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});let a=r(6556);t.default={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:{message:({schemaCode:e})=>(0,a.str)`must be multiple of ${e}`,params:({schemaCode:e})=>(0,a._)`{multipleOf: ${e}}`},code(e){let{gen:t,data:r,schemaCode:s,it:i}=e,n=i.opts.multipleOfPrecision,o=t.let("res"),l=n?(0,a._)`Math.abs(Math.round(${o}) - ${o}) > 1e-${n}`:(0,a._)`${o} !== parseInt(${o})`;e.fail$data((0,a._)`(${s} === 0 || (${o} = ${r}/${s}, ${l}))`)}}},647(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});let a=r(3716),s=r(6556);t.default={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:{message:({schemaCode:e})=>(0,s.str)`must match pattern "${e}"`,params:({schemaCode:e})=>(0,s._)`{pattern: ${e}}`},code(e){let{data:t,$data:r,schema:i,schemaCode:n,it:o}=e,l=o.opts.unicodeRegExp?"u":"",d=r?(0,s._)`(new RegExp(${n}, ${l}))`:(0,a.usePattern)(e,i);e.fail$data((0,s._)`!${d}.test(${t})`)}}},9240(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});let a=r(3716),s=r(6556),i=r(8512);t.default={keyword:"required",type:"object",schemaType:"array",$data:!0,error:{message:({params:{missingProperty:e}})=>(0,s.str)`must have required property '${e}'`,params:({params:{missingProperty:e}})=>(0,s._)`{missingProperty: ${e}}`},code(e){let{gen:t,schema:r,schemaCode:n,data:o,$data:l,it:d}=e,{opts:u}=d;if(!l&&0===r.length)return;let c=r.length>=u.loopRequired;if(d.allErrors?function(){if(c||l)e.block$data(s.nil,p);else for(let t of r)(0,a.checkReportMissingProp)(e,t)}():function(){let i=t.let("missing");if(c||l){let r=t.let("valid",!0);e.block$data(r,()=>{e.setParams({missingProperty:i}),t.forOf(i,n,()=>{t.assign(r,(0,a.propertyInData)(t,o,i,u.ownProperties)),t.if((0,s.not)(r),()=>{e.error(),t.break()})},s.nil)}),e.ok(r)}else t.if((0,a.checkMissingProp)(e,r,i)),(0,a.reportMissingProp)(e,i),t.else()}(),u.strictRequired){let t=e.parentSchema.properties,{definedProperties:a}=e.it;for(let e of r)if((null==t?void 0:t[e])===void 0&&!a.has(e)){let t=d.schemaEnv.baseId+d.errSchemaPath,r=`required property "${e}" is not defined at "${t}" (strictRequired)`;(0,i.checkStrictMode)(d,r,d.opts.strictRequired)}}function p(){t.forOf("prop",n,r=>{e.setParams({missingProperty:r}),t.if((0,a.noPropertyInData)(t,o,r,u.ownProperties),()=>e.error())})}}}},1628(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});let a=r(4029),s=r(6556),i=r(8512),n=r(6935);t.default={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:{message:({params:{i:e,j:t}})=>(0,s.str)`must NOT have duplicate items (items ## ${t} and ${e} are identical)`,params:({params:{i:e,j:t}})=>(0,s._)`{i: ${e}, j: ${t}}`},code(e){let{gen:t,data:r,$data:o,schema:l,parentSchema:d,schemaCode:u,it:c}=e;if(!o&&!l)return;let p=t.let("valid"),h=d.items?(0,a.getSchemaTypes)(d.items):[];e.block$data(p,function(){let o=t.let("i",(0,s._)`${r}.length`),l=t.let("j");e.setParams({i:o,j:l}),t.assign(p,!0),t.if((0,s._)`${o} > 1`,()=>(h.length>0&&!h.some(e=>"object"===e||"array"===e)?function(i,n){let o=t.name("item"),l=(0,a.checkDataTypes)(h,o,c.opts.strictNumbers,a.DataType.Wrong),d=t.const("indices",(0,s._)`{}`);t.for((0,s._)`;${i}--;`,()=>{t.let(o,(0,s._)`${r}[${i}]`),t.if(l,(0,s._)`continue`),h.length>1&&t.if((0,s._)`typeof ${o} == "string"`,(0,s._)`${o} += "_"`),t.if((0,s._)`typeof ${d}[${o}] == "number"`,()=>{t.assign(n,(0,s._)`${d}[${o}]`),e.error(),t.assign(p,!1).break()}).code((0,s._)`${d}[${o}] = ${i}`)})}:function(a,o){let l=(0,i.useFunc)(t,n.default),d=t.name("outer");t.label(d).for((0,s._)`;${a}--;`,()=>t.for((0,s._)`${o} = ${a}; ${o}--;`,()=>t.if((0,s._)`${l}(${r}[${a}], ${r}[${o}])`,()=>{e.error(),t.assign(p,!1).break(d)})))})(o,l))},(0,s._)`${u} === false`),e.ok(p)}}},8583(e,t,r){let a=r(9896),s=r(6928),i=r(857),n=r(6982),o=r(4519).version,l=/(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg;function d(e){console.log(`[dotenv@${o}][DEBUG] ${e}`)}function u(e){console.log(`[dotenv@${o}] ${e}`)}function c(e){return e&&e.DOTENV_KEY&&e.DOTENV_KEY.length>0?e.DOTENV_KEY:process.env.DOTENV_KEY&&process.env.DOTENV_KEY.length>0?process.env.DOTENV_KEY:""}function p(e){let t=null;if(e&&e.path&&e.path.length>0)if(Array.isArray(e.path))for(let r of e.path)a.existsSync(r)&&(t=r.endsWith(".vault")?r:`${r}.vault`);else t=e.path.endsWith(".vault")?e.path:`${e.path}.vault`;else t=s.resolve(process.cwd(),".env.vault");return a.existsSync(t)?t:null}function h(e){return"~"===e[0]?s.join(i.homedir(),e.slice(1)):e}let m={configDotenv:function(e){let t,r=s.resolve(process.cwd(),".env"),i="utf8",n=!!(e&&e.debug),o=!e||!("quiet"in e)||e.quiet;e&&e.encoding?i=e.encoding:n&&d("No encoding is specified. UTF-8 is used by default");let l=[r];if(e&&e.path)if(Array.isArray(e.path))for(let t of(l=[],e.path))l.push(h(t));else l=[h(e.path)];let c={};for(let r of l)try{let t=m.parse(a.readFileSync(r,{encoding:i}));m.populate(c,t,e)}catch(e){n&&d(`Failed to load ${r} ${e.message}`),t=e}let p=process.env;if(e&&null!=e.processEnv&&(p=e.processEnv),m.populate(p,c,e),n||!o){let e=Object.keys(c).length,r=[];for(let e of l)try{let t=s.relative(process.cwd(),e);r.push(t)}catch(r){n&&d(`Failed to load ${e} ${r.message}`),t=r}u(`injecting env (${e}) from ${r.join(",")}`)}return t?{parsed:c,error:t}:{parsed:c}},_configVault:function(e){let t=!!(e&&e.debug),r=!e||!("quiet"in e)||e.quiet;(t||!r)&&u("Loading env from encrypted .env.vault");let a=m._parseVault(e),s=process.env;return e&&null!=e.processEnv&&(s=e.processEnv),m.populate(s,a,e),{parsed:a}},_parseVault:function(e){let t,r=p(e=e||{});e.path=r;let a=m.configDotenv(e);if(!a.parsed){let e=Error(`MISSING_DATA: Cannot parse ${r} for an unknown reason`);throw e.code="MISSING_DATA",e}let s=c(e).split(","),i=s.length;for(let e=0;e<i;e++)try{let r=s[e].trim(),i=function(e,t){let r;try{r=new URL(t)}catch(e){if("ERR_INVALID_URL"===e.code){let e=Error("INVALID_DOTENV_KEY: Wrong format. Must be in valid uri format like dotenv://:key_1234@dotenvx.com/vault/.env.vault?environment=development");throw e.code="INVALID_DOTENV_KEY",e}throw e}let a=r.password;if(!a){let e=Error("INVALID_DOTENV_KEY: Missing key part");throw e.code="INVALID_DOTENV_KEY",e}let s=r.searchParams.get("environment");if(!s){let e=Error("INVALID_DOTENV_KEY: Missing environment part");throw e.code="INVALID_DOTENV_KEY",e}let i=`DOTENV_VAULT_${s.toUpperCase()}`,n=e.parsed[i];if(!n){let e=Error(`NOT_FOUND_DOTENV_ENVIRONMENT: Cannot locate environment ${i} in your .env.vault file.`);throw e.code="NOT_FOUND_DOTENV_ENVIRONMENT",e}return{ciphertext:n,key:a}}(a,r);t=m.decrypt(i.ciphertext,i.key);break}catch(t){if(e+1>=i)throw t}return m.parse(t)},config:function(e){if(0===c(e).length)return m.configDotenv(e);let t=p(e);if(!t){var r;return r=`You set DOTENV_KEY but you are missing a .env.vault file at ${t}. Did you forget to build it?`,console.log(`[dotenv@${o}][WARN] ${r}`),m.configDotenv(e)}return m._configVault(e)},decrypt:function(e,t){let r=Buffer.from(t.slice(-64),"hex"),a=Buffer.from(e,"base64"),s=a.subarray(0,12),i=a.subarray(-16);a=a.subarray(12,-16);try{let e=n.createDecipheriv("aes-256-gcm",r,s);return e.setAuthTag(i),`${e.update(a)}${e.final()}`}catch(a){let e=a instanceof RangeError,t="Invalid key length"===a.message,r="Unsupported state or unable to authenticate data"===a.message;if(e||t){let e=Error("INVALID_DOTENV_KEY: It must be 64 characters long (or more)");throw e.code="INVALID_DOTENV_KEY",e}if(r){let e=Error("DECRYPTION_FAILED: Please check your DOTENV_KEY");throw e.code="DECRYPTION_FAILED",e}throw a}},parse:function(e){let t,r={},a=e.toString();for(a=a.replace(/\r\n?/mg,"\n");null!=(t=l.exec(a));){let e=t[1],a=t[2]||"",s=(a=a.trim())[0];a=a.replace(/^(['"`])([\s\S]*)\1$/mg,"$2"),'"'===s&&(a=(a=a.replace(/\\n/g,"\n")).replace(/\\r/g,"\r")),r[e]=a}return r},populate:function(e,t,r={}){let a=!!(r&&r.debug),s=!!(r&&r.override);if("object"!=typeof t){let e=Error("OBJECT_REQUIRED: Please check the processEnv argument being passed to populate");throw e.code="OBJECT_REQUIRED",e}for(let r of Object.keys(t))Object.prototype.hasOwnProperty.call(e,r)?(!0===s&&(e[r]=t[r]),a&&(!0===s?d(`"${r}" is already defined and WAS overwritten`):d(`"${r}" is already defined and was NOT overwritten`))):e[r]=t[r]}};e.exports.configDotenv=m.configDotenv,e.exports._configVault=m._configVault,e.exports._parseVault=m._parseVault,e.exports.config=m.config,e.exports.decrypt=m.decrypt,e.exports.parse=m.parse,e.exports.populate=m.populate,e.exports=m},7371(e){e.exports=function e(t,r){if(t===r)return!0;if(t&&r&&"object"==typeof t&&"object"==typeof r){if(t.constructor!==r.constructor)return!1;if(Array.isArray(t)){if((a=t.length)!=r.length)return!1;for(s=a;0!=s--;)if(!e(t[s],r[s]))return!1;return!0}if(t.constructor===RegExp)return t.source===r.source&&t.flags===r.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===r.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===r.toString();if((a=(i=Object.keys(t)).length)!==Object.keys(r).length)return!1;for(s=a;0!=s--;)if(!Object.prototype.hasOwnProperty.call(r,i[s]))return!1;for(s=a;0!=s--;){var a,s,i,n=i[s];if(!e(t[n],r[n]))return!1}return!0}return t!=t&&r!=r}},205(e){var t=e.exports=function(e,r,a){"function"==typeof r&&(a=r,r={});var s="function"==typeof(a=r.cb||a)?a:a.pre||function(){};!function e(r,a,s,i,n,o,l,d,u,c){if(i&&"object"==typeof i&&!Array.isArray(i)){for(var p in a(i,n,o,l,d,u,c),i){var h=i[p];if(Array.isArray(h)){if(p in t.arrayKeywords)for(var m=0;m<h.length;m++)e(r,a,s,h[m],n+"/"+p+"/"+m,o,n,p,i,m)}else if(p in t.propsKeywords){if(h&&"object"==typeof h)for(var f in h)e(r,a,s,h[f],n+"/"+p+"/"+f.replace(/~/g,"~0").replace(/\//g,"~1"),o,n,p,i,f)}else(p in t.keywords||r.allKeys&&!(p in t.skipKeywords))&&e(r,a,s,h,n+"/"+p,o,n,p,i)}s(i,n,o,l,d,u,c)}}(r,s,a.post||function(){},e,"",e)};t.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0},t.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0},t.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0},t.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0}},6982(e){e.exports=require("crypto")},9896(e){e.exports=require("fs")},857(e){e.exports=require("os")},6928(e){e.exports=require("path")},5019(e,t,r){let{normalizeIPv6:a,removeDotSegments:s,recomposeAuthority:i,normalizeComponentEncoding:n,isIPv4:o,nonSimpleDomain:l}=r(6214),{SCHEMES:d,getSchemeHandler:u}=r(9147);function c(e,t,r,a){let i={};return a||(e=m(p(e,r),r),t=m(p(t,r),r)),!(r=r||{}).tolerant&&t.scheme?(i.scheme=t.scheme,i.userinfo=t.userinfo,i.host=t.host,i.port=t.port,i.path=s(t.path||""),i.query=t.query):(void 0!==t.userinfo||void 0!==t.host||void 0!==t.port?(i.userinfo=t.userinfo,i.host=t.host,i.port=t.port,i.path=s(t.path||""),i.query=t.query):(t.path?("/"===t.path[0]?i.path=s(t.path):(void 0===e.userinfo&&void 0===e.host&&void 0===e.port||e.path?e.path?i.path=e.path.slice(0,e.path.lastIndexOf("/")+1)+t.path:i.path=t.path:i.path="/"+t.path,i.path=s(i.path)),i.query=t.query):(i.path=e.path,void 0!==t.query?i.query=t.query:i.query=e.query),i.userinfo=e.userinfo,i.host=e.host,i.port=e.port),i.scheme=e.scheme),i.fragment=t.fragment,i}function p(e,t){let r={host:e.host,scheme:e.scheme,userinfo:e.userinfo,port:e.port,path:e.path,query:e.query,nid:e.nid,nss:e.nss,uuid:e.uuid,fragment:e.fragment,reference:e.reference,resourceName:e.resourceName,secure:e.secure,error:""},a=Object.assign({},t),n=[],o=u(a.scheme||r.scheme);o&&o.serialize&&o.serialize(r,a),void 0!==r.path&&(a.skipEscape?r.path=unescape(r.path):(r.path=escape(r.path),void 0!==r.scheme&&(r.path=r.path.split("%3A").join(":")))),"suffix"!==a.reference&&r.scheme&&n.push(r.scheme,":");let l=i(r);if(void 0!==l&&("suffix"!==a.reference&&n.push("//"),n.push(l),r.path&&"/"!==r.path[0]&&n.push("/")),void 0!==r.path){let e=r.path;a.absolutePath||o&&o.absolutePath||(e=s(e)),void 0===l&&"/"===e[0]&&"/"===e[1]&&(e="/%2F"+e.slice(2)),n.push(e)}return void 0!==r.query&&n.push("?",r.query),void 0!==r.fragment&&n.push("#",r.fragment),n.join("")}let h=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function m(e,t){let r=Object.assign({},t),s={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},i=!1;"suffix"===r.reference&&(e=r.scheme?r.scheme+":"+e:"//"+e);let n=e.match(h);if(n){if(s.scheme=n[1],s.userinfo=n[3],s.host=n[4],s.port=parseInt(n[5],10),s.path=n[6]||"",s.query=n[7],s.fragment=n[8],isNaN(s.port)&&(s.port=n[5]),s.host)if(!1===o(s.host)){let e=a(s.host);s.host=e.host.toLowerCase(),i=e.isIPV6}else i=!0;void 0!==s.scheme||void 0!==s.userinfo||void 0!==s.host||void 0!==s.port||void 0!==s.query||s.path?void 0===s.scheme?s.reference="relative":void 0===s.fragment?s.reference="absolute":s.reference="uri":s.reference="same-document",r.reference&&"suffix"!==r.reference&&r.reference!==s.reference&&(s.error=s.error||"URI is not a "+r.reference+" reference.");let t=u(r.scheme||s.scheme);if(!r.unicodeSupport&&(!t||!t.unicodeSupport)&&s.host&&(r.domainHost||t&&t.domainHost)&&!1===i&&l(s.host))try{s.host=URL.domainToASCII(s.host.toLowerCase())}catch(e){s.error=s.error||"Host's domain name can not be converted to ASCII: "+e}(!t||t&&!t.skipNormalize)&&(-1!==e.indexOf("%")&&(void 0!==s.scheme&&(s.scheme=unescape(s.scheme)),void 0!==s.host&&(s.host=unescape(s.host))),s.path&&(s.path=escape(unescape(s.path))),s.fragment&&(s.fragment=encodeURI(decodeURIComponent(s.fragment)))),t&&t.parse&&t.parse(s,r)}else s.error=s.error||"URI can not be parsed.";return s}let f={SCHEMES:d,normalize:function(e,t){return"string"==typeof e?e=p(m(e,t),t):"object"==typeof e&&(e=m(p(e,t),t)),e},resolve:function(e,t,r){let a=r?Object.assign({scheme:"null"},r):{scheme:"null"},s=c(m(e,a),m(t,a),a,!0);return a.skipEscape=!0,p(s,a)},resolveComponent:c,equal:function(e,t,r){return"string"==typeof e?e=p(n(m(e=unescape(e),r),!0),{...r,skipEscape:!0}):"object"==typeof e&&(e=p(n(e,!0),{...r,skipEscape:!0})),"string"==typeof t?t=p(n(m(t=unescape(t),r),!0),{...r,skipEscape:!0}):"object"==typeof t&&(t=p(n(t,!0),{...r,skipEscape:!0})),e.toLowerCase()===t.toLowerCase()},serialize:p,parse:m};e.exports=f,e.exports.default=f,e.exports.fastUri=f},9147(e,t,r){let{isUUID:a}=r(6214),s=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,i=["http","https","ws","wss","urn","urn:uuid"];function n(e){return!0===e.secure||!1!==e.secure&&!!e.scheme&&3===e.scheme.length&&("w"===e.scheme[0]||"W"===e.scheme[0])&&("s"===e.scheme[1]||"S"===e.scheme[1])&&("s"===e.scheme[2]||"S"===e.scheme[2])}function o(e){return e.host||(e.error=e.error||"HTTP URIs must have a host."),e}function l(e){let t="https"===String(e.scheme).toLowerCase();return(e.port===(t?443:80)||""===e.port)&&(e.port=void 0),e.path||(e.path="/"),e}let d={scheme:"http",domainHost:!0,parse:o,serialize:l},u={scheme:"https",domainHost:d.domainHost,parse:o,serialize:l},c={scheme:"ws",domainHost:!0,parse:function(e){return e.secure=n(e),e.resourceName=(e.path||"/")+(e.query?"?"+e.query:""),e.path=void 0,e.query=void 0,e},serialize:function(e){if((e.port===(n(e)?443:80)||""===e.port)&&(e.port=void 0),"boolean"==typeof e.secure&&(e.scheme=e.secure?"wss":"ws",e.secure=void 0),e.resourceName){let[t,r]=e.resourceName.split("?");e.path=t&&"/"!==t?t:void 0,e.query=r,e.resourceName=void 0}return e.fragment=void 0,e}},p={scheme:"wss",domainHost:c.domainHost,parse:c.parse,serialize:c.serialize},h={http:d,https:u,ws:c,wss:p,urn:{scheme:"urn",parse:function(e,t){if(!e.path)return e.error="URN can not be parsed",e;let r=e.path.match(s);if(r){let a=t.scheme||e.scheme||"urn";e.nid=r[1].toLowerCase(),e.nss=r[2];let s=m(`${a}:${t.nid||e.nid}`);e.path=void 0,s&&(e=s.parse(e,t))}else e.error=e.error||"URN can not be parsed.";return e},serialize:function(e,t){if(void 0===e.nid)throw Error("URN without nid cannot be serialized");let r=t.scheme||e.scheme||"urn",a=e.nid.toLowerCase(),s=m(`${r}:${t.nid||a}`);s&&(e=s.serialize(e,t));let i=e,n=e.nss;return i.path=`${a||t.nid}:${n}`,t.skipEscape=!0,i},skipNormalize:!0},"urn:uuid":{scheme:"urn:uuid",parse:function(e,t){return e.uuid=e.nss,e.nss=void 0,t.tolerant||e.uuid&&a(e.uuid)||(e.error=e.error||"UUID is not valid."),e},serialize:function(e){return e.nss=(e.uuid||"").toLowerCase(),e},skipNormalize:!0}};function m(e){return e&&(h[e]||h[e.toLowerCase()])||void 0}Object.setPrototypeOf(h,null),e.exports={wsIsSecure:n,SCHEMES:h,isValidSchemeName:function(e){return -1!==i.indexOf(e)},getSchemeHandler:m}},6214(e){let t=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),r=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 a(e){let t="",r=0,a=0;for(a=0;a<e.length;a++)if(48!==(r=e[a].charCodeAt(0))){if(!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[a];break}for(a+=1;a<e.length;a++){if(!((r=e[a].charCodeAt(0))>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[a]}return t}function s(e){return e.length=0,!0}function i(e,t,r){if(e.length){let s=a(e);if(""===s)return r.error=!0,!1;t.push(s),e.length=0}return!0}function n(e){if(2>function(e,t){let r=0;for(let t=0;t<e.length;t++)":"===e[t]&&r++;return r}(e,0))return{host:e,isIPV6:!1};let t=function(e){let t=0,r={error:!1,address:"",zone:""},n=[],o=[],l=!1,d=!1,u=i;for(let a=0;a<e.length;a++){let i=e[a];if("["!==i&&"]"!==i)if(":"===i){if(!0===l&&(d=!0),!u(o,n,r))break;if(++t>7){r.error=!0;break}a>0&&":"===e[a-1]&&(l=!0),n.push(":");continue}else if("%"===i){if(!u(o,n,r))break;u=s}else{o.push(i);continue}}return o.length&&(u===s?r.zone=o.join(""):d?n.push(o.join("")):n.push(a(o))),r.address=n.join(""),r}(e);if(t.error)return{host:e,isIPV6:!1};{let e=t.address,r=t.address;return t.zone&&(e+="%"+t.zone,r+="%25"+t.zone),{host:e,isIPV6:!0,escapedHost:r}}}e.exports={nonSimpleDomain:RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u),recomposeAuthority:function(e){let t=[];if(void 0!==e.userinfo&&(t.push(e.userinfo),t.push("@")),void 0!==e.host){let a=unescape(e.host);if(!r(a)){let t=n(a);a=!0===t.isIPV6?`[${t.escapedHost}]`:e.host}t.push(a)}return("number"==typeof e.port||"string"==typeof e.port)&&(t.push(":"),t.push(String(e.port))),t.length?t.join(""):void 0},normalizeComponentEncoding:function(e,t){let r=!0!==t?escape:unescape;return void 0!==e.scheme&&(e.scheme=r(e.scheme)),void 0!==e.userinfo&&(e.userinfo=r(e.userinfo)),void 0!==e.host&&(e.host=r(e.host)),void 0!==e.path&&(e.path=r(e.path)),void 0!==e.query&&(e.query=r(e.query)),void 0!==e.fragment&&(e.fragment=r(e.fragment)),e},removeDotSegments:function(e){let t=e,r=[],a=-1,s=0;for(;s=t.length;){if(1===s)if("."===t)break;else if("/"===t){r.push("/");break}else{r.push(t);break}if(2===s){if("."===t[0]){if("."===t[1])break;else if("/"===t[1]){t=t.slice(2);continue}}else if("/"===t[0]&&("."===t[1]||"/"===t[1])){r.push("/");break}}else if(3===s&&"/.."===t){0!==r.length&&r.pop(),r.push("/");break}if("."===t[0]){if("."===t[1]){if("/"===t[2]){t=t.slice(3);continue}}else if("/"===t[1]){t=t.slice(2);continue}}else if("/"===t[0]&&"."===t[1]){if("/"===t[2]){t=t.slice(2);continue}else if("."===t[2]&&"/"===t[3]){t=t.slice(3),0!==r.length&&r.pop();continue}}if(-1===(a=t.indexOf("/",1))){r.push(t);break}r.push(t.slice(0,a)),t=t.slice(a)}return r.join("")},isIPv4:r,isUUID:t,normalizeIPv6:n,stringArrayToHexStripped:a}},2200(e){e.exports=JSON.parse('{"$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}')},7578(e){e.exports=JSON.parse('{"$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}')},4519(e){e.exports=JSON.parse('{"name":"dotenv","version":"16.6.1","description":"Loads environment variables from .env file","main":"lib/main.js","types":"lib/main.d.ts","exports":{".":{"types":"./lib/main.d.ts","require":"./lib/main.js","default":"./lib/main.js"},"./config":"./config.js","./config.js":"./config.js","./lib/env-options":"./lib/env-options.js","./lib/env-options.js":"./lib/env-options.js","./lib/cli-options":"./lib/cli-options.js","./lib/cli-options.js":"./lib/cli-options.js","./package.json":"./package.json"},"scripts":{"dts-check":"tsc --project tests/types/tsconfig.json","lint":"standard","pretest":"npm run lint && npm run dts-check","test":"tap run --allow-empty-coverage --disable-coverage --timeout=60000","test:coverage":"tap run --show-full-coverage --timeout=60000 --coverage-report=text --coverage-report=lcov","prerelease":"npm test","release":"standard-version"},"repository":{"type":"git","url":"git://github.com/motdotla/dotenv.git"},"homepage":"https://github.com/motdotla/dotenv#readme","funding":"https://dotenvx.com","keywords":["dotenv","env",".env","environment","variables","config","settings"],"readmeFilename":"README.md","license":"BSD-2-Clause","devDependencies":{"@types/node":"^18.11.3","decache":"^4.6.2","sinon":"^14.0.1","standard":"^17.0.0","standard-version":"^9.5.0","tap":"^19.2.0","typescript":"^4.8.4"},"engines":{"node":">=12"},"browser":{"fs":false}}')}},s={};function i(t){var r=s[t];if(void 0!==r)return r.exports;var a=s[t]={exports:{}};return e[t](a,a.exports,i),a.exports}return i.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return i.d(t,{a:t}),t},i.d=(e,t)=>{for(var r in t)i.o(t,r)&&!i.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{let e,s,n,o,l,d=require("node:process");function u(e,t,r){function a(r,a){if(r._zod||Object.defineProperty(r,"_zod",{value:{def:a,constr:n,traits:new Set},enumerable:!1}),r._zod.traits.has(e))return;r._zod.traits.add(e),t(r,a);let s=n.prototype,i=Object.keys(s);for(let e=0;e<i.length;e++){let t=i[e];t in r||(r[t]=s[t].bind(r))}}let s=r?.Parent??Object;class i extends s{}function n(e){var t;let s=r?.Parent?new i:this;for(let r of(a(s,e),(t=s._zod).deferred??(t.deferred=[]),s._zod.deferred))r();return s}return Object.defineProperty(i,"name",{value:e}),Object.defineProperty(n,"init",{value:a}),Object.defineProperty(n,Symbol.hasInstance,{value:t=>!!r?.Parent&&t instanceof r.Parent||t?._zod?.traits?.has(e)}),Object.defineProperty(n,"name",{value:e}),n}Object.freeze({status:"aborted"}),Symbol("zod_brand");class c extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class p extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}}let h={};function m(e){return e&&Object.assign(h,e),h}function f(e){let t=Object.values(e).filter(e=>"number"==typeof e);return Object.entries(e).filter(([e,r])=>-1===t.indexOf(+e)).map(([e,t])=>t)}function g(e,t="|"){return e.map(e=>R(e)).join(t)}function y(e,t){return"bigint"==typeof t?t.toString():t}function v(e){return{get value(){{let t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function _(e){let t=+!!e.startsWith("^"),r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}let b=Symbol("evaluating");function w(e,t,r){let a;Object.defineProperty(e,t,{get(){if(a!==b)return void 0===a&&(a=b,a=r()),a},set(r){Object.defineProperty(e,t,{value:r})},configurable:!0})}function $(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function k(...e){let t={};for(let r of e)Object.assign(t,Object.getOwnPropertyDescriptors(r));return Object.defineProperties({},t)}function x(e){return JSON.stringify(e)}let S="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function T(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}let E=v(()=>{if("u">typeof navigator&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return Function(""),!0}catch(e){return!1}});function P(e){if(!1===T(e))return!1;let t=e.constructor;if(void 0===t||"function"!=typeof t)return!0;let r=t.prototype;return!1!==T(r)&&!1!==Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")}function j(e){return P(e)?{...e}:Array.isArray(e)?[...e]:e}let O=new Set(["string","number","symbol"]);function I(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function N(e,t,r){let a=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(a._zod.parent=e),a}function z(e){if(!e)return{};if("string"==typeof e)return{error:()=>e};if(e?.message!==void 0){if(e?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");e.error=e.message}return(delete e.message,"string"==typeof e.error)?{...e,error:()=>e.error}:e}function R(e){return"bigint"==typeof e?e.toString()+"n":"string"==typeof e?`"${e}"`:`${e}`}let C={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-0x80000000,0x7fffffff],uint32:[0,0xffffffff],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function A(e,t=0){if(!0===e.aborted)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function M(e,t){return t.map(t=>(t.path??(t.path=[]),t.path.unshift(e),t))}function Z(e){return"string"==typeof e?e:e?.message}function D(e,t,r){let a={...e,path:e.path??[]};return e.message||(a.message=Z(e.inst?._zod.def?.error?.(e))??Z(t?.error?.(e))??Z(r.customError?.(e))??Z(r.localeError?.(e))??"Invalid input"),delete a.inst,delete a.continue,t?.reportInput||delete a.input,a}function q(e){return Array.isArray(e)?"array":"string"==typeof e?"string":"unknown"}function V(...e){let[t,r,a]=e;return"string"==typeof t?{message:t,code:"custom",input:r,inst:a}:{...t}}let L=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,y,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},F=u("$ZodError",L),U=u("$ZodError",L,{Parent:Error}),H=e=>(t,r,a,s)=>{let i=a?Object.assign(a,{async:!1}):{async:!1},n=t._zod.run({value:r,issues:[]},i);if(n instanceof Promise)throw new c;if(n.issues.length){let t=new(s?.Err??e)(n.issues.map(e=>D(e,i,m())));throw S(t,s?.callee),t}return n.value},K=H(U),J=e=>async(t,r,a,s)=>{let i=a?Object.assign(a,{async:!0}):{async:!0},n=t._zod.run({value:r,issues:[]},i);if(n instanceof Promise&&(n=await n),n.issues.length){let t=new(s?.Err??e)(n.issues.map(e=>D(e,i,m())));throw S(t,s?.callee),t}return n.value},B=J(U),W=e=>(t,r,a)=>{let s=a?{...a,async:!1}:{async:!1},i=t._zod.run({value:r,issues:[]},s);if(i instanceof Promise)throw new c;return i.issues.length?{success:!1,error:new(e??F)(i.issues.map(e=>D(e,s,m())))}:{success:!0,data:i.value}},G=W(U),Y=e=>async(t,r,a)=>{let s=a?Object.assign(a,{async:!0}):{async:!0},i=t._zod.run({value:r,issues:[]},s);return i instanceof Promise&&(i=await i),i.issues.length?{success:!1,error:new e(i.issues.map(e=>D(e,s,m())))}:{success:!0,data:i.value}},Q=Y(U),X=/^[cC][^\s-]{8,}$/,ee=/^[0-9a-z]+$/,et=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,er=/^[0-9a-vA-V]{20}$/,ea=/^[A-Za-z0-9]{27}$/,es=/^[a-zA-Z0-9_-]{21}$/,ei=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,en=/^([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})$/,eo=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,el=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,ed=/^(?:(?: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])$/,eu=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,ec=/^((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])$/,ep=/^(([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])$/,eh=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,em=/^[A-Za-z0-9_-]*$/,ef=/^\+(?:[0-9]){6,14}[0-9]$/,eg="(?:(?:\\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])))",ey=RegExp(`^${eg}$`);function ev(e){let t="(?:[01]\\d|2[0-3]):[0-5]\\d";return"number"==typeof e.precision?-1===e.precision?`${t}`:0===e.precision?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}let e_=/^-?\d+$/,eb=/^-?\d+(?:\.\d+)?/,ew=/^(?:true|false)$/i,e$=/^null$/i,ek=/^[^A-Z]*$/,ex=/^[^a-z]*$/,eS=u("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),eT={number:"number",bigint:"bigint",object:"date"},eE=u("$ZodCheckLessThan",(e,t)=>{eS.init(e,t);let r=eT[typeof t.value];e._zod.onattach.push(e=>{let r=e._zod.bag,a=(t.inclusive?r.maximum:r.exclusiveMaximum)??1/0;t.value<a&&(t.inclusive?r.maximum=t.value:r.exclusiveMaximum=t.value)}),e._zod.check=a=>{(t.inclusive?a.value<=t.value:a.value<t.value)||a.issues.push({origin:r,code:"too_big",maximum:t.value,input:a.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),eP=u("$ZodCheckGreaterThan",(e,t)=>{eS.init(e,t);let r=eT[typeof t.value];e._zod.onattach.push(e=>{let r=e._zod.bag,a=(t.inclusive?r.minimum:r.exclusiveMinimum)??-1/0;t.value>a&&(t.inclusive?r.minimum=t.value:r.exclusiveMinimum=t.value)}),e._zod.check=a=>{(t.inclusive?a.value>=t.value:a.value>t.value)||a.issues.push({origin:r,code:"too_small",minimum:t.value,input:a.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),ej=u("$ZodCheckMultipleOf",(e,t)=>{eS.init(e,t),e._zod.onattach.push(e=>{var r;(r=e._zod.bag).multipleOf??(r.multipleOf=t.value)}),e._zod.check=r=>{if(typeof r.value!=typeof t.value)throw Error("Cannot mix number and bigint in multiple_of check.");("bigint"==typeof r.value?r.value%t.value===BigInt(0):0===function(e,t){let r=(e.toString().split(".")[1]||"").length,a=t.toString(),s=(a.split(".")[1]||"").length;if(0===s&&/\d?e-\d?/.test(a)){let e=a.match(/\d?e-(\d?)/);e?.[1]&&(s=Number.parseInt(e[1]))}let i=r>s?r:s;return Number.parseInt(e.toFixed(i).replace(".",""))%Number.parseInt(t.toFixed(i).replace(".",""))/10**i}(r.value,t.value))||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}}),eO=u("$ZodCheckNumberFormat",(e,t)=>{eS.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),a=r?"int":"number",[s,i]=C[t.format];e._zod.onattach.push(e=>{let a=e._zod.bag;a.format=t.format,a.minimum=s,a.maximum=i,r&&(a.pattern=e_)}),e._zod.check=n=>{let o=n.value;if(r){if(!Number.isInteger(o))return void n.issues.push({expected:a,format:t.format,code:"invalid_type",continue:!1,input:o,inst:e});if(!Number.isSafeInteger(o))return void(o>0?n.issues.push({input:o,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:a,continue:!t.abort}):n.issues.push({input:o,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:a,continue:!t.abort}))}o<s&&n.issues.push({origin:"number",input:o,code:"too_small",minimum:s,inclusive:!0,inst:e,continue:!t.abort}),o>i&&n.issues.push({origin:"number",input:o,code:"too_big",maximum:i,inst:e})}}),eI=u("$ZodCheckMaxLength",(e,t)=>{var r;eS.init(e,t),(r=e._zod.def).when??(r.when=e=>{let t=e.value;return null!=t&&void 0!==t.length}),e._zod.onattach.push(e=>{let r=e._zod.bag.maximum??1/0;t.maximum<r&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=r=>{let a=r.value;if(a.length<=t.maximum)return;let s=q(a);r.issues.push({origin:s,code:"too_big",maximum:t.maximum,inclusive:!0,input:a,inst:e,continue:!t.abort})}}),eN=u("$ZodCheckMinLength",(e,t)=>{var r;eS.init(e,t),(r=e._zod.def).when??(r.when=e=>{let t=e.value;return null!=t&&void 0!==t.length}),e._zod.onattach.push(e=>{let r=e._zod.bag.minimum??-1/0;t.minimum>r&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=r=>{let a=r.value;if(a.length>=t.minimum)return;let s=q(a);r.issues.push({origin:s,code:"too_small",minimum:t.minimum,inclusive:!0,input:a,inst:e,continue:!t.abort})}}),ez=u("$ZodCheckLengthEquals",(e,t)=>{var r;eS.init(e,t),(r=e._zod.def).when??(r.when=e=>{let t=e.value;return null!=t&&void 0!==t.length}),e._zod.onattach.push(e=>{let r=e._zod.bag;r.minimum=t.length,r.maximum=t.length,r.length=t.length}),e._zod.check=r=>{let a=r.value,s=a.length;if(s===t.length)return;let i=q(a),n=s>t.length;r.issues.push({origin:i,...n?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),eR=u("$ZodCheckStringFormat",(e,t)=>{var r,a;eS.init(e,t),e._zod.onattach.push(e=>{let r=e._zod.bag;r.format=t.format,t.pattern&&(r.patterns??(r.patterns=new Set),r.patterns.add(t.pattern))}),t.pattern?(r=e._zod).check??(r.check=r=>{t.pattern.lastIndex=0,t.pattern.test(r.value)||r.issues.push({origin:"string",code:"invalid_format",format:t.format,input:r.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(a=e._zod).check??(a.check=()=>{})}),eC=u("$ZodCheckRegex",(e,t)=>{eR.init(e,t),e._zod.check=r=>{t.pattern.lastIndex=0,t.pattern.test(r.value)||r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),eA=u("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=ek),eR.init(e,t)}),eM=u("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=ex),eR.init(e,t)}),eZ=u("$ZodCheckIncludes",(e,t)=>{eS.init(e,t);let r=I(t.includes),a=new RegExp("number"==typeof t.position?`^.{${t.position}}${r}`:r);t.pattern=a,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(a)}),e._zod.check=r=>{r.value.includes(t.includes,t.position)||r.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:r.value,inst:e,continue:!t.abort})}}),eD=u("$ZodCheckStartsWith",(e,t)=>{eS.init(e,t);let r=RegExp(`^${I(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(r)}),e._zod.check=r=>{r.value.startsWith(t.prefix)||r.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:r.value,inst:e,continue:!t.abort})}}),eq=u("$ZodCheckEndsWith",(e,t)=>{eS.init(e,t);let r=RegExp(`.*${I(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(r)}),e._zod.check=r=>{r.value.endsWith(t.suffix)||r.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:r.value,inst:e,continue:!t.abort})}}),eV=u("$ZodCheckOverwrite",(e,t)=>{eS.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}});class eL{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if("function"==typeof e){e(this,{execution:"sync"}),e(this,{execution:"async"});return}let t=e.split("\n").filter(e=>e),r=Math.min(...t.map(e=>e.length-e.trimStart().length));for(let e of t.map(e=>e.slice(r)).map(e=>" ".repeat(2*this.indent)+e))this.content.push(e)}compile(){return Function(...this?.args,[...(this?.content??[""]).map(e=>` ${e}`)].join("\n"))}}let eF={major:4,minor:1,patch:13},eU=u("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=eF;let a=[...e._zod.def.checks??[]];for(let t of(e._zod.traits.has("$ZodCheck")&&a.unshift(e),a))for(let r of t._zod.onattach)r(e);if(0===a.length)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(e,t,r)=>{let a,s=A(e);for(let i of t){if(i._zod.def.when){if(!i._zod.def.when(e))continue}else if(s)continue;let t=e.issues.length,n=i._zod.check(e);if(n instanceof Promise&&r?.async===!1)throw new c;if(a||n instanceof Promise)a=(a??Promise.resolve()).then(async()=>{await n,e.issues.length!==t&&(s||(s=A(e,t)))});else{if(e.issues.length===t)continue;s||(s=A(e,t))}}return a?a.then(()=>e):e},r=(r,s,i)=>{if(A(r))return r.aborted=!0,r;let n=t(s,a,i);if(n instanceof Promise){if(!1===i.async)throw new c;return n.then(t=>e._zod.parse(t,i))}return e._zod.parse(n,i)};e._zod.run=(s,i)=>{if(i.skipChecks)return e._zod.parse(s,i);if("backward"===i.direction){let t=e._zod.parse({value:s.value,issues:[]},{...i,skipChecks:!0});return t instanceof Promise?t.then(e=>r(e,s,i)):r(t,s,i)}let n=e._zod.parse(s,i);if(n instanceof Promise){if(!1===i.async)throw new c;return n.then(e=>t(e,a,i))}return t(n,a,i)}}e["~standard"]={validate:t=>{try{let r=G(e,t);return r.success?{value:r.data}:{issues:r.error?.issues}}catch(r){return Q(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:"zod",version:1}}),eH=u("$ZodString",(e,t)=>{var r;let a;eU.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??(a=(r=e._zod.bag)?`[\\s\\S]{${r?.minimum??0},${r?.maximum??""}}`:"[\\s\\S]*",RegExp(`^${a}$`)),e._zod.parse=(r,a)=>{if(t.coerce)try{r.value=String(r.value)}catch(e){}return"string"==typeof r.value||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),eK=u("$ZodStringFormat",(e,t)=>{eR.init(e,t),eH.init(e,t)}),eJ=u("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=en),eK.init(e,t)}),eB=u("$ZodUUID",(e,t)=>{if(t.version){let e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(void 0===e)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=eo(e))}else t.pattern??(t.pattern=eo());eK.init(e,t)}),eW=u("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=el),eK.init(e,t)}),eG=u("$ZodURL",(e,t)=>{eK.init(e,t),e._zod.check=r=>{try{let a=r.value.trim(),s=new URL(a);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(s.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:r.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(s.protocol.endsWith(":")?s.protocol.slice(0,-1):s.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort})),t.normalize?r.value=s.href:r.value=a;return}catch(a){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),eY=u("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),eK.init(e,t)}),eQ=u("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=es),eK.init(e,t)}),eX=u("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=X),eK.init(e,t)}),e0=u("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=ee),eK.init(e,t)}),e1=u("$ZodULID",(e,t)=>{t.pattern??(t.pattern=et),eK.init(e,t)}),e9=u("$ZodXID",(e,t)=>{t.pattern??(t.pattern=er),eK.init(e,t)}),e2=u("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=ea),eK.init(e,t)}),e4=u("$ZodISODateTime",(e,t)=>{let r,a,s;t.pattern??(r=ev({precision:t.precision}),a=["Z"],t.local&&a.push(""),t.offset&&a.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)"),s=`${r}(?:${a.join("|")})`,t.pattern=RegExp(`^${eg}T(?:${s})$`)),eK.init(e,t)}),e5=u("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=ey),eK.init(e,t)}),e6=u("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=RegExp(`^${ev(t)}$`)),eK.init(e,t)}),e3=u("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=ei),eK.init(e,t)}),e8=u("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=ed),eK.init(e,t),e._zod.bag.format="ipv4"}),e7=u("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=eu),eK.init(e,t),e._zod.bag.format="ipv6",e._zod.check=r=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}}}),te=u("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=ec),eK.init(e,t)}),tt=u("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=ep),eK.init(e,t),e._zod.check=r=>{let a=r.value.split("/");try{if(2!==a.length)throw Error();let[e,t]=a;if(!t)throw Error();let r=Number(t);if(`${r}`!==t||r<0||r>128)throw Error();new URL(`http://[${e}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}}});function tr(e){if(""===e)return!0;if(e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}let ta=u("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=eh),eK.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=r=>{tr(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}}),ts=u("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=em),eK.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=r=>{!function(e){if(!em.test(e))return!1;let t=e.replace(/[-_]/g,e=>"-"===e?"+":"/");return tr(t.padEnd(4*Math.ceil(t.length/4),"="))}(r.value)&&r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),ti=u("$ZodE164",(e,t)=>{t.pattern??(t.pattern=ef),eK.init(e,t)}),tn=u("$ZodJWT",(e,t)=>{eK.init(e,t),e._zod.check=r=>{!function(e,t=null){try{let r=e.split(".");if(3!==r.length)return!1;let[a]=r;if(!a)return!1;let s=JSON.parse(atob(a));if("typ"in s&&s?.typ!=="JWT"||!s.alg||t&&(!("alg"in s)||s.alg!==t))return!1;return!0}catch{return!1}}(r.value,t.alg)&&r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}}),to=u("$ZodNumber",(e,t)=>{eU.init(e,t),e._zod.pattern=e._zod.bag.pattern??eb,e._zod.parse=(r,a)=>{if(t.coerce)try{r.value=Number(r.value)}catch(e){}let s=r.value;if("number"==typeof s&&!Number.isNaN(s)&&Number.isFinite(s))return r;let i="number"==typeof s?Number.isNaN(s)?"NaN":Number.isFinite(s)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:s,inst:e,...i?{received:i}:{}}),r}}),tl=u("$ZodNumberFormat",(e,t)=>{eO.init(e,t),to.init(e,t)}),td=u("$ZodBoolean",(e,t)=>{eU.init(e,t),e._zod.pattern=ew,e._zod.parse=(r,a)=>{if(t.coerce)try{r.value=!!r.value}catch(e){}let s=r.value;return"boolean"==typeof s||r.issues.push({expected:"boolean",code:"invalid_type",input:s,inst:e}),r}}),tu=u("$ZodNull",(e,t)=>{eU.init(e,t),e._zod.pattern=e$,e._zod.values=new Set([null]),e._zod.parse=(t,r)=>{let a=t.value;return null===a||t.issues.push({expected:"null",code:"invalid_type",input:a,inst:e}),t}}),tc=u("$ZodUnknown",(e,t)=>{eU.init(e,t),e._zod.parse=e=>e}),tp=u("$ZodNever",(e,t)=>{eU.init(e,t),e._zod.parse=(t,r)=>(t.issues.push({expected:"never",code:"invalid_type",input:t.value,inst:e}),t)});function th(e,t,r){e.issues.length&&t.issues.push(...M(r,e.issues)),t.value[r]=e.value}let tm=u("$ZodArray",(e,t)=>{eU.init(e,t),e._zod.parse=(r,a)=>{let s=r.value;if(!Array.isArray(s))return r.issues.push({expected:"array",code:"invalid_type",input:s,inst:e}),r;r.value=Array(s.length);let i=[];for(let e=0;e<s.length;e++){let n=s[e],o=t.element._zod.run({value:n,issues:[]},a);o instanceof Promise?i.push(o.then(t=>th(t,r,e))):th(o,r,e)}return i.length?Promise.all(i).then(()=>r):r}});function tf(e,t,r,a){e.issues.length&&t.issues.push(...M(r,e.issues)),void 0===e.value?r in a&&(t.value[r]=void 0):t.value[r]=e.value}function tg(e){var t;let r=Object.keys(e.shape);for(let t of r)if(!e.shape?.[t]?._zod?.traits?.has("$ZodType"))throw Error(`Invalid element at key "${t}": expected a Zod schema`);let a=Object.keys(t=e.shape).filter(e=>"optional"===t[e]._zod.optin&&"optional"===t[e]._zod.optout);return{...e,keys:r,keySet:new Set(r),numKeys:r.length,optionalKeys:new Set(a)}}function ty(e,t,r,a,s,i){let n=[],o=s.keySet,l=s.catchall._zod,d=l.def.type;for(let s in t){if(o.has(s))continue;if("never"===d){n.push(s);continue}let i=l.run({value:t[s],issues:[]},a);i instanceof Promise?e.push(i.then(e=>tf(e,r,s,t))):tf(i,r,s,t)}return(n.length&&r.issues.push({code:"unrecognized_keys",keys:n,input:t,inst:i}),e.length)?Promise.all(e).then(()=>r):r}let tv=u("$ZodObject",(e,t)=>{let r;eU.init(e,t);let a=Object.getOwnPropertyDescriptor(t,"shape");if(!a?.get){let e=t.shape;Object.defineProperty(t,"shape",{get:()=>{let r={...e};return Object.defineProperty(t,"shape",{value:r}),r}})}let s=v(()=>tg(t));w(e._zod,"propValues",()=>{let e=t.shape,r={};for(let t in e){let a=e[t]._zod;if(a.values)for(let e of(r[t]??(r[t]=new Set),a.values))r[t].add(e)}return r});let i=t.catchall;e._zod.parse=(t,a)=>{r??(r=s.value);let n=t.value;if(!T(n))return t.issues.push({expected:"object",code:"invalid_type",input:n,inst:e}),t;t.value={};let o=[],l=r.shape;for(let e of r.keys){let r=l[e]._zod.run({value:n[e],issues:[]},a);r instanceof Promise?o.push(r.then(r=>tf(r,t,e,n))):tf(r,t,e,n)}return i?ty(o,n,t,a,s.value,e):o.length?Promise.all(o).then(()=>t):t}}),t_=u("$ZodObjectJIT",(e,t)=>{let r,a;tv.init(e,t);let s=e._zod.parse,i=v(()=>tg(t)),n=!h.jitless,o=n&&E.value,l=t.catchall;e._zod.parse=(d,u)=>{a??(a=i.value);let c=d.value;return T(c)?n&&o&&u?.async===!1&&!0!==u.jitless?(r||(r=(e=>{let t=new eL(["shape","payload","ctx"]),r=i.value,a=e=>{let t=x(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write("const input = payload.value;");let s=Object.create(null),n=0;for(let e of r.keys)s[e]=`key_${n++}`;for(let e of(t.write("const newResult = {};"),r.keys)){let r=s[e],i=x(e);t.write(`const ${r} = ${a(e)};`),t.write(`
9
+ if (${r}.issues.length) {
10
+ payload.issues = payload.issues.concat(${r}.issues.map(iss => ({
11
+ ...iss,
12
+ path: iss.path ? [${i}, ...iss.path] : [${i}]
13
+ })));
14
+ }
15
+
16
+
17
+ if (${r}.value === undefined) {
18
+ if (${i} in input) {
19
+ newResult[${i}] = undefined;
20
+ }
21
+ } else {
22
+ newResult[${i}] = ${r}.value;
23
+ }
24
+
25
+ `)}t.write("payload.value = newResult;"),t.write("return payload;");let o=t.compile();return(t,r)=>o(e,t,r)})(t.shape)),d=r(d,u),l)?ty([],c,d,u,a,e):d:s(d,u):(d.issues.push({expected:"object",code:"invalid_type",input:c,inst:e}),d)}});function tb(e,t,r,a){for(let r of e)if(0===r.issues.length)return t.value=r.value,t;let s=e.filter(e=>!A(e));return 1===s.length?(t.value=s[0].value,s[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(e=>e.issues.map(e=>D(e,a,m())))}),t)}let tw=u("$ZodUnion",(e,t)=>{eU.init(e,t),w(e._zod,"optin",()=>t.options.some(e=>"optional"===e._zod.optin)?"optional":void 0),w(e._zod,"optout",()=>t.options.some(e=>"optional"===e._zod.optout)?"optional":void 0),w(e._zod,"values",()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),w(e._zod,"pattern",()=>{if(t.options.every(e=>e._zod.pattern)){let e=t.options.map(e=>e._zod.pattern);return RegExp(`^(${e.map(e=>_(e.source)).join("|")})$`)}});let r=1===t.options.length,a=t.options[0]._zod.run;e._zod.parse=(s,i)=>{if(r)return a(s,i);let n=!1,o=[];for(let e of t.options){let t=e._zod.run({value:s.value,issues:[]},i);if(t instanceof Promise)o.push(t),n=!0;else{if(0===t.issues.length)return t;o.push(t)}}return n?Promise.all(o).then(t=>tb(t,s,e,i)):tb(o,s,e,i)}}),t$=u("$ZodDiscriminatedUnion",(e,t)=>{tw.init(e,t);let r=e._zod.parse;w(e._zod,"propValues",()=>{let e={};for(let r of t.options){let a=r._zod.propValues;if(!a||0===Object.keys(a).length)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(r)}"`);for(let[t,r]of Object.entries(a))for(let a of(e[t]||(e[t]=new Set),r))e[t].add(a)}return e});let a=v(()=>{let e=t.options,r=new Map;for(let a of e){let e=a._zod.propValues?.[t.discriminator];if(!e||0===e.size)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(a)}"`);for(let t of e){if(r.has(t))throw Error(`Duplicate discriminator value "${String(t)}"`);r.set(t,a)}}return r});e._zod.parse=(s,i)=>{let n=s.value;if(!T(n))return s.issues.push({code:"invalid_type",expected:"object",input:n,inst:e}),s;let o=a.value.get(n?.[t.discriminator]);return o?o._zod.run(s,i):t.unionFallback?r(s,i):(s.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,input:n,path:[t.discriminator],inst:e}),s)}}),tk=u("$ZodIntersection",(e,t)=>{eU.init(e,t),e._zod.parse=(e,r)=>{let a=e.value,s=t.left._zod.run({value:a,issues:[]},r),i=t.right._zod.run({value:a,issues:[]},r);return s instanceof Promise||i instanceof Promise?Promise.all([s,i]).then(([t,r])=>tx(e,t,r)):tx(e,s,i)}});function tx(e,t,r){if(t.issues.length&&e.issues.push(...t.issues),r.issues.length&&e.issues.push(...r.issues),A(e))return e;let a=function e(t,r){if(t===r||t instanceof Date&&r instanceof Date&&+t==+r)return{valid:!0,data:t};if(P(t)&&P(r)){let a=Object.keys(r),s=Object.keys(t).filter(e=>-1!==a.indexOf(e)),i={...t,...r};for(let a of s){let s=e(t[a],r[a]);if(!s.valid)return{valid:!1,mergeErrorPath:[a,...s.mergeErrorPath]};i[a]=s.data}return{valid:!0,data:i}}if(Array.isArray(t)&&Array.isArray(r)){if(t.length!==r.length)return{valid:!1,mergeErrorPath:[]};let a=[];for(let s=0;s<t.length;s++){let i=e(t[s],r[s]);if(!i.valid)return{valid:!1,mergeErrorPath:[s,...i.mergeErrorPath]};a.push(i.data)}return{valid:!0,data:a}}return{valid:!1,mergeErrorPath:[]}}(t.value,r.value);if(!a.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(a.mergeErrorPath)}`);return e.value=a.data,e}let tS=u("$ZodRecord",(e,t)=>{eU.init(e,t),e._zod.parse=(r,a)=>{let s=r.value;if(!P(s))return r.issues.push({expected:"record",code:"invalid_type",input:s,inst:e}),r;let i=[],n=t.keyType._zod.values;if(n){let o;r.value={};let l=new Set;for(let e of n)if("string"==typeof e||"number"==typeof e||"symbol"==typeof e){l.add("number"==typeof e?e.toString():e);let n=t.valueType._zod.run({value:s[e],issues:[]},a);n instanceof Promise?i.push(n.then(t=>{t.issues.length&&r.issues.push(...M(e,t.issues)),r.value[e]=t.value})):(n.issues.length&&r.issues.push(...M(e,n.issues)),r.value[e]=n.value)}for(let e in s)l.has(e)||(o=o??[]).push(e);o&&o.length>0&&r.issues.push({code:"unrecognized_keys",input:s,inst:e,keys:o})}else for(let n of(r.value={},Reflect.ownKeys(s))){if("__proto__"===n)continue;let o=t.keyType._zod.run({value:n,issues:[]},a);if(o instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(o.issues.length){r.issues.push({code:"invalid_key",origin:"record",issues:o.issues.map(e=>D(e,a,m())),input:n,path:[n],inst:e}),r.value[o.value]=o.value;continue}let l=t.valueType._zod.run({value:s[n],issues:[]},a);l instanceof Promise?i.push(l.then(e=>{e.issues.length&&r.issues.push(...M(n,e.issues)),r.value[o.value]=e.value})):(l.issues.length&&r.issues.push(...M(n,l.issues)),r.value[o.value]=l.value)}return i.length?Promise.all(i).then(()=>r):r}}),tT=u("$ZodEnum",(e,t)=>{eU.init(e,t);let r=f(t.entries),a=new Set(r);e._zod.values=a,e._zod.pattern=RegExp(`^(${r.filter(e=>O.has(typeof e)).map(e=>"string"==typeof e?I(e):e.toString()).join("|")})$`),e._zod.parse=(t,s)=>{let i=t.value;return a.has(i)||t.issues.push({code:"invalid_value",values:r,input:i,inst:e}),t}}),tE=u("$ZodLiteral",(e,t)=>{if(eU.init(e,t),0===t.values.length)throw Error("Cannot create literal schema with no valid values");let r=new Set(t.values);e._zod.values=r,e._zod.pattern=RegExp(`^(${t.values.map(e=>"string"==typeof e?I(e):e?I(e.toString()):String(e)).join("|")})$`),e._zod.parse=(a,s)=>{let i=a.value;return r.has(i)||a.issues.push({code:"invalid_value",values:t.values,input:i,inst:e}),a}}),tP=u("$ZodTransform",(e,t)=>{eU.init(e,t),e._zod.parse=(r,a)=>{if("backward"===a.direction)throw new p(e.constructor.name);let s=t.transform(r.value,r);if(a.async)return(s instanceof Promise?s:Promise.resolve(s)).then(e=>(r.value=e,r));if(s instanceof Promise)throw new c;return r.value=s,r}});function tj(e,t){return e.issues.length&&void 0===t?{issues:[],value:void 0}:e}let tO=u("$ZodOptional",(e,t)=>{eU.init(e,t),e._zod.optin="optional",e._zod.optout="optional",w(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),w(e._zod,"pattern",()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${_(e.source)})?$`):void 0}),e._zod.parse=(e,r)=>{if("optional"===t.innerType._zod.optin){let a=t.innerType._zod.run(e,r);return a instanceof Promise?a.then(t=>tj(t,e.value)):tj(a,e.value)}return void 0===e.value?e:t.innerType._zod.run(e,r)}}),tI=u("$ZodNullable",(e,t)=>{eU.init(e,t),w(e._zod,"optin",()=>t.innerType._zod.optin),w(e._zod,"optout",()=>t.innerType._zod.optout),w(e._zod,"pattern",()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${_(e.source)}|null)$`):void 0}),w(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(e,r)=>null===e.value?e:t.innerType._zod.run(e,r)}),tN=u("$ZodDefault",(e,t)=>{eU.init(e,t),e._zod.optin="optional",w(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,r)=>{if("backward"===r.direction)return t.innerType._zod.run(e,r);if(void 0===e.value)return e.value=t.defaultValue,e;let a=t.innerType._zod.run(e,r);return a instanceof Promise?a.then(e=>tz(e,t)):tz(a,t)}});function tz(e,t){return void 0===e.value&&(e.value=t.defaultValue),e}let tR=u("$ZodPrefault",(e,t)=>{eU.init(e,t),e._zod.optin="optional",w(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,r)=>("backward"===r.direction||void 0===e.value&&(e.value=t.defaultValue),t.innerType._zod.run(e,r))}),tC=u("$ZodNonOptional",(e,t)=>{eU.init(e,t),w(e._zod,"values",()=>{let e=t.innerType._zod.values;return e?new Set([...e].filter(e=>void 0!==e)):void 0}),e._zod.parse=(r,a)=>{let s=t.innerType._zod.run(r,a);return s instanceof Promise?s.then(t=>tA(t,e)):tA(s,e)}});function tA(e,t){return e.issues.length||void 0!==e.value||e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}let tM=u("$ZodCatch",(e,t)=>{eU.init(e,t),w(e._zod,"optin",()=>t.innerType._zod.optin),w(e._zod,"optout",()=>t.innerType._zod.optout),w(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,r)=>{if("backward"===r.direction)return t.innerType._zod.run(e,r);let a=t.innerType._zod.run(e,r);return a instanceof Promise?a.then(a=>(e.value=a.value,a.issues.length&&(e.value=t.catchValue({...e,error:{issues:a.issues.map(e=>D(e,r,m()))},input:e.value}),e.issues=[]),e)):(e.value=a.value,a.issues.length&&(e.value=t.catchValue({...e,error:{issues:a.issues.map(e=>D(e,r,m()))},input:e.value}),e.issues=[]),e)}}),tZ=u("$ZodPipe",(e,t)=>{eU.init(e,t),w(e._zod,"values",()=>t.in._zod.values),w(e._zod,"optin",()=>t.in._zod.optin),w(e._zod,"optout",()=>t.out._zod.optout),w(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(e,r)=>{if("backward"===r.direction){let a=t.out._zod.run(e,r);return a instanceof Promise?a.then(e=>tD(e,t.in,r)):tD(a,t.in,r)}let a=t.in._zod.run(e,r);return a instanceof Promise?a.then(e=>tD(e,t.out,r)):tD(a,t.out,r)}});function tD(e,t,r){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},r)}let tq=u("$ZodReadonly",(e,t)=>{eU.init(e,t),w(e._zod,"propValues",()=>t.innerType._zod.propValues),w(e._zod,"values",()=>t.innerType._zod.values),w(e._zod,"optin",()=>t.innerType?._zod?.optin),w(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(e,r)=>{if("backward"===r.direction)return t.innerType._zod.run(e,r);let a=t.innerType._zod.run(e,r);return a instanceof Promise?a.then(tV):tV(a)}});function tV(e){return e.value=Object.freeze(e.value),e}let tL=u("$ZodCustom",(e,t)=>{eS.init(e,t),eU.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=r=>{let a=r.value,s=t.fn(a);if(s instanceof Promise)return s.then(t=>tF(t,r,a,e));tF(s,r,a,e)}});function tF(e,t,r,a){if(!e){let e={code:"custom",input:r,inst:a,path:[...a._zod.def.path??[]],continue:!a._zod.def.abort};a._zod.def.params&&(e.params=a._zod.def.params),t.issues.push(V(e))}}Symbol("ZodOutput"),Symbol("ZodInput");class tU{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let r=t[0];if(this._map.set(e,r),r&&"object"==typeof r&&"id"in r){if(this._idmap.has(r.id))throw Error(`ID ${r.id} already exists in the registry`);this._idmap.set(r.id,e)}return this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);return t&&"object"==typeof t&&"id"in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let r={...this.get(t)??{}};delete r.id;let a={...r,...this._map.get(e)};return Object.keys(a).length?a:void 0}return this._map.get(e)}has(e){return this._map.has(e)}}(oO=globalThis).__zod_globalRegistry??(oO.__zod_globalRegistry=new tU);let tH=globalThis.__zod_globalRegistry;function tK(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...z(t)})}function tJ(e,t){return new eE({check:"less_than",...z(t),value:e,inclusive:!1})}function tB(e,t){return new eE({check:"less_than",...z(t),value:e,inclusive:!0})}function tW(e,t){return new eP({check:"greater_than",...z(t),value:e,inclusive:!1})}function tG(e,t){return new eP({check:"greater_than",...z(t),value:e,inclusive:!0})}function tY(e,t){return new ej({check:"multiple_of",...z(t),value:e})}function tQ(e,t){return new eI({check:"max_length",...z(t),maximum:e})}function tX(e,t){return new eN({check:"min_length",...z(t),minimum:e})}function t0(e,t){return new ez({check:"length_equals",...z(t),length:e})}function t1(e){return new eV({check:"overwrite",tx:e})}class t9{constructor(e){this.counter=0,this.metadataRegistry=e?.metadata??tH,this.target=e?.target??"draft-2020-12",this.unrepresentable=e?.unrepresentable??"throw",this.override=e?.override??(()=>{}),this.io=e?.io??"output",this.seen=new Map}process(e,t={path:[],schemaPath:[]}){var r;let a=e._zod.def,s=this.seen.get(e);if(s)return s.count++,t.schemaPath.includes(e)&&(s.cycle=t.path),s.schema;let i={schema:{},count:1,cycle:void 0,path:t.path};this.seen.set(e,i);let n=e._zod.toJSONSchema?.();if(n)i.schema=n;else{let r={...t,schemaPath:[...t.schemaPath,e],path:t.path},s=e._zod.parent;if(s)i.ref=s,this.process(s,r),this.seen.get(s).isParent=!0;else{let t=i.schema;switch(a.type){case"string":{t.type="string";let{minimum:r,maximum:a,format:s,patterns:n,contentEncoding:o}=e._zod.bag;if("number"==typeof r&&(t.minLength=r),"number"==typeof a&&(t.maxLength=a),s&&(t.format=({guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""})[s]??s,""===t.format&&delete t.format),o&&(t.contentEncoding=o),n&&n.size>0){let e=[...n];1===e.length?t.pattern=e[0].source:e.length>1&&(i.schema.allOf=[...e.map(e=>({..."draft-7"===this.target||"draft-4"===this.target||"openapi-3.0"===this.target?{type:"string"}:{},pattern:e.source}))])}break}case"number":{let{minimum:r,maximum:a,format:s,multipleOf:i,exclusiveMaximum:n,exclusiveMinimum:o}=e._zod.bag;"string"==typeof s&&s.includes("int")?t.type="integer":t.type="number","number"==typeof o&&("draft-4"===this.target||"openapi-3.0"===this.target?(t.minimum=o,t.exclusiveMinimum=!0):t.exclusiveMinimum=o),"number"==typeof r&&(t.minimum=r,"number"==typeof o&&"draft-4"!==this.target&&(o>=r?delete t.minimum:delete t.exclusiveMinimum)),"number"==typeof n&&("draft-4"===this.target||"openapi-3.0"===this.target?(t.maximum=n,t.exclusiveMaximum=!0):t.exclusiveMaximum=n),"number"==typeof a&&(t.maximum=a,"number"==typeof n&&"draft-4"!==this.target&&(n<=a?delete t.maximum:delete t.exclusiveMaximum)),"number"==typeof i&&(t.multipleOf=i);break}case"boolean":case"success":t.type="boolean";break;case"bigint":if("throw"===this.unrepresentable)throw Error("BigInt cannot be represented in JSON Schema");break;case"symbol":if("throw"===this.unrepresentable)throw Error("Symbols cannot be represented in JSON Schema");break;case"null":"openapi-3.0"===this.target?(t.type="string",t.nullable=!0,t.enum=[null]):t.type="null";break;case"any":case"unknown":break;case"undefined":if("throw"===this.unrepresentable)throw Error("Undefined cannot be represented in JSON Schema");break;case"void":if("throw"===this.unrepresentable)throw Error("Void cannot be represented in JSON Schema");break;case"never":t.not={};break;case"date":if("throw"===this.unrepresentable)throw Error("Date cannot be represented in JSON Schema");break;case"array":{let{minimum:s,maximum:i}=e._zod.bag;"number"==typeof s&&(t.minItems=s),"number"==typeof i&&(t.maxItems=i),t.type="array",t.items=this.process(a.element,{...r,path:[...r.path,"items"]});break}case"object":{t.type="object",t.properties={};let e=a.shape;for(let a in e)t.properties[a]=this.process(e[a],{...r,path:[...r.path,"properties",a]});let s=new Set([...new Set(Object.keys(e))].filter(e=>{let t=a.shape[e]._zod;return"input"===this.io?void 0===t.optin:void 0===t.optout}));s.size>0&&(t.required=Array.from(s)),a.catchall?._zod.def.type==="never"?t.additionalProperties=!1:a.catchall?a.catchall&&(t.additionalProperties=this.process(a.catchall,{...r,path:[...r.path,"additionalProperties"]})):"output"===this.io&&(t.additionalProperties=!1);break}case"union":{let e=void 0!==a.discriminator,s=a.options.map((t,a)=>this.process(t,{...r,path:[...r.path,e?"oneOf":"anyOf",a]}));e?t.oneOf=s:t.anyOf=s;break}case"intersection":{let e=this.process(a.left,{...r,path:[...r.path,"allOf",0]}),s=this.process(a.right,{...r,path:[...r.path,"allOf",1]}),i=e=>"allOf"in e&&1===Object.keys(e).length;t.allOf=[...i(e)?e.allOf:[e],...i(s)?s.allOf:[s]];break}case"tuple":{t.type="array";let s="draft-2020-12"===this.target?"prefixItems":"items",i="draft-2020-12"===this.target||"openapi-3.0"===this.target?"items":"additionalItems",n=a.items.map((e,t)=>this.process(e,{...r,path:[...r.path,s,t]})),o=a.rest?this.process(a.rest,{...r,path:[...r.path,i,..."openapi-3.0"===this.target?[a.items.length]:[]]}):null;"draft-2020-12"===this.target?(t.prefixItems=n,o&&(t.items=o)):"openapi-3.0"===this.target?(t.items={anyOf:n},o&&t.items.anyOf.push(o),t.minItems=n.length,o||(t.maxItems=n.length)):(t.items=n,o&&(t.additionalItems=o));let{minimum:l,maximum:d}=e._zod.bag;"number"==typeof l&&(t.minItems=l),"number"==typeof d&&(t.maxItems=d);break}case"record":t.type="object",("draft-7"===this.target||"draft-2020-12"===this.target)&&(t.propertyNames=this.process(a.keyType,{...r,path:[...r.path,"propertyNames"]})),t.additionalProperties=this.process(a.valueType,{...r,path:[...r.path,"additionalProperties"]});break;case"map":if("throw"===this.unrepresentable)throw Error("Map cannot be represented in JSON Schema");break;case"set":if("throw"===this.unrepresentable)throw Error("Set cannot be represented in JSON Schema");break;case"enum":{let e=f(a.entries);e.every(e=>"number"==typeof e)&&(t.type="number"),e.every(e=>"string"==typeof e)&&(t.type="string"),t.enum=e;break}case"literal":{let e=[];for(let t of a.values)if(void 0===t){if("throw"===this.unrepresentable)throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if("bigint"==typeof t)if("throw"===this.unrepresentable)throw Error("BigInt literals cannot be represented in JSON Schema");else e.push(Number(t));else e.push(t);if(0===e.length);else if(1===e.length){let r=e[0];t.type=null===r?"null":typeof r,"draft-4"===this.target||"openapi-3.0"===this.target?t.enum=[r]:t.const=r}else e.every(e=>"number"==typeof e)&&(t.type="number"),e.every(e=>"string"==typeof e)&&(t.type="string"),e.every(e=>"boolean"==typeof e)&&(t.type="string"),e.every(e=>null===e)&&(t.type="null"),t.enum=e;break}case"file":{let r={type:"string",format:"binary",contentEncoding:"binary"},{minimum:a,maximum:s,mime:i}=e._zod.bag;void 0!==a&&(r.minLength=a),void 0!==s&&(r.maxLength=s),i?1===i.length?(r.contentMediaType=i[0],Object.assign(t,r)):t.anyOf=i.map(e=>({...r,contentMediaType:e})):Object.assign(t,r);break}case"transform":if("throw"===this.unrepresentable)throw Error("Transforms cannot be represented in JSON Schema");break;case"nullable":{let e=this.process(a.innerType,r);"openapi-3.0"===this.target?(i.ref=a.innerType,t.nullable=!0):t.anyOf=[e,{type:"null"}];break}case"nonoptional":case"promise":case"optional":this.process(a.innerType,r),i.ref=a.innerType;break;case"default":this.process(a.innerType,r),i.ref=a.innerType,t.default=JSON.parse(JSON.stringify(a.defaultValue));break;case"prefault":this.process(a.innerType,r),i.ref=a.innerType,"input"===this.io&&(t._prefault=JSON.parse(JSON.stringify(a.defaultValue)));break;case"catch":{let e;this.process(a.innerType,r),i.ref=a.innerType;try{e=a.catchValue(void 0)}catch{throw Error("Dynamic catch values are not supported in JSON Schema")}t.default=e;break}case"nan":if("throw"===this.unrepresentable)throw Error("NaN cannot be represented in JSON Schema");break;case"template_literal":{let r=e._zod.pattern;if(!r)throw Error("Pattern not found in template literal");t.type="string",t.pattern=r.source;break}case"pipe":{let e="input"===this.io?"transform"===a.in._zod.def.type?a.out:a.in:a.out;this.process(e,r),i.ref=e;break}case"readonly":this.process(a.innerType,r),i.ref=a.innerType,t.readOnly=!0;break;case"lazy":{let t=e._zod.innerType;this.process(t,r),i.ref=t;break}case"custom":if("throw"===this.unrepresentable)throw Error("Custom types cannot be represented in JSON Schema");break;case"function":if("throw"===this.unrepresentable)throw Error("Function types cannot be represented in JSON Schema")}}}let o=this.metadataRegistry.get(e);return o&&Object.assign(i.schema,o),"input"===this.io&&function e(t,r){let a=r??{seen:new Set};if(a.seen.has(t))return!1;a.seen.add(t);let s=t._zod.def;if("transform"===s.type)return!0;if("array"===s.type)return e(s.element,a);if("set"===s.type)return e(s.valueType,a);if("lazy"===s.type)return e(s.getter(),a);if("promise"===s.type||"optional"===s.type||"nonoptional"===s.type||"nullable"===s.type||"readonly"===s.type||"default"===s.type||"prefault"===s.type)return e(s.innerType,a);if("intersection"===s.type)return e(s.left,a)||e(s.right,a);if("record"===s.type||"map"===s.type)return e(s.keyType,a)||e(s.valueType,a);if("pipe"===s.type)return e(s.in,a)||e(s.out,a);if("object"===s.type){for(let t in s.shape)if(e(s.shape[t],a))return!0;return!1}if("union"===s.type){for(let t of s.options)if(e(t,a))return!0;return!1}if("tuple"===s.type){for(let t of s.items)if(e(t,a))return!0;if(s.rest&&e(s.rest,a))return!0}return!1}(e)&&(delete i.schema.examples,delete i.schema.default),"input"===this.io&&i.schema._prefault&&((r=i.schema).default??(r.default=i.schema._prefault)),delete i.schema._prefault,this.seen.get(e).schema}emit(e,t){let r={cycles:t?.cycles??"ref",reused:t?.reused??"inline",external:t?.external??void 0},a=this.seen.get(e);if(!a)throw Error("Unprocessed schema. This is a bug in Zod.");let s=e=>{let t="draft-2020-12"===this.target?"$defs":"definitions";if(r.external){let a=r.external.registry.get(e[0])?.id,s=r.external.uri??(e=>e);if(a)return{ref:s(a)};let i=e[1].defId??e[1].schema.id??`schema${this.counter++}`;return e[1].defId=i,{defId:i,ref:`${s("__shared")}#/${t}/${i}`}}if(e[1]===a)return{ref:"#"};let s=`#/${t}/`,i=e[1].schema.id??`__schema${this.counter++}`;return{defId:i,ref:s+i}},i=e=>{if(e[1].schema.$ref)return;let t=e[1],{ref:r,defId:a}=s(e);t.def={...t.schema},a&&(t.defId=a);let i=t.schema;for(let e in i)delete i[e];i.$ref=r};if("throw"===r.cycles)for(let e of this.seen.entries()){let t=e[1];if(t.cycle)throw Error(`Cycle detected: #/${t.cycle?.join("/")}/<root>
26
+
27
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let t of this.seen.entries()){let a=t[1];if(e===t[0]){i(t);continue}if(r.external){let a=r.external.registry.get(t[0])?.id;if(e!==t[0]&&a){i(t);continue}}if(this.metadataRegistry.get(t[0])?.id||a.cycle||a.count>1&&"ref"===r.reused){i(t);continue}}let n=(e,t)=>{let r=this.seen.get(e),a=r.def??r.schema,s={...a};if(null===r.ref)return;let i=r.ref;if(r.ref=null,i){n(i,t);let e=this.seen.get(i).schema;e.$ref&&("draft-7"===t.target||"draft-4"===t.target||"openapi-3.0"===t.target)?(a.allOf=a.allOf??[],a.allOf.push(e)):(Object.assign(a,e),Object.assign(a,s))}r.isParent||this.override({zodSchema:e,jsonSchema:a,path:r.path??[]})};for(let e of[...this.seen.entries()].reverse())n(e[0],{target:this.target});let o={};if("draft-2020-12"===this.target?o.$schema="https://json-schema.org/draft/2020-12/schema":"draft-7"===this.target?o.$schema="http://json-schema.org/draft-07/schema#":"draft-4"===this.target?o.$schema="http://json-schema.org/draft-04/schema#":"openapi-3.0"===this.target||console.warn(`Invalid target: ${this.target}`),r.external?.uri){let t=r.external.registry.get(e)?.id;if(!t)throw Error("Schema is missing an `id` property");o.$id=r.external.uri(t)}Object.assign(o,a.def);let l=r.external?.defs??{};for(let e of this.seen.entries()){let t=e[1];t.def&&t.defId&&(l[t.defId]=t.def)}r.external||Object.keys(l).length>0&&("draft-2020-12"===this.target?o.$defs=l:o.definitions=l);try{return JSON.parse(JSON.stringify(o))}catch(e){throw Error("Error converting schema to JSON.")}}}let t2=u("ZodISODateTime",(e,t)=>{e4.init(e,t),rp.init(e,t)});function t4(e){return new t2({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...z(e)})}let t5=u("ZodISODate",(e,t)=>{e5.init(e,t),rp.init(e,t)}),t6=u("ZodISOTime",(e,t)=>{e6.init(e,t),rp.init(e,t)}),t3=u("ZodISODuration",(e,t)=>{e3.init(e,t),rp.init(e,t)}),t8=(e,t)=>{F.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:t=>(function(e,t=e=>e.message){let r={_errors:[]},a=e=>{for(let s of e.issues)if("invalid_union"===s.code&&s.errors.length)s.errors.map(e=>a({issues:e}));else if("invalid_key"===s.code)a({issues:s.issues});else if("invalid_element"===s.code)a({issues:s.issues});else if(0===s.path.length)r._errors.push(t(s));else{let e=r,a=0;for(;a<s.path.length;){let r=s.path[a];a===s.path.length-1?(e[r]=e[r]||{_errors:[]},e[r]._errors.push(t(s))):e[r]=e[r]||{_errors:[]},e=e[r],a++}}};return a(e),r})(e,t)},flatten:{value:t=>(function(e,t=e=>e.message){let r={},a=[];for(let s of e.issues)s.path.length>0?(r[s.path[0]]=r[s.path[0]]||[],r[s.path[0]].push(t(s))):a.push(t(s));return{formErrors:a,fieldErrors:r}})(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,y,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,y,2)}},isEmpty:{get:()=>0===e.issues.length}})};u("ZodError",t8);let t7=u("ZodError",t8,{Parent:Error}),re=H(t7),rt=J(t7),rr=W(t7),ra=Y(t7),rs=async(e,t,r)=>{let a=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return J(t7)(e,t,a)},ri=async(e,t,r)=>J(t7)(e,t,r),rn=async(e,t,r)=>{let a=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return Y(t7)(e,t,a)},ro=async(e,t,r)=>Y(t7)(e,t,r),rl=u("ZodType",(e,t)=>(eU.init(e,t),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...r)=>e.clone(k(t,{checks:[...t.checks??[],...r.map(e=>"function"==typeof e?{_zod:{check:e,def:{check:"custom"},onattach:[]}}:e)]})),e.clone=(t,r)=>N(e,t,r),e.brand=()=>e,e.register=(t,r)=>(t.add(e,r),e),e.parse=(t,r)=>re(e,t,r,{callee:e.parse}),e.safeParse=(t,r)=>rr(e,t,r),e.parseAsync=async(t,r)=>rt(e,t,r,{callee:e.parseAsync}),e.safeParseAsync=async(t,r)=>ra(e,t,r),e.spa=e.safeParseAsync,e.encode=(t,r)=>{let a;return a=r?Object.assign(r,{direction:"backward"}):{direction:"backward"},H(t7)(e,t,a)},e.decode=(t,r)=>H(t7)(e,t,r),e.encodeAsync=async(t,r)=>rs(e,t,r),e.decodeAsync=async(t,r)=>ri(e,t,r),e.safeEncode=(t,r)=>{let a;return a=r?Object.assign(r,{direction:"backward"}):{direction:"backward"},W(t7)(e,t,a)},e.safeDecode=(t,r)=>W(t7)(e,t,r),e.safeEncodeAsync=async(t,r)=>rn(e,t,r),e.safeDecodeAsync=async(t,r)=>ro(e,t,r),e.refine=(t,r)=>e.check(function(e,t={}){return new ad({type:"custom",check:"custom",fn:e,...z(t)})}(t,r)),e.superRefine=t=>{var r;let a,s;return e.check((r=e=>(e.addIssue=t=>{"string"==typeof t?e.issues.push(V(t,e.value,a._zod.def)):(t.fatal&&(t.continue=!1),t.code??(t.code="custom"),t.input??(t.input=e.value),t.inst??(t.inst=a),t.continue??(t.continue=!a._zod.def.abort),e.issues.push(V(t)))},t(e.value,e)),(s=new eS({check:"custom",...z(void 0)}))._zod.check=r,a=s))},e.overwrite=t=>e.check(t1(t)),e.optional=()=>r7(e),e.nullable=()=>at(e),e.nullish=()=>r7(at(e)),e.nonoptional=t=>new as({type:"nonoptional",innerType:e,...z(t)}),e.array=()=>rU(e),e.or=t=>rW([e,t]),e.and=t=>rX(e,t),e.transform=t=>ao(e,r3(t)),e.default=t=>new ar({type:"default",innerType:e,get defaultValue(){return"function"==typeof t?t():j(t)}}),e.prefault=t=>new aa({type:"prefault",innerType:e,get defaultValue(){return"function"==typeof t?t():j(t)}}),e.catch=t=>new ai({type:"catch",innerType:e,catchValue:"function"==typeof t?t:()=>t}),e.pipe=t=>ao(e,t),e.readonly=()=>new al({type:"readonly",innerType:e}),e.describe=t=>{let r=e.clone();return tH.add(r,{description:t}),r},Object.defineProperty(e,"description",{get:()=>tH.get(e)?.description,configurable:!0}),e.meta=(...t)=>{if(0===t.length)return tH.get(e);let r=e.clone();return tH.add(r,t[0]),r},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e)),rd=u("_ZodString",(e,t)=>{eH.init(e,t),rl.init(e,t);let r=e._zod.bag;e.format=r.format??null,e.minLength=r.minimum??null,e.maxLength=r.maximum??null,e.regex=(...t)=>e.check(function(e,t){return new eC({check:"string_format",format:"regex",...z(t),pattern:e})}(...t)),e.includes=(...t)=>e.check(function(e,t){return new eZ({check:"string_format",format:"includes",...z(t),includes:e})}(...t)),e.startsWith=(...t)=>e.check(function(e,t){return new eD({check:"string_format",format:"starts_with",...z(t),prefix:e})}(...t)),e.endsWith=(...t)=>e.check(function(e,t){return new eq({check:"string_format",format:"ends_with",...z(t),suffix:e})}(...t)),e.min=(...t)=>e.check(tX(...t)),e.max=(...t)=>e.check(tQ(...t)),e.length=(...t)=>e.check(t0(...t)),e.nonempty=(...t)=>e.check(tX(1,...t)),e.lowercase=t=>e.check(new eA({check:"string_format",format:"lowercase",...z(t)})),e.uppercase=t=>e.check(new eM({check:"string_format",format:"uppercase",...z(t)})),e.trim=()=>e.check(t1(e=>e.trim())),e.normalize=(...t)=>e.check(function(e){return t1(t=>t.normalize(e))}(...t)),e.toLowerCase=()=>e.check(t1(e=>e.toLowerCase())),e.toUpperCase=()=>e.check(t1(e=>e.toUpperCase())),e.slugify=()=>e.check(t1(e=>e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")))}),ru=u("ZodString",(e,t)=>{eH.init(e,t),rd.init(e,t),e.email=t=>e.check(new rh({type:"string",format:"email",check:"string_format",abort:!1,...z(t)})),e.url=t=>e.check(new rg({type:"string",format:"url",check:"string_format",abort:!1,...z(t)})),e.jwt=t=>e.check(new rI({type:"string",format:"jwt",check:"string_format",abort:!1,...z(t)})),e.emoji=t=>e.check(new ry({type:"string",format:"emoji",check:"string_format",abort:!1,...z(t)})),e.guid=t=>e.check(tK(rm,t)),e.uuid=t=>e.check(new rf({type:"string",format:"uuid",check:"string_format",abort:!1,...z(t)})),e.uuidv4=t=>e.check(new rf({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...z(t)})),e.uuidv6=t=>e.check(new rf({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...z(t)})),e.uuidv7=t=>e.check(new rf({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...z(t)})),e.nanoid=t=>e.check(new rv({type:"string",format:"nanoid",check:"string_format",abort:!1,...z(t)})),e.guid=t=>e.check(tK(rm,t)),e.cuid=t=>e.check(new r_({type:"string",format:"cuid",check:"string_format",abort:!1,...z(t)})),e.cuid2=t=>e.check(new rb({type:"string",format:"cuid2",check:"string_format",abort:!1,...z(t)})),e.ulid=t=>e.check(new rw({type:"string",format:"ulid",check:"string_format",abort:!1,...z(t)})),e.base64=t=>e.check(new rP({type:"string",format:"base64",check:"string_format",abort:!1,...z(t)})),e.base64url=t=>e.check(new rj({type:"string",format:"base64url",check:"string_format",abort:!1,...z(t)})),e.xid=t=>e.check(new r$({type:"string",format:"xid",check:"string_format",abort:!1,...z(t)})),e.ksuid=t=>e.check(new rk({type:"string",format:"ksuid",check:"string_format",abort:!1,...z(t)})),e.ipv4=t=>e.check(new rx({type:"string",format:"ipv4",check:"string_format",abort:!1,...z(t)})),e.ipv6=t=>e.check(new rS({type:"string",format:"ipv6",check:"string_format",abort:!1,...z(t)})),e.cidrv4=t=>e.check(new rT({type:"string",format:"cidrv4",check:"string_format",abort:!1,...z(t)})),e.cidrv6=t=>e.check(new rE({type:"string",format:"cidrv6",check:"string_format",abort:!1,...z(t)})),e.e164=t=>e.check(new rO({type:"string",format:"e164",check:"string_format",abort:!1,...z(t)})),e.datetime=t=>e.check(t4(t)),e.date=t=>e.check(new t5({type:"string",format:"date",check:"string_format",...z(t)})),e.time=t=>e.check(new t6({type:"string",format:"time",check:"string_format",precision:null,...z(t)})),e.duration=t=>e.check(new t3({type:"string",format:"duration",check:"string_format",...z(t)}))});function rc(e){return new ru({type:"string",...z(e)})}let rp=u("ZodStringFormat",(e,t)=>{eK.init(e,t),rd.init(e,t)}),rh=u("ZodEmail",(e,t)=>{eW.init(e,t),rp.init(e,t)}),rm=u("ZodGUID",(e,t)=>{eJ.init(e,t),rp.init(e,t)}),rf=u("ZodUUID",(e,t)=>{eB.init(e,t),rp.init(e,t)}),rg=u("ZodURL",(e,t)=>{eG.init(e,t),rp.init(e,t)}),ry=u("ZodEmoji",(e,t)=>{eY.init(e,t),rp.init(e,t)}),rv=u("ZodNanoID",(e,t)=>{eQ.init(e,t),rp.init(e,t)}),r_=u("ZodCUID",(e,t)=>{eX.init(e,t),rp.init(e,t)}),rb=u("ZodCUID2",(e,t)=>{e0.init(e,t),rp.init(e,t)}),rw=u("ZodULID",(e,t)=>{e1.init(e,t),rp.init(e,t)}),r$=u("ZodXID",(e,t)=>{e9.init(e,t),rp.init(e,t)}),rk=u("ZodKSUID",(e,t)=>{e2.init(e,t),rp.init(e,t)}),rx=u("ZodIPv4",(e,t)=>{e8.init(e,t),rp.init(e,t)}),rS=u("ZodIPv6",(e,t)=>{e7.init(e,t),rp.init(e,t)}),rT=u("ZodCIDRv4",(e,t)=>{te.init(e,t),rp.init(e,t)}),rE=u("ZodCIDRv6",(e,t)=>{tt.init(e,t),rp.init(e,t)}),rP=u("ZodBase64",(e,t)=>{ta.init(e,t),rp.init(e,t)}),rj=u("ZodBase64URL",(e,t)=>{ts.init(e,t),rp.init(e,t)}),rO=u("ZodE164",(e,t)=>{ti.init(e,t),rp.init(e,t)}),rI=u("ZodJWT",(e,t)=>{tn.init(e,t),rp.init(e,t)}),rN=u("ZodNumber",(e,t)=>{to.init(e,t),rl.init(e,t),e.gt=(t,r)=>e.check(tW(t,r)),e.gte=(t,r)=>e.check(tG(t,r)),e.min=(t,r)=>e.check(tG(t,r)),e.lt=(t,r)=>e.check(tJ(t,r)),e.lte=(t,r)=>e.check(tB(t,r)),e.max=(t,r)=>e.check(tB(t,r)),e.int=t=>e.check(rC(t)),e.safe=t=>e.check(rC(t)),e.positive=t=>e.check(tW(0,t)),e.nonnegative=t=>e.check(tG(0,t)),e.negative=t=>e.check(tJ(0,t)),e.nonpositive=t=>e.check(tB(0,t)),e.multipleOf=(t,r)=>e.check(tY(t,r)),e.step=(t,r)=>e.check(tY(t,r)),e.finite=()=>e;let r=e._zod.bag;e.minValue=Math.max(r.minimum??-1/0,r.exclusiveMinimum??-1/0)??null,e.maxValue=Math.min(r.maximum??1/0,r.exclusiveMaximum??1/0)??null,e.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??.5),e.isFinite=!0,e.format=r.format??null});function rz(e){return new rN({type:"number",checks:[],...z(e)})}let rR=u("ZodNumberFormat",(e,t)=>{tl.init(e,t),rN.init(e,t)});function rC(e){return new rR({type:"number",check:"number_format",abort:!1,format:"safeint",...z(e)})}let rA=u("ZodBoolean",(e,t)=>{td.init(e,t),rl.init(e,t)});function rM(e){return new rA({type:"boolean",...z(e)})}let rZ=u("ZodNull",(e,t)=>{tu.init(e,t),rl.init(e,t)});function rD(e){return new rZ({type:"null",...z(e)})}let rq=u("ZodUnknown",(e,t)=>{tc.init(e,t),rl.init(e,t)});function rV(){return new rq({type:"unknown"})}let rL=u("ZodNever",(e,t)=>{tp.init(e,t),rl.init(e,t)}),rF=u("ZodArray",(e,t)=>{tm.init(e,t),rl.init(e,t),e.element=t.element,e.min=(t,r)=>e.check(tX(t,r)),e.nonempty=t=>e.check(tX(1,t)),e.max=(t,r)=>e.check(tQ(t,r)),e.length=(t,r)=>e.check(t0(t,r)),e.unwrap=()=>e.element});function rU(e,t){return new rF({type:"array",element:e,...z(t)})}let rH=u("ZodObject",(e,t)=>{t_.init(e,t),rl.init(e,t),w(e,"shape",()=>t.shape),e.keyof=()=>r2(Object.keys(e._zod.def.shape)),e.catchall=t=>e.clone({...e._zod.def,catchall:t}),e.passthrough=()=>e.clone({...e._zod.def,catchall:rV()}),e.loose=()=>e.clone({...e._zod.def,catchall:rV()}),e.strict=()=>e.clone({...e._zod.def,catchall:new rL({type:"never",...z(void 0)})}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=t=>(function(e,t){if(!P(t))throw Error("Invalid input to extend: expected a plain object");let r=e._zod.def.checks;if(r&&r.length>0)throw Error("Object schemas containing refinements cannot be extended. Use `.safeExtend()` instead.");let a=k(e._zod.def,{get shape(){let r={...e._zod.def.shape,...t};return $(this,"shape",r),r},checks:[]});return N(e,a)})(e,t),e.safeExtend=t=>(function(e,t){if(!P(t))throw Error("Invalid input to safeExtend: expected a plain object");let r={...e._zod.def,get shape(){let r={...e._zod.def.shape,...t};return $(this,"shape",r),r},checks:e._zod.def.checks};return N(e,r)})(e,t),e.merge=t=>{let r;return r=k(e._zod.def,{get shape(){let r={...e._zod.def.shape,...t._zod.def.shape};return $(this,"shape",r),r},get catchall(){return t._zod.def.catchall},checks:[]}),N(e,r)},e.pick=t=>{let r,a;return r=e._zod.def,a=k(e._zod.def,{get shape(){let e={};for(let a in t){if(!(a in r.shape))throw Error(`Unrecognized key: "${a}"`);t[a]&&(e[a]=r.shape[a])}return $(this,"shape",e),e},checks:[]}),N(e,a)},e.omit=t=>{let r,a;return r=e._zod.def,a=k(e._zod.def,{get shape(){let a={...e._zod.def.shape};for(let e in t){if(!(e in r.shape))throw Error(`Unrecognized key: "${e}"`);t[e]&&delete a[e]}return $(this,"shape",a),a},checks:[]}),N(e,a)},e.partial=(...t)=>{var r;let a;return r=t[0],a=k(e._zod.def,{get shape(){let t=e._zod.def.shape,a={...t};if(r)for(let e in r){if(!(e in t))throw Error(`Unrecognized key: "${e}"`);r[e]&&(a[e]=r8?new r8({type:"optional",innerType:t[e]}):t[e])}else for(let e in t)a[e]=r8?new r8({type:"optional",innerType:t[e]}):t[e];return $(this,"shape",a),a},checks:[]}),N(e,a)},e.required=(...t)=>{var r;let a;return r=t[0],a=k(e._zod.def,{get shape(){let t=e._zod.def.shape,a={...t};if(r)for(let e in r){if(!(e in a))throw Error(`Unrecognized key: "${e}"`);r[e]&&(a[e]=new as({type:"nonoptional",innerType:t[e]}))}else for(let e in t)a[e]=new as({type:"nonoptional",innerType:t[e]});return $(this,"shape",a),a},checks:[]}),N(e,a)}});function rK(e,t){return new rH({type:"object",shape:e??{},...z(t)})}function rJ(e,t){return new rH({type:"object",shape:e,catchall:rV(),...z(t)})}let rB=u("ZodUnion",(e,t)=>{tw.init(e,t),rl.init(e,t),e.options=t.options});function rW(e,t){return new rB({type:"union",options:e,...z(t)})}let rG=u("ZodDiscriminatedUnion",(e,t)=>{rB.init(e,t),t$.init(e,t)});function rY(e,t,r){return new rG({type:"union",options:t,discriminator:e,...z(r)})}let rQ=u("ZodIntersection",(e,t)=>{tk.init(e,t),rl.init(e,t)});function rX(e,t){return new rQ({type:"intersection",left:e,right:t})}let r0=u("ZodRecord",(e,t)=>{tS.init(e,t),rl.init(e,t),e.keyType=t.keyType,e.valueType=t.valueType});function r1(e,t,r){return new r0({type:"record",keyType:e,valueType:t,...z(r)})}let r9=u("ZodEnum",(e,t)=>{tT.init(e,t),rl.init(e,t),e.enum=t.entries,e.options=Object.values(t.entries);let r=new Set(Object.keys(t.entries));e.extract=(e,a)=>{let s={};for(let a of e)if(r.has(a))s[a]=t.entries[a];else throw Error(`Key ${a} not found in enum`);return new r9({...t,checks:[],...z(a),entries:s})},e.exclude=(e,a)=>{let s={...t.entries};for(let t of e)if(r.has(t))delete s[t];else throw Error(`Key ${t} not found in enum`);return new r9({...t,checks:[],...z(a),entries:s})}});function r2(e,t){return new r9({type:"enum",entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...z(t)})}let r4=u("ZodLiteral",(e,t)=>{tE.init(e,t),rl.init(e,t),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function r5(e,t){return new r4({type:"literal",values:Array.isArray(e)?e:[e],...z(t)})}let r6=u("ZodTransform",(e,t)=>{tP.init(e,t),rl.init(e,t),e._zod.parse=(r,a)=>{if("backward"===a.direction)throw new p(e.constructor.name);r.addIssue=a=>{"string"==typeof a?r.issues.push(V(a,r.value,t)):(a.fatal&&(a.continue=!1),a.code??(a.code="custom"),a.input??(a.input=r.value),a.inst??(a.inst=e),r.issues.push(V(a)))};let s=t.transform(r.value,r);return s instanceof Promise?s.then(e=>(r.value=e,r)):(r.value=s,r)}});function r3(e){return new r6({type:"transform",transform:e})}let r8=u("ZodOptional",(e,t)=>{tO.init(e,t),rl.init(e,t),e.unwrap=()=>e._zod.def.innerType});function r7(e){return new r8({type:"optional",innerType:e})}let ae=u("ZodNullable",(e,t)=>{tI.init(e,t),rl.init(e,t),e.unwrap=()=>e._zod.def.innerType});function at(e){return new ae({type:"nullable",innerType:e})}let ar=u("ZodDefault",(e,t)=>{tN.init(e,t),rl.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap}),aa=u("ZodPrefault",(e,t)=>{tR.init(e,t),rl.init(e,t),e.unwrap=()=>e._zod.def.innerType}),as=u("ZodNonOptional",(e,t)=>{tC.init(e,t),rl.init(e,t),e.unwrap=()=>e._zod.def.innerType}),ai=u("ZodCatch",(e,t)=>{tM.init(e,t),rl.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap}),an=u("ZodPipe",(e,t)=>{tZ.init(e,t),rl.init(e,t),e.in=t.in,e.out=t.out});function ao(e,t){return new an({type:"pipe",in:e,out:t})}let al=u("ZodReadonly",(e,t)=>{tq.init(e,t),rl.init(e,t),e.unwrap=()=>e._zod.def.innerType}),ad=u("ZodCustom",(e,t)=>{tL.init(e,t),rl.init(e,t)});oI||(oI={}),m({localeError:(e={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"}},s={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",mac:"MAC 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"},t=>{switch(t.code){case"invalid_type":return`Invalid input: expected ${t.expected}, received ${(e=>{let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"NaN":"number";case"object":if(Array.isArray(e))return"array";if(null===e)return"null";if(Object.getPrototypeOf(e)!==Object.prototype&&e.constructor)return e.constructor.name}return t})(t.input)}`;case"invalid_value":if(1===t.values.length)return`Invalid input: expected ${R(t.values[0])}`;return`Invalid option: expected one of ${g(t.values,"|")}`;case"too_big":{let r=t.inclusive?"<=":"<",a=e[t.origin]??null;if(a)return`Too big: expected ${t.origin??"value"} to have ${r}${t.maximum.toString()} ${a.unit??"elements"}`;return`Too big: expected ${t.origin??"value"} to be ${r}${t.maximum.toString()}`}case"too_small":{let r=t.inclusive?">=":">",a=e[t.origin]??null;if(a)return`Too small: expected ${t.origin} to have ${r}${t.minimum.toString()} ${a.unit}`;return`Too small: expected ${t.origin} to be ${r}${t.minimum.toString()}`}case"invalid_format":if("starts_with"===t.format)return`Invalid string: must start with "${t.prefix}"`;if("ends_with"===t.format)return`Invalid string: must end with "${t.suffix}"`;if("includes"===t.format)return`Invalid string: must include "${t.includes}"`;if("regex"===t.format)return`Invalid string: must match pattern ${t.pattern}`;return`Invalid ${s[t.format]??t.format}`;case"not_multiple_of":return`Invalid number: must be a multiple of ${t.divisor}`;case"unrecognized_keys":return`Unrecognized key${t.keys.length>1?"s":""}: ${g(t.keys,", ")}`;case"invalid_key":return`Invalid key in ${t.origin}`;case"invalid_union":default:return"Invalid input";case"invalid_element":return`Invalid value in ${t.origin}`}})});let au="2025-11-25",ac=[au,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],ap="io.modelcontextprotocol/related-task",ah=(ow=(e=>null!==e&&("object"==typeof e||"function"==typeof e))??(()=>!0),(o=z(void 0)).abort??(o.abort=!0),new ad({type:"custom",check:"custom",fn:ow,...o})),am=rW([rc(),rz().int()]),af=rc();rJ({ttl:rW([rz(),rD()]).optional(),pollInterval:rz().optional()});let ag=rK({ttl:rz().optional()}),ay=rK({taskId:rc()}),av=rJ({progressToken:am.optional(),[ap]:ay.optional()}),a_=rK({_meta:av.optional()}),ab=a_.extend({task:ag.optional()}),aw=rK({method:rc(),params:a_.loose().optional()}),a$=rK({_meta:av.optional()}),ak=rK({method:rc(),params:a$.loose().optional()}),ax=rJ({_meta:av.optional()}),aS=rW([rc(),rz().int()]),aT=rK({jsonrpc:r5("2.0"),id:aS,...aw.shape}).strict(),aE=e=>aT.safeParse(e).success,aP=rK({jsonrpc:r5("2.0"),...ak.shape}).strict(),aj=rK({jsonrpc:r5("2.0"),id:aS,result:ax}).strict();(o$=oN||(oN={}))[o$.ConnectionClosed=-32e3]="ConnectionClosed",o$[o$.RequestTimeout=-32001]="RequestTimeout",o$[o$.ParseError=-32700]="ParseError",o$[o$.InvalidRequest=-32600]="InvalidRequest",o$[o$.MethodNotFound=-32601]="MethodNotFound",o$[o$.InvalidParams=-32602]="InvalidParams",o$[o$.InternalError=-32603]="InternalError",o$[o$.UrlElicitationRequired=-32042]="UrlElicitationRequired";let aO=rK({jsonrpc:r5("2.0"),id:aS.optional(),error:rK({code:rz().int(),message:rc(),data:rV().optional()})}).strict(),aI=rW([aT,aP,aj,aO]);rW([aj,aO]);let aN=ax.strict(),az=a$.extend({requestId:aS.optional(),reason:rc().optional()}),aR=ak.extend({method:r5("notifications/cancelled"),params:az}),aC=rK({src:rc(),mimeType:rc().optional(),sizes:rU(rc()).optional(),theme:r2(["light","dark"]).optional()}),aA=rK({icons:rU(aC).optional()}),aM=rK({name:rc(),title:rc().optional()}),aZ=aM.extend({...aM.shape,...aA.shape,version:rc(),websiteUrl:rc().optional(),description:rc().optional()}),aD=rX(rK({applyDefaults:rM().optional()}),r1(rc(),rV())),aq=(ok=e=>e&&"object"==typeof e&&!Array.isArray(e)&&0===Object.keys(e).length?{form:{}}:e,ox=rX(rK({form:aD.optional(),url:ah.optional()}),r1(rc(),rV()).optional()),ao(r3(ok),ox)),aV=rJ({list:ah.optional(),cancel:ah.optional(),requests:rJ({sampling:rJ({createMessage:ah.optional()}).optional(),elicitation:rJ({create:ah.optional()}).optional()}).optional()}),aL=rJ({list:ah.optional(),cancel:ah.optional(),requests:rJ({tools:rJ({call:ah.optional()}).optional()}).optional()}),aF=rK({experimental:r1(rc(),ah).optional(),sampling:rK({context:ah.optional(),tools:ah.optional()}).optional(),elicitation:aq.optional(),roots:rK({listChanged:rM().optional()}).optional(),tasks:aV.optional()}),aU=a_.extend({protocolVersion:rc(),capabilities:aF,clientInfo:aZ}),aH=aw.extend({method:r5("initialize"),params:aU}),aK=rK({experimental:r1(rc(),ah).optional(),logging:ah.optional(),completions:ah.optional(),prompts:rK({listChanged:rM().optional()}).optional(),resources:rK({subscribe:rM().optional(),listChanged:rM().optional()}).optional(),tools:rK({listChanged:rM().optional()}).optional(),tasks:aL.optional()}),aJ=ax.extend({protocolVersion:rc(),capabilities:aK,serverInfo:aZ,instructions:rc().optional()}),aB=ak.extend({method:r5("notifications/initialized"),params:a$.optional()}),aW=aw.extend({method:r5("ping"),params:a_.optional()}),aG=rK({progress:rz(),total:r7(rz()),message:r7(rc())}),aY=rK({...a$.shape,...aG.shape,progressToken:am}),aQ=ak.extend({method:r5("notifications/progress"),params:aY}),aX=a_.extend({cursor:af.optional()}),a0=aw.extend({params:aX.optional()}),a1=ax.extend({nextCursor:af.optional()}),a9=r2(["working","input_required","completed","failed","cancelled"]),a2=rK({taskId:rc(),status:a9,ttl:rW([rz(),rD()]),createdAt:rc(),lastUpdatedAt:rc(),pollInterval:r7(rz()),statusMessage:r7(rc())}),a4=ax.extend({task:a2}),a5=a$.merge(a2),a6=ak.extend({method:r5("notifications/tasks/status"),params:a5}),a3=aw.extend({method:r5("tasks/get"),params:a_.extend({taskId:rc()})}),a8=ax.merge(a2),a7=aw.extend({method:r5("tasks/result"),params:a_.extend({taskId:rc()})});ax.loose();let se=a0.extend({method:r5("tasks/list")}),st=a1.extend({tasks:rU(a2)}),sr=aw.extend({method:r5("tasks/cancel"),params:a_.extend({taskId:rc()})}),sa=ax.merge(a2),ss=rK({uri:rc(),mimeType:r7(rc()),_meta:r1(rc(),rV()).optional()}),si=ss.extend({text:rc()}),sn=rc().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),so=ss.extend({blob:sn}),sl=r2(["user","assistant"]),sd=rK({audience:rU(sl).optional(),priority:rz().min(0).max(1).optional(),lastModified:t4({offset:!0}).optional()}),su=rK({...aM.shape,...aA.shape,uri:rc(),description:r7(rc()),mimeType:r7(rc()),annotations:sd.optional(),_meta:r7(rJ({}))}),sc=rK({...aM.shape,...aA.shape,uriTemplate:rc(),description:r7(rc()),mimeType:r7(rc()),annotations:sd.optional(),_meta:r7(rJ({}))}),sp=a0.extend({method:r5("resources/list")}),sh=a1.extend({resources:rU(su)}),sm=a0.extend({method:r5("resources/templates/list")}),sf=a1.extend({resourceTemplates:rU(sc)}),sg=a_.extend({uri:rc()}),sy=aw.extend({method:r5("resources/read"),params:sg}),sv=ax.extend({contents:rU(rW([si,so]))}),s_=ak.extend({method:r5("notifications/resources/list_changed"),params:a$.optional()}),sb=aw.extend({method:r5("resources/subscribe"),params:sg}),sw=aw.extend({method:r5("resources/unsubscribe"),params:sg}),s$=a$.extend({uri:rc()}),sk=ak.extend({method:r5("notifications/resources/updated"),params:s$}),sx=rK({name:rc(),description:r7(rc()),required:r7(rM())}),sS=rK({...aM.shape,...aA.shape,description:r7(rc()),arguments:r7(rU(sx)),_meta:r7(rJ({}))}),sT=a0.extend({method:r5("prompts/list")}),sE=a1.extend({prompts:rU(sS)}),sP=a_.extend({name:rc(),arguments:r1(rc(),rc()).optional()}),sj=aw.extend({method:r5("prompts/get"),params:sP}),sO=rK({type:r5("text"),text:rc(),annotations:sd.optional(),_meta:r1(rc(),rV()).optional()}),sI=rK({type:r5("image"),data:sn,mimeType:rc(),annotations:sd.optional(),_meta:r1(rc(),rV()).optional()}),sN=rK({type:r5("audio"),data:sn,mimeType:rc(),annotations:sd.optional(),_meta:r1(rc(),rV()).optional()}),sz=rK({type:r5("tool_use"),name:rc(),id:rc(),input:r1(rc(),rV()),_meta:r1(rc(),rV()).optional()}),sR=rK({type:r5("resource"),resource:rW([si,so]),annotations:sd.optional(),_meta:r1(rc(),rV()).optional()}),sC=rW([sO,sI,sN,su.extend({type:r5("resource_link")}),sR]),sA=rK({role:sl,content:sC}),sM=ax.extend({description:rc().optional(),messages:rU(sA)}),sZ=ak.extend({method:r5("notifications/prompts/list_changed"),params:a$.optional()}),sD=rK({title:rc().optional(),readOnlyHint:rM().optional(),destructiveHint:rM().optional(),idempotentHint:rM().optional(),openWorldHint:rM().optional()}),sq=rK({taskSupport:r2(["required","optional","forbidden"]).optional()}),sV=rK({...aM.shape,...aA.shape,description:rc().optional(),inputSchema:rK({type:r5("object"),properties:r1(rc(),ah).optional(),required:rU(rc()).optional()}).catchall(rV()),outputSchema:rK({type:r5("object"),properties:r1(rc(),ah).optional(),required:rU(rc()).optional()}).catchall(rV()).optional(),annotations:sD.optional(),execution:sq.optional(),_meta:r1(rc(),rV()).optional()}),sL=a0.extend({method:r5("tools/list")}),sF=a1.extend({tools:rU(sV)}),sU=ax.extend({content:rU(sC).default([]),structuredContent:r1(rc(),rV()).optional(),isError:rM().optional()});sU.or(ax.extend({toolResult:rV()}));let sH=ab.extend({name:rc(),arguments:r1(rc(),rV()).optional()}),sK=aw.extend({method:r5("tools/call"),params:sH}),sJ=ak.extend({method:r5("notifications/tools/list_changed"),params:a$.optional()});rK({autoRefresh:rM().default(!0),debounceMs:rz().int().nonnegative().default(300)});let sB=r2(["debug","info","notice","warning","error","critical","alert","emergency"]),sW=a_.extend({level:sB}),sG=aw.extend({method:r5("logging/setLevel"),params:sW}),sY=a$.extend({level:sB,logger:rc().optional(),data:rV()}),sQ=ak.extend({method:r5("notifications/message"),params:sY}),sX=rK({name:rc().optional()}),s0=rK({hints:rU(sX).optional(),costPriority:rz().min(0).max(1).optional(),speedPriority:rz().min(0).max(1).optional(),intelligencePriority:rz().min(0).max(1).optional()}),s1=rK({mode:r2(["auto","required","none"]).optional()}),s9=rK({type:r5("tool_result"),toolUseId:rc().describe("The unique identifier for the corresponding tool call."),content:rU(sC).default([]),structuredContent:rK({}).loose().optional(),isError:rM().optional(),_meta:r1(rc(),rV()).optional()}),s2=rY("type",[sO,sI,sN]),s4=rY("type",[sO,sI,sN,sz,s9]),s5=rK({role:sl,content:rW([s4,rU(s4)]),_meta:r1(rc(),rV()).optional()}),s6=ab.extend({messages:rU(s5),modelPreferences:s0.optional(),systemPrompt:rc().optional(),includeContext:r2(["none","thisServer","allServers"]).optional(),temperature:rz().optional(),maxTokens:rz().int(),stopSequences:rU(rc()).optional(),metadata:ah.optional(),tools:rU(sV).optional(),toolChoice:s1.optional()}),s3=aw.extend({method:r5("sampling/createMessage"),params:s6}),s8=ax.extend({model:rc(),stopReason:r7(r2(["endTurn","stopSequence","maxTokens"]).or(rc())),role:sl,content:s2}),s7=ax.extend({model:rc(),stopReason:r7(r2(["endTurn","stopSequence","maxTokens","toolUse"]).or(rc())),role:sl,content:rW([s4,rU(s4)])}),ie=rK({type:r5("boolean"),title:rc().optional(),description:rc().optional(),default:rM().optional()}),it=rK({type:r5("string"),title:rc().optional(),description:rc().optional(),minLength:rz().optional(),maxLength:rz().optional(),format:r2(["email","uri","date","date-time"]).optional(),default:rc().optional()}),ir=rK({type:r2(["number","integer"]),title:rc().optional(),description:rc().optional(),minimum:rz().optional(),maximum:rz().optional(),default:rz().optional()}),ia=rK({type:r5("string"),title:rc().optional(),description:rc().optional(),enum:rU(rc()),default:rc().optional()}),is=rK({type:r5("string"),title:rc().optional(),description:rc().optional(),oneOf:rU(rK({const:rc(),title:rc()})),default:rc().optional()}),ii=rK({type:r5("string"),title:rc().optional(),description:rc().optional(),enum:rU(rc()),enumNames:rU(rc()).optional(),default:rc().optional()}),io=rW([ia,is]),il=rW([rK({type:r5("array"),title:rc().optional(),description:rc().optional(),minItems:rz().optional(),maxItems:rz().optional(),items:rK({type:r5("string"),enum:rU(rc())}),default:rU(rc()).optional()}),rK({type:r5("array"),title:rc().optional(),description:rc().optional(),minItems:rz().optional(),maxItems:rz().optional(),items:rK({anyOf:rU(rK({const:rc(),title:rc()}))}),default:rU(rc()).optional()})]),id=rW([ii,io,il]),iu=rW([id,ie,it,ir]),ic=rW([ab.extend({mode:r5("form").optional(),message:rc(),requestedSchema:rK({type:r5("object"),properties:r1(rc(),iu),required:rU(rc()).optional()})}),ab.extend({mode:r5("url"),message:rc(),elicitationId:rc(),url:rc().url()})]),ip=aw.extend({method:r5("elicitation/create"),params:ic}),ih=a$.extend({elicitationId:rc()}),im=ak.extend({method:r5("notifications/elicitation/complete"),params:ih}),ig=ax.extend({action:r2(["accept","decline","cancel"]),content:(oS=e=>null===e?void 0:e,oT=r1(rc(),rW([rc(),rz(),rM(),rU(rc())])).optional(),ao(r3(oS),oT))}),iy=rK({type:r5("ref/resource"),uri:rc()}),iv=rK({type:r5("ref/prompt"),name:rc()}),i_=a_.extend({ref:rW([iv,iy]),argument:rK({name:rc(),value:rc()}),context:rK({arguments:r1(rc(),rc()).optional()}).optional()}),ib=aw.extend({method:r5("completion/complete"),params:i_}),iw=ax.extend({completion:rJ({values:rU(rc()).max(100),total:r7(rz().int()),hasMore:r7(rM())})}),i$=rK({uri:rc().startsWith("file://"),name:rc().optional(),_meta:r1(rc(),rV()).optional()}),ik=aw.extend({method:r5("roots/list"),params:a_.optional()}),ix=ax.extend({roots:rU(i$)}),iS=ak.extend({method:r5("notifications/roots/list_changed"),params:a$.optional()});rW([aW,aH,ib,sG,sj,sT,sp,sm,sy,sb,sw,sK,sL,a3,a7,se,sr]),rW([aR,aQ,aB,iS,a6]),rW([aN,s8,s7,ig,ix,a8,st,a4]),rW([aW,s3,ip,ik,a3,a7,se,sr]),rW([aR,aQ,sQ,sk,s_,sJ,sZ,a6,im]),rW([aN,aJ,iw,sM,sE,sh,sf,sv,sU,sF,a8,st,a4]);class iT extends Error{constructor(e,t,r){super(`MCP error ${e}: ${t}`),this.code=e,this.data=r,this.name="McpError"}static fromError(e,t,r){return e===oN.UrlElicitationRequired&&r&&r.elicitations?new iE(r.elicitations,t):new iT(e,t,r)}}class iE extends iT{constructor(e,t=`URL elicitation${e.length>1?"s":""} required`){super(oN.UrlElicitationRequired,t,{elicitations:e})}get elicitations(){return this.data?.elicitations??[]}}class iP{append(e){this._buffer=this._buffer?Buffer.concat([this._buffer,e]):e}readMessage(){if(!this._buffer)return null;let e=this._buffer.indexOf("\n");if(-1===e)return null;let t=this._buffer.toString("utf8",0,e).replace(/\r$/,"");return this._buffer=this._buffer.subarray(e+1),aI.parse(JSON.parse(t))}clear(){this._buffer=void 0}}class ij{constructor(e=d.stdin,t=d.stdout){this._stdin=e,this._stdout=t,this._readBuffer=new iP,this._started=!1,this._ondata=e=>{this._readBuffer.append(e),this.processReadBuffer()},this._onerror=e=>{this.onerror?.(e)}}async start(){if(this._started)throw Error("StdioServerTransport already started! If using Server class, note that connect() calls start() automatically.");this._started=!0,this._stdin.on("data",this._ondata),this._stdin.on("error",this._onerror)}processReadBuffer(){for(;;)try{let e=this._readBuffer.readMessage();if(null===e)break;this.onmessage?.(e)}catch(e){this.onerror?.(e)}}async close(){this._stdin.off("data",this._ondata),this._stdin.off("error",this._onerror),0===this._stdin.listenerCount("data")&&this._stdin.pause(),this._readBuffer.clear(),this.onclose?.()}send(e){return new Promise(t=>{let r=JSON.stringify(e)+"\n";this._stdout.write(r)?t():this._stdout.once("drain",t)})}}(oE=oz||(oz={})).assertEqual=e=>{},oE.assertIs=function(e){},oE.assertNever=function(e){throw Error()},oE.arrayToEnum=e=>{let t={};for(let r of e)t[r]=r;return t},oE.getValidEnumValues=e=>{let t=oE.objectKeys(e).filter(t=>"number"!=typeof e[e[t]]),r={};for(let a of t)r[a]=e[a];return oE.objectValues(r)},oE.objectValues=e=>oE.objectKeys(e).map(function(t){return e[t]}),oE.objectKeys="function"==typeof Object.keys?e=>Object.keys(e):e=>{let t=[];for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.push(r);return t},oE.find=(e,t)=>{for(let r of e)if(t(r))return r},oE.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&Number.isFinite(e)&&Math.floor(e)===e,oE.joinValues=function(e,t=" | "){return e.map(e=>"string"==typeof e?`'${e}'`:e).join(t)},oE.jsonStringifyReplacer=(e,t)=>"bigint"==typeof t?t.toString():t,(oR||(oR={})).mergeShapes=(e,t)=>({...e,...t});let iO=oz.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),iI=e=>{switch(typeof e){case"undefined":return iO.undefined;case"string":return iO.string;case"number":return Number.isNaN(e)?iO.nan:iO.number;case"boolean":return iO.boolean;case"function":return iO.function;case"bigint":return iO.bigint;case"symbol":return iO.symbol;case"object":if(Array.isArray(e))return iO.array;if(null===e)return iO.null;if(e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch)return iO.promise;if("u">typeof Map&&e instanceof Map)return iO.map;if("u">typeof Set&&e instanceof Set)return iO.set;if("u">typeof Date&&e instanceof Date)return iO.date;return iO.object;default:return iO.unknown}},iN=oz.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class iz extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){let t=e||function(e){return e.message},r={_errors:[]},a=e=>{for(let s of e.issues)if("invalid_union"===s.code)s.unionErrors.map(a);else if("invalid_return_type"===s.code)a(s.returnTypeError);else if("invalid_arguments"===s.code)a(s.argumentsError);else if(0===s.path.length)r._errors.push(t(s));else{let e=r,a=0;for(;a<s.path.length;){let r=s.path[a];a===s.path.length-1?(e[r]=e[r]||{_errors:[]},e[r]._errors.push(t(s))):e[r]=e[r]||{_errors:[]},e=e[r],a++}}};return a(this),r}static assert(e){if(!(e instanceof iz))throw Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,oz.jsonStringifyReplacer,2)}get isEmpty(){return 0===this.issues.length}flatten(e=e=>e.message){let t=Object.create(null),r=[];for(let a of this.issues)if(a.path.length>0){let r=a.path[0];t[r]=t[r]||[],t[r].push(e(a))}else r.push(e(a));return{formErrors:r,fieldErrors:t}}get formErrors(){return this.flatten()}}iz.create=e=>new iz(e);let iR=(e,t)=>{let r;switch(e.code){case iN.invalid_type:r=e.received===iO.undefined?"Required":`Expected ${e.expected}, received ${e.received}`;break;case iN.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,oz.jsonStringifyReplacer)}`;break;case iN.unrecognized_keys:r=`Unrecognized key(s) in object: ${oz.joinValues(e.keys,", ")}`;break;case iN.invalid_union:r="Invalid input";break;case iN.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${oz.joinValues(e.options)}`;break;case iN.invalid_enum_value:r=`Invalid enum value. Expected ${oz.joinValues(e.options)}, received '${e.received}'`;break;case iN.invalid_arguments:r="Invalid function arguments";break;case iN.invalid_return_type:r="Invalid function return type";break;case iN.invalid_date:r="Invalid date";break;case iN.invalid_string:"object"==typeof e.validation?"includes"in e.validation?(r=`Invalid input: must include "${e.validation.includes}"`,"number"==typeof e.validation.position&&(r=`${r} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?r=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?r=`Invalid input: must end with "${e.validation.endsWith}"`:oz.assertNever(e.validation):r="regex"!==e.validation?`Invalid ${e.validation}`:"Invalid";break;case iN.too_small:r="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:"number"===e.type||"bigint"===e.type?`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:"date"===e.type?`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:"Invalid input";break;case iN.too_big:r="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"bigint"===e.type?`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"date"===e.type?`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:"Invalid input";break;case iN.custom:r="Invalid input";break;case iN.invalid_intersection_types:r="Intersection results could not be merged";break;case iN.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case iN.not_finite:r="Number must be finite";break;default:r=t.defaultError,oz.assertNever(e)}return{message:r}},iC=e=>{let{data:t,path:r,errorMaps:a,issueData:s}=e,i=[...r,...s.path||[]],n={...s,path:i};if(void 0!==s.message)return{...s,path:i,message:s.message};let o="";for(let e of a.filter(e=>!!e).slice().reverse())o=e(n,{data:t,defaultError:o}).message;return{...s,path:i,message:o}};function iA(e,t){let r=iC({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,iR,void 0].filter(e=>!!e)});e.common.issues.push(r)}class iM{constructor(){this.value="valid"}dirty(){"valid"===this.value&&(this.value="dirty")}abort(){"aborted"!==this.value&&(this.value="aborted")}static mergeArray(e,t){let r=[];for(let a of t){if("aborted"===a.status)return iZ;"dirty"===a.status&&e.dirty(),r.push(a.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,t){let r=[];for(let e of t){let t=await e.key,a=await e.value;r.push({key:t,value:a})}return iM.mergeObjectSync(e,r)}static mergeObjectSync(e,t){let r={};for(let a of t){let{key:t,value:s}=a;if("aborted"===t.status||"aborted"===s.status)return iZ;"dirty"===t.status&&e.dirty(),"dirty"===s.status&&e.dirty(),"__proto__"!==t.value&&(void 0!==s.value||a.alwaysSet)&&(r[t.value]=s.value)}return{status:e.value,value:r}}}let iZ=Object.freeze({status:"aborted"}),iD=e=>({status:"dirty",value:e}),iq=e=>({status:"valid",value:e}),iV=e=>"u">typeof Promise&&e instanceof Promise;(oP=oC||(oC={})).errToObj=e=>"string"==typeof e?{message:e}:e||{},oP.toString=e=>"string"==typeof e?e:e?.message;class iL{constructor(e,t,r,a){this._cachedPath=[],this.parent=e,this.data=t,this._path=r,this._key=a}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}let iF=(e,t)=>{if("valid"===t.status)return{success:!0,data:t.value};if(!e.common.issues.length)throw Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let t=new iz(e.common.issues);return this._error=t,this._error}}};function iU(e){if(!e)return{};let{errorMap:t,invalid_type_error:r,required_error:a,description:s}=e;if(t&&(r||a))throw Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');return t?{errorMap:t,description:s}:{errorMap:(t,s)=>{let{message:i}=e;return"invalid_enum_value"===t.code?{message:i??s.defaultError}:void 0===s.data?{message:i??a??s.defaultError}:"invalid_type"!==t.code?{message:s.defaultError}:{message:i??r??s.defaultError}},description:s}}class iH{get description(){return this._def.description}_getType(e){return iI(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:iI(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new iM,ctx:{common:e.parent.common,data:e.data,parsedType:iI(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(iV(t))throw Error("Synchronous parse encountered promise.");return t}_parseAsync(e){return Promise.resolve(this._parse(e))}parse(e,t){let r=this.safeParse(e,t);if(r.success)return r.data;throw r.error}safeParse(e,t){let r={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:iI(e)},a=this._parseSync({data:e,path:r.path,parent:r});return iF(r,a)}"~validate"(e){let t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:iI(e)};if(!this["~standard"].async)try{let r=this._parseSync({data:e,path:[],parent:t});return"valid"===r.status?{value:r.value}:{issues:t.common.issues}}catch(e){e?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(e=>"valid"===e.status?{value:e.value}:{issues:t.common.issues})}async parseAsync(e,t){let r=await this.safeParseAsync(e,t);if(r.success)return r.data;throw r.error}async safeParseAsync(e,t){let r={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:iI(e)},a=this._parse({data:e,path:r.path,parent:r});return iF(r,await (iV(a)?a:Promise.resolve(a)))}refine(e,t){return this._refinement((r,a)=>{let s=e(r),i=()=>a.addIssue({code:iN.custom,..."string"==typeof t||void 0===t?{message:t}:"function"==typeof t?t(r):t});return"u">typeof Promise&&s instanceof Promise?s.then(e=>!!e||(i(),!1)):!!s||(i(),!1)})}refinement(e,t){return this._refinement((r,a)=>!!e(r)||(a.addIssue("function"==typeof t?t(r,a):t),!1))}_refinement(e){return new nP({schema:this,typeName:oA.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:e=>this["~validate"](e)}}optional(){return nj.create(this,this._def)}nullable(){return nO.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return nc.create(this)}promise(){return nE.create(this,this._def)}or(e){return nh.create([this,e],this._def)}and(e){return ng.create(this,e,this._def)}transform(e){return new nP({...iU(this._def),schema:this,typeName:oA.ZodEffects,effect:{type:"transform",transform:e}})}default(e){return new nI({...iU(this._def),innerType:this,defaultValue:"function"==typeof e?e:()=>e,typeName:oA.ZodDefault})}brand(){return new nR({typeName:oA.ZodBranded,type:this,...iU(this._def)})}catch(e){return new nN({...iU(this._def),innerType:this,catchValue:"function"==typeof e?e:()=>e,typeName:oA.ZodCatch})}describe(e){return new this.constructor({...this._def,description:e})}pipe(e){return nC.create(this,e)}readonly(){return nA.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}let iK=/^c[^\s-]{8,}$/i,iJ=/^[0-9a-z]+$/,iB=/^[0-9A-HJKMNP-TV-Z]{26}$/i,iW=/^[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,iG=/^[a-z0-9_-]{21}$/i,iY=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,iQ=/^[-+]?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)?)??$/,iX=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,i0=/^(?:(?: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])$/,i1=/^(?:(?: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])$/,i9=/^(([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]))$/,i2=/^(([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])$/,i4=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,i5=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,i6="((\\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])))",i3=RegExp(`^${i6}$`);function i8(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:null==e.precision&&(t=`${t}(\\.\\d+)?`);let r=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${r}`}class i7 extends iH{_parse(e){var t,r,a,s;let i;if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==iO.string){let t=this._getOrReturnCtx(e);return iA(t,{code:iN.invalid_type,expected:iO.string,received:t.parsedType}),iZ}let o=new iM;for(let l of this._def.checks)if("min"===l.kind)e.data.length<l.value&&(iA(i=this._getOrReturnCtx(e,i),{code:iN.too_small,minimum:l.value,type:"string",inclusive:!0,exact:!1,message:l.message}),o.dirty());else if("max"===l.kind)e.data.length>l.value&&(iA(i=this._getOrReturnCtx(e,i),{code:iN.too_big,maximum:l.value,type:"string",inclusive:!0,exact:!1,message:l.message}),o.dirty());else if("length"===l.kind){let t=e.data.length>l.value,r=e.data.length<l.value;(t||r)&&(i=this._getOrReturnCtx(e,i),t?iA(i,{code:iN.too_big,maximum:l.value,type:"string",inclusive:!0,exact:!0,message:l.message}):r&&iA(i,{code:iN.too_small,minimum:l.value,type:"string",inclusive:!0,exact:!0,message:l.message}),o.dirty())}else if("email"===l.kind)iX.test(e.data)||(iA(i=this._getOrReturnCtx(e,i),{validation:"email",code:iN.invalid_string,message:l.message}),o.dirty());else if("emoji"===l.kind)n||(n=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),n.test(e.data)||(iA(i=this._getOrReturnCtx(e,i),{validation:"emoji",code:iN.invalid_string,message:l.message}),o.dirty());else if("uuid"===l.kind)iW.test(e.data)||(iA(i=this._getOrReturnCtx(e,i),{validation:"uuid",code:iN.invalid_string,message:l.message}),o.dirty());else if("nanoid"===l.kind)iG.test(e.data)||(iA(i=this._getOrReturnCtx(e,i),{validation:"nanoid",code:iN.invalid_string,message:l.message}),o.dirty());else if("cuid"===l.kind)iK.test(e.data)||(iA(i=this._getOrReturnCtx(e,i),{validation:"cuid",code:iN.invalid_string,message:l.message}),o.dirty());else if("cuid2"===l.kind)iJ.test(e.data)||(iA(i=this._getOrReturnCtx(e,i),{validation:"cuid2",code:iN.invalid_string,message:l.message}),o.dirty());else if("ulid"===l.kind)iB.test(e.data)||(iA(i=this._getOrReturnCtx(e,i),{validation:"ulid",code:iN.invalid_string,message:l.message}),o.dirty());else if("url"===l.kind)try{new URL(e.data)}catch{iA(i=this._getOrReturnCtx(e,i),{validation:"url",code:iN.invalid_string,message:l.message}),o.dirty()}else"regex"===l.kind?(l.regex.lastIndex=0,l.regex.test(e.data)||(iA(i=this._getOrReturnCtx(e,i),{validation:"regex",code:iN.invalid_string,message:l.message}),o.dirty())):"trim"===l.kind?e.data=e.data.trim():"includes"===l.kind?e.data.includes(l.value,l.position)||(iA(i=this._getOrReturnCtx(e,i),{code:iN.invalid_string,validation:{includes:l.value,position:l.position},message:l.message}),o.dirty()):"toLowerCase"===l.kind?e.data=e.data.toLowerCase():"toUpperCase"===l.kind?e.data=e.data.toUpperCase():"startsWith"===l.kind?e.data.startsWith(l.value)||(iA(i=this._getOrReturnCtx(e,i),{code:iN.invalid_string,validation:{startsWith:l.value},message:l.message}),o.dirty()):"endsWith"===l.kind?e.data.endsWith(l.value)||(iA(i=this._getOrReturnCtx(e,i),{code:iN.invalid_string,validation:{endsWith:l.value},message:l.message}),o.dirty()):"datetime"===l.kind?(function(e){let t=`${i6}T${i8(e)}`,r=[];return r.push(e.local?"Z?":"Z"),e.offset&&r.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${r.join("|")})`,RegExp(`^${t}$`)})(l).test(e.data)||(iA(i=this._getOrReturnCtx(e,i),{code:iN.invalid_string,validation:"datetime",message:l.message}),o.dirty()):"date"===l.kind?i3.test(e.data)||(iA(i=this._getOrReturnCtx(e,i),{code:iN.invalid_string,validation:"date",message:l.message}),o.dirty()):"time"===l.kind?RegExp(`^${i8(l)}$`).test(e.data)||(iA(i=this._getOrReturnCtx(e,i),{code:iN.invalid_string,validation:"time",message:l.message}),o.dirty()):"duration"===l.kind?iQ.test(e.data)||(iA(i=this._getOrReturnCtx(e,i),{validation:"duration",code:iN.invalid_string,message:l.message}),o.dirty()):"ip"===l.kind?(t=e.data,("v4"===(r=l.version)||!r)&&i0.test(t)||("v6"===r||!r)&&i9.test(t)||(iA(i=this._getOrReturnCtx(e,i),{validation:"ip",code:iN.invalid_string,message:l.message}),o.dirty())):"jwt"===l.kind?!function(e,t){if(!iY.test(e))return!1;try{let[r]=e.split(".");if(!r)return!1;let a=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),s=JSON.parse(atob(a));if("object"!=typeof s||null===s||"typ"in s&&s?.typ!=="JWT"||!s.alg||t&&s.alg!==t)return!1;return!0}catch{return!1}}(e.data,l.alg)&&(iA(i=this._getOrReturnCtx(e,i),{validation:"jwt",code:iN.invalid_string,message:l.message}),o.dirty()):"cidr"===l.kind?(a=e.data,("v4"===(s=l.version)||!s)&&i1.test(a)||("v6"===s||!s)&&i2.test(a)||(iA(i=this._getOrReturnCtx(e,i),{validation:"cidr",code:iN.invalid_string,message:l.message}),o.dirty())):"base64"===l.kind?i4.test(e.data)||(iA(i=this._getOrReturnCtx(e,i),{validation:"base64",code:iN.invalid_string,message:l.message}),o.dirty()):"base64url"===l.kind?i5.test(e.data)||(iA(i=this._getOrReturnCtx(e,i),{validation:"base64url",code:iN.invalid_string,message:l.message}),o.dirty()):oz.assertNever(l);return{status:o.value,value:e.data}}_regex(e,t,r){return this.refinement(t=>e.test(t),{validation:t,code:iN.invalid_string,...oC.errToObj(r)})}_addCheck(e){return new i7({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...oC.errToObj(e)})}url(e){return this._addCheck({kind:"url",...oC.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...oC.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...oC.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...oC.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...oC.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...oC.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...oC.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...oC.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...oC.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...oC.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...oC.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...oC.errToObj(e)})}datetime(e){return"string"==typeof e?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:void 0===e?.precision?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...oC.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return"string"==typeof e?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:void 0===e?.precision?null:e?.precision,...oC.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...oC.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...oC.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...oC.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...oC.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...oC.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...oC.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...oC.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...oC.errToObj(t)})}nonempty(e){return this.min(1,oC.errToObj(e))}trim(){return new i7({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new i7({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new i7({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>"datetime"===e.kind)}get isDate(){return!!this._def.checks.find(e=>"date"===e.kind)}get isTime(){return!!this._def.checks.find(e=>"time"===e.kind)}get isDuration(){return!!this._def.checks.find(e=>"duration"===e.kind)}get isEmail(){return!!this._def.checks.find(e=>"email"===e.kind)}get isURL(){return!!this._def.checks.find(e=>"url"===e.kind)}get isEmoji(){return!!this._def.checks.find(e=>"emoji"===e.kind)}get isUUID(){return!!this._def.checks.find(e=>"uuid"===e.kind)}get isNANOID(){return!!this._def.checks.find(e=>"nanoid"===e.kind)}get isCUID(){return!!this._def.checks.find(e=>"cuid"===e.kind)}get isCUID2(){return!!this._def.checks.find(e=>"cuid2"===e.kind)}get isULID(){return!!this._def.checks.find(e=>"ulid"===e.kind)}get isIP(){return!!this._def.checks.find(e=>"ip"===e.kind)}get isCIDR(){return!!this._def.checks.find(e=>"cidr"===e.kind)}get isBase64(){return!!this._def.checks.find(e=>"base64"===e.kind)}get isBase64url(){return!!this._def.checks.find(e=>"base64url"===e.kind)}get minLength(){let e=null;for(let t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(let t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}i7.create=e=>new i7({checks:[],typeName:oA.ZodString,coerce:e?.coerce??!1,...iU(e)});class ne extends iH{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){let t;if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==iO.number){let t=this._getOrReturnCtx(e);return iA(t,{code:iN.invalid_type,expected:iO.number,received:t.parsedType}),iZ}let r=new iM;for(let a of this._def.checks)"int"===a.kind?oz.isInteger(e.data)||(iA(t=this._getOrReturnCtx(e,t),{code:iN.invalid_type,expected:"integer",received:"float",message:a.message}),r.dirty()):"min"===a.kind?(a.inclusive?e.data<a.value:e.data<=a.value)&&(iA(t=this._getOrReturnCtx(e,t),{code:iN.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),r.dirty()):"max"===a.kind?(a.inclusive?e.data>a.value:e.data>=a.value)&&(iA(t=this._getOrReturnCtx(e,t),{code:iN.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),r.dirty()):"multipleOf"===a.kind?0!==function(e,t){let r=(e.toString().split(".")[1]||"").length,a=(t.toString().split(".")[1]||"").length,s=r>a?r:a;return Number.parseInt(e.toFixed(s).replace(".",""))%Number.parseInt(t.toFixed(s).replace(".",""))/10**s}(e.data,a.value)&&(iA(t=this._getOrReturnCtx(e,t),{code:iN.not_multiple_of,multipleOf:a.value,message:a.message}),r.dirty()):"finite"===a.kind?Number.isFinite(e.data)||(iA(t=this._getOrReturnCtx(e,t),{code:iN.not_finite,message:a.message}),r.dirty()):oz.assertNever(a);return{status:r.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,oC.toString(t))}gt(e,t){return this.setLimit("min",e,!1,oC.toString(t))}lte(e,t){return this.setLimit("max",e,!0,oC.toString(t))}lt(e,t){return this.setLimit("max",e,!1,oC.toString(t))}setLimit(e,t,r,a){return new ne({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:oC.toString(a)}]})}_addCheck(e){return new ne({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:oC.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:oC.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:oC.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:oC.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:oC.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:oC.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:oC.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:oC.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:oC.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>"int"===e.kind||"multipleOf"===e.kind&&oz.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let r of this._def.checks)if("finite"===r.kind||"int"===r.kind||"multipleOf"===r.kind)return!0;else"min"===r.kind?(null===t||r.value>t)&&(t=r.value):"max"===r.kind&&(null===e||r.value<e)&&(e=r.value);return Number.isFinite(t)&&Number.isFinite(e)}}ne.create=e=>new ne({checks:[],typeName:oA.ZodNumber,coerce:e?.coerce||!1,...iU(e)});class nt extends iH{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){let t;if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==iO.bigint)return this._getInvalidInput(e);let r=new iM;for(let a of this._def.checks)"min"===a.kind?(a.inclusive?e.data<a.value:e.data<=a.value)&&(iA(t=this._getOrReturnCtx(e,t),{code:iN.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),r.dirty()):"max"===a.kind?(a.inclusive?e.data>a.value:e.data>=a.value)&&(iA(t=this._getOrReturnCtx(e,t),{code:iN.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),r.dirty()):"multipleOf"===a.kind?e.data%a.value!==BigInt(0)&&(iA(t=this._getOrReturnCtx(e,t),{code:iN.not_multiple_of,multipleOf:a.value,message:a.message}),r.dirty()):oz.assertNever(a);return{status:r.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return iA(t,{code:iN.invalid_type,expected:iO.bigint,received:t.parsedType}),iZ}gte(e,t){return this.setLimit("min",e,!0,oC.toString(t))}gt(e,t){return this.setLimit("min",e,!1,oC.toString(t))}lte(e,t){return this.setLimit("max",e,!0,oC.toString(t))}lt(e,t){return this.setLimit("max",e,!1,oC.toString(t))}setLimit(e,t,r,a){return new nt({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:oC.toString(a)}]})}_addCheck(e){return new nt({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:oC.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:oC.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:oC.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:oC.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:oC.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}nt.create=e=>new nt({checks:[],typeName:oA.ZodBigInt,coerce:e?.coerce??!1,...iU(e)});class nr extends iH{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==iO.boolean){let t=this._getOrReturnCtx(e);return iA(t,{code:iN.invalid_type,expected:iO.boolean,received:t.parsedType}),iZ}return iq(e.data)}}nr.create=e=>new nr({typeName:oA.ZodBoolean,coerce:e?.coerce||!1,...iU(e)});class na extends iH{_parse(e){let t;if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==iO.date){let t=this._getOrReturnCtx(e);return iA(t,{code:iN.invalid_type,expected:iO.date,received:t.parsedType}),iZ}if(Number.isNaN(e.data.getTime()))return iA(this._getOrReturnCtx(e),{code:iN.invalid_date}),iZ;let r=new iM;for(let a of this._def.checks)"min"===a.kind?e.data.getTime()<a.value&&(iA(t=this._getOrReturnCtx(e,t),{code:iN.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),r.dirty()):"max"===a.kind?e.data.getTime()>a.value&&(iA(t=this._getOrReturnCtx(e,t),{code:iN.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),r.dirty()):oz.assertNever(a);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new na({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:oC.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:oC.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return null!=e?new Date(e):null}get maxDate(){let e=null;for(let t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return null!=e?new Date(e):null}}na.create=e=>new na({checks:[],coerce:e?.coerce||!1,typeName:oA.ZodDate,...iU(e)});class ns extends iH{_parse(e){if(this._getType(e)!==iO.symbol){let t=this._getOrReturnCtx(e);return iA(t,{code:iN.invalid_type,expected:iO.symbol,received:t.parsedType}),iZ}return iq(e.data)}}ns.create=e=>new ns({typeName:oA.ZodSymbol,...iU(e)});class ni extends iH{_parse(e){if(this._getType(e)!==iO.undefined){let t=this._getOrReturnCtx(e);return iA(t,{code:iN.invalid_type,expected:iO.undefined,received:t.parsedType}),iZ}return iq(e.data)}}ni.create=e=>new ni({typeName:oA.ZodUndefined,...iU(e)});class nn extends iH{_parse(e){if(this._getType(e)!==iO.null){let t=this._getOrReturnCtx(e);return iA(t,{code:iN.invalid_type,expected:iO.null,received:t.parsedType}),iZ}return iq(e.data)}}nn.create=e=>new nn({typeName:oA.ZodNull,...iU(e)});class no extends iH{constructor(){super(...arguments),this._any=!0}_parse(e){return iq(e.data)}}no.create=e=>new no({typeName:oA.ZodAny,...iU(e)});class nl extends iH{constructor(){super(...arguments),this._unknown=!0}_parse(e){return iq(e.data)}}nl.create=e=>new nl({typeName:oA.ZodUnknown,...iU(e)});class nd extends iH{_parse(e){let t=this._getOrReturnCtx(e);return iA(t,{code:iN.invalid_type,expected:iO.never,received:t.parsedType}),iZ}}nd.create=e=>new nd({typeName:oA.ZodNever,...iU(e)});class nu extends iH{_parse(e){if(this._getType(e)!==iO.undefined){let t=this._getOrReturnCtx(e);return iA(t,{code:iN.invalid_type,expected:iO.void,received:t.parsedType}),iZ}return iq(e.data)}}nu.create=e=>new nu({typeName:oA.ZodVoid,...iU(e)});class nc extends iH{_parse(e){let{ctx:t,status:r}=this._processInputParams(e),a=this._def;if(t.parsedType!==iO.array)return iA(t,{code:iN.invalid_type,expected:iO.array,received:t.parsedType}),iZ;if(null!==a.exactLength){let e=t.data.length>a.exactLength.value,s=t.data.length<a.exactLength.value;(e||s)&&(iA(t,{code:e?iN.too_big:iN.too_small,minimum:s?a.exactLength.value:void 0,maximum:e?a.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:a.exactLength.message}),r.dirty())}if(null!==a.minLength&&t.data.length<a.minLength.value&&(iA(t,{code:iN.too_small,minimum:a.minLength.value,type:"array",inclusive:!0,exact:!1,message:a.minLength.message}),r.dirty()),null!==a.maxLength&&t.data.length>a.maxLength.value&&(iA(t,{code:iN.too_big,maximum:a.maxLength.value,type:"array",inclusive:!0,exact:!1,message:a.maxLength.message}),r.dirty()),t.common.async)return Promise.all([...t.data].map((e,r)=>a.type._parseAsync(new iL(t,e,t.path,r)))).then(e=>iM.mergeArray(r,e));let s=[...t.data].map((e,r)=>a.type._parseSync(new iL(t,e,t.path,r)));return iM.mergeArray(r,s)}get element(){return this._def.type}min(e,t){return new nc({...this._def,minLength:{value:e,message:oC.toString(t)}})}max(e,t){return new nc({...this._def,maxLength:{value:e,message:oC.toString(t)}})}length(e,t){return new nc({...this._def,exactLength:{value:e,message:oC.toString(t)}})}nonempty(e){return this.min(1,e)}}nc.create=(e,t)=>new nc({type:e,minLength:null,maxLength:null,exactLength:null,typeName:oA.ZodArray,...iU(t)});class np extends iH{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(null!==this._cached)return this._cached;let e=this._def.shape(),t=oz.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==iO.object){let t=this._getOrReturnCtx(e);return iA(t,{code:iN.invalid_type,expected:iO.object,received:t.parsedType}),iZ}let{status:t,ctx:r}=this._processInputParams(e),{shape:a,keys:s}=this._getCached(),i=[];if(!(this._def.catchall instanceof nd&&"strip"===this._def.unknownKeys))for(let e in r.data)s.includes(e)||i.push(e);let n=[];for(let e of s){let t=a[e],s=r.data[e];n.push({key:{status:"valid",value:e},value:t._parse(new iL(r,s,r.path,e)),alwaysSet:e in r.data})}if(this._def.catchall instanceof nd){let e=this._def.unknownKeys;if("passthrough"===e)for(let e of i)n.push({key:{status:"valid",value:e},value:{status:"valid",value:r.data[e]}});else if("strict"===e)i.length>0&&(iA(r,{code:iN.unrecognized_keys,keys:i}),t.dirty());else if("strip"===e);else throw Error("Internal ZodObject error: invalid unknownKeys value.")}else{let e=this._def.catchall;for(let t of i){let a=r.data[t];n.push({key:{status:"valid",value:t},value:e._parse(new iL(r,a,r.path,t)),alwaysSet:t in r.data})}}return r.common.async?Promise.resolve().then(async()=>{let e=[];for(let t of n){let r=await t.key,a=await t.value;e.push({key:r,value:a,alwaysSet:t.alwaysSet})}return e}).then(e=>iM.mergeObjectSync(t,e)):iM.mergeObjectSync(t,n)}get shape(){return this._def.shape()}strict(e){return oC.errToObj,new np({...this._def,unknownKeys:"strict",...void 0!==e?{errorMap:(t,r)=>{let a=this._def.errorMap?.(t,r).message??r.defaultError;return"unrecognized_keys"===t.code?{message:oC.errToObj(e).message??a}:{message:a}}}:{}})}strip(){return new np({...this._def,unknownKeys:"strip"})}passthrough(){return new np({...this._def,unknownKeys:"passthrough"})}extend(e){return new np({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new np({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:oA.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new np({...this._def,catchall:e})}pick(e){let t={};for(let r of oz.objectKeys(e))e[r]&&this.shape[r]&&(t[r]=this.shape[r]);return new np({...this._def,shape:()=>t})}omit(e){let t={};for(let r of oz.objectKeys(this.shape))e[r]||(t[r]=this.shape[r]);return new np({...this._def,shape:()=>t})}deepPartial(){return function e(t){if(t instanceof np){let r={};for(let a in t.shape){let s=t.shape[a];r[a]=nj.create(e(s))}return new np({...t._def,shape:()=>r})}return t instanceof nc?new nc({...t._def,type:e(t.element)}):t instanceof nj?nj.create(e(t.unwrap())):t instanceof nO?nO.create(e(t.unwrap())):t instanceof ny?ny.create(t.items.map(t=>e(t))):t}(this)}partial(e){let t={};for(let r of oz.objectKeys(this.shape)){let a=this.shape[r];e&&!e[r]?t[r]=a:t[r]=a.optional()}return new np({...this._def,shape:()=>t})}required(e){let t={};for(let r of oz.objectKeys(this.shape))if(e&&!e[r])t[r]=this.shape[r];else{let e=this.shape[r];for(;e instanceof nj;)e=e._def.innerType;t[r]=e}return new np({...this._def,shape:()=>t})}keyof(){return nx(oz.objectKeys(this.shape))}}np.create=(e,t)=>new np({shape:()=>e,unknownKeys:"strip",catchall:nd.create(),typeName:oA.ZodObject,...iU(t)}),np.strictCreate=(e,t)=>new np({shape:()=>e,unknownKeys:"strict",catchall:nd.create(),typeName:oA.ZodObject,...iU(t)}),np.lazycreate=(e,t)=>new np({shape:e,unknownKeys:"strip",catchall:nd.create(),typeName:oA.ZodObject,...iU(t)});class nh extends iH{_parse(e){let{ctx:t}=this._processInputParams(e),r=this._def.options;if(t.common.async)return Promise.all(r.map(async e=>{let r={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:r}),ctx:r}})).then(function(e){for(let t of e)if("valid"===t.result.status)return t.result;for(let r of e)if("dirty"===r.result.status)return t.common.issues.push(...r.ctx.common.issues),r.result;let r=e.map(e=>new iz(e.ctx.common.issues));return iA(t,{code:iN.invalid_union,unionErrors:r}),iZ});{let e,a=[];for(let s of r){let r={...t,common:{...t.common,issues:[]},parent:null},i=s._parseSync({data:t.data,path:t.path,parent:r});if("valid"===i.status)return i;"dirty"!==i.status||e||(e={result:i,ctx:r}),r.common.issues.length&&a.push(r.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;let s=a.map(e=>new iz(e));return iA(t,{code:iN.invalid_union,unionErrors:s}),iZ}}get options(){return this._def.options}}nh.create=(e,t)=>new nh({options:e,typeName:oA.ZodUnion,...iU(t)});let nm=e=>{if(e instanceof n$)return nm(e.schema);if(e instanceof nP)return nm(e.innerType());if(e instanceof nk)return[e.value];if(e instanceof nS)return e.options;if(e instanceof nT)return oz.objectValues(e.enum);if(e instanceof nI)return nm(e._def.innerType);if(e instanceof ni)return[void 0];if(e instanceof nn)return[null];if(e instanceof nj)return[void 0,...nm(e.unwrap())];else if(e instanceof nO)return[null,...nm(e.unwrap())];else if(e instanceof nR)return nm(e.unwrap());else if(e instanceof nA)return nm(e.unwrap());else if(e instanceof nN)return nm(e._def.innerType);else return[]};class nf extends iH{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==iO.object)return iA(t,{code:iN.invalid_type,expected:iO.object,received:t.parsedType}),iZ;let r=this.discriminator,a=t.data[r],s=this.optionsMap.get(a);return s?t.common.async?s._parseAsync({data:t.data,path:t.path,parent:t}):s._parseSync({data:t.data,path:t.path,parent:t}):(iA(t,{code:iN.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),iZ)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,r){let a=new Map;for(let r of t){let t=nm(r.shape[e]);if(!t.length)throw Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let s of t){if(a.has(s))throw Error(`Discriminator property ${String(e)} has duplicate value ${String(s)}`);a.set(s,r)}}return new nf({typeName:oA.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:a,...iU(r)})}}class ng extends iH{_parse(e){let{status:t,ctx:r}=this._processInputParams(e),a=(e,a)=>{if("aborted"===e.status||"aborted"===a.status)return iZ;let s=function e(t,r){let a=iI(t),s=iI(r);if(t===r)return{valid:!0,data:t};if(a===iO.object&&s===iO.object){let a=oz.objectKeys(r),s=oz.objectKeys(t).filter(e=>-1!==a.indexOf(e)),i={...t,...r};for(let a of s){let s=e(t[a],r[a]);if(!s.valid)return{valid:!1};i[a]=s.data}return{valid:!0,data:i}}if(a===iO.array&&s===iO.array){if(t.length!==r.length)return{valid:!1};let a=[];for(let s=0;s<t.length;s++){let i=e(t[s],r[s]);if(!i.valid)return{valid:!1};a.push(i.data)}return{valid:!0,data:a}}return a===iO.date&&s===iO.date&&+t==+r?{valid:!0,data:t}:{valid:!1}}(e.value,a.value);return s.valid?(("dirty"===e.status||"dirty"===a.status)&&t.dirty(),{status:t.value,value:s.data}):(iA(r,{code:iN.invalid_intersection_types}),iZ)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([e,t])=>a(e,t)):a(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}ng.create=(e,t,r)=>new ng({left:e,right:t,typeName:oA.ZodIntersection,...iU(r)});class ny extends iH{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==iO.array)return iA(r,{code:iN.invalid_type,expected:iO.array,received:r.parsedType}),iZ;if(r.data.length<this._def.items.length)return iA(r,{code:iN.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),iZ;!this._def.rest&&r.data.length>this._def.items.length&&(iA(r,{code:iN.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());let a=[...r.data].map((e,t)=>{let a=this._def.items[t]||this._def.rest;return a?a._parse(new iL(r,e,r.path,t)):null}).filter(e=>!!e);return r.common.async?Promise.all(a).then(e=>iM.mergeArray(t,e)):iM.mergeArray(t,a)}get items(){return this._def.items}rest(e){return new ny({...this._def,rest:e})}}ny.create=(e,t)=>{if(!Array.isArray(e))throw Error("You must pass an array of schemas to z.tuple([ ... ])");return new ny({items:e,typeName:oA.ZodTuple,rest:null,...iU(t)})};class nv extends iH{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==iO.object)return iA(r,{code:iN.invalid_type,expected:iO.object,received:r.parsedType}),iZ;let a=[],s=this._def.keyType,i=this._def.valueType;for(let e in r.data)a.push({key:s._parse(new iL(r,e,r.path,e)),value:i._parse(new iL(r,r.data[e],r.path,e)),alwaysSet:e in r.data});return r.common.async?iM.mergeObjectAsync(t,a):iM.mergeObjectSync(t,a)}get element(){return this._def.valueType}static create(e,t,r){return new nv(t instanceof iH?{keyType:e,valueType:t,typeName:oA.ZodRecord,...iU(r)}:{keyType:i7.create(),valueType:e,typeName:oA.ZodRecord,...iU(t)})}}class n_ extends iH{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==iO.map)return iA(r,{code:iN.invalid_type,expected:iO.map,received:r.parsedType}),iZ;let a=this._def.keyType,s=this._def.valueType,i=[...r.data.entries()].map(([e,t],i)=>({key:a._parse(new iL(r,e,r.path,[i,"key"])),value:s._parse(new iL(r,t,r.path,[i,"value"]))}));if(r.common.async){let e=new Map;return Promise.resolve().then(async()=>{for(let r of i){let a=await r.key,s=await r.value;if("aborted"===a.status||"aborted"===s.status)return iZ;("dirty"===a.status||"dirty"===s.status)&&t.dirty(),e.set(a.value,s.value)}return{status:t.value,value:e}})}{let e=new Map;for(let r of i){let a=r.key,s=r.value;if("aborted"===a.status||"aborted"===s.status)return iZ;("dirty"===a.status||"dirty"===s.status)&&t.dirty(),e.set(a.value,s.value)}return{status:t.value,value:e}}}}n_.create=(e,t,r)=>new n_({valueType:t,keyType:e,typeName:oA.ZodMap,...iU(r)});class nb extends iH{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==iO.set)return iA(r,{code:iN.invalid_type,expected:iO.set,received:r.parsedType}),iZ;let a=this._def;null!==a.minSize&&r.data.size<a.minSize.value&&(iA(r,{code:iN.too_small,minimum:a.minSize.value,type:"set",inclusive:!0,exact:!1,message:a.minSize.message}),t.dirty()),null!==a.maxSize&&r.data.size>a.maxSize.value&&(iA(r,{code:iN.too_big,maximum:a.maxSize.value,type:"set",inclusive:!0,exact:!1,message:a.maxSize.message}),t.dirty());let s=this._def.valueType;function i(e){let r=new Set;for(let a of e){if("aborted"===a.status)return iZ;"dirty"===a.status&&t.dirty(),r.add(a.value)}return{status:t.value,value:r}}let n=[...r.data.values()].map((e,t)=>s._parse(new iL(r,e,r.path,t)));return r.common.async?Promise.all(n).then(e=>i(e)):i(n)}min(e,t){return new nb({...this._def,minSize:{value:e,message:oC.toString(t)}})}max(e,t){return new nb({...this._def,maxSize:{value:e,message:oC.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}nb.create=(e,t)=>new nb({valueType:e,minSize:null,maxSize:null,typeName:oA.ZodSet,...iU(t)});class nw extends iH{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==iO.function)return iA(t,{code:iN.invalid_type,expected:iO.function,received:t.parsedType}),iZ;function r(e,r){return iC({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,iR,iR].filter(e=>!!e),issueData:{code:iN.invalid_arguments,argumentsError:r}})}function a(e,r){return iC({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,iR,iR].filter(e=>!!e),issueData:{code:iN.invalid_return_type,returnTypeError:r}})}let s={errorMap:t.common.contextualErrorMap},i=t.data;if(this._def.returns instanceof nE){let e=this;return iq(async function(...t){let n=new iz([]),o=await e._def.args.parseAsync(t,s).catch(e=>{throw n.addIssue(r(t,e)),n}),l=await Reflect.apply(i,this,o);return await e._def.returns._def.type.parseAsync(l,s).catch(e=>{throw n.addIssue(a(l,e)),n})})}{let e=this;return iq(function(...t){let n=e._def.args.safeParse(t,s);if(!n.success)throw new iz([r(t,n.error)]);let o=Reflect.apply(i,this,n.data),l=e._def.returns.safeParse(o,s);if(!l.success)throw new iz([a(o,l.error)]);return l.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new nw({...this._def,args:ny.create(e).rest(nl.create())})}returns(e){return new nw({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,r){return new nw({args:e||ny.create([]).rest(nl.create()),returns:t||nl.create(),typeName:oA.ZodFunction,...iU(r)})}}class n$ extends iH{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}n$.create=(e,t)=>new n$({getter:e,typeName:oA.ZodLazy,...iU(t)});class nk extends iH{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return iA(t,{received:t.data,code:iN.invalid_literal,expected:this._def.value}),iZ}return{status:"valid",value:e.data}}get value(){return this._def.value}}function nx(e,t){return new nS({values:e,typeName:oA.ZodEnum,...iU(t)})}nk.create=(e,t)=>new nk({value:e,typeName:oA.ZodLiteral,...iU(t)});class nS extends iH{_parse(e){if("string"!=typeof e.data){let t=this._getOrReturnCtx(e),r=this._def.values;return iA(t,{expected:oz.joinValues(r),received:t.parsedType,code:iN.invalid_type}),iZ}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let t=this._getOrReturnCtx(e),r=this._def.values;return iA(t,{received:t.data,code:iN.invalid_enum_value,options:r}),iZ}return iq(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return nS.create(e,{...this._def,...t})}exclude(e,t=this._def){return nS.create(this.options.filter(t=>!e.includes(t)),{...this._def,...t})}}nS.create=nx;class nT extends iH{_parse(e){let t=oz.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==iO.string&&r.parsedType!==iO.number){let e=oz.objectValues(t);return iA(r,{expected:oz.joinValues(e),received:r.parsedType,code:iN.invalid_type}),iZ}if(this._cache||(this._cache=new Set(oz.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let e=oz.objectValues(t);return iA(r,{received:r.data,code:iN.invalid_enum_value,options:e}),iZ}return iq(e.data)}get enum(){return this._def.values}}nT.create=(e,t)=>new nT({values:e,typeName:oA.ZodNativeEnum,...iU(t)});class nE extends iH{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);return t.parsedType!==iO.promise&&!1===t.common.async?(iA(t,{code:iN.invalid_type,expected:iO.promise,received:t.parsedType}),iZ):iq((t.parsedType===iO.promise?t.data:Promise.resolve(t.data)).then(e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap})))}}nE.create=(e,t)=>new nE({type:e,typeName:oA.ZodPromise,...iU(t)});class nP extends iH{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===oA.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:r}=this._processInputParams(e),a=this._def.effect||null,s={addIssue:e=>{iA(r,e),e.fatal?t.abort():t.dirty()},get path(){return r.path}};if(s.addIssue=s.addIssue.bind(s),"preprocess"===a.type){let e=a.transform(r.data,s);if(r.common.async)return Promise.resolve(e).then(async e=>{if("aborted"===t.value)return iZ;let a=await this._def.schema._parseAsync({data:e,path:r.path,parent:r});return"aborted"===a.status?iZ:"dirty"===a.status||"dirty"===t.value?iD(a.value):a});{if("aborted"===t.value)return iZ;let a=this._def.schema._parseSync({data:e,path:r.path,parent:r});return"aborted"===a.status?iZ:"dirty"===a.status||"dirty"===t.value?iD(a.value):a}}if("refinement"===a.type){let e=e=>{let t=a.refinement(e,s);if(r.common.async)return Promise.resolve(t);if(t instanceof Promise)throw Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return e};if(!1!==r.common.async)return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(r=>"aborted"===r.status?iZ:("dirty"===r.status&&t.dirty(),e(r.value).then(()=>({status:t.value,value:r.value}))));{let a=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return"aborted"===a.status?iZ:("dirty"===a.status&&t.dirty(),e(a.value),{status:t.value,value:a.value})}}if("transform"===a.type)if(!1!==r.common.async)return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(e=>"valid"!==e.status?iZ:Promise.resolve(a.transform(e.value,s)).then(e=>({status:t.value,value:e})));else{let e=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if("valid"!==e.status)return iZ;let i=a.transform(e.value,s);if(i instanceof Promise)throw Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:i}}oz.assertNever(a)}}nP.create=(e,t,r)=>new nP({schema:e,typeName:oA.ZodEffects,effect:t,...iU(r)}),nP.createWithPreprocess=(e,t,r)=>new nP({schema:t,effect:{type:"preprocess",transform:e},typeName:oA.ZodEffects,...iU(r)});class nj extends iH{_parse(e){return this._getType(e)===iO.undefined?iq(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}nj.create=(e,t)=>new nj({innerType:e,typeName:oA.ZodOptional,...iU(t)});class nO extends iH{_parse(e){return this._getType(e)===iO.null?iq(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}nO.create=(e,t)=>new nO({innerType:e,typeName:oA.ZodNullable,...iU(t)});class nI extends iH{_parse(e){let{ctx:t}=this._processInputParams(e),r=t.data;return t.parsedType===iO.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}nI.create=(e,t)=>new nI({innerType:e,typeName:oA.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...iU(t)});class nN extends iH{_parse(e){let{ctx:t}=this._processInputParams(e),r={...t,common:{...t.common,issues:[]}},a=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return iV(a)?a.then(e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new iz(r.common.issues)},input:r.data})})):{status:"valid",value:"valid"===a.status?a.value:this._def.catchValue({get error(){return new iz(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}nN.create=(e,t)=>new nN({innerType:e,typeName:oA.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...iU(t)});class nz extends iH{_parse(e){if(this._getType(e)!==iO.nan){let t=this._getOrReturnCtx(e);return iA(t,{code:iN.invalid_type,expected:iO.nan,received:t.parsedType}),iZ}return{status:"valid",value:e.data}}}nz.create=e=>new nz({typeName:oA.ZodNaN,...iU(e)}),Symbol("zod_brand");class nR extends iH{_parse(e){let{ctx:t}=this._processInputParams(e),r=t.data;return this._def.type._parse({data:r,path:t.path,parent:t})}unwrap(){return this._def.type}}class nC extends iH{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{let e=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return"aborted"===e.status?iZ:"dirty"===e.status?(t.dirty(),iD(e.value)):this._def.out._parseAsync({data:e.value,path:r.path,parent:r})})();{let e=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return"aborted"===e.status?iZ:"dirty"===e.status?(t.dirty(),{status:"dirty",value:e.value}):this._def.out._parseSync({data:e.value,path:r.path,parent:r})}}static create(e,t){return new nC({in:e,out:t,typeName:oA.ZodPipeline})}}class nA extends iH{_parse(e){let t=this._def.innerType._parse(e),r=e=>("valid"===e.status&&(e.value=Object.freeze(e.value)),e);return iV(t)?t.then(e=>r(e)):r(t)}unwrap(){return this._def.innerType}}nA.create=(e,t)=>new nA({innerType:e,typeName:oA.ZodReadonly,...iU(t)}),np.lazycreate,(oj=oA||(oA={})).ZodString="ZodString",oj.ZodNumber="ZodNumber",oj.ZodNaN="ZodNaN",oj.ZodBigInt="ZodBigInt",oj.ZodBoolean="ZodBoolean",oj.ZodDate="ZodDate",oj.ZodSymbol="ZodSymbol",oj.ZodUndefined="ZodUndefined",oj.ZodNull="ZodNull",oj.ZodAny="ZodAny",oj.ZodUnknown="ZodUnknown",oj.ZodNever="ZodNever",oj.ZodVoid="ZodVoid",oj.ZodArray="ZodArray",oj.ZodObject="ZodObject",oj.ZodUnion="ZodUnion",oj.ZodDiscriminatedUnion="ZodDiscriminatedUnion",oj.ZodIntersection="ZodIntersection",oj.ZodTuple="ZodTuple",oj.ZodRecord="ZodRecord",oj.ZodMap="ZodMap",oj.ZodSet="ZodSet",oj.ZodFunction="ZodFunction",oj.ZodLazy="ZodLazy",oj.ZodLiteral="ZodLiteral",oj.ZodEnum="ZodEnum",oj.ZodEffects="ZodEffects",oj.ZodNativeEnum="ZodNativeEnum",oj.ZodOptional="ZodOptional",oj.ZodNullable="ZodNullable",oj.ZodDefault="ZodDefault",oj.ZodCatch="ZodCatch",oj.ZodPromise="ZodPromise",oj.ZodBranded="ZodBranded",oj.ZodPipeline="ZodPipeline",oj.ZodReadonly="ZodReadonly",i7.create,ne.create,nz.create,nt.create,nr.create,na.create,ns.create,ni.create,nn.create,no.create,nl.create,nd.create,nu.create,nc.create;let nM=np.create;np.strictCreate,nh.create,nf.create,ng.create,ny.create,nv.create,n_.create,nb.create,nw.create,n$.create,nk.create,nS.create,nT.create,nE.create,nP.create,nj.create,nO.create,nP.createWithPreprocess,nC.create;let nZ=u("ZodMiniType",(e,t)=>{if(!e._zod)throw Error("Uninitialized schema in ZodMiniType.");eU.init(e,t),e.def=t,e.type=t.type,e.parse=(t,r)=>K(e,t,r,{callee:e.parse}),e.safeParse=(t,r)=>G(e,t,r),e.parseAsync=async(t,r)=>B(e,t,r,{callee:e.parseAsync}),e.safeParseAsync=async(t,r)=>Q(e,t,r),e.check=(...r)=>e.clone({...t,checks:[...t.checks??[],...r.map(e=>"function"==typeof e?{_zod:{check:e,def:{check:"custom"},onattach:[]}}:e)]}),e.clone=(t,r)=>N(e,t,r),e.brand=()=>e,e.register=(t,r)=>(t.add(e,r),e)}),nD=u("ZodMiniObject",(e,t)=>{tv.init(e,t),nZ.init(e,t),w(e,"shape",()=>t.shape)});function nq(e,t){return new nD({type:"object",shape:e??{},...z(t)})}function nV(e){return!!e._zod}function nL(e){let t=Object.values(e);if(0===t.length)return nq({});let r=t.every(nV),a=t.every(e=>!nV(e));if(r)return nq(e);if(a)return nM(e);throw Error("Mixed Zod versions detected in object shape.")}function nF(e,t){return nV(e)?G(e,t):e.safeParse(t)}async function nU(e,t){return nV(e)?await Q(e,t):await e.safeParseAsync(t)}function nH(e){let t;if(e&&(t=nV(e)?e._zod?.def?.shape:e.shape)){if("function"==typeof t)try{return t()}catch{return}return t}}function nK(e){if(e){if("object"==typeof e&&!e._def&&!e._zod){let t=Object.values(e);if(t.length>0&&t.every(e=>"object"==typeof e&&null!==e&&(void 0!==e._def||void 0!==e._zod||"function"==typeof e.parse)))return nL(e)}if(nV(e)){let t=e._zod?.def;if(t&&("object"===t.type||void 0!==t.shape))return e}else if(void 0!==e.shape)return e}}function nJ(e){if(e&&"object"==typeof e){if("message"in e&&"string"==typeof e.message)return e.message;if("issues"in e&&Array.isArray(e.issues)&&e.issues.length>0){let t=e.issues[0];if(t&&"object"==typeof t&&"message"in t)return String(t.message)}try{return JSON.stringify(e)}catch{}}return String(e)}function nB(e){if(nV(e)){let t=e._zod?.def;if(t){if(void 0!==t.value)return t.value;if(Array.isArray(t.values)&&t.values.length>0)return t.values[0]}}let t=e._def;if(t){if(void 0!==t.value)return t.value;if(Array.isArray(t.values)&&t.values.length>0)return t.values[0]}let r=e.value;if(void 0!==r)return r}function nW(e){return"completed"===e||"failed"===e||"cancelled"===e}let nG=Symbol("Let zodToJsonSchema decide on which parser to use"),nY={name:void 0,$refStrategy:"root",basePath:["#"],effectStrategy:"input",pipeStrategy:"all",dateStrategy:"format:date-time",mapStrategy:"entries",removeAdditionalStrategy:"passthrough",allowedAdditionalProperties:!0,rejectedAdditionalProperties:!1,definitionPath:"definitions",target:"jsonSchema7",strictUnions:!1,definitions:{},errorMessages:!1,markdownDescription:!1,patternStrategy:"escape",applyRegexFlags:!1,emailStrategy:"format:email",base64Strategy:"contentEncoding:base64",nameStrategy:"ref",openAiAnyTypeName:"OpenAiAnyType"},nQ=(e,t)=>{let r=0;for(;r<e.length&&r<t.length&&e[r]===t[r];r++);return[(e.length-r).toString(),...t.slice(r)].join("/")};function nX(e){if("openAi"!==e.target)return{};let t=[...e.basePath,e.definitionPath,e.openAiAnyTypeName];return e.flags.hasReferencedOpenAiAnyType=!0,{$ref:"relative"===e.$refStrategy?nQ(t,e.currentPath):t.join("/")}}function n0(e,t,r,a){a?.errorMessages&&r&&(e.errorMessage={...e.errorMessage,[t]:r})}function n1(e,t,r,a,s){e[t]=r,n0(e,t,a,s)}function n9(e,t){return oh(e.type._def,t)}let n2=/^[cC][^\s-]{8,}$/,n4=/^[0-9a-z]+$/,n5=/^[0-9A-HJKMNP-TV-Z]{26}$/,n6=/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,n3=()=>(void 0===l&&(l=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),l),n8=/^(?:(?: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])$/,n7=/^(([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])$/,oe=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,ot=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,or=/^[a-zA-Z0-9_-]{21}$/,oa=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/;function os(e,t){let r={type:"string"};if(e.checks)for(let a of e.checks)switch(a.kind){case"min":n1(r,"minLength","number"==typeof r.minLength?Math.max(r.minLength,a.value):a.value,a.message,t);break;case"max":n1(r,"maxLength","number"==typeof r.maxLength?Math.min(r.maxLength,a.value):a.value,a.message,t);break;case"email":switch(t.emailStrategy){case"format:email":oo(r,"email",a.message,t);break;case"format:idn-email":oo(r,"idn-email",a.message,t);break;case"pattern:zod":ol(r,n6,a.message,t)}break;case"url":oo(r,"uri",a.message,t);break;case"uuid":oo(r,"uuid",a.message,t);break;case"regex":ol(r,a.regex,a.message,t);break;case"cuid":ol(r,n2,a.message,t);break;case"cuid2":ol(r,n4,a.message,t);break;case"startsWith":ol(r,RegExp(`^${oi(a.value,t)}`),a.message,t);break;case"endsWith":ol(r,RegExp(`${oi(a.value,t)}$`),a.message,t);break;case"datetime":oo(r,"date-time",a.message,t);break;case"date":oo(r,"date",a.message,t);break;case"time":oo(r,"time",a.message,t);break;case"duration":oo(r,"duration",a.message,t);break;case"length":n1(r,"minLength","number"==typeof r.minLength?Math.max(r.minLength,a.value):a.value,a.message,t),n1(r,"maxLength","number"==typeof r.maxLength?Math.min(r.maxLength,a.value):a.value,a.message,t);break;case"includes":ol(r,RegExp(oi(a.value,t)),a.message,t);break;case"ip":"v6"!==a.version&&oo(r,"ipv4",a.message,t),"v4"!==a.version&&oo(r,"ipv6",a.message,t);break;case"base64url":ol(r,ot,a.message,t);break;case"jwt":ol(r,oa,a.message,t);break;case"cidr":"v6"!==a.version&&ol(r,n8,a.message,t),"v4"!==a.version&&ol(r,n7,a.message,t);break;case"emoji":ol(r,n3(),a.message,t);break;case"ulid":ol(r,n5,a.message,t);break;case"base64":switch(t.base64Strategy){case"format:binary":oo(r,"binary",a.message,t);break;case"contentEncoding:base64":n1(r,"contentEncoding","base64",a.message,t);break;case"pattern:zod":ol(r,oe,a.message,t)}break;case"nanoid":ol(r,or,a.message,t)}return r}function oi(e,t){return"escape"===t.patternStrategy?function(e){let t="";for(let r=0;r<e.length;r++)on.has(e[r])||(t+="\\"),t+=e[r];return t}(e):e}let on=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function oo(e,t,r,a){e.format||e.anyOf?.some(e=>e.format)?(e.anyOf||(e.anyOf=[]),e.format&&(e.anyOf.push({format:e.format,...e.errorMessage&&a.errorMessages&&{errorMessage:{format:e.errorMessage.format}}}),delete e.format,e.errorMessage&&(delete e.errorMessage.format,0===Object.keys(e.errorMessage).length&&delete e.errorMessage)),e.anyOf.push({format:t,...r&&a.errorMessages&&{errorMessage:{format:r}}})):n1(e,"format",t,r,a)}function ol(e,t,r,a){e.pattern||e.allOf?.some(e=>e.pattern)?(e.allOf||(e.allOf=[]),e.pattern&&(e.allOf.push({pattern:e.pattern,...e.errorMessage&&a.errorMessages&&{errorMessage:{pattern:e.errorMessage.pattern}}}),delete e.pattern,e.errorMessage&&(delete e.errorMessage.pattern,0===Object.keys(e.errorMessage).length&&delete e.errorMessage)),e.allOf.push({pattern:od(t,a),...r&&a.errorMessages&&{errorMessage:{pattern:r}}})):n1(e,"pattern",od(t,a),r,a)}function od(e,t){if(!t.applyRegexFlags||!e.flags)return e.source;let r={i:e.flags.includes("i"),m:e.flags.includes("m"),s:e.flags.includes("s")},a=r.i?e.source.toLowerCase():e.source,s="",i=!1,n=!1,o=!1;for(let e=0;e<a.length;e++){if(i){s+=a[e],i=!1;continue}if(r.i){if(n){if(a[e].match(/[a-z]/)){o?(s+=a[e],s+=`${a[e-2]}-${a[e]}`.toUpperCase(),o=!1):"-"===a[e+1]&&a[e+2]?.match(/[a-z]/)?(s+=a[e],o=!0):s+=`${a[e]}${a[e].toUpperCase()}`;continue}}else if(a[e].match(/[a-z]/)){s+=`[${a[e]}${a[e].toUpperCase()}]`;continue}}if(r.m){if("^"===a[e]){s+=`(^|(?<=[\r
28
+ ]))`;continue}else if("$"===a[e]){s+=`($|(?=[\r
29
+ ]))`;continue}}if(r.s&&"."===a[e]){s+=n?`${a[e]}\r
30
+ `:`[${a[e]}\r
31
+ ]`;continue}s+=a[e],"\\"===a[e]?i=!0:n&&"]"===a[e]?n=!1:n||"["!==a[e]||(n=!0)}try{new RegExp(s)}catch{return console.warn(`Could not convert regex pattern at ${t.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`),e.source}return s}function ou(e,t){if("openAi"===t.target&&console.warn("Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead."),"openApi3"===t.target&&e.keyType?._def.typeName===oA.ZodEnum)return{type:"object",required:e.keyType._def.values,properties:e.keyType._def.values.reduce((r,a)=>({...r,[a]:oh(e.valueType._def,{...t,currentPath:[...t.currentPath,"properties",a]})??nX(t)}),{}),additionalProperties:t.rejectedAdditionalProperties};let r={type:"object",additionalProperties:oh(e.valueType._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]})??t.allowedAdditionalProperties};if("openApi3"===t.target)return r;if(e.keyType?._def.typeName===oA.ZodString&&e.keyType._def.checks?.length){let{type:a,...s}=os(e.keyType._def,t);return{...r,propertyNames:s}}if(e.keyType?._def.typeName===oA.ZodEnum)return{...r,propertyNames:{enum:e.keyType._def.values}};if(e.keyType?._def.typeName===oA.ZodBranded&&e.keyType._def.type._def.typeName===oA.ZodString&&e.keyType._def.type._def.checks?.length){let{type:a,...s}=n9(e.keyType._def,t);return{...r,propertyNames:s}}return r}let oc={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"},op=(e,t)=>{let r=(e.options instanceof Map?Array.from(e.options.values()):e.options).map((e,r)=>oh(e._def,{...t,currentPath:[...t.currentPath,"anyOf",`${r}`]})).filter(e=>!!e&&(!t.strictUnions||"object"==typeof e&&Object.keys(e).length>0));return r.length?{anyOf:r}:void 0};function oh(e,t,r=!1){let a=t.seen.get(e);if(t.override){let s=t.override?.(e,t,a,r);if(s!==nG)return s}if(a&&!r){let e=om(a,t);if(void 0!==e)return e}let s={def:e,path:t.currentPath,jsonSchema:void 0};t.seen.set(e,s);let i=((e,t,r)=>{switch(t){case oA.ZodString:return os(e,r);case oA.ZodNumber:let a={type:"number"};if(!e.checks)return a;for(let t of e.checks)switch(t.kind){case"int":a.type="integer",n0(a,"type",t.message,r);break;case"min":"jsonSchema7"===r.target?t.inclusive?n1(a,"minimum",t.value,t.message,r):n1(a,"exclusiveMinimum",t.value,t.message,r):(t.inclusive||(a.exclusiveMinimum=!0),n1(a,"minimum",t.value,t.message,r));break;case"max":"jsonSchema7"===r.target?t.inclusive?n1(a,"maximum",t.value,t.message,r):n1(a,"exclusiveMaximum",t.value,t.message,r):(t.inclusive||(a.exclusiveMaximum=!0),n1(a,"maximum",t.value,t.message,r));break;case"multipleOf":n1(a,"multipleOf",t.value,t.message,r)}return a;case oA.ZodObject:return function(e,t){let r="openAi"===t.target,a={type:"object",properties:{}},s=[],i=e.shape();for(let e in i){let n=i[e];if(void 0===n||void 0===n._def)continue;let o=function(e){try{return e.isOptional()}catch{return!0}}(n);o&&r&&("ZodOptional"===n._def.typeName&&(n=n._def.innerType),n.isNullable()||(n=n.nullable()),o=!1);let l=oh(n._def,{...t,currentPath:[...t.currentPath,"properties",e],propertyPath:[...t.currentPath,"properties",e]});void 0!==l&&(a.properties[e]=l,o||s.push(e))}s.length&&(a.required=s);let n=function(e,t){if("ZodNever"!==e.catchall._def.typeName)return oh(e.catchall._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]});switch(e.unknownKeys){case"passthrough":return t.allowedAdditionalProperties;case"strict":return t.rejectedAdditionalProperties;case"strip":return"strict"===t.removeAdditionalStrategy?t.allowedAdditionalProperties:t.rejectedAdditionalProperties}}(e,t);return void 0!==n&&(a.additionalProperties=n),a}(e,r);case oA.ZodBigInt:let s={type:"integer",format:"int64"};if(!e.checks)return s;for(let t of e.checks)switch(t.kind){case"min":"jsonSchema7"===r.target?t.inclusive?n1(s,"minimum",t.value,t.message,r):n1(s,"exclusiveMinimum",t.value,t.message,r):(t.inclusive||(s.exclusiveMinimum=!0),n1(s,"minimum",t.value,t.message,r));break;case"max":"jsonSchema7"===r.target?t.inclusive?n1(s,"maximum",t.value,t.message,r):n1(s,"exclusiveMaximum",t.value,t.message,r):(t.inclusive||(s.exclusiveMaximum=!0),n1(s,"maximum",t.value,t.message,r));break;case"multipleOf":n1(s,"multipleOf",t.value,t.message,r)}return s;case oA.ZodBoolean:return{type:"boolean"};case oA.ZodDate:return function e(t,r,a){let s=a??r.dateStrategy;if(Array.isArray(s))return{anyOf:s.map((a,s)=>e(t,r,a))};switch(s){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":let i={type:"integer",format:"unix-time"};if("openApi3"===r.target)return i;for(let e of t.checks)switch(e.kind){case"min":n1(i,"minimum",e.value,e.message,r);break;case"max":n1(i,"maximum",e.value,e.message,r)}return i}}(e,r);case oA.ZodUndefined:return{not:nX(r)};case oA.ZodNull:return"openApi3"===r.target?{enum:["null"],nullable:!0}:{type:"null"};case oA.ZodArray:let i;return i={type:"array"},e.type?._def&&e.type?._def?.typeName!==oA.ZodAny&&(i.items=oh(e.type._def,{...r,currentPath:[...r.currentPath,"items"]})),e.minLength&&n1(i,"minItems",e.minLength.value,e.minLength.message,r),e.maxLength&&n1(i,"maxItems",e.maxLength.value,e.maxLength.message,r),e.exactLength&&(n1(i,"minItems",e.exactLength.value,e.exactLength.message,r),n1(i,"maxItems",e.exactLength.value,e.exactLength.message,r)),i;case oA.ZodUnion:case oA.ZodDiscriminatedUnion:if("openApi3"===r.target)return op(e,r);let n=e.options instanceof Map?Array.from(e.options.values()):e.options;if(n.every(e=>e._def.typeName in oc&&(!e._def.checks||!e._def.checks.length))){let e=n.reduce((e,t)=>{let r=oc[t._def.typeName];return r&&!e.includes(r)?[...e,r]:e},[]);return{type:e.length>1?e:e[0]}}if(n.every(e=>"ZodLiteral"===e._def.typeName&&!e.description)){let e=n.reduce((e,t)=>{let r=typeof t._def.value;switch(r){case"string":case"number":case"boolean":return[...e,r];case"bigint":return[...e,"integer"];case"object":if(null===t._def.value)return[...e,"null"];default:return e}},[]);if(e.length===n.length){let t=e.filter((e,t,r)=>r.indexOf(e)===t);return{type:t.length>1?t:t[0],enum:n.reduce((e,t)=>e.includes(t._def.value)?e:[...e,t._def.value],[])}}}else if(n.every(e=>"ZodEnum"===e._def.typeName))return{type:"string",enum:n.reduce((e,t)=>[...e,...t._def.values.filter(t=>!e.includes(t))],[])};return op(e,r);case oA.ZodIntersection:let o,l,d;return o=[oh(e.left._def,{...r,currentPath:[...r.currentPath,"allOf","0"]}),oh(e.right._def,{...r,currentPath:[...r.currentPath,"allOf","1"]})].filter(e=>!!e),l="jsonSchema2019-09"===r.target?{unevaluatedProperties:!1}:void 0,d=[],o.forEach(e=>{if((!("type"in e)||"string"!==e.type)&&"allOf"in e)d.push(...e.allOf),void 0===e.unevaluatedProperties&&(l=void 0);else{let t=e;if("additionalProperties"in e&&!1===e.additionalProperties){let{additionalProperties:r,...a}=e;t=a}else l=void 0;d.push(t)}}),d.length?{allOf:d,...l}:void 0;case oA.ZodTuple:return e.rest?{type:"array",minItems:e.items.length,items:e.items.map((e,t)=>oh(e._def,{...r,currentPath:[...r.currentPath,"items",`${t}`]})).reduce((e,t)=>void 0===t?e:[...e,t],[]),additionalItems:oh(e.rest._def,{...r,currentPath:[...r.currentPath,"additionalItems"]})}:{type:"array",minItems:e.items.length,maxItems:e.items.length,items:e.items.map((e,t)=>oh(e._def,{...r,currentPath:[...r.currentPath,"items",`${t}`]})).reduce((e,t)=>void 0===t?e:[...e,t],[])};case oA.ZodRecord:return ou(e,r);case oA.ZodLiteral:let u;return"bigint"!=(u=typeof e.value)&&"number"!==u&&"boolean"!==u&&"string"!==u?{type:Array.isArray(e.value)?"array":"object"}:"openApi3"===r.target?{type:"bigint"===u?"integer":u,enum:[e.value]}:{type:"bigint"===u?"integer":u,const:e.value};case oA.ZodEnum:return{type:"string",enum:Array.from(e.values)};case oA.ZodNativeEnum:let c,p,h;return c=e.values,{type:1===(h=Array.from(new Set((p=Object.keys(e.values).filter(e=>"number"!=typeof c[c[e]]).map(e=>c[e])).map(e=>typeof e)))).length?"string"===h[0]?"string":"number":["string","number"],enum:p};case oA.ZodNullable:if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(e.innerType._def.typeName)&&(!e.innerType._def.checks||!e.innerType._def.checks.length))return"openApi3"===r.target?{type:oc[e.innerType._def.typeName],nullable:!0}:{type:[oc[e.innerType._def.typeName],"null"]};if("openApi3"===r.target){let t=oh(e.innerType._def,{...r,currentPath:[...r.currentPath]});return t&&"$ref"in t?{allOf:[t],nullable:!0}:t&&{...t,nullable:!0}}let m=oh(e.innerType._def,{...r,currentPath:[...r.currentPath,"anyOf","0"]});return m&&{anyOf:[m,{type:"null"}]};case oA.ZodOptional:if(r.currentPath.toString()===r.propertyPath?.toString())return oh(e.innerType._def,r);let f=oh(e.innerType._def,{...r,currentPath:[...r.currentPath,"anyOf","1"]});return f?{anyOf:[{not:nX(r)},f]}:nX(r);case oA.ZodMap:if("record"===r.mapStrategy)return ou(e,r);return{type:"array",maxItems:125,items:{type:"array",items:[oh(e.keyType._def,{...r,currentPath:[...r.currentPath,"items","items","0"]})||nX(r),oh(e.valueType._def,{...r,currentPath:[...r.currentPath,"items","items","1"]})||nX(r)],minItems:2,maxItems:2}};case oA.ZodSet:let g;return g={type:"array",uniqueItems:!0,items:oh(e.valueType._def,{...r,currentPath:[...r.currentPath,"items"]})},e.minSize&&n1(g,"minItems",e.minSize.value,e.minSize.message,r),e.maxSize&&n1(g,"maxItems",e.maxSize.value,e.maxSize.message,r),g;case oA.ZodLazy:return()=>e.getter()._def;case oA.ZodPromise:return oh(e.type._def,r);case oA.ZodNaN:case oA.ZodNever:return"openAi"===r.target?void 0:{not:nX({...r,currentPath:[...r.currentPath,"not"]})};case oA.ZodEffects:return"input"===r.effectStrategy?oh(e.schema._def,r):nX(r);case oA.ZodAny:case oA.ZodUnknown:return nX(r);case oA.ZodDefault:return{...oh(e.innerType._def,r),default:e.defaultValue()};case oA.ZodBranded:return n9(e,r);case oA.ZodReadonly:case oA.ZodCatch:return oh(e.innerType._def,r);case oA.ZodPipeline:if("input"===r.pipeStrategy)return oh(e.in._def,r);if("output"===r.pipeStrategy)return oh(e.out._def,r);let y=oh(e.in._def,{...r,currentPath:[...r.currentPath,"allOf","0"]}),v=oh(e.out._def,{...r,currentPath:[...r.currentPath,"allOf",y?"1":"0"]});return{allOf:[y,v].filter(e=>void 0!==e)};case oA.ZodFunction:case oA.ZodVoid:case oA.ZodSymbol:default:return}})(e,e.typeName,t),n="function"==typeof i?oh(i(),t):i;if(n&&of(e,t,n),t.postProcess){let r=t.postProcess(n,e,t);return s.jsonSchema=n,r}return s.jsonSchema=n,n}let om=(e,t)=>{switch(t.$refStrategy){case"root":return{$ref:e.path.join("/")};case"relative":return{$ref:nQ(t.currentPath,e.path)};case"none":case"seen":if(e.path.length<t.currentPath.length&&e.path.every((e,r)=>t.currentPath[r]===e))return console.warn(`Recursive reference detected at ${t.currentPath.join("/")}! Defaulting to any`),nX(t);return"seen"===t.$refStrategy?nX(t):void 0}},of=(e,t,r)=>(e.description&&(r.description=e.description,t.markdownDescription&&(r.markdownDescription=e.description)),r);function og(e,t){var r,a;let s,i,n,o,l,d,u,c;return nV(e)?function(e,t){if(e instanceof tU){let r=new t9(t),a={};for(let t of e._idmap.entries()){let[e,a]=t;r.process(a)}let s={},i={registry:e,uri:t?.uri,defs:a};for(let a of e._idmap.entries()){let[e,n]=a;s[e]=r.emit(n,{...t,external:i})}return Object.keys(a).length>0&&(s.__shared={["draft-2020-12"===r.target?"$defs":"definitions"]:a}),{schemas:s}}let r=new t9(t);return r.process(e),r.emit(e,t)}(e,{target:(r=t?.target)&&"jsonSchema7"!==r&&"draft-7"!==r&&("jsonSchema2019-09"===r||"draft-2020-12"===r)?"draft-2020-12":"draft-7",io:t?.pipeStrategy??"input"}):(i=void 0!==(s="string"==typeof(a={strictUnions:t?.strictUnions??!0,pipeStrategy:t?.pipeStrategy??"input"})?{...nY,name:a}:{...nY,...a}).name?[...s.basePath,s.definitionPath,s.name]:s.basePath,n={...s,flags:{hasReferencedOpenAiAnyType:!1},currentPath:i,propertyPath:void 0,seen:new Map(Object.entries(s.definitions).map(([e,t])=>[t._def,{def:t._def,path:[...s.basePath,s.definitionPath,e],jsonSchema:void 0}]))},o=a.definitions?Object.entries(a.definitions).reduce((e,[t,r])=>({...e,[t]:oh(r._def,{...n,currentPath:[...n.basePath,n.definitionPath,t]},!0)??nX(n)}),{}):void 0,l=a?.nameStrategy==="title"?void 0:a?.name,d=oh(e._def,void 0===l?n:{...n,currentPath:[...n.basePath,n.definitionPath,l]},!1)??nX(n),void 0!==(u=void 0!==a.name&&"title"===a.nameStrategy?a.name:void 0)&&(d.title=u),n.flags.hasReferencedOpenAiAnyType&&(o||(o={}),o[n.openAiAnyTypeName]||(o[n.openAiAnyTypeName]={type:["string","number","integer","boolean","array","null"],items:{$ref:"relative"===n.$refStrategy?"1":[...n.basePath,n.definitionPath,n.openAiAnyTypeName].join("/")}})),c=void 0===l?o?{...d,[n.definitionPath]:o}:d:{$ref:[..."relative"===n.$refStrategy?[]:n.basePath,n.definitionPath,l].join("/"),[n.definitionPath]:{...o,[l]:d}},"jsonSchema7"===n.target?c.$schema="http://json-schema.org/draft-07/schema#":("jsonSchema2019-09"===n.target||"openAi"===n.target)&&(c.$schema="https://json-schema.org/draft/2019-09/schema#"),"openAi"===n.target&&("anyOf"in c||"oneOf"in c||"allOf"in c||"type"in c&&Array.isArray(c.type))&&console.warn("Warning: OpenAI may not support schemas with unions as roots! Try wrapping it in an object property."),c)}function oy(e){let t=nH(e),r=t?.method;if(!r)throw Error("Schema is missing a method literal");let a=nB(r);if("string"!=typeof a)throw Error("Schema method literal must be a string");return a}function ov(e,t){let r=nF(e,t);if(!r.success)throw r.error;return r.data}class o_{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(aR,e=>{this._oncancel(e)}),this.setNotificationHandler(aQ,e=>{this._onprogress(e)}),this.setRequestHandler(aW,e=>({})),this._taskStore=e?.taskStore,this._taskMessageQueue=e?.taskMessageQueue,this._taskStore&&(this.setRequestHandler(a3,async(e,t)=>{let r=await this._taskStore.getTask(e.params.taskId,t.sessionId);if(!r)throw new iT(oN.InvalidParams,"Failed to retrieve task: Task not found");return{...r}}),this.setRequestHandler(a7,async(e,t)=>{let r=async()=>{let a=e.params.taskId;if(this._taskMessageQueue){let e;for(;e=await this._taskMessageQueue.dequeue(a,t.sessionId);){if("response"===e.type||"error"===e.type){let t=e.message,r=t.id,a=this._requestResolvers.get(r);if(a)this._requestResolvers.delete(r),a("response"===e.type?t:new iT(t.error.code,t.error.message,t.error.data));else{let t="response"===e.type?"Response":"Error";this._onerror(Error(`${t} handler missing for request ${r}`))}continue}await this._transport?.send(e.message,{relatedRequestId:t.requestId})}}let s=await this._taskStore.getTask(a,t.sessionId);if(!s)throw new iT(oN.InvalidParams,`Task not found: ${a}`);if(!nW(s.status))return await this._waitForTaskUpdate(a,t.signal),await r();if(nW(s.status)){let e=await this._taskStore.getTaskResult(a,t.sessionId);return this._clearTaskQueue(a),{...e,_meta:{...e._meta,[ap]:{taskId:a}}}}return await r()};return await r()}),this.setRequestHandler(se,async(e,t)=>{try{let{tasks:r,nextCursor:a}=await this._taskStore.listTasks(e.params?.cursor,t.sessionId);return{tasks:r,nextCursor:a,_meta:{}}}catch(e){throw new iT(oN.InvalidParams,`Failed to list tasks: ${e instanceof Error?e.message:String(e)}`)}}),this.setRequestHandler(sr,async(e,t)=>{try{let r=await this._taskStore.getTask(e.params.taskId,t.sessionId);if(!r)throw new iT(oN.InvalidParams,`Task not found: ${e.params.taskId}`);if(nW(r.status))throw new iT(oN.InvalidParams,`Cannot cancel task in terminal status: ${r.status}`);await this._taskStore.updateTaskStatus(e.params.taskId,"cancelled","Client cancelled task execution.",t.sessionId),this._clearTaskQueue(e.params.taskId);let a=await this._taskStore.getTask(e.params.taskId,t.sessionId);if(!a)throw new iT(oN.InvalidParams,`Task not found after cancellation: ${e.params.taskId}`);return{_meta:{},...a}}catch(e){if(e instanceof iT)throw e;throw new iT(oN.InvalidRequest,`Failed to cancel task: ${e instanceof Error?e.message:String(e)}`)}}))}async _oncancel(e){if(!e.params.requestId)return;let t=this._requestHandlerAbortControllers.get(e.params.requestId);t?.abort(e.params.reason)}_setupTimeout(e,t,r,a,s=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(a,t),startTime:Date.now(),timeout:t,maxTotalTimeout:r,resetTimeoutOnProgress:s,onTimeout:a})}_resetTimeout(e){let t=this._timeoutInfo.get(e);if(!t)return!1;let r=Date.now()-t.startTime;if(t.maxTotalTimeout&&r>=t.maxTotalTimeout)throw this._timeoutInfo.delete(e),iT.fromError(oN.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:t.maxTotalTimeout,totalElapsed:r});return clearTimeout(t.timeoutId),t.timeoutId=setTimeout(t.onTimeout,t.timeout),!0}_cleanupTimeout(e){let t=this._timeoutInfo.get(e);t&&(clearTimeout(t.timeoutId),this._timeoutInfo.delete(e))}async connect(e){this._transport=e;let t=this.transport?.onclose;this._transport.onclose=()=>{t?.(),this._onclose()};let r=this.transport?.onerror;this._transport.onerror=e=>{r?.(e),this._onerror(e)};let a=this._transport?.onmessage;this._transport.onmessage=(e,t)=>{(a?.(e,t),aj.safeParse(e).success||aO.safeParse(e).success)?this._onresponse(e):aE(e)?this._onrequest(e,t):aP.safeParse(e).success?this._onnotification(e):this._onerror(Error(`Unknown message type: ${JSON.stringify(e)}`))},await this._transport.start()}_onclose(){let e=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();let t=iT.fromError(oN.ConnectionClosed,"Connection closed");for(let r of(this._transport=void 0,this.onclose?.(),e.values()))r(t)}_onerror(e){this.onerror?.(e)}_onnotification(e){let t=this._notificationHandlers.get(e.method)??this.fallbackNotificationHandler;void 0!==t&&Promise.resolve().then(()=>t(e)).catch(e=>this._onerror(Error(`Uncaught error in notification handler: ${e}`)))}_onrequest(e,t){let r,a=this._requestHandlers.get(e.method)??this.fallbackRequestHandler,s=this._transport,i=e.params?._meta?.[ap]?.taskId;if(void 0===a){let t={jsonrpc:"2.0",id:e.id,error:{code:oN.MethodNotFound,message:"Method not found"}};i&&this._taskMessageQueue?this._enqueueTaskMessage(i,{type:"error",message:t,timestamp:Date.now()},s?.sessionId).catch(e=>this._onerror(Error(`Failed to enqueue error response: ${e}`))):s?.send(t).catch(e=>this._onerror(Error(`Failed to send an error response: ${e}`)));return}let n=new AbortController;this._requestHandlerAbortControllers.set(e.id,n);let o=(r=e.params,ab.safeParse(r).success)?e.params.task:void 0,l=this._taskStore?this.requestTaskStore(e,s?.sessionId):void 0,d={signal:n.signal,sessionId:s?.sessionId,_meta:e.params?._meta,sendNotification:async t=>{let r={relatedRequestId:e.id};i&&(r.relatedTask={taskId:i}),await this.notification(t,r)},sendRequest:async(t,r,a)=>{let s={...a,relatedRequestId:e.id};i&&!s.relatedTask&&(s.relatedTask={taskId:i});let n=s.relatedTask?.taskId??i;return n&&l&&await l.updateTaskStatus(n,"input_required"),await this.request(t,r,s)},authInfo:t?.authInfo,requestId:e.id,requestInfo:t?.requestInfo,taskId:i,taskStore:l,taskRequestedTtl:o?.ttl,closeSSEStream:t?.closeSSEStream,closeStandaloneSSEStream:t?.closeStandaloneSSEStream};Promise.resolve().then(()=>{o&&this.assertTaskHandlerCapability(e.method)}).then(()=>a(e,d)).then(async t=>{if(n.signal.aborted)return;let r={result:t,jsonrpc:"2.0",id:e.id};i&&this._taskMessageQueue?await this._enqueueTaskMessage(i,{type:"response",message:r,timestamp:Date.now()},s?.sessionId):await s?.send(r)},async t=>{if(n.signal.aborted)return;let r={jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(t.code)?t.code:oN.InternalError,message:t.message??"Internal error",...void 0!==t.data&&{data:t.data}}};i&&this._taskMessageQueue?await this._enqueueTaskMessage(i,{type:"error",message:r,timestamp:Date.now()},s?.sessionId):await s?.send(r)}).catch(e=>this._onerror(Error(`Failed to send response: ${e}`))).finally(()=>{this._requestHandlerAbortControllers.delete(e.id)})}_onprogress(e){let{progressToken:t,...r}=e.params,a=Number(t),s=this._progressHandlers.get(a);if(!s)return void this._onerror(Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));let i=this._responseHandlers.get(a),n=this._timeoutInfo.get(a);if(n&&i&&n.resetTimeoutOnProgress)try{this._resetTimeout(a)}catch(e){this._responseHandlers.delete(a),this._progressHandlers.delete(a),this._cleanupTimeout(a),i(e);return}s(r)}_onresponse(e){let t=Number(e.id),r=this._requestResolvers.get(t);if(r){this._requestResolvers.delete(t),r(aj.safeParse(e).success?e:new iT(e.error.code,e.error.message,e.error.data));return}let a=this._responseHandlers.get(t);if(void 0===a)return void this._onerror(Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));this._responseHandlers.delete(t),this._cleanupTimeout(t);let s=!1;if(aj.safeParse(e).success&&e.result&&"object"==typeof e.result){let r=e.result;if(r.task&&"object"==typeof r.task){let e=r.task;"string"==typeof e.taskId&&(s=!0,this._taskProgressTokens.set(e.taskId,t))}}s||this._progressHandlers.delete(t),a(aj.safeParse(e).success?e:iT.fromError(e.error.code,e.error.message,e.error.data))}get transport(){return this._transport}async close(){await this._transport?.close()}async *requestStream(e,t,r){let a,{task:s}=r??{};if(!s){try{let a=await this.request(e,t,r);yield{type:"result",result:a}}catch(e){yield{type:"error",error:e instanceof iT?e:new iT(oN.InternalError,String(e))}}return}try{let s=await this.request(e,a4,r);if(s.task)a=s.task.taskId,yield{type:"taskCreated",task:s.task};else throw new iT(oN.InternalError,"Task creation did not return a task");for(;;){let e=await this.getTask({taskId:a},r);if(yield{type:"taskStatus",task:e},nW(e.status)){if("completed"===e.status){let e=await this.getTaskResult({taskId:a},t,r);yield{type:"result",result:e}}else"failed"===e.status?yield{type:"error",error:new iT(oN.InternalError,`Task ${a} failed`)}:"cancelled"===e.status&&(yield{type:"error",error:new iT(oN.InternalError,`Task ${a} was cancelled`)});return}if("input_required"===e.status){let e=await this.getTaskResult({taskId:a},t,r);yield{type:"result",result:e};return}let s=e.pollInterval??this._options?.defaultTaskPollInterval??1e3;await new Promise(e=>setTimeout(e,s)),r?.signal?.throwIfAborted()}}catch(e){yield{type:"error",error:e instanceof iT?e:new iT(oN.InternalError,String(e))}}}request(e,t,r){let{relatedRequestId:a,resumptionToken:s,onresumptiontoken:i,task:n,relatedTask:o}=r??{};return new Promise((l,d)=>{let u=e=>{d(e)};if(!this._transport)return void u(Error("Not connected"));if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(e.method),n&&this.assertTaskCapability(e.method)}catch(e){u(e);return}r?.signal?.throwIfAborted();let c=this._requestMessageId++,p={...e,jsonrpc:"2.0",id:c};r?.onprogress&&(this._progressHandlers.set(c,r.onprogress),p.params={...e.params,_meta:{...e.params?._meta||{},progressToken:c}}),n&&(p.params={...p.params,task:n}),o&&(p.params={...p.params,_meta:{...p.params?._meta||{},[ap]:o}});let h=e=>{this._responseHandlers.delete(c),this._progressHandlers.delete(c),this._cleanupTimeout(c),this._transport?.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:c,reason:String(e)}},{relatedRequestId:a,resumptionToken:s,onresumptiontoken:i}).catch(e=>this._onerror(Error(`Failed to send cancellation: ${e}`))),d(e instanceof iT?e:new iT(oN.RequestTimeout,String(e)))};this._responseHandlers.set(c,e=>{if(!r?.signal?.aborted){if(e instanceof Error)return d(e);try{let r=nF(t,e.result);r.success?l(r.data):d(r.error)}catch(e){d(e)}}}),r?.signal?.addEventListener("abort",()=>{h(r?.signal?.reason)});let m=r?.timeout??6e4;this._setupTimeout(c,m,r?.maxTotalTimeout,()=>h(iT.fromError(oN.RequestTimeout,"Request timed out",{timeout:m})),r?.resetTimeoutOnProgress??!1);let f=o?.taskId;if(f){let e=e=>{let t=this._responseHandlers.get(c);t?t(e):this._onerror(Error(`Response handler missing for side-channeled request ${c}`))};this._requestResolvers.set(c,e),this._enqueueTaskMessage(f,{type:"request",message:p,timestamp:Date.now()}).catch(e=>{this._cleanupTimeout(c),d(e)})}else this._transport.send(p,{relatedRequestId:a,resumptionToken:s,onresumptiontoken:i}).catch(e=>{this._cleanupTimeout(c),d(e)})})}async getTask(e,t){return this.request({method:"tasks/get",params:e},a8,t)}async getTaskResult(e,t,r){return this.request({method:"tasks/result",params:e},t,r)}async listTasks(e,t){return this.request({method:"tasks/list",params:e},st,t)}async cancelTask(e,t){return this.request({method:"tasks/cancel",params:e},sa,t)}async notification(e,t){if(!this._transport)throw Error("Not connected");this.assertNotificationCapability(e.method);let r=t?.relatedTask?.taskId;if(r){let a={...e,jsonrpc:"2.0",params:{...e.params,_meta:{...e.params?._meta||{},[ap]:t.relatedTask}}};await this._enqueueTaskMessage(r,{type:"notification",message:a,timestamp:Date.now()});return}if((this._options?.debouncedNotificationMethods??[]).includes(e.method)&&!e.params&&!t?.relatedRequestId&&!t?.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 r={...e,jsonrpc:"2.0"};t?.relatedTask&&(r={...r,params:{...r.params,_meta:{...r.params?._meta||{},[ap]:t.relatedTask}}}),this._transport?.send(r,t).catch(e=>this._onerror(e))});return}let a={...e,jsonrpc:"2.0"};t?.relatedTask&&(a={...a,params:{...a.params,_meta:{...a.params?._meta||{},[ap]:t.relatedTask}}}),await this._transport.send(a,t)}setRequestHandler(e,t){let r=oy(e);this.assertRequestHandlerCapability(r),this._requestHandlers.set(r,(r,a)=>Promise.resolve(t(ov(e,r),a)))}removeRequestHandler(e){this._requestHandlers.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,t){let r=oy(e);this._notificationHandlers.set(r,r=>Promise.resolve(t(ov(e,r))))}removeNotificationHandler(e){this._notificationHandlers.delete(e)}_cleanupTaskProgressHandler(e){let t=this._taskProgressTokens.get(e);void 0!==t&&(this._progressHandlers.delete(t),this._taskProgressTokens.delete(e))}async _enqueueTaskMessage(e,t,r){if(!this._taskStore||!this._taskMessageQueue)throw Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");let a=this._options?.maxTaskQueueSize;await this._taskMessageQueue.enqueue(e,t,r,a)}async _clearTaskQueue(e,t){if(this._taskMessageQueue){for(let r of(await this._taskMessageQueue.dequeueAll(e,t)))if("request"===r.type&&aE(r.message)){let t=r.message.id,a=this._requestResolvers.get(t);a?(a(new iT(oN.InternalError,"Task cancelled or completed")),this._requestResolvers.delete(t)):this._onerror(Error(`Resolver missing for request ${t} during task ${e} cleanup`))}}}async _waitForTaskUpdate(e,t){let r=this._options?.defaultTaskPollInterval??1e3;try{let t=await this._taskStore?.getTask(e);t?.pollInterval&&(r=t.pollInterval)}catch{}return new Promise((e,a)=>{if(t.aborted)return void a(new iT(oN.InvalidRequest,"Request cancelled"));let s=setTimeout(e,r);t.addEventListener("abort",()=>{clearTimeout(s),a(new iT(oN.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore(e,t){let r=this._taskStore;if(!r)throw Error("No task store configured");return{createTask:async a=>{if(!e)throw Error("No request provided");return await r.createTask(a,e.id,{method:e.method,params:e.params},t)},getTask:async e=>{let a=await r.getTask(e,t);if(!a)throw new iT(oN.InvalidParams,"Failed to retrieve task: Task not found");return a},storeTaskResult:async(e,a,s)=>{await r.storeTaskResult(e,a,s,t);let i=await r.getTask(e,t);if(i){let t=a6.parse({method:"notifications/tasks/status",params:i});await this.notification(t),nW(i.status)&&this._cleanupTaskProgressHandler(e)}},getTaskResult:e=>r.getTaskResult(e,t),updateTaskStatus:async(e,a,s)=>{let i=await r.getTask(e,t);if(!i)throw new iT(oN.InvalidParams,`Task "${e}" not found - it may have been cleaned up`);if(nW(i.status))throw new iT(oN.InvalidParams,`Cannot update task "${e}" from terminal status "${i.status}" to "${a}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await r.updateTaskStatus(e,a,s,t);let n=await r.getTask(e,t);if(n){let t=a6.parse({method:"notifications/tasks/status",params:n});await this.notification(t),nW(n.status)&&this._cleanupTaskProgressHandler(e)}},listTasks:e=>r.listTasks(e,t)}}}function ob(e){return null!==e&&"object"==typeof e&&!Array.isArray(e)}var ow,o$,ok,ox,oS,oT,oE,oP,oj,oO,oI,oN,oz,oR,oC,oA,oM,oZ=i(4319),oD=i(494);class oq{constructor(e){this._ajv=e??function(){let e=new oZ({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return oD(e),e}()}getValidator(e){let t="$id"in e&&"string"==typeof e.$id?this._ajv.getSchema(e.$id)??this._ajv.compile(e):this._ajv.compile(e);return e=>t(e)?{valid:!0,data:e,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:this._ajv.errorsText(t.errors)}}}class oV{constructor(e){this._server=e}requestStream(e,t,r){return this._server.requestStream(e,t,r)}async getTask(e,t){return this._server.getTask({taskId:e},t)}async getTaskResult(e,t,r){return this._server.getTaskResult({taskId:e},t,r)}async listTasks(e,t){return this._server.listTasks(e?{cursor:e}:void 0,t)}async cancelTask(e,t){return this._server.cancelTask({taskId:e},t)}}class oL extends o_{constructor(e,t){super(t),this._serverInfo=e,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(sB.options.map((e,t)=>[e,t])),this.isMessageIgnored=(e,t)=>{let r=this._loggingLevels.get(t);return!!r&&this.LOG_LEVEL_SEVERITY.get(e)<this.LOG_LEVEL_SEVERITY.get(r)},this._capabilities=t?.capabilities??{},this._instructions=t?.instructions,this._jsonSchemaValidator=t?.jsonSchemaValidator??new oq,this.setRequestHandler(aH,e=>this._oninitialize(e)),this.setNotificationHandler(aB,()=>this.oninitialized?.()),this._capabilities.logging&&this.setRequestHandler(sG,async(e,t)=>{let r=t.sessionId||t.requestInfo?.headers["mcp-session-id"]||void 0,{level:a}=e.params,s=sB.safeParse(a);return s.success&&this._loggingLevels.set(r,s.data),{}})}get experimental(){return this._experimental||(this._experimental={tasks:new oV(this)}),this._experimental}registerCapabilities(e){if(this.transport)throw Error("Cannot register capabilities after connecting to transport");this._capabilities=function(e,t){let r={...e};for(let e in t){let a=t[e];if(void 0===a)continue;let s=r[e];ob(s)&&ob(a)?r[e]={...s,...a}:r[e]=a}return r}(this._capabilities,e)}setRequestHandler(e,t){let r,a=nH(e),s=a?.method;if(!s)throw Error("Schema is missing a method literal");if(nV(s)){let e=s._zod?.def;r=e?.value??s.value}else{let e=s._def;r=e?.value??s.value}if("string"!=typeof r)throw Error("Schema method literal must be a string");if("tools/call"===r){let r=async(e,r)=>{let a=nF(sK,e);if(!a.success){let e=a.error instanceof Error?a.error.message:String(a.error);throw new iT(oN.InvalidParams,`Invalid tools/call request: ${e}`)}let{params:s}=a.data,i=await Promise.resolve(t(e,r));if(s.task){let e=nF(a4,i);if(!e.success){let t=e.error instanceof Error?e.error.message:String(e.error);throw new iT(oN.InvalidParams,`Invalid task creation result: ${t}`)}return e.data}let n=nF(sU,i);if(!n.success){let e=n.error instanceof Error?n.error.message:String(n.error);throw new iT(oN.InvalidParams,`Invalid tools/call result: ${e}`)}return n.data};return super.setRequestHandler(e,r)}return super.setRequestHandler(e,t)}assertCapabilityForMethod(e){switch(e){case"sampling/createMessage":if(!this._clientCapabilities?.sampling)throw Error(`Client does not support sampling (required for ${e})`);break;case"elicitation/create":if(!this._clientCapabilities?.elicitation)throw Error(`Client does not support elicitation (required for ${e})`);break;case"roots/list":if(!this._clientCapabilities?.roots)throw Error(`Client does not support listing roots (required for ${e})`)}}assertNotificationCapability(e){switch(e){case"notifications/message":if(!this._capabilities.logging)throw Error(`Server does not support logging (required for ${e})`);break;case"notifications/resources/updated":case"notifications/resources/list_changed":if(!this._capabilities.resources)throw Error(`Server does not support notifying about resources (required for ${e})`);break;case"notifications/tools/list_changed":if(!this._capabilities.tools)throw Error(`Server does not support notifying of tool list changes (required for ${e})`);break;case"notifications/prompts/list_changed":if(!this._capabilities.prompts)throw Error(`Server does not support notifying of prompt list changes (required for ${e})`);break;case"notifications/elicitation/complete":if(!this._clientCapabilities?.elicitation?.url)throw Error(`Client does not support URL elicitation (required for ${e})`)}}assertRequestHandlerCapability(e){if(this._capabilities)switch(e){case"completion/complete":if(!this._capabilities.completions)throw Error(`Server does not support completions (required for ${e})`);break;case"logging/setLevel":if(!this._capabilities.logging)throw Error(`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!this._capabilities.prompts)throw Error(`Server does not support prompts (required for ${e})`);break;case"resources/list":case"resources/templates/list":case"resources/read":if(!this._capabilities.resources)throw Error(`Server does not support resources (required for ${e})`);break;case"tools/call":case"tools/list":if(!this._capabilities.tools)throw Error(`Server does not support tools (required for ${e})`);break;case"tasks/get":case"tasks/list":case"tasks/result":case"tasks/cancel":if(!this._capabilities.tasks)throw Error(`Server does not support tasks capability (required for ${e})`)}}assertTaskCapability(e){var t=this._clientCapabilities?.tasks?.requests,r="Client";if(!t)throw Error(`${r} does not support task creation (required for ${e})`);switch(e){case"sampling/createMessage":if(!t.sampling?.createMessage)throw Error(`${r} does not support task creation for sampling/createMessage (required for ${e})`);break;case"elicitation/create":if(!t.elicitation?.create)throw Error(`${r} does not support task creation for elicitation/create (required for ${e})`)}}assertTaskHandlerCapability(e){if(this._capabilities){var t=this._capabilities.tasks?.requests,r="Server";if(!t)throw Error(`${r} does not support task creation (required for ${e})`);if("tools/call"===e&&!t.tools?.call)throw Error(`${r} does not support task creation for tools/call (required for ${e})`)}}async _oninitialize(e){let t=e.params.protocolVersion;return this._clientCapabilities=e.params.capabilities,this._clientVersion=e.params.clientInfo,{protocolVersion:ac.includes(t)?t:au,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"},aN)}async createMessage(e,t){if((e.tools||e.toolChoice)&&!this._clientCapabilities?.sampling?.tools)throw Error("Client does not support sampling tools capability.");if(e.messages.length>0){let t=e.messages[e.messages.length-1],r=Array.isArray(t.content)?t.content:[t.content],a=r.some(e=>"tool_result"===e.type),s=e.messages.length>1?e.messages[e.messages.length-2]:void 0,i=s?Array.isArray(s.content)?s.content:[s.content]:[],n=i.some(e=>"tool_use"===e.type);if(a){if(r.some(e=>"tool_result"!==e.type))throw Error("The last message must contain only tool_result content if any is present");if(!n)throw Error("tool_result blocks are not matching any tool_use from the previous message")}if(n){let e=new Set(i.filter(e=>"tool_use"===e.type).map(e=>e.id)),t=new Set(r.filter(e=>"tool_result"===e.type).map(e=>e.toolUseId));if(e.size!==t.size||![...e].every(e=>t.has(e)))throw 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},s7,t):this.request({method:"sampling/createMessage",params:e},s8,t)}async elicitInput(e,t){switch(e.mode??"form"){case"url":if(!this._clientCapabilities?.elicitation?.url)throw Error("Client does not support url elicitation.");return this.request({method:"elicitation/create",params:e},ig,t);case"form":{if(!this._clientCapabilities?.elicitation?.form)throw Error("Client does not support form elicitation.");let r="form"===e.mode?e:{...e,mode:"form"},a=await this.request({method:"elicitation/create",params:r},ig,t);if("accept"===a.action&&a.content&&r.requestedSchema)try{let e=this._jsonSchemaValidator.getValidator(r.requestedSchema)(a.content);if(!e.valid)throw new iT(oN.InvalidParams,`Elicitation response content does not match requested schema: ${e.errorMessage}`)}catch(e){if(e instanceof iT)throw e;throw new iT(oN.InternalError,`Error validating elicitation response: ${e instanceof Error?e.message:String(e)}`)}return a}}}createElicitationCompletionNotifier(e,t){if(!this._clientCapabilities?.elicitation?.url)throw Error("Client does not support URL elicitation (required for notifications/elicitation/complete)");return()=>this.notification({method:"notifications/elicitation/complete",params:{elicitationId:e}},t)}async listRoots(e,t){return this.request({method:"roots/list",params:e},ix,t)}async sendLoggingMessage(e,t){if(this._capabilities.logging&&!this.isMessageIgnored(e.level,t))return this.notification({method:"notifications/message",params:e})}async sendResourceUpdated(e){return this.notification({method:"notifications/resources/updated",params:e})}async sendResourceListChanged(){return this.notification({method:"notifications/resources/list_changed"})}async sendToolListChanged(){return this.notification({method:"notifications/tools/list_changed"})}async sendPromptListChanged(){return this.notification({method:"notifications/prompts/list_changed"})}}let oF=Symbol.for("mcp.completable");function oU(e){return!!e&&"object"==typeof e&&oF in e}(oM||(oM={})).Completable="McpCompletable";class oH{static isTemplate(e){return/\{[^}\s]+\}/.test(e)}static validateLength(e,t,r){if(e.length>t)throw Error(`${r} exceeds maximum length of ${t} characters (got ${e.length})`)}get variableNames(){return this.parts.flatMap(e=>"string"==typeof e?[]:e.names)}constructor(e){oH.validateLength(e,1e6,"Template"),this.template=e,this.parts=this.parse(e)}toString(){return this.template}parse(e){let t=[],r="",a=0,s=0;for(;a<e.length;)if("{"===e[a]){r&&(t.push(r),r="");let i=e.indexOf("}",a);if(-1===i)throw Error("Unclosed template expression");if(++s>1e4)throw Error("Template contains too many expressions (max 10000)");let n=e.slice(a+1,i),o=this.getOperator(n),l=n.includes("*"),d=this.getNames(n),u=d[0];for(let e of d)oH.validateLength(e,1e6,"Variable name");t.push({name:u,operator:o,names:d,exploded:l}),a=i+1}else r+=e[a],a++;return r&&t.push(r),t}getOperator(e){return["+","#",".","/","?","&"].find(t=>e.startsWith(t))||""}getNames(e){let t=this.getOperator(e);return e.slice(t.length).split(",").map(e=>e.replace("*","").trim()).filter(e=>e.length>0)}encodeValue(e,t){return(oH.validateLength(e,1e6,"Variable value"),"+"===t||"#"===t)?encodeURI(e):encodeURIComponent(e)}expandPart(e,t){if("?"===e.operator||"&"===e.operator){let r=e.names.map(r=>{let a=t[r];if(void 0===a)return"";let s=Array.isArray(a)?a.map(t=>this.encodeValue(t,e.operator)).join(","):this.encodeValue(a.toString(),e.operator);return`${r}=${s}`}).filter(e=>e.length>0);return 0===r.length?"":("?"===e.operator?"?":"&")+r.join("&")}if(e.names.length>1){let r=e.names.map(e=>t[e]).filter(e=>void 0!==e);return 0===r.length?"":r.map(e=>Array.isArray(e)?e[0]:e).join(",")}let r=t[e.name];if(void 0===r)return"";let a=(Array.isArray(r)?r:[r]).map(t=>this.encodeValue(t,e.operator));switch(e.operator){case"":case"+":default:return a.join(",");case"#":return"#"+a.join(",");case".":return"."+a.join(".");case"/":return"/"+a.join("/")}}expand(e){let t="",r=!1;for(let a of this.parts){if("string"==typeof a){t+=a;continue}let s=this.expandPart(a,e);s&&(("?"===a.operator||"&"===a.operator)&&r?t+=s.replace("?","&"):t+=s,("?"===a.operator||"&"===a.operator)&&(r=!0))}return t}escapeRegExp(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}partToRegExp(e){let t,r=[];for(let t of e.names)oH.validateLength(t,1e6,"Variable name");if("?"===e.operator||"&"===e.operator){for(let t=0;t<e.names.length;t++){let a=e.names[t],s=0===t?"\\"+e.operator:"&";r.push({pattern:s+this.escapeRegExp(a)+"=([^&]+)",name:a})}return r}let a=e.name;switch(e.operator){case"":t=e.exploded?"([^/,]+(?:,[^/,]+)*)":"([^/,]+)";break;case"+":case"#":t="(.+)";break;case".":t="\\.([^/,]+)";break;case"/":t="/"+(e.exploded?"([^/,]+(?:,[^/,]+)*)":"([^/,]+)");break;default:t="([^/]+)"}return r.push({pattern:t,name:a}),r}match(e){oH.validateLength(e,1e6,"URI");let t="^",r=[];for(let e of this.parts)if("string"==typeof e)t+=this.escapeRegExp(e);else for(let{pattern:a,name:s}of this.partToRegExp(e))t+=a,r.push({name:s,exploded:e.exploded});t+="$",oH.validateLength(t,1e6,"Generated regex pattern");let a=new RegExp(t),s=e.match(a);if(!s)return null;let i={};for(let e=0;e<r.length;e++){let{name:t,exploded:a}=r[e],n=s[e+1],o=t.replace("*","");a&&n.includes(",")?i[o]=n.split(","):i[o]=n}return i}}let oK=/^[A-Za-z0-9._-]{1,128}$/;function oJ(e){let t=function(e){let t=[];if(0===e.length)return{isValid:!1,warnings:["Tool name cannot be empty"]};if(e.length>128)return{isValid:!1,warnings:[`Tool name exceeds maximum length of 128 characters (current: ${e.length})`]};if(e.includes(" ")&&t.push("Tool name contains spaces, which may cause parsing issues"),e.includes(",")&&t.push("Tool name contains commas, which may cause parsing issues"),(e.startsWith("-")||e.endsWith("-"))&&t.push("Tool name starts or ends with a dash, which may cause parsing issues in some contexts"),(e.startsWith(".")||e.endsWith("."))&&t.push("Tool name starts or ends with a dot, which may cause parsing issues in some contexts"),!oK.test(e)){let r=e.split("").filter(e=>!/[A-Za-z0-9._-]/.test(e)).filter((e,t,r)=>r.indexOf(e)===t);return t.push(`Tool name contains invalid characters: ${r.map(e=>`"${e}"`).join(", ")}`,"Allowed characters are: A-Z, a-z, 0-9, underscore (_), dash (-), and dot (.)"),{isValid:!1,warnings:t}}return{isValid:!0,warnings:t}}(e);var r=t.warnings;if(r.length>0){for(let t of(console.warn(`Tool name validation warning for "${e}":`),r))console.warn(` - ${t}`);console.warn("Tool registration will proceed, but this may cause compatibility issues."),console.warn("Consider updating the tool name to conform to the MCP tool naming standard."),console.warn("See SEP: Specify Format for Tool Names (https://github.com/modelcontextprotocol/modelcontextprotocol/issues/986) for more details.")}return t.isValid}class oB{constructor(e){this._mcpServer=e}registerToolTask(e,t,r){let a={taskSupport:"required",...t.execution};if("forbidden"===a.taskSupport)throw Error(`Cannot register task-based tool '${e}' with taskSupport 'forbidden'. Use registerTool() instead.`);return this._mcpServer._createRegisteredTool(e,t.title,t.description,t.inputSchema,t.outputSchema,t.annotations,a,t._meta,r)}}class oW{constructor(e,t){this._registeredResources={},this._registeredResourceTemplates={},this._registeredTools={},this._registeredPrompts={},this._toolHandlersInitialized=!1,this._completionHandlerInitialized=!1,this._resourceHandlersInitialized=!1,this._promptHandlersInitialized=!1,this.server=new oL(e,t)}get experimental(){return this._experimental||(this._experimental={tasks:new oB(this)}),this._experimental}async connect(e){return await this.server.connect(e)}async close(){await this.server.close()}setToolRequestHandlers(){this._toolHandlersInitialized||(this.server.assertCanSetRequestHandler(o1(sL)),this.server.assertCanSetRequestHandler(o1(sK)),this.server.registerCapabilities({tools:{listChanged:!0}}),this.server.setRequestHandler(sL,()=>({tools:Object.entries(this._registeredTools).filter(([,e])=>e.enabled).map(([e,t])=>{let r,a={name:e,title:t.title,description:t.description,inputSchema:(r=nK(t.inputSchema))?og(r,{strictUnions:!0,pipeStrategy:"input"}):oY,annotations:t.annotations,execution:t.execution,_meta:t._meta};if(t.outputSchema){let e=nK(t.outputSchema);e&&(a.outputSchema=og(e,{strictUnions:!0,pipeStrategy:"output"}))}return a})})),this.server.setRequestHandler(sK,async(e,t)=>{try{let r=this._registeredTools[e.params.name];if(!r)throw new iT(oN.InvalidParams,`Tool ${e.params.name} not found`);if(!r.enabled)throw new iT(oN.InvalidParams,`Tool ${e.params.name} disabled`);let a=!!e.params.task,s=r.execution?.taskSupport,i="createTask"in r.handler;if(("required"===s||"optional"===s)&&!i)throw new iT(oN.InternalError,`Tool ${e.params.name} has taskSupport '${s}' but was not registered with registerToolTask`);if("required"===s&&!a)throw new iT(oN.MethodNotFound,`Tool ${e.params.name} requires task augmentation (taskSupport: 'required')`);if("optional"===s&&!a&&i)return await this.handleAutomaticTaskPolling(r,e,t);let n=await this.validateToolInput(r,e.params.arguments,e.params.name),o=await this.executeToolHandler(r,n,t);if(a)return o;return await this.validateToolOutput(r,o,e.params.name),o}catch(e){if(e instanceof iT&&e.code===oN.UrlElicitationRequired)throw e;return this.createToolError(e instanceof Error?e.message:String(e))}}),this._toolHandlersInitialized=!0)}createToolError(e){return{content:[{type:"text",text:e}],isError:!0}}async validateToolInput(e,t,r){if(!e.inputSchema)return;let a=nK(e.inputSchema)??e.inputSchema,s=await nU(a,t);if(!s.success){let e=nJ("error"in s?s.error:"Unknown error");throw new iT(oN.InvalidParams,`Input validation error: Invalid arguments for tool ${r}: ${e}`)}return s.data}async validateToolOutput(e,t,r){if(!e.outputSchema||!("content"in t)||t.isError)return;if(!t.structuredContent)throw new iT(oN.InvalidParams,`Output validation error: Tool ${r} has an output schema but no structured content was provided`);let a=nK(e.outputSchema),s=await nU(a,t.structuredContent);if(!s.success){let e=nJ("error"in s?s.error:"Unknown error");throw new iT(oN.InvalidParams,`Output validation error: Invalid structured content for tool ${r}: ${e}`)}}async executeToolHandler(e,t,r){let a=e.handler;if("createTask"in a){if(!r.taskStore)throw Error("No task store provided.");let s={...r,taskStore:r.taskStore};return e.inputSchema?await Promise.resolve(a.createTask(t,s)):await Promise.resolve(a.createTask(s))}return e.inputSchema?await Promise.resolve(a(t,r)):await Promise.resolve(a(r))}async handleAutomaticTaskPolling(e,t,r){if(!r.taskStore)throw Error("No task store provided for task-capable tool.");let a=await this.validateToolInput(e,t.params.arguments,t.params.name),s=e.handler,i={...r,taskStore:r.taskStore},n=a?await Promise.resolve(s.createTask(a,i)):await Promise.resolve(s.createTask(i)),o=n.task.taskId,l=n.task,d=l.pollInterval??5e3;for(;"completed"!==l.status&&"failed"!==l.status&&"cancelled"!==l.status;){await new Promise(e=>setTimeout(e,d));let e=await r.taskStore.getTask(o);if(!e)throw new iT(oN.InternalError,`Task ${o} not found during polling`);l=e}return await r.taskStore.getTaskResult(o)}setCompletionRequestHandler(){this._completionHandlerInitialized||(this.server.assertCanSetRequestHandler(o1(ib)),this.server.registerCapabilities({completions:{}}),this.server.setRequestHandler(ib,async e=>{switch(e.params.ref.type){case"ref/prompt":if("ref/prompt"!==e.params.ref.type)throw TypeError(`Expected CompleteRequestPrompt, but got ${e.params.ref.type}`);return this.handlePromptCompletion(e,e.params.ref);case"ref/resource":if("ref/resource"!==e.params.ref.type)throw TypeError(`Expected CompleteRequestResourceTemplate, but got ${e.params.ref.type}`);return this.handleResourceCompletion(e,e.params.ref);default:throw new iT(oN.InvalidParams,`Invalid completion reference: ${e.params.ref}`)}}),this._completionHandlerInitialized=!0)}async handlePromptCompletion(e,t){let r,a=this._registeredPrompts[t.name];if(!a)throw new iT(oN.InvalidParams,`Prompt ${t.name} not found`);if(!a.enabled)throw new iT(oN.InvalidParams,`Prompt ${t.name} disabled`);if(!a.argsSchema)return o2;let s=nH(a.argsSchema),i=s?.[e.params.argument.name];if(!oU(i))return o2;let n=(r=i[oF],r?.complete);return n?o9(await n(e.params.argument.value,e.params.context)):o2}async handleResourceCompletion(e,t){let r=Object.values(this._registeredResourceTemplates).find(e=>e.resourceTemplate.uriTemplate.toString()===t.uri);if(!r){if(this._registeredResources[t.uri])return o2;throw new iT(oN.InvalidParams,`Resource template ${e.params.ref.uri} not found`)}let a=r.resourceTemplate.completeCallback(e.params.argument.name);return a?o9(await a(e.params.argument.value,e.params.context)):o2}setResourceRequestHandlers(){this._resourceHandlersInitialized||(this.server.assertCanSetRequestHandler(o1(sp)),this.server.assertCanSetRequestHandler(o1(sm)),this.server.assertCanSetRequestHandler(o1(sy)),this.server.registerCapabilities({resources:{listChanged:!0}}),this.server.setRequestHandler(sp,async(e,t)=>{let r=Object.entries(this._registeredResources).filter(([e,t])=>t.enabled).map(([e,t])=>({uri:e,name:t.name,...t.metadata})),a=[];for(let e of Object.values(this._registeredResourceTemplates))if(e.resourceTemplate.listCallback)for(let r of(await e.resourceTemplate.listCallback(t)).resources)a.push({...e.metadata,...r});return{resources:[...r,...a]}}),this.server.setRequestHandler(sm,async()=>({resourceTemplates:Object.entries(this._registeredResourceTemplates).map(([e,t])=>({name:e,uriTemplate:t.resourceTemplate.uriTemplate.toString(),...t.metadata}))})),this.server.setRequestHandler(sy,async(e,t)=>{let r=new URL(e.params.uri),a=this._registeredResources[r.toString()];if(a){if(!a.enabled)throw new iT(oN.InvalidParams,`Resource ${r} disabled`);return a.readCallback(r,t)}for(let e of Object.values(this._registeredResourceTemplates)){let a=e.resourceTemplate.uriTemplate.match(r.toString());if(a)return e.readCallback(r,a,t)}throw new iT(oN.InvalidParams,`Resource ${r} not found`)}),this._resourceHandlersInitialized=!0)}setPromptRequestHandlers(){this._promptHandlersInitialized||(this.server.assertCanSetRequestHandler(o1(sT)),this.server.assertCanSetRequestHandler(o1(sj)),this.server.registerCapabilities({prompts:{listChanged:!0}}),this.server.setRequestHandler(sT,()=>({prompts:Object.entries(this._registeredPrompts).filter(([,e])=>e.enabled).map(([e,t])=>{let r;return{name:e,title:t.title,description:t.description,arguments:t.argsSchema?(r=nH(t.argsSchema))?Object.entries(r).map(([e,t])=>({name:e,description:t.description,required:!(nV(t)?t._zod?.def?.type==="optional":"function"==typeof t.isOptional?t.isOptional():t._def?.typeName==="ZodOptional")})):[]:void 0}})})),this.server.setRequestHandler(sj,async(e,t)=>{let r=this._registeredPrompts[e.params.name];if(!r)throw new iT(oN.InvalidParams,`Prompt ${e.params.name} not found`);if(!r.enabled)throw new iT(oN.InvalidParams,`Prompt ${e.params.name} disabled`);if(r.argsSchema){let a=nK(r.argsSchema),s=await nU(a,e.params.arguments);if(!s.success){let t=nJ("error"in s?s.error:"Unknown error");throw new iT(oN.InvalidParams,`Invalid arguments for prompt ${e.params.name}: ${t}`)}let i=s.data,n=r.callback;return await Promise.resolve(n(i,t))}{let e=r.callback;return await Promise.resolve(e(t))}}),this._promptHandlersInitialized=!0)}resource(e,t,...r){let a;"object"==typeof r[0]&&(a=r.shift());let s=r[0];if("string"==typeof t){if(this._registeredResources[t])throw Error(`Resource ${t} is already registered`);let r=this._createRegisteredResource(e,void 0,t,a,s);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),r}{if(this._registeredResourceTemplates[e])throw Error(`Resource template ${e} is already registered`);let r=this._createRegisteredResourceTemplate(e,void 0,t,a,s);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),r}}registerResource(e,t,r,a){if("string"==typeof t){if(this._registeredResources[t])throw Error(`Resource ${t} is already registered`);let s=this._createRegisteredResource(e,r.title,t,r,a);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),s}{if(this._registeredResourceTemplates[e])throw Error(`Resource template ${e} is already registered`);let s=this._createRegisteredResourceTemplate(e,r.title,t,r,a);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),s}}_createRegisteredResource(e,t,r,a,s){let i={name:e,title:t,metadata:a,readCallback:s,enabled:!0,disable:()=>i.update({enabled:!1}),enable:()=>i.update({enabled:!0}),remove:()=>i.update({uri:null}),update:e=>{void 0!==e.uri&&e.uri!==r&&(delete this._registeredResources[r],e.uri&&(this._registeredResources[e.uri]=i)),void 0!==e.name&&(i.name=e.name),void 0!==e.title&&(i.title=e.title),void 0!==e.metadata&&(i.metadata=e.metadata),void 0!==e.callback&&(i.readCallback=e.callback),void 0!==e.enabled&&(i.enabled=e.enabled),this.sendResourceListChanged()}};return this._registeredResources[r]=i,i}_createRegisteredResourceTemplate(e,t,r,a,s){let i={resourceTemplate:r,title:t,metadata:a,readCallback:s,enabled:!0,disable:()=>i.update({enabled:!1}),enable:()=>i.update({enabled:!0}),remove:()=>i.update({name:null}),update:t=>{void 0!==t.name&&t.name!==e&&(delete this._registeredResourceTemplates[e],t.name&&(this._registeredResourceTemplates[t.name]=i)),void 0!==t.title&&(i.title=t.title),void 0!==t.template&&(i.resourceTemplate=t.template),void 0!==t.metadata&&(i.metadata=t.metadata),void 0!==t.callback&&(i.readCallback=t.callback),void 0!==t.enabled&&(i.enabled=t.enabled),this.sendResourceListChanged()}};this._registeredResourceTemplates[e]=i;let n=r.uriTemplate.variableNames;return Array.isArray(n)&&n.some(e=>!!r.completeCallback(e))&&this.setCompletionRequestHandler(),i}_createRegisteredPrompt(e,t,r,a,s){let i={title:t,description:r,argsSchema:void 0===a?void 0:nL(a),callback:s,enabled:!0,disable:()=>i.update({enabled:!1}),enable:()=>i.update({enabled:!0}),remove:()=>i.update({name:null}),update:t=>{void 0!==t.name&&t.name!==e&&(delete this._registeredPrompts[e],t.name&&(this._registeredPrompts[t.name]=i)),void 0!==t.title&&(i.title=t.title),void 0!==t.description&&(i.description=t.description),void 0!==t.argsSchema&&(i.argsSchema=nL(t.argsSchema)),void 0!==t.callback&&(i.callback=t.callback),void 0!==t.enabled&&(i.enabled=t.enabled),this.sendPromptListChanged()}};return this._registeredPrompts[e]=i,a&&Object.values(a).some(e=>oU(e instanceof r8?e._def?.innerType:e))&&this.setCompletionRequestHandler(),i}_createRegisteredTool(e,t,r,a,s,i,n,o,l){oJ(e);let d={title:t,description:r,inputSchema:o0(a),outputSchema:o0(s),annotations:i,execution:n,_meta:o,handler:l,enabled:!0,disable:()=>d.update({enabled:!1}),enable:()=>d.update({enabled:!0}),remove:()=>d.update({name:null}),update:t=>{void 0!==t.name&&t.name!==e&&("string"==typeof t.name&&oJ(t.name),delete this._registeredTools[e],t.name&&(this._registeredTools[t.name]=d)),void 0!==t.title&&(d.title=t.title),void 0!==t.description&&(d.description=t.description),void 0!==t.paramsSchema&&(d.inputSchema=nL(t.paramsSchema)),void 0!==t.outputSchema&&(d.outputSchema=nL(t.outputSchema)),void 0!==t.callback&&(d.handler=t.callback),void 0!==t.annotations&&(d.annotations=t.annotations),void 0!==t._meta&&(d._meta=t._meta),void 0!==t.enabled&&(d.enabled=t.enabled),this.sendToolListChanged()}};return this._registeredTools[e]=d,this.setToolRequestHandlers(),this.sendToolListChanged(),d}tool(e,...t){let r,a,s,i;if(this._registeredTools[e])throw Error(`Tool ${e} is already registered`);if("string"==typeof t[0]&&(r=t.shift()),t.length>1){let e=t[0];oX(e)?(a=t.shift(),t.length>1&&"object"==typeof t[0]&&null!==t[0]&&!oX(t[0])&&(i=t.shift())):"object"==typeof e&&null!==e&&(i=t.shift())}let n=t[0];return this._createRegisteredTool(e,void 0,r,a,s,i,{taskSupport:"forbidden"},void 0,n)}registerTool(e,t,r){if(this._registeredTools[e])throw Error(`Tool ${e} is already registered`);let{title:a,description:s,inputSchema:i,outputSchema:n,annotations:o,_meta:l}=t;return this._createRegisteredTool(e,a,s,i,n,o,{taskSupport:"forbidden"},l,r)}prompt(e,...t){let r,a;if(this._registeredPrompts[e])throw Error(`Prompt ${e} is already registered`);"string"==typeof t[0]&&(r=t.shift()),t.length>1&&(a=t.shift());let s=t[0],i=this._createRegisteredPrompt(e,void 0,r,a,s);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),i}registerPrompt(e,t,r){if(this._registeredPrompts[e])throw Error(`Prompt ${e} is already registered`);let{title:a,description:s,argsSchema:i}=t,n=this._createRegisteredPrompt(e,a,s,i,r);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),n}isConnected(){return void 0!==this.server.transport}async sendLoggingMessage(e,t){return this.server.sendLoggingMessage(e,t)}sendResourceListChanged(){this.isConnected()&&this.server.sendResourceListChanged()}sendToolListChanged(){this.isConnected()&&this.server.sendToolListChanged()}sendPromptListChanged(){this.isConnected()&&this.server.sendPromptListChanged()}}class oG{constructor(e,t){this._callbacks=t,this._uriTemplate="string"==typeof e?new oH(e):e}get uriTemplate(){return this._uriTemplate}get listCallback(){return this._callbacks.list}completeCallback(e){return this._callbacks.complete?.[e]}}let oY={type:"object",properties:{}};function oQ(e){return null!==e&&"object"==typeof e&&"parse"in e&&"function"==typeof e.parse&&"safeParse"in e&&"function"==typeof e.safeParse}function oX(e){return"object"==typeof e&&null!==e&&!("_def"in e||"_zod"in e||oQ(e))&&(0===Object.keys(e).length||Object.values(e).some(oQ))}function o0(e){if(e)return oX(e)?nL(e):e}function o1(e){let t=nH(e),r=t?.method;if(!r)throw Error("Schema is missing a method literal");let a=nB(r);if("string"==typeof a)return a;throw Error("Schema method literal must be a string")}function o9(e){return{completion:{values:e.slice(0,100),total:e.length,hasMore:e.length>100}}}let o2={completion:{values:[],hasMore:!1}},o4={text:e=>"string"!=typeof e.text?{valid:!1,error:'Text content must have a "text" property of type string'}:{valid:!0},image:e=>"string"!=typeof e.data?{valid:!1,error:'Image content must have a "data" property of type string (base64-encoded image)'}:"string"!=typeof e.mimeType?{valid:!1,error:'Image content must have a "mimeType" property of type string'}:{valid:!0},audio:e=>"string"!=typeof e.data?{valid:!1,error:'Audio content must have a "data" property of type string (base64-encoded audio)'}:"string"!=typeof e.mimeType?{valid:!1,error:'Audio content must have a "mimeType" property of type string'}:{valid:!0},resource_link:e=>"string"!=typeof e.name?{valid:!1,error:'Resource link content must have a "name" property of type string'}:"string"!=typeof e.uri?{valid:!1,error:'Resource link content must have a "uri" property of type string'}:void 0!==e.title&&"string"!=typeof e.title?{valid:!1,error:'Resource link "title" property must be a string if provided'}:void 0!==e.description&&"string"!=typeof e.description?{valid:!1,error:'Resource link "description" property must be a string if provided'}:void 0!==e.mimeType&&"string"!=typeof e.mimeType?{valid:!1,error:'Resource link "mimeType" property must be a string if provided'}:{valid:!0}};function o5(e){if(!e||"object"!=typeof e)return{valid:!1,error:"Content must be an object"};if("string"!=typeof e.type)return{valid:!1,error:'Content must have a "type" property of type string'};if(void 0!==e._meta&&(null===e._meta||"object"!=typeof e._meta))return{valid:!1,error:'Content "_meta" property must be an object if provided'};let t=o4[e.type];return t?t(e):{valid:!0}}let o6=new class{add(e,t){this.resources.set(e,t)}getAll(){return this.resources}clear(){this.resources.clear()}has(e){return this.resources.has(e)}constructor(){!function(e,t,r){t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(this,"resources",new Map)}};function o3(e){let t={};return!function e(r,a=""){if(r&&"object"==typeof r)for(let[s,i]of Object.entries(r)){let r=a?`${a}/${s}`:s;!i||"object"!=typeof i||Array.isArray(i)||i instanceof Date||i instanceof RegExp?t[r]=i:e(i,r)}}(e),t}function o8(e){return e.endsWith(".tsx")}let o7=["toolInvocation","widgetAccessible","outputTemplate"],le=["widgetDescription","widgetPrefersBorder","widgetCSP","widgetDomain","widgetState"],lt=new class{add(e,t){this.resources.set(e,t)}getAll(){return this.resources}clear(){this.resources.clear()}has(e){return this.resources.has(e)}constructor(){!function(e,t,r){t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(this,"resources",new Map)}},lr=["ui/resourceUri"],la=["prefersBorder","domain","csp","connectDomains","resourceDomains"];function ls(e){return"object"==typeof e&&null!==e&&Object.entries(e).every(([e,t])=>"string"==typeof e&&"object"==typeof t&&null!==t&&"parse"in t&&"function"==typeof t.parse)}function li(e){return(e.split("/").pop()||e).replace(/\.[^/.]+$/,"")}function ln(e){let t=e.split("/").filter(e=>""!==e),r=t.findIndex(e=>e.match(/^\(.+\)$/));if(-1===r)return null;let a=t[t.length-1];if(a&&a.match(/^\[.+\]\.ts$/))return null;let s=t[r].slice(1,-1),i=t.slice(r+1),n=i[i.length-1];if(n&&n.includes(".")){let e=n.split(".")[0];"index"!==e?i[i.length-1]=e:i.pop()}let o=[],l=[],d=i.map(e=>{if(!e.match(/^\[.+\]$/))return l.push(e),e;{let t=e.slice(1,-1);return o.push(t),`{${t}}`}}),u=`${s}://${d.join("/")}`,c=o.length>0?"template":"direct";return{filePath:e,uriTemplate:u,scheme:s,parameters:o,pathSegments:l,type:c}}let lo={name:"MCP Server",version:"0.0.1"};async function ll(e,t,r,a){return o6.clear(),t.forEach((t,r)=>{var a,s;let i,n={name:li(r),description:"No description provided"},{default:o,metadata:l,schema:d}=t;if("object"==typeof l&&null!==l&&Object.assign(n,l),"function"==typeof o&&"__x402"in o){let e=global.__XMCP_X402_REGISTRY;e&&e.set(n.name,o.__x402)}let u={};ls(d)?u=d:null!=d&&console.warn(`Invalid schema for tool "${n.name}" at ${r}. Expected Record<string, z.ZodType>`),void 0===n.annotations&&(n.annotations={}),void 0===n.annotations.title&&(n.annotations.title=n.name),void 0===n._meta&&(n._meta={});let c=o8(r),p=!!(a=n._meta)&&"object"==typeof a&&("openai"in a&&"object"==typeof a.openai||Object.keys(a).some(e=>e.startsWith("openai/"))),h=!!(s=n._meta)&&"object"==typeof s&&"ui"in s&&"object"==typeof s.ui||c&&!p,m=n._meta;if(h||p){let e=`ui://widget/${n.name}.html`,t=`ui://app/${n.name}.html`;if(p&&(n._meta.openai||(n._meta.openai={}),n._meta.openai.outputTemplate||(n._meta.openai.outputTemplate=e)),h&&(n._meta.ui||(n._meta.ui={}),n._meta.ui.resourceUri||(n._meta.ui.resourceUri=t)),p){let t=function(e){let t={},r={};if(e.openai&&"object"==typeof e.openai){let a=e.openai,s={},i={};for(let[e,t]of Object.entries(a))o7.includes(e)?s[e]=t:le.includes(e)?i[e]=t:s[e]=t;Object.keys(s).length>0&&(t.openai=s),Object.keys(i).length>0&&(r.openai=i)}for(let[r,a]of Object.entries(e))"openai"!==r&&(t[r]=a);return{toolMeta:t,resourceMeta:r}}(m);m=t.toolMeta,o6.add(n.name,{name:n.name,uri:e,handler:o,_meta:t.resourceMeta,toolPath:c?r:void 0,mimeType:"text/html+skybridge"})}if(h){let e=function(e){let t={},r={};if(e.ui&&"object"==typeof e.ui){let a=e.ui,s={},i={};for(let[e,t]of Object.entries(a))lr.includes(e)?s[e]=t:la.includes(e)?i[e]=t:s[e]=t;Object.keys(s).length>0&&(t.ui=s),Object.keys(i).length>0&&(r.ui=i)}for(let[r,a]of Object.entries(e))"ui"!==r&&(t[r]=a);return{toolMeta:t,resourceMeta:r}}(m);m=e.toolMeta;let a=e.resourceMeta;a.ui=a.ui||{},a.ui.csp=a.ui.csp||{},a.ui.csp.resourceDomains=a.ui.csp.resourceDomains||[],a.ui.csp.resourceDomains.includes("https://esm.sh")||a.ui.csp.resourceDomains.push("https://esm.sh"),lt.add(n.name,{name:n.name,uri:t,handler:o,mimeType:"text/html;profile=mcp-app",_meta:a,toolPath:c?r:void 0})}}let f=o3(m),g=p||h?f:void 0;i=o8(r)&&(p||h)?async(e,t)=>({content:[{type:"text",text:""}],_meta:g,structuredContent:{args:e}}):async(e,t)=>{let r=o(e,t);if(r instanceof Promise&&(r=await r),"string"==typeof r||"number"==typeof r)return g&&"object"==typeof g&&Object.keys(g).some(e=>e.startsWith("openai/"))?{content:[{type:"text",text:""}],structuredContent:{args:e},_meta:g}:{content:[{type:"text",text:"number"==typeof r?`${r}`:r}]};if(r&&"object"==typeof r&&"_meta"in r&&!("content"in r)&&!("structuredContent"in r)){let e=r._meta;if(e&&"object"==typeof e&&Object.keys(e).some(e=>e.startsWith("openai/")))return{content:[{type:"text",text:""}],_meta:e}}if(!r||"object"!=typeof r){let e=null===r?"null":typeof r,t=void 0===r?"undefined":null===r?"null":"object"==typeof r?JSON.stringify(r,null,2):String(r);throw Error(`Tool handler must return a CallToolResult, string, or number. Got ${e}: ${t}
32
+
33
+ Expected CallToolResult format:
34
+ {
35
+ content: [
36
+ { type: "text", text: "your text here" },
37
+ { type: "image", data: "base64data", mimeType: "image/jpeg" },
38
+ { type: "audio", data: "base64data", mimeType: "audio/mpeg" },
39
+ { type: "resource_link", name: "resource name", uri: "resource://uri" }
40
+ // All content types support an optional "_meta" object property
41
+ ]
42
+ }
43
+
44
+ Or with structured content:
45
+ {
46
+ structuredContent: { your: "data" }
47
+ }
48
+
49
+ Or both for backwards compatibility:
50
+ {
51
+ content: [{ type: "text", text: "fallback" }],
52
+ structuredContent: { your: "data" }
53
+ }
54
+
55
+ Or for OpenAI metadata only:
56
+ {
57
+ _meta: {
58
+ "openai/...": ...
59
+ }
60
+ }`)}let a="content"in r&&Array.isArray(r.content),s="structuredContent"in r;if(!a&&!s){let e=JSON.stringify(r,null,2);throw Error(`Tool handler must return at least 'content' or 'structuredContent'. Got: ${e}
61
+
62
+ Expected CallToolResult format:
63
+ {
64
+ content: [
65
+ { type: "text", text: "your text here" },
66
+ { type: "image", data: "base64data", mimeType: "image/jpeg" },
67
+ { type: "audio", data: "base64data", mimeType: "audio/mpeg" },
68
+ { type: "resource_link", name: "resource name", uri: "resource://uri" }
69
+ ]
70
+ }
71
+
72
+ Or with structured content:
73
+ {
74
+ structuredContent: { your: "data" }
75
+ }
76
+
77
+ Or both for backwards compatibility:
78
+ {
79
+ content: [{ type: "text", text: "fallback" }],
80
+ structuredContent: { your: "data" }
81
+ }`)}if(a)for(let e=0;e<r.content.length;e++){let t=r.content[e],a=o5(t);if(!a.valid)throw Error(`Invalid content item at index ${e}: ${a.error}
82
+
83
+ Content item: ${JSON.stringify(t,null,2)}
84
+
85
+ Expected content formats:
86
+ - Text: { type: "text", text: "your text here" }
87
+ - Image: { type: "image", data: "base64data", mimeType: "image/jpeg" }
88
+ - Audio: { type: "audio", data: "base64data", mimeType: "audio/mpeg" }
89
+ - Resource: { type: "resource_link", name: "name", uri: "uri" }
90
+ All content types support an optional "_meta" object property`)}if(s){let e=r.structuredContent;if(null===e||"object"!=typeof e||Array.isArray(e)){let t=Array.isArray(e)?"array":typeof e;throw Error(`'structuredContent' must be a plain object (not an array or primitive). Got ${t}: ${JSON.stringify(e,null,2)}
91
+
92
+ Expected format:
93
+ {
94
+ structuredContent: {
95
+ key: "value",
96
+ nested: { data: "here" }
97
+ }
98
+ }`)}}return r};let y={title:n.annotations?.title,description:n.description,inputSchema:rK(u),annotations:n.annotations,_meta:f};e.registerTool(n.name,y,i)}),r.forEach((t,r)=>{let a=li(r),s={name:a,title:a,description:"No description provided"},{default:i,metadata:n,schema:o}=t;"object"==typeof n&&null!==n&&Object.assign(s,n);let l=function(e,t="assistant"){return async(r,a)=>{let s,i=e(r,a);if(i instanceof Promise&&(i=await i),"string"==typeof i||"number"==typeof i)s={type:"text",text:"number"==typeof i?`${i}`:i};else{let e=o5(i);if(e.valid)s=i;else{let t=null===i?"null":typeof i,r=void 0===i?"undefined":null===i?"null":"object"==typeof i?JSON.stringify(i,null,2):String(i);throw Error(`Prompt handler must return a PromptContent object, string, or number. Got ${t}: ${r}
99
+
100
+ Validation error: ${e.error}
101
+
102
+ Expected formats:
103
+ - String: "your text here"
104
+ - Number: 42
105
+ - Text content: { type: "text", text: "your text here" }
106
+ - Image content: { type: "image", data: "base64data", mimeType: "image/jpeg" }
107
+ - Audio content: { type: "audio", data: "base64data", mimeType: "audio/mpeg" }
108
+ - Resource link: { type: "resource_link", name: "resource name", uri: "resource://uri" }
109
+ - All content types support an optional "_meta" object property`)}}if("user"!==t&&"assistant"!==t)throw Error(`Invalid role: ${t}`);return{messages:[{role:t,content:s}]}}}(i,s.role||"assistant");ls(o)?Object.assign({},o):null!=o&&console.warn(`Invalid schema for prompt "${s.name}" at ${r}. Expected Record<string, z.ZodType>`),e.registerPrompt(s.name,{title:s.title,description:s.description,argsSchema:o},l)}),[...o6.getAll(),...lt.getAll()].forEach(([t,r])=>{let a=r?._meta?o3(r._meta):void 0,s={name:r.name,description:`Auto-generated resource for ${r.name} tool`,mimeType:r.mimeType,_meta:a},n=async(e,t)=>{if(r.mimeType&&r.toolPath)try{var a;let e,t,s,n=(a=r.toolPath,function(e){let{normalizedPath:t,baseName:r}=function(e){let t=e.replace(/\\/g,"/");if(!t)throw Error("Invalid tool path: path is empty");let r=t.replace(/\.[^/.]+$/,"").replace(/\//g,"_");return{normalizedPath:t,baseName:r}}(e),a=i(6982).createHash("md5").update(t).digest("hex").slice(0,6);return`${r}_${a}`}(a)),o=function(e){try{let t=i(9896),r=i(6928);for(let a of[r.join(process.cwd(),"dist","client"),r.join(process.cwd(),"client")]){let s=r.join(a,`${e}.bundle.js`),i=r.join(a,`${e}.bundle.css`);if(t.existsSync(s)){let e,r=t.readFileSync(s,"utf-8");return t.existsSync(i)&&(e=t.readFileSync(i,"utf-8")),{js:r,css:e}}}}catch{}return null}(n);if(!o)throw Error(`React client bundle not found for "${r.name}" (bundle: "${n}").
110
+ React tool bundles are generated automatically when you run "xmcp build" (or "xmcp dev").
111
+ Please re-run the build so the framework can regenerate the bundle.`);let l=o.js,d=o.css,u="text/html;profile=mcp-app"===r.mimeType?(e=`
112
+ <script type="module">
113
+ const componentSource = ${JSON.stringify(l)};
114
+ const blobUrl = URL.createObjectURL(
115
+ new Blob([componentSource], { type: "text/javascript" })
116
+ );
117
+
118
+ await import(blobUrl);
119
+
120
+ let nextId = 1;
121
+
122
+ window.parent.postMessage({
123
+ jsonrpc: "2.0",
124
+ id: nextId++,
125
+ method: "ui/initialize",
126
+ params: {
127
+ appCapabilities: {},
128
+ appInfo: { name: "xmcp React Widget", version: "1.0.0" },
129
+ protocolVersion: "2025-06-18"
130
+ }
131
+ }, "*");
132
+
133
+ window.addEventListener("message", (event) => {
134
+ const data = event.data;
135
+
136
+ if (event.source !== window.parent) return;
137
+
138
+ // handshake ack
139
+ if (data?.result?.hostContext && data?.id === 1) {
140
+ window.parent.postMessage({
141
+ jsonrpc: "2.0",
142
+ method: "ui/notifications/initialized",
143
+ params: {}
144
+ }, "*");
145
+ }
146
+ });
147
+
148
+ requestAnimationFrame(() => {
149
+ URL.revokeObjectURL(blobUrl);
150
+ });
151
+ </script>`,t=d?`<style>${d}</style>`:"",`<!DOCTYPE html>
152
+ <html>
153
+ <head>
154
+ <meta charset="utf-8">
155
+ <meta name="viewport" content="width=device-width, initial-scale=1">
156
+ ${t}
157
+ </head>
158
+ <body>
159
+ <div id="root"></div>
160
+ ${e}
161
+ </body>
162
+ </html>`):(s=d?`<style>${d}</style>`:"",`<!DOCTYPE html>
163
+ <html>
164
+ <head>
165
+ <meta charset="utf-8" />
166
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
167
+ ${s}
168
+ </head>
169
+ <body>
170
+ <div id="root"></div>
171
+
172
+ <script type="module">
173
+ const componentSource = ${JSON.stringify(l)};
174
+ const blobUrl = URL.createObjectURL(
175
+ new Blob([componentSource], { type: "text/javascript" })
176
+ );
177
+
178
+ await import(blobUrl);
179
+
180
+ requestAnimationFrame(() => {
181
+ URL.revokeObjectURL(blobUrl);
182
+ });
183
+ </script>
184
+ </body>
185
+ </html>`);return{contents:[{uri:r.uri,text:u,mimeType:r.mimeType,_meta:r._meta}]}}catch(e){throw console.error(`React failed for ${r.name}:`,e),e}let s=r.handler({},t);if(s instanceof Promise&&(s=await s),"string"==typeof s)return{contents:[{uri:r.uri,text:s}]};if(s&&"object"==typeof s&&"_meta"in s&&!("content"in s))return{contents:[{uri:r.uri,text:""}]};if(s&&"object"==typeof s&&"content"in s&&Array.isArray(s.content)){let e=s.content.find(e=>"text"===e.type);if(e&&"text"===e.type&&"string"==typeof e.text)return{contents:[{uri:r.uri,text:e.text}]}}return{contents:[{uri:r.uri,text:""}]}};e.registerResource(r.name,r.uri,s,n)}),a.forEach((t,r)=>{let a={name:li(r),description:"No description provided"},{default:s,metadata:i,schema:n}=t;"object"==typeof i&&null!==i&&Object.assign(a,i);let o={};ls(n)?o=n:null!=n&&console.warn(`Invalid schema for resource "${a.name}" at ${r}. Expected Record<string, z.ZodType>`);let l=ln(r);if(!l)return void console.warn(`Skipping resource "${a.name}" at ${r}: Invalid file path format`);let d=l.uriTemplate;a.mimeType&&a.mimeType.includes("html")&&(d=d.endsWith(".html")?d:`${d}.html`);let u=function(e,t,r={}){let a=ln(t);if(!a)throw Error(`Invalid resource file path: ${t}. Must follow (scheme)/path/[param] convention.`);return async(t,s)=>{let i=e(function(e,t,r){let a={},s={};if(0===t.parameters.length)return s;let i=t.uriTemplate.split("://")[1]||"",n=e.split("://")[1]||"",o=i.split("/"),l=n.split("/");for(let e=0;e<o.length&&e<l.length;e++){let t=o[e],r=l[e],s=t.match(/^\{(.+)\}$/);s&&(a[s[1]]=r)}for(let e of t.parameters){let t=a[e],i=r[e];if(void 0===t)throw Error(`Missing required parameter: ${e}`);if(!i){s[e]=t;continue}try{s[e]=i.parse(t)}catch(r){throw Error(`Invalid parameter "${e}": ${t}. Validation error: ${r instanceof Error?r.message:String(r)}`)}}return s}(t.href,a,r),s);if(i instanceof Promise&&(i=await i),"string"==typeof i)return{contents:[{uri:t.href,text:i}]};if(!i||"object"!=typeof i||!Array.isArray(i.contents)){let e=null===i?"null":typeof i,t=void 0===i?"undefined":null===i?"null":"object"==typeof i?JSON.stringify(i,null,2):String(i);throw Error(`Resource handler must return a ReadResourceResult or string. Got ${e}: ${t}
186
+
187
+ Expected ReadResourceResult format:
188
+ {
189
+ contents: [
190
+ { uri: "resource://uri", text: "content here" },
191
+ { uri: "resource://uri", mimeType: "application/json", text: "json content" },
192
+ { uri: "resource://uri", blob: base64data }
193
+ ]
194
+ }`)}return i.contents.forEach(e=>{e.uri||(e.uri=t.href)}),i}}(s,r,o);if("direct"===l.type)e.registerResource(a.name,d,a,u);else{let t=new oG(d,{list:void 0}),r=async(e,t,r)=>{let a={};for(let e of l.parameters){let r=t[e],s=o[e];if(void 0===r)throw Error(`Missing required parameter: ${e}. Available variables: ${Object.keys(t)}`);s?a[e]=s.parse(r):a[e]=r}let i=s(a,r);return i instanceof Promise&&(i=await i),"string"==typeof i?{contents:[{uri:e.href,text:i}]}:i};e.registerResource(a.name,t,a,r)}}),e}async function ld(){let e,s,i,n=new oW(lo),[o,l]=(e=new Map,[Object.keys(t).map(r=>t[r]().then(t=>{e.set(r,t)})),e]),[d,u]=(s=new Map,[Object.keys(r).map(e=>r[e]().then(t=>{s.set(e,t)})),s]),[c,p]=(i=new Map,[Object.keys(a).map(e=>a[e]().then(t=>{i.set(e,t)})),i]);return await Promise.all(o),await Promise.all(d),await Promise.all(c),ll(n,l,u,p)}var lu=i(8583);function lc(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}i.n(lu)().config();class lp{start(){try{this.mcpServer.connect(this.transport),this.debug&&console.log("[STDIO] MCP Server running with STDIO transport"),this.setupShutdownHandlers()}catch(e){this.debug&&console.error("[STDIO] Error starting STDIO transport:",e),process.exit(1)}}setupShutdownHandlers(){let e=()=>{this.debug&&console.log("[STDIO] Shutting down STDIO transport"),process.exit(0)};process.on("SIGINT",e),process.on("SIGTERM",e)}shutdown(){this.debug&&console.log("[STDIO] Shutting down STDIO transport"),process.exit(0)}constructor(e,t=!1){lc(this,"mcpServer",void 0),lc(this,"transport",void 0),lc(this,"debug",void 0),this.mcpServer=e,this.transport=new ij,this.debug=t}}ld().then(e=>{new lp(e,!1).start()})})(),{}})()),module.exports=o})();