playwright 1.56.0-alpha-2025-09-02 → 1.56.0-alpha-1756945786000
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/README.md +2 -2
- package/ThirdPartyNotices.txt +3 -3
- package/lib/index.js +2 -2
- package/lib/matchers/toBeTruthy.js +3 -3
- package/lib/matchers/toEqual.js +3 -3
- package/lib/matchers/toMatchText.js +3 -3
- package/lib/mcp/browser/actions.d.js +16 -0
- package/lib/mcp/browser/browserContextFactory.js +227 -0
- package/lib/mcp/browser/browserServerBackend.js +82 -0
- package/lib/mcp/browser/codegen.js +64 -0
- package/lib/mcp/browser/config.js +279 -0
- package/lib/mcp/browser/context.js +229 -0
- package/lib/mcp/browser/response.js +163 -0
- package/lib/mcp/browser/sessionLog.js +160 -0
- package/lib/mcp/browser/tab.js +256 -0
- package/lib/mcp/browser/tools/common.js +63 -0
- package/lib/mcp/browser/tools/console.js +41 -0
- package/lib/mcp/browser/tools/dialogs.js +55 -0
- package/lib/mcp/browser/tools/evaluate.js +70 -0
- package/lib/mcp/browser/tools/files.js +52 -0
- package/lib/mcp/browser/tools/form.js +73 -0
- package/lib/mcp/browser/tools/install.js +69 -0
- package/lib/mcp/browser/tools/keyboard.js +95 -0
- package/lib/mcp/browser/tools/mouse.js +107 -0
- package/lib/mcp/browser/tools/navigate.js +62 -0
- package/lib/mcp/browser/tools/network.js +49 -0
- package/lib/mcp/{sdk/call.js → browser/tools/pdf.js} +27 -18
- package/lib/mcp/browser/tools/screenshot.js +94 -0
- package/lib/mcp/browser/tools/snapshot.js +162 -0
- package/lib/mcp/browser/tools/tabs.js +67 -0
- package/lib/mcp/browser/tools/tool.js +49 -0
- package/lib/mcp/browser/tools/utils.js +90 -0
- package/lib/mcp/browser/tools/verify.js +154 -0
- package/lib/mcp/browser/tools/wait.js +63 -0
- package/lib/mcp/browser/tools.js +42 -83
- package/lib/mcp/config.d.js +16 -0
- package/lib/mcp/extension/cdpRelay.js +348 -0
- package/lib/mcp/extension/extensionContextFactory.js +75 -0
- package/lib/mcp/{browser/tool.js → extension/protocol.js} +6 -8
- package/lib/mcp/index.js +61 -0
- package/lib/mcp/log.js +35 -0
- package/lib/mcp/program.js +96 -0
- package/lib/mcp/sdk/bundle.js +11 -1
- package/lib/mcp/sdk/exports.js +2 -2
- package/lib/mcp/sdk/http.js +21 -6
- package/lib/mcp/sdk/mdb.js +16 -15
- package/lib/mcp/sdk/proxyBackend.js +7 -6
- package/lib/mcp/sdk/server.js +6 -6
- package/lib/mcp/sdk/tool.js +1 -1
- package/lib/mcp/{browser/backend.js → test/browserBackend.js} +7 -9
- package/lib/mcp/test/browserTool.js +30 -0
- package/lib/mcp/test/browserTools.js +120 -0
- package/lib/mcp/test/{backend.js → testBackend.js} +12 -12
- package/lib/mcp/test/{context.js → testContext.js} +6 -6
- package/lib/mcp/test/{tool.js → testTool.js} +6 -6
- package/lib/mcp/test/{tools.js → testTools.js} +7 -7
- package/lib/mcpBundleImpl.js +11 -11
- package/lib/program.js +4 -4
- package/package.json +6 -3
package/lib/mcpBundleImpl.js
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
"use strict";var Cu=Object.create;var la=Object.defineProperty;var ku=Object.getOwnPropertyDescriptor;var Du=Object.getOwnPropertyNames;var ju=Object.getPrototypeOf,Nu=Object.prototype.hasOwnProperty;var z=(a,e)=>()=>(e||a((e={exports:{}}).exports,e),e.exports),Mn=(a,e)=>{for(var t in e)la(a,t,{get:e[t],enumerable:!0})},qn=(a,e,t,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of Du(e))!Nu.call(a,r)&&r!==t&&la(a,r,{get:()=>e[r],enumerable:!(s=ku(e,r))||s.enumerable});return a};var hr=(a,e,t)=>(t=a!=null?Cu(ju(a)):{},qn(e||!a||!a.__esModule?la(t,"default",{value:a,enumerable:!0}):t,a)),Fu=a=>qn(la({},"__esModule",{value:!0}),a);var go=z((Pa,vo)=>{(function(a,e){typeof Pa=="object"&&typeof vo!="undefined"?e(Pa):typeof define=="function"&&define.amd?define(["exports"],e):e(a.URI=a.URI||{})})(Pa,function(a){"use strict";function e(){for(var _=arguments.length,h=Array(_),b=0;b<_;b++)h[b]=arguments[b];if(h.length>1){h[0]=h[0].slice(0,-1);for(var w=h.length-1,E=1;E<w;++E)h[E]=h[E].slice(1,-1);return h[w]=h[w].slice(1),h.join("")}else return h[0]}function t(_){return"(?:"+_+")"}function s(_){return _===void 0?"undefined":_===null?"null":Object.prototype.toString.call(_).split(" ").pop().split("]").shift().toLowerCase()}function r(_){return _.toUpperCase()}function n(_){return _!=null?_ instanceof Array?_:typeof _.length!="number"||_.split||_.setInterval||_.call?[_]:Array.prototype.slice.call(_):[]}function o(_,h){var b=_;if(h)for(var w in h)b[w]=h[w];return b}function l(_){var h="[A-Za-z]",b="[\\x0D]",w="[0-9]",E="[\\x22]",N=e(w,"[A-Fa-f]"),K="[\\x0A]",ae="[\\x20]",ie=t(t("%[EFef]"+N+"%"+N+N+"%"+N+N)+"|"+t("%[89A-Fa-f]"+N+"%"+N+N)+"|"+t("%"+N+N)),be="[\\:\\/\\?\\#\\[\\]\\@]",te="[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=]",he=e(be,te),xe=_?"[\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]":"[]",de=_?"[\\uE000-\\uF8FF]":"[]",ne=e(h,w,"[\\-\\.\\_\\~]",xe),pe=t(h+e(h,w,"[\\+\\-\\.]")+"*"),ce=t(t(ie+"|"+e(ne,te,"[\\:]"))+"*"),Nr=t(t("25[0-5]")+"|"+t("2[0-4]"+w)+"|"+t("1"+w+w)+"|"+t("[1-9]"+w)+"|"+w),qe=t(t("25[0-5]")+"|"+t("2[0-4]"+w)+"|"+t("1"+w+w)+"|"+t("0?[1-9]"+w)+"|0?0?"+w),Ve=t(qe+"\\."+qe+"\\."+qe+"\\."+qe),ue=t(N+"{1,4}"),Ue=t(t(ue+"\\:"+ue)+"|"+Ve),He=t(t(ue+"\\:")+"{6}"+Ue),ar=t("\\:\\:"+t(ue+"\\:")+"{5}"+Ue),Fr=t(t(ue)+"?\\:\\:"+t(ue+"\\:")+"{4}"+Ue),ur=t(t(t(ue+"\\:")+"{0,1}"+ue)+"?\\:\\:"+t(ue+"\\:")+"{3}"+Ue),It=t(t(t(ue+"\\:")+"{0,2}"+ue)+"?\\:\\:"+t(ue+"\\:")+"{2}"+Ue),na=t(t(t(ue+"\\:")+"{0,3}"+ue)+"?\\:\\:"+ue+"\\:"+Ue),oa=t(t(t(ue+"\\:")+"{0,4}"+ue)+"?\\:\\:"+Ue),ct=t(t(t(ue+"\\:")+"{0,5}"+ue)+"?\\:\\:"+ue),ut=t(t(t(ue+"\\:")+"{0,6}"+ue)+"?\\:\\:"),dr=t([He,ar,Fr,ur,It,na,oa,ct,ut].join("|")),dt=t(t(ne+"|"+ie)+"+"),is=t(dr+"\\%25"+dt),Lr=t(dr+t("\\%25|\\%(?!"+N+"{2})")+dt),Su=t("[vV]"+N+"+\\."+e(ne,te,"[\\:]")+"+"),Ru=t("\\["+t(Lr+"|"+dr+"|"+Su)+"\\]"),jn=t(t(ie+"|"+e(ne,te))+"*"),Ct=t(Ru+"|"+Ve+"(?!"+jn+")|"+jn),kt=t(w+"*"),Nn=t(t(ce+"@")+"?"+Ct+t("\\:"+kt)+"?"),Dt=t(ie+"|"+e(ne,te,"[\\:\\@]")),Ou=t(Dt+"*"),Fn=t(Dt+"+"),Tu=t(t(ie+"|"+e(ne,te,"[\\@]"))+"+"),fr=t(t("\\/"+Ou)+"*"),ft=t("\\/"+t(Fn+fr)+"?"),ls=t(Tu+fr),ia=t(Fn+fr),ht="(?!"+Dt+")",Nm=t(fr+"|"+ft+"|"+ls+"|"+ia+"|"+ht),pt=t(t(Dt+"|"+e("[\\/\\?]",de))+"*"),jt=t(t(Dt+"|[\\/\\?]")+"*"),Ln=t(t("\\/\\/"+Nn+fr)+"|"+ft+"|"+ia+"|"+ht),$u=t(pe+"\\:"+Ln+t("\\?"+pt)+"?"+t("\\#"+jt)+"?"),Au=t(t("\\/\\/"+Nn+fr)+"|"+ft+"|"+ls+"|"+ht),Iu=t(Au+t("\\?"+pt)+"?"+t("\\#"+jt)+"?"),Fm=t($u+"|"+Iu),Lm=t(pe+"\\:"+Ln+t("\\?"+pt)+"?"),Mm="^("+pe+")\\:"+t(t("\\/\\/("+t("("+ce+")@")+"?("+Ct+")"+t("\\:("+kt+")")+"?)")+"?("+fr+"|"+ft+"|"+ia+"|"+ht+")")+t("\\?("+pt+")")+"?"+t("\\#("+jt+")")+"?$",qm="^(){0}"+t(t("\\/\\/("+t("("+ce+")@")+"?("+Ct+")"+t("\\:("+kt+")")+"?)")+"?("+fr+"|"+ft+"|"+ls+"|"+ht+")")+t("\\?("+pt+")")+"?"+t("\\#("+jt+")")+"?$",Um="^("+pe+")\\:"+t(t("\\/\\/("+t("("+ce+")@")+"?("+Ct+")"+t("\\:("+kt+")")+"?)")+"?("+fr+"|"+ft+"|"+ia+"|"+ht+")")+t("\\?("+pt+")")+"?$",zm="^"+t("\\#("+jt+")")+"?$",Vm="^"+t("("+ce+")@")+"?("+Ct+")"+t("\\:("+kt+")")+"?$";return{NOT_SCHEME:new RegExp(e("[^]",h,w,"[\\+\\-\\.]"),"g"),NOT_USERINFO:new RegExp(e("[^\\%\\:]",ne,te),"g"),NOT_HOST:new RegExp(e("[^\\%\\[\\]\\:]",ne,te),"g"),NOT_PATH:new RegExp(e("[^\\%\\/\\:\\@]",ne,te),"g"),NOT_PATH_NOSCHEME:new RegExp(e("[^\\%\\/\\@]",ne,te),"g"),NOT_QUERY:new RegExp(e("[^\\%]",ne,te,"[\\:\\@\\/\\?]",de),"g"),NOT_FRAGMENT:new RegExp(e("[^\\%]",ne,te,"[\\:\\@\\/\\?]"),"g"),ESCAPE:new RegExp(e("[^]",ne,te),"g"),UNRESERVED:new RegExp(ne,"g"),OTHER_CHARS:new RegExp(e("[^\\%]",ne,he),"g"),PCT_ENCODED:new RegExp(ie,"g"),IPV4ADDRESS:new RegExp("^("+Ve+")$"),IPV6ADDRESS:new RegExp("^\\[?("+dr+")"+t(t("\\%25|\\%(?!"+N+"{2})")+"("+dt+")")+"?\\]?$")}}var u=l(!1),c=l(!0),f=function(){function _(h,b){var w=[],E=!0,N=!1,K=void 0;try{for(var ae=h[Symbol.iterator](),ie;!(E=(ie=ae.next()).done)&&(w.push(ie.value),!(b&&w.length===b));E=!0);}catch(be){N=!0,K=be}finally{try{!E&&ae.return&&ae.return()}finally{if(N)throw K}}return w}return function(h,b){if(Array.isArray(h))return h;if(Symbol.iterator in Object(h))return _(h,b);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),p=function(_){if(Array.isArray(_)){for(var h=0,b=Array(_.length);h<_.length;h++)b[h]=_[h];return b}else return Array.from(_)},g=2147483647,d=36,y=1,m=26,v=38,x=700,S=72,P=128,O="-",A=/^xn--/,I=/[^\0-\x7E]/,H=/[\x2E\u3002\uFF0E\uFF61]/g,q={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},C=d-y,U=Math.floor,M=String.fromCharCode;function F(_){throw new RangeError(q[_])}function $(_,h){for(var b=[],w=_.length;w--;)b[w]=h(_[w]);return b}function k(_,h){var b=_.split("@"),w="";b.length>1&&(w=b[0]+"@",_=b[1]),_=_.replace(H,".");var E=_.split("."),N=$(E,h).join(".");return w+N}function L(_){for(var h=[],b=0,w=_.length;b<w;){var E=_.charCodeAt(b++);if(E>=55296&&E<=56319&&b<w){var N=_.charCodeAt(b++);(N&64512)==56320?h.push(((E&1023)<<10)+(N&1023)+65536):(h.push(E),b--)}else h.push(E)}return h}var le=function(h){return String.fromCodePoint.apply(String,p(h))},Y=function(h){return h-48<10?h-22:h-65<26?h-65:h-97<26?h-97:d},re=function(h,b){return h+22+75*(h<26)-((b!=0)<<5)},W=function(h,b,w){var E=0;for(h=w?U(h/x):h>>1,h+=U(h/b);h>C*m>>1;E+=d)h=U(h/C);return U(E+(C+1)*h/(h+v))},Z=function(h){var b=[],w=h.length,E=0,N=P,K=S,ae=h.lastIndexOf(O);ae<0&&(ae=0);for(var ie=0;ie<ae;++ie)h.charCodeAt(ie)>=128&&F("not-basic"),b.push(h.charCodeAt(ie));for(var be=ae>0?ae+1:0;be<w;){for(var te=E,he=1,xe=d;;xe+=d){be>=w&&F("invalid-input");var de=Y(h.charCodeAt(be++));(de>=d||de>U((g-E)/he))&&F("overflow"),E+=de*he;var ne=xe<=K?y:xe>=K+m?m:xe-K;if(de<ne)break;var pe=d-ne;he>U(g/pe)&&F("overflow"),he*=pe}var ce=b.length+1;K=W(E-te,ce,te==0),U(E/ce)>g-N&&F("overflow"),N+=U(E/ce),E%=ce,b.splice(E++,0,N)}return String.fromCodePoint.apply(String,b)},me=function(h){var b=[];h=L(h);var w=h.length,E=P,N=0,K=S,ae=!0,ie=!1,be=void 0;try{for(var te=h[Symbol.iterator](),he;!(ae=(he=te.next()).done);ae=!0){var xe=he.value;xe<128&&b.push(M(xe))}}catch(Lr){ie=!0,be=Lr}finally{try{!ae&&te.return&&te.return()}finally{if(ie)throw be}}var de=b.length,ne=de;for(de&&b.push(O);ne<w;){var pe=g,ce=!0,Nr=!1,qe=void 0;try{for(var Ve=h[Symbol.iterator](),ue;!(ce=(ue=Ve.next()).done);ce=!0){var Ue=ue.value;Ue>=E&&Ue<pe&&(pe=Ue)}}catch(Lr){Nr=!0,qe=Lr}finally{try{!ce&&Ve.return&&Ve.return()}finally{if(Nr)throw qe}}var He=ne+1;pe-E>U((g-N)/He)&&F("overflow"),N+=(pe-E)*He,E=pe;var ar=!0,Fr=!1,ur=void 0;try{for(var It=h[Symbol.iterator](),na;!(ar=(na=It.next()).done);ar=!0){var oa=na.value;if(oa<E&&++N>g&&F("overflow"),oa==E){for(var ct=N,ut=d;;ut+=d){var dr=ut<=K?y:ut>=K+m?m:ut-K;if(ct<dr)break;var dt=ct-dr,is=d-dr;b.push(M(re(dr+dt%is,0))),ct=U(dt/is)}b.push(M(re(ct,0))),K=W(N,He,ne==de),N=0,++ne}}}catch(Lr){Fr=!0,ur=Lr}finally{try{!ar&&It.return&&It.return()}finally{if(Fr)throw ur}}++N,++E}return b.join("")},Re=function(h){return k(h,function(b){return A.test(b)?Z(b.slice(4).toLowerCase()):b})},Ae=function(h){return k(h,function(b){return I.test(b)?"xn--"+me(b):b})},se={version:"2.1.0",ucs2:{decode:L,encode:le},decode:Z,encode:me,toASCII:Ae,toUnicode:Re},ye={};function Ee(_){var h=_.charCodeAt(0),b=void 0;return h<16?b="%0"+h.toString(16).toUpperCase():h<128?b="%"+h.toString(16).toUpperCase():h<2048?b="%"+(h>>6|192).toString(16).toUpperCase()+"%"+(h&63|128).toString(16).toUpperCase():b="%"+(h>>12|224).toString(16).toUpperCase()+"%"+(h>>6&63|128).toString(16).toUpperCase()+"%"+(h&63|128).toString(16).toUpperCase(),b}function Ie(_){for(var h="",b=0,w=_.length;b<w;){var E=parseInt(_.substr(b+1,2),16);if(E<128)h+=String.fromCharCode(E),b+=3;else if(E>=194&&E<224){if(w-b>=6){var N=parseInt(_.substr(b+4,2),16);h+=String.fromCharCode((E&31)<<6|N&63)}else h+=_.substr(b,6);b+=6}else if(E>=224){if(w-b>=9){var K=parseInt(_.substr(b+4,2),16),ae=parseInt(_.substr(b+7,2),16);h+=String.fromCharCode((E&15)<<12|(K&63)<<6|ae&63)}else h+=_.substr(b,9);b+=9}else h+=_.substr(b,3),b+=3}return h}function xr(_,h){function b(w){var E=Ie(w);return E.match(h.UNRESERVED)?E:w}return _.scheme&&(_.scheme=String(_.scheme).replace(h.PCT_ENCODED,b).toLowerCase().replace(h.NOT_SCHEME,"")),_.userinfo!==void 0&&(_.userinfo=String(_.userinfo).replace(h.PCT_ENCODED,b).replace(h.NOT_USERINFO,Ee).replace(h.PCT_ENCODED,r)),_.host!==void 0&&(_.host=String(_.host).replace(h.PCT_ENCODED,b).toLowerCase().replace(h.NOT_HOST,Ee).replace(h.PCT_ENCODED,r)),_.path!==void 0&&(_.path=String(_.path).replace(h.PCT_ENCODED,b).replace(_.scheme?h.NOT_PATH:h.NOT_PATH_NOSCHEME,Ee).replace(h.PCT_ENCODED,r)),_.query!==void 0&&(_.query=String(_.query).replace(h.PCT_ENCODED,b).replace(h.NOT_QUERY,Ee).replace(h.PCT_ENCODED,r)),_.fragment!==void 0&&(_.fragment=String(_.fragment).replace(h.PCT_ENCODED,b).replace(h.NOT_FRAGMENT,Ee).replace(h.PCT_ENCODED,r)),_}function lr(_){return _.replace(/^0*(.*)/,"$1")||"0"}function _e(_,h){var b=_.match(h.IPV4ADDRESS)||[],w=f(b,2),E=w[1];return E?E.split(".").map(lr).join("."):_}function ve(_,h){var b=_.match(h.IPV6ADDRESS)||[],w=f(b,3),E=w[1],N=w[2];if(E){for(var K=E.toLowerCase().split("::").reverse(),ae=f(K,2),ie=ae[0],be=ae[1],te=be?be.split(":").map(lr):[],he=ie.split(":").map(lr),xe=h.IPV4ADDRESS.test(he[he.length-1]),de=xe?7:8,ne=he.length-de,pe=Array(de),ce=0;ce<de;++ce)pe[ce]=te[ce]||he[ne+ce]||"";xe&&(pe[de-1]=_e(pe[de-1],h));var Nr=pe.reduce(function(He,ar,Fr){if(!ar||ar==="0"){var ur=He[He.length-1];ur&&ur.index+ur.length===Fr?ur.length++:He.push({index:Fr,length:1})}return He},[]),qe=Nr.sort(function(He,ar){return ar.length-He.length})[0],Ve=void 0;if(qe&&qe.length>1){var ue=pe.slice(0,qe.index),Ue=pe.slice(qe.index+qe.length);Ve=ue.join(":")+"::"+Ue.join(":")}else Ve=pe.join(":");return N&&(Ve+="%"+N),Ve}else return _}var kr=/^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i,Oe="".match(/(){0}/)[1]===void 0;function oe(_){var h=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},b={},w=h.iri!==!1?c:u;h.reference==="suffix"&&(_=(h.scheme?h.scheme+":":"")+"//"+_);var E=_.match(kr);if(E){Oe?(b.scheme=E[1],b.userinfo=E[3],b.host=E[4],b.port=parseInt(E[5],10),b.path=E[6]||"",b.query=E[7],b.fragment=E[8],isNaN(b.port)&&(b.port=E[5])):(b.scheme=E[1]||void 0,b.userinfo=_.indexOf("@")!==-1?E[3]:void 0,b.host=_.indexOf("//")!==-1?E[4]:void 0,b.port=parseInt(E[5],10),b.path=E[6]||"",b.query=_.indexOf("?")!==-1?E[7]:void 0,b.fragment=_.indexOf("#")!==-1?E[8]:void 0,isNaN(b.port)&&(b.port=_.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/)?E[4]:void 0)),b.host&&(b.host=ve(_e(b.host,w),w)),b.scheme===void 0&&b.userinfo===void 0&&b.host===void 0&&b.port===void 0&&!b.path&&b.query===void 0?b.reference="same-document":b.scheme===void 0?b.reference="relative":b.fragment===void 0?b.reference="absolute":b.reference="uri",h.reference&&h.reference!=="suffix"&&h.reference!==b.reference&&(b.error=b.error||"URI is not a "+h.reference+" reference.");var N=ye[(h.scheme||b.scheme||"").toLowerCase()];if(!h.unicodeSupport&&(!N||!N.unicodeSupport)){if(b.host&&(h.domainHost||N&&N.domainHost))try{b.host=se.toASCII(b.host.replace(w.PCT_ENCODED,Ie).toLowerCase())}catch(K){b.error=b.error||"Host's domain name can not be converted to ASCII via punycode: "+K}xr(b,u)}else xr(b,w);N&&N.parse&&N.parse(b,h)}else b.error=b.error||"URI can not be parsed.";return b}function wr(_,h){var b=h.iri!==!1?c:u,w=[];return _.userinfo!==void 0&&(w.push(_.userinfo),w.push("@")),_.host!==void 0&&w.push(ve(_e(String(_.host),b),b).replace(b.IPV6ADDRESS,function(E,N,K){return"["+N+(K?"%25"+K:"")+"]"})),(typeof _.port=="number"||typeof _.port=="string")&&(w.push(":"),w.push(String(_.port))),w.length?w.join(""):void 0}var cr=/^\.\.?\//,Dr=/^\/\.(\/|$)/,jr=/^\/\.\.(\/|$)/,Pe=/^\/?(?:.|\n)*?(?=\/|$)/;function ze(_){for(var h=[];_.length;)if(_.match(cr))_=_.replace(cr,"");else if(_.match(Dr))_=_.replace(Dr,"/");else if(_.match(jr))_=_.replace(jr,"/"),h.pop();else if(_==="."||_==="..")_="";else{var b=_.match(Pe);if(b){var w=b[0];_=_.slice(w.length),h.push(w)}else throw new Error("Unexpected dot segment condition")}return h.join("")}function je(_){var h=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},b=h.iri?c:u,w=[],E=ye[(h.scheme||_.scheme||"").toLowerCase()];if(E&&E.serialize&&E.serialize(_,h),_.host&&!b.IPV6ADDRESS.test(_.host)){if(h.domainHost||E&&E.domainHost)try{_.host=h.iri?se.toUnicode(_.host):se.toASCII(_.host.replace(b.PCT_ENCODED,Ie).toLowerCase())}catch(ae){_.error=_.error||"Host's domain name can not be converted to "+(h.iri?"Unicode":"ASCII")+" via punycode: "+ae}}xr(_,b),h.reference!=="suffix"&&_.scheme&&(w.push(_.scheme),w.push(":"));var N=wr(_,h);if(N!==void 0&&(h.reference!=="suffix"&&w.push("//"),w.push(N),_.path&&_.path.charAt(0)!=="/"&&w.push("/")),_.path!==void 0){var K=_.path;!h.absolutePath&&(!E||!E.absolutePath)&&(K=ze(K)),N===void 0&&(K=K.replace(/^\/\//,"/%2F")),w.push(K)}return _.query!==void 0&&(w.push("?"),w.push(_.query)),_.fragment!==void 0&&(w.push("#"),w.push(_.fragment)),w.join("")}function Ce(_,h){var b=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},w=arguments[3],E={};return w||(_=oe(je(_,b),b),h=oe(je(h,b),b)),b=b||{},!b.tolerant&&h.scheme?(E.scheme=h.scheme,E.userinfo=h.userinfo,E.host=h.host,E.port=h.port,E.path=ze(h.path||""),E.query=h.query):(h.userinfo!==void 0||h.host!==void 0||h.port!==void 0?(E.userinfo=h.userinfo,E.host=h.host,E.port=h.port,E.path=ze(h.path||""),E.query=h.query):(h.path?(h.path.charAt(0)==="/"?E.path=ze(h.path):((_.userinfo!==void 0||_.host!==void 0||_.port!==void 0)&&!_.path?E.path="/"+h.path:_.path?E.path=_.path.slice(0,_.path.lastIndexOf("/")+1)+h.path:E.path=h.path,E.path=ze(E.path)),E.query=h.query):(E.path=_.path,h.query!==void 0?E.query=h.query:E.query=_.query),E.userinfo=_.userinfo,E.host=_.host,E.port=_.port),E.scheme=_.scheme),E.fragment=h.fragment,E}function rr(_,h,b){var w=o({scheme:"null"},b);return je(Ce(oe(_,w),oe(h,w),w,!0),w)}function Me(_,h){return typeof _=="string"?_=je(oe(_,h),h):s(_)==="object"&&(_=oe(je(_,h),h)),_}function sa(_,h,b){return typeof _=="string"?_=je(oe(_,b),b):s(_)==="object"&&(_=je(_,b)),typeof h=="string"?h=je(oe(h,b),b):s(h)==="object"&&(h=je(h,b)),_===h}function ns(_,h){return _&&_.toString().replace(!h||!h.iri?u.ESCAPE:c.ESCAPE,Ee)}function Ge(_,h){return _&&_.toString().replace(!h||!h.iri?u.PCT_ENCODED:c.PCT_ENCODED,Ie)}var $t={scheme:"http",domainHost:!0,parse:function(h,b){return h.host||(h.error=h.error||"HTTP URIs must have a host."),h},serialize:function(h,b){var w=String(h.scheme).toLowerCase()==="https";return(h.port===(w?443:80)||h.port==="")&&(h.port=void 0),h.path||(h.path="/"),h}},On={scheme:"https",domainHost:$t.domainHost,parse:$t.parse,serialize:$t.serialize};function Tn(_){return typeof _.secure=="boolean"?_.secure:String(_.scheme).toLowerCase()==="wss"}var At={scheme:"ws",domainHost:!0,parse:function(h,b){var w=h;return w.secure=Tn(w),w.resourceName=(w.path||"/")+(w.query?"?"+w.query:""),w.path=void 0,w.query=void 0,w},serialize:function(h,b){if((h.port===(Tn(h)?443:80)||h.port==="")&&(h.port=void 0),typeof h.secure=="boolean"&&(h.scheme=h.secure?"wss":"ws",h.secure=void 0),h.resourceName){var w=h.resourceName.split("?"),E=f(w,2),N=E[0],K=E[1];h.path=N&&N!=="/"?N:void 0,h.query=K,h.resourceName=void 0}return h.fragment=void 0,h}},$n={scheme:"wss",domainHost:At.domainHost,parse:At.parse,serialize:At.serialize},hu={},pu=!0,An="[A-Za-z0-9\\-\\.\\_\\~"+(pu?"\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF":"")+"]",tr="[0-9A-Fa-f]",mu=t(t("%[EFef]"+tr+"%"+tr+tr+"%"+tr+tr)+"|"+t("%[89A-Fa-f]"+tr+"%"+tr+tr)+"|"+t("%"+tr+tr)),vu="[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]",gu="[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]",yu=e(gu,'[\\"\\\\]'),_u="[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]",bu=new RegExp(An,"g"),lt=new RegExp(mu,"g"),xu=new RegExp(e("[^]",vu,"[\\.]",'[\\"]',yu),"g"),In=new RegExp(e("[^]",An,_u),"g"),wu=In;function os(_){var h=Ie(_);return h.match(bu)?h:_}var Cn={scheme:"mailto",parse:function(h,b){var w=h,E=w.to=w.path?w.path.split(","):[];if(w.path=void 0,w.query){for(var N=!1,K={},ae=w.query.split("&"),ie=0,be=ae.length;ie<be;++ie){var te=ae[ie].split("=");switch(te[0]){case"to":for(var he=te[1].split(","),xe=0,de=he.length;xe<de;++xe)E.push(he[xe]);break;case"subject":w.subject=Ge(te[1],b);break;case"body":w.body=Ge(te[1],b);break;default:N=!0,K[Ge(te[0],b)]=Ge(te[1],b);break}}N&&(w.headers=K)}w.query=void 0;for(var ne=0,pe=E.length;ne<pe;++ne){var ce=E[ne].split("@");if(ce[0]=Ge(ce[0]),b.unicodeSupport)ce[1]=Ge(ce[1],b).toLowerCase();else try{ce[1]=se.toASCII(Ge(ce[1],b).toLowerCase())}catch(Nr){w.error=w.error||"Email address's domain name can not be converted to ASCII via punycode: "+Nr}E[ne]=ce.join("@")}return w},serialize:function(h,b){var w=h,E=n(h.to);if(E){for(var N=0,K=E.length;N<K;++N){var ae=String(E[N]),ie=ae.lastIndexOf("@"),be=ae.slice(0,ie).replace(lt,os).replace(lt,r).replace(xu,Ee),te=ae.slice(ie+1);try{te=b.iri?se.toUnicode(te):se.toASCII(Ge(te,b).toLowerCase())}catch(ne){w.error=w.error||"Email address's domain name can not be converted to "+(b.iri?"Unicode":"ASCII")+" via punycode: "+ne}E[N]=be+"@"+te}w.path=E.join(",")}var he=h.headers=h.headers||{};h.subject&&(he.subject=h.subject),h.body&&(he.body=h.body);var xe=[];for(var de in he)he[de]!==hu[de]&&xe.push(de.replace(lt,os).replace(lt,r).replace(In,Ee)+"="+he[de].replace(lt,os).replace(lt,r).replace(wu,Ee));return xe.length&&(w.query=xe.join("&")),w}},Eu=/^([^\:]+)\:(.*)/,kn={scheme:"urn",parse:function(h,b){var w=h.path&&h.path.match(Eu),E=h;if(w){var N=b.scheme||E.scheme||"urn",K=w[1].toLowerCase(),ae=w[2],ie=N+":"+(b.nid||K),be=ye[ie];E.nid=K,E.nss=ae,E.path=void 0,be&&(E=be.parse(E,b))}else E.error=E.error||"URN can not be parsed.";return E},serialize:function(h,b){var w=b.scheme||h.scheme||"urn",E=h.nid,N=w+":"+(b.nid||E),K=ye[N];K&&(h=K.serialize(h,b));var ae=h,ie=h.nss;return ae.path=(E||b.nid)+":"+ie,ae}},Pu=/^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/,Dn={scheme:"urn:uuid",parse:function(h,b){var w=h;return w.uuid=w.nss,w.nss=void 0,!b.tolerant&&(!w.uuid||!w.uuid.match(Pu))&&(w.error=w.error||"UUID is not valid."),w},serialize:function(h,b){var w=h;return w.nss=(h.uuid||"").toLowerCase(),w}};ye[$t.scheme]=$t,ye[On.scheme]=On,ye[At.scheme]=At,ye[$n.scheme]=$n,ye[Cn.scheme]=Cn,ye[kn.scheme]=kn,ye[Dn.scheme]=Dn,a.SCHEMES=ye,a.pctEncChar=Ee,a.pctDecChars=Ie,a.parse=oe,a.removeDotSegments=ze,a.serialize=je,a.resolveComponents=Ce,a.resolve=rr,a.normalize=Me,a.equal=sa,a.escapeComponent=ns,a.unescapeComponent=Ge,Object.defineProperty(a,"__esModule",{value:!0})})});var Sa=z((Tv,yo)=>{"use strict";yo.exports=function a(e,t){if(e===t)return!0;if(e&&t&&typeof e=="object"&&typeof t=="object"){if(e.constructor!==t.constructor)return!1;var s,r,n;if(Array.isArray(e)){if(s=e.length,s!=t.length)return!1;for(r=s;r--!==0;)if(!a(e[r],t[r]))return!1;return!0}if(e.constructor===RegExp)return e.source===t.source&&e.flags===t.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===t.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===t.toString();if(n=Object.keys(e),s=n.length,s!==Object.keys(t).length)return!1;for(r=s;r--!==0;)if(!Object.prototype.hasOwnProperty.call(t,n[r]))return!1;for(r=s;r--!==0;){var o=n[r];if(!a(e[o],t[o]))return!1}return!0}return e!==e&&t!==t}});var bo=z(($v,_o)=>{"use strict";_o.exports=function(e){for(var t=0,s=e.length,r=0,n;r<s;)t++,n=e.charCodeAt(r++),n>=55296&&n<=56319&&r<s&&(n=e.charCodeAt(r),(n&64512)==56320&&r++);return t}});var at=z((Av,Eo)=>{"use strict";Eo.exports={copy:Nf,checkDataType:As,checkDataTypes:Ff,coerceToTypes:Lf,toHash:Cs,getProperty:ks,escapeQuotes:Ds,equal:Sa(),ucs2length:bo(),varOccurences:Uf,varReplace:zf,schemaHasRules:Vf,schemaHasRulesExcept:Hf,schemaUnknownRules:Zf,toQuotedString:Is,getPathExpr:Bf,getPath:Jf,getData:Gf,unescapeFragment:Wf,unescapeJsonPointer:Ns,escapeFragment:Yf,escapeJsonPointer:js};function Nf(a,e){e=e||{};for(var t in a)e[t]=a[t];return e}function As(a,e,t,s){var r=s?" !== ":" === ",n=s?" || ":" && ",o=s?"!":"",l=s?"":"!";switch(a){case"null":return e+r+"null";case"array":return o+"Array.isArray("+e+")";case"object":return"("+o+e+n+"typeof "+e+r+'"object"'+n+l+"Array.isArray("+e+"))";case"integer":return"(typeof "+e+r+'"number"'+n+l+"("+e+" % 1)"+n+e+r+e+(t?n+o+"isFinite("+e+")":"")+")";case"number":return"(typeof "+e+r+'"'+a+'"'+(t?n+o+"isFinite("+e+")":"")+")";default:return"typeof "+e+r+'"'+a+'"'}}function Ff(a,e,t){switch(a.length){case 1:return As(a[0],e,t,!0);default:var s="",r=Cs(a);r.array&&r.object&&(s=r.null?"(":"(!"+e+" || ",s+="typeof "+e+' !== "object")',delete r.null,delete r.array,delete r.object),r.number&&delete r.integer;for(var n in r)s+=(s?" && ":"")+As(n,e,t,!0);return s}}var xo=Cs(["string","number","integer","boolean","null"]);function Lf(a,e){if(Array.isArray(e)){for(var t=[],s=0;s<e.length;s++){var r=e[s];(xo[r]||a==="array"&&r==="array")&&(t[t.length]=r)}if(t.length)return t}else{if(xo[e])return[e];if(a==="array"&&e==="array")return["array"]}}function Cs(a){for(var e={},t=0;t<a.length;t++)e[a[t]]=!0;return e}var Mf=/^[a-z$_][a-z$_0-9]*$/i,qf=/'|\\/g;function ks(a){return typeof a=="number"?"["+a+"]":Mf.test(a)?"."+a:"['"+Ds(a)+"']"}function Ds(a){return a.replace(qf,"\\$&").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\f/g,"\\f").replace(/\t/g,"\\t")}function Uf(a,e){e+="[^0-9]";var t=a.match(new RegExp(e,"g"));return t?t.length:0}function zf(a,e,t){return e+="([^0-9])",t=t.replace(/\$/g,"$$$$"),a.replace(new RegExp(e,"g"),t+"$1")}function Vf(a,e){if(typeof a=="boolean")return!a;for(var t in a)if(e[t])return!0}function Hf(a,e,t){if(typeof a=="boolean")return!a&&t!="not";for(var s in a)if(s!=t&&e[s])return!0}function Zf(a,e){if(typeof a!="boolean"){for(var t in a)if(!e[t])return t}}function Is(a){return"'"+Ds(a)+"'"}function Bf(a,e,t,s){var r=t?"'/' + "+e+(s?"":".replace(/~/g, '~0').replace(/\\//g, '~1')"):s?"'[' + "+e+" + ']'":"'[\\'' + "+e+" + '\\']'";return wo(a,r)}function Jf(a,e,t){var s=Is(t?"/"+js(e):ks(e));return wo(a,s)}var Qf=/^\/(?:[^~]|~0|~1)*$/,Kf=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function Gf(a,e,t){var s,r,n,o;if(a==="")return"rootData";if(a[0]=="/"){if(!Qf.test(a))throw new Error("Invalid JSON-pointer: "+a);r=a,n="rootData"}else{if(o=a.match(Kf),!o)throw new Error("Invalid JSON-pointer: "+a);if(s=+o[1],r=o[2],r=="#"){if(s>=e)throw new Error("Cannot access property/index "+s+" levels up, current level is "+e);return t[e-s]}if(s>e)throw new Error("Cannot access data "+s+" levels up, current level is "+e);if(n="data"+(e-s||""),!r)return n}for(var l=n,u=r.split("/"),c=0;c<u.length;c++){var f=u[c];f&&(n+=ks(Ns(f)),l+=" && "+n)}return l}function wo(a,e){return a=='""'?e:(a+" + "+e).replace(/([^\\])' \+ '/g,"$1")}function Wf(a){return Ns(decodeURIComponent(a))}function Yf(a){return encodeURIComponent(js(a))}function js(a){return a.replace(/~/g,"~0").replace(/\//g,"~1")}function Ns(a){return a.replace(/~1/g,"/").replace(/~0/g,"~")}});var Fs=z((Iv,Po)=>{"use strict";var Xf=at();Po.exports=eh;function eh(a){Xf.copy(a,this)}});var Ro=z((Cv,So)=>{"use strict";var Tr=So.exports=function(a,e,t){typeof e=="function"&&(t=e,e={}),t=e.cb||t;var s=typeof t=="function"?t:t.pre||function(){},r=t.post||function(){};Ra(e,s,r,a,"",a)};Tr.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0};Tr.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};Tr.propsKeywords={definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};Tr.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0};function Ra(a,e,t,s,r,n,o,l,u,c){if(s&&typeof s=="object"&&!Array.isArray(s)){e(s,r,n,o,l,u,c);for(var f in s){var p=s[f];if(Array.isArray(p)){if(f in Tr.arrayKeywords)for(var g=0;g<p.length;g++)Ra(a,e,t,p[g],r+"/"+f+"/"+g,n,r,f,s,g)}else if(f in Tr.propsKeywords){if(p&&typeof p=="object")for(var d in p)Ra(a,e,t,p[d],r+"/"+f+"/"+rh(d),n,r,f,s,d)}else(f in Tr.keywords||a.allKeys&&!(f in Tr.skipKeywords))&&Ra(a,e,t,p,r+"/"+f,n,r,f,s)}t(s,r,n,o,l,u,c)}}function rh(a){return a.replace(/~/g,"~0").replace(/\//g,"~1")}});var Ca=z((kv,Ao)=>{"use strict";var Ut=go(),Oo=Sa(),Aa=at(),Oa=Fs(),th=Ro();Ao.exports=Ar;Ar.normalizeId=$r;Ar.fullPath=Ta;Ar.url=$a;Ar.ids=ih;Ar.inlineRef=Ls;Ar.schema=Ia;function Ar(a,e,t){var s=this._refs[t];if(typeof s=="string")if(this._refs[s])s=this._refs[s];else return Ar.call(this,a,e,s);if(s=s||this._schemas[t],s instanceof Oa)return Ls(s.schema,this._opts.inlineRefs)?s.schema:s.validate||this._compile(s);var r=Ia.call(this,e,t),n,o,l;return r&&(n=r.schema,e=r.root,l=r.baseId),n instanceof Oa?o=n.validate||a.call(this,n.schema,e,void 0,l):n!==void 0&&(o=Ls(n,this._opts.inlineRefs)?n:a.call(this,n,e,void 0,l)),o}function Ia(a,e){var t=Ut.parse(e),s=$o(t),r=Ta(this._getId(a.schema));if(Object.keys(a.schema).length===0||s!==r){var n=$r(s),o=this._refs[n];if(typeof o=="string")return ah.call(this,a,o,t);if(o instanceof Oa)o.validate||this._compile(o),a=o;else if(o=this._schemas[n],o instanceof Oa){if(o.validate||this._compile(o),n==$r(e))return{schema:o,root:a,baseId:r};a=o}else return;if(!a.schema)return;r=Ta(this._getId(a.schema))}return To.call(this,t,r,a.schema,a)}function ah(a,e,t){var s=Ia.call(this,a,e);if(s){var r=s.schema,n=s.baseId;a=s.root;var o=this._getId(r);return o&&(n=$a(n,o)),To.call(this,t,n,r,a)}}var sh=Aa.toHash(["properties","patternProperties","enum","dependencies","definitions"]);function To(a,e,t,s){if(a.fragment=a.fragment||"",a.fragment.slice(0,1)=="/"){for(var r=a.fragment.split("/"),n=1;n<r.length;n++){var o=r[n];if(o){if(o=Aa.unescapeFragment(o),t=t[o],t===void 0)break;var l;if(!sh[o]&&(l=this._getId(t),l&&(e=$a(e,l)),t.$ref)){var u=$a(e,t.$ref),c=Ia.call(this,s,u);c&&(t=c.schema,s=c.root,e=c.baseId)}}}if(t!==void 0&&t!==s.schema)return{schema:t,root:s,baseId:e}}}var nh=Aa.toHash(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum"]);function Ls(a,e){if(e===!1)return!1;if(e===void 0||e===!0)return Ms(a);if(e)return qs(a)<=e}function Ms(a){var e;if(Array.isArray(a)){for(var t=0;t<a.length;t++)if(e=a[t],typeof e=="object"&&!Ms(e))return!1}else for(var s in a)if(s=="$ref"||(e=a[s],typeof e=="object"&&!Ms(e)))return!1;return!0}function qs(a){var e=0,t;if(Array.isArray(a)){for(var s=0;s<a.length;s++)if(t=a[s],typeof t=="object"&&(e+=qs(t)),e==1/0)return 1/0}else for(var r in a){if(r=="$ref")return 1/0;if(nh[r])e++;else if(t=a[r],typeof t=="object"&&(e+=qs(t)+1),e==1/0)return 1/0}return e}function Ta(a,e){e!==!1&&(a=$r(a));var t=Ut.parse(a);return $o(t)}function $o(a){return Ut.serialize(a).split("#")[0]+"#"}var oh=/#\/?$/;function $r(a){return a?a.replace(oh,""):""}function $a(a,e){return e=$r(e),Ut.resolve(a,e)}function ih(a){var e=$r(this._getId(a)),t={"":e},s={"":Ta(e,!1)},r={},n=this;return th(a,{allKeys:!0},function(o,l,u,c,f,p,g){if(l!==""){var d=n._getId(o),y=t[c],m=s[c]+"/"+f;if(g!==void 0&&(m+="/"+(typeof g=="number"?g:Aa.escapeFragment(g))),typeof d=="string"){d=y=$r(y?Ut.resolve(y,d):d);var v=n._refs[d];if(typeof v=="string"&&(v=n._refs[v]),v&&v.schema){if(!Oo(o,v.schema))throw new Error('id "'+d+'" resolves to more than one schema')}else if(d!=$r(m))if(d[0]=="#"){if(r[d]&&!Oo(o,r[d]))throw new Error('id "'+d+'" resolves to more than one schema');r[d]=o}else n._refs[d]=m}t[l]=y,s[l]=m}}),r}});var ka=z((Dv,Co)=>{"use strict";var Us=Ca();Co.exports={Validation:Io(lh),MissingRef:Io(zs)};function lh(a){this.message="validation failed",this.errors=a,this.ajv=this.validation=!0}zs.message=function(a,e){return"can't resolve reference "+e+" from id "+a};function zs(a,e,t){this.message=t||zs.message(a,e),this.missingRef=Us.url(a,e),this.missingSchema=Us.normalizeId(Us.fullPath(this.missingRef))}function Io(a){return a.prototype=Object.create(Error.prototype),a.prototype.constructor=a,a}});var Vs=z((jv,ko)=>{"use strict";ko.exports=function(a,e){e||(e={}),typeof e=="function"&&(e={cmp:e});var t=typeof e.cycles=="boolean"?e.cycles:!1,s=e.cmp&&function(n){return function(o){return function(l,u){var c={key:l,value:o[l]},f={key:u,value:o[u]};return n(c,f)}}}(e.cmp),r=[];return function n(o){if(o&&o.toJSON&&typeof o.toJSON=="function"&&(o=o.toJSON()),o!==void 0){if(typeof o=="number")return isFinite(o)?""+o:"null";if(typeof o!="object")return JSON.stringify(o);var l,u;if(Array.isArray(o)){for(u="[",l=0;l<o.length;l++)l&&(u+=","),u+=n(o[l])||"null";return u+"]"}if(o===null)return"null";if(r.indexOf(o)!==-1){if(t)return JSON.stringify("__cycle__");throw new TypeError("Converting circular structure to JSON")}var c=r.push(o)-1,f=Object.keys(o).sort(s&&s(o));for(u="",l=0;l<f.length;l++){var p=f[l],g=n(o[p]);g&&(u&&(u+=","),u+=JSON.stringify(p)+":"+g)}return r.splice(c,1),"{"+u+"}"}}(a)}});var Hs=z((Nv,Do)=>{"use strict";Do.exports=function(e,t,s){var r="",n=e.schema.$async===!0,o=e.util.schemaHasRulesExcept(e.schema,e.RULES.all,"$ref"),l=e.self._getId(e.schema);if(e.opts.strictKeywords){var u=e.util.schemaUnknownRules(e.schema,e.RULES.keywords);if(u){var c="unknown keyword: "+u;if(e.opts.strictKeywords==="log")e.logger.warn(c);else throw new Error(c)}}if(e.isTop&&(r+=" var validate = ",n&&(e.async=!0,r+="async "),r+="function(data, dataPath, parentData, parentDataProperty, rootData) { 'use strict'; ",l&&(e.opts.sourceCode||e.opts.processCode)&&(r+=" "+("/*# sourceURL="+l+" */")+" ")),typeof e.schema=="boolean"||!(o||e.schema.$ref)){var t="false schema",f=e.level,p=e.dataLevel,g=e.schema[t],d=e.schemaPath+e.util.getProperty(t),y=e.errSchemaPath+"/"+t,A=!e.opts.allErrors,q,m="data"+(p||""),O="valid"+f;if(e.schema===!1){e.isTop?A=!0:r+=" var "+O+" = false; ";var v=v||[];v.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(q||"false schema")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(y)+" , params: {} ",e.opts.messages!==!1&&(r+=" , message: 'boolean schema is false' "),e.opts.verbose&&(r+=" , schema: false , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var x=r;r=v.pop(),!e.compositeRule&&A?e.async?r+=" throw new ValidationError(["+x+"]); ":r+=" validate.errors = ["+x+"]; return false; ":r+=" var err = "+x+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}else e.isTop?n?r+=" return data; ":r+=" validate.errors = null; return true; ":r+=" var "+O+" = true; ";return e.isTop&&(r+=" }; return validate; "),r}if(e.isTop){var S=e.isTop,f=e.level=0,p=e.dataLevel=0,m="data";if(e.rootId=e.resolve.fullPath(e.self._getId(e.root.schema)),e.baseId=e.baseId||e.rootId,delete e.isTop,e.dataPathArr=[""],e.schema.default!==void 0&&e.opts.useDefaults&&e.opts.strictDefaults){var P="default is ignored in the schema root";if(e.opts.strictDefaults==="log")e.logger.warn(P);else throw new Error(P)}r+=" var vErrors = null; ",r+=" var errors = 0; ",r+=" if (rootData === undefined) rootData = data; "}else{var f=e.level,p=e.dataLevel,m="data"+(p||"");if(l&&(e.baseId=e.resolve.url(e.baseId,l)),n&&!e.async)throw new Error("async schema in sync schema");r+=" var errs_"+f+" = errors;"}var O="valid"+f,A=!e.opts.allErrors,I="",H="",q,C=e.schema.type,U=Array.isArray(C);if(C&&e.opts.nullable&&e.schema.nullable===!0&&(U?C.indexOf("null")==-1&&(C=C.concat("null")):C!="null"&&(C=[C,"null"],U=!0)),U&&C.length==1&&(C=C[0],U=!1),e.schema.$ref&&o){if(e.opts.extendRefs=="fail")throw new Error('$ref: validation keywords used in schema at path "'+e.errSchemaPath+'" (see option extendRefs)');e.opts.extendRefs!==!0&&(o=!1,e.logger.warn('$ref: keywords ignored in schema at path "'+e.errSchemaPath+'"'))}if(e.schema.$comment&&e.opts.$comment&&(r+=" "+e.RULES.all.$comment.code(e,"$comment")),C){if(e.opts.coerceTypes)var M=e.util.coerceToTypes(e.opts.coerceTypes,C);var F=e.RULES.types[C];if(M||U||F===!0||F&&!Pe(F)){var d=e.schemaPath+".type",y=e.errSchemaPath+"/type",d=e.schemaPath+".type",y=e.errSchemaPath+"/type",$=U?"checkDataTypes":"checkDataType";if(r+=" if ("+e.util[$](C,m,e.opts.strictNumbers,!0)+") { ",M){var k="dataType"+f,L="coerced"+f;r+=" var "+k+" = typeof "+m+"; var "+L+" = undefined; ",e.opts.coerceTypes=="array"&&(r+=" if ("+k+" == 'object' && Array.isArray("+m+") && "+m+".length == 1) { "+m+" = "+m+"[0]; "+k+" = typeof "+m+"; if ("+e.util.checkDataType(e.schema.type,m,e.opts.strictNumbers)+") "+L+" = "+m+"; } "),r+=" if ("+L+" !== undefined) ; ";var le=M;if(le)for(var Y,re=-1,W=le.length-1;re<W;)Y=le[re+=1],Y=="string"?r+=" else if ("+k+" == 'number' || "+k+" == 'boolean') "+L+" = '' + "+m+"; else if ("+m+" === null) "+L+" = ''; ":Y=="number"||Y=="integer"?(r+=" else if ("+k+" == 'boolean' || "+m+" === null || ("+k+" == 'string' && "+m+" && "+m+" == +"+m+" ",Y=="integer"&&(r+=" && !("+m+" % 1)"),r+=")) "+L+" = +"+m+"; "):Y=="boolean"?r+=" else if ("+m+" === 'false' || "+m+" === 0 || "+m+" === null) "+L+" = false; else if ("+m+" === 'true' || "+m+" === 1) "+L+" = true; ":Y=="null"?r+=" else if ("+m+" === '' || "+m+" === 0 || "+m+" === false) "+L+" = null; ":e.opts.coerceTypes=="array"&&Y=="array"&&(r+=" else if ("+k+" == 'string' || "+k+" == 'number' || "+k+" == 'boolean' || "+m+" == null) "+L+" = ["+m+"]; ");r+=" else { ";var v=v||[];v.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(q||"type")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(y)+" , params: { type: '",U?r+=""+C.join(","):r+=""+C,r+="' } ",e.opts.messages!==!1&&(r+=" , message: 'should be ",U?r+=""+C.join(","):r+=""+C,r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var x=r;r=v.pop(),!e.compositeRule&&A?e.async?r+=" throw new ValidationError(["+x+"]); ":r+=" validate.errors = ["+x+"]; return false; ":r+=" var err = "+x+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } if ("+L+" !== undefined) { ";var Z=p?"data"+(p-1||""):"parentData",me=p?e.dataPathArr[p]:"parentDataProperty";r+=" "+m+" = "+L+"; ",p||(r+="if ("+Z+" !== undefined)"),r+=" "+Z+"["+me+"] = "+L+"; } "}else{var v=v||[];v.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(q||"type")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(y)+" , params: { type: '",U?r+=""+C.join(","):r+=""+C,r+="' } ",e.opts.messages!==!1&&(r+=" , message: 'should be ",U?r+=""+C.join(","):r+=""+C,r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var x=r;r=v.pop(),!e.compositeRule&&A?e.async?r+=" throw new ValidationError(["+x+"]); ":r+=" validate.errors = ["+x+"]; return false; ":r+=" var err = "+x+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}r+=" } "}}if(e.schema.$ref&&!o)r+=" "+e.RULES.all.$ref.code(e,"$ref")+" ",A&&(r+=" } if (errors === ",S?r+="0":r+="errs_"+f,r+=") { ",H+="}");else{var Re=e.RULES;if(Re){for(var F,Ae=-1,se=Re.length-1;Ae<se;)if(F=Re[Ae+=1],Pe(F)){if(F.type&&(r+=" if ("+e.util.checkDataType(F.type,m,e.opts.strictNumbers)+") { "),e.opts.useDefaults){if(F.type=="object"&&e.schema.properties){var g=e.schema.properties,ye=Object.keys(g),Ee=ye;if(Ee)for(var Ie,xr=-1,lr=Ee.length-1;xr<lr;){Ie=Ee[xr+=1];var _e=g[Ie];if(_e.default!==void 0){var ve=m+e.util.getProperty(Ie);if(e.compositeRule){if(e.opts.strictDefaults){var P="default is ignored for: "+ve;if(e.opts.strictDefaults==="log")e.logger.warn(P);else throw new Error(P)}}else r+=" if ("+ve+" === undefined ",e.opts.useDefaults=="empty"&&(r+=" || "+ve+" === null || "+ve+" === '' "),r+=" ) "+ve+" = ",e.opts.useDefaults=="shared"?r+=" "+e.useDefault(_e.default)+" ":r+=" "+JSON.stringify(_e.default)+" ",r+="; "}}}else if(F.type=="array"&&Array.isArray(e.schema.items)){var kr=e.schema.items;if(kr){for(var _e,re=-1,Oe=kr.length-1;re<Oe;)if(_e=kr[re+=1],_e.default!==void 0){var ve=m+"["+re+"]";if(e.compositeRule){if(e.opts.strictDefaults){var P="default is ignored for: "+ve;if(e.opts.strictDefaults==="log")e.logger.warn(P);else throw new Error(P)}}else r+=" if ("+ve+" === undefined ",e.opts.useDefaults=="empty"&&(r+=" || "+ve+" === null || "+ve+" === '' "),r+=" ) "+ve+" = ",e.opts.useDefaults=="shared"?r+=" "+e.useDefault(_e.default)+" ":r+=" "+JSON.stringify(_e.default)+" ",r+="; "}}}}var oe=F.rules;if(oe){for(var wr,cr=-1,Dr=oe.length-1;cr<Dr;)if(wr=oe[cr+=1],ze(wr)){var jr=wr.code(e,wr.keyword,F.type);jr&&(r+=" "+jr+" ",A&&(I+="}"))}}if(A&&(r+=" "+I+" ",I=""),F.type&&(r+=" } ",C&&C===F.type&&!M)){r+=" else { ";var d=e.schemaPath+".type",y=e.errSchemaPath+"/type",v=v||[];v.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(q||"type")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(y)+" , params: { type: '",U?r+=""+C.join(","):r+=""+C,r+="' } ",e.opts.messages!==!1&&(r+=" , message: 'should be ",U?r+=""+C.join(","):r+=""+C,r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var x=r;r=v.pop(),!e.compositeRule&&A?e.async?r+=" throw new ValidationError(["+x+"]); ":r+=" validate.errors = ["+x+"]; return false; ":r+=" var err = "+x+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } "}A&&(r+=" if (errors === ",S?r+="0":r+="errs_"+f,r+=") { ",H+="}")}}}A&&(r+=" "+H+" "),S?(n?(r+=" if (errors === 0) return data; ",r+=" else throw new ValidationError(vErrors); "):(r+=" validate.errors = vErrors; ",r+=" return errors === 0; "),r+=" }; return validate;"):r+=" var "+O+" = errors === errs_"+f+";";function Pe(Ce){for(var rr=Ce.rules,Me=0;Me<rr.length;Me++)if(ze(rr[Me]))return!0}function ze(Ce){return e.schema[Ce.keyword]!==void 0||Ce.implements&&je(Ce)}function je(Ce){for(var rr=Ce.implements,Me=0;Me<rr.length;Me++)if(e.schema[rr[Me]]!==void 0)return!0}return r}});var Mo=z((Fv,Lo)=>{"use strict";var Da=Ca(),Na=at(),No=ka(),ch=Vs(),jo=Hs(),uh=Na.ucs2length,dh=Sa(),fh=No.Validation;Lo.exports=Zs;function Zs(a,e,t,s){var r=this,n=this._opts,o=[void 0],l={},u=[],c={},f=[],p={},g=[];e=e||{schema:a,refVal:o,refs:l};var d=hh.call(this,a,e,s),y=this._compilations[d.index];if(d.compiling)return y.callValidate=P;var m=this._formats,v=this.RULES;try{var x=O(a,e,t,s);y.validate=x;var S=y.callValidate;return S&&(S.schema=x.schema,S.errors=null,S.refs=x.refs,S.refVal=x.refVal,S.root=x.root,S.$async=x.$async,n.sourceCode&&(S.source=x.source)),x}finally{ph.call(this,a,e,s)}function P(){var $=y.validate,k=$.apply(this,arguments);return P.errors=$.errors,k}function O($,k,L,le){var Y=!k||k&&k.schema==$;if(k.schema!=e.schema)return Zs.call(r,$,k,L,le);var re=$.$async===!0,W=jo({isTop:!0,schema:$,isRoot:Y,baseId:le,root:k,schemaPath:"",errSchemaPath:"#",errorPath:'""',MissingRefError:No.MissingRef,RULES:v,validate:jo,util:Na,resolve:Da,resolveRef:A,usePattern:U,useDefault:M,useCustomRule:F,opts:n,formats:m,logger:r.logger,self:r});W=ja(o,gh)+ja(u,mh)+ja(f,vh)+ja(g,yh)+W,n.processCode&&(W=n.processCode(W,$));var Z;try{var me=new Function("self","RULES","formats","root","refVal","defaults","customRules","equal","ucs2length","ValidationError",W);Z=me(r,v,m,e,o,f,g,dh,uh,fh),o[0]=Z}catch(Re){throw r.logger.error("Error compiling schema, function code:",W),Re}return Z.schema=$,Z.errors=null,Z.refs=l,Z.refVal=o,Z.root=Y?Z:k,re&&(Z.$async=!0),n.sourceCode===!0&&(Z.source={code:W,patterns:u,defaults:f}),Z}function A($,k,L){k=Da.url($,k);var le=l[k],Y,re;if(le!==void 0)return Y=o[le],re="refVal["+le+"]",C(Y,re);if(!L&&e.refs){var W=e.refs[k];if(W!==void 0)return Y=e.refVal[W],re=I(k,Y),C(Y,re)}re=I(k);var Z=Da.call(r,O,e,k);if(Z===void 0){var me=t&&t[k];me&&(Z=Da.inlineRef(me,n.inlineRefs)?me:Zs.call(r,me,e,t,$))}if(Z===void 0)H(k);else return q(k,Z),C(Z,re)}function I($,k){var L=o.length;return o[L]=k,l[$]=L,"refVal"+L}function H($){delete l[$]}function q($,k){var L=l[$];o[L]=k}function C($,k){return typeof $=="object"||typeof $=="boolean"?{code:k,schema:$,inline:!0}:{code:k,$async:$&&!!$.$async}}function U($){var k=c[$];return k===void 0&&(k=c[$]=u.length,u[k]=$),"pattern"+k}function M($){switch(typeof $){case"boolean":case"number":return""+$;case"string":return Na.toQuotedString($);case"object":if($===null)return"null";var k=ch($),L=p[k];return L===void 0&&(L=p[k]=f.length,f[L]=$),"default"+L}}function F($,k,L,le){if(r._opts.validateSchema!==!1){var Y=$.definition.dependencies;if(Y&&!Y.every(function(Ee){return Object.prototype.hasOwnProperty.call(L,Ee)}))throw new Error("parent schema must have all required keywords: "+Y.join(","));var re=$.definition.validateSchema;if(re){var W=re(k);if(!W){var Z="keyword schema is invalid: "+r.errorsText(re.errors);if(r._opts.validateSchema=="log")r.logger.error(Z);else throw new Error(Z)}}}var me=$.definition.compile,Re=$.definition.inline,Ae=$.definition.macro,se;if(me)se=me.call(r,k,L,le);else if(Ae)se=Ae.call(r,k,L,le),n.validateSchema!==!1&&r.validateSchema(se,!0);else if(Re)se=Re.call(r,le,$.keyword,k,L);else if(se=$.definition.validate,!se)return;if(se===void 0)throw new Error('custom keyword "'+$.keyword+'"failed to compile');var ye=g.length;return g[ye]=se,{code:"customRule"+ye,validate:se}}}function hh(a,e,t){var s=Fo.call(this,a,e,t);return s>=0?{index:s,compiling:!0}:(s=this._compilations.length,this._compilations[s]={schema:a,root:e,baseId:t},{index:s,compiling:!1})}function ph(a,e,t){var s=Fo.call(this,a,e,t);s>=0&&this._compilations.splice(s,1)}function Fo(a,e,t){for(var s=0;s<this._compilations.length;s++){var r=this._compilations[s];if(r.schema==a&&r.root==e&&r.baseId==t)return s}return-1}function mh(a,e){return"var pattern"+a+" = new RegExp("+Na.toQuotedString(e[a])+");"}function vh(a){return"var default"+a+" = defaults["+a+"];"}function gh(a,e){return e[a]===void 0?"":"var refVal"+a+" = refVal["+a+"];"}function yh(a){return"var customRule"+a+" = customRules["+a+"];"}function ja(a,e){if(!a.length)return"";for(var t="",s=0;s<a.length;s++)t+=e(s,a);return t}});var Uo=z((Lv,qo)=>{"use strict";var Fa=qo.exports=function(){this._cache={}};Fa.prototype.put=function(e,t){this._cache[e]=t};Fa.prototype.get=function(e){return this._cache[e]};Fa.prototype.del=function(e){delete this._cache[e]};Fa.prototype.clear=function(){this._cache={}}});var Xo=z((Mv,Yo)=>{"use strict";var _h=at(),bh=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,xh=[0,31,28,31,30,31,30,31,31,30,31,30,31],wh=/^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i,zo=/^(?=.{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,Eh=/^(?:[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,Ph=/^(?:[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,Vo=/^(?:(?:[^\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,Ho=/^(?:(?:http[s\u017F]?|ftp):\/\/)(?:(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+(?::(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?@)?(?:(?!10(?:\.[0-9]{1,3}){3})(?!127(?:\.[0-9]{1,3}){3})(?!169\.254(?:\.[0-9]{1,3}){2})(?!192\.168(?:\.[0-9]{1,3}){2})(?!172\.(?:1[6-9]|2[0-9]|3[01])(?:\.[0-9]{1,3}){2})(?:[1-9][0-9]?|1[0-9][0-9]|2[01][0-9]|22[0-3])(?:\.(?:1?[0-9]{1,2}|2[0-4][0-9]|25[0-5])){2}(?:\.(?:[1-9][0-9]?|1[0-9][0-9]|2[0-4][0-9]|25[0-4]))|(?:(?:(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-)*(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)(?:\.(?:(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-)*(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)*(?:\.(?:(?:[a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]){2,})))(?::[0-9]{2,5})?(?:\/(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?$/i,Zo=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,Bo=/^(?:\/(?:[^~/]|~0|~1)*)*$/,Jo=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,Qo=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/;Yo.exports=La;function La(a){return a=a=="full"?"full":"fast",_h.copy(La[a])}La.fast={date:/^\d\d\d\d-[0-1]\d-[0-3]\d$/,time:/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,"date-time":/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,"uri-template":Vo,url:Ho,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i,hostname:zo,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,ipv6:/^\s*(?:(?:(?:[0-9a-f]{1,4}:){7}(?:[0-9a-f]{1,4}|:))|(?:(?:[0-9a-f]{1,4}:){6}(?::[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){5}(?:(?:(?::[0-9a-f]{1,4}){1,2})|:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){4}(?:(?:(?::[0-9a-f]{1,4}){1,3})|(?:(?::[0-9a-f]{1,4})?:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){3}(?:(?:(?::[0-9a-f]{1,4}){1,4})|(?:(?::[0-9a-f]{1,4}){0,2}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){2}(?:(?:(?::[0-9a-f]{1,4}){1,5})|(?:(?::[0-9a-f]{1,4}){0,3}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){1}(?:(?:(?::[0-9a-f]{1,4}){1,6})|(?:(?::[0-9a-f]{1,4}){0,4}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?::(?:(?:(?::[0-9a-f]{1,4}){1,7})|(?:(?::[0-9a-f]{1,4}){0,5}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(?:%.+)?\s*$/i,regex:Wo,uuid:Zo,"json-pointer":Bo,"json-pointer-uri-fragment":Jo,"relative-json-pointer":Qo};La.full={date:Ko,time:Go,"date-time":Oh,uri:$h,"uri-reference":Ph,"uri-template":Vo,url:Ho,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:zo,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,ipv6:/^\s*(?:(?:(?:[0-9a-f]{1,4}:){7}(?:[0-9a-f]{1,4}|:))|(?:(?:[0-9a-f]{1,4}:){6}(?::[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){5}(?:(?:(?::[0-9a-f]{1,4}){1,2})|:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){4}(?:(?:(?::[0-9a-f]{1,4}){1,3})|(?:(?::[0-9a-f]{1,4})?:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){3}(?:(?:(?::[0-9a-f]{1,4}){1,4})|(?:(?::[0-9a-f]{1,4}){0,2}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){2}(?:(?:(?::[0-9a-f]{1,4}){1,5})|(?:(?::[0-9a-f]{1,4}){0,3}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){1}(?:(?:(?::[0-9a-f]{1,4}){1,6})|(?:(?::[0-9a-f]{1,4}){0,4}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?::(?:(?:(?::[0-9a-f]{1,4}){1,7})|(?:(?::[0-9a-f]{1,4}){0,5}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(?:%.+)?\s*$/i,regex:Wo,uuid:Zo,"json-pointer":Bo,"json-pointer-uri-fragment":Jo,"relative-json-pointer":Qo};function Sh(a){return a%4===0&&(a%100!==0||a%400===0)}function Ko(a){var e=a.match(bh);if(!e)return!1;var t=+e[1],s=+e[2],r=+e[3];return s>=1&&s<=12&&r>=1&&r<=(s==2&&Sh(t)?29:xh[s])}function Go(a,e){var t=a.match(wh);if(!t)return!1;var s=t[1],r=t[2],n=t[3],o=t[5];return(s<=23&&r<=59&&n<=59||s==23&&r==59&&n==60)&&(!e||o)}var Rh=/t|\s/i;function Oh(a){var e=a.split(Rh);return e.length==2&&Ko(e[0])&&Go(e[1],!0)}var Th=/\/|:/;function $h(a){return Th.test(a)&&Eh.test(a)}var Ah=/[^\\]\\Z/;function Wo(a){if(Ah.test(a))return!1;try{return new RegExp(a),!0}catch{return!1}}});var ri=z((qv,ei)=>{"use strict";ei.exports=function(e,t,s){var r=" ",n=e.level,o=e.dataLevel,l=e.schema[t],u=e.errSchemaPath+"/"+t,c=!e.opts.allErrors,f="data"+(o||""),p="valid"+n,g,d;if(l=="#"||l=="#/")e.isRoot?(g=e.async,d="validate"):(g=e.root.schema.$async===!0,d="root.refVal[0]");else{var y=e.resolveRef(e.baseId,l,e.isRoot);if(y===void 0){var m=e.MissingRefError.message(e.baseId,l);if(e.opts.missingRefs=="fail"){e.logger.error(m);var v=v||[];v.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '$ref' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { ref: '"+e.util.escapeQuotes(l)+"' } ",e.opts.messages!==!1&&(r+=" , message: 'can\\'t resolve reference "+e.util.escapeQuotes(l)+"' "),e.opts.verbose&&(r+=" , schema: "+e.util.toQuotedString(l)+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),r+=" } "):r+=" {} ";var x=r;r=v.pop(),!e.compositeRule&&c?e.async?r+=" throw new ValidationError(["+x+"]); ":r+=" validate.errors = ["+x+"]; return false; ":r+=" var err = "+x+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",c&&(r+=" if (false) { ")}else if(e.opts.missingRefs=="ignore")e.logger.warn(m),c&&(r+=" if (true) { ");else throw new e.MissingRefError(e.baseId,l,m)}else if(y.inline){var S=e.util.copy(e);S.level++;var P="valid"+S.level;S.schema=y.schema,S.schemaPath="",S.errSchemaPath=l;var O=e.validate(S).replace(/validate\.schema/g,y.code);r+=" "+O+" ",c&&(r+=" if ("+P+") { ")}else g=y.$async===!0||e.async&&y.$async!==!1,d=y.code}if(d){var v=v||[];v.push(r),r="",e.opts.passContext?r+=" "+d+".call(this, ":r+=" "+d+"( ",r+=" "+f+", (dataPath || '')",e.errorPath!='""'&&(r+=" + "+e.errorPath);var A=o?"data"+(o-1||""):"parentData",I=o?e.dataPathArr[o]:"parentDataProperty";r+=" , "+A+" , "+I+", rootData) ";var H=r;if(r=v.pop(),g){if(!e.async)throw new Error("async schema referenced by sync schema");c&&(r+=" var "+p+"; "),r+=" try { await "+H+"; ",c&&(r+=" "+p+" = true; "),r+=" } catch (e) { if (!(e instanceof ValidationError)) throw e; if (vErrors === null) vErrors = e.errors; else vErrors = vErrors.concat(e.errors); errors = vErrors.length; ",c&&(r+=" "+p+" = false; "),r+=" } ",c&&(r+=" if ("+p+") { ")}else r+=" if (!"+H+") { if (vErrors === null) vErrors = "+d+".errors; else vErrors = vErrors.concat("+d+".errors); errors = vErrors.length; } ",c&&(r+=" else { ")}return r}});var ai=z((Uv,ti)=>{"use strict";ti.exports=function(e,t,s){var r=" ",n=e.schema[t],o=e.schemaPath+e.util.getProperty(t),l=e.errSchemaPath+"/"+t,u=!e.opts.allErrors,c=e.util.copy(e),f="";c.level++;var p="valid"+c.level,g=c.baseId,d=!0,y=n;if(y)for(var m,v=-1,x=y.length-1;v<x;)m=y[v+=1],(e.opts.strictKeywords?typeof m=="object"&&Object.keys(m).length>0||m===!1:e.util.schemaHasRules(m,e.RULES.all))&&(d=!1,c.schema=m,c.schemaPath=o+"["+v+"]",c.errSchemaPath=l+"/"+v,r+=" "+e.validate(c)+" ",c.baseId=g,u&&(r+=" if ("+p+") { ",f+="}"));return u&&(d?r+=" if (true) { ":r+=" "+f.slice(0,-1)+" "),r}});var ni=z((zv,si)=>{"use strict";si.exports=function(e,t,s){var r=" ",n=e.level,o=e.dataLevel,l=e.schema[t],u=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,f=!e.opts.allErrors,p="data"+(o||""),g="valid"+n,d="errs__"+n,y=e.util.copy(e),m="";y.level++;var v="valid"+y.level,x=l.every(function(q){return e.opts.strictKeywords?typeof q=="object"&&Object.keys(q).length>0||q===!1:e.util.schemaHasRules(q,e.RULES.all)});if(x){var S=y.baseId;r+=" var "+d+" = errors; var "+g+" = false; ";var P=e.compositeRule;e.compositeRule=y.compositeRule=!0;var O=l;if(O)for(var A,I=-1,H=O.length-1;I<H;)A=O[I+=1],y.schema=A,y.schemaPath=u+"["+I+"]",y.errSchemaPath=c+"/"+I,r+=" "+e.validate(y)+" ",y.baseId=S,r+=" "+g+" = "+g+" || "+v+"; if (!"+g+") { ",m+="}";e.compositeRule=y.compositeRule=P,r+=" "+m+" if (!"+g+") { var err = ",e.createErrors!==!1?(r+=" { keyword: 'anyOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: {} ",e.opts.messages!==!1&&(r+=" , message: 'should match some schema in anyOf' "),e.opts.verbose&&(r+=" , schema: validate.schema"+u+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&f&&(e.async?r+=" throw new ValidationError(vErrors); ":r+=" validate.errors = vErrors; return false; "),r+=" } else { errors = "+d+"; if (vErrors !== null) { if ("+d+") vErrors.length = "+d+"; else vErrors = null; } ",e.opts.allErrors&&(r+=" } ")}else f&&(r+=" if (true) { ");return r}});var ii=z((Vv,oi)=>{"use strict";oi.exports=function(e,t,s){var r=" ",n=e.schema[t],o=e.errSchemaPath+"/"+t,l=!e.opts.allErrors,u=e.util.toQuotedString(n);return e.opts.$comment===!0?r+=" console.log("+u+");":typeof e.opts.$comment=="function"&&(r+=" self._opts.$comment("+u+", "+e.util.toQuotedString(o)+", validate.root.schema);"),r}});var ci=z((Hv,li)=>{"use strict";li.exports=function(e,t,s){var r=" ",n=e.level,o=e.dataLevel,l=e.schema[t],u=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,f=!e.opts.allErrors,p="data"+(o||""),g="valid"+n,d=e.opts.$data&&l&&l.$data,y;d?(r+=" var schema"+n+" = "+e.util.getData(l.$data,o,e.dataPathArr)+"; ",y="schema"+n):y=l,d||(r+=" var schema"+n+" = validate.schema"+u+";"),r+="var "+g+" = equal("+p+", schema"+n+"); if (!"+g+") { ";var m=m||[];m.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'const' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { allowedValue: schema"+n+" } ",e.opts.messages!==!1&&(r+=" , message: 'should be equal to constant' "),e.opts.verbose&&(r+=" , schema: validate.schema"+u+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),r+=" } "):r+=" {} ";var v=r;return r=m.pop(),!e.compositeRule&&f?e.async?r+=" throw new ValidationError(["+v+"]); ":r+=" validate.errors = ["+v+"]; return false; ":r+=" var err = "+v+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" }",f&&(r+=" else { "),r}});var di=z((Zv,ui)=>{"use strict";ui.exports=function(e,t,s){var r=" ",n=e.level,o=e.dataLevel,l=e.schema[t],u=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,f=!e.opts.allErrors,p="data"+(o||""),g="valid"+n,d="errs__"+n,y=e.util.copy(e),m="";y.level++;var v="valid"+y.level,x="i"+n,S=y.dataLevel=e.dataLevel+1,P="data"+S,O=e.baseId,A=e.opts.strictKeywords?typeof l=="object"&&Object.keys(l).length>0||l===!1:e.util.schemaHasRules(l,e.RULES.all);if(r+="var "+d+" = errors;var "+g+";",A){var I=e.compositeRule;e.compositeRule=y.compositeRule=!0,y.schema=l,y.schemaPath=u,y.errSchemaPath=c,r+=" var "+v+" = false; for (var "+x+" = 0; "+x+" < "+p+".length; "+x+"++) { ",y.errorPath=e.util.getPathExpr(e.errorPath,x,e.opts.jsonPointers,!0);var H=p+"["+x+"]";y.dataPathArr[S]=x;var q=e.validate(y);y.baseId=O,e.util.varOccurences(q,P)<2?r+=" "+e.util.varReplace(q,P,H)+" ":r+=" var "+P+" = "+H+"; "+q+" ",r+=" if ("+v+") break; } ",e.compositeRule=y.compositeRule=I,r+=" "+m+" if (!"+v+") {"}else r+=" if ("+p+".length == 0) {";var C=C||[];C.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'contains' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: {} ",e.opts.messages!==!1&&(r+=" , message: 'should contain a valid item' "),e.opts.verbose&&(r+=" , schema: validate.schema"+u+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),r+=" } "):r+=" {} ";var U=r;return r=C.pop(),!e.compositeRule&&f?e.async?r+=" throw new ValidationError(["+U+"]); ":r+=" validate.errors = ["+U+"]; return false; ":r+=" var err = "+U+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } else { ",A&&(r+=" errors = "+d+"; if (vErrors !== null) { if ("+d+") vErrors.length = "+d+"; else vErrors = null; } "),e.opts.allErrors&&(r+=" } "),r}});var hi=z((Bv,fi)=>{"use strict";fi.exports=function(e,t,s){var r=" ",n=e.level,o=e.dataLevel,l=e.schema[t],u=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,f=!e.opts.allErrors,p="data"+(o||""),g="errs__"+n,d=e.util.copy(e),y="";d.level++;var m="valid"+d.level,v={},x={},S=e.opts.ownProperties;for(I in l)if(I!="__proto__"){var P=l[I],O=Array.isArray(P)?x:v;O[I]=P}r+="var "+g+" = errors;";var A=e.errorPath;r+="var missing"+n+";";for(var I in x)if(O=x[I],O.length){if(r+=" if ( "+p+e.util.getProperty(I)+" !== undefined ",S&&(r+=" && Object.prototype.hasOwnProperty.call("+p+", '"+e.util.escapeQuotes(I)+"') "),f){r+=" && ( ";var H=O;if(H)for(var q,C=-1,U=H.length-1;C<U;){q=H[C+=1],C&&(r+=" || ");var M=e.util.getProperty(q),F=p+M;r+=" ( ( "+F+" === undefined ",S&&(r+=" || ! Object.prototype.hasOwnProperty.call("+p+", '"+e.util.escapeQuotes(q)+"') "),r+=") && (missing"+n+" = "+e.util.toQuotedString(e.opts.jsonPointers?q:M)+") ) "}r+=")) { ";var $="missing"+n,k="' + "+$+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.opts.jsonPointers?e.util.getPathExpr(A,$,!0):A+" + "+$);var L=L||[];L.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'dependencies' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { property: '"+e.util.escapeQuotes(I)+"', missingProperty: '"+k+"', depsCount: "+O.length+", deps: '"+e.util.escapeQuotes(O.length==1?O[0]:O.join(", "))+"' } ",e.opts.messages!==!1&&(r+=" , message: 'should have ",O.length==1?r+="property "+e.util.escapeQuotes(O[0]):r+="properties "+e.util.escapeQuotes(O.join(", ")),r+=" when property "+e.util.escapeQuotes(I)+" is present' "),e.opts.verbose&&(r+=" , schema: validate.schema"+u+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),r+=" } "):r+=" {} ";var le=r;r=L.pop(),!e.compositeRule&&f?e.async?r+=" throw new ValidationError(["+le+"]); ":r+=" validate.errors = ["+le+"]; return false; ":r+=" var err = "+le+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}else{r+=" ) { ";var Y=O;if(Y)for(var q,re=-1,W=Y.length-1;re<W;){q=Y[re+=1];var M=e.util.getProperty(q),k=e.util.escapeQuotes(q),F=p+M;e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPath(A,q,e.opts.jsonPointers)),r+=" if ( "+F+" === undefined ",S&&(r+=" || ! Object.prototype.hasOwnProperty.call("+p+", '"+e.util.escapeQuotes(q)+"') "),r+=") { var err = ",e.createErrors!==!1?(r+=" { keyword: 'dependencies' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { property: '"+e.util.escapeQuotes(I)+"', missingProperty: '"+k+"', depsCount: "+O.length+", deps: '"+e.util.escapeQuotes(O.length==1?O[0]:O.join(", "))+"' } ",e.opts.messages!==!1&&(r+=" , message: 'should have ",O.length==1?r+="property "+e.util.escapeQuotes(O[0]):r+="properties "+e.util.escapeQuotes(O.join(", ")),r+=" when property "+e.util.escapeQuotes(I)+" is present' "),e.opts.verbose&&(r+=" , schema: validate.schema"+u+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } "}}r+=" } ",f&&(y+="}",r+=" else { ")}e.errorPath=A;var Z=d.baseId;for(var I in v){var P=v[I];(e.opts.strictKeywords?typeof P=="object"&&Object.keys(P).length>0||P===!1:e.util.schemaHasRules(P,e.RULES.all))&&(r+=" "+m+" = true; if ( "+p+e.util.getProperty(I)+" !== undefined ",S&&(r+=" && Object.prototype.hasOwnProperty.call("+p+", '"+e.util.escapeQuotes(I)+"') "),r+=") { ",d.schema=P,d.schemaPath=u+e.util.getProperty(I),d.errSchemaPath=c+"/"+e.util.escapeFragment(I),r+=" "+e.validate(d)+" ",d.baseId=Z,r+=" } ",f&&(r+=" if ("+m+") { ",y+="}"))}return f&&(r+=" "+y+" if ("+g+" == errors) {"),r}});var mi=z((Jv,pi)=>{"use strict";pi.exports=function(e,t,s){var r=" ",n=e.level,o=e.dataLevel,l=e.schema[t],u=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,f=!e.opts.allErrors,p="data"+(o||""),g="valid"+n,d=e.opts.$data&&l&&l.$data,y;d?(r+=" var schema"+n+" = "+e.util.getData(l.$data,o,e.dataPathArr)+"; ",y="schema"+n):y=l;var m="i"+n,v="schema"+n;d||(r+=" var "+v+" = validate.schema"+u+";"),r+="var "+g+";",d&&(r+=" if (schema"+n+" === undefined) "+g+" = true; else if (!Array.isArray(schema"+n+")) "+g+" = false; else {"),r+=""+g+" = false;for (var "+m+"=0; "+m+"<"+v+".length; "+m+"++) if (equal("+p+", "+v+"["+m+"])) { "+g+" = true; break; }",d&&(r+=" } "),r+=" if (!"+g+") { ";var x=x||[];x.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'enum' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { allowedValues: schema"+n+" } ",e.opts.messages!==!1&&(r+=" , message: 'should be equal to one of the allowed values' "),e.opts.verbose&&(r+=" , schema: validate.schema"+u+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),r+=" } "):r+=" {} ";var S=r;return r=x.pop(),!e.compositeRule&&f?e.async?r+=" throw new ValidationError(["+S+"]); ":r+=" validate.errors = ["+S+"]; return false; ":r+=" var err = "+S+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" }",f&&(r+=" else { "),r}});var gi=z((Qv,vi)=>{"use strict";vi.exports=function(e,t,s){var r=" ",n=e.level,o=e.dataLevel,l=e.schema[t],u=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,f=!e.opts.allErrors,p="data"+(o||"");if(e.opts.format===!1)return f&&(r+=" if (true) { "),r;var g=e.opts.$data&&l&&l.$data,d;g?(r+=" var schema"+n+" = "+e.util.getData(l.$data,o,e.dataPathArr)+"; ",d="schema"+n):d=l;var y=e.opts.unknownFormats,m=Array.isArray(y);if(g){var v="format"+n,x="isObject"+n,S="formatType"+n;r+=" var "+v+" = formats["+d+"]; var "+x+" = typeof "+v+" == 'object' && !("+v+" instanceof RegExp) && "+v+".validate; var "+S+" = "+x+" && "+v+".type || 'string'; if ("+x+") { ",e.async&&(r+=" var async"+n+" = "+v+".async; "),r+=" "+v+" = "+v+".validate; } if ( ",g&&(r+=" ("+d+" !== undefined && typeof "+d+" != 'string') || "),r+=" (",y!="ignore"&&(r+=" ("+d+" && !"+v+" ",m&&(r+=" && self._opts.unknownFormats.indexOf("+d+") == -1 "),r+=") || "),r+=" ("+v+" && "+S+" == '"+s+"' && !(typeof "+v+" == 'function' ? ",e.async?r+=" (async"+n+" ? await "+v+"("+p+") : "+v+"("+p+")) ":r+=" "+v+"("+p+") ",r+=" : "+v+".test("+p+"))))) {"}else{var v=e.formats[l];if(!v){if(y=="ignore")return e.logger.warn('unknown format "'+l+'" ignored in schema at path "'+e.errSchemaPath+'"'),f&&(r+=" if (true) { "),r;if(m&&y.indexOf(l)>=0)return f&&(r+=" if (true) { "),r;throw new Error('unknown format "'+l+'" is used in schema at path "'+e.errSchemaPath+'"')}var x=typeof v=="object"&&!(v instanceof RegExp)&&v.validate,S=x&&v.type||"string";if(x){var P=v.async===!0;v=v.validate}if(S!=s)return f&&(r+=" if (true) { "),r;if(P){if(!e.async)throw new Error("async format in sync schema");var O="formats"+e.util.getProperty(l)+".validate";r+=" if (!(await "+O+"("+p+"))) { "}else{r+=" if (! ";var O="formats"+e.util.getProperty(l);x&&(O+=".validate"),typeof v=="function"?r+=" "+O+"("+p+") ":r+=" "+O+".test("+p+") ",r+=") { "}}var A=A||[];A.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'format' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { format: ",g?r+=""+d:r+=""+e.util.toQuotedString(l),r+=" } ",e.opts.messages!==!1&&(r+=` , message: 'should match format "`,g?r+="' + "+d+" + '":r+=""+e.util.escapeQuotes(l),r+=`"' `),e.opts.verbose&&(r+=" , schema: ",g?r+="validate.schema"+u:r+=""+e.util.toQuotedString(l),r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),r+=" } "):r+=" {} ";var I=r;return r=A.pop(),!e.compositeRule&&f?e.async?r+=" throw new ValidationError(["+I+"]); ":r+=" validate.errors = ["+I+"]; return false; ":r+=" var err = "+I+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } ",f&&(r+=" else { "),r}});var _i=z((Kv,yi)=>{"use strict";yi.exports=function(e,t,s){var r=" ",n=e.level,o=e.dataLevel,l=e.schema[t],u=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,f=!e.opts.allErrors,p="data"+(o||""),g="valid"+n,d="errs__"+n,y=e.util.copy(e);y.level++;var m="valid"+y.level,v=e.schema.then,x=e.schema.else,S=v!==void 0&&(e.opts.strictKeywords?typeof v=="object"&&Object.keys(v).length>0||v===!1:e.util.schemaHasRules(v,e.RULES.all)),P=x!==void 0&&(e.opts.strictKeywords?typeof x=="object"&&Object.keys(x).length>0||x===!1:e.util.schemaHasRules(x,e.RULES.all)),O=y.baseId;if(S||P){var A;y.createErrors=!1,y.schema=l,y.schemaPath=u,y.errSchemaPath=c,r+=" var "+d+" = errors; var "+g+" = true; ";var I=e.compositeRule;e.compositeRule=y.compositeRule=!0,r+=" "+e.validate(y)+" ",y.baseId=O,y.createErrors=!0,r+=" errors = "+d+"; if (vErrors !== null) { if ("+d+") vErrors.length = "+d+"; else vErrors = null; } ",e.compositeRule=y.compositeRule=I,S?(r+=" if ("+m+") { ",y.schema=e.schema.then,y.schemaPath=e.schemaPath+".then",y.errSchemaPath=e.errSchemaPath+"/then",r+=" "+e.validate(y)+" ",y.baseId=O,r+=" "+g+" = "+m+"; ",S&&P?(A="ifClause"+n,r+=" var "+A+" = 'then'; "):A="'then'",r+=" } ",P&&(r+=" else { ")):r+=" if (!"+m+") { ",P&&(y.schema=e.schema.else,y.schemaPath=e.schemaPath+".else",y.errSchemaPath=e.errSchemaPath+"/else",r+=" "+e.validate(y)+" ",y.baseId=O,r+=" "+g+" = "+m+"; ",S&&P?(A="ifClause"+n,r+=" var "+A+" = 'else'; "):A="'else'",r+=" } "),r+=" if (!"+g+") { var err = ",e.createErrors!==!1?(r+=" { keyword: 'if' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { failingKeyword: "+A+" } ",e.opts.messages!==!1&&(r+=` , message: 'should match "' + `+A+` + '" schema' `),e.opts.verbose&&(r+=" , schema: validate.schema"+u+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&f&&(e.async?r+=" throw new ValidationError(vErrors); ":r+=" validate.errors = vErrors; return false; "),r+=" } ",f&&(r+=" else { ")}else f&&(r+=" if (true) { ");return r}});var xi=z((Gv,bi)=>{"use strict";bi.exports=function(e,t,s){var r=" ",n=e.level,o=e.dataLevel,l=e.schema[t],u=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,f=!e.opts.allErrors,p="data"+(o||""),g="valid"+n,d="errs__"+n,y=e.util.copy(e),m="";y.level++;var v="valid"+y.level,x="i"+n,S=y.dataLevel=e.dataLevel+1,P="data"+S,O=e.baseId;if(r+="var "+d+" = errors;var "+g+";",Array.isArray(l)){var A=e.schema.additionalItems;if(A===!1){r+=" "+g+" = "+p+".length <= "+l.length+"; ";var I=c;c=e.errSchemaPath+"/additionalItems",r+=" if (!"+g+") { ";var H=H||[];H.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'additionalItems' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { limit: "+l.length+" } ",e.opts.messages!==!1&&(r+=" , message: 'should NOT have more than "+l.length+" items' "),e.opts.verbose&&(r+=" , schema: false , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),r+=" } "):r+=" {} ";var q=r;r=H.pop(),!e.compositeRule&&f?e.async?r+=" throw new ValidationError(["+q+"]); ":r+=" validate.errors = ["+q+"]; return false; ":r+=" var err = "+q+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } ",c=I,f&&(m+="}",r+=" else { ")}var C=l;if(C){for(var U,M=-1,F=C.length-1;M<F;)if(U=C[M+=1],e.opts.strictKeywords?typeof U=="object"&&Object.keys(U).length>0||U===!1:e.util.schemaHasRules(U,e.RULES.all)){r+=" "+v+" = true; if ("+p+".length > "+M+") { ";var $=p+"["+M+"]";y.schema=U,y.schemaPath=u+"["+M+"]",y.errSchemaPath=c+"/"+M,y.errorPath=e.util.getPathExpr(e.errorPath,M,e.opts.jsonPointers,!0),y.dataPathArr[S]=M;var k=e.validate(y);y.baseId=O,e.util.varOccurences(k,P)<2?r+=" "+e.util.varReplace(k,P,$)+" ":r+=" var "+P+" = "+$+"; "+k+" ",r+=" } ",f&&(r+=" if ("+v+") { ",m+="}")}}if(typeof A=="object"&&(e.opts.strictKeywords?typeof A=="object"&&Object.keys(A).length>0||A===!1:e.util.schemaHasRules(A,e.RULES.all))){y.schema=A,y.schemaPath=e.schemaPath+".additionalItems",y.errSchemaPath=e.errSchemaPath+"/additionalItems",r+=" "+v+" = true; if ("+p+".length > "+l.length+") { for (var "+x+" = "+l.length+"; "+x+" < "+p+".length; "+x+"++) { ",y.errorPath=e.util.getPathExpr(e.errorPath,x,e.opts.jsonPointers,!0);var $=p+"["+x+"]";y.dataPathArr[S]=x;var k=e.validate(y);y.baseId=O,e.util.varOccurences(k,P)<2?r+=" "+e.util.varReplace(k,P,$)+" ":r+=" var "+P+" = "+$+"; "+k+" ",f&&(r+=" if (!"+v+") break; "),r+=" } } ",f&&(r+=" if ("+v+") { ",m+="}")}}else if(e.opts.strictKeywords?typeof l=="object"&&Object.keys(l).length>0||l===!1:e.util.schemaHasRules(l,e.RULES.all)){y.schema=l,y.schemaPath=u,y.errSchemaPath=c,r+=" for (var "+x+" = 0; "+x+" < "+p+".length; "+x+"++) { ",y.errorPath=e.util.getPathExpr(e.errorPath,x,e.opts.jsonPointers,!0);var $=p+"["+x+"]";y.dataPathArr[S]=x;var k=e.validate(y);y.baseId=O,e.util.varOccurences(k,P)<2?r+=" "+e.util.varReplace(k,P,$)+" ":r+=" var "+P+" = "+$+"; "+k+" ",f&&(r+=" if (!"+v+") break; "),r+=" }"}return f&&(r+=" "+m+" if ("+d+" == errors) {"),r}});var Bs=z((Wv,wi)=>{"use strict";wi.exports=function(e,t,s){var r=" ",n=e.level,o=e.dataLevel,l=e.schema[t],u=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,f=!e.opts.allErrors,O,p="data"+(o||""),g=e.opts.$data&&l&&l.$data,d;g?(r+=" var schema"+n+" = "+e.util.getData(l.$data,o,e.dataPathArr)+"; ",d="schema"+n):d=l;var y=t=="maximum",m=y?"exclusiveMaximum":"exclusiveMinimum",v=e.schema[m],x=e.opts.$data&&v&&v.$data,S=y?"<":">",P=y?">":"<",O=void 0;if(!(g||typeof l=="number"||l===void 0))throw new Error(t+" must be number");if(!(x||v===void 0||typeof v=="number"||typeof v=="boolean"))throw new Error(m+" must be number or boolean");if(x){var A=e.util.getData(v.$data,o,e.dataPathArr),I="exclusive"+n,H="exclType"+n,q="exclIsNumber"+n,C="op"+n,U="' + "+C+" + '";r+=" var schemaExcl"+n+" = "+A+"; ",A="schemaExcl"+n,r+=" var "+I+"; var "+H+" = typeof "+A+"; if ("+H+" != 'boolean' && "+H+" != 'undefined' && "+H+" != 'number') { ";var O=m,M=M||[];M.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(O||"_exclusiveLimit")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: {} ",e.opts.messages!==!1&&(r+=" , message: '"+m+" should be boolean' "),e.opts.verbose&&(r+=" , schema: validate.schema"+u+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),r+=" } "):r+=" {} ";var F=r;r=M.pop(),!e.compositeRule&&f?e.async?r+=" throw new ValidationError(["+F+"]); ":r+=" validate.errors = ["+F+"]; return false; ":r+=" var err = "+F+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } else if ( ",g&&(r+=" ("+d+" !== undefined && typeof "+d+" != 'number') || "),r+=" "+H+" == 'number' ? ( ("+I+" = "+d+" === undefined || "+A+" "+S+"= "+d+") ? "+p+" "+P+"= "+A+" : "+p+" "+P+" "+d+" ) : ( ("+I+" = "+A+" === true) ? "+p+" "+P+"= "+d+" : "+p+" "+P+" "+d+" ) || "+p+" !== "+p+") { var op"+n+" = "+I+" ? '"+S+"' : '"+S+"='; ",l===void 0&&(O=m,c=e.errSchemaPath+"/"+m,d=A,g=x)}else{var q=typeof v=="number",U=S;if(q&&g){var C="'"+U+"'";r+=" if ( ",g&&(r+=" ("+d+" !== undefined && typeof "+d+" != 'number') || "),r+=" ( "+d+" === undefined || "+v+" "+S+"= "+d+" ? "+p+" "+P+"= "+v+" : "+p+" "+P+" "+d+" ) || "+p+" !== "+p+") { "}else{q&&l===void 0?(I=!0,O=m,c=e.errSchemaPath+"/"+m,d=v,P+="="):(q&&(d=Math[y?"min":"max"](v,l)),v===(q?d:!0)?(I=!0,O=m,c=e.errSchemaPath+"/"+m,P+="="):(I=!1,U+="="));var C="'"+U+"'";r+=" if ( ",g&&(r+=" ("+d+" !== undefined && typeof "+d+" != 'number') || "),r+=" "+p+" "+P+" "+d+" || "+p+" !== "+p+") { "}}O=O||t;var M=M||[];M.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(O||"_limit")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { comparison: "+C+", limit: "+d+", exclusive: "+I+" } ",e.opts.messages!==!1&&(r+=" , message: 'should be "+U+" ",g?r+="' + "+d:r+=""+d+"'"),e.opts.verbose&&(r+=" , schema: ",g?r+="validate.schema"+u:r+=""+l,r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),r+=" } "):r+=" {} ";var F=r;return r=M.pop(),!e.compositeRule&&f?e.async?r+=" throw new ValidationError(["+F+"]); ":r+=" validate.errors = ["+F+"]; return false; ":r+=" var err = "+F+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } ",f&&(r+=" else { "),r}});var Js=z((Yv,Ei)=>{"use strict";Ei.exports=function(e,t,s){var r=" ",n=e.level,o=e.dataLevel,l=e.schema[t],u=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,f=!e.opts.allErrors,m,p="data"+(o||""),g=e.opts.$data&&l&&l.$data,d;if(g?(r+=" var schema"+n+" = "+e.util.getData(l.$data,o,e.dataPathArr)+"; ",d="schema"+n):d=l,!(g||typeof l=="number"))throw new Error(t+" must be number");var y=t=="maxItems"?">":"<";r+="if ( ",g&&(r+=" ("+d+" !== undefined && typeof "+d+" != 'number') || "),r+=" "+p+".length "+y+" "+d+") { ";var m=t,v=v||[];v.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(m||"_limitItems")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { limit: "+d+" } ",e.opts.messages!==!1&&(r+=" , message: 'should NOT have ",t=="maxItems"?r+="more":r+="fewer",r+=" than ",g?r+="' + "+d+" + '":r+=""+l,r+=" items' "),e.opts.verbose&&(r+=" , schema: ",g?r+="validate.schema"+u:r+=""+l,r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),r+=" } "):r+=" {} ";var x=r;return r=v.pop(),!e.compositeRule&&f?e.async?r+=" throw new ValidationError(["+x+"]); ":r+=" validate.errors = ["+x+"]; return false; ":r+=" var err = "+x+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+="} ",f&&(r+=" else { "),r}});var Qs=z((Xv,Pi)=>{"use strict";Pi.exports=function(e,t,s){var r=" ",n=e.level,o=e.dataLevel,l=e.schema[t],u=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,f=!e.opts.allErrors,m,p="data"+(o||""),g=e.opts.$data&&l&&l.$data,d;if(g?(r+=" var schema"+n+" = "+e.util.getData(l.$data,o,e.dataPathArr)+"; ",d="schema"+n):d=l,!(g||typeof l=="number"))throw new Error(t+" must be number");var y=t=="maxLength"?">":"<";r+="if ( ",g&&(r+=" ("+d+" !== undefined && typeof "+d+" != 'number') || "),e.opts.unicode===!1?r+=" "+p+".length ":r+=" ucs2length("+p+") ",r+=" "+y+" "+d+") { ";var m=t,v=v||[];v.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(m||"_limitLength")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { limit: "+d+" } ",e.opts.messages!==!1&&(r+=" , message: 'should NOT be ",t=="maxLength"?r+="longer":r+="shorter",r+=" than ",g?r+="' + "+d+" + '":r+=""+l,r+=" characters' "),e.opts.verbose&&(r+=" , schema: ",g?r+="validate.schema"+u:r+=""+l,r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),r+=" } "):r+=" {} ";var x=r;return r=v.pop(),!e.compositeRule&&f?e.async?r+=" throw new ValidationError(["+x+"]); ":r+=" validate.errors = ["+x+"]; return false; ":r+=" var err = "+x+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+="} ",f&&(r+=" else { "),r}});var Ks=z((eg,Si)=>{"use strict";Si.exports=function(e,t,s){var r=" ",n=e.level,o=e.dataLevel,l=e.schema[t],u=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,f=!e.opts.allErrors,m,p="data"+(o||""),g=e.opts.$data&&l&&l.$data,d;if(g?(r+=" var schema"+n+" = "+e.util.getData(l.$data,o,e.dataPathArr)+"; ",d="schema"+n):d=l,!(g||typeof l=="number"))throw new Error(t+" must be number");var y=t=="maxProperties"?">":"<";r+="if ( ",g&&(r+=" ("+d+" !== undefined && typeof "+d+" != 'number') || "),r+=" Object.keys("+p+").length "+y+" "+d+") { ";var m=t,v=v||[];v.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(m||"_limitProperties")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { limit: "+d+" } ",e.opts.messages!==!1&&(r+=" , message: 'should NOT have ",t=="maxProperties"?r+="more":r+="fewer",r+=" than ",g?r+="' + "+d+" + '":r+=""+l,r+=" properties' "),e.opts.verbose&&(r+=" , schema: ",g?r+="validate.schema"+u:r+=""+l,r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),r+=" } "):r+=" {} ";var x=r;return r=v.pop(),!e.compositeRule&&f?e.async?r+=" throw new ValidationError(["+x+"]); ":r+=" validate.errors = ["+x+"]; return false; ":r+=" var err = "+x+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+="} ",f&&(r+=" else { "),r}});var Oi=z((rg,Ri)=>{"use strict";Ri.exports=function(e,t,s){var r=" ",n=e.level,o=e.dataLevel,l=e.schema[t],u=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,f=!e.opts.allErrors,p="data"+(o||""),g=e.opts.$data&&l&&l.$data,d;if(g?(r+=" var schema"+n+" = "+e.util.getData(l.$data,o,e.dataPathArr)+"; ",d="schema"+n):d=l,!(g||typeof l=="number"))throw new Error(t+" must be number");r+="var division"+n+";if (",g&&(r+=" "+d+" !== undefined && ( typeof "+d+" != 'number' || "),r+=" (division"+n+" = "+p+" / "+d+", ",e.opts.multipleOfPrecision?r+=" Math.abs(Math.round(division"+n+") - division"+n+") > 1e-"+e.opts.multipleOfPrecision+" ":r+=" division"+n+" !== parseInt(division"+n+") ",r+=" ) ",g&&(r+=" ) "),r+=" ) { ";var y=y||[];y.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'multipleOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { multipleOf: "+d+" } ",e.opts.messages!==!1&&(r+=" , message: 'should be multiple of ",g?r+="' + "+d:r+=""+d+"'"),e.opts.verbose&&(r+=" , schema: ",g?r+="validate.schema"+u:r+=""+l,r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),r+=" } "):r+=" {} ";var m=r;return r=y.pop(),!e.compositeRule&&f?e.async?r+=" throw new ValidationError(["+m+"]); ":r+=" validate.errors = ["+m+"]; return false; ":r+=" var err = "+m+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+="} ",f&&(r+=" else { "),r}});var $i=z((tg,Ti)=>{"use strict";Ti.exports=function(e,t,s){var r=" ",n=e.level,o=e.dataLevel,l=e.schema[t],u=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,f=!e.opts.allErrors,p="data"+(o||""),g="errs__"+n,d=e.util.copy(e);d.level++;var y="valid"+d.level;if(e.opts.strictKeywords?typeof l=="object"&&Object.keys(l).length>0||l===!1:e.util.schemaHasRules(l,e.RULES.all)){d.schema=l,d.schemaPath=u,d.errSchemaPath=c,r+=" var "+g+" = errors; ";var m=e.compositeRule;e.compositeRule=d.compositeRule=!0,d.createErrors=!1;var v;d.opts.allErrors&&(v=d.opts.allErrors,d.opts.allErrors=!1),r+=" "+e.validate(d)+" ",d.createErrors=!0,v&&(d.opts.allErrors=v),e.compositeRule=d.compositeRule=m,r+=" if ("+y+") { ";var x=x||[];x.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'not' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: {} ",e.opts.messages!==!1&&(r+=" , message: 'should NOT be valid' "),e.opts.verbose&&(r+=" , schema: validate.schema"+u+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),r+=" } "):r+=" {} ";var S=r;r=x.pop(),!e.compositeRule&&f?e.async?r+=" throw new ValidationError(["+S+"]); ":r+=" validate.errors = ["+S+"]; return false; ":r+=" var err = "+S+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } else { errors = "+g+"; if (vErrors !== null) { if ("+g+") vErrors.length = "+g+"; else vErrors = null; } ",e.opts.allErrors&&(r+=" } ")}else r+=" var err = ",e.createErrors!==!1?(r+=" { keyword: 'not' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: {} ",e.opts.messages!==!1&&(r+=" , message: 'should NOT be valid' "),e.opts.verbose&&(r+=" , schema: validate.schema"+u+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",f&&(r+=" if (false) { ");return r}});var Ii=z((ag,Ai)=>{"use strict";Ai.exports=function(e,t,s){var r=" ",n=e.level,o=e.dataLevel,l=e.schema[t],u=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,f=!e.opts.allErrors,p="data"+(o||""),g="valid"+n,d="errs__"+n,y=e.util.copy(e),m="";y.level++;var v="valid"+y.level,x=y.baseId,S="prevValid"+n,P="passingSchemas"+n;r+="var "+d+" = errors , "+S+" = false , "+g+" = false , "+P+" = null; ";var O=e.compositeRule;e.compositeRule=y.compositeRule=!0;var A=l;if(A)for(var I,H=-1,q=A.length-1;H<q;)I=A[H+=1],(e.opts.strictKeywords?typeof I=="object"&&Object.keys(I).length>0||I===!1:e.util.schemaHasRules(I,e.RULES.all))?(y.schema=I,y.schemaPath=u+"["+H+"]",y.errSchemaPath=c+"/"+H,r+=" "+e.validate(y)+" ",y.baseId=x):r+=" var "+v+" = true; ",H&&(r+=" if ("+v+" && "+S+") { "+g+" = false; "+P+" = ["+P+", "+H+"]; } else { ",m+="}"),r+=" if ("+v+") { "+g+" = "+S+" = true; "+P+" = "+H+"; }";return e.compositeRule=y.compositeRule=O,r+=""+m+"if (!"+g+") { var err = ",e.createErrors!==!1?(r+=" { keyword: 'oneOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { passingSchemas: "+P+" } ",e.opts.messages!==!1&&(r+=" , message: 'should match exactly one schema in oneOf' "),e.opts.verbose&&(r+=" , schema: validate.schema"+u+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&f&&(e.async?r+=" throw new ValidationError(vErrors); ":r+=" validate.errors = vErrors; return false; "),r+="} else { errors = "+d+"; if (vErrors !== null) { if ("+d+") vErrors.length = "+d+"; else vErrors = null; }",e.opts.allErrors&&(r+=" } "),r}});var ki=z((sg,Ci)=>{"use strict";Ci.exports=function(e,t,s){var r=" ",n=e.level,o=e.dataLevel,l=e.schema[t],u=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,f=!e.opts.allErrors,p="data"+(o||""),g=e.opts.$data&&l&&l.$data,d;g?(r+=" var schema"+n+" = "+e.util.getData(l.$data,o,e.dataPathArr)+"; ",d="schema"+n):d=l;var y=g?"(new RegExp("+d+"))":e.usePattern(l);r+="if ( ",g&&(r+=" ("+d+" !== undefined && typeof "+d+" != 'string') || "),r+=" !"+y+".test("+p+") ) { ";var m=m||[];m.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'pattern' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { pattern: ",g?r+=""+d:r+=""+e.util.toQuotedString(l),r+=" } ",e.opts.messages!==!1&&(r+=` , message: 'should match pattern "`,g?r+="' + "+d+" + '":r+=""+e.util.escapeQuotes(l),r+=`"' `),e.opts.verbose&&(r+=" , schema: ",g?r+="validate.schema"+u:r+=""+e.util.toQuotedString(l),r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),r+=" } "):r+=" {} ";var v=r;return r=m.pop(),!e.compositeRule&&f?e.async?r+=" throw new ValidationError(["+v+"]); ":r+=" validate.errors = ["+v+"]; return false; ":r+=" var err = "+v+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+="} ",f&&(r+=" else { "),r}});var ji=z((ng,Di)=>{"use strict";Di.exports=function(e,t,s){var r=" ",n=e.level,o=e.dataLevel,l=e.schema[t],u=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,f=!e.opts.allErrors,p="data"+(o||""),g="errs__"+n,d=e.util.copy(e),y="";d.level++;var m="valid"+d.level,v="key"+n,x="idx"+n,S=d.dataLevel=e.dataLevel+1,P="data"+S,O="dataProperties"+n,A=Object.keys(l||{}).filter(re),I=e.schema.patternProperties||{},H=Object.keys(I).filter(re),q=e.schema.additionalProperties,C=A.length||H.length,U=q===!1,M=typeof q=="object"&&Object.keys(q).length,F=e.opts.removeAdditional,$=U||M||F,k=e.opts.ownProperties,L=e.baseId,le=e.schema.required;if(le&&!(e.opts.$data&&le.$data)&&le.length<e.opts.loopRequired)var Y=e.util.toHash(le);function re(Ge){return Ge!=="__proto__"}if(r+="var "+g+" = errors;var "+m+" = true;",k&&(r+=" var "+O+" = undefined;"),$){if(k?r+=" "+O+" = "+O+" || Object.keys("+p+"); for (var "+x+"=0; "+x+"<"+O+".length; "+x+"++) { var "+v+" = "+O+"["+x+"]; ":r+=" for (var "+v+" in "+p+") { ",C){if(r+=" var isAdditional"+n+" = !(false ",A.length)if(A.length>8)r+=" || validate.schema"+u+".hasOwnProperty("+v+") ";else{var W=A;if(W)for(var Z,me=-1,Re=W.length-1;me<Re;)Z=W[me+=1],r+=" || "+v+" == "+e.util.toQuotedString(Z)+" "}if(H.length){var Ae=H;if(Ae)for(var se,ye=-1,Ee=Ae.length-1;ye<Ee;)se=Ae[ye+=1],r+=" || "+e.usePattern(se)+".test("+v+") "}r+=" ); if (isAdditional"+n+") { "}if(F=="all")r+=" delete "+p+"["+v+"]; ";else{var Ie=e.errorPath,xr="' + "+v+" + '";if(e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(e.errorPath,v,e.opts.jsonPointers)),U)if(F)r+=" delete "+p+"["+v+"]; ";else{r+=" "+m+" = false; ";var lr=c;c=e.errSchemaPath+"/additionalProperties";var _e=_e||[];_e.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'additionalProperties' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { additionalProperty: '"+xr+"' } ",e.opts.messages!==!1&&(r+=" , message: '",e.opts._errorDataPathProperty?r+="is an invalid additional property":r+="should NOT have additional properties",r+="' "),e.opts.verbose&&(r+=" , schema: false , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),r+=" } "):r+=" {} ";var ve=r;r=_e.pop(),!e.compositeRule&&f?e.async?r+=" throw new ValidationError(["+ve+"]); ":r+=" validate.errors = ["+ve+"]; return false; ":r+=" var err = "+ve+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",c=lr,f&&(r+=" break; ")}else if(M)if(F=="failing"){r+=" var "+g+" = errors; ";var kr=e.compositeRule;e.compositeRule=d.compositeRule=!0,d.schema=q,d.schemaPath=e.schemaPath+".additionalProperties",d.errSchemaPath=e.errSchemaPath+"/additionalProperties",d.errorPath=e.opts._errorDataPathProperty?e.errorPath:e.util.getPathExpr(e.errorPath,v,e.opts.jsonPointers);var Oe=p+"["+v+"]";d.dataPathArr[S]=v;var oe=e.validate(d);d.baseId=L,e.util.varOccurences(oe,P)<2?r+=" "+e.util.varReplace(oe,P,Oe)+" ":r+=" var "+P+" = "+Oe+"; "+oe+" ",r+=" if (!"+m+") { errors = "+g+"; if (validate.errors !== null) { if (errors) validate.errors.length = errors; else validate.errors = null; } delete "+p+"["+v+"]; } ",e.compositeRule=d.compositeRule=kr}else{d.schema=q,d.schemaPath=e.schemaPath+".additionalProperties",d.errSchemaPath=e.errSchemaPath+"/additionalProperties",d.errorPath=e.opts._errorDataPathProperty?e.errorPath:e.util.getPathExpr(e.errorPath,v,e.opts.jsonPointers);var Oe=p+"["+v+"]";d.dataPathArr[S]=v;var oe=e.validate(d);d.baseId=L,e.util.varOccurences(oe,P)<2?r+=" "+e.util.varReplace(oe,P,Oe)+" ":r+=" var "+P+" = "+Oe+"; "+oe+" ",f&&(r+=" if (!"+m+") break; ")}e.errorPath=Ie}C&&(r+=" } "),r+=" } ",f&&(r+=" if ("+m+") { ",y+="}")}var wr=e.opts.useDefaults&&!e.compositeRule;if(A.length){var cr=A;if(cr)for(var Z,Dr=-1,jr=cr.length-1;Dr<jr;){Z=cr[Dr+=1];var Pe=l[Z];if(e.opts.strictKeywords?typeof Pe=="object"&&Object.keys(Pe).length>0||Pe===!1:e.util.schemaHasRules(Pe,e.RULES.all)){var ze=e.util.getProperty(Z),Oe=p+ze,je=wr&&Pe.default!==void 0;d.schema=Pe,d.schemaPath=u+ze,d.errSchemaPath=c+"/"+e.util.escapeFragment(Z),d.errorPath=e.util.getPath(e.errorPath,Z,e.opts.jsonPointers),d.dataPathArr[S]=e.util.toQuotedString(Z);var oe=e.validate(d);if(d.baseId=L,e.util.varOccurences(oe,P)<2){oe=e.util.varReplace(oe,P,Oe);var Ce=Oe}else{var Ce=P;r+=" var "+P+" = "+Oe+"; "}if(je)r+=" "+oe+" ";else{if(Y&&Y[Z]){r+=" if ( "+Ce+" === undefined ",k&&(r+=" || ! Object.prototype.hasOwnProperty.call("+p+", '"+e.util.escapeQuotes(Z)+"') "),r+=") { "+m+" = false; ";var Ie=e.errorPath,lr=c,rr=e.util.escapeQuotes(Z);e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPath(Ie,Z,e.opts.jsonPointers)),c=e.errSchemaPath+"/required";var _e=_e||[];_e.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { missingProperty: '"+rr+"' } ",e.opts.messages!==!1&&(r+=" , message: '",e.opts._errorDataPathProperty?r+="is a required property":r+="should have required property \\'"+rr+"\\'",r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+u+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),r+=" } "):r+=" {} ";var ve=r;r=_e.pop(),!e.compositeRule&&f?e.async?r+=" throw new ValidationError(["+ve+"]); ":r+=" validate.errors = ["+ve+"]; return false; ":r+=" var err = "+ve+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",c=lr,e.errorPath=Ie,r+=" } else { "}else f?(r+=" if ( "+Ce+" === undefined ",k&&(r+=" || ! Object.prototype.hasOwnProperty.call("+p+", '"+e.util.escapeQuotes(Z)+"') "),r+=") { "+m+" = true; } else { "):(r+=" if ("+Ce+" !== undefined ",k&&(r+=" && Object.prototype.hasOwnProperty.call("+p+", '"+e.util.escapeQuotes(Z)+"') "),r+=" ) { ");r+=" "+oe+" } "}}f&&(r+=" if ("+m+") { ",y+="}")}}if(H.length){var Me=H;if(Me)for(var se,sa=-1,ns=Me.length-1;sa<ns;){se=Me[sa+=1];var Pe=I[se];if(e.opts.strictKeywords?typeof Pe=="object"&&Object.keys(Pe).length>0||Pe===!1:e.util.schemaHasRules(Pe,e.RULES.all)){d.schema=Pe,d.schemaPath=e.schemaPath+".patternProperties"+e.util.getProperty(se),d.errSchemaPath=e.errSchemaPath+"/patternProperties/"+e.util.escapeFragment(se),k?r+=" "+O+" = "+O+" || Object.keys("+p+"); for (var "+x+"=0; "+x+"<"+O+".length; "+x+"++) { var "+v+" = "+O+"["+x+"]; ":r+=" for (var "+v+" in "+p+") { ",r+=" if ("+e.usePattern(se)+".test("+v+")) { ",d.errorPath=e.util.getPathExpr(e.errorPath,v,e.opts.jsonPointers);var Oe=p+"["+v+"]";d.dataPathArr[S]=v;var oe=e.validate(d);d.baseId=L,e.util.varOccurences(oe,P)<2?r+=" "+e.util.varReplace(oe,P,Oe)+" ":r+=" var "+P+" = "+Oe+"; "+oe+" ",f&&(r+=" if (!"+m+") break; "),r+=" } ",f&&(r+=" else "+m+" = true; "),r+=" } ",f&&(r+=" if ("+m+") { ",y+="}")}}}return f&&(r+=" "+y+" if ("+g+" == errors) {"),r}});var Fi=z((og,Ni)=>{"use strict";Ni.exports=function(e,t,s){var r=" ",n=e.level,o=e.dataLevel,l=e.schema[t],u=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,f=!e.opts.allErrors,p="data"+(o||""),g="errs__"+n,d=e.util.copy(e),y="";d.level++;var m="valid"+d.level;if(r+="var "+g+" = errors;",e.opts.strictKeywords?typeof l=="object"&&Object.keys(l).length>0||l===!1:e.util.schemaHasRules(l,e.RULES.all)){d.schema=l,d.schemaPath=u,d.errSchemaPath=c;var v="key"+n,x="idx"+n,S="i"+n,P="' + "+v+" + '",O=d.dataLevel=e.dataLevel+1,A="data"+O,I="dataProperties"+n,H=e.opts.ownProperties,q=e.baseId;H&&(r+=" var "+I+" = undefined; "),H?r+=" "+I+" = "+I+" || Object.keys("+p+"); for (var "+x+"=0; "+x+"<"+I+".length; "+x+"++) { var "+v+" = "+I+"["+x+"]; ":r+=" for (var "+v+" in "+p+") { ",r+=" var startErrs"+n+" = errors; ";var C=v,U=e.compositeRule;e.compositeRule=d.compositeRule=!0;var M=e.validate(d);d.baseId=q,e.util.varOccurences(M,A)<2?r+=" "+e.util.varReplace(M,A,C)+" ":r+=" var "+A+" = "+C+"; "+M+" ",e.compositeRule=d.compositeRule=U,r+=" if (!"+m+") { for (var "+S+"=startErrs"+n+"; "+S+"<errors; "+S+"++) { vErrors["+S+"].propertyName = "+v+"; } var err = ",e.createErrors!==!1?(r+=" { keyword: 'propertyNames' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { propertyName: '"+P+"' } ",e.opts.messages!==!1&&(r+=" , message: 'property name \\'"+P+"\\' is invalid' "),e.opts.verbose&&(r+=" , schema: validate.schema"+u+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&f&&(e.async?r+=" throw new ValidationError(vErrors); ":r+=" validate.errors = vErrors; return false; "),f&&(r+=" break; "),r+=" } }"}return f&&(r+=" "+y+" if ("+g+" == errors) {"),r}});var Mi=z((ig,Li)=>{"use strict";Li.exports=function(e,t,s){var r=" ",n=e.level,o=e.dataLevel,l=e.schema[t],u=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,f=!e.opts.allErrors,p="data"+(o||""),g="valid"+n,d=e.opts.$data&&l&&l.$data,y;d?(r+=" var schema"+n+" = "+e.util.getData(l.$data,o,e.dataPathArr)+"; ",y="schema"+n):y=l;var m="schema"+n;if(!d)if(l.length<e.opts.loopRequired&&e.schema.properties&&Object.keys(e.schema.properties).length){var v=[],x=l;if(x)for(var S,P=-1,O=x.length-1;P<O;){S=x[P+=1];var A=e.schema.properties[S];A&&(e.opts.strictKeywords?typeof A=="object"&&Object.keys(A).length>0||A===!1:e.util.schemaHasRules(A,e.RULES.all))||(v[v.length]=S)}}else var v=l;if(d||v.length){var I=e.errorPath,H=d||v.length>=e.opts.loopRequired,q=e.opts.ownProperties;if(f)if(r+=" var missing"+n+"; ",H){d||(r+=" var "+m+" = validate.schema"+u+"; ");var C="i"+n,U="schema"+n+"["+C+"]",M="' + "+U+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(I,U,e.opts.jsonPointers)),r+=" var "+g+" = true; ",d&&(r+=" if (schema"+n+" === undefined) "+g+" = true; else if (!Array.isArray(schema"+n+")) "+g+" = false; else {"),r+=" for (var "+C+" = 0; "+C+" < "+m+".length; "+C+"++) { "+g+" = "+p+"["+m+"["+C+"]] !== undefined ",q&&(r+=" && Object.prototype.hasOwnProperty.call("+p+", "+m+"["+C+"]) "),r+="; if (!"+g+") break; } ",d&&(r+=" } "),r+=" if (!"+g+") { ";var F=F||[];F.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { missingProperty: '"+M+"' } ",e.opts.messages!==!1&&(r+=" , message: '",e.opts._errorDataPathProperty?r+="is a required property":r+="should have required property \\'"+M+"\\'",r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+u+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),r+=" } "):r+=" {} ";var $=r;r=F.pop(),!e.compositeRule&&f?e.async?r+=" throw new ValidationError(["+$+"]); ":r+=" validate.errors = ["+$+"]; return false; ":r+=" var err = "+$+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } else { "}else{r+=" if ( ";var k=v;if(k)for(var L,C=-1,le=k.length-1;C<le;){L=k[C+=1],C&&(r+=" || ");var Y=e.util.getProperty(L),re=p+Y;r+=" ( ( "+re+" === undefined ",q&&(r+=" || ! Object.prototype.hasOwnProperty.call("+p+", '"+e.util.escapeQuotes(L)+"') "),r+=") && (missing"+n+" = "+e.util.toQuotedString(e.opts.jsonPointers?L:Y)+") ) "}r+=") { ";var U="missing"+n,M="' + "+U+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.opts.jsonPointers?e.util.getPathExpr(I,U,!0):I+" + "+U);var F=F||[];F.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { missingProperty: '"+M+"' } ",e.opts.messages!==!1&&(r+=" , message: '",e.opts._errorDataPathProperty?r+="is a required property":r+="should have required property \\'"+M+"\\'",r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+u+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),r+=" } "):r+=" {} ";var $=r;r=F.pop(),!e.compositeRule&&f?e.async?r+=" throw new ValidationError(["+$+"]); ":r+=" validate.errors = ["+$+"]; return false; ":r+=" var err = "+$+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } else { "}else if(H){d||(r+=" var "+m+" = validate.schema"+u+"; ");var C="i"+n,U="schema"+n+"["+C+"]",M="' + "+U+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(I,U,e.opts.jsonPointers)),d&&(r+=" if ("+m+" && !Array.isArray("+m+")) { var err = ",e.createErrors!==!1?(r+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { missingProperty: '"+M+"' } ",e.opts.messages!==!1&&(r+=" , message: '",e.opts._errorDataPathProperty?r+="is a required property":r+="should have required property \\'"+M+"\\'",r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+u+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } else if ("+m+" !== undefined) { "),r+=" for (var "+C+" = 0; "+C+" < "+m+".length; "+C+"++) { if ("+p+"["+m+"["+C+"]] === undefined ",q&&(r+=" || ! Object.prototype.hasOwnProperty.call("+p+", "+m+"["+C+"]) "),r+=") { var err = ",e.createErrors!==!1?(r+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { missingProperty: '"+M+"' } ",e.opts.messages!==!1&&(r+=" , message: '",e.opts._errorDataPathProperty?r+="is a required property":r+="should have required property \\'"+M+"\\'",r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+u+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } } ",d&&(r+=" } ")}else{var W=v;if(W)for(var L,Z=-1,me=W.length-1;Z<me;){L=W[Z+=1];var Y=e.util.getProperty(L),M=e.util.escapeQuotes(L),re=p+Y;e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPath(I,L,e.opts.jsonPointers)),r+=" if ( "+re+" === undefined ",q&&(r+=" || ! Object.prototype.hasOwnProperty.call("+p+", '"+e.util.escapeQuotes(L)+"') "),r+=") { var err = ",e.createErrors!==!1?(r+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { missingProperty: '"+M+"' } ",e.opts.messages!==!1&&(r+=" , message: '",e.opts._errorDataPathProperty?r+="is a required property":r+="should have required property \\'"+M+"\\'",r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+u+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } "}}e.errorPath=I}else f&&(r+=" if (true) {");return r}});var Ui=z((lg,qi)=>{"use strict";qi.exports=function(e,t,s){var r=" ",n=e.level,o=e.dataLevel,l=e.schema[t],u=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,f=!e.opts.allErrors,p="data"+(o||""),g="valid"+n,d=e.opts.$data&&l&&l.$data,y;if(d?(r+=" var schema"+n+" = "+e.util.getData(l.$data,o,e.dataPathArr)+"; ",y="schema"+n):y=l,(l||d)&&e.opts.uniqueItems!==!1){d&&(r+=" var "+g+"; if ("+y+" === false || "+y+" === undefined) "+g+" = true; else if (typeof "+y+" != 'boolean') "+g+" = false; else { "),r+=" var i = "+p+".length , "+g+" = true , j; if (i > 1) { ";var m=e.schema.items&&e.schema.items.type,v=Array.isArray(m);if(!m||m=="object"||m=="array"||v&&(m.indexOf("object")>=0||m.indexOf("array")>=0))r+=" outer: for (;i--;) { for (j = i; j--;) { if (equal("+p+"[i], "+p+"[j])) { "+g+" = false; break outer; } } } ";else{r+=" var itemIndices = {}, item; for (;i--;) { var item = "+p+"[i]; ";var x="checkDataType"+(v?"s":"");r+=" if ("+e.util[x](m,"item",e.opts.strictNumbers,!0)+") continue; ",v&&(r+=` if (typeof item == 'string') item = '"' + item; `),r+=" if (typeof itemIndices[item] == 'number') { "+g+" = false; j = itemIndices[item]; break; } itemIndices[item] = i; } "}r+=" } ",d&&(r+=" } "),r+=" if (!"+g+") { ";var S=S||[];S.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'uniqueItems' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { i: i, j: j } ",e.opts.messages!==!1&&(r+=" , message: 'should NOT have duplicate items (items ## ' + j + ' and ' + i + ' are identical)' "),e.opts.verbose&&(r+=" , schema: ",d?r+="validate.schema"+u:r+=""+l,r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),r+=" } "):r+=" {} ";var P=r;r=S.pop(),!e.compositeRule&&f?e.async?r+=" throw new ValidationError(["+P+"]); ":r+=" validate.errors = ["+P+"]; return false; ":r+=" var err = "+P+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } ",f&&(r+=" else { ")}else f&&(r+=" if (true) { ");return r}});var Vi=z((cg,zi)=>{"use strict";zi.exports={$ref:ri(),allOf:ai(),anyOf:ni(),$comment:ii(),const:ci(),contains:di(),dependencies:hi(),enum:mi(),format:gi(),if:_i(),items:xi(),maximum:Bs(),minimum:Bs(),maxItems:Js(),minItems:Js(),maxLength:Qs(),minLength:Qs(),maxProperties:Ks(),minProperties:Ks(),multipleOf:Oi(),not:$i(),oneOf:Ii(),pattern:ki(),properties:ji(),propertyNames:Fi(),required:Mi(),uniqueItems:Ui(),validate:Hs()}});var Bi=z((ug,Zi)=>{"use strict";var Hi=Vi(),Gs=at().toHash;Zi.exports=function(){var e=[{type:"number",rules:[{maximum:["exclusiveMaximum"]},{minimum:["exclusiveMinimum"]},"multipleOf","format"]},{type:"string",rules:["maxLength","minLength","pattern","format"]},{type:"array",rules:["maxItems","minItems","items","contains","uniqueItems"]},{type:"object",rules:["maxProperties","minProperties","required","dependencies","propertyNames",{properties:["additionalProperties","patternProperties"]}]},{rules:["$ref","const","enum","not","anyOf","oneOf","allOf","if"]}],t=["type","$comment"],s=["$schema","$id","id","$data","$async","title","description","default","definitions","examples","readOnly","writeOnly","contentMediaType","contentEncoding","additionalItems","then","else"],r=["number","integer","string","array","object","boolean","null"];return e.all=Gs(t),e.types=Gs(r),e.forEach(function(n){n.rules=n.rules.map(function(o){var l;if(typeof o=="object"){var u=Object.keys(o)[0];l=o[u],o=u,l.forEach(function(f){t.push(f),e.all[f]=!0})}t.push(o);var c=e.all[o]={keyword:o,code:Hi[o],implements:l};return c}),e.all.$comment={keyword:"$comment",code:Hi.$comment},n.type&&(e.types[n.type]=n)}),e.keywords=Gs(t.concat(s)),e.custom={},e}});var Ki=z((dg,Qi)=>{"use strict";var Ji=["multipleOf","maximum","exclusiveMaximum","minimum","exclusiveMinimum","maxLength","minLength","pattern","additionalItems","maxItems","minItems","uniqueItems","maxProperties","minProperties","required","additionalProperties","enum","format","const"];Qi.exports=function(a,e){for(var t=0;t<e.length;t++){a=JSON.parse(JSON.stringify(a));var s=e[t].split("/"),r=a,n;for(n=1;n<s.length;n++)r=r[s[n]];for(n=0;n<Ji.length;n++){var o=Ji[n],l=r[o];l&&(r[o]={anyOf:[l,{$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"}]})}}return a}});var Yi=z((fg,Wi)=>{"use strict";var Ih=ka().MissingRef;Wi.exports=Gi;function Gi(a,e,t){var s=this;if(typeof this._opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");typeof e=="function"&&(t=e,e=void 0);var r=n(a).then(function(){var l=s._addSchema(a,void 0,e);return l.validate||o(l)});return t&&r.then(function(l){t(null,l)},t),r;function n(l){var u=l.$schema;return u&&!s.getSchema(u)?Gi.call(s,{$ref:u},!0):Promise.resolve()}function o(l){try{return s._compile(l)}catch(c){if(c instanceof Ih)return u(c);throw c}function u(c){var f=c.missingSchema;if(d(f))throw new Error("Schema "+f+" is loaded but "+c.missingRef+" cannot be resolved");var p=s._loadingSchemas[f];return p||(p=s._loadingSchemas[f]=s._opts.loadSchema(f),p.then(g,g)),p.then(function(y){if(!d(f))return n(y).then(function(){d(f)||s.addSchema(y,f,void 0,e)})}).then(function(){return o(l)});function g(){delete s._loadingSchemas[f]}function d(y){return s._refs[y]||s._schemas[y]}}}}});var el=z((hg,Xi)=>{"use strict";Xi.exports=function(e,t,s){var r=" ",n=e.level,o=e.dataLevel,l=e.schema[t],u=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,f=!e.opts.allErrors,p,g="data"+(o||""),d="valid"+n,y="errs__"+n,m=e.opts.$data&&l&&l.$data,v;m?(r+=" var schema"+n+" = "+e.util.getData(l.$data,o,e.dataPathArr)+"; ",v="schema"+n):v=l;var x=this,S="definition"+n,P=x.definition,O="",A,I,H,q,C;if(m&&P.$data){C="keywordValidate"+n;var U=P.validateSchema;r+=" var "+S+" = RULES.custom['"+t+"'].definition; var "+C+" = "+S+".validate;"}else{if(q=e.useCustomRule(x,l,e.schema,e),!q)return;v="validate.schema"+u,C=q.code,A=P.compile,I=P.inline,H=P.macro}var M=C+".errors",F="i"+n,$="ruleErr"+n,k=P.async;if(k&&!e.async)throw new Error("async keyword in sync schema");if(I||H||(r+=""+M+" = null;"),r+="var "+y+" = errors;var "+d+";",m&&P.$data&&(O+="}",r+=" if ("+v+" === undefined) { "+d+" = true; } else { ",U&&(O+="}",r+=" "+d+" = "+S+".validateSchema("+v+"); if ("+d+") { ")),I)P.statements?r+=" "+q.validate+" ":r+=" "+d+" = "+q.validate+"; ";else if(H){var L=e.util.copy(e),O="";L.level++;var le="valid"+L.level;L.schema=q.validate,L.schemaPath="";var Y=e.compositeRule;e.compositeRule=L.compositeRule=!0;var re=e.validate(L).replace(/validate\.schema/g,C);e.compositeRule=L.compositeRule=Y,r+=" "+re}else{var W=W||[];W.push(r),r="",r+=" "+C+".call( ",e.opts.passContext?r+="this":r+="self",A||P.schema===!1?r+=" , "+g+" ":r+=" , "+v+" , "+g+" , validate.schema"+e.schemaPath+" ",r+=" , (dataPath || '')",e.errorPath!='""'&&(r+=" + "+e.errorPath);var Z=o?"data"+(o-1||""):"parentData",me=o?e.dataPathArr[o]:"parentDataProperty";r+=" , "+Z+" , "+me+" , rootData ) ";var Re=r;r=W.pop(),P.errors===!1?(r+=" "+d+" = ",k&&(r+="await "),r+=""+Re+"; "):k?(M="customErrors"+n,r+=" var "+M+" = null; try { "+d+" = await "+Re+"; } catch (e) { "+d+" = false; if (e instanceof ValidationError) "+M+" = e.errors; else throw e; } "):r+=" "+M+" = null; "+d+" = "+Re+"; "}if(P.modifying&&(r+=" if ("+Z+") "+g+" = "+Z+"["+me+"];"),r+=""+O,P.valid)f&&(r+=" if (true) { ");else{r+=" if ( ",P.valid===void 0?(r+=" !",H?r+=""+le:r+=""+d):r+=" "+!P.valid+" ",r+=") { ",p=x.keyword;var W=W||[];W.push(r),r="";var W=W||[];W.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(p||"custom")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { keyword: '"+x.keyword+"' } ",e.opts.messages!==!1&&(r+=` , message: 'should pass "`+x.keyword+`" keyword validation' `),e.opts.verbose&&(r+=" , schema: validate.schema"+u+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+g+" "),r+=" } "):r+=" {} ";var Ae=r;r=W.pop(),!e.compositeRule&&f?e.async?r+=" throw new ValidationError(["+Ae+"]); ":r+=" validate.errors = ["+Ae+"]; return false; ":r+=" var err = "+Ae+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";var se=r;r=W.pop(),I?P.errors?P.errors!="full"&&(r+=" for (var "+F+"="+y+"; "+F+"<errors; "+F+"++) { var "+$+" = vErrors["+F+"]; if ("+$+".dataPath === undefined) "+$+".dataPath = (dataPath || '') + "+e.errorPath+"; if ("+$+".schemaPath === undefined) { "+$+'.schemaPath = "'+c+'"; } ',e.opts.verbose&&(r+=" "+$+".schema = "+v+"; "+$+".data = "+g+"; "),r+=" } "):P.errors===!1?r+=" "+se+" ":(r+=" if ("+y+" == errors) { "+se+" } else { for (var "+F+"="+y+"; "+F+"<errors; "+F+"++) { var "+$+" = vErrors["+F+"]; if ("+$+".dataPath === undefined) "+$+".dataPath = (dataPath || '') + "+e.errorPath+"; if ("+$+".schemaPath === undefined) { "+$+'.schemaPath = "'+c+'"; } ',e.opts.verbose&&(r+=" "+$+".schema = "+v+"; "+$+".data = "+g+"; "),r+=" } } "):H?(r+=" var err = ",e.createErrors!==!1?(r+=" { keyword: '"+(p||"custom")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { keyword: '"+x.keyword+"' } ",e.opts.messages!==!1&&(r+=` , message: 'should pass "`+x.keyword+`" keyword validation' `),e.opts.verbose&&(r+=" , schema: validate.schema"+u+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+g+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&f&&(e.async?r+=" throw new ValidationError(vErrors); ":r+=" validate.errors = vErrors; return false; ")):P.errors===!1?r+=" "+se+" ":(r+=" if (Array.isArray("+M+")) { if (vErrors === null) vErrors = "+M+"; else vErrors = vErrors.concat("+M+"); errors = vErrors.length; for (var "+F+"="+y+"; "+F+"<errors; "+F+"++) { var "+$+" = vErrors["+F+"]; if ("+$+".dataPath === undefined) "+$+".dataPath = (dataPath || '') + "+e.errorPath+"; "+$+'.schemaPath = "'+c+'"; ',e.opts.verbose&&(r+=" "+$+".schema = "+v+"; "+$+".data = "+g+"; "),r+=" } } else { "+se+" } "),r+=" } ",f&&(r+=" else { ")}return r}});var Ws=z((pg,Ch)=>{Ch.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"http://json-schema.org/draft-07/schema#",title:"Core schema meta-schema",definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},default:!0}});var al=z((mg,tl)=>{"use strict";var rl=Ws();tl.exports={$id:"https://github.com/ajv-validator/ajv/blob/master/lib/definition_schema.js",definitions:{simpleTypes:rl.definitions.simpleTypes},type:"object",dependencies:{schema:["validate"],$data:["validate"],statements:["inline"],valid:{not:{required:["macro"]}}},properties:{type:rl.properties.type,schema:{type:"boolean"},statements:{type:"boolean"},dependencies:{type:"array",items:{type:"string"}},metaSchema:{type:"object"},modifying:{type:"boolean"},valid:{type:"boolean"},$data:{type:"boolean"},async:{type:"boolean"},errors:{anyOf:[{type:"boolean"},{const:"full"}]}}}});var nl=z((vg,sl)=>{"use strict";var kh=/^[a-z_$][a-z0-9_$-]*$/i,Dh=el(),jh=al();sl.exports={add:Nh,get:Fh,remove:Lh,validate:Ys};function Nh(a,e){var t=this.RULES;if(t.keywords[a])throw new Error("Keyword "+a+" is already defined");if(!kh.test(a))throw new Error("Keyword "+a+" is not a valid identifier");if(e){this.validateKeyword(e,!0);var s=e.type;if(Array.isArray(s))for(var r=0;r<s.length;r++)o(a,s[r],e);else o(a,s,e);var n=e.metaSchema;n&&(e.$data&&this._opts.$data&&(n={anyOf:[n,{$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"}]}),e.validateSchema=this.compile(n,!0))}t.keywords[a]=t.all[a]=!0;function o(l,u,c){for(var f,p=0;p<t.length;p++){var g=t[p];if(g.type==u){f=g;break}}f||(f={type:u,rules:[]},t.push(f));var d={keyword:l,definition:c,custom:!0,code:Dh,implements:c.implements};f.rules.push(d),t.custom[l]=d}return this}function Fh(a){var e=this.RULES.custom[a];return e?e.definition:this.RULES.keywords[a]||!1}function Lh(a){var e=this.RULES;delete e.keywords[a],delete e.all[a],delete e.custom[a];for(var t=0;t<e.length;t++)for(var s=e[t].rules,r=0;r<s.length;r++)if(s[r].keyword==a){s.splice(r,1);break}return this}function Ys(a,e){Ys.errors=null;var t=this._validateKeyword=this._validateKeyword||this.compile(jh,!0);if(t(a))return!0;if(Ys.errors=t.errors,e)throw new Error("custom keyword definition is invalid: "+this.errorsText(t.errors));return!1}});var ol=z((gg,Mh)=>{Mh.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",description:"Meta-schema for $data reference (JSON Schema extension proposal)",type:"object",required:["$data"],properties:{$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},additionalProperties:!1}});var en=z((yg,ml)=>{"use strict";var ll=Mo(),st=Ca(),qh=Uo(),cl=Fs(),Uh=Vs(),zh=Xo(),Vh=Bi(),ul=Ki(),dl=at();ml.exports=ge;ge.prototype.validate=Zh;ge.prototype.compile=Bh;ge.prototype.addSchema=Jh;ge.prototype.addMetaSchema=Qh;ge.prototype.validateSchema=Kh;ge.prototype.getSchema=Wh;ge.prototype.removeSchema=Xh;ge.prototype.addFormat=ip;ge.prototype.errorsText=op;ge.prototype._addSchema=ep;ge.prototype._compile=rp;ge.prototype.compileAsync=Yi();var Ua=nl();ge.prototype.addKeyword=Ua.add;ge.prototype.getKeyword=Ua.get;ge.prototype.removeKeyword=Ua.remove;ge.prototype.validateKeyword=Ua.validate;var fl=ka();ge.ValidationError=fl.Validation;ge.MissingRefError=fl.MissingRef;ge.$dataMetaSchema=ul;var qa="http://json-schema.org/draft-07/schema",il=["removeAdditional","useDefaults","coerceTypes","strictDefaults"],Hh=["/properties"];function ge(a){if(!(this instanceof ge))return new ge(a);a=this._opts=dl.copy(a)||{},hp(this),this._schemas={},this._refs={},this._fragments={},this._formats=zh(a.format),this._cache=a.cache||new qh,this._loadingSchemas={},this._compilations=[],this.RULES=Vh(),this._getId=tp(a),a.loopRequired=a.loopRequired||1/0,a.errorDataPath=="property"&&(a._errorDataPathProperty=!0),a.serialize===void 0&&(a.serialize=Uh),this._metaOpts=fp(this),a.formats&&up(this),a.keywords&&dp(this),lp(this),typeof a.meta=="object"&&this.addMetaSchema(a.meta),a.nullable&&this.addKeyword("nullable",{metaSchema:{type:"boolean"}}),cp(this)}function Zh(a,e){var t;if(typeof a=="string"){if(t=this.getSchema(a),!t)throw new Error('no schema with key or ref "'+a+'"')}else{var s=this._addSchema(a);t=s.validate||this._compile(s)}var r=t(e);return t.$async!==!0&&(this.errors=t.errors),r}function Bh(a,e){var t=this._addSchema(a,void 0,e);return t.validate||this._compile(t)}function Jh(a,e,t,s){if(Array.isArray(a)){for(var r=0;r<a.length;r++)this.addSchema(a[r],void 0,t,s);return this}var n=this._getId(a);if(n!==void 0&&typeof n!="string")throw new Error("schema id must be string");return e=st.normalizeId(e||n),pl(this,e),this._schemas[e]=this._addSchema(a,t,s,!0),this}function Qh(a,e,t){return this.addSchema(a,e,t,!0),this}function Kh(a,e){var t=a.$schema;if(t!==void 0&&typeof t!="string")throw new Error("$schema must be a string");if(t=t||this._opts.defaultMeta||Gh(this),!t)return this.logger.warn("meta-schema not available"),this.errors=null,!0;var s=this.validate(t,a);if(!s&&e){var r="schema is invalid: "+this.errorsText();if(this._opts.validateSchema=="log")this.logger.error(r);else throw new Error(r)}return s}function Gh(a){var e=a._opts.meta;return a._opts.defaultMeta=typeof e=="object"?a._getId(e)||e:a.getSchema(qa)?qa:void 0,a._opts.defaultMeta}function Wh(a){var e=hl(this,a);switch(typeof e){case"object":return e.validate||this._compile(e);case"string":return this.getSchema(e);case"undefined":return Yh(this,a)}}function Yh(a,e){var t=st.schema.call(a,{schema:{}},e);if(t){var s=t.schema,r=t.root,n=t.baseId,o=ll.call(a,s,r,void 0,n);return a._fragments[e]=new cl({ref:e,fragment:!0,schema:s,root:r,baseId:n,validate:o}),o}}function hl(a,e){return e=st.normalizeId(e),a._schemas[e]||a._refs[e]||a._fragments[e]}function Xh(a){if(a instanceof RegExp)return Ma(this,this._schemas,a),Ma(this,this._refs,a),this;switch(typeof a){case"undefined":return Ma(this,this._schemas),Ma(this,this._refs),this._cache.clear(),this;case"string":var e=hl(this,a);return e&&this._cache.del(e.cacheKey),delete this._schemas[a],delete this._refs[a],this;case"object":var t=this._opts.serialize,s=t?t(a):a;this._cache.del(s);var r=this._getId(a);r&&(r=st.normalizeId(r),delete this._schemas[r],delete this._refs[r])}return this}function Ma(a,e,t){for(var s in e){var r=e[s];!r.meta&&(!t||t.test(s))&&(a._cache.del(r.cacheKey),delete e[s])}}function ep(a,e,t,s){if(typeof a!="object"&&typeof a!="boolean")throw new Error("schema should be object or boolean");var r=this._opts.serialize,n=r?r(a):a,o=this._cache.get(n);if(o)return o;s=s||this._opts.addUsedSchema!==!1;var l=st.normalizeId(this._getId(a));l&&s&&pl(this,l);var u=this._opts.validateSchema!==!1&&!e,c;u&&!(c=l&&l==st.normalizeId(a.$schema))&&this.validateSchema(a,!0);var f=st.ids.call(this,a),p=new cl({id:l,schema:a,localRefs:f,cacheKey:n,meta:t});return l[0]!="#"&&s&&(this._refs[l]=p),this._cache.put(n,p),u&&c&&this.validateSchema(a,!0),p}function rp(a,e){if(a.compiling)return a.validate=r,r.schema=a.schema,r.errors=null,r.root=e||r,a.schema.$async===!0&&(r.$async=!0),r;a.compiling=!0;var t;a.meta&&(t=this._opts,this._opts=this._metaOpts);var s;try{s=ll.call(this,a.schema,e,a.localRefs)}catch(n){throw delete a.validate,n}finally{a.compiling=!1,a.meta&&(this._opts=t)}return a.validate=s,a.refs=s.refs,a.refVal=s.refVal,a.root=s.root,s;function r(){var n=a.validate,o=n.apply(this,arguments);return r.errors=n.errors,o}}function tp(a){switch(a.schemaId){case"auto":return np;case"id":return ap;default:return sp}}function ap(a){return a.$id&&this.logger.warn("schema $id ignored",a.$id),a.id}function sp(a){return a.id&&this.logger.warn("schema id ignored",a.id),a.$id}function np(a){if(a.$id&&a.id&&a.$id!=a.id)throw new Error("schema $id is different from id");return a.$id||a.id}function op(a,e){if(a=a||this.errors,!a)return"No errors";e=e||{};for(var t=e.separator===void 0?", ":e.separator,s=e.dataVar===void 0?"data":e.dataVar,r="",n=0;n<a.length;n++){var o=a[n];o&&(r+=s+o.dataPath+" "+o.message+t)}return r.slice(0,-t.length)}function ip(a,e){return typeof e=="string"&&(e=new RegExp(e)),this._formats[a]=e,this}function lp(a){var e;if(a._opts.$data&&(e=ol(),a.addMetaSchema(e,e.$id,!0)),a._opts.meta!==!1){var t=Ws();a._opts.$data&&(t=ul(t,Hh)),a.addMetaSchema(t,qa,!0),a._refs["http://json-schema.org/schema"]=qa}}function cp(a){var e=a._opts.schemas;if(e)if(Array.isArray(e))a.addSchema(e);else for(var t in e)a.addSchema(e[t],t)}function up(a){for(var e in a._opts.formats){var t=a._opts.formats[e];a.addFormat(e,t)}}function dp(a){for(var e in a._opts.keywords){var t=a._opts.keywords[e];a.addKeyword(e,t)}}function pl(a,e){if(a._schemas[e]||a._refs[e])throw new Error('schema with key or id "'+e+'" already exists')}function fp(a){for(var e=dl.copy(a._opts),t=0;t<il.length;t++)delete e[il[t]];return e}function hp(a){var e=a._opts.logger;if(e===!1)a.logger={log:Xs,warn:Xs,error:Xs};else{if(e===void 0&&(e=console),!(typeof e=="object"&&e.log&&e.warn&&e.error))throw new Error("logger must implement log, warn and error methods");a.logger=e}}function Xs(){}});var bl=z((Sg,Ha)=>{"use strict";Ha.exports=gp;Ha.exports.format=yl;Ha.exports.parse=_l;var pp=/\B(?=(\d{3})+(?!\d))/g,mp=/(?:\.0*|(\.[^0]+)0+)$/,Ir={b:1,kb:1024,mb:1<<20,gb:1<<30,tb:Math.pow(1024,4),pb:Math.pow(1024,5)},vp=/^((-|\+)?(\d+(?:\.\d+)?)) *(kb|mb|gb|tb|pb)$/i;function gp(a,e){return typeof a=="string"?_l(a):typeof a=="number"?yl(a,e):null}function yl(a,e){if(!Number.isFinite(a))return null;var t=Math.abs(a),s=e&&e.thousandsSeparator||"",r=e&&e.unitSeparator||"",n=e&&e.decimalPlaces!==void 0?e.decimalPlaces:2,o=!!(e&&e.fixedDecimals),l=e&&e.unit||"";(!l||!Ir[l.toLowerCase()])&&(t>=Ir.pb?l="PB":t>=Ir.tb?l="TB":t>=Ir.gb?l="GB":t>=Ir.mb?l="MB":t>=Ir.kb?l="KB":l="B");var u=a/Ir[l.toLowerCase()],c=u.toFixed(n);return o||(c=c.replace(mp,"$1")),s&&(c=c.split(".").map(function(f,p){return p===0?f.replace(pp,s):f}).join(".")),c+r+l}function _l(a){if(typeof a=="number"&&!isNaN(a))return a;if(typeof a!="string")return null;var e=vp.exec(a),t,s="b";return e?(t=parseFloat(e[1]),s=e[4].toLowerCase()):(t=parseInt(a,10),s="b"),isNaN(t)?null:Math.floor(Ir[s]*t)}});var tn=z(rn=>{"use strict";var wl=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,yp=/^[\u000b\u0020-\u007e\u0080-\u00ff]+$/,El=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/,_p=/\\([\u000b\u0020-\u00ff])/g,bp=/([\\"])/g,Pl=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;rn.format=xp;rn.parse=wp;function xp(a){if(!a||typeof a!="object")throw new TypeError("argument obj is required");var e=a.parameters,t=a.type;if(!t||!Pl.test(t))throw new TypeError("invalid type");var s=t;if(e&&typeof e=="object")for(var r,n=Object.keys(e).sort(),o=0;o<n.length;o++){if(r=n[o],!El.test(r))throw new TypeError("invalid parameter name");s+="; "+r+"="+Pp(e[r])}return s}function wp(a){if(!a)throw new TypeError("argument string is required");var e=typeof a=="object"?Ep(a):a;if(typeof e!="string")throw new TypeError("argument string is required to be a string");var t=e.indexOf(";"),s=t!==-1?e.slice(0,t).trim():e.trim();if(!Pl.test(s))throw new TypeError("invalid media type");var r=new Sp(s.toLowerCase());if(t!==-1){var n,o,l;for(wl.lastIndex=t;o=wl.exec(e);){if(o.index!==t)throw new TypeError("invalid parameter format");t+=o[0].length,n=o[1].toLowerCase(),l=o[2],l.charCodeAt(0)===34&&(l=l.slice(1,-1),l.indexOf("\\")!==-1&&(l=l.replace(_p,"$1"))),r.parameters[n]=l}if(t!==e.length)throw new TypeError("invalid parameter format")}return r}function Ep(a){var e;if(typeof a.getHeader=="function"?e=a.getHeader("content-type"):typeof a.headers=="object"&&(e=a.headers&&a.headers["content-type"]),typeof e!="string")throw new TypeError("content-type header is missing from object");return e}function Pp(a){var e=String(a);if(El.test(e))return e;if(e.length>0&&!yp.test(e))throw new TypeError("invalid parameter value");return'"'+e.replace(bp,"\\$1")+'"'}function Sp(a){this.parameters=Object.create(null),this.type=a}});var Cl=z((Ig,Il)=>{Il.exports=Al;Al.sync=Tp;var Tl=require("fs");function Op(a,e){var t=e.pathExt!==void 0?e.pathExt:process.env.PATHEXT;if(!t||(t=t.split(";"),t.indexOf("")!==-1))return!0;for(var s=0;s<t.length;s++){var r=t[s].toLowerCase();if(r&&a.substr(-r.length).toLowerCase()===r)return!0}return!1}function $l(a,e,t){return!a.isSymbolicLink()&&!a.isFile()?!1:Op(e,t)}function Al(a,e,t){Tl.stat(a,function(s,r){t(s,s?!1:$l(r,a,e))})}function Tp(a,e){return $l(Tl.statSync(a),a,e)}});var Fl=z((Cg,Nl)=>{Nl.exports=Dl;Dl.sync=$p;var kl=require("fs");function Dl(a,e,t){kl.stat(a,function(s,r){t(s,s?!1:jl(r,e))})}function $p(a,e){return jl(kl.statSync(a),e)}function jl(a,e){return a.isFile()&&Ap(a,e)}function Ap(a,e){var t=a.mode,s=a.uid,r=a.gid,n=e.uid!==void 0?e.uid:process.getuid&&process.getuid(),o=e.gid!==void 0?e.gid:process.getgid&&process.getgid(),l=parseInt("100",8),u=parseInt("010",8),c=parseInt("001",8),f=l|u,p=t&c||t&u&&r===o||t&l&&s===n||t&f&&n===0;return p}});var Ml=z((Dg,Ll)=>{var kg=require("fs"),Ba;process.platform==="win32"||global.TESTING_WINDOWS?Ba=Cl():Ba=Fl();Ll.exports=an;an.sync=Ip;function an(a,e,t){if(typeof e=="function"&&(t=e,e={}),!t){if(typeof Promise!="function")throw new TypeError("callback not provided");return new Promise(function(s,r){an(a,e||{},function(n,o){n?r(n):s(o)})})}Ba(a,e||{},function(s,r){s&&(s.code==="EACCES"||e&&e.ignoreErrors)&&(s=null,r=!1),t(s,r)})}function Ip(a,e){try{return Ba.sync(a,e||{})}catch(t){if(e&&e.ignoreErrors||t.code==="EACCES")return!1;throw t}}});var Bl=z((jg,Zl)=>{var Rt=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",ql=require("path"),Cp=Rt?";":":",Ul=Ml(),zl=a=>Object.assign(new Error(`not found: ${a}`),{code:"ENOENT"}),Vl=(a,e)=>{let t=e.colon||Cp,s=a.match(/\//)||Rt&&a.match(/\\/)?[""]:[...Rt?[process.cwd()]:[],...(e.path||process.env.PATH||"").split(t)],r=Rt?e.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",n=Rt?r.split(t):[""];return Rt&&a.indexOf(".")!==-1&&n[0]!==""&&n.unshift(""),{pathEnv:s,pathExt:n,pathExtExe:r}},Hl=(a,e,t)=>{typeof e=="function"&&(t=e,e={}),e||(e={});let{pathEnv:s,pathExt:r,pathExtExe:n}=Vl(a,e),o=[],l=c=>new Promise((f,p)=>{if(c===s.length)return e.all&&o.length?f(o):p(zl(a));let g=s[c],d=/^".*"$/.test(g)?g.slice(1,-1):g,y=ql.join(d,a),m=!d&&/^\.[\\\/]/.test(a)?a.slice(0,2)+y:y;f(u(m,c,0))}),u=(c,f,p)=>new Promise((g,d)=>{if(p===r.length)return g(l(f+1));let y=r[p];Ul(c+y,{pathExt:n},(m,v)=>{if(!m&&v)if(e.all)o.push(c+y);else return g(c+y);return g(u(c,f,p+1))})});return t?l(0).then(c=>t(null,c),t):l(0)},kp=(a,e)=>{e=e||{};let{pathEnv:t,pathExt:s,pathExtExe:r}=Vl(a,e),n=[];for(let o=0;o<t.length;o++){let l=t[o],u=/^".*"$/.test(l)?l.slice(1,-1):l,c=ql.join(u,a),f=!u&&/^\.[\\\/]/.test(a)?a.slice(0,2)+c:c;for(let p=0;p<s.length;p++){let g=f+s[p];try{if(Ul.sync(g,{pathExt:r}))if(e.all)n.push(g);else return g}catch{}}}if(e.all&&n.length)return n;if(e.nothrow)return null;throw zl(a)};Zl.exports=Hl;Hl.sync=kp});var Ql=z((Ng,sn)=>{"use strict";var Jl=(a={})=>{let e=a.env||process.env;return(a.platform||process.platform)!=="win32"?"PATH":Object.keys(e).reverse().find(s=>s.toUpperCase()==="PATH")||"Path"};sn.exports=Jl;sn.exports.default=Jl});var Yl=z((Fg,Wl)=>{"use strict";var Kl=require("path"),Dp=Bl(),jp=Ql();function Gl(a,e){let t=a.options.env||process.env,s=process.cwd(),r=a.options.cwd!=null,n=r&&process.chdir!==void 0&&!process.chdir.disabled;if(n)try{process.chdir(a.options.cwd)}catch{}let o;try{o=Dp.sync(a.command,{path:t[jp({env:t})],pathExt:e?Kl.delimiter:void 0})}catch{}finally{n&&process.chdir(s)}return o&&(o=Kl.resolve(r?a.options.cwd:"",o)),o}function Np(a){return Gl(a)||Gl(a,!0)}Wl.exports=Np});var Xl=z((Lg,on)=>{"use strict";var nn=/([()\][%!^"`<>&|;, *?])/g;function Fp(a){return a=a.replace(nn,"^$1"),a}function Lp(a,e){return a=`${a}`,a=a.replace(/(?=(\\+?)?)\1"/g,'$1$1\\"'),a=a.replace(/(?=(\\+?)?)\1$/,"$1$1"),a=`"${a}"`,a=a.replace(nn,"^$1"),e&&(a=a.replace(nn,"^$1")),a}on.exports.command=Fp;on.exports.argument=Lp});var rc=z((Mg,ec)=>{"use strict";ec.exports=/^#!(.*)/});var ac=z((qg,tc)=>{"use strict";var Mp=rc();tc.exports=(a="")=>{let e=a.match(Mp);if(!e)return null;let[t,s]=e[0].replace(/#! ?/,"").split(" "),r=t.split("/").pop();return r==="env"?s:s?`${r} ${s}`:r}});var nc=z((Ug,sc)=>{"use strict";var ln=require("fs"),qp=ac();function Up(a){let t=Buffer.alloc(150),s;try{s=ln.openSync(a,"r"),ln.readSync(s,t,0,150,0),ln.closeSync(s)}catch{}return qp(t.toString())}sc.exports=Up});var cc=z((zg,lc)=>{"use strict";var zp=require("path"),oc=Yl(),ic=Xl(),Vp=nc(),Hp=process.platform==="win32",Zp=/\.(?:com|exe)$/i,Bp=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function Jp(a){a.file=oc(a);let e=a.file&&Vp(a.file);return e?(a.args.unshift(a.file),a.command=e,oc(a)):a.file}function Qp(a){if(!Hp)return a;let e=Jp(a),t=!Zp.test(e);if(a.options.forceShell||t){let s=Bp.test(e);a.command=zp.normalize(a.command),a.command=ic.command(a.command),a.args=a.args.map(n=>ic.argument(n,s));let r=[a.command].concat(a.args).join(" ");a.args=["/d","/s","/c",`"${r}"`],a.command=process.env.comspec||"cmd.exe",a.options.windowsVerbatimArguments=!0}return a}function Kp(a,e,t){e&&!Array.isArray(e)&&(t=e,e=null),e=e?e.slice(0):[],t=Object.assign({},t);let s={command:a,args:e,options:t,file:void 0,original:{command:a,args:e}};return t.shell?s:Qp(s)}lc.exports=Kp});var fc=z((Vg,dc)=>{"use strict";var cn=process.platform==="win32";function un(a,e){return Object.assign(new Error(`${e} ${a.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${e} ${a.command}`,path:a.command,spawnargs:a.args})}function Gp(a,e){if(!cn)return;let t=a.emit;a.emit=function(s,r){if(s==="exit"){let n=uc(r,e);if(n)return t.call(a,"error",n)}return t.apply(a,arguments)}}function uc(a,e){return cn&&a===1&&!e.file?un(e.original,"spawn"):null}function Wp(a,e){return cn&&a===1&&!e.file?un(e.original,"spawnSync"):null}dc.exports={hookChildProcess:Gp,verifyENOENT:uc,verifyENOENTSync:Wp,notFoundError:un}});var mc=z((Hg,Ot)=>{"use strict";var hc=require("child_process"),dn=cc(),fn=fc();function pc(a,e,t){let s=dn(a,e,t),r=hc.spawn(s.command,s.args,s.options);return fn.hookChildProcess(r,s),r}function Yp(a,e,t){let s=dn(a,e,t),r=hc.spawnSync(s.command,s.args,s.options);return r.error=r.error||fn.verifyENOENTSync(r.status,s),r}Ot.exports=pc;Ot.exports.spawn=pc;Ot.exports.sync=Yp;Ot.exports._parse=dn;Ot.exports._enoent=fn});var jm={};Mn(jm,{CallToolRequestSchema:()=>Ps,Client:()=>za,ListRootsRequestSchema:()=>Ts,ListToolsRequestSchema:()=>ws,PingRequestSchema:()=>Pt,SSEServerTransport:()=>Za,Server:()=>Va,StdioClientTransport:()=>Qa,StdioServerTransport:()=>Ka,StreamableHTTPClientTransport:()=>es,StreamableHTTPServerTransport:()=>Ga,z:()=>i,zodToJsonSchema:()=>Rn});module.exports=Fu(jm);var i={};Mn(i,{BRAND:()=>cd,DIRTY:()=>Mr,EMPTY_PATH:()=>Uu,INVALID:()=>B,NEVER:()=>Jd,OK:()=>Te,ParseStatus:()=>Se,Schema:()=>G,ZodAny:()=>Sr,ZodArray:()=>gr,ZodBigInt:()=>Ur,ZodBoolean:()=>zr,ZodBranded:()=>Ft,ZodCatch:()=>Xr,ZodDate:()=>Vr,ZodDefault:()=>Yr,ZodDiscriminatedUnion:()=>da,ZodEffects:()=>Je,ZodEnum:()=>Gr,ZodError:()=>Ne,ZodFirstPartyTypeKind:()=>T,ZodFunction:()=>ha,ZodIntersection:()=>Jr,ZodIssueCode:()=>R,ZodLazy:()=>Qr,ZodLiteral:()=>Kr,ZodMap:()=>bt,ZodNaN:()=>wt,ZodNativeEnum:()=>Wr,ZodNever:()=>We,ZodNull:()=>Zr,ZodNullable:()=>or,ZodNumber:()=>qr,ZodObject:()=>Fe,ZodOptional:()=>Ze,ZodParsedType:()=>j,ZodPipeline:()=>Lt,ZodPromise:()=>Rr,ZodReadonly:()=>et,ZodRecord:()=>fa,ZodSchema:()=>G,ZodSet:()=>xt,ZodString:()=>Pr,ZodSymbol:()=>yt,ZodTransformer:()=>Je,ZodTuple:()=>nr,ZodType:()=>G,ZodUndefined:()=>Hr,ZodUnion:()=>Br,ZodUnknown:()=>vr,ZodVoid:()=>_t,addIssueToContext:()=>D,any:()=>yd,array:()=>wd,bigint:()=>hd,boolean:()=>Wn,coerce:()=>Bd,custom:()=>Qn,date:()=>pd,datetimeRegex:()=>Bn,defaultErrorMap:()=>pr,discriminatedUnion:()=>Rd,effect:()=>Ld,enum:()=>jd,function:()=>Cd,getErrorMap:()=>mt,getParsedType:()=>sr,instanceof:()=>dd,intersection:()=>Od,isAborted:()=>ca,isAsync:()=>vt,isDirty:()=>ua,isValid:()=>Er,late:()=>ud,lazy:()=>kd,literal:()=>Dd,makeIssue:()=>Nt,map:()=>Ad,nan:()=>fd,nativeEnum:()=>Nd,never:()=>bd,null:()=>gd,nullable:()=>qd,number:()=>Gn,object:()=>Ed,objectUtil:()=>cs,oboolean:()=>Zd,onumber:()=>Hd,optional:()=>Md,ostring:()=>Vd,pipeline:()=>zd,preprocess:()=>Ud,promise:()=>Fd,quotelessJson:()=>Lu,record:()=>$d,set:()=>Id,setErrorMap:()=>qu,strictObject:()=>Pd,string:()=>Kn,symbol:()=>md,transformer:()=>Ld,tuple:()=>Td,undefined:()=>vd,union:()=>Sd,unknown:()=>_d,util:()=>X,void:()=>xd});var X;(function(a){a.assertEqual=r=>{};function e(r){}a.assertIs=e;function t(r){throw new Error}a.assertNever=t,a.arrayToEnum=r=>{let n={};for(let o of r)n[o]=o;return n},a.getValidEnumValues=r=>{let n=a.objectKeys(r).filter(l=>typeof r[r[l]]!="number"),o={};for(let l of n)o[l]=r[l];return a.objectValues(o)},a.objectValues=r=>a.objectKeys(r).map(function(n){return r[n]}),a.objectKeys=typeof Object.keys=="function"?r=>Object.keys(r):r=>{let n=[];for(let o in r)Object.prototype.hasOwnProperty.call(r,o)&&n.push(o);return n},a.find=(r,n)=>{for(let o of r)if(n(o))return o},a.isInteger=typeof Number.isInteger=="function"?r=>Number.isInteger(r):r=>typeof r=="number"&&Number.isFinite(r)&&Math.floor(r)===r;function s(r,n=" | "){return r.map(o=>typeof o=="string"?`'${o}'`:o).join(n)}a.joinValues=s,a.jsonStringifyReplacer=(r,n)=>typeof n=="bigint"?n.toString():n})(X||(X={}));var cs;(function(a){a.mergeShapes=(e,t)=>({...e,...t})})(cs||(cs={}));var j=X.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),sr=a=>{switch(typeof a){case"undefined":return j.undefined;case"string":return j.string;case"number":return Number.isNaN(a)?j.nan:j.number;case"boolean":return j.boolean;case"function":return j.function;case"bigint":return j.bigint;case"symbol":return j.symbol;case"object":return Array.isArray(a)?j.array:a===null?j.null:a.then&&typeof a.then=="function"&&a.catch&&typeof a.catch=="function"?j.promise:typeof Map!="undefined"&&a instanceof Map?j.map:typeof Set!="undefined"&&a instanceof Set?j.set:typeof Date!="undefined"&&a instanceof Date?j.date:j.object;default:return j.unknown}};var R=X.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"]),Lu=a=>JSON.stringify(a,null,2).replace(/"([^"]+)":/g,"$1:"),Ne=class a extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=s=>{this.issues=[...this.issues,s]},this.addIssues=(s=[])=>{this.issues=[...this.issues,...s]};let t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){let t=e||function(n){return n.message},s={_errors:[]},r=n=>{for(let o of n.issues)if(o.code==="invalid_union")o.unionErrors.map(r);else if(o.code==="invalid_return_type")r(o.returnTypeError);else if(o.code==="invalid_arguments")r(o.argumentsError);else if(o.path.length===0)s._errors.push(t(o));else{let l=s,u=0;for(;u<o.path.length;){let c=o.path[u];u===o.path.length-1?(l[c]=l[c]||{_errors:[]},l[c]._errors.push(t(o))):l[c]=l[c]||{_errors:[]},l=l[c],u++}}};return r(this),s}static assert(e){if(!(e instanceof a))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,X.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){let t={},s=[];for(let r of this.issues)if(r.path.length>0){let n=r.path[0];t[n]=t[n]||[],t[n].push(e(r))}else s.push(e(r));return{formErrors:s,fieldErrors:t}}get formErrors(){return this.flatten()}};Ne.create=a=>new Ne(a);var Mu=(a,e)=>{let t;switch(a.code){case R.invalid_type:a.received===j.undefined?t="Required":t=`Expected ${a.expected}, received ${a.received}`;break;case R.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(a.expected,X.jsonStringifyReplacer)}`;break;case R.unrecognized_keys:t=`Unrecognized key(s) in object: ${X.joinValues(a.keys,", ")}`;break;case R.invalid_union:t="Invalid input";break;case R.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${X.joinValues(a.options)}`;break;case R.invalid_enum_value:t=`Invalid enum value. Expected ${X.joinValues(a.options)}, received '${a.received}'`;break;case R.invalid_arguments:t="Invalid function arguments";break;case R.invalid_return_type:t="Invalid function return type";break;case R.invalid_date:t="Invalid date";break;case R.invalid_string:typeof a.validation=="object"?"includes"in a.validation?(t=`Invalid input: must include "${a.validation.includes}"`,typeof a.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${a.validation.position}`)):"startsWith"in a.validation?t=`Invalid input: must start with "${a.validation.startsWith}"`:"endsWith"in a.validation?t=`Invalid input: must end with "${a.validation.endsWith}"`:X.assertNever(a.validation):a.validation!=="regex"?t=`Invalid ${a.validation}`:t="Invalid";break;case R.too_small:a.type==="array"?t=`Array must contain ${a.exact?"exactly":a.inclusive?"at least":"more than"} ${a.minimum} element(s)`:a.type==="string"?t=`String must contain ${a.exact?"exactly":a.inclusive?"at least":"over"} ${a.minimum} character(s)`:a.type==="number"?t=`Number must be ${a.exact?"exactly equal to ":a.inclusive?"greater than or equal to ":"greater than "}${a.minimum}`:a.type==="bigint"?t=`Number must be ${a.exact?"exactly equal to ":a.inclusive?"greater than or equal to ":"greater than "}${a.minimum}`:a.type==="date"?t=`Date must be ${a.exact?"exactly equal to ":a.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(a.minimum))}`:t="Invalid input";break;case R.too_big:a.type==="array"?t=`Array must contain ${a.exact?"exactly":a.inclusive?"at most":"less than"} ${a.maximum} element(s)`:a.type==="string"?t=`String must contain ${a.exact?"exactly":a.inclusive?"at most":"under"} ${a.maximum} character(s)`:a.type==="number"?t=`Number must be ${a.exact?"exactly":a.inclusive?"less than or equal to":"less than"} ${a.maximum}`:a.type==="bigint"?t=`BigInt must be ${a.exact?"exactly":a.inclusive?"less than or equal to":"less than"} ${a.maximum}`:a.type==="date"?t=`Date must be ${a.exact?"exactly":a.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(a.maximum))}`:t="Invalid input";break;case R.custom:t="Invalid input";break;case R.invalid_intersection_types:t="Intersection results could not be merged";break;case R.not_multiple_of:t=`Number must be a multiple of ${a.multipleOf}`;break;case R.not_finite:t="Number must be finite";break;default:t=e.defaultError,X.assertNever(a)}return{message:t}},pr=Mu;var Un=pr;function qu(a){Un=a}function mt(){return Un}var Nt=a=>{let{data:e,path:t,errorMaps:s,issueData:r}=a,n=[...t,...r.path||[]],o={...r,path:n};if(r.message!==void 0)return{...r,path:n,message:r.message};let l="",u=s.filter(c=>!!c).slice().reverse();for(let c of u)l=c(o,{data:e,defaultError:l}).message;return{...r,path:n,message:l}},Uu=[];function D(a,e){let t=mt(),s=Nt({issueData:e,data:a.data,path:a.path,errorMaps:[a.common.contextualErrorMap,a.schemaErrorMap,t,t===pr?void 0:pr].filter(r=>!!r)});a.common.issues.push(s)}var Se=class a{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){let s=[];for(let r of t){if(r.status==="aborted")return B;r.status==="dirty"&&e.dirty(),s.push(r.value)}return{status:e.value,value:s}}static async mergeObjectAsync(e,t){let s=[];for(let r of t){let n=await r.key,o=await r.value;s.push({key:n,value:o})}return a.mergeObjectSync(e,s)}static mergeObjectSync(e,t){let s={};for(let r of t){let{key:n,value:o}=r;if(n.status==="aborted"||o.status==="aborted")return B;n.status==="dirty"&&e.dirty(),o.status==="dirty"&&e.dirty(),n.value!=="__proto__"&&(typeof o.value!="undefined"||r.alwaysSet)&&(s[n.value]=o.value)}return{status:e.value,value:s}}},B=Object.freeze({status:"aborted"}),Mr=a=>({status:"dirty",value:a}),Te=a=>({status:"valid",value:a}),ca=a=>a.status==="aborted",ua=a=>a.status==="dirty",Er=a=>a.status==="valid",vt=a=>typeof Promise!="undefined"&&a instanceof Promise;var V;(function(a){a.errToObj=e=>typeof e=="string"?{message:e}:e||{},a.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(V||(V={}));var Be=class{constructor(e,t,s,r){this._cachedPath=[],this.parent=e,this.data=t,this._path=s,this._key=r}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},zn=(a,e)=>{if(Er(e))return{success:!0,data:e.value};if(!a.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let t=new Ne(a.common.issues);return this._error=t,this._error}}};function Q(a){if(!a)return{};let{errorMap:e,invalid_type_error:t,required_error:s,description:r}=a;if(e&&(t||s))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:r}:{errorMap:(o,l)=>{var c,f;let{message:u}=a;return o.code==="invalid_enum_value"?{message:u!=null?u:l.defaultError}:typeof l.data=="undefined"?{message:(c=u!=null?u:s)!=null?c:l.defaultError}:o.code!=="invalid_type"?{message:l.defaultError}:{message:(f=u!=null?u:t)!=null?f:l.defaultError}},description:r}}var G=class{get description(){return this._def.description}_getType(e){return sr(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:sr(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Se,ctx:{common:e.parent.common,data:e.data,parsedType:sr(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(vt(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){let t=this._parse(e);return Promise.resolve(t)}parse(e,t){let s=this.safeParse(e,t);if(s.success)return s.data;throw s.error}safeParse(e,t){var n;let s={common:{issues:[],async:(n=t==null?void 0:t.async)!=null?n:!1,contextualErrorMap:t==null?void 0:t.errorMap},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:sr(e)},r=this._parseSync({data:e,path:s.path,parent:s});return zn(s,r)}"~validate"(e){var s,r;let t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:sr(e)};if(!this["~standard"].async)try{let n=this._parseSync({data:e,path:[],parent:t});return Er(n)?{value:n.value}:{issues:t.common.issues}}catch(n){(r=(s=n==null?void 0:n.message)==null?void 0:s.toLowerCase())!=null&&r.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(n=>Er(n)?{value:n.value}:{issues:t.common.issues})}async parseAsync(e,t){let s=await this.safeParseAsync(e,t);if(s.success)return s.data;throw s.error}async safeParseAsync(e,t){let s={common:{issues:[],contextualErrorMap:t==null?void 0:t.errorMap,async:!0},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:sr(e)},r=this._parse({data:e,path:s.path,parent:s}),n=await(vt(r)?r:Promise.resolve(r));return zn(s,n)}refine(e,t){let s=r=>typeof t=="string"||typeof t=="undefined"?{message:t}:typeof t=="function"?t(r):t;return this._refinement((r,n)=>{let o=e(r),l=()=>n.addIssue({code:R.custom,...s(r)});return typeof Promise!="undefined"&&o instanceof Promise?o.then(u=>u?!0:(l(),!1)):o?!0:(l(),!1)})}refinement(e,t){return this._refinement((s,r)=>e(s)?!0:(r.addIssue(typeof t=="function"?t(s,r):t),!1))}_refinement(e){return new Je({schema:this,typeName:T.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:t=>this["~validate"](t)}}optional(){return Ze.create(this,this._def)}nullable(){return or.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return gr.create(this)}promise(){return Rr.create(this,this._def)}or(e){return Br.create([this,e],this._def)}and(e){return Jr.create(this,e,this._def)}transform(e){return new Je({...Q(this._def),schema:this,typeName:T.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let t=typeof e=="function"?e:()=>e;return new Yr({...Q(this._def),innerType:this,defaultValue:t,typeName:T.ZodDefault})}brand(){return new Ft({typeName:T.ZodBranded,type:this,...Q(this._def)})}catch(e){let t=typeof e=="function"?e:()=>e;return new Xr({...Q(this._def),innerType:this,catchValue:t,typeName:T.ZodCatch})}describe(e){let t=this.constructor;return new t({...this._def,description:e})}pipe(e){return Lt.create(this,e)}readonly(){return et.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},zu=/^c[^\s-]{8,}$/i,Vu=/^[0-9a-z]+$/,Hu=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Zu=/^[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,Bu=/^[a-z0-9_-]{21}$/i,Ju=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Qu=/^[-+]?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)?)??$/,Ku=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Gu="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",us,Wu=/^(?:(?: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])$/,Yu=/^(?:(?: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])$/,Xu=/^(([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]))$/,ed=/^(([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])$/,rd=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,td=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Hn="((\\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])))",ad=new RegExp(`^${Hn}$`);function Zn(a){let e="[0-5]\\d";a.precision?e=`${e}\\.\\d{${a.precision}}`:a.precision==null&&(e=`${e}(\\.\\d+)?`);let t=a.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${t}`}function sd(a){return new RegExp(`^${Zn(a)}$`)}function Bn(a){let e=`${Hn}T${Zn(a)}`,t=[];return t.push(a.local?"Z?":"Z"),a.offset&&t.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${t.join("|")})`,new RegExp(`^${e}$`)}function nd(a,e){return!!((e==="v4"||!e)&&Wu.test(a)||(e==="v6"||!e)&&Xu.test(a))}function od(a,e){if(!Ju.test(a))return!1;try{let[t]=a.split(".");if(!t)return!1;let s=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),r=JSON.parse(atob(s));return!(typeof r!="object"||r===null||"typ"in r&&(r==null?void 0:r.typ)!=="JWT"||!r.alg||e&&r.alg!==e)}catch{return!1}}function id(a,e){return!!((e==="v4"||!e)&&Yu.test(a)||(e==="v6"||!e)&&ed.test(a))}var Pr=class a extends G{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==j.string){let n=this._getOrReturnCtx(e);return D(n,{code:R.invalid_type,expected:j.string,received:n.parsedType}),B}let s=new Se,r;for(let n of this._def.checks)if(n.kind==="min")e.data.length<n.value&&(r=this._getOrReturnCtx(e,r),D(r,{code:R.too_small,minimum:n.value,type:"string",inclusive:!0,exact:!1,message:n.message}),s.dirty());else if(n.kind==="max")e.data.length>n.value&&(r=this._getOrReturnCtx(e,r),D(r,{code:R.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!1,message:n.message}),s.dirty());else if(n.kind==="length"){let o=e.data.length>n.value,l=e.data.length<n.value;(o||l)&&(r=this._getOrReturnCtx(e,r),o?D(r,{code:R.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message}):l&&D(r,{code:R.too_small,minimum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message}),s.dirty())}else if(n.kind==="email")Ku.test(e.data)||(r=this._getOrReturnCtx(e,r),D(r,{validation:"email",code:R.invalid_string,message:n.message}),s.dirty());else if(n.kind==="emoji")us||(us=new RegExp(Gu,"u")),us.test(e.data)||(r=this._getOrReturnCtx(e,r),D(r,{validation:"emoji",code:R.invalid_string,message:n.message}),s.dirty());else if(n.kind==="uuid")Zu.test(e.data)||(r=this._getOrReturnCtx(e,r),D(r,{validation:"uuid",code:R.invalid_string,message:n.message}),s.dirty());else if(n.kind==="nanoid")Bu.test(e.data)||(r=this._getOrReturnCtx(e,r),D(r,{validation:"nanoid",code:R.invalid_string,message:n.message}),s.dirty());else if(n.kind==="cuid")zu.test(e.data)||(r=this._getOrReturnCtx(e,r),D(r,{validation:"cuid",code:R.invalid_string,message:n.message}),s.dirty());else if(n.kind==="cuid2")Vu.test(e.data)||(r=this._getOrReturnCtx(e,r),D(r,{validation:"cuid2",code:R.invalid_string,message:n.message}),s.dirty());else if(n.kind==="ulid")Hu.test(e.data)||(r=this._getOrReturnCtx(e,r),D(r,{validation:"ulid",code:R.invalid_string,message:n.message}),s.dirty());else if(n.kind==="url")try{new URL(e.data)}catch{r=this._getOrReturnCtx(e,r),D(r,{validation:"url",code:R.invalid_string,message:n.message}),s.dirty()}else n.kind==="regex"?(n.regex.lastIndex=0,n.regex.test(e.data)||(r=this._getOrReturnCtx(e,r),D(r,{validation:"regex",code:R.invalid_string,message:n.message}),s.dirty())):n.kind==="trim"?e.data=e.data.trim():n.kind==="includes"?e.data.includes(n.value,n.position)||(r=this._getOrReturnCtx(e,r),D(r,{code:R.invalid_string,validation:{includes:n.value,position:n.position},message:n.message}),s.dirty()):n.kind==="toLowerCase"?e.data=e.data.toLowerCase():n.kind==="toUpperCase"?e.data=e.data.toUpperCase():n.kind==="startsWith"?e.data.startsWith(n.value)||(r=this._getOrReturnCtx(e,r),D(r,{code:R.invalid_string,validation:{startsWith:n.value},message:n.message}),s.dirty()):n.kind==="endsWith"?e.data.endsWith(n.value)||(r=this._getOrReturnCtx(e,r),D(r,{code:R.invalid_string,validation:{endsWith:n.value},message:n.message}),s.dirty()):n.kind==="datetime"?Bn(n).test(e.data)||(r=this._getOrReturnCtx(e,r),D(r,{code:R.invalid_string,validation:"datetime",message:n.message}),s.dirty()):n.kind==="date"?ad.test(e.data)||(r=this._getOrReturnCtx(e,r),D(r,{code:R.invalid_string,validation:"date",message:n.message}),s.dirty()):n.kind==="time"?sd(n).test(e.data)||(r=this._getOrReturnCtx(e,r),D(r,{code:R.invalid_string,validation:"time",message:n.message}),s.dirty()):n.kind==="duration"?Qu.test(e.data)||(r=this._getOrReturnCtx(e,r),D(r,{validation:"duration",code:R.invalid_string,message:n.message}),s.dirty()):n.kind==="ip"?nd(e.data,n.version)||(r=this._getOrReturnCtx(e,r),D(r,{validation:"ip",code:R.invalid_string,message:n.message}),s.dirty()):n.kind==="jwt"?od(e.data,n.alg)||(r=this._getOrReturnCtx(e,r),D(r,{validation:"jwt",code:R.invalid_string,message:n.message}),s.dirty()):n.kind==="cidr"?id(e.data,n.version)||(r=this._getOrReturnCtx(e,r),D(r,{validation:"cidr",code:R.invalid_string,message:n.message}),s.dirty()):n.kind==="base64"?rd.test(e.data)||(r=this._getOrReturnCtx(e,r),D(r,{validation:"base64",code:R.invalid_string,message:n.message}),s.dirty()):n.kind==="base64url"?td.test(e.data)||(r=this._getOrReturnCtx(e,r),D(r,{validation:"base64url",code:R.invalid_string,message:n.message}),s.dirty()):X.assertNever(n);return{status:s.value,value:e.data}}_regex(e,t,s){return this.refinement(r=>e.test(r),{validation:t,code:R.invalid_string,...V.errToObj(s)})}_addCheck(e){return new a({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...V.errToObj(e)})}url(e){return this._addCheck({kind:"url",...V.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...V.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...V.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...V.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...V.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...V.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...V.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...V.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...V.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...V.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...V.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...V.errToObj(e)})}datetime(e){var t,s;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof(e==null?void 0:e.precision)=="undefined"?null:e==null?void 0:e.precision,offset:(t=e==null?void 0:e.offset)!=null?t:!1,local:(s=e==null?void 0:e.local)!=null?s:!1,...V.errToObj(e==null?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof(e==null?void 0:e.precision)=="undefined"?null:e==null?void 0:e.precision,...V.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...V.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...V.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t==null?void 0:t.position,...V.errToObj(t==null?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...V.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...V.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...V.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...V.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...V.errToObj(t)})}nonempty(e){return this.min(1,V.errToObj(e))}trim(){return new a({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new a({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new a({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}};Pr.create=a=>{var e;return new Pr({checks:[],typeName:T.ZodString,coerce:(e=a==null?void 0:a.coerce)!=null?e:!1,...Q(a)})};function ld(a,e){let t=(a.toString().split(".")[1]||"").length,s=(e.toString().split(".")[1]||"").length,r=t>s?t:s,n=Number.parseInt(a.toFixed(r).replace(".","")),o=Number.parseInt(e.toFixed(r).replace(".",""));return n%o/10**r}var qr=class a extends G{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==j.number){let n=this._getOrReturnCtx(e);return D(n,{code:R.invalid_type,expected:j.number,received:n.parsedType}),B}let s,r=new Se;for(let n of this._def.checks)n.kind==="int"?X.isInteger(e.data)||(s=this._getOrReturnCtx(e,s),D(s,{code:R.invalid_type,expected:"integer",received:"float",message:n.message}),r.dirty()):n.kind==="min"?(n.inclusive?e.data<n.value:e.data<=n.value)&&(s=this._getOrReturnCtx(e,s),D(s,{code:R.too_small,minimum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),r.dirty()):n.kind==="max"?(n.inclusive?e.data>n.value:e.data>=n.value)&&(s=this._getOrReturnCtx(e,s),D(s,{code:R.too_big,maximum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),r.dirty()):n.kind==="multipleOf"?ld(e.data,n.value)!==0&&(s=this._getOrReturnCtx(e,s),D(s,{code:R.not_multiple_of,multipleOf:n.value,message:n.message}),r.dirty()):n.kind==="finite"?Number.isFinite(e.data)||(s=this._getOrReturnCtx(e,s),D(s,{code:R.not_finite,message:n.message}),r.dirty()):X.assertNever(n);return{status:r.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,V.toString(t))}gt(e,t){return this.setLimit("min",e,!1,V.toString(t))}lte(e,t){return this.setLimit("max",e,!0,V.toString(t))}lt(e,t){return this.setLimit("max",e,!1,V.toString(t))}setLimit(e,t,s,r){return new a({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:V.toString(r)}]})}_addCheck(e){return new a({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:V.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:V.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:V.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:V.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:V.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:V.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:V.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:V.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:V.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&X.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let s of this._def.checks){if(s.kind==="finite"||s.kind==="int"||s.kind==="multipleOf")return!0;s.kind==="min"?(t===null||s.value>t)&&(t=s.value):s.kind==="max"&&(e===null||s.value<e)&&(e=s.value)}return Number.isFinite(t)&&Number.isFinite(e)}};qr.create=a=>new qr({checks:[],typeName:T.ZodNumber,coerce:(a==null?void 0:a.coerce)||!1,...Q(a)});var Ur=class a extends G{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==j.bigint)return this._getInvalidInput(e);let s,r=new Se;for(let n of this._def.checks)n.kind==="min"?(n.inclusive?e.data<n.value:e.data<=n.value)&&(s=this._getOrReturnCtx(e,s),D(s,{code:R.too_small,type:"bigint",minimum:n.value,inclusive:n.inclusive,message:n.message}),r.dirty()):n.kind==="max"?(n.inclusive?e.data>n.value:e.data>=n.value)&&(s=this._getOrReturnCtx(e,s),D(s,{code:R.too_big,type:"bigint",maximum:n.value,inclusive:n.inclusive,message:n.message}),r.dirty()):n.kind==="multipleOf"?e.data%n.value!==BigInt(0)&&(s=this._getOrReturnCtx(e,s),D(s,{code:R.not_multiple_of,multipleOf:n.value,message:n.message}),r.dirty()):X.assertNever(n);return{status:r.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return D(t,{code:R.invalid_type,expected:j.bigint,received:t.parsedType}),B}gte(e,t){return this.setLimit("min",e,!0,V.toString(t))}gt(e,t){return this.setLimit("min",e,!1,V.toString(t))}lte(e,t){return this.setLimit("max",e,!0,V.toString(t))}lt(e,t){return this.setLimit("max",e,!1,V.toString(t))}setLimit(e,t,s,r){return new a({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:V.toString(r)}]})}_addCheck(e){return new a({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:V.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:V.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:V.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:V.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:V.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}};Ur.create=a=>{var e;return new Ur({checks:[],typeName:T.ZodBigInt,coerce:(e=a==null?void 0:a.coerce)!=null?e:!1,...Q(a)})};var zr=class extends G{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==j.boolean){let s=this._getOrReturnCtx(e);return D(s,{code:R.invalid_type,expected:j.boolean,received:s.parsedType}),B}return Te(e.data)}};zr.create=a=>new zr({typeName:T.ZodBoolean,coerce:(a==null?void 0:a.coerce)||!1,...Q(a)});var Vr=class a extends G{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==j.date){let n=this._getOrReturnCtx(e);return D(n,{code:R.invalid_type,expected:j.date,received:n.parsedType}),B}if(Number.isNaN(e.data.getTime())){let n=this._getOrReturnCtx(e);return D(n,{code:R.invalid_date}),B}let s=new Se,r;for(let n of this._def.checks)n.kind==="min"?e.data.getTime()<n.value&&(r=this._getOrReturnCtx(e,r),D(r,{code:R.too_small,message:n.message,inclusive:!0,exact:!1,minimum:n.value,type:"date"}),s.dirty()):n.kind==="max"?e.data.getTime()>n.value&&(r=this._getOrReturnCtx(e,r),D(r,{code:R.too_big,message:n.message,inclusive:!0,exact:!1,maximum:n.value,type:"date"}),s.dirty()):X.assertNever(n);return{status:s.value,value:new Date(e.data.getTime())}}_addCheck(e){return new a({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:V.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:V.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e!=null?new Date(e):null}};Vr.create=a=>new Vr({checks:[],coerce:(a==null?void 0:a.coerce)||!1,typeName:T.ZodDate,...Q(a)});var yt=class extends G{_parse(e){if(this._getType(e)!==j.symbol){let s=this._getOrReturnCtx(e);return D(s,{code:R.invalid_type,expected:j.symbol,received:s.parsedType}),B}return Te(e.data)}};yt.create=a=>new yt({typeName:T.ZodSymbol,...Q(a)});var Hr=class extends G{_parse(e){if(this._getType(e)!==j.undefined){let s=this._getOrReturnCtx(e);return D(s,{code:R.invalid_type,expected:j.undefined,received:s.parsedType}),B}return Te(e.data)}};Hr.create=a=>new Hr({typeName:T.ZodUndefined,...Q(a)});var Zr=class extends G{_parse(e){if(this._getType(e)!==j.null){let s=this._getOrReturnCtx(e);return D(s,{code:R.invalid_type,expected:j.null,received:s.parsedType}),B}return Te(e.data)}};Zr.create=a=>new Zr({typeName:T.ZodNull,...Q(a)});var Sr=class extends G{constructor(){super(...arguments),this._any=!0}_parse(e){return Te(e.data)}};Sr.create=a=>new Sr({typeName:T.ZodAny,...Q(a)});var vr=class extends G{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Te(e.data)}};vr.create=a=>new vr({typeName:T.ZodUnknown,...Q(a)});var We=class extends G{_parse(e){let t=this._getOrReturnCtx(e);return D(t,{code:R.invalid_type,expected:j.never,received:t.parsedType}),B}};We.create=a=>new We({typeName:T.ZodNever,...Q(a)});var _t=class extends G{_parse(e){if(this._getType(e)!==j.undefined){let s=this._getOrReturnCtx(e);return D(s,{code:R.invalid_type,expected:j.void,received:s.parsedType}),B}return Te(e.data)}};_t.create=a=>new _t({typeName:T.ZodVoid,...Q(a)});var gr=class a extends G{_parse(e){let{ctx:t,status:s}=this._processInputParams(e),r=this._def;if(t.parsedType!==j.array)return D(t,{code:R.invalid_type,expected:j.array,received:t.parsedType}),B;if(r.exactLength!==null){let o=t.data.length>r.exactLength.value,l=t.data.length<r.exactLength.value;(o||l)&&(D(t,{code:o?R.too_big:R.too_small,minimum:l?r.exactLength.value:void 0,maximum:o?r.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:r.exactLength.message}),s.dirty())}if(r.minLength!==null&&t.data.length<r.minLength.value&&(D(t,{code:R.too_small,minimum:r.minLength.value,type:"array",inclusive:!0,exact:!1,message:r.minLength.message}),s.dirty()),r.maxLength!==null&&t.data.length>r.maxLength.value&&(D(t,{code:R.too_big,maximum:r.maxLength.value,type:"array",inclusive:!0,exact:!1,message:r.maxLength.message}),s.dirty()),t.common.async)return Promise.all([...t.data].map((o,l)=>r.type._parseAsync(new Be(t,o,t.path,l)))).then(o=>Se.mergeArray(s,o));let n=[...t.data].map((o,l)=>r.type._parseSync(new Be(t,o,t.path,l)));return Se.mergeArray(s,n)}get element(){return this._def.type}min(e,t){return new a({...this._def,minLength:{value:e,message:V.toString(t)}})}max(e,t){return new a({...this._def,maxLength:{value:e,message:V.toString(t)}})}length(e,t){return new a({...this._def,exactLength:{value:e,message:V.toString(t)}})}nonempty(e){return this.min(1,e)}};gr.create=(a,e)=>new gr({type:a,minLength:null,maxLength:null,exactLength:null,typeName:T.ZodArray,...Q(e)});function gt(a){if(a instanceof Fe){let e={};for(let t in a.shape){let s=a.shape[t];e[t]=Ze.create(gt(s))}return new Fe({...a._def,shape:()=>e})}else return a instanceof gr?new gr({...a._def,type:gt(a.element)}):a instanceof Ze?Ze.create(gt(a.unwrap())):a instanceof or?or.create(gt(a.unwrap())):a instanceof nr?nr.create(a.items.map(e=>gt(e))):a}var Fe=class a extends G{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),t=X.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==j.object){let c=this._getOrReturnCtx(e);return D(c,{code:R.invalid_type,expected:j.object,received:c.parsedType}),B}let{status:s,ctx:r}=this._processInputParams(e),{shape:n,keys:o}=this._getCached(),l=[];if(!(this._def.catchall instanceof We&&this._def.unknownKeys==="strip"))for(let c in r.data)o.includes(c)||l.push(c);let u=[];for(let c of o){let f=n[c],p=r.data[c];u.push({key:{status:"valid",value:c},value:f._parse(new Be(r,p,r.path,c)),alwaysSet:c in r.data})}if(this._def.catchall instanceof We){let c=this._def.unknownKeys;if(c==="passthrough")for(let f of l)u.push({key:{status:"valid",value:f},value:{status:"valid",value:r.data[f]}});else if(c==="strict")l.length>0&&(D(r,{code:R.unrecognized_keys,keys:l}),s.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let c=this._def.catchall;for(let f of l){let p=r.data[f];u.push({key:{status:"valid",value:f},value:c._parse(new Be(r,p,r.path,f)),alwaysSet:f in r.data})}}return r.common.async?Promise.resolve().then(async()=>{let c=[];for(let f of u){let p=await f.key,g=await f.value;c.push({key:p,value:g,alwaysSet:f.alwaysSet})}return c}).then(c=>Se.mergeObjectSync(s,c)):Se.mergeObjectSync(s,u)}get shape(){return this._def.shape()}strict(e){return V.errToObj,new a({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,s)=>{var n,o,l,u;let r=(l=(o=(n=this._def).errorMap)==null?void 0:o.call(n,t,s).message)!=null?l:s.defaultError;return t.code==="unrecognized_keys"?{message:(u=V.errToObj(e).message)!=null?u:r}:{message:r}}}:{}})}strip(){return new a({...this._def,unknownKeys:"strip"})}passthrough(){return new a({...this._def,unknownKeys:"passthrough"})}extend(e){return new a({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new a({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:T.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new a({...this._def,catchall:e})}pick(e){let t={};for(let s of X.objectKeys(e))e[s]&&this.shape[s]&&(t[s]=this.shape[s]);return new a({...this._def,shape:()=>t})}omit(e){let t={};for(let s of X.objectKeys(this.shape))e[s]||(t[s]=this.shape[s]);return new a({...this._def,shape:()=>t})}deepPartial(){return gt(this)}partial(e){let t={};for(let s of X.objectKeys(this.shape)){let r=this.shape[s];e&&!e[s]?t[s]=r:t[s]=r.optional()}return new a({...this._def,shape:()=>t})}required(e){let t={};for(let s of X.objectKeys(this.shape))if(e&&!e[s])t[s]=this.shape[s];else{let n=this.shape[s];for(;n instanceof Ze;)n=n._def.innerType;t[s]=n}return new a({...this._def,shape:()=>t})}keyof(){return Jn(X.objectKeys(this.shape))}};Fe.create=(a,e)=>new Fe({shape:()=>a,unknownKeys:"strip",catchall:We.create(),typeName:T.ZodObject,...Q(e)});Fe.strictCreate=(a,e)=>new Fe({shape:()=>a,unknownKeys:"strict",catchall:We.create(),typeName:T.ZodObject,...Q(e)});Fe.lazycreate=(a,e)=>new Fe({shape:a,unknownKeys:"strip",catchall:We.create(),typeName:T.ZodObject,...Q(e)});var Br=class extends G{_parse(e){let{ctx:t}=this._processInputParams(e),s=this._def.options;function r(n){for(let l of n)if(l.result.status==="valid")return l.result;for(let l of n)if(l.result.status==="dirty")return t.common.issues.push(...l.ctx.common.issues),l.result;let o=n.map(l=>new Ne(l.ctx.common.issues));return D(t,{code:R.invalid_union,unionErrors:o}),B}if(t.common.async)return Promise.all(s.map(async n=>{let o={...t,common:{...t.common,issues:[]},parent:null};return{result:await n._parseAsync({data:t.data,path:t.path,parent:o}),ctx:o}})).then(r);{let n,o=[];for(let u of s){let c={...t,common:{...t.common,issues:[]},parent:null},f=u._parseSync({data:t.data,path:t.path,parent:c});if(f.status==="valid")return f;f.status==="dirty"&&!n&&(n={result:f,ctx:c}),c.common.issues.length&&o.push(c.common.issues)}if(n)return t.common.issues.push(...n.ctx.common.issues),n.result;let l=o.map(u=>new Ne(u));return D(t,{code:R.invalid_union,unionErrors:l}),B}}get options(){return this._def.options}};Br.create=(a,e)=>new Br({options:a,typeName:T.ZodUnion,...Q(e)});var mr=a=>a instanceof Qr?mr(a.schema):a instanceof Je?mr(a.innerType()):a instanceof Kr?[a.value]:a instanceof Gr?a.options:a instanceof Wr?X.objectValues(a.enum):a instanceof Yr?mr(a._def.innerType):a instanceof Hr?[void 0]:a instanceof Zr?[null]:a instanceof Ze?[void 0,...mr(a.unwrap())]:a instanceof or?[null,...mr(a.unwrap())]:a instanceof Ft||a instanceof et?mr(a.unwrap()):a instanceof Xr?mr(a._def.innerType):[],da=class a extends G{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==j.object)return D(t,{code:R.invalid_type,expected:j.object,received:t.parsedType}),B;let s=this.discriminator,r=t.data[s],n=this.optionsMap.get(r);return n?t.common.async?n._parseAsync({data:t.data,path:t.path,parent:t}):n._parseSync({data:t.data,path:t.path,parent:t}):(D(t,{code:R.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[s]}),B)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,s){let r=new Map;for(let n of t){let o=mr(n.shape[e]);if(!o.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let l of o){if(r.has(l))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(l)}`);r.set(l,n)}}return new a({typeName:T.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:r,...Q(s)})}};function ds(a,e){let t=sr(a),s=sr(e);if(a===e)return{valid:!0,data:a};if(t===j.object&&s===j.object){let r=X.objectKeys(e),n=X.objectKeys(a).filter(l=>r.indexOf(l)!==-1),o={...a,...e};for(let l of n){let u=ds(a[l],e[l]);if(!u.valid)return{valid:!1};o[l]=u.data}return{valid:!0,data:o}}else if(t===j.array&&s===j.array){if(a.length!==e.length)return{valid:!1};let r=[];for(let n=0;n<a.length;n++){let o=a[n],l=e[n],u=ds(o,l);if(!u.valid)return{valid:!1};r.push(u.data)}return{valid:!0,data:r}}else return t===j.date&&s===j.date&&+a==+e?{valid:!0,data:a}:{valid:!1}}var Jr=class extends G{_parse(e){let{status:t,ctx:s}=this._processInputParams(e),r=(n,o)=>{if(ca(n)||ca(o))return B;let l=ds(n.value,o.value);return l.valid?((ua(n)||ua(o))&&t.dirty(),{status:t.value,value:l.data}):(D(s,{code:R.invalid_intersection_types}),B)};return s.common.async?Promise.all([this._def.left._parseAsync({data:s.data,path:s.path,parent:s}),this._def.right._parseAsync({data:s.data,path:s.path,parent:s})]).then(([n,o])=>r(n,o)):r(this._def.left._parseSync({data:s.data,path:s.path,parent:s}),this._def.right._parseSync({data:s.data,path:s.path,parent:s}))}};Jr.create=(a,e,t)=>new Jr({left:a,right:e,typeName:T.ZodIntersection,...Q(t)});var nr=class a extends G{_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==j.array)return D(s,{code:R.invalid_type,expected:j.array,received:s.parsedType}),B;if(s.data.length<this._def.items.length)return D(s,{code:R.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),B;!this._def.rest&&s.data.length>this._def.items.length&&(D(s,{code:R.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());let n=[...s.data].map((o,l)=>{let u=this._def.items[l]||this._def.rest;return u?u._parse(new Be(s,o,s.path,l)):null}).filter(o=>!!o);return s.common.async?Promise.all(n).then(o=>Se.mergeArray(t,o)):Se.mergeArray(t,n)}get items(){return this._def.items}rest(e){return new a({...this._def,rest:e})}};nr.create=(a,e)=>{if(!Array.isArray(a))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new nr({items:a,typeName:T.ZodTuple,rest:null,...Q(e)})};var fa=class a extends G{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==j.object)return D(s,{code:R.invalid_type,expected:j.object,received:s.parsedType}),B;let r=[],n=this._def.keyType,o=this._def.valueType;for(let l in s.data)r.push({key:n._parse(new Be(s,l,s.path,l)),value:o._parse(new Be(s,s.data[l],s.path,l)),alwaysSet:l in s.data});return s.common.async?Se.mergeObjectAsync(t,r):Se.mergeObjectSync(t,r)}get element(){return this._def.valueType}static create(e,t,s){return t instanceof G?new a({keyType:e,valueType:t,typeName:T.ZodRecord,...Q(s)}):new a({keyType:Pr.create(),valueType:e,typeName:T.ZodRecord,...Q(t)})}},bt=class extends G{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==j.map)return D(s,{code:R.invalid_type,expected:j.map,received:s.parsedType}),B;let r=this._def.keyType,n=this._def.valueType,o=[...s.data.entries()].map(([l,u],c)=>({key:r._parse(new Be(s,l,s.path,[c,"key"])),value:n._parse(new Be(s,u,s.path,[c,"value"]))}));if(s.common.async){let l=new Map;return Promise.resolve().then(async()=>{for(let u of o){let c=await u.key,f=await u.value;if(c.status==="aborted"||f.status==="aborted")return B;(c.status==="dirty"||f.status==="dirty")&&t.dirty(),l.set(c.value,f.value)}return{status:t.value,value:l}})}else{let l=new Map;for(let u of o){let c=u.key,f=u.value;if(c.status==="aborted"||f.status==="aborted")return B;(c.status==="dirty"||f.status==="dirty")&&t.dirty(),l.set(c.value,f.value)}return{status:t.value,value:l}}}};bt.create=(a,e,t)=>new bt({valueType:e,keyType:a,typeName:T.ZodMap,...Q(t)});var xt=class a extends G{_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==j.set)return D(s,{code:R.invalid_type,expected:j.set,received:s.parsedType}),B;let r=this._def;r.minSize!==null&&s.data.size<r.minSize.value&&(D(s,{code:R.too_small,minimum:r.minSize.value,type:"set",inclusive:!0,exact:!1,message:r.minSize.message}),t.dirty()),r.maxSize!==null&&s.data.size>r.maxSize.value&&(D(s,{code:R.too_big,maximum:r.maxSize.value,type:"set",inclusive:!0,exact:!1,message:r.maxSize.message}),t.dirty());let n=this._def.valueType;function o(u){let c=new Set;for(let f of u){if(f.status==="aborted")return B;f.status==="dirty"&&t.dirty(),c.add(f.value)}return{status:t.value,value:c}}let l=[...s.data.values()].map((u,c)=>n._parse(new Be(s,u,s.path,c)));return s.common.async?Promise.all(l).then(u=>o(u)):o(l)}min(e,t){return new a({...this._def,minSize:{value:e,message:V.toString(t)}})}max(e,t){return new a({...this._def,maxSize:{value:e,message:V.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};xt.create=(a,e)=>new xt({valueType:a,minSize:null,maxSize:null,typeName:T.ZodSet,...Q(e)});var ha=class a extends G{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==j.function)return D(t,{code:R.invalid_type,expected:j.function,received:t.parsedType}),B;function s(l,u){return Nt({data:l,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,mt(),pr].filter(c=>!!c),issueData:{code:R.invalid_arguments,argumentsError:u}})}function r(l,u){return Nt({data:l,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,mt(),pr].filter(c=>!!c),issueData:{code:R.invalid_return_type,returnTypeError:u}})}let n={errorMap:t.common.contextualErrorMap},o=t.data;if(this._def.returns instanceof Rr){let l=this;return Te(async function(...u){let c=new Ne([]),f=await l._def.args.parseAsync(u,n).catch(d=>{throw c.addIssue(s(u,d)),c}),p=await Reflect.apply(o,this,f);return await l._def.returns._def.type.parseAsync(p,n).catch(d=>{throw c.addIssue(r(p,d)),c})})}else{let l=this;return Te(function(...u){let c=l._def.args.safeParse(u,n);if(!c.success)throw new Ne([s(u,c.error)]);let f=Reflect.apply(o,this,c.data),p=l._def.returns.safeParse(f,n);if(!p.success)throw new Ne([r(f,p.error)]);return p.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new a({...this._def,args:nr.create(e).rest(vr.create())})}returns(e){return new a({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,s){return new a({args:e||nr.create([]).rest(vr.create()),returns:t||vr.create(),typeName:T.ZodFunction,...Q(s)})}},Qr=class extends G{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})}};Qr.create=(a,e)=>new Qr({getter:a,typeName:T.ZodLazy,...Q(e)});var Kr=class extends G{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return D(t,{received:t.data,code:R.invalid_literal,expected:this._def.value}),B}return{status:"valid",value:e.data}}get value(){return this._def.value}};Kr.create=(a,e)=>new Kr({value:a,typeName:T.ZodLiteral,...Q(e)});function Jn(a,e){return new Gr({values:a,typeName:T.ZodEnum,...Q(e)})}var Gr=class a extends G{_parse(e){if(typeof e.data!="string"){let t=this._getOrReturnCtx(e),s=this._def.values;return D(t,{expected:X.joinValues(s),received:t.parsedType,code:R.invalid_type}),B}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let t=this._getOrReturnCtx(e),s=this._def.values;return D(t,{received:t.data,code:R.invalid_enum_value,options:s}),B}return Te(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 a.create(e,{...this._def,...t})}exclude(e,t=this._def){return a.create(this.options.filter(s=>!e.includes(s)),{...this._def,...t})}};Gr.create=Jn;var Wr=class extends G{_parse(e){let t=X.getValidEnumValues(this._def.values),s=this._getOrReturnCtx(e);if(s.parsedType!==j.string&&s.parsedType!==j.number){let r=X.objectValues(t);return D(s,{expected:X.joinValues(r),received:s.parsedType,code:R.invalid_type}),B}if(this._cache||(this._cache=new Set(X.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let r=X.objectValues(t);return D(s,{received:s.data,code:R.invalid_enum_value,options:r}),B}return Te(e.data)}get enum(){return this._def.values}};Wr.create=(a,e)=>new Wr({values:a,typeName:T.ZodNativeEnum,...Q(e)});var Rr=class extends G{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==j.promise&&t.common.async===!1)return D(t,{code:R.invalid_type,expected:j.promise,received:t.parsedType}),B;let s=t.parsedType===j.promise?t.data:Promise.resolve(t.data);return Te(s.then(r=>this._def.type.parseAsync(r,{path:t.path,errorMap:t.common.contextualErrorMap})))}};Rr.create=(a,e)=>new Rr({type:a,typeName:T.ZodPromise,...Q(e)});var Je=class extends G{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===T.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:s}=this._processInputParams(e),r=this._def.effect||null,n={addIssue:o=>{D(s,o),o.fatal?t.abort():t.dirty()},get path(){return s.path}};if(n.addIssue=n.addIssue.bind(n),r.type==="preprocess"){let o=r.transform(s.data,n);if(s.common.async)return Promise.resolve(o).then(async l=>{if(t.value==="aborted")return B;let u=await this._def.schema._parseAsync({data:l,path:s.path,parent:s});return u.status==="aborted"?B:u.status==="dirty"?Mr(u.value):t.value==="dirty"?Mr(u.value):u});{if(t.value==="aborted")return B;let l=this._def.schema._parseSync({data:o,path:s.path,parent:s});return l.status==="aborted"?B:l.status==="dirty"?Mr(l.value):t.value==="dirty"?Mr(l.value):l}}if(r.type==="refinement"){let o=l=>{let u=r.refinement(l,n);if(s.common.async)return Promise.resolve(u);if(u instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return l};if(s.common.async===!1){let l=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});return l.status==="aborted"?B:(l.status==="dirty"&&t.dirty(),o(l.value),{status:t.value,value:l.value})}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(l=>l.status==="aborted"?B:(l.status==="dirty"&&t.dirty(),o(l.value).then(()=>({status:t.value,value:l.value}))))}if(r.type==="transform")if(s.common.async===!1){let o=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});if(!Er(o))return B;let l=r.transform(o.value,n);if(l instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:l}}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(o=>Er(o)?Promise.resolve(r.transform(o.value,n)).then(l=>({status:t.value,value:l})):B);X.assertNever(r)}};Je.create=(a,e,t)=>new Je({schema:a,typeName:T.ZodEffects,effect:e,...Q(t)});Je.createWithPreprocess=(a,e,t)=>new Je({schema:e,effect:{type:"preprocess",transform:a},typeName:T.ZodEffects,...Q(t)});var Ze=class extends G{_parse(e){return this._getType(e)===j.undefined?Te(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Ze.create=(a,e)=>new Ze({innerType:a,typeName:T.ZodOptional,...Q(e)});var or=class extends G{_parse(e){return this._getType(e)===j.null?Te(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};or.create=(a,e)=>new or({innerType:a,typeName:T.ZodNullable,...Q(e)});var Yr=class extends G{_parse(e){let{ctx:t}=this._processInputParams(e),s=t.data;return t.parsedType===j.undefined&&(s=this._def.defaultValue()),this._def.innerType._parse({data:s,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};Yr.create=(a,e)=>new Yr({innerType:a,typeName:T.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...Q(e)});var Xr=class extends G{_parse(e){let{ctx:t}=this._processInputParams(e),s={...t,common:{...t.common,issues:[]}},r=this._def.innerType._parse({data:s.data,path:s.path,parent:{...s}});return vt(r)?r.then(n=>({status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new Ne(s.common.issues)},input:s.data})})):{status:"valid",value:r.status==="valid"?r.value:this._def.catchValue({get error(){return new Ne(s.common.issues)},input:s.data})}}removeCatch(){return this._def.innerType}};Xr.create=(a,e)=>new Xr({innerType:a,typeName:T.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...Q(e)});var wt=class extends G{_parse(e){if(this._getType(e)!==j.nan){let s=this._getOrReturnCtx(e);return D(s,{code:R.invalid_type,expected:j.nan,received:s.parsedType}),B}return{status:"valid",value:e.data}}};wt.create=a=>new wt({typeName:T.ZodNaN,...Q(a)});var cd=Symbol("zod_brand"),Ft=class extends G{_parse(e){let{ctx:t}=this._processInputParams(e),s=t.data;return this._def.type._parse({data:s,path:t.path,parent:t})}unwrap(){return this._def.type}},Lt=class a extends G{_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.common.async)return(async()=>{let n=await this._def.in._parseAsync({data:s.data,path:s.path,parent:s});return n.status==="aborted"?B:n.status==="dirty"?(t.dirty(),Mr(n.value)):this._def.out._parseAsync({data:n.value,path:s.path,parent:s})})();{let r=this._def.in._parseSync({data:s.data,path:s.path,parent:s});return r.status==="aborted"?B:r.status==="dirty"?(t.dirty(),{status:"dirty",value:r.value}):this._def.out._parseSync({data:r.value,path:s.path,parent:s})}}static create(e,t){return new a({in:e,out:t,typeName:T.ZodPipeline})}},et=class extends G{_parse(e){let t=this._def.innerType._parse(e),s=r=>(Er(r)&&(r.value=Object.freeze(r.value)),r);return vt(t)?t.then(r=>s(r)):s(t)}unwrap(){return this._def.innerType}};et.create=(a,e)=>new et({innerType:a,typeName:T.ZodReadonly,...Q(e)});function Vn(a,e){let t=typeof a=="function"?a(e):typeof a=="string"?{message:a}:a;return typeof t=="string"?{message:t}:t}function Qn(a,e={},t){return a?Sr.create().superRefine((s,r)=>{var o,l;let n=a(s);if(n instanceof Promise)return n.then(u=>{var c,f;if(!u){let p=Vn(e,s),g=(f=(c=p.fatal)!=null?c:t)!=null?f:!0;r.addIssue({code:"custom",...p,fatal:g})}});if(!n){let u=Vn(e,s),c=(l=(o=u.fatal)!=null?o:t)!=null?l:!0;r.addIssue({code:"custom",...u,fatal:c})}}):Sr.create()}var ud={object:Fe.lazycreate},T;(function(a){a.ZodString="ZodString",a.ZodNumber="ZodNumber",a.ZodNaN="ZodNaN",a.ZodBigInt="ZodBigInt",a.ZodBoolean="ZodBoolean",a.ZodDate="ZodDate",a.ZodSymbol="ZodSymbol",a.ZodUndefined="ZodUndefined",a.ZodNull="ZodNull",a.ZodAny="ZodAny",a.ZodUnknown="ZodUnknown",a.ZodNever="ZodNever",a.ZodVoid="ZodVoid",a.ZodArray="ZodArray",a.ZodObject="ZodObject",a.ZodUnion="ZodUnion",a.ZodDiscriminatedUnion="ZodDiscriminatedUnion",a.ZodIntersection="ZodIntersection",a.ZodTuple="ZodTuple",a.ZodRecord="ZodRecord",a.ZodMap="ZodMap",a.ZodSet="ZodSet",a.ZodFunction="ZodFunction",a.ZodLazy="ZodLazy",a.ZodLiteral="ZodLiteral",a.ZodEnum="ZodEnum",a.ZodEffects="ZodEffects",a.ZodNativeEnum="ZodNativeEnum",a.ZodOptional="ZodOptional",a.ZodNullable="ZodNullable",a.ZodDefault="ZodDefault",a.ZodCatch="ZodCatch",a.ZodPromise="ZodPromise",a.ZodBranded="ZodBranded",a.ZodPipeline="ZodPipeline",a.ZodReadonly="ZodReadonly"})(T||(T={}));var dd=(a,e={message:`Input not instance of ${a.name}`})=>Qn(t=>t instanceof a,e),Kn=Pr.create,Gn=qr.create,fd=wt.create,hd=Ur.create,Wn=zr.create,pd=Vr.create,md=yt.create,vd=Hr.create,gd=Zr.create,yd=Sr.create,_d=vr.create,bd=We.create,xd=_t.create,wd=gr.create,Ed=Fe.create,Pd=Fe.strictCreate,Sd=Br.create,Rd=da.create,Od=Jr.create,Td=nr.create,$d=fa.create,Ad=bt.create,Id=xt.create,Cd=ha.create,kd=Qr.create,Dd=Kr.create,jd=Gr.create,Nd=Wr.create,Fd=Rr.create,Ld=Je.create,Md=Ze.create,qd=or.create,Ud=Je.createWithPreprocess,zd=Lt.create,Vd=()=>Kn().optional(),Hd=()=>Gn().optional(),Zd=()=>Wn().optional(),Bd={string:a=>Pr.create({...a,coerce:!0}),number:a=>qr.create({...a,coerce:!0}),boolean:a=>zr.create({...a,coerce:!0}),bigint:a=>Ur.create({...a,coerce:!0}),date:a=>Vr.create({...a,coerce:!0})};var Jd=B;var Or="2025-06-18",Yn="2025-03-26",rt=[Or,"2025-03-26","2024-11-05","2024-10-07"],pa="2.0",Xn=i.union([i.string(),i.number().int()]),eo=i.string(),Qd=i.object({progressToken:i.optional(Xn)}).passthrough(),Qe=i.object({_meta:i.optional(Qd)}).passthrough(),Le=i.object({method:i.string(),params:i.optional(Qe)}),Mt=i.object({_meta:i.optional(i.object({}).passthrough())}).passthrough(),ir=i.object({method:i.string(),params:i.optional(Mt)}),Ke=i.object({_meta:i.optional(i.object({}).passthrough())}).passthrough(),ma=i.union([i.string(),i.number().int()]),ro=i.object({jsonrpc:i.literal(pa),id:ma}).merge(Le).strict(),tt=a=>ro.safeParse(a).success,to=i.object({jsonrpc:i.literal(pa)}).merge(ir).strict(),ao=a=>to.safeParse(a).success,so=i.object({jsonrpc:i.literal(pa),id:ma,result:Ke}).strict(),yr=a=>so.safeParse(a).success,ke;(function(a){a[a.ConnectionClosed=-32e3]="ConnectionClosed",a[a.RequestTimeout=-32001]="RequestTimeout",a[a.ParseError=-32700]="ParseError",a[a.InvalidRequest=-32600]="InvalidRequest",a[a.MethodNotFound=-32601]="MethodNotFound",a[a.InvalidParams=-32602]="InvalidParams",a[a.InternalError=-32603]="InternalError"})(ke||(ke={}));var no=i.object({jsonrpc:i.literal(pa),id:ma,error:i.object({code:i.number().int(),message:i.string(),data:i.optional(i.unknown())})}).strict(),Et=a=>no.safeParse(a).success,Ye=i.union([ro,to,so,no]),_r=Ke.strict(),va=ir.extend({method:i.literal("notifications/cancelled"),params:Mt.extend({requestId:ma,reason:i.string().optional()})}),qt=i.object({name:i.string(),title:i.optional(i.string())}).passthrough(),oo=qt.extend({version:i.string()}),Kd=i.object({experimental:i.optional(i.object({}).passthrough()),sampling:i.optional(i.object({}).passthrough()),elicitation:i.optional(i.object({}).passthrough()),roots:i.optional(i.object({listChanged:i.optional(i.boolean())}).passthrough())}).passthrough(),ga=Le.extend({method:i.literal("initialize"),params:Qe.extend({protocolVersion:i.string(),capabilities:Kd,clientInfo:oo})}),io=a=>ga.safeParse(a).success,Gd=i.object({experimental:i.optional(i.object({}).passthrough()),logging:i.optional(i.object({}).passthrough()),completions:i.optional(i.object({}).passthrough()),prompts:i.optional(i.object({listChanged:i.optional(i.boolean())}).passthrough()),resources:i.optional(i.object({subscribe:i.optional(i.boolean()),listChanged:i.optional(i.boolean())}).passthrough()),tools:i.optional(i.object({listChanged:i.optional(i.boolean())}).passthrough())}).passthrough(),fs=Ke.extend({protocolVersion:i.string(),capabilities:Gd,serverInfo:oo,instructions:i.optional(i.string())}),ya=ir.extend({method:i.literal("notifications/initialized")}),lo=a=>ya.safeParse(a).success,Pt=Le.extend({method:i.literal("ping")}),Wd=i.object({progress:i.number(),total:i.optional(i.number()),message:i.optional(i.string())}).passthrough(),_a=ir.extend({method:i.literal("notifications/progress"),params:Mt.merge(Wd).extend({progressToken:Xn})}),ba=Le.extend({params:Qe.extend({cursor:i.optional(eo)}).optional()}),xa=Ke.extend({nextCursor:i.optional(eo)}),co=i.object({uri:i.string(),mimeType:i.optional(i.string()),_meta:i.optional(i.object({}).passthrough())}).passthrough(),uo=co.extend({text:i.string()}),hs=i.string().refine(a=>{try{return atob(a),!0}catch{return!1}},{message:"Invalid Base64 string"}),fo=co.extend({blob:hs}),ho=qt.extend({uri:i.string(),description:i.optional(i.string()),mimeType:i.optional(i.string()),_meta:i.optional(i.object({}).passthrough())}),Yd=qt.extend({uriTemplate:i.string(),description:i.optional(i.string()),mimeType:i.optional(i.string()),_meta:i.optional(i.object({}).passthrough())}),Xd=ba.extend({method:i.literal("resources/list")}),ps=xa.extend({resources:i.array(ho)}),ef=ba.extend({method:i.literal("resources/templates/list")}),ms=xa.extend({resourceTemplates:i.array(Yd)}),rf=Le.extend({method:i.literal("resources/read"),params:Qe.extend({uri:i.string()})}),vs=Ke.extend({contents:i.array(i.union([uo,fo]))}),tf=ir.extend({method:i.literal("notifications/resources/list_changed")}),af=Le.extend({method:i.literal("resources/subscribe"),params:Qe.extend({uri:i.string()})}),sf=Le.extend({method:i.literal("resources/unsubscribe"),params:Qe.extend({uri:i.string()})}),nf=ir.extend({method:i.literal("notifications/resources/updated"),params:Mt.extend({uri:i.string()})}),of=i.object({name:i.string(),description:i.optional(i.string()),required:i.optional(i.boolean())}).passthrough(),lf=qt.extend({description:i.optional(i.string()),arguments:i.optional(i.array(of)),_meta:i.optional(i.object({}).passthrough())}),cf=ba.extend({method:i.literal("prompts/list")}),gs=xa.extend({prompts:i.array(lf)}),uf=Le.extend({method:i.literal("prompts/get"),params:Qe.extend({name:i.string(),arguments:i.optional(i.record(i.string()))})}),ys=i.object({type:i.literal("text"),text:i.string(),_meta:i.optional(i.object({}).passthrough())}).passthrough(),_s=i.object({type:i.literal("image"),data:hs,mimeType:i.string(),_meta:i.optional(i.object({}).passthrough())}).passthrough(),bs=i.object({type:i.literal("audio"),data:hs,mimeType:i.string(),_meta:i.optional(i.object({}).passthrough())}).passthrough(),df=i.object({type:i.literal("resource"),resource:i.union([uo,fo]),_meta:i.optional(i.object({}).passthrough())}).passthrough(),ff=ho.extend({type:i.literal("resource_link")}),po=i.union([ys,_s,bs,ff,df]),hf=i.object({role:i.enum(["user","assistant"]),content:po}).passthrough(),xs=Ke.extend({description:i.optional(i.string()),messages:i.array(hf)}),pf=ir.extend({method:i.literal("notifications/prompts/list_changed")}),mf=i.object({title:i.optional(i.string()),readOnlyHint:i.optional(i.boolean()),destructiveHint:i.optional(i.boolean()),idempotentHint:i.optional(i.boolean()),openWorldHint:i.optional(i.boolean())}).passthrough(),vf=qt.extend({description:i.optional(i.string()),inputSchema:i.object({type:i.literal("object"),properties:i.optional(i.object({}).passthrough()),required:i.optional(i.array(i.string()))}).passthrough(),outputSchema:i.optional(i.object({type:i.literal("object"),properties:i.optional(i.object({}).passthrough()),required:i.optional(i.array(i.string()))}).passthrough()),annotations:i.optional(mf),_meta:i.optional(i.object({}).passthrough())}),ws=ba.extend({method:i.literal("tools/list")}),Es=xa.extend({tools:i.array(vf)}),wa=Ke.extend({content:i.array(po).default([]),structuredContent:i.object({}).passthrough().optional(),isError:i.optional(i.boolean())}),yv=wa.or(Ke.extend({toolResult:i.unknown()})),Ps=Le.extend({method:i.literal("tools/call"),params:Qe.extend({name:i.string(),arguments:i.optional(i.record(i.unknown()))})}),gf=ir.extend({method:i.literal("notifications/tools/list_changed")}),mo=i.enum(["debug","info","notice","warning","error","critical","alert","emergency"]),yf=Le.extend({method:i.literal("logging/setLevel"),params:Qe.extend({level:mo})}),_f=ir.extend({method:i.literal("notifications/message"),params:Mt.extend({level:mo,logger:i.optional(i.string()),data:i.unknown()})}),bf=i.object({name:i.string().optional()}).passthrough(),xf=i.object({hints:i.optional(i.array(bf)),costPriority:i.optional(i.number().min(0).max(1)),speedPriority:i.optional(i.number().min(0).max(1)),intelligencePriority:i.optional(i.number().min(0).max(1))}).passthrough(),wf=i.object({role:i.enum(["user","assistant"]),content:i.union([ys,_s,bs])}).passthrough(),Ef=Le.extend({method:i.literal("sampling/createMessage"),params:Qe.extend({messages:i.array(wf),systemPrompt:i.optional(i.string()),includeContext:i.optional(i.enum(["none","thisServer","allServers"])),temperature:i.optional(i.number()),maxTokens:i.number().int(),stopSequences:i.optional(i.array(i.string())),metadata:i.optional(i.object({}).passthrough()),modelPreferences:i.optional(xf)})}),Ss=Ke.extend({model:i.string(),stopReason:i.optional(i.enum(["endTurn","stopSequence","maxTokens"]).or(i.string())),role:i.enum(["user","assistant"]),content:i.discriminatedUnion("type",[ys,_s,bs])}),Pf=i.object({type:i.literal("boolean"),title:i.optional(i.string()),description:i.optional(i.string()),default:i.optional(i.boolean())}).passthrough(),Sf=i.object({type:i.literal("string"),title:i.optional(i.string()),description:i.optional(i.string()),minLength:i.optional(i.number()),maxLength:i.optional(i.number()),format:i.optional(i.enum(["email","uri","date","date-time"]))}).passthrough(),Rf=i.object({type:i.enum(["number","integer"]),title:i.optional(i.string()),description:i.optional(i.string()),minimum:i.optional(i.number()),maximum:i.optional(i.number())}).passthrough(),Of=i.object({type:i.literal("string"),title:i.optional(i.string()),description:i.optional(i.string()),enum:i.array(i.string()),enumNames:i.optional(i.array(i.string()))}).passthrough(),Tf=i.union([Pf,Sf,Rf,Of]),$f=Le.extend({method:i.literal("elicitation/create"),params:Qe.extend({message:i.string(),requestedSchema:i.object({type:i.literal("object"),properties:i.record(i.string(),Tf),required:i.optional(i.array(i.string()))}).passthrough()})}),Rs=Ke.extend({action:i.enum(["accept","decline","cancel"]),content:i.optional(i.record(i.string(),i.unknown()))}),Af=i.object({type:i.literal("ref/resource"),uri:i.string()}).passthrough();var If=i.object({type:i.literal("ref/prompt"),name:i.string()}).passthrough(),Cf=Le.extend({method:i.literal("completion/complete"),params:Qe.extend({ref:i.union([If,Af]),argument:i.object({name:i.string(),value:i.string()}).passthrough(),context:i.optional(i.object({arguments:i.optional(i.record(i.string(),i.string()))}))})}),Os=Ke.extend({completion:i.object({values:i.array(i.string()).max(100),total:i.optional(i.number().int()),hasMore:i.optional(i.boolean())}).passthrough()}),kf=i.object({uri:i.string().startsWith("file://"),name:i.optional(i.string()),_meta:i.optional(i.object({}).passthrough())}).passthrough(),Ts=Le.extend({method:i.literal("roots/list")}),$s=Ke.extend({roots:i.array(kf)}),Df=ir.extend({method:i.literal("notifications/roots/list_changed")}),_v=i.union([Pt,ga,Cf,yf,uf,cf,Xd,ef,rf,af,sf,Ps,ws]),bv=i.union([va,_a,ya,Df]),xv=i.union([_r,Ss,Rs,$s]),wv=i.union([Pt,Ef,$f,Ts]),Ev=i.union([va,_a,_f,nf,tf,gf,pf]),Pv=i.union([_r,fs,Os,xs,gs,ps,ms,vs,wa,Es]),$e=class extends Error{constructor(e,t,s){super(`MCP error ${e}: ${t}`),this.code=e,this.data=s,this.name="McpError"}};var jf=6e4,St=class{constructor(e){this._options=e,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this._pendingDebouncedNotifications=new Set,this.setNotificationHandler(va,t=>{let s=this._requestHandlerAbortControllers.get(t.params.requestId);s==null||s.abort(t.params.reason)}),this.setNotificationHandler(_a,t=>{this._onprogress(t)}),this.setRequestHandler(Pt,t=>({}))}_setupTimeout(e,t,s,r,n=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(r,t),startTime:Date.now(),timeout:t,maxTotalTimeout:s,resetTimeoutOnProgress:n,onTimeout:r})}_resetTimeout(e){let t=this._timeoutInfo.get(e);if(!t)return!1;let s=Date.now()-t.startTime;if(t.maxTotalTimeout&&s>=t.maxTotalTimeout)throw this._timeoutInfo.delete(e),new $e(ke.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:t.maxTotalTimeout,totalElapsed:s});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){var t,s,r;this._transport=e;let n=(t=this.transport)===null||t===void 0?void 0:t.onclose;this._transport.onclose=()=>{n==null||n(),this._onclose()};let o=(s=this.transport)===null||s===void 0?void 0:s.onerror;this._transport.onerror=u=>{o==null||o(u),this._onerror(u)};let l=(r=this._transport)===null||r===void 0?void 0:r.onmessage;this._transport.onmessage=(u,c)=>{l==null||l(u,c),yr(u)||Et(u)?this._onresponse(u):tt(u)?this._onrequest(u,c):ao(u)?this._onnotification(u):this._onerror(new Error(`Unknown message type: ${JSON.stringify(u)}`))},await this._transport.start()}_onclose(){var e;let t=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._pendingDebouncedNotifications.clear(),this._transport=void 0,(e=this.onclose)===null||e===void 0||e.call(this);let s=new $e(ke.ConnectionClosed,"Connection closed");for(let r of t.values())r(s)}_onerror(e){var t;(t=this.onerror)===null||t===void 0||t.call(this,e)}_onnotification(e){var t;let s=(t=this._notificationHandlers.get(e.method))!==null&&t!==void 0?t:this.fallbackNotificationHandler;s!==void 0&&Promise.resolve().then(()=>s(e)).catch(r=>this._onerror(new Error(`Uncaught error in notification handler: ${r}`)))}_onrequest(e,t){var s,r;let n=(s=this._requestHandlers.get(e.method))!==null&&s!==void 0?s:this.fallbackRequestHandler,o=this._transport;if(n===void 0){o==null||o.send({jsonrpc:"2.0",id:e.id,error:{code:ke.MethodNotFound,message:"Method not found"}}).catch(c=>this._onerror(new Error(`Failed to send an error response: ${c}`)));return}let l=new AbortController;this._requestHandlerAbortControllers.set(e.id,l);let u={signal:l.signal,sessionId:o==null?void 0:o.sessionId,_meta:(r=e.params)===null||r===void 0?void 0:r._meta,sendNotification:c=>this.notification(c,{relatedRequestId:e.id}),sendRequest:(c,f,p)=>this.request(c,f,{...p,relatedRequestId:e.id}),authInfo:t==null?void 0:t.authInfo,requestId:e.id,requestInfo:t==null?void 0:t.requestInfo};Promise.resolve().then(()=>n(e,u)).then(c=>{if(!l.signal.aborted)return o==null?void 0:o.send({result:c,jsonrpc:"2.0",id:e.id})},c=>{var f;if(!l.signal.aborted)return o==null?void 0:o.send({jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(c.code)?c.code:ke.InternalError,message:(f=c.message)!==null&&f!==void 0?f:"Internal error"}})}).catch(c=>this._onerror(new Error(`Failed to send response: ${c}`))).finally(()=>{this._requestHandlerAbortControllers.delete(e.id)})}_onprogress(e){let{progressToken:t,...s}=e.params,r=Number(t),n=this._progressHandlers.get(r);if(!n){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}let o=this._responseHandlers.get(r),l=this._timeoutInfo.get(r);if(l&&o&&l.resetTimeoutOnProgress)try{this._resetTimeout(r)}catch(u){o(u);return}n(s)}_onresponse(e){let t=Number(e.id),s=this._responseHandlers.get(t);if(s===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}if(this._responseHandlers.delete(t),this._progressHandlers.delete(t),this._cleanupTimeout(t),yr(e))s(e);else{let r=new $e(e.error.code,e.error.message,e.error.data);s(r)}}get transport(){return this._transport}async close(){var e;await((e=this._transport)===null||e===void 0?void 0:e.close())}request(e,t,s){let{relatedRequestId:r,resumptionToken:n,onresumptiontoken:o}=s!=null?s:{};return new Promise((l,u)=>{var c,f,p,g,d,y;if(!this._transport){u(new Error("Not connected"));return}((c=this._options)===null||c===void 0?void 0:c.enforceStrictCapabilities)===!0&&this.assertCapabilityForMethod(e.method),(f=s==null?void 0:s.signal)===null||f===void 0||f.throwIfAborted();let m=this._requestMessageId++,v={...e,jsonrpc:"2.0",id:m};s!=null&&s.onprogress&&(this._progressHandlers.set(m,s.onprogress),v.params={...e.params,_meta:{...((p=e.params)===null||p===void 0?void 0:p._meta)||{},progressToken:m}});let x=O=>{var A;this._responseHandlers.delete(m),this._progressHandlers.delete(m),this._cleanupTimeout(m),(A=this._transport)===null||A===void 0||A.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:m,reason:String(O)}},{relatedRequestId:r,resumptionToken:n,onresumptiontoken:o}).catch(I=>this._onerror(new Error(`Failed to send cancellation: ${I}`))),u(O)};this._responseHandlers.set(m,O=>{var A;if(!(!((A=s==null?void 0:s.signal)===null||A===void 0)&&A.aborted)){if(O instanceof Error)return u(O);try{let I=t.parse(O.result);l(I)}catch(I){u(I)}}}),(g=s==null?void 0:s.signal)===null||g===void 0||g.addEventListener("abort",()=>{var O;x((O=s==null?void 0:s.signal)===null||O===void 0?void 0:O.reason)});let S=(d=s==null?void 0:s.timeout)!==null&&d!==void 0?d:jf,P=()=>x(new $e(ke.RequestTimeout,"Request timed out",{timeout:S}));this._setupTimeout(m,S,s==null?void 0:s.maxTotalTimeout,P,(y=s==null?void 0:s.resetTimeoutOnProgress)!==null&&y!==void 0?y:!1),this._transport.send(v,{relatedRequestId:r,resumptionToken:n,onresumptiontoken:o}).catch(O=>{this._cleanupTimeout(m),u(O)})})}async notification(e,t){var s,r;if(!this._transport)throw new Error("Not connected");if(this.assertNotificationCapability(e.method),((r=(s=this._options)===null||s===void 0?void 0:s.debouncedNotificationMethods)!==null&&r!==void 0?r:[]).includes(e.method)&&!e.params&&!(t!=null&&t.relatedRequestId)){if(this._pendingDebouncedNotifications.has(e.method))return;this._pendingDebouncedNotifications.add(e.method),Promise.resolve().then(()=>{var u;if(this._pendingDebouncedNotifications.delete(e.method),!this._transport)return;let c={...e,jsonrpc:"2.0"};(u=this._transport)===null||u===void 0||u.send(c,t).catch(f=>this._onerror(f))});return}let l={...e,jsonrpc:"2.0"};await this._transport.send(l,t)}setRequestHandler(e,t){let s=e.shape.method.value;this.assertRequestHandlerCapability(s),this._requestHandlers.set(s,(r,n)=>Promise.resolve(t(e.parse(r),n)))}removeRequestHandler(e){this._requestHandlers.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw new Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,t){this._notificationHandlers.set(e.shape.method.value,s=>Promise.resolve(t(e.parse(s))))}removeNotificationHandler(e){this._notificationHandlers.delete(e)}};function Ea(a,e){return Object.entries(e).reduce((t,[s,r])=>(r&&typeof r=="object"?t[s]=t[s]?{...t[s],...r}:r:t[s]=r,t),{...a})}var vl=hr(en(),1),za=class extends St{constructor(e,t){var s;super(t),this._clientInfo=e,this._cachedToolOutputValidators=new Map,this._capabilities=(s=t==null?void 0:t.capabilities)!==null&&s!==void 0?s:{},this._ajv=new vl.default}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=Ea(this._capabilities,e)}assertCapability(e,t){var s;if(!(!((s=this._serverCapabilities)===null||s===void 0)&&s[e]))throw new Error(`Server does not support ${e} (required for ${t})`)}async connect(e,t){if(await super.connect(e),e.sessionId===void 0)try{let s=await this.request({method:"initialize",params:{protocolVersion:Or,capabilities:this._capabilities,clientInfo:this._clientInfo}},fs,t);if(s===void 0)throw new Error(`Server sent invalid initialize result: ${s}`);if(!rt.includes(s.protocolVersion))throw new Error(`Server's protocol version is not supported: ${s.protocolVersion}`);this._serverCapabilities=s.capabilities,this._serverVersion=s.serverInfo,e.setProtocolVersion&&e.setProtocolVersion(s.protocolVersion),this._instructions=s.instructions,await this.notification({method:"notifications/initialized"})}catch(s){throw this.close(),s}}getServerCapabilities(){return this._serverCapabilities}getServerVersion(){return this._serverVersion}getInstructions(){return this._instructions}assertCapabilityForMethod(e){var t,s,r,n,o;switch(e){case"logging/setLevel":if(!(!((t=this._serverCapabilities)===null||t===void 0)&&t.logging))throw new Error(`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!(!((s=this._serverCapabilities)===null||s===void 0)&&s.prompts))throw new Error(`Server does not support prompts (required for ${e})`);break;case"resources/list":case"resources/templates/list":case"resources/read":case"resources/subscribe":case"resources/unsubscribe":if(!(!((r=this._serverCapabilities)===null||r===void 0)&&r.resources))throw new Error(`Server does not support resources (required for ${e})`);if(e==="resources/subscribe"&&!this._serverCapabilities.resources.subscribe)throw new Error(`Server does not support resource subscriptions (required for ${e})`);break;case"tools/call":case"tools/list":if(!(!((n=this._serverCapabilities)===null||n===void 0)&&n.tools))throw new Error(`Server does not support tools (required for ${e})`);break;case"completion/complete":if(!(!((o=this._serverCapabilities)===null||o===void 0)&&o.completions))throw new Error(`Server does not support completions (required for ${e})`);break;case"initialize":break;case"ping":break}}assertNotificationCapability(e){var t;switch(e){case"notifications/roots/list_changed":if(!(!((t=this._capabilities.roots)===null||t===void 0)&&t.listChanged))throw new Error(`Client does not support roots list changed notifications (required for ${e})`);break;case"notifications/initialized":break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(e){switch(e){case"sampling/createMessage":if(!this._capabilities.sampling)throw new Error(`Client does not support sampling capability (required for ${e})`);break;case"elicitation/create":if(!this._capabilities.elicitation)throw new Error(`Client does not support elicitation capability (required for ${e})`);break;case"roots/list":if(!this._capabilities.roots)throw new Error(`Client does not support roots capability (required for ${e})`);break;case"ping":break}}async ping(e){return this.request({method:"ping"},_r,e)}async complete(e,t){return this.request({method:"completion/complete",params:e},Os,t)}async setLoggingLevel(e,t){return this.request({method:"logging/setLevel",params:{level:e}},_r,t)}async getPrompt(e,t){return this.request({method:"prompts/get",params:e},xs,t)}async listPrompts(e,t){return this.request({method:"prompts/list",params:e},gs,t)}async listResources(e,t){return this.request({method:"resources/list",params:e},ps,t)}async listResourceTemplates(e,t){return this.request({method:"resources/templates/list",params:e},ms,t)}async readResource(e,t){return this.request({method:"resources/read",params:e},vs,t)}async subscribeResource(e,t){return this.request({method:"resources/subscribe",params:e},_r,t)}async unsubscribeResource(e,t){return this.request({method:"resources/unsubscribe",params:e},_r,t)}async callTool(e,t=wa,s){let r=await this.request({method:"tools/call",params:e},t,s),n=this.getToolOutputValidator(e.name);if(n){if(!r.structuredContent&&!r.isError)throw new $e(ke.InvalidRequest,`Tool ${e.name} has an output schema but did not return structured content`);if(r.structuredContent)try{if(!n(r.structuredContent))throw new $e(ke.InvalidParams,`Structured content does not match the tool's output schema: ${this._ajv.errorsText(n.errors)}`)}catch(o){throw o instanceof $e?o:new $e(ke.InvalidParams,`Failed to validate structured content: ${o instanceof Error?o.message:String(o)}`)}}return r}cacheToolOutputSchemas(e){this._cachedToolOutputValidators.clear();for(let t of e)if(t.outputSchema)try{let s=this._ajv.compile(t.outputSchema);this._cachedToolOutputValidators.set(t.name,s)}catch{}}getToolOutputValidator(e){return this._cachedToolOutputValidators.get(e)}async listTools(e,t){let s=await this.request({method:"tools/list",params:e},Es,t);return this.cacheToolOutputSchemas(s.tools),s}async sendRootsListChanged(){return this.notification({method:"notifications/roots/list_changed"})}};var gl=hr(en(),1),Va=class extends St{constructor(e,t){var s;super(t),this._serverInfo=e,this._capabilities=(s=t==null?void 0:t.capabilities)!==null&&s!==void 0?s:{},this._instructions=t==null?void 0:t.instructions,this.setRequestHandler(ga,r=>this._oninitialize(r)),this.setNotificationHandler(ya,()=>{var r;return(r=this.oninitialized)===null||r===void 0?void 0:r.call(this)})}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=Ea(this._capabilities,e)}assertCapabilityForMethod(e){var t,s,r;switch(e){case"sampling/createMessage":if(!(!((t=this._clientCapabilities)===null||t===void 0)&&t.sampling))throw new Error(`Client does not support sampling (required for ${e})`);break;case"elicitation/create":if(!(!((s=this._clientCapabilities)===null||s===void 0)&&s.elicitation))throw new Error(`Client does not support elicitation (required for ${e})`);break;case"roots/list":if(!(!((r=this._clientCapabilities)===null||r===void 0)&&r.roots))throw new Error(`Client does not support listing roots (required for ${e})`);break;case"ping":break}}assertNotificationCapability(e){switch(e){case"notifications/message":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${e})`);break;case"notifications/resources/updated":case"notifications/resources/list_changed":if(!this._capabilities.resources)throw new Error(`Server does not support notifying about resources (required for ${e})`);break;case"notifications/tools/list_changed":if(!this._capabilities.tools)throw new Error(`Server does not support notifying of tool list changes (required for ${e})`);break;case"notifications/prompts/list_changed":if(!this._capabilities.prompts)throw new Error(`Server does not support notifying of prompt list changes (required for ${e})`);break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(e){switch(e){case"sampling/createMessage":if(!this._capabilities.sampling)throw new Error(`Server does not support sampling (required for ${e})`);break;case"logging/setLevel":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!this._capabilities.prompts)throw new Error(`Server does not support prompts (required for ${e})`);break;case"resources/list":case"resources/templates/list":case"resources/read":if(!this._capabilities.resources)throw new Error(`Server does not support resources (required for ${e})`);break;case"tools/call":case"tools/list":if(!this._capabilities.tools)throw new Error(`Server does not support tools (required for ${e})`);break;case"ping":case"initialize":break}}async _oninitialize(e){let t=e.params.protocolVersion;return this._clientCapabilities=e.params.capabilities,this._clientVersion=e.params.clientInfo,{protocolVersion:rt.includes(t)?t:Or,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"},_r)}async createMessage(e,t){return this.request({method:"sampling/createMessage",params:e},Ss,t)}async elicitInput(e,t){let s=await this.request({method:"elicitation/create",params:e},Rs,t);if(s.action==="accept"&&s.content)try{let r=new gl.default,n=r.compile(e.requestedSchema);if(!n(s.content))throw new $e(ke.InvalidParams,`Elicitation response content does not match requested schema: ${r.errorsText(n.errors)}`)}catch(r){throw r instanceof $e?r:new $e(ke.InternalError,`Error validating elicitation response: ${r}`)}return s}async listRoots(e,t){return this.request({method:"roots/list",params:e},$s,t)}async sendLoggingMessage(e){return this.notification({method:"notifications/message",params:e})}async sendResourceUpdated(e){return this.notification({method:"notifications/resources/updated",params:e})}async sendResourceListChanged(){return this.notification({method:"notifications/resources/list_changed"})}async sendToolListChanged(){return this.notification({method:"notifications/tools/list_changed"})}async sendPromptListChanged(){return this.notification({method:"notifications/prompts/list_changed"})}};var Sl=require("node:crypto");var xl=hr(bl());function zt(a,{limit:e,encoding:t}){let s=xl.default.parse(e);return new Promise((r,n)=>{let o=0,l=[];a.on("data",u=>{if(o+=u.length,o>s)return n(new Error(`Message size exceeds limit of ${e} bytes`));l.push(u)}),a.on("end",()=>{try{r(Buffer.concat(l).toString(t))}catch(u){n(u)}}),a.on("error",u=>{n(u)})})}var Rl=hr(tn(),1),Ol=require("url"),Rp="4mb",Za=class{constructor(e,t,s){this._endpoint=e,this.res=t,this._sessionId=(0,Sl.randomUUID)(),this._options=s||{enableDnsRebindingProtection:!1}}validateRequestHeaders(e){if(this._options.enableDnsRebindingProtection){if(this._options.allowedHosts&&this._options.allowedHosts.length>0){let t=e.headers.host;if(!t||!this._options.allowedHosts.includes(t))return`Invalid Host header: ${t}`}if(this._options.allowedOrigins&&this._options.allowedOrigins.length>0){let t=e.headers.origin;if(!t||!this._options.allowedOrigins.includes(t))return`Invalid Origin header: ${t}`}}}async start(){if(this._sseResponse)throw new Error("SSEServerTransport already started! If using Server class, note that connect() calls start() automatically.");this.res.writeHead(200,{"Content-Type":"text/event-stream","Cache-Control":"no-cache, no-transform",Connection:"keep-alive"});let e="http://localhost",t=new Ol.URL(this._endpoint,e);t.searchParams.set("sessionId",this._sessionId);let s=t.pathname+t.search+t.hash;this.res.write(`event: endpoint
|
|
1
|
+
"use strict";var Du=Object.create;var ua=Object.defineProperty;var ju=Object.getOwnPropertyDescriptor;var Nu=Object.getOwnPropertyNames;var Lu=Object.getPrototypeOf,Fu=Object.prototype.hasOwnProperty;var z=(a,e)=>()=>(e||a((e={exports:{}}).exports,e),e.exports),zn=(a,e)=>{for(var t in e)ua(a,t,{get:e[t],enumerable:!0})},Vn=(a,e,t,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of Nu(e))!Fu.call(a,r)&&r!==t&&ua(a,r,{get:()=>e[r],enumerable:!(s=ju(e,r))||s.enumerable});return a};var pr=(a,e,t)=>(t=a!=null?Du(Lu(a)):{},Vn(e||!a||!a.__esModule?ua(t,"default",{value:a,enumerable:!0}):t,a)),Mu=a=>Vn(ua({},"__esModule",{value:!0}),a);var _o=z((Ra,yo)=>{(function(a,e){typeof Ra=="object"&&typeof yo!="undefined"?e(Ra):typeof define=="function"&&define.amd?define(["exports"],e):e(a.URI=a.URI||{})})(Ra,function(a){"use strict";function e(){for(var _=arguments.length,h=Array(_),b=0;b<_;b++)h[b]=arguments[b];if(h.length>1){h[0]=h[0].slice(0,-1);for(var w=h.length-1,E=1;E<w;++E)h[E]=h[E].slice(1,-1);return h[w]=h[w].slice(1),h.join("")}else return h[0]}function t(_){return"(?:"+_+")"}function s(_){return _===void 0?"undefined":_===null?"null":Object.prototype.toString.call(_).split(" ").pop().split("]").shift().toLowerCase()}function r(_){return _.toUpperCase()}function n(_){return _!=null?_ instanceof Array?_:typeof _.length!="number"||_.split||_.setInterval||_.call?[_]:Array.prototype.slice.call(_):[]}function o(_,h){var b=_;if(h)for(var w in h)b[w]=h[w];return b}function i(_){var h="[A-Za-z]",b="[\\x0D]",w="[0-9]",E="[\\x22]",N=e(w,"[A-Fa-f]"),K="[\\x0A]",ae="[\\x20]",ie=t(t("%[EFef]"+N+"%"+N+N+"%"+N+N)+"|"+t("%[89A-Fa-f]"+N+"%"+N+N)+"|"+t("%"+N+N)),be="[\\:\\/\\?\\#\\[\\]\\@]",te="[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=]",he=e(be,te),xe=_?"[\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]":"[]",de=_?"[\\uE000-\\uF8FF]":"[]",ne=e(h,w,"[\\-\\.\\_\\~]",xe),pe=t(h+e(h,w,"[\\+\\-\\.]")+"*"),ce=t(t(ie+"|"+e(ne,te,"[\\:]"))+"*"),Lr=t(t("25[0-5]")+"|"+t("2[0-4]"+w)+"|"+t("1"+w+w)+"|"+t("[1-9]"+w)+"|"+w),Ue=t(t("25[0-5]")+"|"+t("2[0-4]"+w)+"|"+t("1"+w+w)+"|"+t("0?[1-9]"+w)+"|0?0?"+w),He=t(Ue+"\\."+Ue+"\\."+Ue+"\\."+Ue),ue=t(N+"{1,4}"),ze=t(t(ue+"\\:"+ue)+"|"+He),Ze=t(t(ue+"\\:")+"{6}"+ze),sr=t("\\:\\:"+t(ue+"\\:")+"{5}"+ze),Fr=t(t(ue)+"?\\:\\:"+t(ue+"\\:")+"{4}"+ze),dr=t(t(t(ue+"\\:")+"{0,1}"+ue)+"?\\:\\:"+t(ue+"\\:")+"{3}"+ze),Ct=t(t(t(ue+"\\:")+"{0,2}"+ue)+"?\\:\\:"+t(ue+"\\:")+"{2}"+ze),ia=t(t(t(ue+"\\:")+"{0,3}"+ue)+"?\\:\\:"+ue+"\\:"+ze),la=t(t(t(ue+"\\:")+"{0,4}"+ue)+"?\\:\\:"+ze),ut=t(t(t(ue+"\\:")+"{0,5}"+ue)+"?\\:\\:"+ue),dt=t(t(t(ue+"\\:")+"{0,6}"+ue)+"?\\:\\:"),fr=t([Ze,sr,Fr,dr,Ct,ia,la,ut,dt].join("|")),ft=t(t(ne+"|"+ie)+"+"),cs=t(fr+"\\%25"+ft),Mr=t(fr+t("\\%25|\\%(?!"+N+"{2})")+ft),Ou=t("[vV]"+N+"+\\."+e(ne,te,"[\\:]")+"+"),Tu=t("\\["+t(Mr+"|"+fr+"|"+Ou)+"\\]"),Fn=t(t(ie+"|"+e(ne,te))+"*"),kt=t(Tu+"|"+He+"(?!"+Fn+")|"+Fn),Dt=t(w+"*"),Mn=t(t(ce+"@")+"?"+kt+t("\\:"+Dt)+"?"),jt=t(ie+"|"+e(ne,te,"[\\:\\@]")),$u=t(jt+"*"),qn=t(jt+"+"),Au=t(t(ie+"|"+e(ne,te,"[\\@]"))+"+"),hr=t(t("\\/"+$u)+"*"),ht=t("\\/"+t(qn+hr)+"?"),us=t(Au+hr),ca=t(qn+hr),pt="(?!"+jt+")",Lm=t(hr+"|"+ht+"|"+us+"|"+ca+"|"+pt),mt=t(t(jt+"|"+e("[\\/\\?]",de))+"*"),Nt=t(t(jt+"|[\\/\\?]")+"*"),Un=t(t("\\/\\/"+Mn+hr)+"|"+ht+"|"+ca+"|"+pt),Iu=t(pe+"\\:"+Un+t("\\?"+mt)+"?"+t("\\#"+Nt)+"?"),Cu=t(t("\\/\\/"+Mn+hr)+"|"+ht+"|"+us+"|"+pt),ku=t(Cu+t("\\?"+mt)+"?"+t("\\#"+Nt)+"?"),Fm=t(Iu+"|"+ku),Mm=t(pe+"\\:"+Un+t("\\?"+mt)+"?"),qm="^("+pe+")\\:"+t(t("\\/\\/("+t("("+ce+")@")+"?("+kt+")"+t("\\:("+Dt+")")+"?)")+"?("+hr+"|"+ht+"|"+ca+"|"+pt+")")+t("\\?("+mt+")")+"?"+t("\\#("+Nt+")")+"?$",Um="^(){0}"+t(t("\\/\\/("+t("("+ce+")@")+"?("+kt+")"+t("\\:("+Dt+")")+"?)")+"?("+hr+"|"+ht+"|"+us+"|"+pt+")")+t("\\?("+mt+")")+"?"+t("\\#("+Nt+")")+"?$",zm="^("+pe+")\\:"+t(t("\\/\\/("+t("("+ce+")@")+"?("+kt+")"+t("\\:("+Dt+")")+"?)")+"?("+hr+"|"+ht+"|"+ca+"|"+pt+")")+t("\\?("+mt+")")+"?$",Vm="^"+t("\\#("+Nt+")")+"?$",Hm="^"+t("("+ce+")@")+"?("+kt+")"+t("\\:("+Dt+")")+"?$";return{NOT_SCHEME:new RegExp(e("[^]",h,w,"[\\+\\-\\.]"),"g"),NOT_USERINFO:new RegExp(e("[^\\%\\:]",ne,te),"g"),NOT_HOST:new RegExp(e("[^\\%\\[\\]\\:]",ne,te),"g"),NOT_PATH:new RegExp(e("[^\\%\\/\\:\\@]",ne,te),"g"),NOT_PATH_NOSCHEME:new RegExp(e("[^\\%\\/\\@]",ne,te),"g"),NOT_QUERY:new RegExp(e("[^\\%]",ne,te,"[\\:\\@\\/\\?]",de),"g"),NOT_FRAGMENT:new RegExp(e("[^\\%]",ne,te,"[\\:\\@\\/\\?]"),"g"),ESCAPE:new RegExp(e("[^]",ne,te),"g"),UNRESERVED:new RegExp(ne,"g"),OTHER_CHARS:new RegExp(e("[^\\%]",ne,he),"g"),PCT_ENCODED:new RegExp(ie,"g"),IPV4ADDRESS:new RegExp("^("+He+")$"),IPV6ADDRESS:new RegExp("^\\[?("+fr+")"+t(t("\\%25|\\%(?!"+N+"{2})")+"("+ft+")")+"?\\]?$")}}var u=i(!1),c=i(!0),f=function(){function _(h,b){var w=[],E=!0,N=!1,K=void 0;try{for(var ae=h[Symbol.iterator](),ie;!(E=(ie=ae.next()).done)&&(w.push(ie.value),!(b&&w.length===b));E=!0);}catch(be){N=!0,K=be}finally{try{!E&&ae.return&&ae.return()}finally{if(N)throw K}}return w}return function(h,b){if(Array.isArray(h))return h;if(Symbol.iterator in Object(h))return _(h,b);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),p=function(_){if(Array.isArray(_)){for(var h=0,b=Array(_.length);h<_.length;h++)b[h]=_[h];return b}else return Array.from(_)},g=2147483647,d=36,y=1,m=26,v=38,x=700,S=72,P=128,O="-",A=/^xn--/,I=/[^\0-\x7E]/,H=/[\x2E\u3002\uFF0E\uFF61]/g,q={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},C=d-y,U=Math.floor,M=String.fromCharCode;function L(_){throw new RangeError(q[_])}function $(_,h){for(var b=[],w=_.length;w--;)b[w]=h(_[w]);return b}function k(_,h){var b=_.split("@"),w="";b.length>1&&(w=b[0]+"@",_=b[1]),_=_.replace(H,".");var E=_.split("."),N=$(E,h).join(".");return w+N}function F(_){for(var h=[],b=0,w=_.length;b<w;){var E=_.charCodeAt(b++);if(E>=55296&&E<=56319&&b<w){var N=_.charCodeAt(b++);(N&64512)==56320?h.push(((E&1023)<<10)+(N&1023)+65536):(h.push(E),b--)}else h.push(E)}return h}var le=function(h){return String.fromCodePoint.apply(String,p(h))},Y=function(h){return h-48<10?h-22:h-65<26?h-65:h-97<26?h-97:d},re=function(h,b){return h+22+75*(h<26)-((b!=0)<<5)},W=function(h,b,w){var E=0;for(h=w?U(h/x):h>>1,h+=U(h/b);h>C*m>>1;E+=d)h=U(h/C);return U(E+(C+1)*h/(h+v))},Z=function(h){var b=[],w=h.length,E=0,N=P,K=S,ae=h.lastIndexOf(O);ae<0&&(ae=0);for(var ie=0;ie<ae;++ie)h.charCodeAt(ie)>=128&&L("not-basic"),b.push(h.charCodeAt(ie));for(var be=ae>0?ae+1:0;be<w;){for(var te=E,he=1,xe=d;;xe+=d){be>=w&&L("invalid-input");var de=Y(h.charCodeAt(be++));(de>=d||de>U((g-E)/he))&&L("overflow"),E+=de*he;var ne=xe<=K?y:xe>=K+m?m:xe-K;if(de<ne)break;var pe=d-ne;he>U(g/pe)&&L("overflow"),he*=pe}var ce=b.length+1;K=W(E-te,ce,te==0),U(E/ce)>g-N&&L("overflow"),N+=U(E/ce),E%=ce,b.splice(E++,0,N)}return String.fromCodePoint.apply(String,b)},me=function(h){var b=[];h=F(h);var w=h.length,E=P,N=0,K=S,ae=!0,ie=!1,be=void 0;try{for(var te=h[Symbol.iterator](),he;!(ae=(he=te.next()).done);ae=!0){var xe=he.value;xe<128&&b.push(M(xe))}}catch(Mr){ie=!0,be=Mr}finally{try{!ae&&te.return&&te.return()}finally{if(ie)throw be}}var de=b.length,ne=de;for(de&&b.push(O);ne<w;){var pe=g,ce=!0,Lr=!1,Ue=void 0;try{for(var He=h[Symbol.iterator](),ue;!(ce=(ue=He.next()).done);ce=!0){var ze=ue.value;ze>=E&&ze<pe&&(pe=ze)}}catch(Mr){Lr=!0,Ue=Mr}finally{try{!ce&&He.return&&He.return()}finally{if(Lr)throw Ue}}var Ze=ne+1;pe-E>U((g-N)/Ze)&&L("overflow"),N+=(pe-E)*Ze,E=pe;var sr=!0,Fr=!1,dr=void 0;try{for(var Ct=h[Symbol.iterator](),ia;!(sr=(ia=Ct.next()).done);sr=!0){var la=ia.value;if(la<E&&++N>g&&L("overflow"),la==E){for(var ut=N,dt=d;;dt+=d){var fr=dt<=K?y:dt>=K+m?m:dt-K;if(ut<fr)break;var ft=ut-fr,cs=d-fr;b.push(M(re(fr+ft%cs,0))),ut=U(ft/cs)}b.push(M(re(ut,0))),K=W(N,Ze,ne==de),N=0,++ne}}}catch(Mr){Fr=!0,dr=Mr}finally{try{!sr&&Ct.return&&Ct.return()}finally{if(Fr)throw dr}}++N,++E}return b.join("")},Oe=function(h){return k(h,function(b){return A.test(b)?Z(b.slice(4).toLowerCase()):b})},Ie=function(h){return k(h,function(b){return I.test(b)?"xn--"+me(b):b})},se={version:"2.1.0",ucs2:{decode:F,encode:le},decode:Z,encode:me,toASCII:Ie,toUnicode:Oe},ye={};function Ee(_){var h=_.charCodeAt(0),b=void 0;return h<16?b="%0"+h.toString(16).toUpperCase():h<128?b="%"+h.toString(16).toUpperCase():h<2048?b="%"+(h>>6|192).toString(16).toUpperCase()+"%"+(h&63|128).toString(16).toUpperCase():b="%"+(h>>12|224).toString(16).toUpperCase()+"%"+(h>>6&63|128).toString(16).toUpperCase()+"%"+(h&63|128).toString(16).toUpperCase(),b}function Ce(_){for(var h="",b=0,w=_.length;b<w;){var E=parseInt(_.substr(b+1,2),16);if(E<128)h+=String.fromCharCode(E),b+=3;else if(E>=194&&E<224){if(w-b>=6){var N=parseInt(_.substr(b+4,2),16);h+=String.fromCharCode((E&31)<<6|N&63)}else h+=_.substr(b,6);b+=6}else if(E>=224){if(w-b>=9){var K=parseInt(_.substr(b+4,2),16),ae=parseInt(_.substr(b+7,2),16);h+=String.fromCharCode((E&15)<<12|(K&63)<<6|ae&63)}else h+=_.substr(b,9);b+=9}else h+=_.substr(b,3),b+=3}return h}function wr(_,h){function b(w){var E=Ce(w);return E.match(h.UNRESERVED)?E:w}return _.scheme&&(_.scheme=String(_.scheme).replace(h.PCT_ENCODED,b).toLowerCase().replace(h.NOT_SCHEME,"")),_.userinfo!==void 0&&(_.userinfo=String(_.userinfo).replace(h.PCT_ENCODED,b).replace(h.NOT_USERINFO,Ee).replace(h.PCT_ENCODED,r)),_.host!==void 0&&(_.host=String(_.host).replace(h.PCT_ENCODED,b).toLowerCase().replace(h.NOT_HOST,Ee).replace(h.PCT_ENCODED,r)),_.path!==void 0&&(_.path=String(_.path).replace(h.PCT_ENCODED,b).replace(_.scheme?h.NOT_PATH:h.NOT_PATH_NOSCHEME,Ee).replace(h.PCT_ENCODED,r)),_.query!==void 0&&(_.query=String(_.query).replace(h.PCT_ENCODED,b).replace(h.NOT_QUERY,Ee).replace(h.PCT_ENCODED,r)),_.fragment!==void 0&&(_.fragment=String(_.fragment).replace(h.PCT_ENCODED,b).replace(h.NOT_FRAGMENT,Ee).replace(h.PCT_ENCODED,r)),_}function cr(_){return _.replace(/^0*(.*)/,"$1")||"0"}function _e(_,h){var b=_.match(h.IPV4ADDRESS)||[],w=f(b,2),E=w[1];return E?E.split(".").map(cr).join("."):_}function ve(_,h){var b=_.match(h.IPV6ADDRESS)||[],w=f(b,3),E=w[1],N=w[2];if(E){for(var K=E.toLowerCase().split("::").reverse(),ae=f(K,2),ie=ae[0],be=ae[1],te=be?be.split(":").map(cr):[],he=ie.split(":").map(cr),xe=h.IPV4ADDRESS.test(he[he.length-1]),de=xe?7:8,ne=he.length-de,pe=Array(de),ce=0;ce<de;++ce)pe[ce]=te[ce]||he[ne+ce]||"";xe&&(pe[de-1]=_e(pe[de-1],h));var Lr=pe.reduce(function(Ze,sr,Fr){if(!sr||sr==="0"){var dr=Ze[Ze.length-1];dr&&dr.index+dr.length===Fr?dr.length++:Ze.push({index:Fr,length:1})}return Ze},[]),Ue=Lr.sort(function(Ze,sr){return sr.length-Ze.length})[0],He=void 0;if(Ue&&Ue.length>1){var ue=pe.slice(0,Ue.index),ze=pe.slice(Ue.index+Ue.length);He=ue.join(":")+"::"+ze.join(":")}else He=pe.join(":");return N&&(He+="%"+N),He}else return _}var Dr=/^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i,Te="".match(/(){0}/)[1]===void 0;function oe(_){var h=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},b={},w=h.iri!==!1?c:u;h.reference==="suffix"&&(_=(h.scheme?h.scheme+":":"")+"//"+_);var E=_.match(Dr);if(E){Te?(b.scheme=E[1],b.userinfo=E[3],b.host=E[4],b.port=parseInt(E[5],10),b.path=E[6]||"",b.query=E[7],b.fragment=E[8],isNaN(b.port)&&(b.port=E[5])):(b.scheme=E[1]||void 0,b.userinfo=_.indexOf("@")!==-1?E[3]:void 0,b.host=_.indexOf("//")!==-1?E[4]:void 0,b.port=parseInt(E[5],10),b.path=E[6]||"",b.query=_.indexOf("?")!==-1?E[7]:void 0,b.fragment=_.indexOf("#")!==-1?E[8]:void 0,isNaN(b.port)&&(b.port=_.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/)?E[4]:void 0)),b.host&&(b.host=ve(_e(b.host,w),w)),b.scheme===void 0&&b.userinfo===void 0&&b.host===void 0&&b.port===void 0&&!b.path&&b.query===void 0?b.reference="same-document":b.scheme===void 0?b.reference="relative":b.fragment===void 0?b.reference="absolute":b.reference="uri",h.reference&&h.reference!=="suffix"&&h.reference!==b.reference&&(b.error=b.error||"URI is not a "+h.reference+" reference.");var N=ye[(h.scheme||b.scheme||"").toLowerCase()];if(!h.unicodeSupport&&(!N||!N.unicodeSupport)){if(b.host&&(h.domainHost||N&&N.domainHost))try{b.host=se.toASCII(b.host.replace(w.PCT_ENCODED,Ce).toLowerCase())}catch(K){b.error=b.error||"Host's domain name can not be converted to ASCII via punycode: "+K}wr(b,u)}else wr(b,w);N&&N.parse&&N.parse(b,h)}else b.error=b.error||"URI can not be parsed.";return b}function Er(_,h){var b=h.iri!==!1?c:u,w=[];return _.userinfo!==void 0&&(w.push(_.userinfo),w.push("@")),_.host!==void 0&&w.push(ve(_e(String(_.host),b),b).replace(b.IPV6ADDRESS,function(E,N,K){return"["+N+(K?"%25"+K:"")+"]"})),(typeof _.port=="number"||typeof _.port=="string")&&(w.push(":"),w.push(String(_.port))),w.length?w.join(""):void 0}var ur=/^\.\.?\//,jr=/^\/\.(\/|$)/,Nr=/^\/\.\.(\/|$)/,Se=/^\/?(?:.|\n)*?(?=\/|$)/;function Ve(_){for(var h=[];_.length;)if(_.match(ur))_=_.replace(ur,"");else if(_.match(jr))_=_.replace(jr,"/");else if(_.match(Nr))_=_.replace(Nr,"/"),h.pop();else if(_==="."||_==="..")_="";else{var b=_.match(Se);if(b){var w=b[0];_=_.slice(w.length),h.push(w)}else throw new Error("Unexpected dot segment condition")}return h.join("")}function Ne(_){var h=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},b=h.iri?c:u,w=[],E=ye[(h.scheme||_.scheme||"").toLowerCase()];if(E&&E.serialize&&E.serialize(_,h),_.host&&!b.IPV6ADDRESS.test(_.host)){if(h.domainHost||E&&E.domainHost)try{_.host=h.iri?se.toUnicode(_.host):se.toASCII(_.host.replace(b.PCT_ENCODED,Ce).toLowerCase())}catch(ae){_.error=_.error||"Host's domain name can not be converted to "+(h.iri?"Unicode":"ASCII")+" via punycode: "+ae}}wr(_,b),h.reference!=="suffix"&&_.scheme&&(w.push(_.scheme),w.push(":"));var N=Er(_,h);if(N!==void 0&&(h.reference!=="suffix"&&w.push("//"),w.push(N),_.path&&_.path.charAt(0)!=="/"&&w.push("/")),_.path!==void 0){var K=_.path;!h.absolutePath&&(!E||!E.absolutePath)&&(K=Ve(K)),N===void 0&&(K=K.replace(/^\/\//,"/%2F")),w.push(K)}return _.query!==void 0&&(w.push("?"),w.push(_.query)),_.fragment!==void 0&&(w.push("#"),w.push(_.fragment)),w.join("")}function ke(_,h){var b=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},w=arguments[3],E={};return w||(_=oe(Ne(_,b),b),h=oe(Ne(h,b),b)),b=b||{},!b.tolerant&&h.scheme?(E.scheme=h.scheme,E.userinfo=h.userinfo,E.host=h.host,E.port=h.port,E.path=Ve(h.path||""),E.query=h.query):(h.userinfo!==void 0||h.host!==void 0||h.port!==void 0?(E.userinfo=h.userinfo,E.host=h.host,E.port=h.port,E.path=Ve(h.path||""),E.query=h.query):(h.path?(h.path.charAt(0)==="/"?E.path=Ve(h.path):((_.userinfo!==void 0||_.host!==void 0||_.port!==void 0)&&!_.path?E.path="/"+h.path:_.path?E.path=_.path.slice(0,_.path.lastIndexOf("/")+1)+h.path:E.path=h.path,E.path=Ve(E.path)),E.query=h.query):(E.path=_.path,h.query!==void 0?E.query=h.query:E.query=_.query),E.userinfo=_.userinfo,E.host=_.host,E.port=_.port),E.scheme=_.scheme),E.fragment=h.fragment,E}function tr(_,h,b){var w=o({scheme:"null"},b);return Ne(ke(oe(_,w),oe(h,w),w,!0),w)}function qe(_,h){return typeof _=="string"?_=Ne(oe(_,h),h):s(_)==="object"&&(_=oe(Ne(_,h),h)),_}function oa(_,h,b){return typeof _=="string"?_=Ne(oe(_,b),b):s(_)==="object"&&(_=Ne(_,b)),typeof h=="string"?h=Ne(oe(h,b),b):s(h)==="object"&&(h=Ne(h,b)),_===h}function is(_,h){return _&&_.toString().replace(!h||!h.iri?u.ESCAPE:c.ESCAPE,Ee)}function We(_,h){return _&&_.toString().replace(!h||!h.iri?u.PCT_ENCODED:c.PCT_ENCODED,Ce)}var At={scheme:"http",domainHost:!0,parse:function(h,b){return h.host||(h.error=h.error||"HTTP URIs must have a host."),h},serialize:function(h,b){var w=String(h.scheme).toLowerCase()==="https";return(h.port===(w?443:80)||h.port==="")&&(h.port=void 0),h.path||(h.path="/"),h}},An={scheme:"https",domainHost:At.domainHost,parse:At.parse,serialize:At.serialize};function In(_){return typeof _.secure=="boolean"?_.secure:String(_.scheme).toLowerCase()==="wss"}var It={scheme:"ws",domainHost:!0,parse:function(h,b){var w=h;return w.secure=In(w),w.resourceName=(w.path||"/")+(w.query?"?"+w.query:""),w.path=void 0,w.query=void 0,w},serialize:function(h,b){if((h.port===(In(h)?443:80)||h.port==="")&&(h.port=void 0),typeof h.secure=="boolean"&&(h.scheme=h.secure?"wss":"ws",h.secure=void 0),h.resourceName){var w=h.resourceName.split("?"),E=f(w,2),N=E[0],K=E[1];h.path=N&&N!=="/"?N:void 0,h.query=K,h.resourceName=void 0}return h.fragment=void 0,h}},Cn={scheme:"wss",domainHost:It.domainHost,parse:It.parse,serialize:It.serialize},mu={},vu=!0,kn="[A-Za-z0-9\\-\\.\\_\\~"+(vu?"\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF":"")+"]",ar="[0-9A-Fa-f]",gu=t(t("%[EFef]"+ar+"%"+ar+ar+"%"+ar+ar)+"|"+t("%[89A-Fa-f]"+ar+"%"+ar+ar)+"|"+t("%"+ar+ar)),yu="[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]",_u="[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]",bu=e(_u,'[\\"\\\\]'),xu="[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]",wu=new RegExp(kn,"g"),ct=new RegExp(gu,"g"),Eu=new RegExp(e("[^]",yu,"[\\.]",'[\\"]',bu),"g"),Dn=new RegExp(e("[^]",kn,xu),"g"),Pu=Dn;function ls(_){var h=Ce(_);return h.match(wu)?h:_}var jn={scheme:"mailto",parse:function(h,b){var w=h,E=w.to=w.path?w.path.split(","):[];if(w.path=void 0,w.query){for(var N=!1,K={},ae=w.query.split("&"),ie=0,be=ae.length;ie<be;++ie){var te=ae[ie].split("=");switch(te[0]){case"to":for(var he=te[1].split(","),xe=0,de=he.length;xe<de;++xe)E.push(he[xe]);break;case"subject":w.subject=We(te[1],b);break;case"body":w.body=We(te[1],b);break;default:N=!0,K[We(te[0],b)]=We(te[1],b);break}}N&&(w.headers=K)}w.query=void 0;for(var ne=0,pe=E.length;ne<pe;++ne){var ce=E[ne].split("@");if(ce[0]=We(ce[0]),b.unicodeSupport)ce[1]=We(ce[1],b).toLowerCase();else try{ce[1]=se.toASCII(We(ce[1],b).toLowerCase())}catch(Lr){w.error=w.error||"Email address's domain name can not be converted to ASCII via punycode: "+Lr}E[ne]=ce.join("@")}return w},serialize:function(h,b){var w=h,E=n(h.to);if(E){for(var N=0,K=E.length;N<K;++N){var ae=String(E[N]),ie=ae.lastIndexOf("@"),be=ae.slice(0,ie).replace(ct,ls).replace(ct,r).replace(Eu,Ee),te=ae.slice(ie+1);try{te=b.iri?se.toUnicode(te):se.toASCII(We(te,b).toLowerCase())}catch(ne){w.error=w.error||"Email address's domain name can not be converted to "+(b.iri?"Unicode":"ASCII")+" via punycode: "+ne}E[N]=be+"@"+te}w.path=E.join(",")}var he=h.headers=h.headers||{};h.subject&&(he.subject=h.subject),h.body&&(he.body=h.body);var xe=[];for(var de in he)he[de]!==mu[de]&&xe.push(de.replace(ct,ls).replace(ct,r).replace(Dn,Ee)+"="+he[de].replace(ct,ls).replace(ct,r).replace(Pu,Ee));return xe.length&&(w.query=xe.join("&")),w}},Su=/^([^\:]+)\:(.*)/,Nn={scheme:"urn",parse:function(h,b){var w=h.path&&h.path.match(Su),E=h;if(w){var N=b.scheme||E.scheme||"urn",K=w[1].toLowerCase(),ae=w[2],ie=N+":"+(b.nid||K),be=ye[ie];E.nid=K,E.nss=ae,E.path=void 0,be&&(E=be.parse(E,b))}else E.error=E.error||"URN can not be parsed.";return E},serialize:function(h,b){var w=b.scheme||h.scheme||"urn",E=h.nid,N=w+":"+(b.nid||E),K=ye[N];K&&(h=K.serialize(h,b));var ae=h,ie=h.nss;return ae.path=(E||b.nid)+":"+ie,ae}},Ru=/^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/,Ln={scheme:"urn:uuid",parse:function(h,b){var w=h;return w.uuid=w.nss,w.nss=void 0,!b.tolerant&&(!w.uuid||!w.uuid.match(Ru))&&(w.error=w.error||"UUID is not valid."),w},serialize:function(h,b){var w=h;return w.nss=(h.uuid||"").toLowerCase(),w}};ye[At.scheme]=At,ye[An.scheme]=An,ye[It.scheme]=It,ye[Cn.scheme]=Cn,ye[jn.scheme]=jn,ye[Nn.scheme]=Nn,ye[Ln.scheme]=Ln,a.SCHEMES=ye,a.pctEncChar=Ee,a.pctDecChars=Ce,a.parse=oe,a.removeDotSegments=Ve,a.serialize=Ne,a.resolveComponents=ke,a.resolve=tr,a.normalize=qe,a.equal=oa,a.escapeComponent=is,a.unescapeComponent=We,Object.defineProperty(a,"__esModule",{value:!0})})});var Oa=z(($v,bo)=>{"use strict";bo.exports=function a(e,t){if(e===t)return!0;if(e&&t&&typeof e=="object"&&typeof t=="object"){if(e.constructor!==t.constructor)return!1;var s,r,n;if(Array.isArray(e)){if(s=e.length,s!=t.length)return!1;for(r=s;r--!==0;)if(!a(e[r],t[r]))return!1;return!0}if(e.constructor===RegExp)return e.source===t.source&&e.flags===t.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===t.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===t.toString();if(n=Object.keys(e),s=n.length,s!==Object.keys(t).length)return!1;for(r=s;r--!==0;)if(!Object.prototype.hasOwnProperty.call(t,n[r]))return!1;for(r=s;r--!==0;){var o=n[r];if(!a(e[o],t[o]))return!1}return!0}return e!==e&&t!==t}});var wo=z((Av,xo)=>{"use strict";xo.exports=function(e){for(var t=0,s=e.length,r=0,n;r<s;)t++,n=e.charCodeAt(r++),n>=55296&&n<=56319&&r<s&&(n=e.charCodeAt(r),(n&64512)==56320&&r++);return t}});var st=z((Iv,So)=>{"use strict";So.exports={copy:Lf,checkDataType:ks,checkDataTypes:Ff,coerceToTypes:Mf,toHash:js,getProperty:Ns,escapeQuotes:Ls,equal:Oa(),ucs2length:wo(),varOccurences:zf,varReplace:Vf,schemaHasRules:Hf,schemaHasRulesExcept:Zf,schemaUnknownRules:Bf,toQuotedString:Ds,getPathExpr:Jf,getPath:Qf,getData:Wf,unescapeFragment:Yf,unescapeJsonPointer:Ms,escapeFragment:Xf,escapeJsonPointer:Fs};function Lf(a,e){e=e||{};for(var t in a)e[t]=a[t];return e}function ks(a,e,t,s){var r=s?" !== ":" === ",n=s?" || ":" && ",o=s?"!":"",i=s?"":"!";switch(a){case"null":return e+r+"null";case"array":return o+"Array.isArray("+e+")";case"object":return"("+o+e+n+"typeof "+e+r+'"object"'+n+i+"Array.isArray("+e+"))";case"integer":return"(typeof "+e+r+'"number"'+n+i+"("+e+" % 1)"+n+e+r+e+(t?n+o+"isFinite("+e+")":"")+")";case"number":return"(typeof "+e+r+'"'+a+'"'+(t?n+o+"isFinite("+e+")":"")+")";default:return"typeof "+e+r+'"'+a+'"'}}function Ff(a,e,t){switch(a.length){case 1:return ks(a[0],e,t,!0);default:var s="",r=js(a);r.array&&r.object&&(s=r.null?"(":"(!"+e+" || ",s+="typeof "+e+' !== "object")',delete r.null,delete r.array,delete r.object),r.number&&delete r.integer;for(var n in r)s+=(s?" && ":"")+ks(n,e,t,!0);return s}}var Eo=js(["string","number","integer","boolean","null"]);function Mf(a,e){if(Array.isArray(e)){for(var t=[],s=0;s<e.length;s++){var r=e[s];(Eo[r]||a==="array"&&r==="array")&&(t[t.length]=r)}if(t.length)return t}else{if(Eo[e])return[e];if(a==="array"&&e==="array")return["array"]}}function js(a){for(var e={},t=0;t<a.length;t++)e[a[t]]=!0;return e}var qf=/^[a-z$_][a-z$_0-9]*$/i,Uf=/'|\\/g;function Ns(a){return typeof a=="number"?"["+a+"]":qf.test(a)?"."+a:"['"+Ls(a)+"']"}function Ls(a){return a.replace(Uf,"\\$&").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\f/g,"\\f").replace(/\t/g,"\\t")}function zf(a,e){e+="[^0-9]";var t=a.match(new RegExp(e,"g"));return t?t.length:0}function Vf(a,e,t){return e+="([^0-9])",t=t.replace(/\$/g,"$$$$"),a.replace(new RegExp(e,"g"),t+"$1")}function Hf(a,e){if(typeof a=="boolean")return!a;for(var t in a)if(e[t])return!0}function Zf(a,e,t){if(typeof a=="boolean")return!a&&t!="not";for(var s in a)if(s!=t&&e[s])return!0}function Bf(a,e){if(typeof a!="boolean"){for(var t in a)if(!e[t])return t}}function Ds(a){return"'"+Ls(a)+"'"}function Jf(a,e,t,s){var r=t?"'/' + "+e+(s?"":".replace(/~/g, '~0').replace(/\\//g, '~1')"):s?"'[' + "+e+" + ']'":"'[\\'' + "+e+" + '\\']'";return Po(a,r)}function Qf(a,e,t){var s=Ds(t?"/"+Fs(e):Ns(e));return Po(a,s)}var Kf=/^\/(?:[^~]|~0|~1)*$/,Gf=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function Wf(a,e,t){var s,r,n,o;if(a==="")return"rootData";if(a[0]=="/"){if(!Kf.test(a))throw new Error("Invalid JSON-pointer: "+a);r=a,n="rootData"}else{if(o=a.match(Gf),!o)throw new Error("Invalid JSON-pointer: "+a);if(s=+o[1],r=o[2],r=="#"){if(s>=e)throw new Error("Cannot access property/index "+s+" levels up, current level is "+e);return t[e-s]}if(s>e)throw new Error("Cannot access data "+s+" levels up, current level is "+e);if(n="data"+(e-s||""),!r)return n}for(var i=n,u=r.split("/"),c=0;c<u.length;c++){var f=u[c];f&&(n+=Ns(Ms(f)),i+=" && "+n)}return i}function Po(a,e){return a=='""'?e:(a+" + "+e).replace(/([^\\])' \+ '/g,"$1")}function Yf(a){return Ms(decodeURIComponent(a))}function Xf(a){return encodeURIComponent(Fs(a))}function Fs(a){return a.replace(/~/g,"~0").replace(/\//g,"~1")}function Ms(a){return a.replace(/~1/g,"/").replace(/~0/g,"~")}});var qs=z((Cv,Ro)=>{"use strict";var eh=st();Ro.exports=rh;function rh(a){eh.copy(a,this)}});var To=z((kv,Oo)=>{"use strict";var $r=Oo.exports=function(a,e,t){typeof e=="function"&&(t=e,e={}),t=e.cb||t;var s=typeof t=="function"?t:t.pre||function(){},r=t.post||function(){};Ta(e,s,r,a,"",a)};$r.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0};$r.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};$r.propsKeywords={definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};$r.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0};function Ta(a,e,t,s,r,n,o,i,u,c){if(s&&typeof s=="object"&&!Array.isArray(s)){e(s,r,n,o,i,u,c);for(var f in s){var p=s[f];if(Array.isArray(p)){if(f in $r.arrayKeywords)for(var g=0;g<p.length;g++)Ta(a,e,t,p[g],r+"/"+f+"/"+g,n,r,f,s,g)}else if(f in $r.propsKeywords){if(p&&typeof p=="object")for(var d in p)Ta(a,e,t,p[d],r+"/"+f+"/"+th(d),n,r,f,s,d)}else(f in $r.keywords||a.allKeys&&!(f in $r.skipKeywords))&&Ta(a,e,t,p,r+"/"+f,n,r,f,s)}t(s,r,n,o,i,u,c)}}function th(a){return a.replace(/~/g,"~0").replace(/\//g,"~1")}});var Da=z((Dv,Co)=>{"use strict";var Vt=_o(),$o=Oa(),Ca=st(),$a=qs(),ah=To();Co.exports=Ir;Ir.normalizeId=Ar;Ir.fullPath=Aa;Ir.url=Ia;Ir.ids=lh;Ir.inlineRef=Us;Ir.schema=ka;function Ir(a,e,t){var s=this._refs[t];if(typeof s=="string")if(this._refs[s])s=this._refs[s];else return Ir.call(this,a,e,s);if(s=s||this._schemas[t],s instanceof $a)return Us(s.schema,this._opts.inlineRefs)?s.schema:s.validate||this._compile(s);var r=ka.call(this,e,t),n,o,i;return r&&(n=r.schema,e=r.root,i=r.baseId),n instanceof $a?o=n.validate||a.call(this,n.schema,e,void 0,i):n!==void 0&&(o=Us(n,this._opts.inlineRefs)?n:a.call(this,n,e,void 0,i)),o}function ka(a,e){var t=Vt.parse(e),s=Io(t),r=Aa(this._getId(a.schema));if(Object.keys(a.schema).length===0||s!==r){var n=Ar(s),o=this._refs[n];if(typeof o=="string")return sh.call(this,a,o,t);if(o instanceof $a)o.validate||this._compile(o),a=o;else if(o=this._schemas[n],o instanceof $a){if(o.validate||this._compile(o),n==Ar(e))return{schema:o,root:a,baseId:r};a=o}else return;if(!a.schema)return;r=Aa(this._getId(a.schema))}return Ao.call(this,t,r,a.schema,a)}function sh(a,e,t){var s=ka.call(this,a,e);if(s){var r=s.schema,n=s.baseId;a=s.root;var o=this._getId(r);return o&&(n=Ia(n,o)),Ao.call(this,t,n,r,a)}}var nh=Ca.toHash(["properties","patternProperties","enum","dependencies","definitions"]);function Ao(a,e,t,s){if(a.fragment=a.fragment||"",a.fragment.slice(0,1)=="/"){for(var r=a.fragment.split("/"),n=1;n<r.length;n++){var o=r[n];if(o){if(o=Ca.unescapeFragment(o),t=t[o],t===void 0)break;var i;if(!nh[o]&&(i=this._getId(t),i&&(e=Ia(e,i)),t.$ref)){var u=Ia(e,t.$ref),c=ka.call(this,s,u);c&&(t=c.schema,s=c.root,e=c.baseId)}}}if(t!==void 0&&t!==s.schema)return{schema:t,root:s,baseId:e}}}var oh=Ca.toHash(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum"]);function Us(a,e){if(e===!1)return!1;if(e===void 0||e===!0)return zs(a);if(e)return Vs(a)<=e}function zs(a){var e;if(Array.isArray(a)){for(var t=0;t<a.length;t++)if(e=a[t],typeof e=="object"&&!zs(e))return!1}else for(var s in a)if(s=="$ref"||(e=a[s],typeof e=="object"&&!zs(e)))return!1;return!0}function Vs(a){var e=0,t;if(Array.isArray(a)){for(var s=0;s<a.length;s++)if(t=a[s],typeof t=="object"&&(e+=Vs(t)),e==1/0)return 1/0}else for(var r in a){if(r=="$ref")return 1/0;if(oh[r])e++;else if(t=a[r],typeof t=="object"&&(e+=Vs(t)+1),e==1/0)return 1/0}return e}function Aa(a,e){e!==!1&&(a=Ar(a));var t=Vt.parse(a);return Io(t)}function Io(a){return Vt.serialize(a).split("#")[0]+"#"}var ih=/#\/?$/;function Ar(a){return a?a.replace(ih,""):""}function Ia(a,e){return e=Ar(e),Vt.resolve(a,e)}function lh(a){var e=Ar(this._getId(a)),t={"":e},s={"":Aa(e,!1)},r={},n=this;return ah(a,{allKeys:!0},function(o,i,u,c,f,p,g){if(i!==""){var d=n._getId(o),y=t[c],m=s[c]+"/"+f;if(g!==void 0&&(m+="/"+(typeof g=="number"?g:Ca.escapeFragment(g))),typeof d=="string"){d=y=Ar(y?Vt.resolve(y,d):d);var v=n._refs[d];if(typeof v=="string"&&(v=n._refs[v]),v&&v.schema){if(!$o(o,v.schema))throw new Error('id "'+d+'" resolves to more than one schema')}else if(d!=Ar(m))if(d[0]=="#"){if(r[d]&&!$o(o,r[d]))throw new Error('id "'+d+'" resolves to more than one schema');r[d]=o}else n._refs[d]=m}t[i]=y,s[i]=m}}),r}});var ja=z((jv,Do)=>{"use strict";var Hs=Da();Do.exports={Validation:ko(ch),MissingRef:ko(Zs)};function ch(a){this.message="validation failed",this.errors=a,this.ajv=this.validation=!0}Zs.message=function(a,e){return"can't resolve reference "+e+" from id "+a};function Zs(a,e,t){this.message=t||Zs.message(a,e),this.missingRef=Hs.url(a,e),this.missingSchema=Hs.normalizeId(Hs.fullPath(this.missingRef))}function ko(a){return a.prototype=Object.create(Error.prototype),a.prototype.constructor=a,a}});var Bs=z((Nv,jo)=>{"use strict";jo.exports=function(a,e){e||(e={}),typeof e=="function"&&(e={cmp:e});var t=typeof e.cycles=="boolean"?e.cycles:!1,s=e.cmp&&function(n){return function(o){return function(i,u){var c={key:i,value:o[i]},f={key:u,value:o[u]};return n(c,f)}}}(e.cmp),r=[];return function n(o){if(o&&o.toJSON&&typeof o.toJSON=="function"&&(o=o.toJSON()),o!==void 0){if(typeof o=="number")return isFinite(o)?""+o:"null";if(typeof o!="object")return JSON.stringify(o);var i,u;if(Array.isArray(o)){for(u="[",i=0;i<o.length;i++)i&&(u+=","),u+=n(o[i])||"null";return u+"]"}if(o===null)return"null";if(r.indexOf(o)!==-1){if(t)return JSON.stringify("__cycle__");throw new TypeError("Converting circular structure to JSON")}var c=r.push(o)-1,f=Object.keys(o).sort(s&&s(o));for(u="",i=0;i<f.length;i++){var p=f[i],g=n(o[p]);g&&(u&&(u+=","),u+=JSON.stringify(p)+":"+g)}return r.splice(c,1),"{"+u+"}"}}(a)}});var Js=z((Lv,No)=>{"use strict";No.exports=function(e,t,s){var r="",n=e.schema.$async===!0,o=e.util.schemaHasRulesExcept(e.schema,e.RULES.all,"$ref"),i=e.self._getId(e.schema);if(e.opts.strictKeywords){var u=e.util.schemaUnknownRules(e.schema,e.RULES.keywords);if(u){var c="unknown keyword: "+u;if(e.opts.strictKeywords==="log")e.logger.warn(c);else throw new Error(c)}}if(e.isTop&&(r+=" var validate = ",n&&(e.async=!0,r+="async "),r+="function(data, dataPath, parentData, parentDataProperty, rootData) { 'use strict'; ",i&&(e.opts.sourceCode||e.opts.processCode)&&(r+=" "+("/*# sourceURL="+i+" */")+" ")),typeof e.schema=="boolean"||!(o||e.schema.$ref)){var t="false schema",f=e.level,p=e.dataLevel,g=e.schema[t],d=e.schemaPath+e.util.getProperty(t),y=e.errSchemaPath+"/"+t,A=!e.opts.allErrors,q,m="data"+(p||""),O="valid"+f;if(e.schema===!1){e.isTop?A=!0:r+=" var "+O+" = false; ";var v=v||[];v.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(q||"false schema")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(y)+" , params: {} ",e.opts.messages!==!1&&(r+=" , message: 'boolean schema is false' "),e.opts.verbose&&(r+=" , schema: false , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var x=r;r=v.pop(),!e.compositeRule&&A?e.async?r+=" throw new ValidationError(["+x+"]); ":r+=" validate.errors = ["+x+"]; return false; ":r+=" var err = "+x+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}else e.isTop?n?r+=" return data; ":r+=" validate.errors = null; return true; ":r+=" var "+O+" = true; ";return e.isTop&&(r+=" }; return validate; "),r}if(e.isTop){var S=e.isTop,f=e.level=0,p=e.dataLevel=0,m="data";if(e.rootId=e.resolve.fullPath(e.self._getId(e.root.schema)),e.baseId=e.baseId||e.rootId,delete e.isTop,e.dataPathArr=[""],e.schema.default!==void 0&&e.opts.useDefaults&&e.opts.strictDefaults){var P="default is ignored in the schema root";if(e.opts.strictDefaults==="log")e.logger.warn(P);else throw new Error(P)}r+=" var vErrors = null; ",r+=" var errors = 0; ",r+=" if (rootData === undefined) rootData = data; "}else{var f=e.level,p=e.dataLevel,m="data"+(p||"");if(i&&(e.baseId=e.resolve.url(e.baseId,i)),n&&!e.async)throw new Error("async schema in sync schema");r+=" var errs_"+f+" = errors;"}var O="valid"+f,A=!e.opts.allErrors,I="",H="",q,C=e.schema.type,U=Array.isArray(C);if(C&&e.opts.nullable&&e.schema.nullable===!0&&(U?C.indexOf("null")==-1&&(C=C.concat("null")):C!="null"&&(C=[C,"null"],U=!0)),U&&C.length==1&&(C=C[0],U=!1),e.schema.$ref&&o){if(e.opts.extendRefs=="fail")throw new Error('$ref: validation keywords used in schema at path "'+e.errSchemaPath+'" (see option extendRefs)');e.opts.extendRefs!==!0&&(o=!1,e.logger.warn('$ref: keywords ignored in schema at path "'+e.errSchemaPath+'"'))}if(e.schema.$comment&&e.opts.$comment&&(r+=" "+e.RULES.all.$comment.code(e,"$comment")),C){if(e.opts.coerceTypes)var M=e.util.coerceToTypes(e.opts.coerceTypes,C);var L=e.RULES.types[C];if(M||U||L===!0||L&&!Se(L)){var d=e.schemaPath+".type",y=e.errSchemaPath+"/type",d=e.schemaPath+".type",y=e.errSchemaPath+"/type",$=U?"checkDataTypes":"checkDataType";if(r+=" if ("+e.util[$](C,m,e.opts.strictNumbers,!0)+") { ",M){var k="dataType"+f,F="coerced"+f;r+=" var "+k+" = typeof "+m+"; var "+F+" = undefined; ",e.opts.coerceTypes=="array"&&(r+=" if ("+k+" == 'object' && Array.isArray("+m+") && "+m+".length == 1) { "+m+" = "+m+"[0]; "+k+" = typeof "+m+"; if ("+e.util.checkDataType(e.schema.type,m,e.opts.strictNumbers)+") "+F+" = "+m+"; } "),r+=" if ("+F+" !== undefined) ; ";var le=M;if(le)for(var Y,re=-1,W=le.length-1;re<W;)Y=le[re+=1],Y=="string"?r+=" else if ("+k+" == 'number' || "+k+" == 'boolean') "+F+" = '' + "+m+"; else if ("+m+" === null) "+F+" = ''; ":Y=="number"||Y=="integer"?(r+=" else if ("+k+" == 'boolean' || "+m+" === null || ("+k+" == 'string' && "+m+" && "+m+" == +"+m+" ",Y=="integer"&&(r+=" && !("+m+" % 1)"),r+=")) "+F+" = +"+m+"; "):Y=="boolean"?r+=" else if ("+m+" === 'false' || "+m+" === 0 || "+m+" === null) "+F+" = false; else if ("+m+" === 'true' || "+m+" === 1) "+F+" = true; ":Y=="null"?r+=" else if ("+m+" === '' || "+m+" === 0 || "+m+" === false) "+F+" = null; ":e.opts.coerceTypes=="array"&&Y=="array"&&(r+=" else if ("+k+" == 'string' || "+k+" == 'number' || "+k+" == 'boolean' || "+m+" == null) "+F+" = ["+m+"]; ");r+=" else { ";var v=v||[];v.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(q||"type")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(y)+" , params: { type: '",U?r+=""+C.join(","):r+=""+C,r+="' } ",e.opts.messages!==!1&&(r+=" , message: 'should be ",U?r+=""+C.join(","):r+=""+C,r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var x=r;r=v.pop(),!e.compositeRule&&A?e.async?r+=" throw new ValidationError(["+x+"]); ":r+=" validate.errors = ["+x+"]; return false; ":r+=" var err = "+x+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } if ("+F+" !== undefined) { ";var Z=p?"data"+(p-1||""):"parentData",me=p?e.dataPathArr[p]:"parentDataProperty";r+=" "+m+" = "+F+"; ",p||(r+="if ("+Z+" !== undefined)"),r+=" "+Z+"["+me+"] = "+F+"; } "}else{var v=v||[];v.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(q||"type")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(y)+" , params: { type: '",U?r+=""+C.join(","):r+=""+C,r+="' } ",e.opts.messages!==!1&&(r+=" , message: 'should be ",U?r+=""+C.join(","):r+=""+C,r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var x=r;r=v.pop(),!e.compositeRule&&A?e.async?r+=" throw new ValidationError(["+x+"]); ":r+=" validate.errors = ["+x+"]; return false; ":r+=" var err = "+x+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}r+=" } "}}if(e.schema.$ref&&!o)r+=" "+e.RULES.all.$ref.code(e,"$ref")+" ",A&&(r+=" } if (errors === ",S?r+="0":r+="errs_"+f,r+=") { ",H+="}");else{var Oe=e.RULES;if(Oe){for(var L,Ie=-1,se=Oe.length-1;Ie<se;)if(L=Oe[Ie+=1],Se(L)){if(L.type&&(r+=" if ("+e.util.checkDataType(L.type,m,e.opts.strictNumbers)+") { "),e.opts.useDefaults){if(L.type=="object"&&e.schema.properties){var g=e.schema.properties,ye=Object.keys(g),Ee=ye;if(Ee)for(var Ce,wr=-1,cr=Ee.length-1;wr<cr;){Ce=Ee[wr+=1];var _e=g[Ce];if(_e.default!==void 0){var ve=m+e.util.getProperty(Ce);if(e.compositeRule){if(e.opts.strictDefaults){var P="default is ignored for: "+ve;if(e.opts.strictDefaults==="log")e.logger.warn(P);else throw new Error(P)}}else r+=" if ("+ve+" === undefined ",e.opts.useDefaults=="empty"&&(r+=" || "+ve+" === null || "+ve+" === '' "),r+=" ) "+ve+" = ",e.opts.useDefaults=="shared"?r+=" "+e.useDefault(_e.default)+" ":r+=" "+JSON.stringify(_e.default)+" ",r+="; "}}}else if(L.type=="array"&&Array.isArray(e.schema.items)){var Dr=e.schema.items;if(Dr){for(var _e,re=-1,Te=Dr.length-1;re<Te;)if(_e=Dr[re+=1],_e.default!==void 0){var ve=m+"["+re+"]";if(e.compositeRule){if(e.opts.strictDefaults){var P="default is ignored for: "+ve;if(e.opts.strictDefaults==="log")e.logger.warn(P);else throw new Error(P)}}else r+=" if ("+ve+" === undefined ",e.opts.useDefaults=="empty"&&(r+=" || "+ve+" === null || "+ve+" === '' "),r+=" ) "+ve+" = ",e.opts.useDefaults=="shared"?r+=" "+e.useDefault(_e.default)+" ":r+=" "+JSON.stringify(_e.default)+" ",r+="; "}}}}var oe=L.rules;if(oe){for(var Er,ur=-1,jr=oe.length-1;ur<jr;)if(Er=oe[ur+=1],Ve(Er)){var Nr=Er.code(e,Er.keyword,L.type);Nr&&(r+=" "+Nr+" ",A&&(I+="}"))}}if(A&&(r+=" "+I+" ",I=""),L.type&&(r+=" } ",C&&C===L.type&&!M)){r+=" else { ";var d=e.schemaPath+".type",y=e.errSchemaPath+"/type",v=v||[];v.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(q||"type")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(y)+" , params: { type: '",U?r+=""+C.join(","):r+=""+C,r+="' } ",e.opts.messages!==!1&&(r+=" , message: 'should be ",U?r+=""+C.join(","):r+=""+C,r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var x=r;r=v.pop(),!e.compositeRule&&A?e.async?r+=" throw new ValidationError(["+x+"]); ":r+=" validate.errors = ["+x+"]; return false; ":r+=" var err = "+x+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } "}A&&(r+=" if (errors === ",S?r+="0":r+="errs_"+f,r+=") { ",H+="}")}}}A&&(r+=" "+H+" "),S?(n?(r+=" if (errors === 0) return data; ",r+=" else throw new ValidationError(vErrors); "):(r+=" validate.errors = vErrors; ",r+=" return errors === 0; "),r+=" }; return validate;"):r+=" var "+O+" = errors === errs_"+f+";";function Se(ke){for(var tr=ke.rules,qe=0;qe<tr.length;qe++)if(Ve(tr[qe]))return!0}function Ve(ke){return e.schema[ke.keyword]!==void 0||ke.implements&&Ne(ke)}function Ne(ke){for(var tr=ke.implements,qe=0;qe<tr.length;qe++)if(e.schema[tr[qe]]!==void 0)return!0}return r}});var Uo=z((Fv,qo)=>{"use strict";var Na=Da(),Fa=st(),Fo=ja(),uh=Bs(),Lo=Js(),dh=Fa.ucs2length,fh=Oa(),hh=Fo.Validation;qo.exports=Qs;function Qs(a,e,t,s){var r=this,n=this._opts,o=[void 0],i={},u=[],c={},f=[],p={},g=[];e=e||{schema:a,refVal:o,refs:i};var d=ph.call(this,a,e,s),y=this._compilations[d.index];if(d.compiling)return y.callValidate=P;var m=this._formats,v=this.RULES;try{var x=O(a,e,t,s);y.validate=x;var S=y.callValidate;return S&&(S.schema=x.schema,S.errors=null,S.refs=x.refs,S.refVal=x.refVal,S.root=x.root,S.$async=x.$async,n.sourceCode&&(S.source=x.source)),x}finally{mh.call(this,a,e,s)}function P(){var $=y.validate,k=$.apply(this,arguments);return P.errors=$.errors,k}function O($,k,F,le){var Y=!k||k&&k.schema==$;if(k.schema!=e.schema)return Qs.call(r,$,k,F,le);var re=$.$async===!0,W=Lo({isTop:!0,schema:$,isRoot:Y,baseId:le,root:k,schemaPath:"",errSchemaPath:"#",errorPath:'""',MissingRefError:Fo.MissingRef,RULES:v,validate:Lo,util:Fa,resolve:Na,resolveRef:A,usePattern:U,useDefault:M,useCustomRule:L,opts:n,formats:m,logger:r.logger,self:r});W=La(o,yh)+La(u,vh)+La(f,gh)+La(g,_h)+W,n.processCode&&(W=n.processCode(W,$));var Z;try{var me=new Function("self","RULES","formats","root","refVal","defaults","customRules","equal","ucs2length","ValidationError",W);Z=me(r,v,m,e,o,f,g,fh,dh,hh),o[0]=Z}catch(Oe){throw r.logger.error("Error compiling schema, function code:",W),Oe}return Z.schema=$,Z.errors=null,Z.refs=i,Z.refVal=o,Z.root=Y?Z:k,re&&(Z.$async=!0),n.sourceCode===!0&&(Z.source={code:W,patterns:u,defaults:f}),Z}function A($,k,F){k=Na.url($,k);var le=i[k],Y,re;if(le!==void 0)return Y=o[le],re="refVal["+le+"]",C(Y,re);if(!F&&e.refs){var W=e.refs[k];if(W!==void 0)return Y=e.refVal[W],re=I(k,Y),C(Y,re)}re=I(k);var Z=Na.call(r,O,e,k);if(Z===void 0){var me=t&&t[k];me&&(Z=Na.inlineRef(me,n.inlineRefs)?me:Qs.call(r,me,e,t,$))}if(Z===void 0)H(k);else return q(k,Z),C(Z,re)}function I($,k){var F=o.length;return o[F]=k,i[$]=F,"refVal"+F}function H($){delete i[$]}function q($,k){var F=i[$];o[F]=k}function C($,k){return typeof $=="object"||typeof $=="boolean"?{code:k,schema:$,inline:!0}:{code:k,$async:$&&!!$.$async}}function U($){var k=c[$];return k===void 0&&(k=c[$]=u.length,u[k]=$),"pattern"+k}function M($){switch(typeof $){case"boolean":case"number":return""+$;case"string":return Fa.toQuotedString($);case"object":if($===null)return"null";var k=uh($),F=p[k];return F===void 0&&(F=p[k]=f.length,f[F]=$),"default"+F}}function L($,k,F,le){if(r._opts.validateSchema!==!1){var Y=$.definition.dependencies;if(Y&&!Y.every(function(Ee){return Object.prototype.hasOwnProperty.call(F,Ee)}))throw new Error("parent schema must have all required keywords: "+Y.join(","));var re=$.definition.validateSchema;if(re){var W=re(k);if(!W){var Z="keyword schema is invalid: "+r.errorsText(re.errors);if(r._opts.validateSchema=="log")r.logger.error(Z);else throw new Error(Z)}}}var me=$.definition.compile,Oe=$.definition.inline,Ie=$.definition.macro,se;if(me)se=me.call(r,k,F,le);else if(Ie)se=Ie.call(r,k,F,le),n.validateSchema!==!1&&r.validateSchema(se,!0);else if(Oe)se=Oe.call(r,le,$.keyword,k,F);else if(se=$.definition.validate,!se)return;if(se===void 0)throw new Error('custom keyword "'+$.keyword+'"failed to compile');var ye=g.length;return g[ye]=se,{code:"customRule"+ye,validate:se}}}function ph(a,e,t){var s=Mo.call(this,a,e,t);return s>=0?{index:s,compiling:!0}:(s=this._compilations.length,this._compilations[s]={schema:a,root:e,baseId:t},{index:s,compiling:!1})}function mh(a,e,t){var s=Mo.call(this,a,e,t);s>=0&&this._compilations.splice(s,1)}function Mo(a,e,t){for(var s=0;s<this._compilations.length;s++){var r=this._compilations[s];if(r.schema==a&&r.root==e&&r.baseId==t)return s}return-1}function vh(a,e){return"var pattern"+a+" = new RegExp("+Fa.toQuotedString(e[a])+");"}function gh(a){return"var default"+a+" = defaults["+a+"];"}function yh(a,e){return e[a]===void 0?"":"var refVal"+a+" = refVal["+a+"];"}function _h(a){return"var customRule"+a+" = customRules["+a+"];"}function La(a,e){if(!a.length)return"";for(var t="",s=0;s<a.length;s++)t+=e(s,a);return t}});var Vo=z((Mv,zo)=>{"use strict";var Ma=zo.exports=function(){this._cache={}};Ma.prototype.put=function(e,t){this._cache[e]=t};Ma.prototype.get=function(e){return this._cache[e]};Ma.prototype.del=function(e){delete this._cache[e]};Ma.prototype.clear=function(){this._cache={}}});var ri=z((qv,ei)=>{"use strict";var bh=st(),xh=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,wh=[0,31,28,31,30,31,30,31,31,30,31,30,31],Eh=/^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i,Ho=/^(?=.{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,Ph=/^(?:[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,Sh=/^(?:[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,Zo=/^(?:(?:[^\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,Bo=/^(?:(?:http[s\u017F]?|ftp):\/\/)(?:(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+(?::(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?@)?(?:(?!10(?:\.[0-9]{1,3}){3})(?!127(?:\.[0-9]{1,3}){3})(?!169\.254(?:\.[0-9]{1,3}){2})(?!192\.168(?:\.[0-9]{1,3}){2})(?!172\.(?:1[6-9]|2[0-9]|3[01])(?:\.[0-9]{1,3}){2})(?:[1-9][0-9]?|1[0-9][0-9]|2[01][0-9]|22[0-3])(?:\.(?:1?[0-9]{1,2}|2[0-4][0-9]|25[0-5])){2}(?:\.(?:[1-9][0-9]?|1[0-9][0-9]|2[0-4][0-9]|25[0-4]))|(?:(?:(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-)*(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)(?:\.(?:(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-)*(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)*(?:\.(?:(?:[a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]){2,})))(?::[0-9]{2,5})?(?:\/(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?$/i,Jo=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,Qo=/^(?:\/(?:[^~/]|~0|~1)*)*$/,Ko=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,Go=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/;ei.exports=qa;function qa(a){return a=a=="full"?"full":"fast",bh.copy(qa[a])}qa.fast={date:/^\d\d\d\d-[0-1]\d-[0-3]\d$/,time:/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,"date-time":/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,"uri-template":Zo,url:Bo,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i,hostname:Ho,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,ipv6:/^\s*(?:(?:(?:[0-9a-f]{1,4}:){7}(?:[0-9a-f]{1,4}|:))|(?:(?:[0-9a-f]{1,4}:){6}(?::[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){5}(?:(?:(?::[0-9a-f]{1,4}){1,2})|:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){4}(?:(?:(?::[0-9a-f]{1,4}){1,3})|(?:(?::[0-9a-f]{1,4})?:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){3}(?:(?:(?::[0-9a-f]{1,4}){1,4})|(?:(?::[0-9a-f]{1,4}){0,2}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){2}(?:(?:(?::[0-9a-f]{1,4}){1,5})|(?:(?::[0-9a-f]{1,4}){0,3}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){1}(?:(?:(?::[0-9a-f]{1,4}){1,6})|(?:(?::[0-9a-f]{1,4}){0,4}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?::(?:(?:(?::[0-9a-f]{1,4}){1,7})|(?:(?::[0-9a-f]{1,4}){0,5}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(?:%.+)?\s*$/i,regex:Xo,uuid:Jo,"json-pointer":Qo,"json-pointer-uri-fragment":Ko,"relative-json-pointer":Go};qa.full={date:Wo,time:Yo,"date-time":Th,uri:Ah,"uri-reference":Sh,"uri-template":Zo,url:Bo,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:Ho,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,ipv6:/^\s*(?:(?:(?:[0-9a-f]{1,4}:){7}(?:[0-9a-f]{1,4}|:))|(?:(?:[0-9a-f]{1,4}:){6}(?::[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){5}(?:(?:(?::[0-9a-f]{1,4}){1,2})|:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){4}(?:(?:(?::[0-9a-f]{1,4}){1,3})|(?:(?::[0-9a-f]{1,4})?:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){3}(?:(?:(?::[0-9a-f]{1,4}){1,4})|(?:(?::[0-9a-f]{1,4}){0,2}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){2}(?:(?:(?::[0-9a-f]{1,4}){1,5})|(?:(?::[0-9a-f]{1,4}){0,3}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){1}(?:(?:(?::[0-9a-f]{1,4}){1,6})|(?:(?::[0-9a-f]{1,4}){0,4}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?::(?:(?:(?::[0-9a-f]{1,4}){1,7})|(?:(?::[0-9a-f]{1,4}){0,5}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(?:%.+)?\s*$/i,regex:Xo,uuid:Jo,"json-pointer":Qo,"json-pointer-uri-fragment":Ko,"relative-json-pointer":Go};function Rh(a){return a%4===0&&(a%100!==0||a%400===0)}function Wo(a){var e=a.match(xh);if(!e)return!1;var t=+e[1],s=+e[2],r=+e[3];return s>=1&&s<=12&&r>=1&&r<=(s==2&&Rh(t)?29:wh[s])}function Yo(a,e){var t=a.match(Eh);if(!t)return!1;var s=t[1],r=t[2],n=t[3],o=t[5];return(s<=23&&r<=59&&n<=59||s==23&&r==59&&n==60)&&(!e||o)}var Oh=/t|\s/i;function Th(a){var e=a.split(Oh);return e.length==2&&Wo(e[0])&&Yo(e[1],!0)}var $h=/\/|:/;function Ah(a){return $h.test(a)&&Ph.test(a)}var Ih=/[^\\]\\Z/;function Xo(a){if(Ih.test(a))return!1;try{return new RegExp(a),!0}catch{return!1}}});var ai=z((Uv,ti)=>{"use strict";ti.exports=function(e,t,s){var r=" ",n=e.level,o=e.dataLevel,i=e.schema[t],u=e.errSchemaPath+"/"+t,c=!e.opts.allErrors,f="data"+(o||""),p="valid"+n,g,d;if(i=="#"||i=="#/")e.isRoot?(g=e.async,d="validate"):(g=e.root.schema.$async===!0,d="root.refVal[0]");else{var y=e.resolveRef(e.baseId,i,e.isRoot);if(y===void 0){var m=e.MissingRefError.message(e.baseId,i);if(e.opts.missingRefs=="fail"){e.logger.error(m);var v=v||[];v.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '$ref' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(u)+" , params: { ref: '"+e.util.escapeQuotes(i)+"' } ",e.opts.messages!==!1&&(r+=" , message: 'can\\'t resolve reference "+e.util.escapeQuotes(i)+"' "),e.opts.verbose&&(r+=" , schema: "+e.util.toQuotedString(i)+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+f+" "),r+=" } "):r+=" {} ";var x=r;r=v.pop(),!e.compositeRule&&c?e.async?r+=" throw new ValidationError(["+x+"]); ":r+=" validate.errors = ["+x+"]; return false; ":r+=" var err = "+x+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",c&&(r+=" if (false) { ")}else if(e.opts.missingRefs=="ignore")e.logger.warn(m),c&&(r+=" if (true) { ");else throw new e.MissingRefError(e.baseId,i,m)}else if(y.inline){var S=e.util.copy(e);S.level++;var P="valid"+S.level;S.schema=y.schema,S.schemaPath="",S.errSchemaPath=i;var O=e.validate(S).replace(/validate\.schema/g,y.code);r+=" "+O+" ",c&&(r+=" if ("+P+") { ")}else g=y.$async===!0||e.async&&y.$async!==!1,d=y.code}if(d){var v=v||[];v.push(r),r="",e.opts.passContext?r+=" "+d+".call(this, ":r+=" "+d+"( ",r+=" "+f+", (dataPath || '')",e.errorPath!='""'&&(r+=" + "+e.errorPath);var A=o?"data"+(o-1||""):"parentData",I=o?e.dataPathArr[o]:"parentDataProperty";r+=" , "+A+" , "+I+", rootData) ";var H=r;if(r=v.pop(),g){if(!e.async)throw new Error("async schema referenced by sync schema");c&&(r+=" var "+p+"; "),r+=" try { await "+H+"; ",c&&(r+=" "+p+" = true; "),r+=" } catch (e) { if (!(e instanceof ValidationError)) throw e; if (vErrors === null) vErrors = e.errors; else vErrors = vErrors.concat(e.errors); errors = vErrors.length; ",c&&(r+=" "+p+" = false; "),r+=" } ",c&&(r+=" if ("+p+") { ")}else r+=" if (!"+H+") { if (vErrors === null) vErrors = "+d+".errors; else vErrors = vErrors.concat("+d+".errors); errors = vErrors.length; } ",c&&(r+=" else { ")}return r}});var ni=z((zv,si)=>{"use strict";si.exports=function(e,t,s){var r=" ",n=e.schema[t],o=e.schemaPath+e.util.getProperty(t),i=e.errSchemaPath+"/"+t,u=!e.opts.allErrors,c=e.util.copy(e),f="";c.level++;var p="valid"+c.level,g=c.baseId,d=!0,y=n;if(y)for(var m,v=-1,x=y.length-1;v<x;)m=y[v+=1],(e.opts.strictKeywords?typeof m=="object"&&Object.keys(m).length>0||m===!1:e.util.schemaHasRules(m,e.RULES.all))&&(d=!1,c.schema=m,c.schemaPath=o+"["+v+"]",c.errSchemaPath=i+"/"+v,r+=" "+e.validate(c)+" ",c.baseId=g,u&&(r+=" if ("+p+") { ",f+="}"));return u&&(d?r+=" if (true) { ":r+=" "+f.slice(0,-1)+" "),r}});var ii=z((Vv,oi)=>{"use strict";oi.exports=function(e,t,s){var r=" ",n=e.level,o=e.dataLevel,i=e.schema[t],u=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,f=!e.opts.allErrors,p="data"+(o||""),g="valid"+n,d="errs__"+n,y=e.util.copy(e),m="";y.level++;var v="valid"+y.level,x=i.every(function(q){return e.opts.strictKeywords?typeof q=="object"&&Object.keys(q).length>0||q===!1:e.util.schemaHasRules(q,e.RULES.all)});if(x){var S=y.baseId;r+=" var "+d+" = errors; var "+g+" = false; ";var P=e.compositeRule;e.compositeRule=y.compositeRule=!0;var O=i;if(O)for(var A,I=-1,H=O.length-1;I<H;)A=O[I+=1],y.schema=A,y.schemaPath=u+"["+I+"]",y.errSchemaPath=c+"/"+I,r+=" "+e.validate(y)+" ",y.baseId=S,r+=" "+g+" = "+g+" || "+v+"; if (!"+g+") { ",m+="}";e.compositeRule=y.compositeRule=P,r+=" "+m+" if (!"+g+") { var err = ",e.createErrors!==!1?(r+=" { keyword: 'anyOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: {} ",e.opts.messages!==!1&&(r+=" , message: 'should match some schema in anyOf' "),e.opts.verbose&&(r+=" , schema: validate.schema"+u+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&f&&(e.async?r+=" throw new ValidationError(vErrors); ":r+=" validate.errors = vErrors; return false; "),r+=" } else { errors = "+d+"; if (vErrors !== null) { if ("+d+") vErrors.length = "+d+"; else vErrors = null; } ",e.opts.allErrors&&(r+=" } ")}else f&&(r+=" if (true) { ");return r}});var ci=z((Hv,li)=>{"use strict";li.exports=function(e,t,s){var r=" ",n=e.schema[t],o=e.errSchemaPath+"/"+t,i=!e.opts.allErrors,u=e.util.toQuotedString(n);return e.opts.$comment===!0?r+=" console.log("+u+");":typeof e.opts.$comment=="function"&&(r+=" self._opts.$comment("+u+", "+e.util.toQuotedString(o)+", validate.root.schema);"),r}});var di=z((Zv,ui)=>{"use strict";ui.exports=function(e,t,s){var r=" ",n=e.level,o=e.dataLevel,i=e.schema[t],u=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,f=!e.opts.allErrors,p="data"+(o||""),g="valid"+n,d=e.opts.$data&&i&&i.$data,y;d?(r+=" var schema"+n+" = "+e.util.getData(i.$data,o,e.dataPathArr)+"; ",y="schema"+n):y=i,d||(r+=" var schema"+n+" = validate.schema"+u+";"),r+="var "+g+" = equal("+p+", schema"+n+"); if (!"+g+") { ";var m=m||[];m.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'const' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { allowedValue: schema"+n+" } ",e.opts.messages!==!1&&(r+=" , message: 'should be equal to constant' "),e.opts.verbose&&(r+=" , schema: validate.schema"+u+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),r+=" } "):r+=" {} ";var v=r;return r=m.pop(),!e.compositeRule&&f?e.async?r+=" throw new ValidationError(["+v+"]); ":r+=" validate.errors = ["+v+"]; return false; ":r+=" var err = "+v+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" }",f&&(r+=" else { "),r}});var hi=z((Bv,fi)=>{"use strict";fi.exports=function(e,t,s){var r=" ",n=e.level,o=e.dataLevel,i=e.schema[t],u=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,f=!e.opts.allErrors,p="data"+(o||""),g="valid"+n,d="errs__"+n,y=e.util.copy(e),m="";y.level++;var v="valid"+y.level,x="i"+n,S=y.dataLevel=e.dataLevel+1,P="data"+S,O=e.baseId,A=e.opts.strictKeywords?typeof i=="object"&&Object.keys(i).length>0||i===!1:e.util.schemaHasRules(i,e.RULES.all);if(r+="var "+d+" = errors;var "+g+";",A){var I=e.compositeRule;e.compositeRule=y.compositeRule=!0,y.schema=i,y.schemaPath=u,y.errSchemaPath=c,r+=" var "+v+" = false; for (var "+x+" = 0; "+x+" < "+p+".length; "+x+"++) { ",y.errorPath=e.util.getPathExpr(e.errorPath,x,e.opts.jsonPointers,!0);var H=p+"["+x+"]";y.dataPathArr[S]=x;var q=e.validate(y);y.baseId=O,e.util.varOccurences(q,P)<2?r+=" "+e.util.varReplace(q,P,H)+" ":r+=" var "+P+" = "+H+"; "+q+" ",r+=" if ("+v+") break; } ",e.compositeRule=y.compositeRule=I,r+=" "+m+" if (!"+v+") {"}else r+=" if ("+p+".length == 0) {";var C=C||[];C.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'contains' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: {} ",e.opts.messages!==!1&&(r+=" , message: 'should contain a valid item' "),e.opts.verbose&&(r+=" , schema: validate.schema"+u+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),r+=" } "):r+=" {} ";var U=r;return r=C.pop(),!e.compositeRule&&f?e.async?r+=" throw new ValidationError(["+U+"]); ":r+=" validate.errors = ["+U+"]; return false; ":r+=" var err = "+U+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } else { ",A&&(r+=" errors = "+d+"; if (vErrors !== null) { if ("+d+") vErrors.length = "+d+"; else vErrors = null; } "),e.opts.allErrors&&(r+=" } "),r}});var mi=z((Jv,pi)=>{"use strict";pi.exports=function(e,t,s){var r=" ",n=e.level,o=e.dataLevel,i=e.schema[t],u=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,f=!e.opts.allErrors,p="data"+(o||""),g="errs__"+n,d=e.util.copy(e),y="";d.level++;var m="valid"+d.level,v={},x={},S=e.opts.ownProperties;for(I in i)if(I!="__proto__"){var P=i[I],O=Array.isArray(P)?x:v;O[I]=P}r+="var "+g+" = errors;";var A=e.errorPath;r+="var missing"+n+";";for(var I in x)if(O=x[I],O.length){if(r+=" if ( "+p+e.util.getProperty(I)+" !== undefined ",S&&(r+=" && Object.prototype.hasOwnProperty.call("+p+", '"+e.util.escapeQuotes(I)+"') "),f){r+=" && ( ";var H=O;if(H)for(var q,C=-1,U=H.length-1;C<U;){q=H[C+=1],C&&(r+=" || ");var M=e.util.getProperty(q),L=p+M;r+=" ( ( "+L+" === undefined ",S&&(r+=" || ! Object.prototype.hasOwnProperty.call("+p+", '"+e.util.escapeQuotes(q)+"') "),r+=") && (missing"+n+" = "+e.util.toQuotedString(e.opts.jsonPointers?q:M)+") ) "}r+=")) { ";var $="missing"+n,k="' + "+$+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.opts.jsonPointers?e.util.getPathExpr(A,$,!0):A+" + "+$);var F=F||[];F.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'dependencies' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { property: '"+e.util.escapeQuotes(I)+"', missingProperty: '"+k+"', depsCount: "+O.length+", deps: '"+e.util.escapeQuotes(O.length==1?O[0]:O.join(", "))+"' } ",e.opts.messages!==!1&&(r+=" , message: 'should have ",O.length==1?r+="property "+e.util.escapeQuotes(O[0]):r+="properties "+e.util.escapeQuotes(O.join(", ")),r+=" when property "+e.util.escapeQuotes(I)+" is present' "),e.opts.verbose&&(r+=" , schema: validate.schema"+u+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),r+=" } "):r+=" {} ";var le=r;r=F.pop(),!e.compositeRule&&f?e.async?r+=" throw new ValidationError(["+le+"]); ":r+=" validate.errors = ["+le+"]; return false; ":r+=" var err = "+le+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}else{r+=" ) { ";var Y=O;if(Y)for(var q,re=-1,W=Y.length-1;re<W;){q=Y[re+=1];var M=e.util.getProperty(q),k=e.util.escapeQuotes(q),L=p+M;e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPath(A,q,e.opts.jsonPointers)),r+=" if ( "+L+" === undefined ",S&&(r+=" || ! Object.prototype.hasOwnProperty.call("+p+", '"+e.util.escapeQuotes(q)+"') "),r+=") { var err = ",e.createErrors!==!1?(r+=" { keyword: 'dependencies' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { property: '"+e.util.escapeQuotes(I)+"', missingProperty: '"+k+"', depsCount: "+O.length+", deps: '"+e.util.escapeQuotes(O.length==1?O[0]:O.join(", "))+"' } ",e.opts.messages!==!1&&(r+=" , message: 'should have ",O.length==1?r+="property "+e.util.escapeQuotes(O[0]):r+="properties "+e.util.escapeQuotes(O.join(", ")),r+=" when property "+e.util.escapeQuotes(I)+" is present' "),e.opts.verbose&&(r+=" , schema: validate.schema"+u+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } "}}r+=" } ",f&&(y+="}",r+=" else { ")}e.errorPath=A;var Z=d.baseId;for(var I in v){var P=v[I];(e.opts.strictKeywords?typeof P=="object"&&Object.keys(P).length>0||P===!1:e.util.schemaHasRules(P,e.RULES.all))&&(r+=" "+m+" = true; if ( "+p+e.util.getProperty(I)+" !== undefined ",S&&(r+=" && Object.prototype.hasOwnProperty.call("+p+", '"+e.util.escapeQuotes(I)+"') "),r+=") { ",d.schema=P,d.schemaPath=u+e.util.getProperty(I),d.errSchemaPath=c+"/"+e.util.escapeFragment(I),r+=" "+e.validate(d)+" ",d.baseId=Z,r+=" } ",f&&(r+=" if ("+m+") { ",y+="}"))}return f&&(r+=" "+y+" if ("+g+" == errors) {"),r}});var gi=z((Qv,vi)=>{"use strict";vi.exports=function(e,t,s){var r=" ",n=e.level,o=e.dataLevel,i=e.schema[t],u=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,f=!e.opts.allErrors,p="data"+(o||""),g="valid"+n,d=e.opts.$data&&i&&i.$data,y;d?(r+=" var schema"+n+" = "+e.util.getData(i.$data,o,e.dataPathArr)+"; ",y="schema"+n):y=i;var m="i"+n,v="schema"+n;d||(r+=" var "+v+" = validate.schema"+u+";"),r+="var "+g+";",d&&(r+=" if (schema"+n+" === undefined) "+g+" = true; else if (!Array.isArray(schema"+n+")) "+g+" = false; else {"),r+=""+g+" = false;for (var "+m+"=0; "+m+"<"+v+".length; "+m+"++) if (equal("+p+", "+v+"["+m+"])) { "+g+" = true; break; }",d&&(r+=" } "),r+=" if (!"+g+") { ";var x=x||[];x.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'enum' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { allowedValues: schema"+n+" } ",e.opts.messages!==!1&&(r+=" , message: 'should be equal to one of the allowed values' "),e.opts.verbose&&(r+=" , schema: validate.schema"+u+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),r+=" } "):r+=" {} ";var S=r;return r=x.pop(),!e.compositeRule&&f?e.async?r+=" throw new ValidationError(["+S+"]); ":r+=" validate.errors = ["+S+"]; return false; ":r+=" var err = "+S+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" }",f&&(r+=" else { "),r}});var _i=z((Kv,yi)=>{"use strict";yi.exports=function(e,t,s){var r=" ",n=e.level,o=e.dataLevel,i=e.schema[t],u=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,f=!e.opts.allErrors,p="data"+(o||"");if(e.opts.format===!1)return f&&(r+=" if (true) { "),r;var g=e.opts.$data&&i&&i.$data,d;g?(r+=" var schema"+n+" = "+e.util.getData(i.$data,o,e.dataPathArr)+"; ",d="schema"+n):d=i;var y=e.opts.unknownFormats,m=Array.isArray(y);if(g){var v="format"+n,x="isObject"+n,S="formatType"+n;r+=" var "+v+" = formats["+d+"]; var "+x+" = typeof "+v+" == 'object' && !("+v+" instanceof RegExp) && "+v+".validate; var "+S+" = "+x+" && "+v+".type || 'string'; if ("+x+") { ",e.async&&(r+=" var async"+n+" = "+v+".async; "),r+=" "+v+" = "+v+".validate; } if ( ",g&&(r+=" ("+d+" !== undefined && typeof "+d+" != 'string') || "),r+=" (",y!="ignore"&&(r+=" ("+d+" && !"+v+" ",m&&(r+=" && self._opts.unknownFormats.indexOf("+d+") == -1 "),r+=") || "),r+=" ("+v+" && "+S+" == '"+s+"' && !(typeof "+v+" == 'function' ? ",e.async?r+=" (async"+n+" ? await "+v+"("+p+") : "+v+"("+p+")) ":r+=" "+v+"("+p+") ",r+=" : "+v+".test("+p+"))))) {"}else{var v=e.formats[i];if(!v){if(y=="ignore")return e.logger.warn('unknown format "'+i+'" ignored in schema at path "'+e.errSchemaPath+'"'),f&&(r+=" if (true) { "),r;if(m&&y.indexOf(i)>=0)return f&&(r+=" if (true) { "),r;throw new Error('unknown format "'+i+'" is used in schema at path "'+e.errSchemaPath+'"')}var x=typeof v=="object"&&!(v instanceof RegExp)&&v.validate,S=x&&v.type||"string";if(x){var P=v.async===!0;v=v.validate}if(S!=s)return f&&(r+=" if (true) { "),r;if(P){if(!e.async)throw new Error("async format in sync schema");var O="formats"+e.util.getProperty(i)+".validate";r+=" if (!(await "+O+"("+p+"))) { "}else{r+=" if (! ";var O="formats"+e.util.getProperty(i);x&&(O+=".validate"),typeof v=="function"?r+=" "+O+"("+p+") ":r+=" "+O+".test("+p+") ",r+=") { "}}var A=A||[];A.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'format' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { format: ",g?r+=""+d:r+=""+e.util.toQuotedString(i),r+=" } ",e.opts.messages!==!1&&(r+=` , message: 'should match format "`,g?r+="' + "+d+" + '":r+=""+e.util.escapeQuotes(i),r+=`"' `),e.opts.verbose&&(r+=" , schema: ",g?r+="validate.schema"+u:r+=""+e.util.toQuotedString(i),r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),r+=" } "):r+=" {} ";var I=r;return r=A.pop(),!e.compositeRule&&f?e.async?r+=" throw new ValidationError(["+I+"]); ":r+=" validate.errors = ["+I+"]; return false; ":r+=" var err = "+I+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } ",f&&(r+=" else { "),r}});var xi=z((Gv,bi)=>{"use strict";bi.exports=function(e,t,s){var r=" ",n=e.level,o=e.dataLevel,i=e.schema[t],u=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,f=!e.opts.allErrors,p="data"+(o||""),g="valid"+n,d="errs__"+n,y=e.util.copy(e);y.level++;var m="valid"+y.level,v=e.schema.then,x=e.schema.else,S=v!==void 0&&(e.opts.strictKeywords?typeof v=="object"&&Object.keys(v).length>0||v===!1:e.util.schemaHasRules(v,e.RULES.all)),P=x!==void 0&&(e.opts.strictKeywords?typeof x=="object"&&Object.keys(x).length>0||x===!1:e.util.schemaHasRules(x,e.RULES.all)),O=y.baseId;if(S||P){var A;y.createErrors=!1,y.schema=i,y.schemaPath=u,y.errSchemaPath=c,r+=" var "+d+" = errors; var "+g+" = true; ";var I=e.compositeRule;e.compositeRule=y.compositeRule=!0,r+=" "+e.validate(y)+" ",y.baseId=O,y.createErrors=!0,r+=" errors = "+d+"; if (vErrors !== null) { if ("+d+") vErrors.length = "+d+"; else vErrors = null; } ",e.compositeRule=y.compositeRule=I,S?(r+=" if ("+m+") { ",y.schema=e.schema.then,y.schemaPath=e.schemaPath+".then",y.errSchemaPath=e.errSchemaPath+"/then",r+=" "+e.validate(y)+" ",y.baseId=O,r+=" "+g+" = "+m+"; ",S&&P?(A="ifClause"+n,r+=" var "+A+" = 'then'; "):A="'then'",r+=" } ",P&&(r+=" else { ")):r+=" if (!"+m+") { ",P&&(y.schema=e.schema.else,y.schemaPath=e.schemaPath+".else",y.errSchemaPath=e.errSchemaPath+"/else",r+=" "+e.validate(y)+" ",y.baseId=O,r+=" "+g+" = "+m+"; ",S&&P?(A="ifClause"+n,r+=" var "+A+" = 'else'; "):A="'else'",r+=" } "),r+=" if (!"+g+") { var err = ",e.createErrors!==!1?(r+=" { keyword: 'if' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { failingKeyword: "+A+" } ",e.opts.messages!==!1&&(r+=` , message: 'should match "' + `+A+` + '" schema' `),e.opts.verbose&&(r+=" , schema: validate.schema"+u+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&f&&(e.async?r+=" throw new ValidationError(vErrors); ":r+=" validate.errors = vErrors; return false; "),r+=" } ",f&&(r+=" else { ")}else f&&(r+=" if (true) { ");return r}});var Ei=z((Wv,wi)=>{"use strict";wi.exports=function(e,t,s){var r=" ",n=e.level,o=e.dataLevel,i=e.schema[t],u=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,f=!e.opts.allErrors,p="data"+(o||""),g="valid"+n,d="errs__"+n,y=e.util.copy(e),m="";y.level++;var v="valid"+y.level,x="i"+n,S=y.dataLevel=e.dataLevel+1,P="data"+S,O=e.baseId;if(r+="var "+d+" = errors;var "+g+";",Array.isArray(i)){var A=e.schema.additionalItems;if(A===!1){r+=" "+g+" = "+p+".length <= "+i.length+"; ";var I=c;c=e.errSchemaPath+"/additionalItems",r+=" if (!"+g+") { ";var H=H||[];H.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'additionalItems' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { limit: "+i.length+" } ",e.opts.messages!==!1&&(r+=" , message: 'should NOT have more than "+i.length+" items' "),e.opts.verbose&&(r+=" , schema: false , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),r+=" } "):r+=" {} ";var q=r;r=H.pop(),!e.compositeRule&&f?e.async?r+=" throw new ValidationError(["+q+"]); ":r+=" validate.errors = ["+q+"]; return false; ":r+=" var err = "+q+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } ",c=I,f&&(m+="}",r+=" else { ")}var C=i;if(C){for(var U,M=-1,L=C.length-1;M<L;)if(U=C[M+=1],e.opts.strictKeywords?typeof U=="object"&&Object.keys(U).length>0||U===!1:e.util.schemaHasRules(U,e.RULES.all)){r+=" "+v+" = true; if ("+p+".length > "+M+") { ";var $=p+"["+M+"]";y.schema=U,y.schemaPath=u+"["+M+"]",y.errSchemaPath=c+"/"+M,y.errorPath=e.util.getPathExpr(e.errorPath,M,e.opts.jsonPointers,!0),y.dataPathArr[S]=M;var k=e.validate(y);y.baseId=O,e.util.varOccurences(k,P)<2?r+=" "+e.util.varReplace(k,P,$)+" ":r+=" var "+P+" = "+$+"; "+k+" ",r+=" } ",f&&(r+=" if ("+v+") { ",m+="}")}}if(typeof A=="object"&&(e.opts.strictKeywords?typeof A=="object"&&Object.keys(A).length>0||A===!1:e.util.schemaHasRules(A,e.RULES.all))){y.schema=A,y.schemaPath=e.schemaPath+".additionalItems",y.errSchemaPath=e.errSchemaPath+"/additionalItems",r+=" "+v+" = true; if ("+p+".length > "+i.length+") { for (var "+x+" = "+i.length+"; "+x+" < "+p+".length; "+x+"++) { ",y.errorPath=e.util.getPathExpr(e.errorPath,x,e.opts.jsonPointers,!0);var $=p+"["+x+"]";y.dataPathArr[S]=x;var k=e.validate(y);y.baseId=O,e.util.varOccurences(k,P)<2?r+=" "+e.util.varReplace(k,P,$)+" ":r+=" var "+P+" = "+$+"; "+k+" ",f&&(r+=" if (!"+v+") break; "),r+=" } } ",f&&(r+=" if ("+v+") { ",m+="}")}}else if(e.opts.strictKeywords?typeof i=="object"&&Object.keys(i).length>0||i===!1:e.util.schemaHasRules(i,e.RULES.all)){y.schema=i,y.schemaPath=u,y.errSchemaPath=c,r+=" for (var "+x+" = 0; "+x+" < "+p+".length; "+x+"++) { ",y.errorPath=e.util.getPathExpr(e.errorPath,x,e.opts.jsonPointers,!0);var $=p+"["+x+"]";y.dataPathArr[S]=x;var k=e.validate(y);y.baseId=O,e.util.varOccurences(k,P)<2?r+=" "+e.util.varReplace(k,P,$)+" ":r+=" var "+P+" = "+$+"; "+k+" ",f&&(r+=" if (!"+v+") break; "),r+=" }"}return f&&(r+=" "+m+" if ("+d+" == errors) {"),r}});var Ks=z((Yv,Pi)=>{"use strict";Pi.exports=function(e,t,s){var r=" ",n=e.level,o=e.dataLevel,i=e.schema[t],u=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,f=!e.opts.allErrors,O,p="data"+(o||""),g=e.opts.$data&&i&&i.$data,d;g?(r+=" var schema"+n+" = "+e.util.getData(i.$data,o,e.dataPathArr)+"; ",d="schema"+n):d=i;var y=t=="maximum",m=y?"exclusiveMaximum":"exclusiveMinimum",v=e.schema[m],x=e.opts.$data&&v&&v.$data,S=y?"<":">",P=y?">":"<",O=void 0;if(!(g||typeof i=="number"||i===void 0))throw new Error(t+" must be number");if(!(x||v===void 0||typeof v=="number"||typeof v=="boolean"))throw new Error(m+" must be number or boolean");if(x){var A=e.util.getData(v.$data,o,e.dataPathArr),I="exclusive"+n,H="exclType"+n,q="exclIsNumber"+n,C="op"+n,U="' + "+C+" + '";r+=" var schemaExcl"+n+" = "+A+"; ",A="schemaExcl"+n,r+=" var "+I+"; var "+H+" = typeof "+A+"; if ("+H+" != 'boolean' && "+H+" != 'undefined' && "+H+" != 'number') { ";var O=m,M=M||[];M.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(O||"_exclusiveLimit")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: {} ",e.opts.messages!==!1&&(r+=" , message: '"+m+" should be boolean' "),e.opts.verbose&&(r+=" , schema: validate.schema"+u+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),r+=" } "):r+=" {} ";var L=r;r=M.pop(),!e.compositeRule&&f?e.async?r+=" throw new ValidationError(["+L+"]); ":r+=" validate.errors = ["+L+"]; return false; ":r+=" var err = "+L+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } else if ( ",g&&(r+=" ("+d+" !== undefined && typeof "+d+" != 'number') || "),r+=" "+H+" == 'number' ? ( ("+I+" = "+d+" === undefined || "+A+" "+S+"= "+d+") ? "+p+" "+P+"= "+A+" : "+p+" "+P+" "+d+" ) : ( ("+I+" = "+A+" === true) ? "+p+" "+P+"= "+d+" : "+p+" "+P+" "+d+" ) || "+p+" !== "+p+") { var op"+n+" = "+I+" ? '"+S+"' : '"+S+"='; ",i===void 0&&(O=m,c=e.errSchemaPath+"/"+m,d=A,g=x)}else{var q=typeof v=="number",U=S;if(q&&g){var C="'"+U+"'";r+=" if ( ",g&&(r+=" ("+d+" !== undefined && typeof "+d+" != 'number') || "),r+=" ( "+d+" === undefined || "+v+" "+S+"= "+d+" ? "+p+" "+P+"= "+v+" : "+p+" "+P+" "+d+" ) || "+p+" !== "+p+") { "}else{q&&i===void 0?(I=!0,O=m,c=e.errSchemaPath+"/"+m,d=v,P+="="):(q&&(d=Math[y?"min":"max"](v,i)),v===(q?d:!0)?(I=!0,O=m,c=e.errSchemaPath+"/"+m,P+="="):(I=!1,U+="="));var C="'"+U+"'";r+=" if ( ",g&&(r+=" ("+d+" !== undefined && typeof "+d+" != 'number') || "),r+=" "+p+" "+P+" "+d+" || "+p+" !== "+p+") { "}}O=O||t;var M=M||[];M.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(O||"_limit")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { comparison: "+C+", limit: "+d+", exclusive: "+I+" } ",e.opts.messages!==!1&&(r+=" , message: 'should be "+U+" ",g?r+="' + "+d:r+=""+d+"'"),e.opts.verbose&&(r+=" , schema: ",g?r+="validate.schema"+u:r+=""+i,r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),r+=" } "):r+=" {} ";var L=r;return r=M.pop(),!e.compositeRule&&f?e.async?r+=" throw new ValidationError(["+L+"]); ":r+=" validate.errors = ["+L+"]; return false; ":r+=" var err = "+L+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } ",f&&(r+=" else { "),r}});var Gs=z((Xv,Si)=>{"use strict";Si.exports=function(e,t,s){var r=" ",n=e.level,o=e.dataLevel,i=e.schema[t],u=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,f=!e.opts.allErrors,m,p="data"+(o||""),g=e.opts.$data&&i&&i.$data,d;if(g?(r+=" var schema"+n+" = "+e.util.getData(i.$data,o,e.dataPathArr)+"; ",d="schema"+n):d=i,!(g||typeof i=="number"))throw new Error(t+" must be number");var y=t=="maxItems"?">":"<";r+="if ( ",g&&(r+=" ("+d+" !== undefined && typeof "+d+" != 'number') || "),r+=" "+p+".length "+y+" "+d+") { ";var m=t,v=v||[];v.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(m||"_limitItems")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { limit: "+d+" } ",e.opts.messages!==!1&&(r+=" , message: 'should NOT have ",t=="maxItems"?r+="more":r+="fewer",r+=" than ",g?r+="' + "+d+" + '":r+=""+i,r+=" items' "),e.opts.verbose&&(r+=" , schema: ",g?r+="validate.schema"+u:r+=""+i,r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),r+=" } "):r+=" {} ";var x=r;return r=v.pop(),!e.compositeRule&&f?e.async?r+=" throw new ValidationError(["+x+"]); ":r+=" validate.errors = ["+x+"]; return false; ":r+=" var err = "+x+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+="} ",f&&(r+=" else { "),r}});var Ws=z((eg,Ri)=>{"use strict";Ri.exports=function(e,t,s){var r=" ",n=e.level,o=e.dataLevel,i=e.schema[t],u=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,f=!e.opts.allErrors,m,p="data"+(o||""),g=e.opts.$data&&i&&i.$data,d;if(g?(r+=" var schema"+n+" = "+e.util.getData(i.$data,o,e.dataPathArr)+"; ",d="schema"+n):d=i,!(g||typeof i=="number"))throw new Error(t+" must be number");var y=t=="maxLength"?">":"<";r+="if ( ",g&&(r+=" ("+d+" !== undefined && typeof "+d+" != 'number') || "),e.opts.unicode===!1?r+=" "+p+".length ":r+=" ucs2length("+p+") ",r+=" "+y+" "+d+") { ";var m=t,v=v||[];v.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(m||"_limitLength")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { limit: "+d+" } ",e.opts.messages!==!1&&(r+=" , message: 'should NOT be ",t=="maxLength"?r+="longer":r+="shorter",r+=" than ",g?r+="' + "+d+" + '":r+=""+i,r+=" characters' "),e.opts.verbose&&(r+=" , schema: ",g?r+="validate.schema"+u:r+=""+i,r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),r+=" } "):r+=" {} ";var x=r;return r=v.pop(),!e.compositeRule&&f?e.async?r+=" throw new ValidationError(["+x+"]); ":r+=" validate.errors = ["+x+"]; return false; ":r+=" var err = "+x+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+="} ",f&&(r+=" else { "),r}});var Ys=z((rg,Oi)=>{"use strict";Oi.exports=function(e,t,s){var r=" ",n=e.level,o=e.dataLevel,i=e.schema[t],u=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,f=!e.opts.allErrors,m,p="data"+(o||""),g=e.opts.$data&&i&&i.$data,d;if(g?(r+=" var schema"+n+" = "+e.util.getData(i.$data,o,e.dataPathArr)+"; ",d="schema"+n):d=i,!(g||typeof i=="number"))throw new Error(t+" must be number");var y=t=="maxProperties"?">":"<";r+="if ( ",g&&(r+=" ("+d+" !== undefined && typeof "+d+" != 'number') || "),r+=" Object.keys("+p+").length "+y+" "+d+") { ";var m=t,v=v||[];v.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(m||"_limitProperties")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { limit: "+d+" } ",e.opts.messages!==!1&&(r+=" , message: 'should NOT have ",t=="maxProperties"?r+="more":r+="fewer",r+=" than ",g?r+="' + "+d+" + '":r+=""+i,r+=" properties' "),e.opts.verbose&&(r+=" , schema: ",g?r+="validate.schema"+u:r+=""+i,r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),r+=" } "):r+=" {} ";var x=r;return r=v.pop(),!e.compositeRule&&f?e.async?r+=" throw new ValidationError(["+x+"]); ":r+=" validate.errors = ["+x+"]; return false; ":r+=" var err = "+x+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+="} ",f&&(r+=" else { "),r}});var $i=z((tg,Ti)=>{"use strict";Ti.exports=function(e,t,s){var r=" ",n=e.level,o=e.dataLevel,i=e.schema[t],u=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,f=!e.opts.allErrors,p="data"+(o||""),g=e.opts.$data&&i&&i.$data,d;if(g?(r+=" var schema"+n+" = "+e.util.getData(i.$data,o,e.dataPathArr)+"; ",d="schema"+n):d=i,!(g||typeof i=="number"))throw new Error(t+" must be number");r+="var division"+n+";if (",g&&(r+=" "+d+" !== undefined && ( typeof "+d+" != 'number' || "),r+=" (division"+n+" = "+p+" / "+d+", ",e.opts.multipleOfPrecision?r+=" Math.abs(Math.round(division"+n+") - division"+n+") > 1e-"+e.opts.multipleOfPrecision+" ":r+=" division"+n+" !== parseInt(division"+n+") ",r+=" ) ",g&&(r+=" ) "),r+=" ) { ";var y=y||[];y.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'multipleOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { multipleOf: "+d+" } ",e.opts.messages!==!1&&(r+=" , message: 'should be multiple of ",g?r+="' + "+d:r+=""+d+"'"),e.opts.verbose&&(r+=" , schema: ",g?r+="validate.schema"+u:r+=""+i,r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),r+=" } "):r+=" {} ";var m=r;return r=y.pop(),!e.compositeRule&&f?e.async?r+=" throw new ValidationError(["+m+"]); ":r+=" validate.errors = ["+m+"]; return false; ":r+=" var err = "+m+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+="} ",f&&(r+=" else { "),r}});var Ii=z((ag,Ai)=>{"use strict";Ai.exports=function(e,t,s){var r=" ",n=e.level,o=e.dataLevel,i=e.schema[t],u=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,f=!e.opts.allErrors,p="data"+(o||""),g="errs__"+n,d=e.util.copy(e);d.level++;var y="valid"+d.level;if(e.opts.strictKeywords?typeof i=="object"&&Object.keys(i).length>0||i===!1:e.util.schemaHasRules(i,e.RULES.all)){d.schema=i,d.schemaPath=u,d.errSchemaPath=c,r+=" var "+g+" = errors; ";var m=e.compositeRule;e.compositeRule=d.compositeRule=!0,d.createErrors=!1;var v;d.opts.allErrors&&(v=d.opts.allErrors,d.opts.allErrors=!1),r+=" "+e.validate(d)+" ",d.createErrors=!0,v&&(d.opts.allErrors=v),e.compositeRule=d.compositeRule=m,r+=" if ("+y+") { ";var x=x||[];x.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'not' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: {} ",e.opts.messages!==!1&&(r+=" , message: 'should NOT be valid' "),e.opts.verbose&&(r+=" , schema: validate.schema"+u+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),r+=" } "):r+=" {} ";var S=r;r=x.pop(),!e.compositeRule&&f?e.async?r+=" throw new ValidationError(["+S+"]); ":r+=" validate.errors = ["+S+"]; return false; ":r+=" var err = "+S+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } else { errors = "+g+"; if (vErrors !== null) { if ("+g+") vErrors.length = "+g+"; else vErrors = null; } ",e.opts.allErrors&&(r+=" } ")}else r+=" var err = ",e.createErrors!==!1?(r+=" { keyword: 'not' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: {} ",e.opts.messages!==!1&&(r+=" , message: 'should NOT be valid' "),e.opts.verbose&&(r+=" , schema: validate.schema"+u+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",f&&(r+=" if (false) { ");return r}});var ki=z((sg,Ci)=>{"use strict";Ci.exports=function(e,t,s){var r=" ",n=e.level,o=e.dataLevel,i=e.schema[t],u=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,f=!e.opts.allErrors,p="data"+(o||""),g="valid"+n,d="errs__"+n,y=e.util.copy(e),m="";y.level++;var v="valid"+y.level,x=y.baseId,S="prevValid"+n,P="passingSchemas"+n;r+="var "+d+" = errors , "+S+" = false , "+g+" = false , "+P+" = null; ";var O=e.compositeRule;e.compositeRule=y.compositeRule=!0;var A=i;if(A)for(var I,H=-1,q=A.length-1;H<q;)I=A[H+=1],(e.opts.strictKeywords?typeof I=="object"&&Object.keys(I).length>0||I===!1:e.util.schemaHasRules(I,e.RULES.all))?(y.schema=I,y.schemaPath=u+"["+H+"]",y.errSchemaPath=c+"/"+H,r+=" "+e.validate(y)+" ",y.baseId=x):r+=" var "+v+" = true; ",H&&(r+=" if ("+v+" && "+S+") { "+g+" = false; "+P+" = ["+P+", "+H+"]; } else { ",m+="}"),r+=" if ("+v+") { "+g+" = "+S+" = true; "+P+" = "+H+"; }";return e.compositeRule=y.compositeRule=O,r+=""+m+"if (!"+g+") { var err = ",e.createErrors!==!1?(r+=" { keyword: 'oneOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { passingSchemas: "+P+" } ",e.opts.messages!==!1&&(r+=" , message: 'should match exactly one schema in oneOf' "),e.opts.verbose&&(r+=" , schema: validate.schema"+u+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&f&&(e.async?r+=" throw new ValidationError(vErrors); ":r+=" validate.errors = vErrors; return false; "),r+="} else { errors = "+d+"; if (vErrors !== null) { if ("+d+") vErrors.length = "+d+"; else vErrors = null; }",e.opts.allErrors&&(r+=" } "),r}});var ji=z((ng,Di)=>{"use strict";Di.exports=function(e,t,s){var r=" ",n=e.level,o=e.dataLevel,i=e.schema[t],u=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,f=!e.opts.allErrors,p="data"+(o||""),g=e.opts.$data&&i&&i.$data,d;g?(r+=" var schema"+n+" = "+e.util.getData(i.$data,o,e.dataPathArr)+"; ",d="schema"+n):d=i;var y=g?"(new RegExp("+d+"))":e.usePattern(i);r+="if ( ",g&&(r+=" ("+d+" !== undefined && typeof "+d+" != 'string') || "),r+=" !"+y+".test("+p+") ) { ";var m=m||[];m.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'pattern' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { pattern: ",g?r+=""+d:r+=""+e.util.toQuotedString(i),r+=" } ",e.opts.messages!==!1&&(r+=` , message: 'should match pattern "`,g?r+="' + "+d+" + '":r+=""+e.util.escapeQuotes(i),r+=`"' `),e.opts.verbose&&(r+=" , schema: ",g?r+="validate.schema"+u:r+=""+e.util.toQuotedString(i),r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),r+=" } "):r+=" {} ";var v=r;return r=m.pop(),!e.compositeRule&&f?e.async?r+=" throw new ValidationError(["+v+"]); ":r+=" validate.errors = ["+v+"]; return false; ":r+=" var err = "+v+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+="} ",f&&(r+=" else { "),r}});var Li=z((og,Ni)=>{"use strict";Ni.exports=function(e,t,s){var r=" ",n=e.level,o=e.dataLevel,i=e.schema[t],u=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,f=!e.opts.allErrors,p="data"+(o||""),g="errs__"+n,d=e.util.copy(e),y="";d.level++;var m="valid"+d.level,v="key"+n,x="idx"+n,S=d.dataLevel=e.dataLevel+1,P="data"+S,O="dataProperties"+n,A=Object.keys(i||{}).filter(re),I=e.schema.patternProperties||{},H=Object.keys(I).filter(re),q=e.schema.additionalProperties,C=A.length||H.length,U=q===!1,M=typeof q=="object"&&Object.keys(q).length,L=e.opts.removeAdditional,$=U||M||L,k=e.opts.ownProperties,F=e.baseId,le=e.schema.required;if(le&&!(e.opts.$data&&le.$data)&&le.length<e.opts.loopRequired)var Y=e.util.toHash(le);function re(We){return We!=="__proto__"}if(r+="var "+g+" = errors;var "+m+" = true;",k&&(r+=" var "+O+" = undefined;"),$){if(k?r+=" "+O+" = "+O+" || Object.keys("+p+"); for (var "+x+"=0; "+x+"<"+O+".length; "+x+"++) { var "+v+" = "+O+"["+x+"]; ":r+=" for (var "+v+" in "+p+") { ",C){if(r+=" var isAdditional"+n+" = !(false ",A.length)if(A.length>8)r+=" || validate.schema"+u+".hasOwnProperty("+v+") ";else{var W=A;if(W)for(var Z,me=-1,Oe=W.length-1;me<Oe;)Z=W[me+=1],r+=" || "+v+" == "+e.util.toQuotedString(Z)+" "}if(H.length){var Ie=H;if(Ie)for(var se,ye=-1,Ee=Ie.length-1;ye<Ee;)se=Ie[ye+=1],r+=" || "+e.usePattern(se)+".test("+v+") "}r+=" ); if (isAdditional"+n+") { "}if(L=="all")r+=" delete "+p+"["+v+"]; ";else{var Ce=e.errorPath,wr="' + "+v+" + '";if(e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(e.errorPath,v,e.opts.jsonPointers)),U)if(L)r+=" delete "+p+"["+v+"]; ";else{r+=" "+m+" = false; ";var cr=c;c=e.errSchemaPath+"/additionalProperties";var _e=_e||[];_e.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'additionalProperties' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { additionalProperty: '"+wr+"' } ",e.opts.messages!==!1&&(r+=" , message: '",e.opts._errorDataPathProperty?r+="is an invalid additional property":r+="should NOT have additional properties",r+="' "),e.opts.verbose&&(r+=" , schema: false , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),r+=" } "):r+=" {} ";var ve=r;r=_e.pop(),!e.compositeRule&&f?e.async?r+=" throw new ValidationError(["+ve+"]); ":r+=" validate.errors = ["+ve+"]; return false; ":r+=" var err = "+ve+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",c=cr,f&&(r+=" break; ")}else if(M)if(L=="failing"){r+=" var "+g+" = errors; ";var Dr=e.compositeRule;e.compositeRule=d.compositeRule=!0,d.schema=q,d.schemaPath=e.schemaPath+".additionalProperties",d.errSchemaPath=e.errSchemaPath+"/additionalProperties",d.errorPath=e.opts._errorDataPathProperty?e.errorPath:e.util.getPathExpr(e.errorPath,v,e.opts.jsonPointers);var Te=p+"["+v+"]";d.dataPathArr[S]=v;var oe=e.validate(d);d.baseId=F,e.util.varOccurences(oe,P)<2?r+=" "+e.util.varReplace(oe,P,Te)+" ":r+=" var "+P+" = "+Te+"; "+oe+" ",r+=" if (!"+m+") { errors = "+g+"; if (validate.errors !== null) { if (errors) validate.errors.length = errors; else validate.errors = null; } delete "+p+"["+v+"]; } ",e.compositeRule=d.compositeRule=Dr}else{d.schema=q,d.schemaPath=e.schemaPath+".additionalProperties",d.errSchemaPath=e.errSchemaPath+"/additionalProperties",d.errorPath=e.opts._errorDataPathProperty?e.errorPath:e.util.getPathExpr(e.errorPath,v,e.opts.jsonPointers);var Te=p+"["+v+"]";d.dataPathArr[S]=v;var oe=e.validate(d);d.baseId=F,e.util.varOccurences(oe,P)<2?r+=" "+e.util.varReplace(oe,P,Te)+" ":r+=" var "+P+" = "+Te+"; "+oe+" ",f&&(r+=" if (!"+m+") break; ")}e.errorPath=Ce}C&&(r+=" } "),r+=" } ",f&&(r+=" if ("+m+") { ",y+="}")}var Er=e.opts.useDefaults&&!e.compositeRule;if(A.length){var ur=A;if(ur)for(var Z,jr=-1,Nr=ur.length-1;jr<Nr;){Z=ur[jr+=1];var Se=i[Z];if(e.opts.strictKeywords?typeof Se=="object"&&Object.keys(Se).length>0||Se===!1:e.util.schemaHasRules(Se,e.RULES.all)){var Ve=e.util.getProperty(Z),Te=p+Ve,Ne=Er&&Se.default!==void 0;d.schema=Se,d.schemaPath=u+Ve,d.errSchemaPath=c+"/"+e.util.escapeFragment(Z),d.errorPath=e.util.getPath(e.errorPath,Z,e.opts.jsonPointers),d.dataPathArr[S]=e.util.toQuotedString(Z);var oe=e.validate(d);if(d.baseId=F,e.util.varOccurences(oe,P)<2){oe=e.util.varReplace(oe,P,Te);var ke=Te}else{var ke=P;r+=" var "+P+" = "+Te+"; "}if(Ne)r+=" "+oe+" ";else{if(Y&&Y[Z]){r+=" if ( "+ke+" === undefined ",k&&(r+=" || ! Object.prototype.hasOwnProperty.call("+p+", '"+e.util.escapeQuotes(Z)+"') "),r+=") { "+m+" = false; ";var Ce=e.errorPath,cr=c,tr=e.util.escapeQuotes(Z);e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPath(Ce,Z,e.opts.jsonPointers)),c=e.errSchemaPath+"/required";var _e=_e||[];_e.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { missingProperty: '"+tr+"' } ",e.opts.messages!==!1&&(r+=" , message: '",e.opts._errorDataPathProperty?r+="is a required property":r+="should have required property \\'"+tr+"\\'",r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+u+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),r+=" } "):r+=" {} ";var ve=r;r=_e.pop(),!e.compositeRule&&f?e.async?r+=" throw new ValidationError(["+ve+"]); ":r+=" validate.errors = ["+ve+"]; return false; ":r+=" var err = "+ve+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",c=cr,e.errorPath=Ce,r+=" } else { "}else f?(r+=" if ( "+ke+" === undefined ",k&&(r+=" || ! Object.prototype.hasOwnProperty.call("+p+", '"+e.util.escapeQuotes(Z)+"') "),r+=") { "+m+" = true; } else { "):(r+=" if ("+ke+" !== undefined ",k&&(r+=" && Object.prototype.hasOwnProperty.call("+p+", '"+e.util.escapeQuotes(Z)+"') "),r+=" ) { ");r+=" "+oe+" } "}}f&&(r+=" if ("+m+") { ",y+="}")}}if(H.length){var qe=H;if(qe)for(var se,oa=-1,is=qe.length-1;oa<is;){se=qe[oa+=1];var Se=I[se];if(e.opts.strictKeywords?typeof Se=="object"&&Object.keys(Se).length>0||Se===!1:e.util.schemaHasRules(Se,e.RULES.all)){d.schema=Se,d.schemaPath=e.schemaPath+".patternProperties"+e.util.getProperty(se),d.errSchemaPath=e.errSchemaPath+"/patternProperties/"+e.util.escapeFragment(se),k?r+=" "+O+" = "+O+" || Object.keys("+p+"); for (var "+x+"=0; "+x+"<"+O+".length; "+x+"++) { var "+v+" = "+O+"["+x+"]; ":r+=" for (var "+v+" in "+p+") { ",r+=" if ("+e.usePattern(se)+".test("+v+")) { ",d.errorPath=e.util.getPathExpr(e.errorPath,v,e.opts.jsonPointers);var Te=p+"["+v+"]";d.dataPathArr[S]=v;var oe=e.validate(d);d.baseId=F,e.util.varOccurences(oe,P)<2?r+=" "+e.util.varReplace(oe,P,Te)+" ":r+=" var "+P+" = "+Te+"; "+oe+" ",f&&(r+=" if (!"+m+") break; "),r+=" } ",f&&(r+=" else "+m+" = true; "),r+=" } ",f&&(r+=" if ("+m+") { ",y+="}")}}}return f&&(r+=" "+y+" if ("+g+" == errors) {"),r}});var Mi=z((ig,Fi)=>{"use strict";Fi.exports=function(e,t,s){var r=" ",n=e.level,o=e.dataLevel,i=e.schema[t],u=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,f=!e.opts.allErrors,p="data"+(o||""),g="errs__"+n,d=e.util.copy(e),y="";d.level++;var m="valid"+d.level;if(r+="var "+g+" = errors;",e.opts.strictKeywords?typeof i=="object"&&Object.keys(i).length>0||i===!1:e.util.schemaHasRules(i,e.RULES.all)){d.schema=i,d.schemaPath=u,d.errSchemaPath=c;var v="key"+n,x="idx"+n,S="i"+n,P="' + "+v+" + '",O=d.dataLevel=e.dataLevel+1,A="data"+O,I="dataProperties"+n,H=e.opts.ownProperties,q=e.baseId;H&&(r+=" var "+I+" = undefined; "),H?r+=" "+I+" = "+I+" || Object.keys("+p+"); for (var "+x+"=0; "+x+"<"+I+".length; "+x+"++) { var "+v+" = "+I+"["+x+"]; ":r+=" for (var "+v+" in "+p+") { ",r+=" var startErrs"+n+" = errors; ";var C=v,U=e.compositeRule;e.compositeRule=d.compositeRule=!0;var M=e.validate(d);d.baseId=q,e.util.varOccurences(M,A)<2?r+=" "+e.util.varReplace(M,A,C)+" ":r+=" var "+A+" = "+C+"; "+M+" ",e.compositeRule=d.compositeRule=U,r+=" if (!"+m+") { for (var "+S+"=startErrs"+n+"; "+S+"<errors; "+S+"++) { vErrors["+S+"].propertyName = "+v+"; } var err = ",e.createErrors!==!1?(r+=" { keyword: 'propertyNames' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { propertyName: '"+P+"' } ",e.opts.messages!==!1&&(r+=" , message: 'property name \\'"+P+"\\' is invalid' "),e.opts.verbose&&(r+=" , schema: validate.schema"+u+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&f&&(e.async?r+=" throw new ValidationError(vErrors); ":r+=" validate.errors = vErrors; return false; "),f&&(r+=" break; "),r+=" } }"}return f&&(r+=" "+y+" if ("+g+" == errors) {"),r}});var Ui=z((lg,qi)=>{"use strict";qi.exports=function(e,t,s){var r=" ",n=e.level,o=e.dataLevel,i=e.schema[t],u=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,f=!e.opts.allErrors,p="data"+(o||""),g="valid"+n,d=e.opts.$data&&i&&i.$data,y;d?(r+=" var schema"+n+" = "+e.util.getData(i.$data,o,e.dataPathArr)+"; ",y="schema"+n):y=i;var m="schema"+n;if(!d)if(i.length<e.opts.loopRequired&&e.schema.properties&&Object.keys(e.schema.properties).length){var v=[],x=i;if(x)for(var S,P=-1,O=x.length-1;P<O;){S=x[P+=1];var A=e.schema.properties[S];A&&(e.opts.strictKeywords?typeof A=="object"&&Object.keys(A).length>0||A===!1:e.util.schemaHasRules(A,e.RULES.all))||(v[v.length]=S)}}else var v=i;if(d||v.length){var I=e.errorPath,H=d||v.length>=e.opts.loopRequired,q=e.opts.ownProperties;if(f)if(r+=" var missing"+n+"; ",H){d||(r+=" var "+m+" = validate.schema"+u+"; ");var C="i"+n,U="schema"+n+"["+C+"]",M="' + "+U+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(I,U,e.opts.jsonPointers)),r+=" var "+g+" = true; ",d&&(r+=" if (schema"+n+" === undefined) "+g+" = true; else if (!Array.isArray(schema"+n+")) "+g+" = false; else {"),r+=" for (var "+C+" = 0; "+C+" < "+m+".length; "+C+"++) { "+g+" = "+p+"["+m+"["+C+"]] !== undefined ",q&&(r+=" && Object.prototype.hasOwnProperty.call("+p+", "+m+"["+C+"]) "),r+="; if (!"+g+") break; } ",d&&(r+=" } "),r+=" if (!"+g+") { ";var L=L||[];L.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { missingProperty: '"+M+"' } ",e.opts.messages!==!1&&(r+=" , message: '",e.opts._errorDataPathProperty?r+="is a required property":r+="should have required property \\'"+M+"\\'",r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+u+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),r+=" } "):r+=" {} ";var $=r;r=L.pop(),!e.compositeRule&&f?e.async?r+=" throw new ValidationError(["+$+"]); ":r+=" validate.errors = ["+$+"]; return false; ":r+=" var err = "+$+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } else { "}else{r+=" if ( ";var k=v;if(k)for(var F,C=-1,le=k.length-1;C<le;){F=k[C+=1],C&&(r+=" || ");var Y=e.util.getProperty(F),re=p+Y;r+=" ( ( "+re+" === undefined ",q&&(r+=" || ! Object.prototype.hasOwnProperty.call("+p+", '"+e.util.escapeQuotes(F)+"') "),r+=") && (missing"+n+" = "+e.util.toQuotedString(e.opts.jsonPointers?F:Y)+") ) "}r+=") { ";var U="missing"+n,M="' + "+U+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.opts.jsonPointers?e.util.getPathExpr(I,U,!0):I+" + "+U);var L=L||[];L.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { missingProperty: '"+M+"' } ",e.opts.messages!==!1&&(r+=" , message: '",e.opts._errorDataPathProperty?r+="is a required property":r+="should have required property \\'"+M+"\\'",r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+u+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),r+=" } "):r+=" {} ";var $=r;r=L.pop(),!e.compositeRule&&f?e.async?r+=" throw new ValidationError(["+$+"]); ":r+=" validate.errors = ["+$+"]; return false; ":r+=" var err = "+$+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } else { "}else if(H){d||(r+=" var "+m+" = validate.schema"+u+"; ");var C="i"+n,U="schema"+n+"["+C+"]",M="' + "+U+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(I,U,e.opts.jsonPointers)),d&&(r+=" if ("+m+" && !Array.isArray("+m+")) { var err = ",e.createErrors!==!1?(r+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { missingProperty: '"+M+"' } ",e.opts.messages!==!1&&(r+=" , message: '",e.opts._errorDataPathProperty?r+="is a required property":r+="should have required property \\'"+M+"\\'",r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+u+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } else if ("+m+" !== undefined) { "),r+=" for (var "+C+" = 0; "+C+" < "+m+".length; "+C+"++) { if ("+p+"["+m+"["+C+"]] === undefined ",q&&(r+=" || ! Object.prototype.hasOwnProperty.call("+p+", "+m+"["+C+"]) "),r+=") { var err = ",e.createErrors!==!1?(r+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { missingProperty: '"+M+"' } ",e.opts.messages!==!1&&(r+=" , message: '",e.opts._errorDataPathProperty?r+="is a required property":r+="should have required property \\'"+M+"\\'",r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+u+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } } ",d&&(r+=" } ")}else{var W=v;if(W)for(var F,Z=-1,me=W.length-1;Z<me;){F=W[Z+=1];var Y=e.util.getProperty(F),M=e.util.escapeQuotes(F),re=p+Y;e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPath(I,F,e.opts.jsonPointers)),r+=" if ( "+re+" === undefined ",q&&(r+=" || ! Object.prototype.hasOwnProperty.call("+p+", '"+e.util.escapeQuotes(F)+"') "),r+=") { var err = ",e.createErrors!==!1?(r+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { missingProperty: '"+M+"' } ",e.opts.messages!==!1&&(r+=" , message: '",e.opts._errorDataPathProperty?r+="is a required property":r+="should have required property \\'"+M+"\\'",r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+u+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } "}}e.errorPath=I}else f&&(r+=" if (true) {");return r}});var Vi=z((cg,zi)=>{"use strict";zi.exports=function(e,t,s){var r=" ",n=e.level,o=e.dataLevel,i=e.schema[t],u=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,f=!e.opts.allErrors,p="data"+(o||""),g="valid"+n,d=e.opts.$data&&i&&i.$data,y;if(d?(r+=" var schema"+n+" = "+e.util.getData(i.$data,o,e.dataPathArr)+"; ",y="schema"+n):y=i,(i||d)&&e.opts.uniqueItems!==!1){d&&(r+=" var "+g+"; if ("+y+" === false || "+y+" === undefined) "+g+" = true; else if (typeof "+y+" != 'boolean') "+g+" = false; else { "),r+=" var i = "+p+".length , "+g+" = true , j; if (i > 1) { ";var m=e.schema.items&&e.schema.items.type,v=Array.isArray(m);if(!m||m=="object"||m=="array"||v&&(m.indexOf("object")>=0||m.indexOf("array")>=0))r+=" outer: for (;i--;) { for (j = i; j--;) { if (equal("+p+"[i], "+p+"[j])) { "+g+" = false; break outer; } } } ";else{r+=" var itemIndices = {}, item; for (;i--;) { var item = "+p+"[i]; ";var x="checkDataType"+(v?"s":"");r+=" if ("+e.util[x](m,"item",e.opts.strictNumbers,!0)+") continue; ",v&&(r+=` if (typeof item == 'string') item = '"' + item; `),r+=" if (typeof itemIndices[item] == 'number') { "+g+" = false; j = itemIndices[item]; break; } itemIndices[item] = i; } "}r+=" } ",d&&(r+=" } "),r+=" if (!"+g+") { ";var S=S||[];S.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'uniqueItems' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { i: i, j: j } ",e.opts.messages!==!1&&(r+=" , message: 'should NOT have duplicate items (items ## ' + j + ' and ' + i + ' are identical)' "),e.opts.verbose&&(r+=" , schema: ",d?r+="validate.schema"+u:r+=""+i,r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+p+" "),r+=" } "):r+=" {} ";var P=r;r=S.pop(),!e.compositeRule&&f?e.async?r+=" throw new ValidationError(["+P+"]); ":r+=" validate.errors = ["+P+"]; return false; ":r+=" var err = "+P+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } ",f&&(r+=" else { ")}else f&&(r+=" if (true) { ");return r}});var Zi=z((ug,Hi)=>{"use strict";Hi.exports={$ref:ai(),allOf:ni(),anyOf:ii(),$comment:ci(),const:di(),contains:hi(),dependencies:mi(),enum:gi(),format:_i(),if:xi(),items:Ei(),maximum:Ks(),minimum:Ks(),maxItems:Gs(),minItems:Gs(),maxLength:Ws(),minLength:Ws(),maxProperties:Ys(),minProperties:Ys(),multipleOf:$i(),not:Ii(),oneOf:ki(),pattern:ji(),properties:Li(),propertyNames:Mi(),required:Ui(),uniqueItems:Vi(),validate:Js()}});var Qi=z((dg,Ji)=>{"use strict";var Bi=Zi(),Xs=st().toHash;Ji.exports=function(){var e=[{type:"number",rules:[{maximum:["exclusiveMaximum"]},{minimum:["exclusiveMinimum"]},"multipleOf","format"]},{type:"string",rules:["maxLength","minLength","pattern","format"]},{type:"array",rules:["maxItems","minItems","items","contains","uniqueItems"]},{type:"object",rules:["maxProperties","minProperties","required","dependencies","propertyNames",{properties:["additionalProperties","patternProperties"]}]},{rules:["$ref","const","enum","not","anyOf","oneOf","allOf","if"]}],t=["type","$comment"],s=["$schema","$id","id","$data","$async","title","description","default","definitions","examples","readOnly","writeOnly","contentMediaType","contentEncoding","additionalItems","then","else"],r=["number","integer","string","array","object","boolean","null"];return e.all=Xs(t),e.types=Xs(r),e.forEach(function(n){n.rules=n.rules.map(function(o){var i;if(typeof o=="object"){var u=Object.keys(o)[0];i=o[u],o=u,i.forEach(function(f){t.push(f),e.all[f]=!0})}t.push(o);var c=e.all[o]={keyword:o,code:Bi[o],implements:i};return c}),e.all.$comment={keyword:"$comment",code:Bi.$comment},n.type&&(e.types[n.type]=n)}),e.keywords=Xs(t.concat(s)),e.custom={},e}});var Wi=z((fg,Gi)=>{"use strict";var Ki=["multipleOf","maximum","exclusiveMaximum","minimum","exclusiveMinimum","maxLength","minLength","pattern","additionalItems","maxItems","minItems","uniqueItems","maxProperties","minProperties","required","additionalProperties","enum","format","const"];Gi.exports=function(a,e){for(var t=0;t<e.length;t++){a=JSON.parse(JSON.stringify(a));var s=e[t].split("/"),r=a,n;for(n=1;n<s.length;n++)r=r[s[n]];for(n=0;n<Ki.length;n++){var o=Ki[n],i=r[o];i&&(r[o]={anyOf:[i,{$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"}]})}}return a}});var el=z((hg,Xi)=>{"use strict";var Ch=ja().MissingRef;Xi.exports=Yi;function Yi(a,e,t){var s=this;if(typeof this._opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");typeof e=="function"&&(t=e,e=void 0);var r=n(a).then(function(){var i=s._addSchema(a,void 0,e);return i.validate||o(i)});return t&&r.then(function(i){t(null,i)},t),r;function n(i){var u=i.$schema;return u&&!s.getSchema(u)?Yi.call(s,{$ref:u},!0):Promise.resolve()}function o(i){try{return s._compile(i)}catch(c){if(c instanceof Ch)return u(c);throw c}function u(c){var f=c.missingSchema;if(d(f))throw new Error("Schema "+f+" is loaded but "+c.missingRef+" cannot be resolved");var p=s._loadingSchemas[f];return p||(p=s._loadingSchemas[f]=s._opts.loadSchema(f),p.then(g,g)),p.then(function(y){if(!d(f))return n(y).then(function(){d(f)||s.addSchema(y,f,void 0,e)})}).then(function(){return o(i)});function g(){delete s._loadingSchemas[f]}function d(y){return s._refs[y]||s._schemas[y]}}}}});var tl=z((pg,rl)=>{"use strict";rl.exports=function(e,t,s){var r=" ",n=e.level,o=e.dataLevel,i=e.schema[t],u=e.schemaPath+e.util.getProperty(t),c=e.errSchemaPath+"/"+t,f=!e.opts.allErrors,p,g="data"+(o||""),d="valid"+n,y="errs__"+n,m=e.opts.$data&&i&&i.$data,v;m?(r+=" var schema"+n+" = "+e.util.getData(i.$data,o,e.dataPathArr)+"; ",v="schema"+n):v=i;var x=this,S="definition"+n,P=x.definition,O="",A,I,H,q,C;if(m&&P.$data){C="keywordValidate"+n;var U=P.validateSchema;r+=" var "+S+" = RULES.custom['"+t+"'].definition; var "+C+" = "+S+".validate;"}else{if(q=e.useCustomRule(x,i,e.schema,e),!q)return;v="validate.schema"+u,C=q.code,A=P.compile,I=P.inline,H=P.macro}var M=C+".errors",L="i"+n,$="ruleErr"+n,k=P.async;if(k&&!e.async)throw new Error("async keyword in sync schema");if(I||H||(r+=""+M+" = null;"),r+="var "+y+" = errors;var "+d+";",m&&P.$data&&(O+="}",r+=" if ("+v+" === undefined) { "+d+" = true; } else { ",U&&(O+="}",r+=" "+d+" = "+S+".validateSchema("+v+"); if ("+d+") { ")),I)P.statements?r+=" "+q.validate+" ":r+=" "+d+" = "+q.validate+"; ";else if(H){var F=e.util.copy(e),O="";F.level++;var le="valid"+F.level;F.schema=q.validate,F.schemaPath="";var Y=e.compositeRule;e.compositeRule=F.compositeRule=!0;var re=e.validate(F).replace(/validate\.schema/g,C);e.compositeRule=F.compositeRule=Y,r+=" "+re}else{var W=W||[];W.push(r),r="",r+=" "+C+".call( ",e.opts.passContext?r+="this":r+="self",A||P.schema===!1?r+=" , "+g+" ":r+=" , "+v+" , "+g+" , validate.schema"+e.schemaPath+" ",r+=" , (dataPath || '')",e.errorPath!='""'&&(r+=" + "+e.errorPath);var Z=o?"data"+(o-1||""):"parentData",me=o?e.dataPathArr[o]:"parentDataProperty";r+=" , "+Z+" , "+me+" , rootData ) ";var Oe=r;r=W.pop(),P.errors===!1?(r+=" "+d+" = ",k&&(r+="await "),r+=""+Oe+"; "):k?(M="customErrors"+n,r+=" var "+M+" = null; try { "+d+" = await "+Oe+"; } catch (e) { "+d+" = false; if (e instanceof ValidationError) "+M+" = e.errors; else throw e; } "):r+=" "+M+" = null; "+d+" = "+Oe+"; "}if(P.modifying&&(r+=" if ("+Z+") "+g+" = "+Z+"["+me+"];"),r+=""+O,P.valid)f&&(r+=" if (true) { ");else{r+=" if ( ",P.valid===void 0?(r+=" !",H?r+=""+le:r+=""+d):r+=" "+!P.valid+" ",r+=") { ",p=x.keyword;var W=W||[];W.push(r),r="";var W=W||[];W.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(p||"custom")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { keyword: '"+x.keyword+"' } ",e.opts.messages!==!1&&(r+=` , message: 'should pass "`+x.keyword+`" keyword validation' `),e.opts.verbose&&(r+=" , schema: validate.schema"+u+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+g+" "),r+=" } "):r+=" {} ";var Ie=r;r=W.pop(),!e.compositeRule&&f?e.async?r+=" throw new ValidationError(["+Ie+"]); ":r+=" validate.errors = ["+Ie+"]; return false; ":r+=" var err = "+Ie+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";var se=r;r=W.pop(),I?P.errors?P.errors!="full"&&(r+=" for (var "+L+"="+y+"; "+L+"<errors; "+L+"++) { var "+$+" = vErrors["+L+"]; if ("+$+".dataPath === undefined) "+$+".dataPath = (dataPath || '') + "+e.errorPath+"; if ("+$+".schemaPath === undefined) { "+$+'.schemaPath = "'+c+'"; } ',e.opts.verbose&&(r+=" "+$+".schema = "+v+"; "+$+".data = "+g+"; "),r+=" } "):P.errors===!1?r+=" "+se+" ":(r+=" if ("+y+" == errors) { "+se+" } else { for (var "+L+"="+y+"; "+L+"<errors; "+L+"++) { var "+$+" = vErrors["+L+"]; if ("+$+".dataPath === undefined) "+$+".dataPath = (dataPath || '') + "+e.errorPath+"; if ("+$+".schemaPath === undefined) { "+$+'.schemaPath = "'+c+'"; } ',e.opts.verbose&&(r+=" "+$+".schema = "+v+"; "+$+".data = "+g+"; "),r+=" } } "):H?(r+=" var err = ",e.createErrors!==!1?(r+=" { keyword: '"+(p||"custom")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(c)+" , params: { keyword: '"+x.keyword+"' } ",e.opts.messages!==!1&&(r+=` , message: 'should pass "`+x.keyword+`" keyword validation' `),e.opts.verbose&&(r+=" , schema: validate.schema"+u+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+g+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&f&&(e.async?r+=" throw new ValidationError(vErrors); ":r+=" validate.errors = vErrors; return false; ")):P.errors===!1?r+=" "+se+" ":(r+=" if (Array.isArray("+M+")) { if (vErrors === null) vErrors = "+M+"; else vErrors = vErrors.concat("+M+"); errors = vErrors.length; for (var "+L+"="+y+"; "+L+"<errors; "+L+"++) { var "+$+" = vErrors["+L+"]; if ("+$+".dataPath === undefined) "+$+".dataPath = (dataPath || '') + "+e.errorPath+"; "+$+'.schemaPath = "'+c+'"; ',e.opts.verbose&&(r+=" "+$+".schema = "+v+"; "+$+".data = "+g+"; "),r+=" } } else { "+se+" } "),r+=" } ",f&&(r+=" else { ")}return r}});var en=z((mg,kh)=>{kh.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"http://json-schema.org/draft-07/schema#",title:"Core schema meta-schema",definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},default:!0}});var nl=z((vg,sl)=>{"use strict";var al=en();sl.exports={$id:"https://github.com/ajv-validator/ajv/blob/master/lib/definition_schema.js",definitions:{simpleTypes:al.definitions.simpleTypes},type:"object",dependencies:{schema:["validate"],$data:["validate"],statements:["inline"],valid:{not:{required:["macro"]}}},properties:{type:al.properties.type,schema:{type:"boolean"},statements:{type:"boolean"},dependencies:{type:"array",items:{type:"string"}},metaSchema:{type:"object"},modifying:{type:"boolean"},valid:{type:"boolean"},$data:{type:"boolean"},async:{type:"boolean"},errors:{anyOf:[{type:"boolean"},{const:"full"}]}}}});var il=z((gg,ol)=>{"use strict";var Dh=/^[a-z_$][a-z0-9_$-]*$/i,jh=tl(),Nh=nl();ol.exports={add:Lh,get:Fh,remove:Mh,validate:rn};function Lh(a,e){var t=this.RULES;if(t.keywords[a])throw new Error("Keyword "+a+" is already defined");if(!Dh.test(a))throw new Error("Keyword "+a+" is not a valid identifier");if(e){this.validateKeyword(e,!0);var s=e.type;if(Array.isArray(s))for(var r=0;r<s.length;r++)o(a,s[r],e);else o(a,s,e);var n=e.metaSchema;n&&(e.$data&&this._opts.$data&&(n={anyOf:[n,{$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"}]}),e.validateSchema=this.compile(n,!0))}t.keywords[a]=t.all[a]=!0;function o(i,u,c){for(var f,p=0;p<t.length;p++){var g=t[p];if(g.type==u){f=g;break}}f||(f={type:u,rules:[]},t.push(f));var d={keyword:i,definition:c,custom:!0,code:jh,implements:c.implements};f.rules.push(d),t.custom[i]=d}return this}function Fh(a){var e=this.RULES.custom[a];return e?e.definition:this.RULES.keywords[a]||!1}function Mh(a){var e=this.RULES;delete e.keywords[a],delete e.all[a],delete e.custom[a];for(var t=0;t<e.length;t++)for(var s=e[t].rules,r=0;r<s.length;r++)if(s[r].keyword==a){s.splice(r,1);break}return this}function rn(a,e){rn.errors=null;var t=this._validateKeyword=this._validateKeyword||this.compile(Nh,!0);if(t(a))return!0;if(rn.errors=t.errors,e)throw new Error("custom keyword definition is invalid: "+this.errorsText(t.errors));return!1}});var ll=z((yg,qh)=>{qh.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",description:"Meta-schema for $data reference (JSON Schema extension proposal)",type:"object",required:["$data"],properties:{$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},additionalProperties:!1}});var an=z((_g,gl)=>{"use strict";var ul=Uo(),nt=Da(),Uh=Vo(),dl=qs(),zh=Bs(),Vh=ri(),Hh=Qi(),fl=Wi(),hl=st();gl.exports=ge;ge.prototype.validate=Bh;ge.prototype.compile=Jh;ge.prototype.addSchema=Qh;ge.prototype.addMetaSchema=Kh;ge.prototype.validateSchema=Gh;ge.prototype.getSchema=Yh;ge.prototype.removeSchema=ep;ge.prototype.addFormat=lp;ge.prototype.errorsText=ip;ge.prototype._addSchema=rp;ge.prototype._compile=tp;ge.prototype.compileAsync=el();var Va=il();ge.prototype.addKeyword=Va.add;ge.prototype.getKeyword=Va.get;ge.prototype.removeKeyword=Va.remove;ge.prototype.validateKeyword=Va.validate;var pl=ja();ge.ValidationError=pl.Validation;ge.MissingRefError=pl.MissingRef;ge.$dataMetaSchema=fl;var za="http://json-schema.org/draft-07/schema",cl=["removeAdditional","useDefaults","coerceTypes","strictDefaults"],Zh=["/properties"];function ge(a){if(!(this instanceof ge))return new ge(a);a=this._opts=hl.copy(a)||{},pp(this),this._schemas={},this._refs={},this._fragments={},this._formats=Vh(a.format),this._cache=a.cache||new Uh,this._loadingSchemas={},this._compilations=[],this.RULES=Hh(),this._getId=ap(a),a.loopRequired=a.loopRequired||1/0,a.errorDataPath=="property"&&(a._errorDataPathProperty=!0),a.serialize===void 0&&(a.serialize=zh),this._metaOpts=hp(this),a.formats&&dp(this),a.keywords&&fp(this),cp(this),typeof a.meta=="object"&&this.addMetaSchema(a.meta),a.nullable&&this.addKeyword("nullable",{metaSchema:{type:"boolean"}}),up(this)}function Bh(a,e){var t;if(typeof a=="string"){if(t=this.getSchema(a),!t)throw new Error('no schema with key or ref "'+a+'"')}else{var s=this._addSchema(a);t=s.validate||this._compile(s)}var r=t(e);return t.$async!==!0&&(this.errors=t.errors),r}function Jh(a,e){var t=this._addSchema(a,void 0,e);return t.validate||this._compile(t)}function Qh(a,e,t,s){if(Array.isArray(a)){for(var r=0;r<a.length;r++)this.addSchema(a[r],void 0,t,s);return this}var n=this._getId(a);if(n!==void 0&&typeof n!="string")throw new Error("schema id must be string");return e=nt.normalizeId(e||n),vl(this,e),this._schemas[e]=this._addSchema(a,t,s,!0),this}function Kh(a,e,t){return this.addSchema(a,e,t,!0),this}function Gh(a,e){var t=a.$schema;if(t!==void 0&&typeof t!="string")throw new Error("$schema must be a string");if(t=t||this._opts.defaultMeta||Wh(this),!t)return this.logger.warn("meta-schema not available"),this.errors=null,!0;var s=this.validate(t,a);if(!s&&e){var r="schema is invalid: "+this.errorsText();if(this._opts.validateSchema=="log")this.logger.error(r);else throw new Error(r)}return s}function Wh(a){var e=a._opts.meta;return a._opts.defaultMeta=typeof e=="object"?a._getId(e)||e:a.getSchema(za)?za:void 0,a._opts.defaultMeta}function Yh(a){var e=ml(this,a);switch(typeof e){case"object":return e.validate||this._compile(e);case"string":return this.getSchema(e);case"undefined":return Xh(this,a)}}function Xh(a,e){var t=nt.schema.call(a,{schema:{}},e);if(t){var s=t.schema,r=t.root,n=t.baseId,o=ul.call(a,s,r,void 0,n);return a._fragments[e]=new dl({ref:e,fragment:!0,schema:s,root:r,baseId:n,validate:o}),o}}function ml(a,e){return e=nt.normalizeId(e),a._schemas[e]||a._refs[e]||a._fragments[e]}function ep(a){if(a instanceof RegExp)return Ua(this,this._schemas,a),Ua(this,this._refs,a),this;switch(typeof a){case"undefined":return Ua(this,this._schemas),Ua(this,this._refs),this._cache.clear(),this;case"string":var e=ml(this,a);return e&&this._cache.del(e.cacheKey),delete this._schemas[a],delete this._refs[a],this;case"object":var t=this._opts.serialize,s=t?t(a):a;this._cache.del(s);var r=this._getId(a);r&&(r=nt.normalizeId(r),delete this._schemas[r],delete this._refs[r])}return this}function Ua(a,e,t){for(var s in e){var r=e[s];!r.meta&&(!t||t.test(s))&&(a._cache.del(r.cacheKey),delete e[s])}}function rp(a,e,t,s){if(typeof a!="object"&&typeof a!="boolean")throw new Error("schema should be object or boolean");var r=this._opts.serialize,n=r?r(a):a,o=this._cache.get(n);if(o)return o;s=s||this._opts.addUsedSchema!==!1;var i=nt.normalizeId(this._getId(a));i&&s&&vl(this,i);var u=this._opts.validateSchema!==!1&&!e,c;u&&!(c=i&&i==nt.normalizeId(a.$schema))&&this.validateSchema(a,!0);var f=nt.ids.call(this,a),p=new dl({id:i,schema:a,localRefs:f,cacheKey:n,meta:t});return i[0]!="#"&&s&&(this._refs[i]=p),this._cache.put(n,p),u&&c&&this.validateSchema(a,!0),p}function tp(a,e){if(a.compiling)return a.validate=r,r.schema=a.schema,r.errors=null,r.root=e||r,a.schema.$async===!0&&(r.$async=!0),r;a.compiling=!0;var t;a.meta&&(t=this._opts,this._opts=this._metaOpts);var s;try{s=ul.call(this,a.schema,e,a.localRefs)}catch(n){throw delete a.validate,n}finally{a.compiling=!1,a.meta&&(this._opts=t)}return a.validate=s,a.refs=s.refs,a.refVal=s.refVal,a.root=s.root,s;function r(){var n=a.validate,o=n.apply(this,arguments);return r.errors=n.errors,o}}function ap(a){switch(a.schemaId){case"auto":return op;case"id":return sp;default:return np}}function sp(a){return a.$id&&this.logger.warn("schema $id ignored",a.$id),a.id}function np(a){return a.id&&this.logger.warn("schema id ignored",a.id),a.$id}function op(a){if(a.$id&&a.id&&a.$id!=a.id)throw new Error("schema $id is different from id");return a.$id||a.id}function ip(a,e){if(a=a||this.errors,!a)return"No errors";e=e||{};for(var t=e.separator===void 0?", ":e.separator,s=e.dataVar===void 0?"data":e.dataVar,r="",n=0;n<a.length;n++){var o=a[n];o&&(r+=s+o.dataPath+" "+o.message+t)}return r.slice(0,-t.length)}function lp(a,e){return typeof e=="string"&&(e=new RegExp(e)),this._formats[a]=e,this}function cp(a){var e;if(a._opts.$data&&(e=ll(),a.addMetaSchema(e,e.$id,!0)),a._opts.meta!==!1){var t=en();a._opts.$data&&(t=fl(t,Zh)),a.addMetaSchema(t,za,!0),a._refs["http://json-schema.org/schema"]=za}}function up(a){var e=a._opts.schemas;if(e)if(Array.isArray(e))a.addSchema(e);else for(var t in e)a.addSchema(e[t],t)}function dp(a){for(var e in a._opts.formats){var t=a._opts.formats[e];a.addFormat(e,t)}}function fp(a){for(var e in a._opts.keywords){var t=a._opts.keywords[e];a.addKeyword(e,t)}}function vl(a,e){if(a._schemas[e]||a._refs[e])throw new Error('schema with key or id "'+e+'" already exists')}function hp(a){for(var e=hl.copy(a._opts),t=0;t<cl.length;t++)delete e[cl[t]];return e}function pp(a){var e=a._opts.logger;if(e===!1)a.logger={log:tn,warn:tn,error:tn};else{if(e===void 0&&(e=console),!(typeof e=="object"&&e.log&&e.warn&&e.error))throw new Error("logger must implement log, warn and error methods");a.logger=e}}function tn(){}});var wl=z((Rg,Ba)=>{"use strict";Ba.exports=yp;Ba.exports.format=bl;Ba.exports.parse=xl;var mp=/\B(?=(\d{3})+(?!\d))/g,vp=/(?:\.0*|(\.[^0]+)0+)$/,Cr={b:1,kb:1024,mb:1<<20,gb:1<<30,tb:Math.pow(1024,4),pb:Math.pow(1024,5)},gp=/^((-|\+)?(\d+(?:\.\d+)?)) *(kb|mb|gb|tb|pb)$/i;function yp(a,e){return typeof a=="string"?xl(a):typeof a=="number"?bl(a,e):null}function bl(a,e){if(!Number.isFinite(a))return null;var t=Math.abs(a),s=e&&e.thousandsSeparator||"",r=e&&e.unitSeparator||"",n=e&&e.decimalPlaces!==void 0?e.decimalPlaces:2,o=!!(e&&e.fixedDecimals),i=e&&e.unit||"";(!i||!Cr[i.toLowerCase()])&&(t>=Cr.pb?i="PB":t>=Cr.tb?i="TB":t>=Cr.gb?i="GB":t>=Cr.mb?i="MB":t>=Cr.kb?i="KB":i="B");var u=a/Cr[i.toLowerCase()],c=u.toFixed(n);return o||(c=c.replace(vp,"$1")),s&&(c=c.split(".").map(function(f,p){return p===0?f.replace(mp,s):f}).join(".")),c+r+i}function xl(a){if(typeof a=="number"&&!isNaN(a))return a;if(typeof a!="string")return null;var e=gp.exec(a),t,s="b";return e?(t=parseFloat(e[1]),s=e[4].toLowerCase()):(t=parseInt(a,10),s="b"),isNaN(t)?null:Math.floor(Cr[s]*t)}});var nn=z(sn=>{"use strict";var Pl=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,_p=/^[\u000b\u0020-\u007e\u0080-\u00ff]+$/,Sl=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/,bp=/\\([\u000b\u0020-\u00ff])/g,xp=/([\\"])/g,Rl=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;sn.format=wp;sn.parse=Ep;function wp(a){if(!a||typeof a!="object")throw new TypeError("argument obj is required");var e=a.parameters,t=a.type;if(!t||!Rl.test(t))throw new TypeError("invalid type");var s=t;if(e&&typeof e=="object")for(var r,n=Object.keys(e).sort(),o=0;o<n.length;o++){if(r=n[o],!Sl.test(r))throw new TypeError("invalid parameter name");s+="; "+r+"="+Sp(e[r])}return s}function Ep(a){if(!a)throw new TypeError("argument string is required");var e=typeof a=="object"?Pp(a):a;if(typeof e!="string")throw new TypeError("argument string is required to be a string");var t=e.indexOf(";"),s=t!==-1?e.slice(0,t).trim():e.trim();if(!Rl.test(s))throw new TypeError("invalid media type");var r=new Rp(s.toLowerCase());if(t!==-1){var n,o,i;for(Pl.lastIndex=t;o=Pl.exec(e);){if(o.index!==t)throw new TypeError("invalid parameter format");t+=o[0].length,n=o[1].toLowerCase(),i=o[2],i.charCodeAt(0)===34&&(i=i.slice(1,-1),i.indexOf("\\")!==-1&&(i=i.replace(bp,"$1"))),r.parameters[n]=i}if(t!==e.length)throw new TypeError("invalid parameter format")}return r}function Pp(a){var e;if(typeof a.getHeader=="function"?e=a.getHeader("content-type"):typeof a.headers=="object"&&(e=a.headers&&a.headers["content-type"]),typeof e!="string")throw new TypeError("content-type header is missing from object");return e}function Sp(a){var e=String(a);if(Sl.test(e))return e;if(e.length>0&&!_p.test(e))throw new TypeError("invalid parameter value");return'"'+e.replace(xp,"\\$1")+'"'}function Rp(a){this.parameters=Object.create(null),this.type=a}});var Dl=z((Cg,kl)=>{kl.exports=Cl;Cl.sync=$p;var Al=require("fs");function Tp(a,e){var t=e.pathExt!==void 0?e.pathExt:process.env.PATHEXT;if(!t||(t=t.split(";"),t.indexOf("")!==-1))return!0;for(var s=0;s<t.length;s++){var r=t[s].toLowerCase();if(r&&a.substr(-r.length).toLowerCase()===r)return!0}return!1}function Il(a,e,t){return!a.isSymbolicLink()&&!a.isFile()?!1:Tp(e,t)}function Cl(a,e,t){Al.stat(a,function(s,r){t(s,s?!1:Il(r,a,e))})}function $p(a,e){return Il(Al.statSync(a),a,e)}});var Ml=z((kg,Fl)=>{Fl.exports=Nl;Nl.sync=Ap;var jl=require("fs");function Nl(a,e,t){jl.stat(a,function(s,r){t(s,s?!1:Ll(r,e))})}function Ap(a,e){return Ll(jl.statSync(a),e)}function Ll(a,e){return a.isFile()&&Ip(a,e)}function Ip(a,e){var t=a.mode,s=a.uid,r=a.gid,n=e.uid!==void 0?e.uid:process.getuid&&process.getuid(),o=e.gid!==void 0?e.gid:process.getgid&&process.getgid(),i=parseInt("100",8),u=parseInt("010",8),c=parseInt("001",8),f=i|u,p=t&c||t&u&&r===o||t&i&&s===n||t&f&&n===0;return p}});var Ul=z((jg,ql)=>{var Dg=require("fs"),Qa;process.platform==="win32"||global.TESTING_WINDOWS?Qa=Dl():Qa=Ml();ql.exports=on;on.sync=Cp;function on(a,e,t){if(typeof e=="function"&&(t=e,e={}),!t){if(typeof Promise!="function")throw new TypeError("callback not provided");return new Promise(function(s,r){on(a,e||{},function(n,o){n?r(n):s(o)})})}Qa(a,e||{},function(s,r){s&&(s.code==="EACCES"||e&&e.ignoreErrors)&&(s=null,r=!1),t(s,r)})}function Cp(a,e){try{return Qa.sync(a,e||{})}catch(t){if(e&&e.ignoreErrors||t.code==="EACCES")return!1;throw t}}});var Ql=z((Ng,Jl)=>{var Ot=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",zl=require("path"),kp=Ot?";":":",Vl=Ul(),Hl=a=>Object.assign(new Error(`not found: ${a}`),{code:"ENOENT"}),Zl=(a,e)=>{let t=e.colon||kp,s=a.match(/\//)||Ot&&a.match(/\\/)?[""]:[...Ot?[process.cwd()]:[],...(e.path||process.env.PATH||"").split(t)],r=Ot?e.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",n=Ot?r.split(t):[""];return Ot&&a.indexOf(".")!==-1&&n[0]!==""&&n.unshift(""),{pathEnv:s,pathExt:n,pathExtExe:r}},Bl=(a,e,t)=>{typeof e=="function"&&(t=e,e={}),e||(e={});let{pathEnv:s,pathExt:r,pathExtExe:n}=Zl(a,e),o=[],i=c=>new Promise((f,p)=>{if(c===s.length)return e.all&&o.length?f(o):p(Hl(a));let g=s[c],d=/^".*"$/.test(g)?g.slice(1,-1):g,y=zl.join(d,a),m=!d&&/^\.[\\\/]/.test(a)?a.slice(0,2)+y:y;f(u(m,c,0))}),u=(c,f,p)=>new Promise((g,d)=>{if(p===r.length)return g(i(f+1));let y=r[p];Vl(c+y,{pathExt:n},(m,v)=>{if(!m&&v)if(e.all)o.push(c+y);else return g(c+y);return g(u(c,f,p+1))})});return t?i(0).then(c=>t(null,c),t):i(0)},Dp=(a,e)=>{e=e||{};let{pathEnv:t,pathExt:s,pathExtExe:r}=Zl(a,e),n=[];for(let o=0;o<t.length;o++){let i=t[o],u=/^".*"$/.test(i)?i.slice(1,-1):i,c=zl.join(u,a),f=!u&&/^\.[\\\/]/.test(a)?a.slice(0,2)+c:c;for(let p=0;p<s.length;p++){let g=f+s[p];try{if(Vl.sync(g,{pathExt:r}))if(e.all)n.push(g);else return g}catch{}}}if(e.all&&n.length)return n;if(e.nothrow)return null;throw Hl(a)};Jl.exports=Bl;Bl.sync=Dp});var Gl=z((Lg,ln)=>{"use strict";var Kl=(a={})=>{let e=a.env||process.env;return(a.platform||process.platform)!=="win32"?"PATH":Object.keys(e).reverse().find(s=>s.toUpperCase()==="PATH")||"Path"};ln.exports=Kl;ln.exports.default=Kl});var ec=z((Fg,Xl)=>{"use strict";var Wl=require("path"),jp=Ql(),Np=Gl();function Yl(a,e){let t=a.options.env||process.env,s=process.cwd(),r=a.options.cwd!=null,n=r&&process.chdir!==void 0&&!process.chdir.disabled;if(n)try{process.chdir(a.options.cwd)}catch{}let o;try{o=jp.sync(a.command,{path:t[Np({env:t})],pathExt:e?Wl.delimiter:void 0})}catch{}finally{n&&process.chdir(s)}return o&&(o=Wl.resolve(r?a.options.cwd:"",o)),o}function Lp(a){return Yl(a)||Yl(a,!0)}Xl.exports=Lp});var rc=z((Mg,un)=>{"use strict";var cn=/([()\][%!^"`<>&|;, *?])/g;function Fp(a){return a=a.replace(cn,"^$1"),a}function Mp(a,e){return a=`${a}`,a=a.replace(/(?=(\\+?)?)\1"/g,'$1$1\\"'),a=a.replace(/(?=(\\+?)?)\1$/,"$1$1"),a=`"${a}"`,a=a.replace(cn,"^$1"),e&&(a=a.replace(cn,"^$1")),a}un.exports.command=Fp;un.exports.argument=Mp});var ac=z((qg,tc)=>{"use strict";tc.exports=/^#!(.*)/});var nc=z((Ug,sc)=>{"use strict";var qp=ac();sc.exports=(a="")=>{let e=a.match(qp);if(!e)return null;let[t,s]=e[0].replace(/#! ?/,"").split(" "),r=t.split("/").pop();return r==="env"?s:s?`${r} ${s}`:r}});var ic=z((zg,oc)=>{"use strict";var dn=require("fs"),Up=nc();function zp(a){let t=Buffer.alloc(150),s;try{s=dn.openSync(a,"r"),dn.readSync(s,t,0,150,0),dn.closeSync(s)}catch{}return Up(t.toString())}oc.exports=zp});var dc=z((Vg,uc)=>{"use strict";var Vp=require("path"),lc=ec(),cc=rc(),Hp=ic(),Zp=process.platform==="win32",Bp=/\.(?:com|exe)$/i,Jp=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function Qp(a){a.file=lc(a);let e=a.file&&Hp(a.file);return e?(a.args.unshift(a.file),a.command=e,lc(a)):a.file}function Kp(a){if(!Zp)return a;let e=Qp(a),t=!Bp.test(e);if(a.options.forceShell||t){let s=Jp.test(e);a.command=Vp.normalize(a.command),a.command=cc.command(a.command),a.args=a.args.map(n=>cc.argument(n,s));let r=[a.command].concat(a.args).join(" ");a.args=["/d","/s","/c",`"${r}"`],a.command=process.env.comspec||"cmd.exe",a.options.windowsVerbatimArguments=!0}return a}function Gp(a,e,t){e&&!Array.isArray(e)&&(t=e,e=null),e=e?e.slice(0):[],t=Object.assign({},t);let s={command:a,args:e,options:t,file:void 0,original:{command:a,args:e}};return t.shell?s:Kp(s)}uc.exports=Gp});var pc=z((Hg,hc)=>{"use strict";var fn=process.platform==="win32";function hn(a,e){return Object.assign(new Error(`${e} ${a.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${e} ${a.command}`,path:a.command,spawnargs:a.args})}function Wp(a,e){if(!fn)return;let t=a.emit;a.emit=function(s,r){if(s==="exit"){let n=fc(r,e);if(n)return t.call(a,"error",n)}return t.apply(a,arguments)}}function fc(a,e){return fn&&a===1&&!e.file?hn(e.original,"spawn"):null}function Yp(a,e){return fn&&a===1&&!e.file?hn(e.original,"spawnSync"):null}hc.exports={hookChildProcess:Wp,verifyENOENT:fc,verifyENOENTSync:Yp,notFoundError:hn}});var gc=z((Zg,Tt)=>{"use strict";var mc=require("child_process"),pn=dc(),mn=pc();function vc(a,e,t){let s=pn(a,e,t),r=mc.spawn(s.command,s.args,s.options);return mn.hookChildProcess(r,s),r}function Xp(a,e,t){let s=pn(a,e,t),r=mc.spawnSync(s.command,s.args,s.options);return r.error=r.error||mn.verifyENOENTSync(r.status,s),r}Tt.exports=vc;Tt.exports.spawn=vc;Tt.exports.sync=Xp;Tt.exports._parse=pn;Tt.exports._enoent=mn});var Nm={};zn(Nm,{CallToolRequestSchema:()=>Rs,Client:()=>Ha,ListRootsRequestSchema:()=>Is,ListToolsRequestSchema:()=>Ps,PingRequestSchema:()=>St,SSEServerTransport:()=>Ja,Server:()=>Za,StdioClientTransport:()=>Ga,StdioServerTransport:()=>Wa,StreamableHTTPClientTransport:()=>ts,StreamableHTTPServerTransport:()=>Ya,z:()=>l,zodToJsonSchema:()=>$n});module.exports=Mu(Nm);var l={};zn(l,{BRAND:()=>dd,DIRTY:()=>qr,EMPTY_PATH:()=>Vu,INVALID:()=>B,NEVER:()=>Kd,OK:()=>$e,ParseStatus:()=>Re,Schema:()=>G,ZodAny:()=>Rr,ZodArray:()=>yr,ZodBigInt:()=>zr,ZodBoolean:()=>Vr,ZodBranded:()=>Ft,ZodCatch:()=>et,ZodDate:()=>Hr,ZodDefault:()=>Xr,ZodDiscriminatedUnion:()=>ha,ZodEffects:()=>Qe,ZodEnum:()=>Wr,ZodError:()=>Le,ZodFirstPartyTypeKind:()=>T,ZodFunction:()=>ma,ZodIntersection:()=>Qr,ZodIssueCode:()=>R,ZodLazy:()=>Kr,ZodLiteral:()=>Gr,ZodMap:()=>xt,ZodNaN:()=>Et,ZodNativeEnum:()=>Yr,ZodNever:()=>Ye,ZodNull:()=>Br,ZodNullable:()=>ir,ZodNumber:()=>Ur,ZodObject:()=>Fe,ZodOptional:()=>Be,ZodParsedType:()=>j,ZodPipeline:()=>Mt,ZodPromise:()=>Or,ZodReadonly:()=>rt,ZodRecord:()=>pa,ZodSchema:()=>G,ZodSet:()=>wt,ZodString:()=>Sr,ZodSymbol:()=>_t,ZodTransformer:()=>Qe,ZodTuple:()=>or,ZodType:()=>G,ZodUndefined:()=>Zr,ZodUnion:()=>Jr,ZodUnknown:()=>gr,ZodVoid:()=>bt,addIssueToContext:()=>D,any:()=>bd,array:()=>Pd,bigint:()=>md,boolean:()=>eo,coerce:()=>Qd,custom:()=>Wn,date:()=>vd,datetimeRegex:()=>Kn,defaultErrorMap:()=>mr,discriminatedUnion:()=>Td,effect:()=>qd,enum:()=>Ld,function:()=>Dd,getErrorMap:()=>vt,getParsedType:()=>nr,instanceof:()=>hd,intersection:()=>$d,isAborted:()=>da,isAsync:()=>gt,isDirty:()=>fa,isValid:()=>Pr,late:()=>fd,lazy:()=>jd,literal:()=>Nd,makeIssue:()=>Lt,map:()=>Cd,nan:()=>pd,nativeEnum:()=>Fd,never:()=>wd,null:()=>_d,nullable:()=>zd,number:()=>Xn,object:()=>Sd,objectUtil:()=>ds,oboolean:()=>Jd,onumber:()=>Bd,optional:()=>Ud,ostring:()=>Zd,pipeline:()=>Hd,preprocess:()=>Vd,promise:()=>Md,quotelessJson:()=>qu,record:()=>Id,set:()=>kd,setErrorMap:()=>zu,strictObject:()=>Rd,string:()=>Yn,symbol:()=>gd,transformer:()=>qd,tuple:()=>Ad,undefined:()=>yd,union:()=>Od,unknown:()=>xd,util:()=>X,void:()=>Ed});var X;(function(a){a.assertEqual=r=>{};function e(r){}a.assertIs=e;function t(r){throw new Error}a.assertNever=t,a.arrayToEnum=r=>{let n={};for(let o of r)n[o]=o;return n},a.getValidEnumValues=r=>{let n=a.objectKeys(r).filter(i=>typeof r[r[i]]!="number"),o={};for(let i of n)o[i]=r[i];return a.objectValues(o)},a.objectValues=r=>a.objectKeys(r).map(function(n){return r[n]}),a.objectKeys=typeof Object.keys=="function"?r=>Object.keys(r):r=>{let n=[];for(let o in r)Object.prototype.hasOwnProperty.call(r,o)&&n.push(o);return n},a.find=(r,n)=>{for(let o of r)if(n(o))return o},a.isInteger=typeof Number.isInteger=="function"?r=>Number.isInteger(r):r=>typeof r=="number"&&Number.isFinite(r)&&Math.floor(r)===r;function s(r,n=" | "){return r.map(o=>typeof o=="string"?`'${o}'`:o).join(n)}a.joinValues=s,a.jsonStringifyReplacer=(r,n)=>typeof n=="bigint"?n.toString():n})(X||(X={}));var ds;(function(a){a.mergeShapes=(e,t)=>({...e,...t})})(ds||(ds={}));var j=X.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),nr=a=>{switch(typeof a){case"undefined":return j.undefined;case"string":return j.string;case"number":return Number.isNaN(a)?j.nan:j.number;case"boolean":return j.boolean;case"function":return j.function;case"bigint":return j.bigint;case"symbol":return j.symbol;case"object":return Array.isArray(a)?j.array:a===null?j.null:a.then&&typeof a.then=="function"&&a.catch&&typeof a.catch=="function"?j.promise:typeof Map!="undefined"&&a instanceof Map?j.map:typeof Set!="undefined"&&a instanceof Set?j.set:typeof Date!="undefined"&&a instanceof Date?j.date:j.object;default:return j.unknown}};var R=X.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"]),qu=a=>JSON.stringify(a,null,2).replace(/"([^"]+)":/g,"$1:"),Le=class a extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=s=>{this.issues=[...this.issues,s]},this.addIssues=(s=[])=>{this.issues=[...this.issues,...s]};let t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){let t=e||function(n){return n.message},s={_errors:[]},r=n=>{for(let o of n.issues)if(o.code==="invalid_union")o.unionErrors.map(r);else if(o.code==="invalid_return_type")r(o.returnTypeError);else if(o.code==="invalid_arguments")r(o.argumentsError);else if(o.path.length===0)s._errors.push(t(o));else{let i=s,u=0;for(;u<o.path.length;){let c=o.path[u];u===o.path.length-1?(i[c]=i[c]||{_errors:[]},i[c]._errors.push(t(o))):i[c]=i[c]||{_errors:[]},i=i[c],u++}}};return r(this),s}static assert(e){if(!(e instanceof a))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,X.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){let t={},s=[];for(let r of this.issues)if(r.path.length>0){let n=r.path[0];t[n]=t[n]||[],t[n].push(e(r))}else s.push(e(r));return{formErrors:s,fieldErrors:t}}get formErrors(){return this.flatten()}};Le.create=a=>new Le(a);var Uu=(a,e)=>{let t;switch(a.code){case R.invalid_type:a.received===j.undefined?t="Required":t=`Expected ${a.expected}, received ${a.received}`;break;case R.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(a.expected,X.jsonStringifyReplacer)}`;break;case R.unrecognized_keys:t=`Unrecognized key(s) in object: ${X.joinValues(a.keys,", ")}`;break;case R.invalid_union:t="Invalid input";break;case R.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${X.joinValues(a.options)}`;break;case R.invalid_enum_value:t=`Invalid enum value. Expected ${X.joinValues(a.options)}, received '${a.received}'`;break;case R.invalid_arguments:t="Invalid function arguments";break;case R.invalid_return_type:t="Invalid function return type";break;case R.invalid_date:t="Invalid date";break;case R.invalid_string:typeof a.validation=="object"?"includes"in a.validation?(t=`Invalid input: must include "${a.validation.includes}"`,typeof a.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${a.validation.position}`)):"startsWith"in a.validation?t=`Invalid input: must start with "${a.validation.startsWith}"`:"endsWith"in a.validation?t=`Invalid input: must end with "${a.validation.endsWith}"`:X.assertNever(a.validation):a.validation!=="regex"?t=`Invalid ${a.validation}`:t="Invalid";break;case R.too_small:a.type==="array"?t=`Array must contain ${a.exact?"exactly":a.inclusive?"at least":"more than"} ${a.minimum} element(s)`:a.type==="string"?t=`String must contain ${a.exact?"exactly":a.inclusive?"at least":"over"} ${a.minimum} character(s)`:a.type==="number"?t=`Number must be ${a.exact?"exactly equal to ":a.inclusive?"greater than or equal to ":"greater than "}${a.minimum}`:a.type==="bigint"?t=`Number must be ${a.exact?"exactly equal to ":a.inclusive?"greater than or equal to ":"greater than "}${a.minimum}`:a.type==="date"?t=`Date must be ${a.exact?"exactly equal to ":a.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(a.minimum))}`:t="Invalid input";break;case R.too_big:a.type==="array"?t=`Array must contain ${a.exact?"exactly":a.inclusive?"at most":"less than"} ${a.maximum} element(s)`:a.type==="string"?t=`String must contain ${a.exact?"exactly":a.inclusive?"at most":"under"} ${a.maximum} character(s)`:a.type==="number"?t=`Number must be ${a.exact?"exactly":a.inclusive?"less than or equal to":"less than"} ${a.maximum}`:a.type==="bigint"?t=`BigInt must be ${a.exact?"exactly":a.inclusive?"less than or equal to":"less than"} ${a.maximum}`:a.type==="date"?t=`Date must be ${a.exact?"exactly":a.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(a.maximum))}`:t="Invalid input";break;case R.custom:t="Invalid input";break;case R.invalid_intersection_types:t="Intersection results could not be merged";break;case R.not_multiple_of:t=`Number must be a multiple of ${a.multipleOf}`;break;case R.not_finite:t="Number must be finite";break;default:t=e.defaultError,X.assertNever(a)}return{message:t}},mr=Uu;var Hn=mr;function zu(a){Hn=a}function vt(){return Hn}var Lt=a=>{let{data:e,path:t,errorMaps:s,issueData:r}=a,n=[...t,...r.path||[]],o={...r,path:n};if(r.message!==void 0)return{...r,path:n,message:r.message};let i="",u=s.filter(c=>!!c).slice().reverse();for(let c of u)i=c(o,{data:e,defaultError:i}).message;return{...r,path:n,message:i}},Vu=[];function D(a,e){let t=vt(),s=Lt({issueData:e,data:a.data,path:a.path,errorMaps:[a.common.contextualErrorMap,a.schemaErrorMap,t,t===mr?void 0:mr].filter(r=>!!r)});a.common.issues.push(s)}var Re=class a{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){let s=[];for(let r of t){if(r.status==="aborted")return B;r.status==="dirty"&&e.dirty(),s.push(r.value)}return{status:e.value,value:s}}static async mergeObjectAsync(e,t){let s=[];for(let r of t){let n=await r.key,o=await r.value;s.push({key:n,value:o})}return a.mergeObjectSync(e,s)}static mergeObjectSync(e,t){let s={};for(let r of t){let{key:n,value:o}=r;if(n.status==="aborted"||o.status==="aborted")return B;n.status==="dirty"&&e.dirty(),o.status==="dirty"&&e.dirty(),n.value!=="__proto__"&&(typeof o.value!="undefined"||r.alwaysSet)&&(s[n.value]=o.value)}return{status:e.value,value:s}}},B=Object.freeze({status:"aborted"}),qr=a=>({status:"dirty",value:a}),$e=a=>({status:"valid",value:a}),da=a=>a.status==="aborted",fa=a=>a.status==="dirty",Pr=a=>a.status==="valid",gt=a=>typeof Promise!="undefined"&&a instanceof Promise;var V;(function(a){a.errToObj=e=>typeof e=="string"?{message:e}:e||{},a.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(V||(V={}));var Je=class{constructor(e,t,s,r){this._cachedPath=[],this.parent=e,this.data=t,this._path=s,this._key=r}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},Zn=(a,e)=>{if(Pr(e))return{success:!0,data:e.value};if(!a.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let t=new Le(a.common.issues);return this._error=t,this._error}}};function Q(a){if(!a)return{};let{errorMap:e,invalid_type_error:t,required_error:s,description:r}=a;if(e&&(t||s))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:r}:{errorMap:(o,i)=>{var c,f;let{message:u}=a;return o.code==="invalid_enum_value"?{message:u!=null?u:i.defaultError}:typeof i.data=="undefined"?{message:(c=u!=null?u:s)!=null?c:i.defaultError}:o.code!=="invalid_type"?{message:i.defaultError}:{message:(f=u!=null?u:t)!=null?f:i.defaultError}},description:r}}var G=class{get description(){return this._def.description}_getType(e){return nr(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:nr(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Re,ctx:{common:e.parent.common,data:e.data,parsedType:nr(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(gt(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){let t=this._parse(e);return Promise.resolve(t)}parse(e,t){let s=this.safeParse(e,t);if(s.success)return s.data;throw s.error}safeParse(e,t){var n;let s={common:{issues:[],async:(n=t==null?void 0:t.async)!=null?n:!1,contextualErrorMap:t==null?void 0:t.errorMap},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:nr(e)},r=this._parseSync({data:e,path:s.path,parent:s});return Zn(s,r)}"~validate"(e){var s,r;let t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:nr(e)};if(!this["~standard"].async)try{let n=this._parseSync({data:e,path:[],parent:t});return Pr(n)?{value:n.value}:{issues:t.common.issues}}catch(n){(r=(s=n==null?void 0:n.message)==null?void 0:s.toLowerCase())!=null&&r.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(n=>Pr(n)?{value:n.value}:{issues:t.common.issues})}async parseAsync(e,t){let s=await this.safeParseAsync(e,t);if(s.success)return s.data;throw s.error}async safeParseAsync(e,t){let s={common:{issues:[],contextualErrorMap:t==null?void 0:t.errorMap,async:!0},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:nr(e)},r=this._parse({data:e,path:s.path,parent:s}),n=await(gt(r)?r:Promise.resolve(r));return Zn(s,n)}refine(e,t){let s=r=>typeof t=="string"||typeof t=="undefined"?{message:t}:typeof t=="function"?t(r):t;return this._refinement((r,n)=>{let o=e(r),i=()=>n.addIssue({code:R.custom,...s(r)});return typeof Promise!="undefined"&&o instanceof Promise?o.then(u=>u?!0:(i(),!1)):o?!0:(i(),!1)})}refinement(e,t){return this._refinement((s,r)=>e(s)?!0:(r.addIssue(typeof t=="function"?t(s,r):t),!1))}_refinement(e){return new Qe({schema:this,typeName:T.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:t=>this["~validate"](t)}}optional(){return Be.create(this,this._def)}nullable(){return ir.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return yr.create(this)}promise(){return Or.create(this,this._def)}or(e){return Jr.create([this,e],this._def)}and(e){return Qr.create(this,e,this._def)}transform(e){return new Qe({...Q(this._def),schema:this,typeName:T.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let t=typeof e=="function"?e:()=>e;return new Xr({...Q(this._def),innerType:this,defaultValue:t,typeName:T.ZodDefault})}brand(){return new Ft({typeName:T.ZodBranded,type:this,...Q(this._def)})}catch(e){let t=typeof e=="function"?e:()=>e;return new et({...Q(this._def),innerType:this,catchValue:t,typeName:T.ZodCatch})}describe(e){let t=this.constructor;return new t({...this._def,description:e})}pipe(e){return Mt.create(this,e)}readonly(){return rt.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},Hu=/^c[^\s-]{8,}$/i,Zu=/^[0-9a-z]+$/,Bu=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Ju=/^[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,Qu=/^[a-z0-9_-]{21}$/i,Ku=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Gu=/^[-+]?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)?)??$/,Wu=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Yu="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",fs,Xu=/^(?:(?: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])$/,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])\/(3[0-2]|[12]?[0-9])$/,rd=/^(([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]))$/,td=/^(([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])$/,ad=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,sd=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Jn="((\\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])))",nd=new RegExp(`^${Jn}$`);function Qn(a){let e="[0-5]\\d";a.precision?e=`${e}\\.\\d{${a.precision}}`:a.precision==null&&(e=`${e}(\\.\\d+)?`);let t=a.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${t}`}function od(a){return new RegExp(`^${Qn(a)}$`)}function Kn(a){let e=`${Jn}T${Qn(a)}`,t=[];return t.push(a.local?"Z?":"Z"),a.offset&&t.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${t.join("|")})`,new RegExp(`^${e}$`)}function id(a,e){return!!((e==="v4"||!e)&&Xu.test(a)||(e==="v6"||!e)&&rd.test(a))}function ld(a,e){if(!Ku.test(a))return!1;try{let[t]=a.split(".");if(!t)return!1;let s=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),r=JSON.parse(atob(s));return!(typeof r!="object"||r===null||"typ"in r&&(r==null?void 0:r.typ)!=="JWT"||!r.alg||e&&r.alg!==e)}catch{return!1}}function cd(a,e){return!!((e==="v4"||!e)&&ed.test(a)||(e==="v6"||!e)&&td.test(a))}var Sr=class a extends G{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==j.string){let n=this._getOrReturnCtx(e);return D(n,{code:R.invalid_type,expected:j.string,received:n.parsedType}),B}let s=new Re,r;for(let n of this._def.checks)if(n.kind==="min")e.data.length<n.value&&(r=this._getOrReturnCtx(e,r),D(r,{code:R.too_small,minimum:n.value,type:"string",inclusive:!0,exact:!1,message:n.message}),s.dirty());else if(n.kind==="max")e.data.length>n.value&&(r=this._getOrReturnCtx(e,r),D(r,{code:R.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!1,message:n.message}),s.dirty());else if(n.kind==="length"){let o=e.data.length>n.value,i=e.data.length<n.value;(o||i)&&(r=this._getOrReturnCtx(e,r),o?D(r,{code:R.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message}):i&&D(r,{code:R.too_small,minimum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message}),s.dirty())}else if(n.kind==="email")Wu.test(e.data)||(r=this._getOrReturnCtx(e,r),D(r,{validation:"email",code:R.invalid_string,message:n.message}),s.dirty());else if(n.kind==="emoji")fs||(fs=new RegExp(Yu,"u")),fs.test(e.data)||(r=this._getOrReturnCtx(e,r),D(r,{validation:"emoji",code:R.invalid_string,message:n.message}),s.dirty());else if(n.kind==="uuid")Ju.test(e.data)||(r=this._getOrReturnCtx(e,r),D(r,{validation:"uuid",code:R.invalid_string,message:n.message}),s.dirty());else if(n.kind==="nanoid")Qu.test(e.data)||(r=this._getOrReturnCtx(e,r),D(r,{validation:"nanoid",code:R.invalid_string,message:n.message}),s.dirty());else if(n.kind==="cuid")Hu.test(e.data)||(r=this._getOrReturnCtx(e,r),D(r,{validation:"cuid",code:R.invalid_string,message:n.message}),s.dirty());else if(n.kind==="cuid2")Zu.test(e.data)||(r=this._getOrReturnCtx(e,r),D(r,{validation:"cuid2",code:R.invalid_string,message:n.message}),s.dirty());else if(n.kind==="ulid")Bu.test(e.data)||(r=this._getOrReturnCtx(e,r),D(r,{validation:"ulid",code:R.invalid_string,message:n.message}),s.dirty());else if(n.kind==="url")try{new URL(e.data)}catch{r=this._getOrReturnCtx(e,r),D(r,{validation:"url",code:R.invalid_string,message:n.message}),s.dirty()}else n.kind==="regex"?(n.regex.lastIndex=0,n.regex.test(e.data)||(r=this._getOrReturnCtx(e,r),D(r,{validation:"regex",code:R.invalid_string,message:n.message}),s.dirty())):n.kind==="trim"?e.data=e.data.trim():n.kind==="includes"?e.data.includes(n.value,n.position)||(r=this._getOrReturnCtx(e,r),D(r,{code:R.invalid_string,validation:{includes:n.value,position:n.position},message:n.message}),s.dirty()):n.kind==="toLowerCase"?e.data=e.data.toLowerCase():n.kind==="toUpperCase"?e.data=e.data.toUpperCase():n.kind==="startsWith"?e.data.startsWith(n.value)||(r=this._getOrReturnCtx(e,r),D(r,{code:R.invalid_string,validation:{startsWith:n.value},message:n.message}),s.dirty()):n.kind==="endsWith"?e.data.endsWith(n.value)||(r=this._getOrReturnCtx(e,r),D(r,{code:R.invalid_string,validation:{endsWith:n.value},message:n.message}),s.dirty()):n.kind==="datetime"?Kn(n).test(e.data)||(r=this._getOrReturnCtx(e,r),D(r,{code:R.invalid_string,validation:"datetime",message:n.message}),s.dirty()):n.kind==="date"?nd.test(e.data)||(r=this._getOrReturnCtx(e,r),D(r,{code:R.invalid_string,validation:"date",message:n.message}),s.dirty()):n.kind==="time"?od(n).test(e.data)||(r=this._getOrReturnCtx(e,r),D(r,{code:R.invalid_string,validation:"time",message:n.message}),s.dirty()):n.kind==="duration"?Gu.test(e.data)||(r=this._getOrReturnCtx(e,r),D(r,{validation:"duration",code:R.invalid_string,message:n.message}),s.dirty()):n.kind==="ip"?id(e.data,n.version)||(r=this._getOrReturnCtx(e,r),D(r,{validation:"ip",code:R.invalid_string,message:n.message}),s.dirty()):n.kind==="jwt"?ld(e.data,n.alg)||(r=this._getOrReturnCtx(e,r),D(r,{validation:"jwt",code:R.invalid_string,message:n.message}),s.dirty()):n.kind==="cidr"?cd(e.data,n.version)||(r=this._getOrReturnCtx(e,r),D(r,{validation:"cidr",code:R.invalid_string,message:n.message}),s.dirty()):n.kind==="base64"?ad.test(e.data)||(r=this._getOrReturnCtx(e,r),D(r,{validation:"base64",code:R.invalid_string,message:n.message}),s.dirty()):n.kind==="base64url"?sd.test(e.data)||(r=this._getOrReturnCtx(e,r),D(r,{validation:"base64url",code:R.invalid_string,message:n.message}),s.dirty()):X.assertNever(n);return{status:s.value,value:e.data}}_regex(e,t,s){return this.refinement(r=>e.test(r),{validation:t,code:R.invalid_string,...V.errToObj(s)})}_addCheck(e){return new a({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...V.errToObj(e)})}url(e){return this._addCheck({kind:"url",...V.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...V.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...V.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...V.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...V.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...V.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...V.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...V.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...V.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...V.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...V.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...V.errToObj(e)})}datetime(e){var t,s;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof(e==null?void 0:e.precision)=="undefined"?null:e==null?void 0:e.precision,offset:(t=e==null?void 0:e.offset)!=null?t:!1,local:(s=e==null?void 0:e.local)!=null?s:!1,...V.errToObj(e==null?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof(e==null?void 0:e.precision)=="undefined"?null:e==null?void 0:e.precision,...V.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...V.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...V.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t==null?void 0:t.position,...V.errToObj(t==null?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...V.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...V.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...V.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...V.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...V.errToObj(t)})}nonempty(e){return this.min(1,V.errToObj(e))}trim(){return new a({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new a({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new a({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}};Sr.create=a=>{var e;return new Sr({checks:[],typeName:T.ZodString,coerce:(e=a==null?void 0:a.coerce)!=null?e:!1,...Q(a)})};function ud(a,e){let t=(a.toString().split(".")[1]||"").length,s=(e.toString().split(".")[1]||"").length,r=t>s?t:s,n=Number.parseInt(a.toFixed(r).replace(".","")),o=Number.parseInt(e.toFixed(r).replace(".",""));return n%o/10**r}var Ur=class a extends G{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==j.number){let n=this._getOrReturnCtx(e);return D(n,{code:R.invalid_type,expected:j.number,received:n.parsedType}),B}let s,r=new Re;for(let n of this._def.checks)n.kind==="int"?X.isInteger(e.data)||(s=this._getOrReturnCtx(e,s),D(s,{code:R.invalid_type,expected:"integer",received:"float",message:n.message}),r.dirty()):n.kind==="min"?(n.inclusive?e.data<n.value:e.data<=n.value)&&(s=this._getOrReturnCtx(e,s),D(s,{code:R.too_small,minimum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),r.dirty()):n.kind==="max"?(n.inclusive?e.data>n.value:e.data>=n.value)&&(s=this._getOrReturnCtx(e,s),D(s,{code:R.too_big,maximum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),r.dirty()):n.kind==="multipleOf"?ud(e.data,n.value)!==0&&(s=this._getOrReturnCtx(e,s),D(s,{code:R.not_multiple_of,multipleOf:n.value,message:n.message}),r.dirty()):n.kind==="finite"?Number.isFinite(e.data)||(s=this._getOrReturnCtx(e,s),D(s,{code:R.not_finite,message:n.message}),r.dirty()):X.assertNever(n);return{status:r.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,V.toString(t))}gt(e,t){return this.setLimit("min",e,!1,V.toString(t))}lte(e,t){return this.setLimit("max",e,!0,V.toString(t))}lt(e,t){return this.setLimit("max",e,!1,V.toString(t))}setLimit(e,t,s,r){return new a({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:V.toString(r)}]})}_addCheck(e){return new a({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:V.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:V.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:V.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:V.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:V.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:V.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:V.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:V.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:V.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&X.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let s of this._def.checks){if(s.kind==="finite"||s.kind==="int"||s.kind==="multipleOf")return!0;s.kind==="min"?(t===null||s.value>t)&&(t=s.value):s.kind==="max"&&(e===null||s.value<e)&&(e=s.value)}return Number.isFinite(t)&&Number.isFinite(e)}};Ur.create=a=>new Ur({checks:[],typeName:T.ZodNumber,coerce:(a==null?void 0:a.coerce)||!1,...Q(a)});var zr=class a extends G{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==j.bigint)return this._getInvalidInput(e);let s,r=new Re;for(let n of this._def.checks)n.kind==="min"?(n.inclusive?e.data<n.value:e.data<=n.value)&&(s=this._getOrReturnCtx(e,s),D(s,{code:R.too_small,type:"bigint",minimum:n.value,inclusive:n.inclusive,message:n.message}),r.dirty()):n.kind==="max"?(n.inclusive?e.data>n.value:e.data>=n.value)&&(s=this._getOrReturnCtx(e,s),D(s,{code:R.too_big,type:"bigint",maximum:n.value,inclusive:n.inclusive,message:n.message}),r.dirty()):n.kind==="multipleOf"?e.data%n.value!==BigInt(0)&&(s=this._getOrReturnCtx(e,s),D(s,{code:R.not_multiple_of,multipleOf:n.value,message:n.message}),r.dirty()):X.assertNever(n);return{status:r.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return D(t,{code:R.invalid_type,expected:j.bigint,received:t.parsedType}),B}gte(e,t){return this.setLimit("min",e,!0,V.toString(t))}gt(e,t){return this.setLimit("min",e,!1,V.toString(t))}lte(e,t){return this.setLimit("max",e,!0,V.toString(t))}lt(e,t){return this.setLimit("max",e,!1,V.toString(t))}setLimit(e,t,s,r){return new a({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:V.toString(r)}]})}_addCheck(e){return new a({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:V.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:V.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:V.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:V.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:V.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}};zr.create=a=>{var e;return new zr({checks:[],typeName:T.ZodBigInt,coerce:(e=a==null?void 0:a.coerce)!=null?e:!1,...Q(a)})};var Vr=class extends G{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==j.boolean){let s=this._getOrReturnCtx(e);return D(s,{code:R.invalid_type,expected:j.boolean,received:s.parsedType}),B}return $e(e.data)}};Vr.create=a=>new Vr({typeName:T.ZodBoolean,coerce:(a==null?void 0:a.coerce)||!1,...Q(a)});var Hr=class a extends G{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==j.date){let n=this._getOrReturnCtx(e);return D(n,{code:R.invalid_type,expected:j.date,received:n.parsedType}),B}if(Number.isNaN(e.data.getTime())){let n=this._getOrReturnCtx(e);return D(n,{code:R.invalid_date}),B}let s=new Re,r;for(let n of this._def.checks)n.kind==="min"?e.data.getTime()<n.value&&(r=this._getOrReturnCtx(e,r),D(r,{code:R.too_small,message:n.message,inclusive:!0,exact:!1,minimum:n.value,type:"date"}),s.dirty()):n.kind==="max"?e.data.getTime()>n.value&&(r=this._getOrReturnCtx(e,r),D(r,{code:R.too_big,message:n.message,inclusive:!0,exact:!1,maximum:n.value,type:"date"}),s.dirty()):X.assertNever(n);return{status:s.value,value:new Date(e.data.getTime())}}_addCheck(e){return new a({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:V.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:V.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e!=null?new Date(e):null}};Hr.create=a=>new Hr({checks:[],coerce:(a==null?void 0:a.coerce)||!1,typeName:T.ZodDate,...Q(a)});var _t=class extends G{_parse(e){if(this._getType(e)!==j.symbol){let s=this._getOrReturnCtx(e);return D(s,{code:R.invalid_type,expected:j.symbol,received:s.parsedType}),B}return $e(e.data)}};_t.create=a=>new _t({typeName:T.ZodSymbol,...Q(a)});var Zr=class extends G{_parse(e){if(this._getType(e)!==j.undefined){let s=this._getOrReturnCtx(e);return D(s,{code:R.invalid_type,expected:j.undefined,received:s.parsedType}),B}return $e(e.data)}};Zr.create=a=>new Zr({typeName:T.ZodUndefined,...Q(a)});var Br=class extends G{_parse(e){if(this._getType(e)!==j.null){let s=this._getOrReturnCtx(e);return D(s,{code:R.invalid_type,expected:j.null,received:s.parsedType}),B}return $e(e.data)}};Br.create=a=>new Br({typeName:T.ZodNull,...Q(a)});var Rr=class extends G{constructor(){super(...arguments),this._any=!0}_parse(e){return $e(e.data)}};Rr.create=a=>new Rr({typeName:T.ZodAny,...Q(a)});var gr=class extends G{constructor(){super(...arguments),this._unknown=!0}_parse(e){return $e(e.data)}};gr.create=a=>new gr({typeName:T.ZodUnknown,...Q(a)});var Ye=class extends G{_parse(e){let t=this._getOrReturnCtx(e);return D(t,{code:R.invalid_type,expected:j.never,received:t.parsedType}),B}};Ye.create=a=>new Ye({typeName:T.ZodNever,...Q(a)});var bt=class extends G{_parse(e){if(this._getType(e)!==j.undefined){let s=this._getOrReturnCtx(e);return D(s,{code:R.invalid_type,expected:j.void,received:s.parsedType}),B}return $e(e.data)}};bt.create=a=>new bt({typeName:T.ZodVoid,...Q(a)});var yr=class a extends G{_parse(e){let{ctx:t,status:s}=this._processInputParams(e),r=this._def;if(t.parsedType!==j.array)return D(t,{code:R.invalid_type,expected:j.array,received:t.parsedType}),B;if(r.exactLength!==null){let o=t.data.length>r.exactLength.value,i=t.data.length<r.exactLength.value;(o||i)&&(D(t,{code:o?R.too_big:R.too_small,minimum:i?r.exactLength.value:void 0,maximum:o?r.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:r.exactLength.message}),s.dirty())}if(r.minLength!==null&&t.data.length<r.minLength.value&&(D(t,{code:R.too_small,minimum:r.minLength.value,type:"array",inclusive:!0,exact:!1,message:r.minLength.message}),s.dirty()),r.maxLength!==null&&t.data.length>r.maxLength.value&&(D(t,{code:R.too_big,maximum:r.maxLength.value,type:"array",inclusive:!0,exact:!1,message:r.maxLength.message}),s.dirty()),t.common.async)return Promise.all([...t.data].map((o,i)=>r.type._parseAsync(new Je(t,o,t.path,i)))).then(o=>Re.mergeArray(s,o));let n=[...t.data].map((o,i)=>r.type._parseSync(new Je(t,o,t.path,i)));return Re.mergeArray(s,n)}get element(){return this._def.type}min(e,t){return new a({...this._def,minLength:{value:e,message:V.toString(t)}})}max(e,t){return new a({...this._def,maxLength:{value:e,message:V.toString(t)}})}length(e,t){return new a({...this._def,exactLength:{value:e,message:V.toString(t)}})}nonempty(e){return this.min(1,e)}};yr.create=(a,e)=>new yr({type:a,minLength:null,maxLength:null,exactLength:null,typeName:T.ZodArray,...Q(e)});function yt(a){if(a instanceof Fe){let e={};for(let t in a.shape){let s=a.shape[t];e[t]=Be.create(yt(s))}return new Fe({...a._def,shape:()=>e})}else return a instanceof yr?new yr({...a._def,type:yt(a.element)}):a instanceof Be?Be.create(yt(a.unwrap())):a instanceof ir?ir.create(yt(a.unwrap())):a instanceof or?or.create(a.items.map(e=>yt(e))):a}var Fe=class a extends G{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),t=X.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==j.object){let c=this._getOrReturnCtx(e);return D(c,{code:R.invalid_type,expected:j.object,received:c.parsedType}),B}let{status:s,ctx:r}=this._processInputParams(e),{shape:n,keys:o}=this._getCached(),i=[];if(!(this._def.catchall instanceof Ye&&this._def.unknownKeys==="strip"))for(let c in r.data)o.includes(c)||i.push(c);let u=[];for(let c of o){let f=n[c],p=r.data[c];u.push({key:{status:"valid",value:c},value:f._parse(new Je(r,p,r.path,c)),alwaysSet:c in r.data})}if(this._def.catchall instanceof Ye){let c=this._def.unknownKeys;if(c==="passthrough")for(let f of i)u.push({key:{status:"valid",value:f},value:{status:"valid",value:r.data[f]}});else if(c==="strict")i.length>0&&(D(r,{code:R.unrecognized_keys,keys:i}),s.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let c=this._def.catchall;for(let f of i){let p=r.data[f];u.push({key:{status:"valid",value:f},value:c._parse(new Je(r,p,r.path,f)),alwaysSet:f in r.data})}}return r.common.async?Promise.resolve().then(async()=>{let c=[];for(let f of u){let p=await f.key,g=await f.value;c.push({key:p,value:g,alwaysSet:f.alwaysSet})}return c}).then(c=>Re.mergeObjectSync(s,c)):Re.mergeObjectSync(s,u)}get shape(){return this._def.shape()}strict(e){return V.errToObj,new a({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,s)=>{var n,o,i,u;let r=(i=(o=(n=this._def).errorMap)==null?void 0:o.call(n,t,s).message)!=null?i:s.defaultError;return t.code==="unrecognized_keys"?{message:(u=V.errToObj(e).message)!=null?u:r}:{message:r}}}:{}})}strip(){return new a({...this._def,unknownKeys:"strip"})}passthrough(){return new a({...this._def,unknownKeys:"passthrough"})}extend(e){return new a({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new a({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:T.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new a({...this._def,catchall:e})}pick(e){let t={};for(let s of X.objectKeys(e))e[s]&&this.shape[s]&&(t[s]=this.shape[s]);return new a({...this._def,shape:()=>t})}omit(e){let t={};for(let s of X.objectKeys(this.shape))e[s]||(t[s]=this.shape[s]);return new a({...this._def,shape:()=>t})}deepPartial(){return yt(this)}partial(e){let t={};for(let s of X.objectKeys(this.shape)){let r=this.shape[s];e&&!e[s]?t[s]=r:t[s]=r.optional()}return new a({...this._def,shape:()=>t})}required(e){let t={};for(let s of X.objectKeys(this.shape))if(e&&!e[s])t[s]=this.shape[s];else{let n=this.shape[s];for(;n instanceof Be;)n=n._def.innerType;t[s]=n}return new a({...this._def,shape:()=>t})}keyof(){return Gn(X.objectKeys(this.shape))}};Fe.create=(a,e)=>new Fe({shape:()=>a,unknownKeys:"strip",catchall:Ye.create(),typeName:T.ZodObject,...Q(e)});Fe.strictCreate=(a,e)=>new Fe({shape:()=>a,unknownKeys:"strict",catchall:Ye.create(),typeName:T.ZodObject,...Q(e)});Fe.lazycreate=(a,e)=>new Fe({shape:a,unknownKeys:"strip",catchall:Ye.create(),typeName:T.ZodObject,...Q(e)});var Jr=class extends G{_parse(e){let{ctx:t}=this._processInputParams(e),s=this._def.options;function r(n){for(let i of n)if(i.result.status==="valid")return i.result;for(let i of n)if(i.result.status==="dirty")return t.common.issues.push(...i.ctx.common.issues),i.result;let o=n.map(i=>new Le(i.ctx.common.issues));return D(t,{code:R.invalid_union,unionErrors:o}),B}if(t.common.async)return Promise.all(s.map(async n=>{let o={...t,common:{...t.common,issues:[]},parent:null};return{result:await n._parseAsync({data:t.data,path:t.path,parent:o}),ctx:o}})).then(r);{let n,o=[];for(let u of s){let c={...t,common:{...t.common,issues:[]},parent:null},f=u._parseSync({data:t.data,path:t.path,parent:c});if(f.status==="valid")return f;f.status==="dirty"&&!n&&(n={result:f,ctx:c}),c.common.issues.length&&o.push(c.common.issues)}if(n)return t.common.issues.push(...n.ctx.common.issues),n.result;let i=o.map(u=>new Le(u));return D(t,{code:R.invalid_union,unionErrors:i}),B}}get options(){return this._def.options}};Jr.create=(a,e)=>new Jr({options:a,typeName:T.ZodUnion,...Q(e)});var vr=a=>a instanceof Kr?vr(a.schema):a instanceof Qe?vr(a.innerType()):a instanceof Gr?[a.value]:a instanceof Wr?a.options:a instanceof Yr?X.objectValues(a.enum):a instanceof Xr?vr(a._def.innerType):a instanceof Zr?[void 0]:a instanceof Br?[null]:a instanceof Be?[void 0,...vr(a.unwrap())]:a instanceof ir?[null,...vr(a.unwrap())]:a instanceof Ft||a instanceof rt?vr(a.unwrap()):a instanceof et?vr(a._def.innerType):[],ha=class a extends G{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==j.object)return D(t,{code:R.invalid_type,expected:j.object,received:t.parsedType}),B;let s=this.discriminator,r=t.data[s],n=this.optionsMap.get(r);return n?t.common.async?n._parseAsync({data:t.data,path:t.path,parent:t}):n._parseSync({data:t.data,path:t.path,parent:t}):(D(t,{code:R.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[s]}),B)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,s){let r=new Map;for(let n of t){let o=vr(n.shape[e]);if(!o.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let i of o){if(r.has(i))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(i)}`);r.set(i,n)}}return new a({typeName:T.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:r,...Q(s)})}};function hs(a,e){let t=nr(a),s=nr(e);if(a===e)return{valid:!0,data:a};if(t===j.object&&s===j.object){let r=X.objectKeys(e),n=X.objectKeys(a).filter(i=>r.indexOf(i)!==-1),o={...a,...e};for(let i of n){let u=hs(a[i],e[i]);if(!u.valid)return{valid:!1};o[i]=u.data}return{valid:!0,data:o}}else if(t===j.array&&s===j.array){if(a.length!==e.length)return{valid:!1};let r=[];for(let n=0;n<a.length;n++){let o=a[n],i=e[n],u=hs(o,i);if(!u.valid)return{valid:!1};r.push(u.data)}return{valid:!0,data:r}}else return t===j.date&&s===j.date&&+a==+e?{valid:!0,data:a}:{valid:!1}}var Qr=class extends G{_parse(e){let{status:t,ctx:s}=this._processInputParams(e),r=(n,o)=>{if(da(n)||da(o))return B;let i=hs(n.value,o.value);return i.valid?((fa(n)||fa(o))&&t.dirty(),{status:t.value,value:i.data}):(D(s,{code:R.invalid_intersection_types}),B)};return s.common.async?Promise.all([this._def.left._parseAsync({data:s.data,path:s.path,parent:s}),this._def.right._parseAsync({data:s.data,path:s.path,parent:s})]).then(([n,o])=>r(n,o)):r(this._def.left._parseSync({data:s.data,path:s.path,parent:s}),this._def.right._parseSync({data:s.data,path:s.path,parent:s}))}};Qr.create=(a,e,t)=>new Qr({left:a,right:e,typeName:T.ZodIntersection,...Q(t)});var or=class a extends G{_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==j.array)return D(s,{code:R.invalid_type,expected:j.array,received:s.parsedType}),B;if(s.data.length<this._def.items.length)return D(s,{code:R.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),B;!this._def.rest&&s.data.length>this._def.items.length&&(D(s,{code:R.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());let n=[...s.data].map((o,i)=>{let u=this._def.items[i]||this._def.rest;return u?u._parse(new Je(s,o,s.path,i)):null}).filter(o=>!!o);return s.common.async?Promise.all(n).then(o=>Re.mergeArray(t,o)):Re.mergeArray(t,n)}get items(){return this._def.items}rest(e){return new a({...this._def,rest:e})}};or.create=(a,e)=>{if(!Array.isArray(a))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new or({items:a,typeName:T.ZodTuple,rest:null,...Q(e)})};var pa=class a extends G{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==j.object)return D(s,{code:R.invalid_type,expected:j.object,received:s.parsedType}),B;let r=[],n=this._def.keyType,o=this._def.valueType;for(let i in s.data)r.push({key:n._parse(new Je(s,i,s.path,i)),value:o._parse(new Je(s,s.data[i],s.path,i)),alwaysSet:i in s.data});return s.common.async?Re.mergeObjectAsync(t,r):Re.mergeObjectSync(t,r)}get element(){return this._def.valueType}static create(e,t,s){return t instanceof G?new a({keyType:e,valueType:t,typeName:T.ZodRecord,...Q(s)}):new a({keyType:Sr.create(),valueType:e,typeName:T.ZodRecord,...Q(t)})}},xt=class extends G{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==j.map)return D(s,{code:R.invalid_type,expected:j.map,received:s.parsedType}),B;let r=this._def.keyType,n=this._def.valueType,o=[...s.data.entries()].map(([i,u],c)=>({key:r._parse(new Je(s,i,s.path,[c,"key"])),value:n._parse(new Je(s,u,s.path,[c,"value"]))}));if(s.common.async){let i=new Map;return Promise.resolve().then(async()=>{for(let u of o){let c=await u.key,f=await u.value;if(c.status==="aborted"||f.status==="aborted")return B;(c.status==="dirty"||f.status==="dirty")&&t.dirty(),i.set(c.value,f.value)}return{status:t.value,value:i}})}else{let i=new Map;for(let u of o){let c=u.key,f=u.value;if(c.status==="aborted"||f.status==="aborted")return B;(c.status==="dirty"||f.status==="dirty")&&t.dirty(),i.set(c.value,f.value)}return{status:t.value,value:i}}}};xt.create=(a,e,t)=>new xt({valueType:e,keyType:a,typeName:T.ZodMap,...Q(t)});var wt=class a extends G{_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==j.set)return D(s,{code:R.invalid_type,expected:j.set,received:s.parsedType}),B;let r=this._def;r.minSize!==null&&s.data.size<r.minSize.value&&(D(s,{code:R.too_small,minimum:r.minSize.value,type:"set",inclusive:!0,exact:!1,message:r.minSize.message}),t.dirty()),r.maxSize!==null&&s.data.size>r.maxSize.value&&(D(s,{code:R.too_big,maximum:r.maxSize.value,type:"set",inclusive:!0,exact:!1,message:r.maxSize.message}),t.dirty());let n=this._def.valueType;function o(u){let c=new Set;for(let f of u){if(f.status==="aborted")return B;f.status==="dirty"&&t.dirty(),c.add(f.value)}return{status:t.value,value:c}}let i=[...s.data.values()].map((u,c)=>n._parse(new Je(s,u,s.path,c)));return s.common.async?Promise.all(i).then(u=>o(u)):o(i)}min(e,t){return new a({...this._def,minSize:{value:e,message:V.toString(t)}})}max(e,t){return new a({...this._def,maxSize:{value:e,message:V.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};wt.create=(a,e)=>new wt({valueType:a,minSize:null,maxSize:null,typeName:T.ZodSet,...Q(e)});var ma=class a extends G{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==j.function)return D(t,{code:R.invalid_type,expected:j.function,received:t.parsedType}),B;function s(i,u){return Lt({data:i,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,vt(),mr].filter(c=>!!c),issueData:{code:R.invalid_arguments,argumentsError:u}})}function r(i,u){return Lt({data:i,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,vt(),mr].filter(c=>!!c),issueData:{code:R.invalid_return_type,returnTypeError:u}})}let n={errorMap:t.common.contextualErrorMap},o=t.data;if(this._def.returns instanceof Or){let i=this;return $e(async function(...u){let c=new Le([]),f=await i._def.args.parseAsync(u,n).catch(d=>{throw c.addIssue(s(u,d)),c}),p=await Reflect.apply(o,this,f);return await i._def.returns._def.type.parseAsync(p,n).catch(d=>{throw c.addIssue(r(p,d)),c})})}else{let i=this;return $e(function(...u){let c=i._def.args.safeParse(u,n);if(!c.success)throw new Le([s(u,c.error)]);let f=Reflect.apply(o,this,c.data),p=i._def.returns.safeParse(f,n);if(!p.success)throw new Le([r(f,p.error)]);return p.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new a({...this._def,args:or.create(e).rest(gr.create())})}returns(e){return new a({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,s){return new a({args:e||or.create([]).rest(gr.create()),returns:t||gr.create(),typeName:T.ZodFunction,...Q(s)})}},Kr=class extends G{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})}};Kr.create=(a,e)=>new Kr({getter:a,typeName:T.ZodLazy,...Q(e)});var Gr=class extends G{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return D(t,{received:t.data,code:R.invalid_literal,expected:this._def.value}),B}return{status:"valid",value:e.data}}get value(){return this._def.value}};Gr.create=(a,e)=>new Gr({value:a,typeName:T.ZodLiteral,...Q(e)});function Gn(a,e){return new Wr({values:a,typeName:T.ZodEnum,...Q(e)})}var Wr=class a extends G{_parse(e){if(typeof e.data!="string"){let t=this._getOrReturnCtx(e),s=this._def.values;return D(t,{expected:X.joinValues(s),received:t.parsedType,code:R.invalid_type}),B}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let t=this._getOrReturnCtx(e),s=this._def.values;return D(t,{received:t.data,code:R.invalid_enum_value,options:s}),B}return $e(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 a.create(e,{...this._def,...t})}exclude(e,t=this._def){return a.create(this.options.filter(s=>!e.includes(s)),{...this._def,...t})}};Wr.create=Gn;var Yr=class extends G{_parse(e){let t=X.getValidEnumValues(this._def.values),s=this._getOrReturnCtx(e);if(s.parsedType!==j.string&&s.parsedType!==j.number){let r=X.objectValues(t);return D(s,{expected:X.joinValues(r),received:s.parsedType,code:R.invalid_type}),B}if(this._cache||(this._cache=new Set(X.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let r=X.objectValues(t);return D(s,{received:s.data,code:R.invalid_enum_value,options:r}),B}return $e(e.data)}get enum(){return this._def.values}};Yr.create=(a,e)=>new Yr({values:a,typeName:T.ZodNativeEnum,...Q(e)});var Or=class extends G{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==j.promise&&t.common.async===!1)return D(t,{code:R.invalid_type,expected:j.promise,received:t.parsedType}),B;let s=t.parsedType===j.promise?t.data:Promise.resolve(t.data);return $e(s.then(r=>this._def.type.parseAsync(r,{path:t.path,errorMap:t.common.contextualErrorMap})))}};Or.create=(a,e)=>new Or({type:a,typeName:T.ZodPromise,...Q(e)});var Qe=class extends G{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===T.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:s}=this._processInputParams(e),r=this._def.effect||null,n={addIssue:o=>{D(s,o),o.fatal?t.abort():t.dirty()},get path(){return s.path}};if(n.addIssue=n.addIssue.bind(n),r.type==="preprocess"){let o=r.transform(s.data,n);if(s.common.async)return Promise.resolve(o).then(async i=>{if(t.value==="aborted")return B;let u=await this._def.schema._parseAsync({data:i,path:s.path,parent:s});return u.status==="aborted"?B:u.status==="dirty"?qr(u.value):t.value==="dirty"?qr(u.value):u});{if(t.value==="aborted")return B;let i=this._def.schema._parseSync({data:o,path:s.path,parent:s});return i.status==="aborted"?B:i.status==="dirty"?qr(i.value):t.value==="dirty"?qr(i.value):i}}if(r.type==="refinement"){let o=i=>{let u=r.refinement(i,n);if(s.common.async)return Promise.resolve(u);if(u instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return i};if(s.common.async===!1){let i=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});return i.status==="aborted"?B:(i.status==="dirty"&&t.dirty(),o(i.value),{status:t.value,value:i.value})}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(i=>i.status==="aborted"?B:(i.status==="dirty"&&t.dirty(),o(i.value).then(()=>({status:t.value,value:i.value}))))}if(r.type==="transform")if(s.common.async===!1){let o=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});if(!Pr(o))return B;let i=r.transform(o.value,n);if(i instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:i}}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(o=>Pr(o)?Promise.resolve(r.transform(o.value,n)).then(i=>({status:t.value,value:i})):B);X.assertNever(r)}};Qe.create=(a,e,t)=>new Qe({schema:a,typeName:T.ZodEffects,effect:e,...Q(t)});Qe.createWithPreprocess=(a,e,t)=>new Qe({schema:e,effect:{type:"preprocess",transform:a},typeName:T.ZodEffects,...Q(t)});var Be=class extends G{_parse(e){return this._getType(e)===j.undefined?$e(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Be.create=(a,e)=>new Be({innerType:a,typeName:T.ZodOptional,...Q(e)});var ir=class extends G{_parse(e){return this._getType(e)===j.null?$e(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};ir.create=(a,e)=>new ir({innerType:a,typeName:T.ZodNullable,...Q(e)});var Xr=class extends G{_parse(e){let{ctx:t}=this._processInputParams(e),s=t.data;return t.parsedType===j.undefined&&(s=this._def.defaultValue()),this._def.innerType._parse({data:s,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};Xr.create=(a,e)=>new Xr({innerType:a,typeName:T.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...Q(e)});var et=class extends G{_parse(e){let{ctx:t}=this._processInputParams(e),s={...t,common:{...t.common,issues:[]}},r=this._def.innerType._parse({data:s.data,path:s.path,parent:{...s}});return gt(r)?r.then(n=>({status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new Le(s.common.issues)},input:s.data})})):{status:"valid",value:r.status==="valid"?r.value:this._def.catchValue({get error(){return new Le(s.common.issues)},input:s.data})}}removeCatch(){return this._def.innerType}};et.create=(a,e)=>new et({innerType:a,typeName:T.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...Q(e)});var Et=class extends G{_parse(e){if(this._getType(e)!==j.nan){let s=this._getOrReturnCtx(e);return D(s,{code:R.invalid_type,expected:j.nan,received:s.parsedType}),B}return{status:"valid",value:e.data}}};Et.create=a=>new Et({typeName:T.ZodNaN,...Q(a)});var dd=Symbol("zod_brand"),Ft=class extends G{_parse(e){let{ctx:t}=this._processInputParams(e),s=t.data;return this._def.type._parse({data:s,path:t.path,parent:t})}unwrap(){return this._def.type}},Mt=class a extends G{_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.common.async)return(async()=>{let n=await this._def.in._parseAsync({data:s.data,path:s.path,parent:s});return n.status==="aborted"?B:n.status==="dirty"?(t.dirty(),qr(n.value)):this._def.out._parseAsync({data:n.value,path:s.path,parent:s})})();{let r=this._def.in._parseSync({data:s.data,path:s.path,parent:s});return r.status==="aborted"?B:r.status==="dirty"?(t.dirty(),{status:"dirty",value:r.value}):this._def.out._parseSync({data:r.value,path:s.path,parent:s})}}static create(e,t){return new a({in:e,out:t,typeName:T.ZodPipeline})}},rt=class extends G{_parse(e){let t=this._def.innerType._parse(e),s=r=>(Pr(r)&&(r.value=Object.freeze(r.value)),r);return gt(t)?t.then(r=>s(r)):s(t)}unwrap(){return this._def.innerType}};rt.create=(a,e)=>new rt({innerType:a,typeName:T.ZodReadonly,...Q(e)});function Bn(a,e){let t=typeof a=="function"?a(e):typeof a=="string"?{message:a}:a;return typeof t=="string"?{message:t}:t}function Wn(a,e={},t){return a?Rr.create().superRefine((s,r)=>{var o,i;let n=a(s);if(n instanceof Promise)return n.then(u=>{var c,f;if(!u){let p=Bn(e,s),g=(f=(c=p.fatal)!=null?c:t)!=null?f:!0;r.addIssue({code:"custom",...p,fatal:g})}});if(!n){let u=Bn(e,s),c=(i=(o=u.fatal)!=null?o:t)!=null?i:!0;r.addIssue({code:"custom",...u,fatal:c})}}):Rr.create()}var fd={object:Fe.lazycreate},T;(function(a){a.ZodString="ZodString",a.ZodNumber="ZodNumber",a.ZodNaN="ZodNaN",a.ZodBigInt="ZodBigInt",a.ZodBoolean="ZodBoolean",a.ZodDate="ZodDate",a.ZodSymbol="ZodSymbol",a.ZodUndefined="ZodUndefined",a.ZodNull="ZodNull",a.ZodAny="ZodAny",a.ZodUnknown="ZodUnknown",a.ZodNever="ZodNever",a.ZodVoid="ZodVoid",a.ZodArray="ZodArray",a.ZodObject="ZodObject",a.ZodUnion="ZodUnion",a.ZodDiscriminatedUnion="ZodDiscriminatedUnion",a.ZodIntersection="ZodIntersection",a.ZodTuple="ZodTuple",a.ZodRecord="ZodRecord",a.ZodMap="ZodMap",a.ZodSet="ZodSet",a.ZodFunction="ZodFunction",a.ZodLazy="ZodLazy",a.ZodLiteral="ZodLiteral",a.ZodEnum="ZodEnum",a.ZodEffects="ZodEffects",a.ZodNativeEnum="ZodNativeEnum",a.ZodOptional="ZodOptional",a.ZodNullable="ZodNullable",a.ZodDefault="ZodDefault",a.ZodCatch="ZodCatch",a.ZodPromise="ZodPromise",a.ZodBranded="ZodBranded",a.ZodPipeline="ZodPipeline",a.ZodReadonly="ZodReadonly"})(T||(T={}));var hd=(a,e={message:`Input not instance of ${a.name}`})=>Wn(t=>t instanceof a,e),Yn=Sr.create,Xn=Ur.create,pd=Et.create,md=zr.create,eo=Vr.create,vd=Hr.create,gd=_t.create,yd=Zr.create,_d=Br.create,bd=Rr.create,xd=gr.create,wd=Ye.create,Ed=bt.create,Pd=yr.create,Sd=Fe.create,Rd=Fe.strictCreate,Od=Jr.create,Td=ha.create,$d=Qr.create,Ad=or.create,Id=pa.create,Cd=xt.create,kd=wt.create,Dd=ma.create,jd=Kr.create,Nd=Gr.create,Ld=Wr.create,Fd=Yr.create,Md=Or.create,qd=Qe.create,Ud=Be.create,zd=ir.create,Vd=Qe.createWithPreprocess,Hd=Mt.create,Zd=()=>Yn().optional(),Bd=()=>Xn().optional(),Jd=()=>eo().optional(),Qd={string:a=>Sr.create({...a,coerce:!0}),number:a=>Ur.create({...a,coerce:!0}),boolean:a=>Vr.create({...a,coerce:!0}),bigint:a=>zr.create({...a,coerce:!0}),date:a=>Hr.create({...a,coerce:!0})};var Kd=B;var Tr="2025-06-18",ro="2025-03-26",tt=[Tr,"2025-03-26","2024-11-05","2024-10-07"],va="2.0",to=l.union([l.string(),l.number().int()]),ao=l.string(),Gd=l.object({progressToken:l.optional(to)}).passthrough(),Ke=l.object({_meta:l.optional(Gd)}).passthrough(),Me=l.object({method:l.string(),params:l.optional(Ke)}),qt=l.object({_meta:l.optional(l.object({}).passthrough())}).passthrough(),lr=l.object({method:l.string(),params:l.optional(qt)}),Ge=l.object({_meta:l.optional(l.object({}).passthrough())}).passthrough(),ga=l.union([l.string(),l.number().int()]),so=l.object({jsonrpc:l.literal(va),id:ga}).merge(Me).strict(),at=a=>so.safeParse(a).success,no=l.object({jsonrpc:l.literal(va)}).merge(lr).strict(),oo=a=>no.safeParse(a).success,io=l.object({jsonrpc:l.literal(va),id:ga,result:Ge}).strict(),_r=a=>io.safeParse(a).success,De;(function(a){a[a.ConnectionClosed=-32e3]="ConnectionClosed",a[a.RequestTimeout=-32001]="RequestTimeout",a[a.ParseError=-32700]="ParseError",a[a.InvalidRequest=-32600]="InvalidRequest",a[a.MethodNotFound=-32601]="MethodNotFound",a[a.InvalidParams=-32602]="InvalidParams",a[a.InternalError=-32603]="InternalError"})(De||(De={}));var lo=l.object({jsonrpc:l.literal(va),id:ga,error:l.object({code:l.number().int(),message:l.string(),data:l.optional(l.unknown())})}).strict(),Pt=a=>lo.safeParse(a).success,Xe=l.union([so,no,io,lo]),br=Ge.strict(),ya=lr.extend({method:l.literal("notifications/cancelled"),params:qt.extend({requestId:ga,reason:l.string().optional()})}),Ut=l.object({name:l.string(),title:l.optional(l.string())}).passthrough(),co=Ut.extend({version:l.string()}),Wd=l.object({experimental:l.optional(l.object({}).passthrough()),sampling:l.optional(l.object({}).passthrough()),elicitation:l.optional(l.object({}).passthrough()),roots:l.optional(l.object({listChanged:l.optional(l.boolean())}).passthrough())}).passthrough(),_a=Me.extend({method:l.literal("initialize"),params:Ke.extend({protocolVersion:l.string(),capabilities:Wd,clientInfo:co})}),uo=a=>_a.safeParse(a).success,Yd=l.object({experimental:l.optional(l.object({}).passthrough()),logging:l.optional(l.object({}).passthrough()),completions:l.optional(l.object({}).passthrough()),prompts:l.optional(l.object({listChanged:l.optional(l.boolean())}).passthrough()),resources:l.optional(l.object({subscribe:l.optional(l.boolean()),listChanged:l.optional(l.boolean())}).passthrough()),tools:l.optional(l.object({listChanged:l.optional(l.boolean())}).passthrough())}).passthrough(),ps=Ge.extend({protocolVersion:l.string(),capabilities:Yd,serverInfo:co,instructions:l.optional(l.string())}),ba=lr.extend({method:l.literal("notifications/initialized")}),fo=a=>ba.safeParse(a).success,St=Me.extend({method:l.literal("ping")}),Xd=l.object({progress:l.number(),total:l.optional(l.number()),message:l.optional(l.string())}).passthrough(),xa=lr.extend({method:l.literal("notifications/progress"),params:qt.merge(Xd).extend({progressToken:to})}),wa=Me.extend({params:Ke.extend({cursor:l.optional(ao)}).optional()}),Ea=Ge.extend({nextCursor:l.optional(ao)}),ho=l.object({uri:l.string(),mimeType:l.optional(l.string()),_meta:l.optional(l.object({}).passthrough())}).passthrough(),po=ho.extend({text:l.string()}),ms=l.string().refine(a=>{try{return atob(a),!0}catch{return!1}},{message:"Invalid Base64 string"}),mo=ho.extend({blob:ms}),vo=Ut.extend({uri:l.string(),description:l.optional(l.string()),mimeType:l.optional(l.string()),_meta:l.optional(l.object({}).passthrough())}),ef=Ut.extend({uriTemplate:l.string(),description:l.optional(l.string()),mimeType:l.optional(l.string()),_meta:l.optional(l.object({}).passthrough())}),rf=wa.extend({method:l.literal("resources/list")}),vs=Ea.extend({resources:l.array(vo)}),tf=wa.extend({method:l.literal("resources/templates/list")}),gs=Ea.extend({resourceTemplates:l.array(ef)}),af=Me.extend({method:l.literal("resources/read"),params:Ke.extend({uri:l.string()})}),ys=Ge.extend({contents:l.array(l.union([po,mo]))}),sf=lr.extend({method:l.literal("notifications/resources/list_changed")}),nf=Me.extend({method:l.literal("resources/subscribe"),params:Ke.extend({uri:l.string()})}),of=Me.extend({method:l.literal("resources/unsubscribe"),params:Ke.extend({uri:l.string()})}),lf=lr.extend({method:l.literal("notifications/resources/updated"),params:qt.extend({uri:l.string()})}),cf=l.object({name:l.string(),description:l.optional(l.string()),required:l.optional(l.boolean())}).passthrough(),uf=Ut.extend({description:l.optional(l.string()),arguments:l.optional(l.array(cf)),_meta:l.optional(l.object({}).passthrough())}),df=wa.extend({method:l.literal("prompts/list")}),_s=Ea.extend({prompts:l.array(uf)}),ff=Me.extend({method:l.literal("prompts/get"),params:Ke.extend({name:l.string(),arguments:l.optional(l.record(l.string()))})}),bs=l.object({type:l.literal("text"),text:l.string(),_meta:l.optional(l.object({}).passthrough())}).passthrough(),xs=l.object({type:l.literal("image"),data:ms,mimeType:l.string(),_meta:l.optional(l.object({}).passthrough())}).passthrough(),ws=l.object({type:l.literal("audio"),data:ms,mimeType:l.string(),_meta:l.optional(l.object({}).passthrough())}).passthrough(),hf=l.object({type:l.literal("resource"),resource:l.union([po,mo]),_meta:l.optional(l.object({}).passthrough())}).passthrough(),pf=vo.extend({type:l.literal("resource_link")}),go=l.union([bs,xs,ws,pf,hf]),mf=l.object({role:l.enum(["user","assistant"]),content:go}).passthrough(),Es=Ge.extend({description:l.optional(l.string()),messages:l.array(mf)}),vf=lr.extend({method:l.literal("notifications/prompts/list_changed")}),gf=l.object({title:l.optional(l.string()),readOnlyHint:l.optional(l.boolean()),destructiveHint:l.optional(l.boolean()),idempotentHint:l.optional(l.boolean()),openWorldHint:l.optional(l.boolean())}).passthrough(),yf=Ut.extend({description:l.optional(l.string()),inputSchema:l.object({type:l.literal("object"),properties:l.optional(l.object({}).passthrough()),required:l.optional(l.array(l.string()))}).passthrough(),outputSchema:l.optional(l.object({type:l.literal("object"),properties:l.optional(l.object({}).passthrough()),required:l.optional(l.array(l.string()))}).passthrough()),annotations:l.optional(gf),_meta:l.optional(l.object({}).passthrough())}),Ps=wa.extend({method:l.literal("tools/list")}),Ss=Ea.extend({tools:l.array(yf)}),Pa=Ge.extend({content:l.array(go).default([]),structuredContent:l.object({}).passthrough().optional(),isError:l.optional(l.boolean())}),_v=Pa.or(Ge.extend({toolResult:l.unknown()})),Rs=Me.extend({method:l.literal("tools/call"),params:Ke.extend({name:l.string(),arguments:l.optional(l.record(l.unknown()))})}),_f=lr.extend({method:l.literal("notifications/tools/list_changed")}),zt=l.enum(["debug","info","notice","warning","error","critical","alert","emergency"]),Os=Me.extend({method:l.literal("logging/setLevel"),params:Ke.extend({level:zt})}),bf=lr.extend({method:l.literal("notifications/message"),params:qt.extend({level:zt,logger:l.optional(l.string()),data:l.unknown()})}),xf=l.object({name:l.string().optional()}).passthrough(),wf=l.object({hints:l.optional(l.array(xf)),costPriority:l.optional(l.number().min(0).max(1)),speedPriority:l.optional(l.number().min(0).max(1)),intelligencePriority:l.optional(l.number().min(0).max(1))}).passthrough(),Ef=l.object({role:l.enum(["user","assistant"]),content:l.union([bs,xs,ws])}).passthrough(),Pf=Me.extend({method:l.literal("sampling/createMessage"),params:Ke.extend({messages:l.array(Ef),systemPrompt:l.optional(l.string()),includeContext:l.optional(l.enum(["none","thisServer","allServers"])),temperature:l.optional(l.number()),maxTokens:l.number().int(),stopSequences:l.optional(l.array(l.string())),metadata:l.optional(l.object({}).passthrough()),modelPreferences:l.optional(wf)})}),Ts=Ge.extend({model:l.string(),stopReason:l.optional(l.enum(["endTurn","stopSequence","maxTokens"]).or(l.string())),role:l.enum(["user","assistant"]),content:l.discriminatedUnion("type",[bs,xs,ws])}),Sf=l.object({type:l.literal("boolean"),title:l.optional(l.string()),description:l.optional(l.string()),default:l.optional(l.boolean())}).passthrough(),Rf=l.object({type:l.literal("string"),title:l.optional(l.string()),description:l.optional(l.string()),minLength:l.optional(l.number()),maxLength:l.optional(l.number()),format:l.optional(l.enum(["email","uri","date","date-time"]))}).passthrough(),Of=l.object({type:l.enum(["number","integer"]),title:l.optional(l.string()),description:l.optional(l.string()),minimum:l.optional(l.number()),maximum:l.optional(l.number())}).passthrough(),Tf=l.object({type:l.literal("string"),title:l.optional(l.string()),description:l.optional(l.string()),enum:l.array(l.string()),enumNames:l.optional(l.array(l.string()))}).passthrough(),$f=l.union([Sf,Rf,Of,Tf]),Af=Me.extend({method:l.literal("elicitation/create"),params:Ke.extend({message:l.string(),requestedSchema:l.object({type:l.literal("object"),properties:l.record(l.string(),$f),required:l.optional(l.array(l.string()))}).passthrough()})}),$s=Ge.extend({action:l.enum(["accept","decline","cancel"]),content:l.optional(l.record(l.string(),l.unknown()))}),If=l.object({type:l.literal("ref/resource"),uri:l.string()}).passthrough();var Cf=l.object({type:l.literal("ref/prompt"),name:l.string()}).passthrough(),kf=Me.extend({method:l.literal("completion/complete"),params:Ke.extend({ref:l.union([Cf,If]),argument:l.object({name:l.string(),value:l.string()}).passthrough(),context:l.optional(l.object({arguments:l.optional(l.record(l.string(),l.string()))}))})}),As=Ge.extend({completion:l.object({values:l.array(l.string()).max(100),total:l.optional(l.number().int()),hasMore:l.optional(l.boolean())}).passthrough()}),Df=l.object({uri:l.string().startsWith("file://"),name:l.optional(l.string()),_meta:l.optional(l.object({}).passthrough())}).passthrough(),Is=Me.extend({method:l.literal("roots/list")}),Cs=Ge.extend({roots:l.array(Df)}),jf=lr.extend({method:l.literal("notifications/roots/list_changed")}),bv=l.union([St,_a,kf,Os,ff,df,rf,tf,af,nf,of,Rs,Ps]),xv=l.union([ya,xa,ba,jf]),wv=l.union([br,Ts,$s,Cs]),Ev=l.union([St,Pf,Af,Is]),Pv=l.union([ya,xa,bf,lf,sf,_f,vf]),Sv=l.union([br,ps,As,Es,_s,vs,gs,ys,Pa,Ss]),Ae=class extends Error{constructor(e,t,s){super(`MCP error ${e}: ${t}`),this.code=e,this.data=s,this.name="McpError"}};var Nf=6e4,Rt=class{constructor(e){this._options=e,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this._pendingDebouncedNotifications=new Set,this.setNotificationHandler(ya,t=>{let s=this._requestHandlerAbortControllers.get(t.params.requestId);s==null||s.abort(t.params.reason)}),this.setNotificationHandler(xa,t=>{this._onprogress(t)}),this.setRequestHandler(St,t=>({}))}_setupTimeout(e,t,s,r,n=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(r,t),startTime:Date.now(),timeout:t,maxTotalTimeout:s,resetTimeoutOnProgress:n,onTimeout:r})}_resetTimeout(e){let t=this._timeoutInfo.get(e);if(!t)return!1;let s=Date.now()-t.startTime;if(t.maxTotalTimeout&&s>=t.maxTotalTimeout)throw this._timeoutInfo.delete(e),new Ae(De.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:t.maxTotalTimeout,totalElapsed:s});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){var t,s,r;this._transport=e;let n=(t=this.transport)===null||t===void 0?void 0:t.onclose;this._transport.onclose=()=>{n==null||n(),this._onclose()};let o=(s=this.transport)===null||s===void 0?void 0:s.onerror;this._transport.onerror=u=>{o==null||o(u),this._onerror(u)};let i=(r=this._transport)===null||r===void 0?void 0:r.onmessage;this._transport.onmessage=(u,c)=>{i==null||i(u,c),_r(u)||Pt(u)?this._onresponse(u):at(u)?this._onrequest(u,c):oo(u)?this._onnotification(u):this._onerror(new Error(`Unknown message type: ${JSON.stringify(u)}`))},await this._transport.start()}_onclose(){var e;let t=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._pendingDebouncedNotifications.clear(),this._transport=void 0,(e=this.onclose)===null||e===void 0||e.call(this);let s=new Ae(De.ConnectionClosed,"Connection closed");for(let r of t.values())r(s)}_onerror(e){var t;(t=this.onerror)===null||t===void 0||t.call(this,e)}_onnotification(e){var t;let s=(t=this._notificationHandlers.get(e.method))!==null&&t!==void 0?t:this.fallbackNotificationHandler;s!==void 0&&Promise.resolve().then(()=>s(e)).catch(r=>this._onerror(new Error(`Uncaught error in notification handler: ${r}`)))}_onrequest(e,t){var s,r;let n=(s=this._requestHandlers.get(e.method))!==null&&s!==void 0?s:this.fallbackRequestHandler,o=this._transport;if(n===void 0){o==null||o.send({jsonrpc:"2.0",id:e.id,error:{code:De.MethodNotFound,message:"Method not found"}}).catch(c=>this._onerror(new Error(`Failed to send an error response: ${c}`)));return}let i=new AbortController;this._requestHandlerAbortControllers.set(e.id,i);let u={signal:i.signal,sessionId:o==null?void 0:o.sessionId,_meta:(r=e.params)===null||r===void 0?void 0:r._meta,sendNotification:c=>this.notification(c,{relatedRequestId:e.id}),sendRequest:(c,f,p)=>this.request(c,f,{...p,relatedRequestId:e.id}),authInfo:t==null?void 0:t.authInfo,requestId:e.id,requestInfo:t==null?void 0:t.requestInfo};Promise.resolve().then(()=>n(e,u)).then(c=>{if(!i.signal.aborted)return o==null?void 0:o.send({result:c,jsonrpc:"2.0",id:e.id})},c=>{var f;if(!i.signal.aborted)return o==null?void 0:o.send({jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(c.code)?c.code:De.InternalError,message:(f=c.message)!==null&&f!==void 0?f:"Internal error"}})}).catch(c=>this._onerror(new Error(`Failed to send response: ${c}`))).finally(()=>{this._requestHandlerAbortControllers.delete(e.id)})}_onprogress(e){let{progressToken:t,...s}=e.params,r=Number(t),n=this._progressHandlers.get(r);if(!n){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}let o=this._responseHandlers.get(r),i=this._timeoutInfo.get(r);if(i&&o&&i.resetTimeoutOnProgress)try{this._resetTimeout(r)}catch(u){o(u);return}n(s)}_onresponse(e){let t=Number(e.id),s=this._responseHandlers.get(t);if(s===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}if(this._responseHandlers.delete(t),this._progressHandlers.delete(t),this._cleanupTimeout(t),_r(e))s(e);else{let r=new Ae(e.error.code,e.error.message,e.error.data);s(r)}}get transport(){return this._transport}async close(){var e;await((e=this._transport)===null||e===void 0?void 0:e.close())}request(e,t,s){let{relatedRequestId:r,resumptionToken:n,onresumptiontoken:o}=s!=null?s:{};return new Promise((i,u)=>{var c,f,p,g,d,y;if(!this._transport){u(new Error("Not connected"));return}((c=this._options)===null||c===void 0?void 0:c.enforceStrictCapabilities)===!0&&this.assertCapabilityForMethod(e.method),(f=s==null?void 0:s.signal)===null||f===void 0||f.throwIfAborted();let m=this._requestMessageId++,v={...e,jsonrpc:"2.0",id:m};s!=null&&s.onprogress&&(this._progressHandlers.set(m,s.onprogress),v.params={...e.params,_meta:{...((p=e.params)===null||p===void 0?void 0:p._meta)||{},progressToken:m}});let x=O=>{var A;this._responseHandlers.delete(m),this._progressHandlers.delete(m),this._cleanupTimeout(m),(A=this._transport)===null||A===void 0||A.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:m,reason:String(O)}},{relatedRequestId:r,resumptionToken:n,onresumptiontoken:o}).catch(I=>this._onerror(new Error(`Failed to send cancellation: ${I}`))),u(O)};this._responseHandlers.set(m,O=>{var A;if(!(!((A=s==null?void 0:s.signal)===null||A===void 0)&&A.aborted)){if(O instanceof Error)return u(O);try{let I=t.parse(O.result);i(I)}catch(I){u(I)}}}),(g=s==null?void 0:s.signal)===null||g===void 0||g.addEventListener("abort",()=>{var O;x((O=s==null?void 0:s.signal)===null||O===void 0?void 0:O.reason)});let S=(d=s==null?void 0:s.timeout)!==null&&d!==void 0?d:Nf,P=()=>x(new Ae(De.RequestTimeout,"Request timed out",{timeout:S}));this._setupTimeout(m,S,s==null?void 0:s.maxTotalTimeout,P,(y=s==null?void 0:s.resetTimeoutOnProgress)!==null&&y!==void 0?y:!1),this._transport.send(v,{relatedRequestId:r,resumptionToken:n,onresumptiontoken:o}).catch(O=>{this._cleanupTimeout(m),u(O)})})}async notification(e,t){var s,r;if(!this._transport)throw new Error("Not connected");if(this.assertNotificationCapability(e.method),((r=(s=this._options)===null||s===void 0?void 0:s.debouncedNotificationMethods)!==null&&r!==void 0?r:[]).includes(e.method)&&!e.params&&!(t!=null&&t.relatedRequestId)){if(this._pendingDebouncedNotifications.has(e.method))return;this._pendingDebouncedNotifications.add(e.method),Promise.resolve().then(()=>{var u;if(this._pendingDebouncedNotifications.delete(e.method),!this._transport)return;let c={...e,jsonrpc:"2.0"};(u=this._transport)===null||u===void 0||u.send(c,t).catch(f=>this._onerror(f))});return}let i={...e,jsonrpc:"2.0"};await this._transport.send(i,t)}setRequestHandler(e,t){let s=e.shape.method.value;this.assertRequestHandlerCapability(s),this._requestHandlers.set(s,(r,n)=>Promise.resolve(t(e.parse(r),n)))}removeRequestHandler(e){this._requestHandlers.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw new Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,t){this._notificationHandlers.set(e.shape.method.value,s=>Promise.resolve(t(e.parse(s))))}removeNotificationHandler(e){this._notificationHandlers.delete(e)}};function Sa(a,e){return Object.entries(e).reduce((t,[s,r])=>(r&&typeof r=="object"?t[s]=t[s]?{...t[s],...r}:r:t[s]=r,t),{...a})}var yl=pr(an(),1),Ha=class extends Rt{constructor(e,t){var s;super(t),this._clientInfo=e,this._cachedToolOutputValidators=new Map,this._capabilities=(s=t==null?void 0:t.capabilities)!==null&&s!==void 0?s:{},this._ajv=new yl.default}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=Sa(this._capabilities,e)}assertCapability(e,t){var s;if(!(!((s=this._serverCapabilities)===null||s===void 0)&&s[e]))throw new Error(`Server does not support ${e} (required for ${t})`)}async connect(e,t){if(await super.connect(e),e.sessionId===void 0)try{let s=await this.request({method:"initialize",params:{protocolVersion:Tr,capabilities:this._capabilities,clientInfo:this._clientInfo}},ps,t);if(s===void 0)throw new Error(`Server sent invalid initialize result: ${s}`);if(!tt.includes(s.protocolVersion))throw new Error(`Server's protocol version is not supported: ${s.protocolVersion}`);this._serverCapabilities=s.capabilities,this._serverVersion=s.serverInfo,e.setProtocolVersion&&e.setProtocolVersion(s.protocolVersion),this._instructions=s.instructions,await this.notification({method:"notifications/initialized"})}catch(s){throw this.close(),s}}getServerCapabilities(){return this._serverCapabilities}getServerVersion(){return this._serverVersion}getInstructions(){return this._instructions}assertCapabilityForMethod(e){var t,s,r,n,o;switch(e){case"logging/setLevel":if(!(!((t=this._serverCapabilities)===null||t===void 0)&&t.logging))throw new Error(`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!(!((s=this._serverCapabilities)===null||s===void 0)&&s.prompts))throw new Error(`Server does not support prompts (required for ${e})`);break;case"resources/list":case"resources/templates/list":case"resources/read":case"resources/subscribe":case"resources/unsubscribe":if(!(!((r=this._serverCapabilities)===null||r===void 0)&&r.resources))throw new Error(`Server does not support resources (required for ${e})`);if(e==="resources/subscribe"&&!this._serverCapabilities.resources.subscribe)throw new Error(`Server does not support resource subscriptions (required for ${e})`);break;case"tools/call":case"tools/list":if(!(!((n=this._serverCapabilities)===null||n===void 0)&&n.tools))throw new Error(`Server does not support tools (required for ${e})`);break;case"completion/complete":if(!(!((o=this._serverCapabilities)===null||o===void 0)&&o.completions))throw new Error(`Server does not support completions (required for ${e})`);break;case"initialize":break;case"ping":break}}assertNotificationCapability(e){var t;switch(e){case"notifications/roots/list_changed":if(!(!((t=this._capabilities.roots)===null||t===void 0)&&t.listChanged))throw new Error(`Client does not support roots list changed notifications (required for ${e})`);break;case"notifications/initialized":break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(e){switch(e){case"sampling/createMessage":if(!this._capabilities.sampling)throw new Error(`Client does not support sampling capability (required for ${e})`);break;case"elicitation/create":if(!this._capabilities.elicitation)throw new Error(`Client does not support elicitation capability (required for ${e})`);break;case"roots/list":if(!this._capabilities.roots)throw new Error(`Client does not support roots capability (required for ${e})`);break;case"ping":break}}async ping(e){return this.request({method:"ping"},br,e)}async complete(e,t){return this.request({method:"completion/complete",params:e},As,t)}async setLoggingLevel(e,t){return this.request({method:"logging/setLevel",params:{level:e}},br,t)}async getPrompt(e,t){return this.request({method:"prompts/get",params:e},Es,t)}async listPrompts(e,t){return this.request({method:"prompts/list",params:e},_s,t)}async listResources(e,t){return this.request({method:"resources/list",params:e},vs,t)}async listResourceTemplates(e,t){return this.request({method:"resources/templates/list",params:e},gs,t)}async readResource(e,t){return this.request({method:"resources/read",params:e},ys,t)}async subscribeResource(e,t){return this.request({method:"resources/subscribe",params:e},br,t)}async unsubscribeResource(e,t){return this.request({method:"resources/unsubscribe",params:e},br,t)}async callTool(e,t=Pa,s){let r=await this.request({method:"tools/call",params:e},t,s),n=this.getToolOutputValidator(e.name);if(n){if(!r.structuredContent&&!r.isError)throw new Ae(De.InvalidRequest,`Tool ${e.name} has an output schema but did not return structured content`);if(r.structuredContent)try{if(!n(r.structuredContent))throw new Ae(De.InvalidParams,`Structured content does not match the tool's output schema: ${this._ajv.errorsText(n.errors)}`)}catch(o){throw o instanceof Ae?o:new Ae(De.InvalidParams,`Failed to validate structured content: ${o instanceof Error?o.message:String(o)}`)}}return r}cacheToolOutputSchemas(e){this._cachedToolOutputValidators.clear();for(let t of e)if(t.outputSchema)try{let s=this._ajv.compile(t.outputSchema);this._cachedToolOutputValidators.set(t.name,s)}catch{}}getToolOutputValidator(e){return this._cachedToolOutputValidators.get(e)}async listTools(e,t){let s=await this.request({method:"tools/list",params:e},Ss,t);return this.cacheToolOutputSchemas(s.tools),s}async sendRootsListChanged(){return this.notification({method:"notifications/roots/list_changed"})}};var _l=pr(an(),1),Za=class extends Rt{constructor(e,t){var s;super(t),this._serverInfo=e,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(zt.options.map((r,n)=>[r,n])),this.isMessageIgnored=(r,n)=>{let o=this._loggingLevels.get(n);return o?this.LOG_LEVEL_SEVERITY.get(r)<this.LOG_LEVEL_SEVERITY.get(o):!1},this._capabilities=(s=t==null?void 0:t.capabilities)!==null&&s!==void 0?s:{},this._instructions=t==null?void 0:t.instructions,this.setRequestHandler(_a,r=>this._oninitialize(r)),this.setNotificationHandler(ba,()=>{var r;return(r=this.oninitialized)===null||r===void 0?void 0:r.call(this)}),this._capabilities.logging&&this.setRequestHandler(Os,async(r,n)=>{var o;let i=n.sessionId||((o=n.requestInfo)===null||o===void 0?void 0:o.headers["mcp-session-id"])||void 0,{level:u}=r.params,c=zt.safeParse(u);return i&&c.success&&this._loggingLevels.set(i,c.data),{}})}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=Sa(this._capabilities,e)}assertCapabilityForMethod(e){var t,s,r;switch(e){case"sampling/createMessage":if(!(!((t=this._clientCapabilities)===null||t===void 0)&&t.sampling))throw new Error(`Client does not support sampling (required for ${e})`);break;case"elicitation/create":if(!(!((s=this._clientCapabilities)===null||s===void 0)&&s.elicitation))throw new Error(`Client does not support elicitation (required for ${e})`);break;case"roots/list":if(!(!((r=this._clientCapabilities)===null||r===void 0)&&r.roots))throw new Error(`Client does not support listing roots (required for ${e})`);break;case"ping":break}}assertNotificationCapability(e){switch(e){case"notifications/message":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${e})`);break;case"notifications/resources/updated":case"notifications/resources/list_changed":if(!this._capabilities.resources)throw new Error(`Server does not support notifying about resources (required for ${e})`);break;case"notifications/tools/list_changed":if(!this._capabilities.tools)throw new Error(`Server does not support notifying of tool list changes (required for ${e})`);break;case"notifications/prompts/list_changed":if(!this._capabilities.prompts)throw new Error(`Server does not support notifying of prompt list changes (required for ${e})`);break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(e){switch(e){case"sampling/createMessage":if(!this._capabilities.sampling)throw new Error(`Server does not support sampling (required for ${e})`);break;case"logging/setLevel":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!this._capabilities.prompts)throw new Error(`Server does not support prompts (required for ${e})`);break;case"resources/list":case"resources/templates/list":case"resources/read":if(!this._capabilities.resources)throw new Error(`Server does not support resources (required for ${e})`);break;case"tools/call":case"tools/list":if(!this._capabilities.tools)throw new Error(`Server does not support tools (required for ${e})`);break;case"ping":case"initialize":break}}async _oninitialize(e){let t=e.params.protocolVersion;return this._clientCapabilities=e.params.capabilities,this._clientVersion=e.params.clientInfo,{protocolVersion:tt.includes(t)?t:Tr,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"},br)}async createMessage(e,t){return this.request({method:"sampling/createMessage",params:e},Ts,t)}async elicitInput(e,t){let s=await this.request({method:"elicitation/create",params:e},$s,t);if(s.action==="accept"&&s.content)try{let r=new _l.default,n=r.compile(e.requestedSchema);if(!n(s.content))throw new Ae(De.InvalidParams,`Elicitation response content does not match requested schema: ${r.errorsText(n.errors)}`)}catch(r){throw r instanceof Ae?r:new Ae(De.InternalError,`Error validating elicitation response: ${r}`)}return s}async listRoots(e,t){return this.request({method:"roots/list",params:e},Cs,t)}async sendLoggingMessage(e,t){if(this._capabilities.logging&&(!t||!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"})}};var Ol=require("node:crypto");var El=pr(wl());function Ht(a,{limit:e,encoding:t}){let s=El.default.parse(e);return new Promise((r,n)=>{let o=0,i=[];a.on("data",u=>{if(o+=u.length,o>s)return n(new Error(`Message size exceeds limit of ${e} bytes`));i.push(u)}),a.on("end",()=>{try{r(Buffer.concat(i).toString(t))}catch(u){n(u)}}),a.on("error",u=>{n(u)})})}var Tl=pr(nn(),1),$l=require("url"),Op="4mb",Ja=class{constructor(e,t,s){this._endpoint=e,this.res=t,this._sessionId=(0,Ol.randomUUID)(),this._options=s||{enableDnsRebindingProtection:!1}}validateRequestHeaders(e){if(this._options.enableDnsRebindingProtection){if(this._options.allowedHosts&&this._options.allowedHosts.length>0){let t=e.headers.host;if(!t||!this._options.allowedHosts.includes(t))return`Invalid Host header: ${t}`}if(this._options.allowedOrigins&&this._options.allowedOrigins.length>0){let t=e.headers.origin;if(!t||!this._options.allowedOrigins.includes(t))return`Invalid Origin header: ${t}`}}}async start(){if(this._sseResponse)throw new Error("SSEServerTransport already started! If using Server class, note that connect() calls start() automatically.");this.res.writeHead(200,{"Content-Type":"text/event-stream","Cache-Control":"no-cache, no-transform",Connection:"keep-alive"});let e="http://localhost",t=new $l.URL(this._endpoint,e);t.searchParams.set("sessionId",this._sessionId);let s=t.pathname+t.search+t.hash;this.res.write(`event: endpoint
|
|
2
2
|
data: ${s}
|
|
3
3
|
|
|
4
|
-
`),this._sseResponse=this.res,this.res.on("close",()=>{var r;this._sseResponse=void 0,(r=this.onclose)===null||r===void 0||r.call(this)})}async handlePostMessage(e,t,s){var r,n,o,
|
|
4
|
+
`),this._sseResponse=this.res,this.res.on("close",()=>{var r;this._sseResponse=void 0,(r=this.onclose)===null||r===void 0||r.call(this)})}async handlePostMessage(e,t,s){var r,n,o,i;if(!this._sseResponse){let g="SSE connection not established";throw t.writeHead(500).end(g),new Error(g)}let u=this.validateRequestHeaders(e);if(u){t.writeHead(403).end(u),(r=this.onerror)===null||r===void 0||r.call(this,new Error(u));return}let c=e.auth,f={headers:e.headers},p;try{let g=Tl.default.parse((n=e.headers["content-type"])!==null&&n!==void 0?n:"");if(g.type!=="application/json")throw new Error(`Unsupported content-type: ${g.type}`);p=s!=null?s:await Ht(e,{limit:Op,encoding:(o=g.parameters.charset)!==null&&o!==void 0?o:"utf-8"})}catch(g){t.writeHead(400).end(String(g)),(i=this.onerror)===null||i===void 0||i.call(this,g);return}try{await this.handleMessage(typeof p=="string"?JSON.parse(p):p,{requestInfo:f,authInfo:c})}catch{t.writeHead(400).end(`Invalid message: ${p}`);return}t.writeHead(202).end("Accepted")}async handleMessage(e,t){var s,r;let n;try{n=Xe.parse(e)}catch(o){throw(s=this.onerror)===null||s===void 0||s.call(this,o),o}(r=this.onmessage)===null||r===void 0||r.call(this,n,t)}async close(){var e,t;(e=this._sseResponse)===null||e===void 0||e.end(),this._sseResponse=void 0,(t=this.onclose)===null||t===void 0||t.call(this)}async send(e){if(!this._sseResponse)throw new Error("Not connected");this._sseResponse.write(`event: message
|
|
5
5
|
data: ${JSON.stringify(e)}
|
|
6
6
|
|
|
7
|
-
`)}get sessionId(){return this._sessionId}};var
|
|
8
|
-
`);if(e===-1)return null;let t=this._buffer.toString("utf8",0,e).replace(/\r$/,"");return this._buffer=this._buffer.subarray(e+1),
|
|
9
|
-
`}var
|
|
7
|
+
`)}get sessionId(){return this._sessionId}};var yc=pr(gc(),1),Zt=pr(require("node:process"),1),_c=require("node:stream");var $t=class{append(e){this._buffer=this._buffer?Buffer.concat([this._buffer,e]):e}readMessage(){if(!this._buffer)return null;let e=this._buffer.indexOf(`
|
|
8
|
+
`);if(e===-1)return null;let t=this._buffer.toString("utf8",0,e).replace(/\r$/,"");return this._buffer=this._buffer.subarray(e+1),em(t)}clear(){this._buffer=void 0}};function em(a){return Xe.parse(JSON.parse(a))}function Ka(a){return JSON.stringify(a)+`
|
|
9
|
+
`}var rm=Zt.default.platform==="win32"?["APPDATA","HOMEDRIVE","HOMEPATH","LOCALAPPDATA","PATH","PROCESSOR_ARCHITECTURE","SYSTEMDRIVE","SYSTEMROOT","TEMP","USERNAME","USERPROFILE","PROGRAMFILES"]:["HOME","LOGNAME","PATH","SHELL","TERM","USER"];function tm(){let a={};for(let e of rm){let t=Zt.default.env[e];t!==void 0&&(t.startsWith("()")||(a[e]=t))}return a}var Ga=class{constructor(e){this._abortController=new AbortController,this._readBuffer=new $t,this._stderrStream=null,this._serverParams=e,(e.stderr==="pipe"||e.stderr==="overlapped")&&(this._stderrStream=new _c.PassThrough)}async start(){if(this._process)throw new Error("StdioClientTransport already started! If using Client class, note that connect() calls start() automatically.");return new Promise((e,t)=>{var s,r,n,o,i;this._process=(0,yc.default)(this._serverParams.command,(s=this._serverParams.args)!==null&&s!==void 0?s:[],{env:{...tm(),...this._serverParams.env},stdio:["pipe","pipe",(r=this._serverParams.stderr)!==null&&r!==void 0?r:"inherit"],shell:!1,signal:this._abortController.signal,windowsHide:Zt.default.platform==="win32"&&am(),cwd:this._serverParams.cwd}),this._process.on("error",u=>{var c,f;if(u.name==="AbortError"){(c=this.onclose)===null||c===void 0||c.call(this);return}t(u),(f=this.onerror)===null||f===void 0||f.call(this,u)}),this._process.on("spawn",()=>{e()}),this._process.on("close",u=>{var c;this._process=void 0,(c=this.onclose)===null||c===void 0||c.call(this)}),(n=this._process.stdin)===null||n===void 0||n.on("error",u=>{var c;(c=this.onerror)===null||c===void 0||c.call(this,u)}),(o=this._process.stdout)===null||o===void 0||o.on("data",u=>{this._readBuffer.append(u),this.processReadBuffer()}),(i=this._process.stdout)===null||i===void 0||i.on("error",u=>{var c;(c=this.onerror)===null||c===void 0||c.call(this,u)}),this._stderrStream&&this._process.stderr&&this._process.stderr.pipe(this._stderrStream)})}get stderr(){var e,t;return this._stderrStream?this._stderrStream:(t=(e=this._process)===null||e===void 0?void 0:e.stderr)!==null&&t!==void 0?t:null}get pid(){var e,t;return(t=(e=this._process)===null||e===void 0?void 0:e.pid)!==null&&t!==void 0?t:null}processReadBuffer(){for(var e,t;;)try{let s=this._readBuffer.readMessage();if(s===null)break;(e=this.onmessage)===null||e===void 0||e.call(this,s)}catch(s){(t=this.onerror)===null||t===void 0||t.call(this,s)}}async close(){this._abortController.abort(),this._process=void 0,this._readBuffer.clear()}send(e){return new Promise(t=>{var s;if(!(!((s=this._process)===null||s===void 0)&&s.stdin))throw new Error("Not connected");let r=Ka(e);this._process.stdin.write(r)?t():this._process.stdin.once("drain",t)})}};function am(){return"type"in Zt.default}var vn=pr(require("node:process"),1);var Wa=class{constructor(e=vn.default.stdin,t=vn.default.stdout){this._stdin=e,this._stdout=t,this._readBuffer=new $t,this._started=!1,this._ondata=s=>{this._readBuffer.append(s),this.processReadBuffer()},this._onerror=s=>{var r;(r=this.onerror)===null||r===void 0||r.call(this,s)}}async start(){if(this._started)throw new 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(var e,t;;)try{let s=this._readBuffer.readMessage();if(s===null)break;(e=this.onmessage)===null||e===void 0||e.call(this,s)}catch(s){(t=this.onerror)===null||t===void 0||t.call(this,s)}}async close(){var e;this._stdin.off("data",this._ondata),this._stdin.off("error",this._onerror),this._stdin.listenerCount("data")===0&&this._stdin.pause(),this._readBuffer.clear(),(e=this.onclose)===null||e===void 0||e.call(this)}send(e){return new Promise(t=>{let s=Ka(e);this._stdout.write(s)?t():this._stdout.once("drain",t)})}};var bc=pr(nn(),1),xc=require("node:crypto"),sm="4mb",Ya=class{constructor(e){var t,s;this._started=!1,this._streamMapping=new Map,this._requestToStreamMapping=new Map,this._requestResponseMap=new Map,this._initialized=!1,this._enableJsonResponse=!1,this._standaloneSseStreamId="_GET_stream",this.sessionIdGenerator=e.sessionIdGenerator,this._enableJsonResponse=(t=e.enableJsonResponse)!==null&&t!==void 0?t:!1,this._eventStore=e.eventStore,this._onsessioninitialized=e.onsessioninitialized,this._onsessionclosed=e.onsessionclosed,this._allowedHosts=e.allowedHosts,this._allowedOrigins=e.allowedOrigins,this._enableDnsRebindingProtection=(s=e.enableDnsRebindingProtection)!==null&&s!==void 0?s:!1}async start(){if(this._started)throw new Error("Transport already started");this._started=!0}validateRequestHeaders(e){if(this._enableDnsRebindingProtection){if(this._allowedHosts&&this._allowedHosts.length>0){let t=e.headers.host;if(!t||!this._allowedHosts.includes(t))return`Invalid Host header: ${t}`}if(this._allowedOrigins&&this._allowedOrigins.length>0){let t=e.headers.origin;if(!t||!this._allowedOrigins.includes(t))return`Invalid Origin header: ${t}`}}}async handleRequest(e,t,s){var r;let n=this.validateRequestHeaders(e);if(n){t.writeHead(403).end(JSON.stringify({jsonrpc:"2.0",error:{code:-32e3,message:n},id:null})),(r=this.onerror)===null||r===void 0||r.call(this,new Error(n));return}e.method==="POST"?await this.handlePostRequest(e,t,s):e.method==="GET"?await this.handleGetRequest(e,t):e.method==="DELETE"?await this.handleDeleteRequest(e,t):await this.handleUnsupportedRequest(t)}async handleGetRequest(e,t){let s=e.headers.accept;if(!(s!=null&&s.includes("text/event-stream"))){t.writeHead(406).end(JSON.stringify({jsonrpc:"2.0",error:{code:-32e3,message:"Not Acceptable: Client must accept text/event-stream"},id:null}));return}if(!this.validateSession(e,t)||!this.validateProtocolVersion(e,t))return;if(this._eventStore){let n=e.headers["last-event-id"];if(n){await this.replayEvents(n,t);return}}let r={"Content-Type":"text/event-stream","Cache-Control":"no-cache, no-transform",Connection:"keep-alive"};if(this.sessionId!==void 0&&(r["mcp-session-id"]=this.sessionId),this._streamMapping.get(this._standaloneSseStreamId)!==void 0){t.writeHead(409).end(JSON.stringify({jsonrpc:"2.0",error:{code:-32e3,message:"Conflict: Only one SSE stream is allowed per session"},id:null}));return}t.writeHead(200,r).flushHeaders(),this._streamMapping.set(this._standaloneSseStreamId,t),t.on("close",()=>{this._streamMapping.delete(this._standaloneSseStreamId)})}async replayEvents(e,t){var s,r;if(this._eventStore)try{let n={"Content-Type":"text/event-stream","Cache-Control":"no-cache, no-transform",Connection:"keep-alive"};this.sessionId!==void 0&&(n["mcp-session-id"]=this.sessionId),t.writeHead(200,n).flushHeaders();let o=await((s=this._eventStore)===null||s===void 0?void 0:s.replayEventsAfter(e,{send:async(i,u)=>{var c;this.writeSSEEvent(t,u,i)||((c=this.onerror)===null||c===void 0||c.call(this,new Error("Failed replay events")),t.end())}}));this._streamMapping.set(o,t)}catch(n){(r=this.onerror)===null||r===void 0||r.call(this,n)}}writeSSEEvent(e,t,s){let r=`event: message
|
|
10
10
|
`;return s&&(r+=`id: ${s}
|
|
11
11
|
`),r+=`data: ${JSON.stringify(t)}
|
|
12
12
|
|
|
13
|
-
`,e.write(r)}async handleUnsupportedRequest(e){e.writeHead(405,{Allow:"GET, POST, DELETE"}).end(JSON.stringify({jsonrpc:"2.0",error:{code:-32e3,message:"Method not allowed."},id:null}))}async handlePostRequest(e,t,s){var r,n,o,l,u;try{let c=e.headers.accept;if(!(c!=null&&c.includes("application/json"))||!c.includes("text/event-stream")){t.writeHead(406).end(JSON.stringify({jsonrpc:"2.0",error:{code:-32e3,message:"Not Acceptable: Client must accept both application/json and text/event-stream"},id:null}));return}let f=e.headers["content-type"];if(!f||!f.includes("application/json")){t.writeHead(415).end(JSON.stringify({jsonrpc:"2.0",error:{code:-32e3,message:"Unsupported Media Type: Content-Type must be application/json"},id:null}));return}let p=e.auth,g={headers:e.headers},d;if(s!==void 0)d=s;else{let x=yc.default.parse(f),S=await zt(e,{limit:am,encoding:(r=x.parameters.charset)!==null&&r!==void 0?r:"utf-8"});d=JSON.parse(S.toString())}let y;Array.isArray(d)?y=d.map(x=>Ye.parse(x)):y=[Ye.parse(d)];let m=y.some(io);if(m){if(this._initialized&&this.sessionId!==void 0){t.writeHead(400).end(JSON.stringify({jsonrpc:"2.0",error:{code:-32600,message:"Invalid Request: Server already initialized"},id:null}));return}if(y.length>1){t.writeHead(400).end(JSON.stringify({jsonrpc:"2.0",error:{code:-32600,message:"Invalid Request: Only one initialization request is allowed"},id:null}));return}this.sessionId=(n=this.sessionIdGenerator)===null||n===void 0?void 0:n.call(this),this._initialized=!0,this.sessionId&&this._onsessioninitialized&&await Promise.resolve(this._onsessioninitialized(this.sessionId))}if(!m&&(!this.validateSession(e,t)||!this.validateProtocolVersion(e,t)))return;let v=y.some(tt);if(v){if(v){let x=(0,_c.randomUUID)();if(!this._enableJsonResponse){let S={"Content-Type":"text/event-stream","Cache-Control":"no-cache",Connection:"keep-alive"};this.sessionId!==void 0&&(S["mcp-session-id"]=this.sessionId),t.writeHead(200,S)}for(let S of y)tt(S)&&(this._streamMapping.set(x,t),this._requestToStreamMapping.set(S.id,x));t.on("close",()=>{this._streamMapping.delete(x)});for(let S of y)(l=this.onmessage)===null||l===void 0||l.call(this,S,{authInfo:p,requestInfo:g})}}else{t.writeHead(202).end();for(let x of y)(o=this.onmessage)===null||o===void 0||o.call(this,x,{authInfo:p,requestInfo:g})}}catch(c){t.writeHead(400).end(JSON.stringify({jsonrpc:"2.0",error:{code:-32700,message:"Parse error",data:String(c)},id:null})),(u=this.onerror)===null||u===void 0||u.call(this,c)}}async handleDeleteRequest(e,t){var s;this.validateSession(e,t)&&this.validateProtocolVersion(e,t)&&(await Promise.resolve((s=this._onsessionclosed)===null||s===void 0?void 0:s.call(this,this.sessionId)),await this.close(),t.writeHead(200).end())}validateSession(e,t){if(this.sessionIdGenerator===void 0)return!0;if(!this._initialized)return t.writeHead(400).end(JSON.stringify({jsonrpc:"2.0",error:{code:-32e3,message:"Bad Request: Server not initialized"},id:null})),!1;let s=e.headers["mcp-session-id"];if(s){if(Array.isArray(s))return t.writeHead(400).end(JSON.stringify({jsonrpc:"2.0",error:{code:-32e3,message:"Bad Request: Mcp-Session-Id header must be a single value"},id:null})),!1;if(s!==this.sessionId)return t.writeHead(404).end(JSON.stringify({jsonrpc:"2.0",error:{code:-32001,message:"Session not found"},id:null})),!1}else return t.writeHead(400).end(JSON.stringify({jsonrpc:"2.0",error:{code:-32e3,message:"Bad Request: Mcp-Session-Id header is required"},id:null})),!1;return!0}validateProtocolVersion(e,t){var s;let r=(s=e.headers["mcp-protocol-version"])!==null&&s!==void 0?s:Yn;return Array.isArray(r)&&(r=r[r.length-1]),rt.includes(r)?!0:(t.writeHead(400).end(JSON.stringify({jsonrpc:"2.0",error:{code:-32e3,message:`Bad Request: Unsupported protocol version (supported versions: ${rt.join(", ")})`},id:null})),!1)}async close(){var e;this._streamMapping.forEach(t=>{t.end()}),this._streamMapping.clear(),this._requestResponseMap.clear(),(e=this.onclose)===null||e===void 0||e.call(this)}async send(e,t){let s=t==null?void 0:t.relatedRequestId;if((yr(e)||Et(e))&&(s=e.id),s===void 0){if(yr(e)||Et(e))throw new Error("Cannot send a response on a standalone SSE stream unless resuming a previous client request");let o=this._streamMapping.get(this._standaloneSseStreamId);if(o===void 0)return;let l;this._eventStore&&(l=await this._eventStore.storeEvent(this._standaloneSseStreamId,e)),this.writeSSEEvent(o,e,l);return}let r=this._requestToStreamMapping.get(s),n=this._streamMapping.get(r);if(!r)throw new Error(`No connection established for request ID: ${String(s)}`);if(!this._enableJsonResponse){let o;this._eventStore&&(o=await this._eventStore.storeEvent(r,e)),n&&this.writeSSEEvent(n,e,o)}if(yr(e)||Et(e)){this._requestResponseMap.set(s,e);let o=Array.from(this._requestToStreamMapping.entries()).filter(([u,c])=>this._streamMapping.get(c)===n).map(([u])=>u);if(o.every(u=>this._requestResponseMap.has(u))){if(!n)throw new Error(`No connection established for request ID: ${String(s)}`);if(this._enableJsonResponse){let u={"Content-Type":"application/json"};this.sessionId!==void 0&&(u["mcp-session-id"]=this.sessionId);let c=o.map(f=>this._requestResponseMap.get(f));n.writeHead(200,u),c.length===1?n.end(JSON.stringify(c[0])):n.end(JSON.stringify(c))}else n.end();for(let u of o)this._requestResponseMap.delete(u),this._requestToStreamMapping.delete(u)}}}};var pn,bc,xc,wc;pn=(wc=(xc=(bc=globalThis.crypto)==null?void 0:bc.webcrypto)!=null?xc:globalThis.crypto)!=null?wc:import("node:crypto").then(a=>a.webcrypto);async function sm(a){return(await pn).getRandomValues(new Uint8Array(a))}async function nm(a){let e="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~",t="",s=await sm(a);for(let r=0;r<a;r++){let n=s[r]%e.length;t+=e[n]}return t}async function om(a){return await nm(a)}async function im(a){let e=await(await pn).subtle.digest("SHA-256",new TextEncoder().encode(a));return btoa(String.fromCharCode(...new Uint8Array(e))).replace(/\//g,"_").replace(/\+/g,"-").replace(/=/g,"")}async function mn(a){if(a||(a=43),a<43||a>128)throw`Expected a length between 43 and 128. Received ${a}.`;let e=await om(a),t=await im(e);return{code_verifier:e,code_challenge:t}}var Ec=i.object({resource:i.string().url(),authorization_servers:i.array(i.string().url()).optional(),jwks_uri:i.string().url().optional(),scopes_supported:i.array(i.string()).optional(),bearer_methods_supported:i.array(i.string()).optional(),resource_signing_alg_values_supported:i.array(i.string()).optional(),resource_name:i.string().optional(),resource_documentation:i.string().optional(),resource_policy_uri:i.string().url().optional(),resource_tos_uri:i.string().url().optional(),tls_client_certificate_bound_access_tokens:i.boolean().optional(),authorization_details_types_supported:i.array(i.string()).optional(),dpop_signing_alg_values_supported:i.array(i.string()).optional(),dpop_bound_access_tokens_required:i.boolean().optional()}).passthrough(),vn=i.object({issuer:i.string(),authorization_endpoint:i.string(),token_endpoint:i.string(),registration_endpoint:i.string().optional(),scopes_supported:i.array(i.string()).optional(),response_types_supported:i.array(i.string()),response_modes_supported:i.array(i.string()).optional(),grant_types_supported:i.array(i.string()).optional(),token_endpoint_auth_methods_supported:i.array(i.string()).optional(),token_endpoint_auth_signing_alg_values_supported:i.array(i.string()).optional(),service_documentation:i.string().optional(),revocation_endpoint:i.string().optional(),revocation_endpoint_auth_methods_supported:i.array(i.string()).optional(),revocation_endpoint_auth_signing_alg_values_supported:i.array(i.string()).optional(),introspection_endpoint:i.string().optional(),introspection_endpoint_auth_methods_supported:i.array(i.string()).optional(),introspection_endpoint_auth_signing_alg_values_supported:i.array(i.string()).optional(),code_challenge_methods_supported:i.array(i.string()).optional()}).passthrough(),lm=i.object({issuer:i.string(),authorization_endpoint:i.string(),token_endpoint:i.string(),userinfo_endpoint:i.string().optional(),jwks_uri:i.string(),registration_endpoint:i.string().optional(),scopes_supported:i.array(i.string()).optional(),response_types_supported:i.array(i.string()),response_modes_supported:i.array(i.string()).optional(),grant_types_supported:i.array(i.string()).optional(),acr_values_supported:i.array(i.string()).optional(),subject_types_supported:i.array(i.string()),id_token_signing_alg_values_supported:i.array(i.string()),id_token_encryption_alg_values_supported:i.array(i.string()).optional(),id_token_encryption_enc_values_supported:i.array(i.string()).optional(),userinfo_signing_alg_values_supported:i.array(i.string()).optional(),userinfo_encryption_alg_values_supported:i.array(i.string()).optional(),userinfo_encryption_enc_values_supported:i.array(i.string()).optional(),request_object_signing_alg_values_supported:i.array(i.string()).optional(),request_object_encryption_alg_values_supported:i.array(i.string()).optional(),request_object_encryption_enc_values_supported:i.array(i.string()).optional(),token_endpoint_auth_methods_supported:i.array(i.string()).optional(),token_endpoint_auth_signing_alg_values_supported:i.array(i.string()).optional(),display_values_supported:i.array(i.string()).optional(),claim_types_supported:i.array(i.string()).optional(),claims_supported:i.array(i.string()).optional(),service_documentation:i.string().optional(),claims_locales_supported:i.array(i.string()).optional(),ui_locales_supported:i.array(i.string()).optional(),claims_parameter_supported:i.boolean().optional(),request_parameter_supported:i.boolean().optional(),request_uri_parameter_supported:i.boolean().optional(),require_request_uri_registration:i.boolean().optional(),op_policy_uri:i.string().optional(),op_tos_uri:i.string().optional()}).passthrough(),Pc=lm.merge(vn.pick({code_challenge_methods_supported:!0})),gn=i.object({access_token:i.string(),id_token:i.string().optional(),token_type:i.string(),expires_in:i.number().optional(),scope:i.string().optional(),refresh_token:i.string().optional()}).strip(),Sc=i.object({error:i.string(),error_description:i.string().optional(),error_uri:i.string().optional()}),cm=i.object({redirect_uris:i.array(i.string()).refine(a=>a.every(e=>URL.canParse(e)),{message:"redirect_uris must contain valid URLs"}),token_endpoint_auth_method:i.string().optional(),grant_types:i.array(i.string()).optional(),response_types:i.array(i.string()).optional(),client_name:i.string().optional(),client_uri:i.string().optional(),logo_uri:i.string().optional(),scope:i.string().optional(),contacts:i.array(i.string()).optional(),tos_uri:i.string().optional(),policy_uri:i.string().optional(),jwks_uri:i.string().optional(),jwks:i.any().optional(),software_id:i.string().optional(),software_version:i.string().optional(),software_statement:i.string().optional()}).strip(),um=i.object({client_id:i.string(),client_secret:i.string().optional(),client_id_issued_at:i.number().optional(),client_secret_expires_at:i.number().optional()}).strip(),Rc=cm.merge(um),ty=i.object({error:i.string(),error_description:i.string().optional()}).strip(),ay=i.object({token:i.string(),token_type_hint:i.string().optional()}).strip();function Oc(a){let e=typeof a=="string"?new URL(a):new URL(a.href);return e.hash="",e}function Tc({requestedResource:a,configuredResource:e}){let t=typeof a=="string"?new URL(a):new URL(a.href),s=typeof e=="string"?new URL(e):new URL(e.href);if(t.origin!==s.origin||t.pathname.length<s.pathname.length)return!1;let r=t.pathname.endsWith("/")?t.pathname:t.pathname+"/",n=s.pathname.endsWith("/")?s.pathname:s.pathname+"/";return r.startsWith(n)}var we=class extends Error{constructor(e,t){super(e),this.errorUri=t,this.name=this.constructor.name}toResponseObject(){let e={error:this.errorCode,error_description:this.message};return this.errorUri&&(e.error_uri=this.errorUri),e}get errorCode(){return this.constructor.errorCode}},Ht=class extends we{};Ht.errorCode="invalid_request";var nt=class extends we{};nt.errorCode="invalid_client";var ot=class extends we{};ot.errorCode="invalid_grant";var it=class extends we{};it.errorCode="unauthorized_client";var Zt=class extends we{};Zt.errorCode="unsupported_grant_type";var Bt=class extends we{};Bt.errorCode="invalid_scope";var Jt=class extends we{};Jt.errorCode="access_denied";var br=class extends we{};br.errorCode="server_error";var Qt=class extends we{};Qt.errorCode="temporarily_unavailable";var Kt=class extends we{};Kt.errorCode="unsupported_response_type";var Gt=class extends we{};Gt.errorCode="unsupported_token_type";var Wt=class extends we{};Wt.errorCode="invalid_token";var Yt=class extends we{};Yt.errorCode="method_not_allowed";var Xt=class extends we{};Xt.errorCode="too_many_requests";var ea=class extends we{};ea.errorCode="invalid_client_metadata";var ra=class extends we{};ra.errorCode="insufficient_scope";var $c={[Ht.errorCode]:Ht,[nt.errorCode]:nt,[ot.errorCode]:ot,[it.errorCode]:it,[Zt.errorCode]:Zt,[Bt.errorCode]:Bt,[Jt.errorCode]:Jt,[br.errorCode]:br,[Qt.errorCode]:Qt,[Kt.errorCode]:Kt,[Gt.errorCode]:Gt,[Wt.errorCode]:Wt,[Yt.errorCode]:Yt,[Xt.errorCode]:Xt,[ea.errorCode]:ea,[ra.errorCode]:ra};var Cr=class extends Error{constructor(e){super(e!=null?e:"Unauthorized")}};function Ic(a,e){let t=a.client_secret!==void 0;return e.length===0?t?"client_secret_post":"none":t&&e.includes("client_secret_basic")?"client_secret_basic":t&&e.includes("client_secret_post")?"client_secret_post":e.includes("none")?"none":t?"client_secret_post":"none"}function Cc(a,e,t,s){let{client_id:r,client_secret:n}=e;switch(a){case"client_secret_basic":dm(r,n,t);return;case"client_secret_post":fm(r,n,s);return;case"none":hm(r,s);return;default:throw new Error(`Unsupported client authentication method: ${a}`)}}function dm(a,e,t){if(!e)throw new Error("client_secret_basic authentication requires a client_secret");let s=btoa(`${a}:${e}`);t.set("Authorization",`Basic ${s}`)}function fm(a,e,t){t.set("client_id",a),e&&t.set("client_secret",e)}function hm(a,e){e.set("client_id",a)}async function _n(a){let e=a instanceof Response?a.status:void 0,t=a instanceof Response?await a.text():a;try{let s=Sc.parse(JSON.parse(t)),{error:r,error_description:n,error_uri:o}=s,l=$c[r]||br;return new l(n||"",o)}catch(s){let r=`${e?`HTTP ${e}: `:""}Invalid OAuth error response: ${s}. Raw body: ${t}`;return new br(r)}}async function Wa(a,e){var t,s;try{return await yn(a,e)}catch(r){if(r instanceof nt||r instanceof it)return await((t=a.invalidateCredentials)===null||t===void 0?void 0:t.call(a,"all")),await yn(a,e);if(r instanceof ot)return await((s=a.invalidateCredentials)===null||s===void 0?void 0:s.call(a,"tokens")),await yn(a,e);throw r}}async function yn(a,{serverUrl:e,authorizationCode:t,scope:s,resourceMetadataUrl:r,fetchFn:n}){let o,l;try{o=await mm(e,{resourceMetadataUrl:r},n),o.authorization_servers&&o.authorization_servers.length>0&&(l=o.authorization_servers[0])}catch{}l||(l=e);let u=await pm(e,a,o),c=await bm(l,{fetchFn:n}),f=await Promise.resolve(a.clientInformation());if(!f){if(t!==void 0)throw new Error("Existing OAuth client information is required when exchanging an authorization code");if(!a.saveClientInformation)throw new Error("OAuth client information must be saveable for dynamic registration");let m=await Pm(l,{metadata:c,clientMetadata:a.clientMetadata,fetchFn:n});await a.saveClientInformation(m),f=m}if(t!==void 0){let m=await a.codeVerifier(),v=await wm(l,{metadata:c,clientInformation:f,authorizationCode:t,codeVerifier:m,redirectUri:a.redirectUrl,resource:u,addClientAuthentication:a.addClientAuthentication,fetchFn:n});return await a.saveTokens(v),"AUTHORIZED"}let p=await a.tokens();if(p!=null&&p.refresh_token)try{let m=await Em(l,{metadata:c,clientInformation:f,refreshToken:p.refresh_token,resource:u,addClientAuthentication:a.addClientAuthentication,fetchFn:n});return await a.saveTokens(m),"AUTHORIZED"}catch(m){if(!(!(m instanceof we)||m instanceof br))throw m}let g=a.state?await a.state():void 0,{authorizationUrl:d,codeVerifier:y}=await xm(l,{metadata:c,clientInformation:f,state:g,redirectUrl:a.redirectUrl,scope:s||a.clientMetadata.scope,resource:u});return await a.saveCodeVerifier(y),await a.redirectToAuthorization(d),"REDIRECT"}async function pm(a,e,t){let s=Oc(a);if(e.validateResourceURL)return await e.validateResourceURL(s,t==null?void 0:t.resource);if(t){if(!Tc({requestedResource:s,configuredResource:t.resource}))throw new Error(`Protected resource ${t.resource} does not match expected ${s} (or origin)`);return new URL(t.resource)}}function kc(a){let e=a.headers.get("WWW-Authenticate");if(!e)return;let[t,s]=e.split(" ");if(t.toLowerCase()!=="bearer"||!s)return;let n=/resource_metadata="([^"]*)"/.exec(e);if(n)try{return new URL(n[1])}catch{return}}async function mm(a,e,t=fetch){let s=await ym(a,"oauth-protected-resource",t,{protocolVersion:e==null?void 0:e.protocolVersion,metadataUrl:e==null?void 0:e.resourceMetadataUrl});if(!s||s.status===404)throw new Error("Resource server does not implement OAuth 2.0 Protected Resource Metadata.");if(!s.ok)throw new Error(`HTTP ${s.status} trying to load well-known OAuth protected resource metadata.`);return Ec.parse(await s.json())}async function bn(a,e,t=fetch){try{return await t(a,{headers:e})}catch(s){if(s instanceof TypeError)return e?bn(a,void 0,t):void 0;throw s}}function vm(a,e="",t={}){return e.endsWith("/")&&(e=e.slice(0,-1)),t.prependPathname?`${e}/.well-known/${a}`:`/.well-known/${a}${e}`}async function Ac(a,e,t=fetch){return await bn(a,{"MCP-Protocol-Version":e},t)}function gm(a,e){return!a||a.status===404&&e!=="/"}async function ym(a,e,t,s){var r,n;let o=new URL(a),l=(r=s==null?void 0:s.protocolVersion)!==null&&r!==void 0?r:Or,u;if(s!=null&&s.metadataUrl)u=new URL(s.metadataUrl);else{let f=vm(e,o.pathname);u=new URL(f,(n=s==null?void 0:s.metadataServerUrl)!==null&&n!==void 0?n:o),u.search=o.search}let c=await Ac(u,l,t);if(!(s!=null&&s.metadataUrl)&&gm(c,o.pathname)){let f=new URL(`/.well-known/${e}`,o);c=await Ac(f,l,t)}return c}function _m(a){let e=typeof a=="string"?new URL(a):a,t=e.pathname!=="/",s=[];if(!t)return s.push({url:new URL("/.well-known/oauth-authorization-server",e.origin),type:"oauth"}),s.push({url:new URL("/.well-known/openid-configuration",e.origin),type:"oidc"}),s;let r=e.pathname;return r.endsWith("/")&&(r=r.slice(0,-1)),s.push({url:new URL(`/.well-known/oauth-authorization-server${r}`,e.origin),type:"oauth"}),s.push({url:new URL("/.well-known/oauth-authorization-server",e.origin),type:"oauth"}),s.push({url:new URL(`/.well-known/openid-configuration${r}`,e.origin),type:"oidc"}),s.push({url:new URL(`${r}/.well-known/openid-configuration`,e.origin),type:"oidc"}),s}async function bm(a,{fetchFn:e=fetch,protocolVersion:t=Or}={}){var s;let r={"MCP-Protocol-Version":t},n=_m(a);for(let{url:o,type:l}of n){let u=await bn(o,r,e);if(u){if(!u.ok){if(u.status>=400&&u.status<500)continue;throw new Error(`HTTP ${u.status} trying to load ${l==="oauth"?"OAuth":"OpenID provider"} metadata from ${o}`)}if(l==="oauth")return vn.parse(await u.json());{let c=Pc.parse(await u.json());if(!(!((s=c.code_challenge_methods_supported)===null||s===void 0)&&s.includes("S256")))throw new Error(`Incompatible OIDC provider at ${o}: does not support S256 code challenge method required by MCP specification`);return c}}}}async function xm(a,{metadata:e,clientInformation:t,redirectUrl:s,scope:r,state:n,resource:o}){let l="code",u="S256",c;if(e){if(c=new URL(e.authorization_endpoint),!e.response_types_supported.includes(l))throw new Error(`Incompatible auth server: does not support response type ${l}`);if(!e.code_challenge_methods_supported||!e.code_challenge_methods_supported.includes(u))throw new Error(`Incompatible auth server: does not support code challenge method ${u}`)}else c=new URL("/authorize",a);let f=await mn(),p=f.code_verifier,g=f.code_challenge;return c.searchParams.set("response_type",l),c.searchParams.set("client_id",t.client_id),c.searchParams.set("code_challenge",g),c.searchParams.set("code_challenge_method",u),c.searchParams.set("redirect_uri",String(s)),n&&c.searchParams.set("state",n),r&&c.searchParams.set("scope",r),r!=null&&r.includes("offline_access")&&c.searchParams.append("prompt","consent"),o&&c.searchParams.set("resource",o.href),{authorizationUrl:c,codeVerifier:p}}async function wm(a,{metadata:e,clientInformation:t,authorizationCode:s,codeVerifier:r,redirectUri:n,resource:o,addClientAuthentication:l,fetchFn:u}){var c;let f="authorization_code",p=e!=null&&e.token_endpoint?new URL(e.token_endpoint):new URL("/token",a);if(e!=null&&e.grant_types_supported&&!e.grant_types_supported.includes(f))throw new Error(`Incompatible auth server: does not support grant type ${f}`);let g=new Headers({"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"}),d=new URLSearchParams({grant_type:f,code:s,code_verifier:r,redirect_uri:String(n)});if(l)l(g,d,a,e);else{let m=(c=e==null?void 0:e.token_endpoint_auth_methods_supported)!==null&&c!==void 0?c:[],v=Ic(t,m);Cc(v,t,g,d)}o&&d.set("resource",o.href);let y=await(u!=null?u:fetch)(p,{method:"POST",headers:g,body:d});if(!y.ok)throw await _n(y);return gn.parse(await y.json())}async function Em(a,{metadata:e,clientInformation:t,refreshToken:s,resource:r,addClientAuthentication:n,fetchFn:o}){var l;let u="refresh_token",c;if(e){if(c=new URL(e.token_endpoint),e.grant_types_supported&&!e.grant_types_supported.includes(u))throw new Error(`Incompatible auth server: does not support grant type ${u}`)}else c=new URL("/token",a);let f=new Headers({"Content-Type":"application/x-www-form-urlencoded"}),p=new URLSearchParams({grant_type:u,refresh_token:s});if(n)n(f,p,a,e);else{let d=(l=e==null?void 0:e.token_endpoint_auth_methods_supported)!==null&&l!==void 0?l:[],y=Ic(t,d);Cc(y,t,f,p)}r&&p.set("resource",r.href);let g=await(o!=null?o:fetch)(c,{method:"POST",headers:f,body:p});if(!g.ok)throw await _n(g);return gn.parse({refresh_token:s,...await g.json()})}async function Pm(a,{metadata:e,clientMetadata:t,fetchFn:s}){let r;if(e){if(!e.registration_endpoint)throw new Error("Incompatible auth server: does not support dynamic client registration");r=new URL(e.registration_endpoint)}else r=new URL("/register",a);let n=await(s!=null?s:fetch)(r,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!n.ok)throw await _n(n);return Rc.parse(await n.json())}var Ya=class extends Error{constructor(e,t){super(e),this.name="ParseError",this.type=t.type,this.field=t.field,this.value=t.value,this.line=t.line}};function xn(a){}function Dc(a){if(typeof a=="function")throw new TypeError("`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?");let{onEvent:e=xn,onError:t=xn,onRetry:s=xn,onComment:r}=a,n="",o=!0,l,u="",c="";function f(m){let v=o?m.replace(/^\xEF\xBB\xBF/,""):m,[x,S]=Sm(`${n}${v}`);for(let P of x)p(P);n=S,o=!1}function p(m){if(m===""){d();return}if(m.startsWith(":")){r&&r(m.slice(m.startsWith(": ")?2:1));return}let v=m.indexOf(":");if(v!==-1){let x=m.slice(0,v),S=m[v+1]===" "?2:1,P=m.slice(v+S);g(x,P,m);return}g(m,"",m)}function g(m,v,x){switch(m){case"event":c=v;break;case"data":u=`${u}${v}
|
|
14
|
-
`;break;case"id":
|
|
15
|
-
`)?u.slice(0,-1):u}),
|
|
16
|
-
`,s),o=-1;if(r!==-1&&n!==-1?o=Math.min(r,n):r!==-1?o=r:n!==-1&&(o=n),o===-1){t=a.slice(s);break}else{let
|
|
17
|
-
`&&s++}}return[e,t]}var Xa=class extends TransformStream{constructor({onError:e,onRetry:t,onComment:s}={}){let r;super({start(n){r=Dc({onEvent:o=>{n.enqueue(o)},onError(o){e==="terminate"?n.error(o):typeof e=="function"&&e(o)},onRetry:t,onComment:s})},transform(n){r.feed(n)}})}};var Rm={initialReconnectionDelay:1e3,maxReconnectionDelay:3e4,reconnectionDelayGrowFactor:1.5,maxRetries:2},ta=class extends Error{constructor(e,t){super(`Streamable HTTP error: ${t}`),this.code=e}},es=class{constructor(e,t){var s;this._url=e,this._resourceMetadataUrl=void 0,this._requestInit=t==null?void 0:t.requestInit,this._authProvider=t==null?void 0:t.authProvider,this._fetch=t==null?void 0:t.fetch,this._sessionId=t==null?void 0:t.sessionId,this._reconnectionOptions=(s=t==null?void 0:t.reconnectionOptions)!==null&&s!==void 0?s:Rm}async _authThenStart(){var e;if(!this._authProvider)throw new Cr("No auth provider");let t;try{t=await Wa(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,fetchFn:this._fetch})}catch(s){throw(e=this.onerror)===null||e===void 0||e.call(this,s),s}if(t!=="AUTHORIZED")throw new Cr;return await this._startOrAuthSse({resumptionToken:void 0})}async _commonHeaders(){var e;let t={};if(this._authProvider){let r=await this._authProvider.tokens();r&&(t.Authorization=`Bearer ${r.access_token}`)}this._sessionId&&(t["mcp-session-id"]=this._sessionId),this._protocolVersion&&(t["mcp-protocol-version"]=this._protocolVersion);let s=this._normalizeHeaders((e=this._requestInit)===null||e===void 0?void 0:e.headers);return new Headers({...t,...s})}async _startOrAuthSse(e){var t,s,r;let{resumptionToken:n}=e;try{let o=await this._commonHeaders();o.set("Accept","text/event-stream"),n&&o.set("last-event-id",n);let l=await((t=this._fetch)!==null&&t!==void 0?t:fetch)(this._url,{method:"GET",headers:o,signal:(s=this._abortController)===null||s===void 0?void 0:s.signal});if(!l.ok){if(l.status===401&&this._authProvider)return await this._authThenStart();if(l.status===405)return;throw new ta(l.status,`Failed to open SSE stream: ${l.statusText}`)}this._handleSseStream(l.body,e,!0)}catch(o){throw(r=this.onerror)===null||r===void 0||r.call(this,o),o}}_getNextReconnectionDelay(e){let t=this._reconnectionOptions.initialReconnectionDelay,s=this._reconnectionOptions.reconnectionDelayGrowFactor,r=this._reconnectionOptions.maxReconnectionDelay;return Math.min(t*Math.pow(s,e),r)}_normalizeHeaders(e){return e?e instanceof Headers?Object.fromEntries(e.entries()):Array.isArray(e)?Object.fromEntries(e):{...e}:{}}_scheduleReconnection(e,t=0){var s;let r=this._reconnectionOptions.maxRetries;if(r>0&&t>=r){(s=this.onerror)===null||s===void 0||s.call(this,new Error(`Maximum reconnection attempts (${r}) exceeded.`));return}let n=this._getNextReconnectionDelay(t);setTimeout(()=>{this._startOrAuthSse(e).catch(o=>{var l;(l=this.onerror)===null||l===void 0||l.call(this,new Error(`Failed to reconnect SSE stream: ${o instanceof Error?o.message:String(o)}`)),this._scheduleReconnection(e,t+1)})},n)}_handleSseStream(e,t,s){if(!e)return;let{onresumptiontoken:r,replayMessageId:n}=t,o;(async()=>{var u,c,f,p;try{let g=e.pipeThrough(new TextDecoderStream).pipeThrough(new Xa).getReader();for(;;){let{value:d,done:y}=await g.read();if(y)break;if(d.id&&(o=d.id,r==null||r(d.id)),!d.event||d.event==="message")try{let m=Ye.parse(JSON.parse(d.data));n!==void 0&&yr(m)&&(m.id=n),(u=this.onmessage)===null||u===void 0||u.call(this,m)}catch(m){(c=this.onerror)===null||c===void 0||c.call(this,m)}}}catch(g){if((f=this.onerror)===null||f===void 0||f.call(this,new Error(`SSE stream disconnected: ${g}`)),s&&this._abortController&&!this._abortController.signal.aborted)try{this._scheduleReconnection({resumptionToken:o,onresumptiontoken:r,replayMessageId:n},0)}catch(d){(p=this.onerror)===null||p===void 0||p.call(this,new Error(`Failed to reconnect: ${d instanceof Error?d.message:String(d)}`))}}})()}async start(){if(this._abortController)throw new Error("StreamableHTTPClientTransport already started! If using Client class, note that connect() calls start() automatically.");this._abortController=new AbortController}async finishAuth(e){if(!this._authProvider)throw new Cr("No auth provider");if(await Wa(this._authProvider,{serverUrl:this._url,authorizationCode:e,resourceMetadataUrl:this._resourceMetadataUrl,fetchFn:this._fetch})!=="AUTHORIZED")throw new Cr("Failed to authorize")}async close(){var e,t;(e=this._abortController)===null||e===void 0||e.abort(),(t=this.onclose)===null||t===void 0||t.call(this)}async send(e,t){var s,r,n,o;try{let{resumptionToken:l,onresumptiontoken:u}=t||{};if(l){this._startOrAuthSse({resumptionToken:l,replayMessageId:tt(e)?e.id:void 0}).catch(v=>{var x;return(x=this.onerror)===null||x===void 0?void 0:x.call(this,v)});return}let c=await this._commonHeaders();c.set("content-type","application/json"),c.set("accept","application/json, text/event-stream");let f={...this._requestInit,method:"POST",headers:c,body:JSON.stringify(e),signal:(s=this._abortController)===null||s===void 0?void 0:s.signal},p=await((r=this._fetch)!==null&&r!==void 0?r:fetch)(this._url,f),g=p.headers.get("mcp-session-id");if(g&&(this._sessionId=g),!p.ok){if(p.status===401&&this._authProvider){if(this._resourceMetadataUrl=kc(p),await Wa(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,fetchFn:this._fetch})!=="AUTHORIZED")throw new Cr;return this.send(e)}let v=await p.text().catch(()=>null);throw new Error(`Error POSTing to endpoint (HTTP ${p.status}): ${v}`)}if(p.status===202){lo(e)&&this._startOrAuthSse({resumptionToken:void 0}).catch(v=>{var x;return(x=this.onerror)===null||x===void 0?void 0:x.call(this,v)});return}let y=(Array.isArray(e)?e:[e]).filter(v=>"method"in v&&"id"in v&&v.id!==void 0).length>0,m=p.headers.get("content-type");if(y)if(m!=null&&m.includes("text/event-stream"))this._handleSseStream(p.body,{onresumptiontoken:u},!1);else if(m!=null&&m.includes("application/json")){let v=await p.json(),x=Array.isArray(v)?v.map(S=>Ye.parse(S)):[Ye.parse(v)];for(let S of x)(n=this.onmessage)===null||n===void 0||n.call(this,S)}else throw new ta(-1,`Unexpected content type: ${m}`)}catch(l){throw(o=this.onerror)===null||o===void 0||o.call(this,l),l}}get sessionId(){return this._sessionId}async terminateSession(){var e,t,s;if(this._sessionId)try{let r=await this._commonHeaders(),n={...this._requestInit,method:"DELETE",headers:r,signal:(e=this._abortController)===null||e===void 0?void 0:e.signal},o=await((t=this._fetch)!==null&&t!==void 0?t:fetch)(this._url,n);if(!o.ok&&o.status!==405)throw new ta(o.status,`Failed to terminate session: ${o.statusText}`);this._sessionId=void 0}catch(r){throw(s=this.onerror)===null||s===void 0||s.call(this,r),r}}setProtocolVersion(e){this._protocolVersion=e}get protocolVersion(){return this._protocolVersion}};var Nc=Symbol("Let zodToJsonSchema decide on which parser to use");var jc={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"},Fc=a=>typeof a=="string"?{...jc,name:a}:{...jc,...a};var Lc=a=>{let e=Fc(a),t=e.name!==void 0?[...e.basePath,e.definitionPath,e.name]:e.basePath;return{...e,flags:{hasReferencedOpenAiAnyType:!1},currentPath:t,propertyPath:void 0,seen:new Map(Object.entries(e.definitions).map(([s,r])=>[r._def,{def:r._def,path:[...e.basePath,e.definitionPath,s],jsonSchema:void 0}]))}};function wn(a,e,t,s){s!=null&&s.errorMessages&&t&&(a.errorMessage={...a.errorMessage,[e]:t})}function ee(a,e,t,s,r){a[e]=t,wn(a,e,s,r)}var rs=(a,e)=>{let t=0;for(;t<a.length&&t<e.length&&a[t]===e[t];t++);return[(a.length-t).toString(),...e.slice(t)].join("/")};function fe(a){if(a.target!=="openAi")return{};let e=[...a.basePath,a.definitionPath,a.openAiAnyTypeName];return a.flags.hasReferencedOpenAiAnyType=!0,{$ref:a.$refStrategy==="relative"?rs(e,a.currentPath):e.join("/")}}function Mc(a,e){var s,r,n;let t={type:"array"};return(s=a.type)!=null&&s._def&&((n=(r=a.type)==null?void 0:r._def)==null?void 0:n.typeName)!==T.ZodAny&&(t.items=J(a.type._def,{...e,currentPath:[...e.currentPath,"items"]})),a.minLength&&ee(t,"minItems",a.minLength.value,a.minLength.message,e),a.maxLength&&ee(t,"maxItems",a.maxLength.value,a.maxLength.message,e),a.exactLength&&(ee(t,"minItems",a.exactLength.value,a.exactLength.message,e),ee(t,"maxItems",a.exactLength.value,a.exactLength.message,e)),t}function qc(a,e){let t={type:"integer",format:"int64"};if(!a.checks)return t;for(let s of a.checks)switch(s.kind){case"min":e.target==="jsonSchema7"?s.inclusive?ee(t,"minimum",s.value,s.message,e):ee(t,"exclusiveMinimum",s.value,s.message,e):(s.inclusive||(t.exclusiveMinimum=!0),ee(t,"minimum",s.value,s.message,e));break;case"max":e.target==="jsonSchema7"?s.inclusive?ee(t,"maximum",s.value,s.message,e):ee(t,"exclusiveMaximum",s.value,s.message,e):(s.inclusive||(t.exclusiveMaximum=!0),ee(t,"maximum",s.value,s.message,e));break;case"multipleOf":ee(t,"multipleOf",s.value,s.message,e);break}return t}function Uc(){return{type:"boolean"}}function ts(a,e){return J(a.type._def,e)}var zc=(a,e)=>J(a.innerType._def,e);function En(a,e,t){let s=t!=null?t:e.dateStrategy;if(Array.isArray(s))return{anyOf:s.map((r,n)=>En(a,e,r))};switch(s){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return Om(a,e)}}var Om=(a,e)=>{let t={type:"integer",format:"unix-time"};if(e.target==="openApi3")return t;for(let s of a.checks)switch(s.kind){case"min":ee(t,"minimum",s.value,s.message,e);break;case"max":ee(t,"maximum",s.value,s.message,e);break}return t};function Vc(a,e){return{...J(a.innerType._def,e),default:a.defaultValue()}}function Hc(a,e){return e.effectStrategy==="input"?J(a.schema._def,e):fe(e)}function Zc(a){return{type:"string",enum:Array.from(a.values)}}var Tm=a=>"type"in a&&a.type==="string"?!1:"allOf"in a;function Bc(a,e){let t=[J(a.left._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),J(a.right._def,{...e,currentPath:[...e.currentPath,"allOf","1"]})].filter(n=>!!n),s=e.target==="jsonSchema2019-09"?{unevaluatedProperties:!1}:void 0,r=[];return t.forEach(n=>{if(Tm(n))r.push(...n.allOf),n.unevaluatedProperties===void 0&&(s=void 0);else{let o=n;if("additionalProperties"in n&&n.additionalProperties===!1){let{additionalProperties:l,...u}=n;o=u}else s=void 0;r.push(o)}}),r.length?{allOf:r,...s}:void 0}function Jc(a,e){let t=typeof a.value;return t!=="bigint"&&t!=="number"&&t!=="boolean"&&t!=="string"?{type:Array.isArray(a.value)?"array":"object"}:e.target==="openApi3"?{type:t==="bigint"?"integer":t,enum:[a.value]}:{type:t==="bigint"?"integer":t,const:a.value}}var Pn,Xe={cuid:/^[cC][^\s-]{8,}$/,cuid2:/^[0-9a-z]+$/,ulid:/^[0-9A-HJKMNP-TV-Z]{26}$/,email:/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,emoji:()=>(Pn===void 0&&(Pn=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),Pn),uuid:/^[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}$/,ipv4:/^(?:(?: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])$/,ipv4Cidr:/^(?:(?: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])$/,ipv6:/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,ipv6Cidr:/^(([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])$/,base64:/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,base64url:/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,nanoid:/^[a-zA-Z0-9_-]{21}$/,jwt:/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/};function as(a,e){let t={type:"string"};if(a.checks)for(let s of a.checks)switch(s.kind){case"min":ee(t,"minLength",typeof t.minLength=="number"?Math.max(t.minLength,s.value):s.value,s.message,e);break;case"max":ee(t,"maxLength",typeof t.maxLength=="number"?Math.min(t.maxLength,s.value):s.value,s.message,e);break;case"email":switch(e.emailStrategy){case"format:email":er(t,"email",s.message,e);break;case"format:idn-email":er(t,"idn-email",s.message,e);break;case"pattern:zod":De(t,Xe.email,s.message,e);break}break;case"url":er(t,"uri",s.message,e);break;case"uuid":er(t,"uuid",s.message,e);break;case"regex":De(t,s.regex,s.message,e);break;case"cuid":De(t,Xe.cuid,s.message,e);break;case"cuid2":De(t,Xe.cuid2,s.message,e);break;case"startsWith":De(t,RegExp(`^${Sn(s.value,e)}`),s.message,e);break;case"endsWith":De(t,RegExp(`${Sn(s.value,e)}$`),s.message,e);break;case"datetime":er(t,"date-time",s.message,e);break;case"date":er(t,"date",s.message,e);break;case"time":er(t,"time",s.message,e);break;case"duration":er(t,"duration",s.message,e);break;case"length":ee(t,"minLength",typeof t.minLength=="number"?Math.max(t.minLength,s.value):s.value,s.message,e),ee(t,"maxLength",typeof t.maxLength=="number"?Math.min(t.maxLength,s.value):s.value,s.message,e);break;case"includes":{De(t,RegExp(Sn(s.value,e)),s.message,e);break}case"ip":{s.version!=="v6"&&er(t,"ipv4",s.message,e),s.version!=="v4"&&er(t,"ipv6",s.message,e);break}case"base64url":De(t,Xe.base64url,s.message,e);break;case"jwt":De(t,Xe.jwt,s.message,e);break;case"cidr":{s.version!=="v6"&&De(t,Xe.ipv4Cidr,s.message,e),s.version!=="v4"&&De(t,Xe.ipv6Cidr,s.message,e);break}case"emoji":De(t,Xe.emoji(),s.message,e);break;case"ulid":{De(t,Xe.ulid,s.message,e);break}case"base64":{switch(e.base64Strategy){case"format:binary":{er(t,"binary",s.message,e);break}case"contentEncoding:base64":{ee(t,"contentEncoding","base64",s.message,e);break}case"pattern:zod":{De(t,Xe.base64,s.message,e);break}}break}case"nanoid":De(t,Xe.nanoid,s.message,e);case"toLowerCase":case"toUpperCase":case"trim":break;default:}return t}function Sn(a,e){return e.patternStrategy==="escape"?Am(a):a}var $m=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function Am(a){let e="";for(let t=0;t<a.length;t++)$m.has(a[t])||(e+="\\"),e+=a[t];return e}function er(a,e,t,s){var r;a.format||(r=a.anyOf)!=null&&r.some(n=>n.format)?(a.anyOf||(a.anyOf=[]),a.format&&(a.anyOf.push({format:a.format,...a.errorMessage&&s.errorMessages&&{errorMessage:{format:a.errorMessage.format}}}),delete a.format,a.errorMessage&&(delete a.errorMessage.format,Object.keys(a.errorMessage).length===0&&delete a.errorMessage)),a.anyOf.push({format:e,...t&&s.errorMessages&&{errorMessage:{format:t}}})):ee(a,"format",e,t,s)}function De(a,e,t,s){var r;a.pattern||(r=a.allOf)!=null&&r.some(n=>n.pattern)?(a.allOf||(a.allOf=[]),a.pattern&&(a.allOf.push({pattern:a.pattern,...a.errorMessage&&s.errorMessages&&{errorMessage:{pattern:a.errorMessage.pattern}}}),delete a.pattern,a.errorMessage&&(delete a.errorMessage.pattern,Object.keys(a.errorMessage).length===0&&delete a.errorMessage)),a.allOf.push({pattern:Qc(e,s),...t&&s.errorMessages&&{errorMessage:{pattern:t}}})):ee(a,"pattern",Qc(e,s),t,s)}function Qc(a,e){var u;if(!e.applyRegexFlags||!a.flags)return a.source;let t={i:a.flags.includes("i"),m:a.flags.includes("m"),s:a.flags.includes("s")},s=t.i?a.source.toLowerCase():a.source,r="",n=!1,o=!1,l=!1;for(let c=0;c<s.length;c++){if(n){r+=s[c],n=!1;continue}if(t.i){if(o){if(s[c].match(/[a-z]/)){l?(r+=s[c],r+=`${s[c-2]}-${s[c]}`.toUpperCase(),l=!1):s[c+1]==="-"&&((u=s[c+2])!=null&&u.match(/[a-z]/))?(r+=s[c],l=!0):r+=`${s[c]}${s[c].toUpperCase()}`;continue}}else if(s[c].match(/[a-z]/)){r+=`[${s[c]}${s[c].toUpperCase()}]`;continue}}if(t.m){if(s[c]==="^"){r+=`(^|(?<=[\r
|
|
13
|
+
`,e.write(r)}async handleUnsupportedRequest(e){e.writeHead(405,{Allow:"GET, POST, DELETE"}).end(JSON.stringify({jsonrpc:"2.0",error:{code:-32e3,message:"Method not allowed."},id:null}))}async handlePostRequest(e,t,s){var r,n,o,i,u;try{let c=e.headers.accept;if(!(c!=null&&c.includes("application/json"))||!c.includes("text/event-stream")){t.writeHead(406).end(JSON.stringify({jsonrpc:"2.0",error:{code:-32e3,message:"Not Acceptable: Client must accept both application/json and text/event-stream"},id:null}));return}let f=e.headers["content-type"];if(!f||!f.includes("application/json")){t.writeHead(415).end(JSON.stringify({jsonrpc:"2.0",error:{code:-32e3,message:"Unsupported Media Type: Content-Type must be application/json"},id:null}));return}let p=e.auth,g={headers:e.headers},d;if(s!==void 0)d=s;else{let x=bc.default.parse(f),S=await Ht(e,{limit:sm,encoding:(r=x.parameters.charset)!==null&&r!==void 0?r:"utf-8"});d=JSON.parse(S.toString())}let y;Array.isArray(d)?y=d.map(x=>Xe.parse(x)):y=[Xe.parse(d)];let m=y.some(uo);if(m){if(this._initialized&&this.sessionId!==void 0){t.writeHead(400).end(JSON.stringify({jsonrpc:"2.0",error:{code:-32600,message:"Invalid Request: Server already initialized"},id:null}));return}if(y.length>1){t.writeHead(400).end(JSON.stringify({jsonrpc:"2.0",error:{code:-32600,message:"Invalid Request: Only one initialization request is allowed"},id:null}));return}this.sessionId=(n=this.sessionIdGenerator)===null||n===void 0?void 0:n.call(this),this._initialized=!0,this.sessionId&&this._onsessioninitialized&&await Promise.resolve(this._onsessioninitialized(this.sessionId))}if(!m&&(!this.validateSession(e,t)||!this.validateProtocolVersion(e,t)))return;let v=y.some(at);if(v){if(v){let x=(0,xc.randomUUID)();if(!this._enableJsonResponse){let S={"Content-Type":"text/event-stream","Cache-Control":"no-cache",Connection:"keep-alive"};this.sessionId!==void 0&&(S["mcp-session-id"]=this.sessionId),t.writeHead(200,S)}for(let S of y)at(S)&&(this._streamMapping.set(x,t),this._requestToStreamMapping.set(S.id,x));t.on("close",()=>{this._streamMapping.delete(x)});for(let S of y)(i=this.onmessage)===null||i===void 0||i.call(this,S,{authInfo:p,requestInfo:g})}}else{t.writeHead(202).end();for(let x of y)(o=this.onmessage)===null||o===void 0||o.call(this,x,{authInfo:p,requestInfo:g})}}catch(c){t.writeHead(400).end(JSON.stringify({jsonrpc:"2.0",error:{code:-32700,message:"Parse error",data:String(c)},id:null})),(u=this.onerror)===null||u===void 0||u.call(this,c)}}async handleDeleteRequest(e,t){var s;this.validateSession(e,t)&&this.validateProtocolVersion(e,t)&&(await Promise.resolve((s=this._onsessionclosed)===null||s===void 0?void 0:s.call(this,this.sessionId)),await this.close(),t.writeHead(200).end())}validateSession(e,t){if(this.sessionIdGenerator===void 0)return!0;if(!this._initialized)return t.writeHead(400).end(JSON.stringify({jsonrpc:"2.0",error:{code:-32e3,message:"Bad Request: Server not initialized"},id:null})),!1;let s=e.headers["mcp-session-id"];if(s){if(Array.isArray(s))return t.writeHead(400).end(JSON.stringify({jsonrpc:"2.0",error:{code:-32e3,message:"Bad Request: Mcp-Session-Id header must be a single value"},id:null})),!1;if(s!==this.sessionId)return t.writeHead(404).end(JSON.stringify({jsonrpc:"2.0",error:{code:-32001,message:"Session not found"},id:null})),!1}else return t.writeHead(400).end(JSON.stringify({jsonrpc:"2.0",error:{code:-32e3,message:"Bad Request: Mcp-Session-Id header is required"},id:null})),!1;return!0}validateProtocolVersion(e,t){var s;let r=(s=e.headers["mcp-protocol-version"])!==null&&s!==void 0?s:ro;return Array.isArray(r)&&(r=r[r.length-1]),tt.includes(r)?!0:(t.writeHead(400).end(JSON.stringify({jsonrpc:"2.0",error:{code:-32e3,message:`Bad Request: Unsupported protocol version (supported versions: ${tt.join(", ")})`},id:null})),!1)}async close(){var e;this._streamMapping.forEach(t=>{t.end()}),this._streamMapping.clear(),this._requestResponseMap.clear(),(e=this.onclose)===null||e===void 0||e.call(this)}async send(e,t){let s=t==null?void 0:t.relatedRequestId;if((_r(e)||Pt(e))&&(s=e.id),s===void 0){if(_r(e)||Pt(e))throw new Error("Cannot send a response on a standalone SSE stream unless resuming a previous client request");let o=this._streamMapping.get(this._standaloneSseStreamId);if(o===void 0)return;let i;this._eventStore&&(i=await this._eventStore.storeEvent(this._standaloneSseStreamId,e)),this.writeSSEEvent(o,e,i);return}let r=this._requestToStreamMapping.get(s),n=this._streamMapping.get(r);if(!r)throw new Error(`No connection established for request ID: ${String(s)}`);if(!this._enableJsonResponse){let o;this._eventStore&&(o=await this._eventStore.storeEvent(r,e)),n&&this.writeSSEEvent(n,e,o)}if(_r(e)||Pt(e)){this._requestResponseMap.set(s,e);let o=Array.from(this._requestToStreamMapping.entries()).filter(([u,c])=>this._streamMapping.get(c)===n).map(([u])=>u);if(o.every(u=>this._requestResponseMap.has(u))){if(!n)throw new Error(`No connection established for request ID: ${String(s)}`);if(this._enableJsonResponse){let u={"Content-Type":"application/json"};this.sessionId!==void 0&&(u["mcp-session-id"]=this.sessionId);let c=o.map(f=>this._requestResponseMap.get(f));n.writeHead(200,u),c.length===1?n.end(JSON.stringify(c[0])):n.end(JSON.stringify(c))}else n.end();for(let u of o)this._requestResponseMap.delete(u),this._requestToStreamMapping.delete(u)}}}};var gn,wc,Ec,Pc;gn=(Pc=(Ec=(wc=globalThis.crypto)==null?void 0:wc.webcrypto)!=null?Ec:globalThis.crypto)!=null?Pc:import("node:crypto").then(a=>a.webcrypto);async function nm(a){return(await gn).getRandomValues(new Uint8Array(a))}async function om(a){let e="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~",t="",s=await nm(a);for(let r=0;r<a;r++){let n=s[r]%e.length;t+=e[n]}return t}async function im(a){return await om(a)}async function lm(a){let e=await(await gn).subtle.digest("SHA-256",new TextEncoder().encode(a));return btoa(String.fromCharCode(...new Uint8Array(e))).replace(/\//g,"_").replace(/\+/g,"-").replace(/=/g,"")}async function yn(a){if(a||(a=43),a<43||a>128)throw`Expected a length between 43 and 128. Received ${a}.`;let e=await im(a),t=await lm(e);return{code_verifier:e,code_challenge:t}}var Pe=l.string().url().superRefine((a,e)=>{if(!URL.canParse(a))return e.addIssue({code:l.ZodIssueCode.custom,message:"URL must be parseable",fatal:!0}),l.NEVER}).refine(a=>{let e=new URL(a);return e.protocol!=="javascript:"&&e.protocol!=="data:"&&e.protocol!=="vbscript:"},{message:"URL cannot use javascript:, data:, or vbscript: scheme"}),Sc=l.object({resource:l.string().url(),authorization_servers:l.array(Pe).optional(),jwks_uri:l.string().url().optional(),scopes_supported:l.array(l.string()).optional(),bearer_methods_supported:l.array(l.string()).optional(),resource_signing_alg_values_supported:l.array(l.string()).optional(),resource_name:l.string().optional(),resource_documentation:l.string().optional(),resource_policy_uri:l.string().url().optional(),resource_tos_uri:l.string().url().optional(),tls_client_certificate_bound_access_tokens:l.boolean().optional(),authorization_details_types_supported:l.array(l.string()).optional(),dpop_signing_alg_values_supported:l.array(l.string()).optional(),dpop_bound_access_tokens_required:l.boolean().optional()}).passthrough(),_n=l.object({issuer:l.string(),authorization_endpoint:Pe,token_endpoint:Pe,registration_endpoint:Pe.optional(),scopes_supported:l.array(l.string()).optional(),response_types_supported:l.array(l.string()),response_modes_supported:l.array(l.string()).optional(),grant_types_supported:l.array(l.string()).optional(),token_endpoint_auth_methods_supported:l.array(l.string()).optional(),token_endpoint_auth_signing_alg_values_supported:l.array(l.string()).optional(),service_documentation:Pe.optional(),revocation_endpoint:Pe.optional(),revocation_endpoint_auth_methods_supported:l.array(l.string()).optional(),revocation_endpoint_auth_signing_alg_values_supported:l.array(l.string()).optional(),introspection_endpoint:l.string().optional(),introspection_endpoint_auth_methods_supported:l.array(l.string()).optional(),introspection_endpoint_auth_signing_alg_values_supported:l.array(l.string()).optional(),code_challenge_methods_supported:l.array(l.string()).optional()}).passthrough(),cm=l.object({issuer:l.string(),authorization_endpoint:Pe,token_endpoint:Pe,userinfo_endpoint:Pe.optional(),jwks_uri:Pe,registration_endpoint:Pe.optional(),scopes_supported:l.array(l.string()).optional(),response_types_supported:l.array(l.string()),response_modes_supported:l.array(l.string()).optional(),grant_types_supported:l.array(l.string()).optional(),acr_values_supported:l.array(l.string()).optional(),subject_types_supported:l.array(l.string()),id_token_signing_alg_values_supported:l.array(l.string()),id_token_encryption_alg_values_supported:l.array(l.string()).optional(),id_token_encryption_enc_values_supported:l.array(l.string()).optional(),userinfo_signing_alg_values_supported:l.array(l.string()).optional(),userinfo_encryption_alg_values_supported:l.array(l.string()).optional(),userinfo_encryption_enc_values_supported:l.array(l.string()).optional(),request_object_signing_alg_values_supported:l.array(l.string()).optional(),request_object_encryption_alg_values_supported:l.array(l.string()).optional(),request_object_encryption_enc_values_supported:l.array(l.string()).optional(),token_endpoint_auth_methods_supported:l.array(l.string()).optional(),token_endpoint_auth_signing_alg_values_supported:l.array(l.string()).optional(),display_values_supported:l.array(l.string()).optional(),claim_types_supported:l.array(l.string()).optional(),claims_supported:l.array(l.string()).optional(),service_documentation:l.string().optional(),claims_locales_supported:l.array(l.string()).optional(),ui_locales_supported:l.array(l.string()).optional(),claims_parameter_supported:l.boolean().optional(),request_parameter_supported:l.boolean().optional(),request_uri_parameter_supported:l.boolean().optional(),require_request_uri_registration:l.boolean().optional(),op_policy_uri:Pe.optional(),op_tos_uri:Pe.optional()}).passthrough(),Rc=cm.merge(_n.pick({code_challenge_methods_supported:!0})),bn=l.object({access_token:l.string(),id_token:l.string().optional(),token_type:l.string(),expires_in:l.number().optional(),scope:l.string().optional(),refresh_token:l.string().optional()}).strip(),Oc=l.object({error:l.string(),error_description:l.string().optional(),error_uri:l.string().optional()}),um=l.object({redirect_uris:l.array(Pe),token_endpoint_auth_method:l.string().optional(),grant_types:l.array(l.string()).optional(),response_types:l.array(l.string()).optional(),client_name:l.string().optional(),client_uri:Pe.optional(),logo_uri:Pe.optional(),scope:l.string().optional(),contacts:l.array(l.string()).optional(),tos_uri:Pe.optional(),policy_uri:l.string().optional(),jwks_uri:Pe.optional(),jwks:l.any().optional(),software_id:l.string().optional(),software_version:l.string().optional(),software_statement:l.string().optional()}).strip(),dm=l.object({client_id:l.string(),client_secret:l.string().optional(),client_id_issued_at:l.number().optional(),client_secret_expires_at:l.number().optional()}).strip(),Tc=um.merge(dm),ay=l.object({error:l.string(),error_description:l.string().optional()}).strip(),sy=l.object({token:l.string(),token_type_hint:l.string().optional()}).strip();function $c(a){let e=typeof a=="string"?new URL(a):new URL(a.href);return e.hash="",e}function Ac({requestedResource:a,configuredResource:e}){let t=typeof a=="string"?new URL(a):new URL(a.href),s=typeof e=="string"?new URL(e):new URL(e.href);if(t.origin!==s.origin||t.pathname.length<s.pathname.length)return!1;let r=t.pathname.endsWith("/")?t.pathname:t.pathname+"/",n=s.pathname.endsWith("/")?s.pathname:s.pathname+"/";return r.startsWith(n)}var we=class extends Error{constructor(e,t){super(e),this.errorUri=t,this.name=this.constructor.name}toResponseObject(){let e={error:this.errorCode,error_description:this.message};return this.errorUri&&(e.error_uri=this.errorUri),e}get errorCode(){return this.constructor.errorCode}},Bt=class extends we{};Bt.errorCode="invalid_request";var ot=class extends we{};ot.errorCode="invalid_client";var it=class extends we{};it.errorCode="invalid_grant";var lt=class extends we{};lt.errorCode="unauthorized_client";var Jt=class extends we{};Jt.errorCode="unsupported_grant_type";var Qt=class extends we{};Qt.errorCode="invalid_scope";var Kt=class extends we{};Kt.errorCode="access_denied";var xr=class extends we{};xr.errorCode="server_error";var Gt=class extends we{};Gt.errorCode="temporarily_unavailable";var Wt=class extends we{};Wt.errorCode="unsupported_response_type";var Yt=class extends we{};Yt.errorCode="unsupported_token_type";var Xt=class extends we{};Xt.errorCode="invalid_token";var ea=class extends we{};ea.errorCode="method_not_allowed";var ra=class extends we{};ra.errorCode="too_many_requests";var ta=class extends we{};ta.errorCode="invalid_client_metadata";var aa=class extends we{};aa.errorCode="insufficient_scope";var Ic={[Bt.errorCode]:Bt,[ot.errorCode]:ot,[it.errorCode]:it,[lt.errorCode]:lt,[Jt.errorCode]:Jt,[Qt.errorCode]:Qt,[Kt.errorCode]:Kt,[xr.errorCode]:xr,[Gt.errorCode]:Gt,[Wt.errorCode]:Wt,[Yt.errorCode]:Yt,[Xt.errorCode]:Xt,[ea.errorCode]:ea,[ra.errorCode]:ra,[ta.errorCode]:ta,[aa.errorCode]:aa};var kr=class extends Error{constructor(e){super(e!=null?e:"Unauthorized")}};function kc(a,e){let t=a.client_secret!==void 0;return e.length===0?t?"client_secret_post":"none":t&&e.includes("client_secret_basic")?"client_secret_basic":t&&e.includes("client_secret_post")?"client_secret_post":e.includes("none")?"none":t?"client_secret_post":"none"}function Dc(a,e,t,s){let{client_id:r,client_secret:n}=e;switch(a){case"client_secret_basic":fm(r,n,t);return;case"client_secret_post":hm(r,n,s);return;case"none":pm(r,s);return;default:throw new Error(`Unsupported client authentication method: ${a}`)}}function fm(a,e,t){if(!e)throw new Error("client_secret_basic authentication requires a client_secret");let s=btoa(`${a}:${e}`);t.set("Authorization",`Basic ${s}`)}function hm(a,e,t){t.set("client_id",a),e&&t.set("client_secret",e)}function pm(a,e){e.set("client_id",a)}async function wn(a){let e=a instanceof Response?a.status:void 0,t=a instanceof Response?await a.text():a;try{let s=Oc.parse(JSON.parse(t)),{error:r,error_description:n,error_uri:o}=s,i=Ic[r]||xr;return new i(n||"",o)}catch(s){let r=`${e?`HTTP ${e}: `:""}Invalid OAuth error response: ${s}. Raw body: ${t}`;return new xr(r)}}async function Xa(a,e){var t,s;try{return await xn(a,e)}catch(r){if(r instanceof ot||r instanceof lt)return await((t=a.invalidateCredentials)===null||t===void 0?void 0:t.call(a,"all")),await xn(a,e);if(r instanceof it)return await((s=a.invalidateCredentials)===null||s===void 0?void 0:s.call(a,"tokens")),await xn(a,e);throw r}}async function xn(a,{serverUrl:e,authorizationCode:t,scope:s,resourceMetadataUrl:r,fetchFn:n}){let o,i;try{o=await vm(e,{resourceMetadataUrl:r},n),o.authorization_servers&&o.authorization_servers.length>0&&(i=o.authorization_servers[0])}catch{}i||(i=e);let u=await mm(e,a,o),c=await xm(i,{fetchFn:n}),f=await Promise.resolve(a.clientInformation());if(!f){if(t!==void 0)throw new Error("Existing OAuth client information is required when exchanging an authorization code");if(!a.saveClientInformation)throw new Error("OAuth client information must be saveable for dynamic registration");let m=await Sm(i,{metadata:c,clientMetadata:a.clientMetadata,fetchFn:n});await a.saveClientInformation(m),f=m}if(t!==void 0){let m=await a.codeVerifier(),v=await Em(i,{metadata:c,clientInformation:f,authorizationCode:t,codeVerifier:m,redirectUri:a.redirectUrl,resource:u,addClientAuthentication:a.addClientAuthentication,fetchFn:n});return await a.saveTokens(v),"AUTHORIZED"}let p=await a.tokens();if(p!=null&&p.refresh_token)try{let m=await Pm(i,{metadata:c,clientInformation:f,refreshToken:p.refresh_token,resource:u,addClientAuthentication:a.addClientAuthentication,fetchFn:n});return await a.saveTokens(m),"AUTHORIZED"}catch(m){if(!(!(m instanceof we)||m instanceof xr))throw m}let g=a.state?await a.state():void 0,{authorizationUrl:d,codeVerifier:y}=await wm(i,{metadata:c,clientInformation:f,state:g,redirectUrl:a.redirectUrl,scope:s||a.clientMetadata.scope,resource:u});return await a.saveCodeVerifier(y),await a.redirectToAuthorization(d),"REDIRECT"}async function mm(a,e,t){let s=$c(a);if(e.validateResourceURL)return await e.validateResourceURL(s,t==null?void 0:t.resource);if(t){if(!Ac({requestedResource:s,configuredResource:t.resource}))throw new Error(`Protected resource ${t.resource} does not match expected ${s} (or origin)`);return new URL(t.resource)}}function jc(a){let e=a.headers.get("WWW-Authenticate");if(!e)return;let[t,s]=e.split(" ");if(t.toLowerCase()!=="bearer"||!s)return;let n=/resource_metadata="([^"]*)"/.exec(e);if(n)try{return new URL(n[1])}catch{return}}async function vm(a,e,t=fetch){let s=await _m(a,"oauth-protected-resource",t,{protocolVersion:e==null?void 0:e.protocolVersion,metadataUrl:e==null?void 0:e.resourceMetadataUrl});if(!s||s.status===404)throw new Error("Resource server does not implement OAuth 2.0 Protected Resource Metadata.");if(!s.ok)throw new Error(`HTTP ${s.status} trying to load well-known OAuth protected resource metadata.`);return Sc.parse(await s.json())}async function En(a,e,t=fetch){try{return await t(a,{headers:e})}catch(s){if(s instanceof TypeError)return e?En(a,void 0,t):void 0;throw s}}function gm(a,e="",t={}){return e.endsWith("/")&&(e=e.slice(0,-1)),t.prependPathname?`${e}/.well-known/${a}`:`/.well-known/${a}${e}`}async function Cc(a,e,t=fetch){return await En(a,{"MCP-Protocol-Version":e},t)}function ym(a,e){return!a||a.status>=400&&a.status<500&&e!=="/"}async function _m(a,e,t,s){var r,n;let o=new URL(a),i=(r=s==null?void 0:s.protocolVersion)!==null&&r!==void 0?r:Tr,u;if(s!=null&&s.metadataUrl)u=new URL(s.metadataUrl);else{let f=gm(e,o.pathname);u=new URL(f,(n=s==null?void 0:s.metadataServerUrl)!==null&&n!==void 0?n:o),u.search=o.search}let c=await Cc(u,i,t);if(!(s!=null&&s.metadataUrl)&&ym(c,o.pathname)){let f=new URL(`/.well-known/${e}`,o);c=await Cc(f,i,t)}return c}function bm(a){let e=typeof a=="string"?new URL(a):a,t=e.pathname!=="/",s=[];if(!t)return s.push({url:new URL("/.well-known/oauth-authorization-server",e.origin),type:"oauth"}),s.push({url:new URL("/.well-known/openid-configuration",e.origin),type:"oidc"}),s;let r=e.pathname;return r.endsWith("/")&&(r=r.slice(0,-1)),s.push({url:new URL(`/.well-known/oauth-authorization-server${r}`,e.origin),type:"oauth"}),s.push({url:new URL("/.well-known/oauth-authorization-server",e.origin),type:"oauth"}),s.push({url:new URL(`/.well-known/openid-configuration${r}`,e.origin),type:"oidc"}),s.push({url:new URL(`${r}/.well-known/openid-configuration`,e.origin),type:"oidc"}),s}async function xm(a,{fetchFn:e=fetch,protocolVersion:t=Tr}={}){var s;let r={"MCP-Protocol-Version":t},n=bm(a);for(let{url:o,type:i}of n){let u=await En(o,r,e);if(u){if(!u.ok){if(u.status>=400&&u.status<500)continue;throw new Error(`HTTP ${u.status} trying to load ${i==="oauth"?"OAuth":"OpenID provider"} metadata from ${o}`)}if(i==="oauth")return _n.parse(await u.json());{let c=Rc.parse(await u.json());if(!(!((s=c.code_challenge_methods_supported)===null||s===void 0)&&s.includes("S256")))throw new Error(`Incompatible OIDC provider at ${o}: does not support S256 code challenge method required by MCP specification`);return c}}}}async function wm(a,{metadata:e,clientInformation:t,redirectUrl:s,scope:r,state:n,resource:o}){let i="code",u="S256",c;if(e){if(c=new URL(e.authorization_endpoint),!e.response_types_supported.includes(i))throw new Error(`Incompatible auth server: does not support response type ${i}`);if(!e.code_challenge_methods_supported||!e.code_challenge_methods_supported.includes(u))throw new Error(`Incompatible auth server: does not support code challenge method ${u}`)}else c=new URL("/authorize",a);let f=await yn(),p=f.code_verifier,g=f.code_challenge;return c.searchParams.set("response_type",i),c.searchParams.set("client_id",t.client_id),c.searchParams.set("code_challenge",g),c.searchParams.set("code_challenge_method",u),c.searchParams.set("redirect_uri",String(s)),n&&c.searchParams.set("state",n),r&&c.searchParams.set("scope",r),r!=null&&r.includes("offline_access")&&c.searchParams.append("prompt","consent"),o&&c.searchParams.set("resource",o.href),{authorizationUrl:c,codeVerifier:p}}async function Em(a,{metadata:e,clientInformation:t,authorizationCode:s,codeVerifier:r,redirectUri:n,resource:o,addClientAuthentication:i,fetchFn:u}){var c;let f="authorization_code",p=e!=null&&e.token_endpoint?new URL(e.token_endpoint):new URL("/token",a);if(e!=null&&e.grant_types_supported&&!e.grant_types_supported.includes(f))throw new Error(`Incompatible auth server: does not support grant type ${f}`);let g=new Headers({"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"}),d=new URLSearchParams({grant_type:f,code:s,code_verifier:r,redirect_uri:String(n)});if(i)i(g,d,a,e);else{let m=(c=e==null?void 0:e.token_endpoint_auth_methods_supported)!==null&&c!==void 0?c:[],v=kc(t,m);Dc(v,t,g,d)}o&&d.set("resource",o.href);let y=await(u!=null?u:fetch)(p,{method:"POST",headers:g,body:d});if(!y.ok)throw await wn(y);return bn.parse(await y.json())}async function Pm(a,{metadata:e,clientInformation:t,refreshToken:s,resource:r,addClientAuthentication:n,fetchFn:o}){var i;let u="refresh_token",c;if(e){if(c=new URL(e.token_endpoint),e.grant_types_supported&&!e.grant_types_supported.includes(u))throw new Error(`Incompatible auth server: does not support grant type ${u}`)}else c=new URL("/token",a);let f=new Headers({"Content-Type":"application/x-www-form-urlencoded"}),p=new URLSearchParams({grant_type:u,refresh_token:s});if(n)n(f,p,a,e);else{let d=(i=e==null?void 0:e.token_endpoint_auth_methods_supported)!==null&&i!==void 0?i:[],y=kc(t,d);Dc(y,t,f,p)}r&&p.set("resource",r.href);let g=await(o!=null?o:fetch)(c,{method:"POST",headers:f,body:p});if(!g.ok)throw await wn(g);return bn.parse({refresh_token:s,...await g.json()})}async function Sm(a,{metadata:e,clientMetadata:t,fetchFn:s}){let r;if(e){if(!e.registration_endpoint)throw new Error("Incompatible auth server: does not support dynamic client registration");r=new URL(e.registration_endpoint)}else r=new URL("/register",a);let n=await(s!=null?s:fetch)(r,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!n.ok)throw await wn(n);return Tc.parse(await n.json())}var es=class extends Error{constructor(e,t){super(e),this.name="ParseError",this.type=t.type,this.field=t.field,this.value=t.value,this.line=t.line}};function Pn(a){}function Nc(a){if(typeof a=="function")throw new TypeError("`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?");let{onEvent:e=Pn,onError:t=Pn,onRetry:s=Pn,onComment:r}=a,n="",o=!0,i,u="",c="";function f(m){let v=o?m.replace(/^\xEF\xBB\xBF/,""):m,[x,S]=Rm(`${n}${v}`);for(let P of x)p(P);n=S,o=!1}function p(m){if(m===""){d();return}if(m.startsWith(":")){r&&r(m.slice(m.startsWith(": ")?2:1));return}let v=m.indexOf(":");if(v!==-1){let x=m.slice(0,v),S=m[v+1]===" "?2:1,P=m.slice(v+S);g(x,P,m);return}g(m,"",m)}function g(m,v,x){switch(m){case"event":c=v;break;case"data":u=`${u}${v}
|
|
14
|
+
`;break;case"id":i=v.includes("\0")?void 0:v;break;case"retry":/^\d+$/.test(v)?s(parseInt(v,10)):t(new es(`Invalid \`retry\` value: "${v}"`,{type:"invalid-retry",value:v,line:x}));break;default:t(new es(`Unknown field "${m.length>20?`${m.slice(0,20)}\u2026`:m}"`,{type:"unknown-field",field:m,value:v,line:x}));break}}function d(){u.length>0&&e({id:i,event:c||void 0,data:u.endsWith(`
|
|
15
|
+
`)?u.slice(0,-1):u}),i=void 0,u="",c=""}function y(m={}){n&&m.consume&&p(n),o=!0,i=void 0,u="",c="",n=""}return{feed:f,reset:y}}function Rm(a){let e=[],t="",s=0;for(;s<a.length;){let r=a.indexOf("\r",s),n=a.indexOf(`
|
|
16
|
+
`,s),o=-1;if(r!==-1&&n!==-1?o=Math.min(r,n):r!==-1?o=r:n!==-1&&(o=n),o===-1){t=a.slice(s);break}else{let i=a.slice(s,o);e.push(i),s=o+1,a[s-1]==="\r"&&a[s]===`
|
|
17
|
+
`&&s++}}return[e,t]}var rs=class extends TransformStream{constructor({onError:e,onRetry:t,onComment:s}={}){let r;super({start(n){r=Nc({onEvent:o=>{n.enqueue(o)},onError(o){e==="terminate"?n.error(o):typeof e=="function"&&e(o)},onRetry:t,onComment:s})},transform(n){r.feed(n)}})}};var Om={initialReconnectionDelay:1e3,maxReconnectionDelay:3e4,reconnectionDelayGrowFactor:1.5,maxRetries:2},sa=class extends Error{constructor(e,t){super(`Streamable HTTP error: ${t}`),this.code=e}},ts=class{constructor(e,t){var s;this._url=e,this._resourceMetadataUrl=void 0,this._requestInit=t==null?void 0:t.requestInit,this._authProvider=t==null?void 0:t.authProvider,this._fetch=t==null?void 0:t.fetch,this._sessionId=t==null?void 0:t.sessionId,this._reconnectionOptions=(s=t==null?void 0:t.reconnectionOptions)!==null&&s!==void 0?s:Om}async _authThenStart(){var e;if(!this._authProvider)throw new kr("No auth provider");let t;try{t=await Xa(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,fetchFn:this._fetch})}catch(s){throw(e=this.onerror)===null||e===void 0||e.call(this,s),s}if(t!=="AUTHORIZED")throw new kr;return await this._startOrAuthSse({resumptionToken:void 0})}async _commonHeaders(){var e;let t={};if(this._authProvider){let r=await this._authProvider.tokens();r&&(t.Authorization=`Bearer ${r.access_token}`)}this._sessionId&&(t["mcp-session-id"]=this._sessionId),this._protocolVersion&&(t["mcp-protocol-version"]=this._protocolVersion);let s=this._normalizeHeaders((e=this._requestInit)===null||e===void 0?void 0:e.headers);return new Headers({...t,...s})}async _startOrAuthSse(e){var t,s,r;let{resumptionToken:n}=e;try{let o=await this._commonHeaders();o.set("Accept","text/event-stream"),n&&o.set("last-event-id",n);let i=await((t=this._fetch)!==null&&t!==void 0?t:fetch)(this._url,{method:"GET",headers:o,signal:(s=this._abortController)===null||s===void 0?void 0:s.signal});if(!i.ok){if(i.status===401&&this._authProvider)return await this._authThenStart();if(i.status===405)return;throw new sa(i.status,`Failed to open SSE stream: ${i.statusText}`)}this._handleSseStream(i.body,e,!0)}catch(o){throw(r=this.onerror)===null||r===void 0||r.call(this,o),o}}_getNextReconnectionDelay(e){let t=this._reconnectionOptions.initialReconnectionDelay,s=this._reconnectionOptions.reconnectionDelayGrowFactor,r=this._reconnectionOptions.maxReconnectionDelay;return Math.min(t*Math.pow(s,e),r)}_normalizeHeaders(e){return e?e instanceof Headers?Object.fromEntries(e.entries()):Array.isArray(e)?Object.fromEntries(e):{...e}:{}}_scheduleReconnection(e,t=0){var s;let r=this._reconnectionOptions.maxRetries;if(r>0&&t>=r){(s=this.onerror)===null||s===void 0||s.call(this,new Error(`Maximum reconnection attempts (${r}) exceeded.`));return}let n=this._getNextReconnectionDelay(t);setTimeout(()=>{this._startOrAuthSse(e).catch(o=>{var i;(i=this.onerror)===null||i===void 0||i.call(this,new Error(`Failed to reconnect SSE stream: ${o instanceof Error?o.message:String(o)}`)),this._scheduleReconnection(e,t+1)})},n)}_handleSseStream(e,t,s){if(!e)return;let{onresumptiontoken:r,replayMessageId:n}=t,o;(async()=>{var u,c,f,p;try{let g=e.pipeThrough(new TextDecoderStream).pipeThrough(new rs).getReader();for(;;){let{value:d,done:y}=await g.read();if(y)break;if(d.id&&(o=d.id,r==null||r(d.id)),!d.event||d.event==="message")try{let m=Xe.parse(JSON.parse(d.data));n!==void 0&&_r(m)&&(m.id=n),(u=this.onmessage)===null||u===void 0||u.call(this,m)}catch(m){(c=this.onerror)===null||c===void 0||c.call(this,m)}}}catch(g){if((f=this.onerror)===null||f===void 0||f.call(this,new Error(`SSE stream disconnected: ${g}`)),s&&this._abortController&&!this._abortController.signal.aborted)try{this._scheduleReconnection({resumptionToken:o,onresumptiontoken:r,replayMessageId:n},0)}catch(d){(p=this.onerror)===null||p===void 0||p.call(this,new Error(`Failed to reconnect: ${d instanceof Error?d.message:String(d)}`))}}})()}async start(){if(this._abortController)throw new Error("StreamableHTTPClientTransport already started! If using Client class, note that connect() calls start() automatically.");this._abortController=new AbortController}async finishAuth(e){if(!this._authProvider)throw new kr("No auth provider");if(await Xa(this._authProvider,{serverUrl:this._url,authorizationCode:e,resourceMetadataUrl:this._resourceMetadataUrl,fetchFn:this._fetch})!=="AUTHORIZED")throw new kr("Failed to authorize")}async close(){var e,t;(e=this._abortController)===null||e===void 0||e.abort(),(t=this.onclose)===null||t===void 0||t.call(this)}async send(e,t){var s,r,n,o;try{let{resumptionToken:i,onresumptiontoken:u}=t||{};if(i){this._startOrAuthSse({resumptionToken:i,replayMessageId:at(e)?e.id:void 0}).catch(v=>{var x;return(x=this.onerror)===null||x===void 0?void 0:x.call(this,v)});return}let c=await this._commonHeaders();c.set("content-type","application/json"),c.set("accept","application/json, text/event-stream");let f={...this._requestInit,method:"POST",headers:c,body:JSON.stringify(e),signal:(s=this._abortController)===null||s===void 0?void 0:s.signal},p=await((r=this._fetch)!==null&&r!==void 0?r:fetch)(this._url,f),g=p.headers.get("mcp-session-id");if(g&&(this._sessionId=g),!p.ok){if(p.status===401&&this._authProvider){if(this._resourceMetadataUrl=jc(p),await Xa(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,fetchFn:this._fetch})!=="AUTHORIZED")throw new kr;return this.send(e)}let v=await p.text().catch(()=>null);throw new Error(`Error POSTing to endpoint (HTTP ${p.status}): ${v}`)}if(p.status===202){fo(e)&&this._startOrAuthSse({resumptionToken:void 0}).catch(v=>{var x;return(x=this.onerror)===null||x===void 0?void 0:x.call(this,v)});return}let y=(Array.isArray(e)?e:[e]).filter(v=>"method"in v&&"id"in v&&v.id!==void 0).length>0,m=p.headers.get("content-type");if(y)if(m!=null&&m.includes("text/event-stream"))this._handleSseStream(p.body,{onresumptiontoken:u},!1);else if(m!=null&&m.includes("application/json")){let v=await p.json(),x=Array.isArray(v)?v.map(S=>Xe.parse(S)):[Xe.parse(v)];for(let S of x)(n=this.onmessage)===null||n===void 0||n.call(this,S)}else throw new sa(-1,`Unexpected content type: ${m}`)}catch(i){throw(o=this.onerror)===null||o===void 0||o.call(this,i),i}}get sessionId(){return this._sessionId}async terminateSession(){var e,t,s;if(this._sessionId)try{let r=await this._commonHeaders(),n={...this._requestInit,method:"DELETE",headers:r,signal:(e=this._abortController)===null||e===void 0?void 0:e.signal},o=await((t=this._fetch)!==null&&t!==void 0?t:fetch)(this._url,n);if(!o.ok&&o.status!==405)throw new sa(o.status,`Failed to terminate session: ${o.statusText}`);this._sessionId=void 0}catch(r){throw(s=this.onerror)===null||s===void 0||s.call(this,r),r}}setProtocolVersion(e){this._protocolVersion=e}get protocolVersion(){return this._protocolVersion}};var Fc=Symbol("Let zodToJsonSchema decide on which parser to use");var Lc={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"},Mc=a=>typeof a=="string"?{...Lc,name:a}:{...Lc,...a};var qc=a=>{let e=Mc(a),t=e.name!==void 0?[...e.basePath,e.definitionPath,e.name]:e.basePath;return{...e,flags:{hasReferencedOpenAiAnyType:!1},currentPath:t,propertyPath:void 0,seen:new Map(Object.entries(e.definitions).map(([s,r])=>[r._def,{def:r._def,path:[...e.basePath,e.definitionPath,s],jsonSchema:void 0}]))}};function Sn(a,e,t,s){s!=null&&s.errorMessages&&t&&(a.errorMessage={...a.errorMessage,[e]:t})}function ee(a,e,t,s,r){a[e]=t,Sn(a,e,s,r)}var as=(a,e)=>{let t=0;for(;t<a.length&&t<e.length&&a[t]===e[t];t++);return[(a.length-t).toString(),...e.slice(t)].join("/")};function fe(a){if(a.target!=="openAi")return{};let e=[...a.basePath,a.definitionPath,a.openAiAnyTypeName];return a.flags.hasReferencedOpenAiAnyType=!0,{$ref:a.$refStrategy==="relative"?as(e,a.currentPath):e.join("/")}}function Uc(a,e){var s,r,n;let t={type:"array"};return(s=a.type)!=null&&s._def&&((n=(r=a.type)==null?void 0:r._def)==null?void 0:n.typeName)!==T.ZodAny&&(t.items=J(a.type._def,{...e,currentPath:[...e.currentPath,"items"]})),a.minLength&&ee(t,"minItems",a.minLength.value,a.minLength.message,e),a.maxLength&&ee(t,"maxItems",a.maxLength.value,a.maxLength.message,e),a.exactLength&&(ee(t,"minItems",a.exactLength.value,a.exactLength.message,e),ee(t,"maxItems",a.exactLength.value,a.exactLength.message,e)),t}function zc(a,e){let t={type:"integer",format:"int64"};if(!a.checks)return t;for(let s of a.checks)switch(s.kind){case"min":e.target==="jsonSchema7"?s.inclusive?ee(t,"minimum",s.value,s.message,e):ee(t,"exclusiveMinimum",s.value,s.message,e):(s.inclusive||(t.exclusiveMinimum=!0),ee(t,"minimum",s.value,s.message,e));break;case"max":e.target==="jsonSchema7"?s.inclusive?ee(t,"maximum",s.value,s.message,e):ee(t,"exclusiveMaximum",s.value,s.message,e):(s.inclusive||(t.exclusiveMaximum=!0),ee(t,"maximum",s.value,s.message,e));break;case"multipleOf":ee(t,"multipleOf",s.value,s.message,e);break}return t}function Vc(){return{type:"boolean"}}function ss(a,e){return J(a.type._def,e)}var Hc=(a,e)=>J(a.innerType._def,e);function Rn(a,e,t){let s=t!=null?t:e.dateStrategy;if(Array.isArray(s))return{anyOf:s.map((r,n)=>Rn(a,e,r))};switch(s){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return Tm(a,e)}}var Tm=(a,e)=>{let t={type:"integer",format:"unix-time"};if(e.target==="openApi3")return t;for(let s of a.checks)switch(s.kind){case"min":ee(t,"minimum",s.value,s.message,e);break;case"max":ee(t,"maximum",s.value,s.message,e);break}return t};function Zc(a,e){return{...J(a.innerType._def,e),default:a.defaultValue()}}function Bc(a,e){return e.effectStrategy==="input"?J(a.schema._def,e):fe(e)}function Jc(a){return{type:"string",enum:Array.from(a.values)}}var $m=a=>"type"in a&&a.type==="string"?!1:"allOf"in a;function Qc(a,e){let t=[J(a.left._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),J(a.right._def,{...e,currentPath:[...e.currentPath,"allOf","1"]})].filter(n=>!!n),s=e.target==="jsonSchema2019-09"?{unevaluatedProperties:!1}:void 0,r=[];return t.forEach(n=>{if($m(n))r.push(...n.allOf),n.unevaluatedProperties===void 0&&(s=void 0);else{let o=n;if("additionalProperties"in n&&n.additionalProperties===!1){let{additionalProperties:i,...u}=n;o=u}else s=void 0;r.push(o)}}),r.length?{allOf:r,...s}:void 0}function Kc(a,e){let t=typeof a.value;return t!=="bigint"&&t!=="number"&&t!=="boolean"&&t!=="string"?{type:Array.isArray(a.value)?"array":"object"}:e.target==="openApi3"?{type:t==="bigint"?"integer":t,enum:[a.value]}:{type:t==="bigint"?"integer":t,const:a.value}}var On,er={cuid:/^[cC][^\s-]{8,}$/,cuid2:/^[0-9a-z]+$/,ulid:/^[0-9A-HJKMNP-TV-Z]{26}$/,email:/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,emoji:()=>(On===void 0&&(On=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),On),uuid:/^[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}$/,ipv4:/^(?:(?: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])$/,ipv4Cidr:/^(?:(?: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])$/,ipv6:/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,ipv6Cidr:/^(([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])$/,base64:/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,base64url:/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,nanoid:/^[a-zA-Z0-9_-]{21}$/,jwt:/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/};function ns(a,e){let t={type:"string"};if(a.checks)for(let s of a.checks)switch(s.kind){case"min":ee(t,"minLength",typeof t.minLength=="number"?Math.max(t.minLength,s.value):s.value,s.message,e);break;case"max":ee(t,"maxLength",typeof t.maxLength=="number"?Math.min(t.maxLength,s.value):s.value,s.message,e);break;case"email":switch(e.emailStrategy){case"format:email":rr(t,"email",s.message,e);break;case"format:idn-email":rr(t,"idn-email",s.message,e);break;case"pattern:zod":je(t,er.email,s.message,e);break}break;case"url":rr(t,"uri",s.message,e);break;case"uuid":rr(t,"uuid",s.message,e);break;case"regex":je(t,s.regex,s.message,e);break;case"cuid":je(t,er.cuid,s.message,e);break;case"cuid2":je(t,er.cuid2,s.message,e);break;case"startsWith":je(t,RegExp(`^${Tn(s.value,e)}`),s.message,e);break;case"endsWith":je(t,RegExp(`${Tn(s.value,e)}$`),s.message,e);break;case"datetime":rr(t,"date-time",s.message,e);break;case"date":rr(t,"date",s.message,e);break;case"time":rr(t,"time",s.message,e);break;case"duration":rr(t,"duration",s.message,e);break;case"length":ee(t,"minLength",typeof t.minLength=="number"?Math.max(t.minLength,s.value):s.value,s.message,e),ee(t,"maxLength",typeof t.maxLength=="number"?Math.min(t.maxLength,s.value):s.value,s.message,e);break;case"includes":{je(t,RegExp(Tn(s.value,e)),s.message,e);break}case"ip":{s.version!=="v6"&&rr(t,"ipv4",s.message,e),s.version!=="v4"&&rr(t,"ipv6",s.message,e);break}case"base64url":je(t,er.base64url,s.message,e);break;case"jwt":je(t,er.jwt,s.message,e);break;case"cidr":{s.version!=="v6"&&je(t,er.ipv4Cidr,s.message,e),s.version!=="v4"&&je(t,er.ipv6Cidr,s.message,e);break}case"emoji":je(t,er.emoji(),s.message,e);break;case"ulid":{je(t,er.ulid,s.message,e);break}case"base64":{switch(e.base64Strategy){case"format:binary":{rr(t,"binary",s.message,e);break}case"contentEncoding:base64":{ee(t,"contentEncoding","base64",s.message,e);break}case"pattern:zod":{je(t,er.base64,s.message,e);break}}break}case"nanoid":je(t,er.nanoid,s.message,e);case"toLowerCase":case"toUpperCase":case"trim":break;default:}return t}function Tn(a,e){return e.patternStrategy==="escape"?Im(a):a}var Am=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function Im(a){let e="";for(let t=0;t<a.length;t++)Am.has(a[t])||(e+="\\"),e+=a[t];return e}function rr(a,e,t,s){var r;a.format||(r=a.anyOf)!=null&&r.some(n=>n.format)?(a.anyOf||(a.anyOf=[]),a.format&&(a.anyOf.push({format:a.format,...a.errorMessage&&s.errorMessages&&{errorMessage:{format:a.errorMessage.format}}}),delete a.format,a.errorMessage&&(delete a.errorMessage.format,Object.keys(a.errorMessage).length===0&&delete a.errorMessage)),a.anyOf.push({format:e,...t&&s.errorMessages&&{errorMessage:{format:t}}})):ee(a,"format",e,t,s)}function je(a,e,t,s){var r;a.pattern||(r=a.allOf)!=null&&r.some(n=>n.pattern)?(a.allOf||(a.allOf=[]),a.pattern&&(a.allOf.push({pattern:a.pattern,...a.errorMessage&&s.errorMessages&&{errorMessage:{pattern:a.errorMessage.pattern}}}),delete a.pattern,a.errorMessage&&(delete a.errorMessage.pattern,Object.keys(a.errorMessage).length===0&&delete a.errorMessage)),a.allOf.push({pattern:Gc(e,s),...t&&s.errorMessages&&{errorMessage:{pattern:t}}})):ee(a,"pattern",Gc(e,s),t,s)}function Gc(a,e){var u;if(!e.applyRegexFlags||!a.flags)return a.source;let t={i:a.flags.includes("i"),m:a.flags.includes("m"),s:a.flags.includes("s")},s=t.i?a.source.toLowerCase():a.source,r="",n=!1,o=!1,i=!1;for(let c=0;c<s.length;c++){if(n){r+=s[c],n=!1;continue}if(t.i){if(o){if(s[c].match(/[a-z]/)){i?(r+=s[c],r+=`${s[c-2]}-${s[c]}`.toUpperCase(),i=!1):s[c+1]==="-"&&((u=s[c+2])!=null&&u.match(/[a-z]/))?(r+=s[c],i=!0):r+=`${s[c]}${s[c].toUpperCase()}`;continue}}else if(s[c].match(/[a-z]/)){r+=`[${s[c]}${s[c].toUpperCase()}]`;continue}}if(t.m){if(s[c]==="^"){r+=`(^|(?<=[\r
|
|
18
18
|
]))`;continue}else if(s[c]==="$"){r+=`($|(?=[\r
|
|
19
19
|
]))`;continue}}if(t.s&&s[c]==="."){r+=o?`${s[c]}\r
|
|
20
20
|
`:`[${s[c]}\r
|
|
21
|
-
]`;continue}r+=s[c],s[c]==="\\"?n=!0:o&&s[c]==="]"?o=!1:!o&&s[c]==="["&&(o=!0)}try{new RegExp(r)}catch{return console.warn(`Could not convert regex pattern at ${e.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`),a.source}return r}function ss(a,e){var s,r,n,o,l,u,c;if(e.target==="openAi"&&console.warn("Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead."),e.target==="openApi3"&&((s=a.keyType)==null?void 0:s._def.typeName)===T.ZodEnum)return{type:"object",required:a.keyType._def.values,properties:a.keyType._def.values.reduce((f,p)=>{var g;return{...f,[p]:(g=J(a.valueType._def,{...e,currentPath:[...e.currentPath,"properties",p]}))!=null?g:fe(e)}},{}),additionalProperties:e.rejectedAdditionalProperties};let t={type:"object",additionalProperties:(r=J(a.valueType._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]}))!=null?r:e.allowedAdditionalProperties};if(e.target==="openApi3")return t;if(((n=a.keyType)==null?void 0:n._def.typeName)===T.ZodString&&((o=a.keyType._def.checks)!=null&&o.length)){let{type:f,...p}=as(a.keyType._def,e);return{...t,propertyNames:p}}else{if(((l=a.keyType)==null?void 0:l._def.typeName)===T.ZodEnum)return{...t,propertyNames:{enum:a.keyType._def.values}};if(((u=a.keyType)==null?void 0:u._def.typeName)===T.ZodBranded&&a.keyType._def.type._def.typeName===T.ZodString&&((c=a.keyType._def.type._def.checks)!=null&&c.length)){let{type:f,...p}=ts(a.keyType._def,e);return{...t,propertyNames:p}}}return t}function Kc(a,e){if(e.mapStrategy==="record")return ss(a,e);let t=J(a.keyType._def,{...e,currentPath:[...e.currentPath,"items","items","0"]})||fe(e),s=J(a.valueType._def,{...e,currentPath:[...e.currentPath,"items","items","1"]})||fe(e);return{type:"array",maxItems:125,items:{type:"array",items:[t,s],minItems:2,maxItems:2}}}function Gc(a){let e=a.values,s=Object.keys(a.values).filter(n=>typeof e[e[n]]!="number").map(n=>e[n]),r=Array.from(new Set(s.map(n=>typeof n)));return{type:r.length===1?r[0]==="string"?"string":"number":["string","number"],enum:s}}function Wc(a){return a.target==="openAi"?void 0:{not:fe({...a,currentPath:[...a.currentPath,"not"]})}}function Yc(a){return a.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}var aa={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function eu(a,e){if(e.target==="openApi3")return Xc(a,e);let t=a.options instanceof Map?Array.from(a.options.values()):a.options;if(t.every(s=>s._def.typeName in aa&&(!s._def.checks||!s._def.checks.length))){let s=t.reduce((r,n)=>{let o=aa[n._def.typeName];return o&&!r.includes(o)?[...r,o]:r},[]);return{type:s.length>1?s:s[0]}}else if(t.every(s=>s._def.typeName==="ZodLiteral"&&!s.description)){let s=t.reduce((r,n)=>{let o=typeof n._def.value;switch(o){case"string":case"number":case"boolean":return[...r,o];case"bigint":return[...r,"integer"];case"object":if(n._def.value===null)return[...r,"null"];case"symbol":case"undefined":case"function":default:return r}},[]);if(s.length===t.length){let r=s.filter((n,o,l)=>l.indexOf(n)===o);return{type:r.length>1?r:r[0],enum:t.reduce((n,o)=>n.includes(o._def.value)?n:[...n,o._def.value],[])}}}else if(t.every(s=>s._def.typeName==="ZodEnum"))return{type:"string",enum:t.reduce((s,r)=>[...s,...r._def.values.filter(n=>!s.includes(n))],[])};return Xc(a,e)}var Xc=(a,e)=>{let t=(a.options instanceof Map?Array.from(a.options.values()):a.options).map((s,r)=>J(s._def,{...e,currentPath:[...e.currentPath,"anyOf",`${r}`]})).filter(s=>!!s&&(!e.strictUnions||typeof s=="object"&&Object.keys(s).length>0));return t.length?{anyOf:t}:void 0};function ru(a,e){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(a.innerType._def.typeName)&&(!a.innerType._def.checks||!a.innerType._def.checks.length))return e.target==="openApi3"?{type:aa[a.innerType._def.typeName],nullable:!0}:{type:[aa[a.innerType._def.typeName],"null"]};if(e.target==="openApi3"){let s=J(a.innerType._def,{...e,currentPath:[...e.currentPath]});return s&&"$ref"in s?{allOf:[s],nullable:!0}:s&&{...s,nullable:!0}}let t=J(a.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","0"]});return t&&{anyOf:[t,{type:"null"}]}}function tu(a,e){let t={type:"number"};if(!a.checks)return t;for(let s of a.checks)switch(s.kind){case"int":t.type="integer",wn(t,"type",s.message,e);break;case"min":e.target==="jsonSchema7"?s.inclusive?ee(t,"minimum",s.value,s.message,e):ee(t,"exclusiveMinimum",s.value,s.message,e):(s.inclusive||(t.exclusiveMinimum=!0),ee(t,"minimum",s.value,s.message,e));break;case"max":e.target==="jsonSchema7"?s.inclusive?ee(t,"maximum",s.value,s.message,e):ee(t,"exclusiveMaximum",s.value,s.message,e):(s.inclusive||(t.exclusiveMaximum=!0),ee(t,"maximum",s.value,s.message,e));break;case"multipleOf":ee(t,"multipleOf",s.value,s.message,e);break}return t}function au(a,e){let t=e.target==="openAi",s={type:"object",properties:{}},r=[],n=a.shape();for(let l in n){let u=n[l];if(u===void 0||u._def===void 0)continue;let c=Cm(u);c&&t&&(u._def.typeName==="ZodOptional"&&(u=u._def.innerType),u.isNullable()||(u=u.nullable()),c=!1);let f=J(u._def,{...e,currentPath:[...e.currentPath,"properties",l],propertyPath:[...e.currentPath,"properties",l]});f!==void 0&&(s.properties[l]=f,c||r.push(l))}r.length&&(s.required=r);let o=Im(a,e);return o!==void 0&&(s.additionalProperties=o),s}function Im(a,e){if(a.catchall._def.typeName!=="ZodNever")return J(a.catchall._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]});switch(a.unknownKeys){case"passthrough":return e.allowedAdditionalProperties;case"strict":return e.rejectedAdditionalProperties;case"strip":return e.removeAdditionalStrategy==="strict"?e.allowedAdditionalProperties:e.rejectedAdditionalProperties}}function Cm(a){try{return a.isOptional()}catch{return!0}}var su=(a,e)=>{var s;if(e.currentPath.toString()===((s=e.propertyPath)==null?void 0:s.toString()))return J(a.innerType._def,e);let t=J(a.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","1"]});return t?{anyOf:[{not:fe(e)},t]}:fe(e)};var nu=(a,e)=>{if(e.pipeStrategy==="input")return J(a.in._def,e);if(e.pipeStrategy==="output")return J(a.out._def,e);let t=J(a.in._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),s=J(a.out._def,{...e,currentPath:[...e.currentPath,"allOf",t?"1":"0"]});return{allOf:[t,s].filter(r=>r!==void 0)}};function ou(a,e){return J(a.type._def,e)}function iu(a,e){let s={type:"array",uniqueItems:!0,items:J(a.valueType._def,{...e,currentPath:[...e.currentPath,"items"]})};return a.minSize&&ee(s,"minItems",a.minSize.value,a.minSize.message,e),a.maxSize&&ee(s,"maxItems",a.maxSize.value,a.maxSize.message,e),s}function lu(a,e){return a.rest?{type:"array",minItems:a.items.length,items:a.items.map((t,s)=>J(t._def,{...e,currentPath:[...e.currentPath,"items",`${s}`]})).reduce((t,s)=>s===void 0?t:[...t,s],[]),additionalItems:J(a.rest._def,{...e,currentPath:[...e.currentPath,"additionalItems"]})}:{type:"array",minItems:a.items.length,maxItems:a.items.length,items:a.items.map((t,s)=>J(t._def,{...e,currentPath:[...e.currentPath,"items",`${s}`]})).reduce((t,s)=>s===void 0?t:[...t,s],[])}}function cu(a){return{not:fe(a)}}function uu(a){return fe(a)}var du=(a,e)=>J(a.innerType._def,e);var fu=(a,e,t)=>{switch(e){case T.ZodString:return as(a,t);case T.ZodNumber:return tu(a,t);case T.ZodObject:return au(a,t);case T.ZodBigInt:return qc(a,t);case T.ZodBoolean:return Uc();case T.ZodDate:return En(a,t);case T.ZodUndefined:return cu(t);case T.ZodNull:return Yc(t);case T.ZodArray:return Mc(a,t);case T.ZodUnion:case T.ZodDiscriminatedUnion:return eu(a,t);case T.ZodIntersection:return Bc(a,t);case T.ZodTuple:return lu(a,t);case T.ZodRecord:return ss(a,t);case T.ZodLiteral:return Jc(a,t);case T.ZodEnum:return Zc(a);case T.ZodNativeEnum:return Gc(a);case T.ZodNullable:return ru(a,t);case T.ZodOptional:return su(a,t);case T.ZodMap:return Kc(a,t);case T.ZodSet:return iu(a,t);case T.ZodLazy:return()=>a.getter()._def;case T.ZodPromise:return ou(a,t);case T.ZodNaN:case T.ZodNever:return Wc(t);case T.ZodEffects:return Hc(a,t);case T.ZodAny:return fe(t);case T.ZodUnknown:return uu(t);case T.ZodDefault:return Vc(a,t);case T.ZodBranded:return ts(a,t);case T.ZodReadonly:return du(a,t);case T.ZodCatch:return zc(a,t);case T.ZodPipeline:return nu(a,t);case T.ZodFunction:case T.ZodVoid:case T.ZodSymbol:return;default:return(s=>{})(e)}};function J(a,e,t=!1){var l;let s=e.seen.get(a);if(e.override){let u=(l=e.override)==null?void 0:l.call(e,a,e,s,t);if(u!==Nc)return u}if(s&&!t){let u=km(s,e);if(u!==void 0)return u}let r={def:a,path:e.currentPath,jsonSchema:void 0};e.seen.set(a,r);let n=fu(a,a.typeName,e),o=typeof n=="function"?J(n(),e):n;if(o&&Dm(a,e,o),e.postProcess){let u=e.postProcess(o,a,e);return r.jsonSchema=o,u}return r.jsonSchema=o,o}var km=(a,e)=>{switch(e.$refStrategy){case"root":return{$ref:a.path.join("/")};case"relative":return{$ref:rs(e.currentPath,a.path)};case"none":case"seen":return a.path.length<e.currentPath.length&&a.path.every((t,s)=>e.currentPath[s]===t)?(console.warn(`Recursive reference detected at ${e.currentPath.join("/")}! Defaulting to any`),fe(e)):e.$refStrategy==="seen"?fe(e):void 0}},Dm=(a,e,t)=>(a.description&&(t.description=a.description,e.markdownDescription&&(t.markdownDescription=a.description)),t);var Rn=(a,e)=>{var u;let t=Lc(e),s=typeof e=="object"&&e.definitions?Object.entries(e.definitions).reduce((c,[f,p])=>{var g;return{...c,[f]:(g=J(p._def,{...t,currentPath:[...t.basePath,t.definitionPath,f]},!0))!=null?g:fe(t)}},{}):void 0,r=typeof e=="string"?e:(e==null?void 0:e.nameStrategy)==="title"||e==null?void 0:e.name,n=(u=J(a._def,r===void 0?t:{...t,currentPath:[...t.basePath,t.definitionPath,r]},!1))!=null?u:fe(t),o=typeof e=="object"&&e.name!==void 0&&e.nameStrategy==="title"?e.name:void 0;o!==void 0&&(n.title=o),t.flags.hasReferencedOpenAiAnyType&&(s||(s={}),s[t.openAiAnyTypeName]||(s[t.openAiAnyTypeName]={type:["string","number","integer","boolean","array","null"],items:{$ref:t.$refStrategy==="relative"?"1":[...t.basePath,t.definitionPath,t.openAiAnyTypeName].join("/")}}));let l=r===void 0?s?{...n,[t.definitionPath]:s}:n:{$ref:[...t.$refStrategy==="relative"?[]:t.basePath,t.definitionPath,r].join("/"),[t.definitionPath]:{...s,[r]:n}};return t.target==="jsonSchema7"?l.$schema="http://json-schema.org/draft-07/schema#":(t.target==="jsonSchema2019-09"||t.target==="openAi")&&(l.$schema="https://json-schema.org/draft/2019-09/schema#"),t.target==="openAi"&&("anyOf"in l||"oneOf"in l||"allOf"in l||"type"in l&&Array.isArray(l.type))&&console.warn("Warning: OpenAI may not support schemas with unions as roots! Try wrapping it in an object property."),l};0&&(module.exports={CallToolRequestSchema,Client,ListRootsRequestSchema,ListToolsRequestSchema,PingRequestSchema,SSEServerTransport,Server,StdioClientTransport,StdioServerTransport,StreamableHTTPClientTransport,StreamableHTTPServerTransport,z,zodToJsonSchema});
|
|
21
|
+
]`;continue}r+=s[c],s[c]==="\\"?n=!0:o&&s[c]==="]"?o=!1:!o&&s[c]==="["&&(o=!0)}try{new RegExp(r)}catch{return console.warn(`Could not convert regex pattern at ${e.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`),a.source}return r}function os(a,e){var s,r,n,o,i,u,c;if(e.target==="openAi"&&console.warn("Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead."),e.target==="openApi3"&&((s=a.keyType)==null?void 0:s._def.typeName)===T.ZodEnum)return{type:"object",required:a.keyType._def.values,properties:a.keyType._def.values.reduce((f,p)=>{var g;return{...f,[p]:(g=J(a.valueType._def,{...e,currentPath:[...e.currentPath,"properties",p]}))!=null?g:fe(e)}},{}),additionalProperties:e.rejectedAdditionalProperties};let t={type:"object",additionalProperties:(r=J(a.valueType._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]}))!=null?r:e.allowedAdditionalProperties};if(e.target==="openApi3")return t;if(((n=a.keyType)==null?void 0:n._def.typeName)===T.ZodString&&((o=a.keyType._def.checks)!=null&&o.length)){let{type:f,...p}=ns(a.keyType._def,e);return{...t,propertyNames:p}}else{if(((i=a.keyType)==null?void 0:i._def.typeName)===T.ZodEnum)return{...t,propertyNames:{enum:a.keyType._def.values}};if(((u=a.keyType)==null?void 0:u._def.typeName)===T.ZodBranded&&a.keyType._def.type._def.typeName===T.ZodString&&((c=a.keyType._def.type._def.checks)!=null&&c.length)){let{type:f,...p}=ss(a.keyType._def,e);return{...t,propertyNames:p}}}return t}function Wc(a,e){if(e.mapStrategy==="record")return os(a,e);let t=J(a.keyType._def,{...e,currentPath:[...e.currentPath,"items","items","0"]})||fe(e),s=J(a.valueType._def,{...e,currentPath:[...e.currentPath,"items","items","1"]})||fe(e);return{type:"array",maxItems:125,items:{type:"array",items:[t,s],minItems:2,maxItems:2}}}function Yc(a){let e=a.values,s=Object.keys(a.values).filter(n=>typeof e[e[n]]!="number").map(n=>e[n]),r=Array.from(new Set(s.map(n=>typeof n)));return{type:r.length===1?r[0]==="string"?"string":"number":["string","number"],enum:s}}function Xc(a){return a.target==="openAi"?void 0:{not:fe({...a,currentPath:[...a.currentPath,"not"]})}}function eu(a){return a.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}var na={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function tu(a,e){if(e.target==="openApi3")return ru(a,e);let t=a.options instanceof Map?Array.from(a.options.values()):a.options;if(t.every(s=>s._def.typeName in na&&(!s._def.checks||!s._def.checks.length))){let s=t.reduce((r,n)=>{let o=na[n._def.typeName];return o&&!r.includes(o)?[...r,o]:r},[]);return{type:s.length>1?s:s[0]}}else if(t.every(s=>s._def.typeName==="ZodLiteral"&&!s.description)){let s=t.reduce((r,n)=>{let o=typeof n._def.value;switch(o){case"string":case"number":case"boolean":return[...r,o];case"bigint":return[...r,"integer"];case"object":if(n._def.value===null)return[...r,"null"];case"symbol":case"undefined":case"function":default:return r}},[]);if(s.length===t.length){let r=s.filter((n,o,i)=>i.indexOf(n)===o);return{type:r.length>1?r:r[0],enum:t.reduce((n,o)=>n.includes(o._def.value)?n:[...n,o._def.value],[])}}}else if(t.every(s=>s._def.typeName==="ZodEnum"))return{type:"string",enum:t.reduce((s,r)=>[...s,...r._def.values.filter(n=>!s.includes(n))],[])};return ru(a,e)}var ru=(a,e)=>{let t=(a.options instanceof Map?Array.from(a.options.values()):a.options).map((s,r)=>J(s._def,{...e,currentPath:[...e.currentPath,"anyOf",`${r}`]})).filter(s=>!!s&&(!e.strictUnions||typeof s=="object"&&Object.keys(s).length>0));return t.length?{anyOf:t}:void 0};function au(a,e){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(a.innerType._def.typeName)&&(!a.innerType._def.checks||!a.innerType._def.checks.length))return e.target==="openApi3"?{type:na[a.innerType._def.typeName],nullable:!0}:{type:[na[a.innerType._def.typeName],"null"]};if(e.target==="openApi3"){let s=J(a.innerType._def,{...e,currentPath:[...e.currentPath]});return s&&"$ref"in s?{allOf:[s],nullable:!0}:s&&{...s,nullable:!0}}let t=J(a.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","0"]});return t&&{anyOf:[t,{type:"null"}]}}function su(a,e){let t={type:"number"};if(!a.checks)return t;for(let s of a.checks)switch(s.kind){case"int":t.type="integer",Sn(t,"type",s.message,e);break;case"min":e.target==="jsonSchema7"?s.inclusive?ee(t,"minimum",s.value,s.message,e):ee(t,"exclusiveMinimum",s.value,s.message,e):(s.inclusive||(t.exclusiveMinimum=!0),ee(t,"minimum",s.value,s.message,e));break;case"max":e.target==="jsonSchema7"?s.inclusive?ee(t,"maximum",s.value,s.message,e):ee(t,"exclusiveMaximum",s.value,s.message,e):(s.inclusive||(t.exclusiveMaximum=!0),ee(t,"maximum",s.value,s.message,e));break;case"multipleOf":ee(t,"multipleOf",s.value,s.message,e);break}return t}function nu(a,e){let t=e.target==="openAi",s={type:"object",properties:{}},r=[],n=a.shape();for(let i in n){let u=n[i];if(u===void 0||u._def===void 0)continue;let c=km(u);c&&t&&(u._def.typeName==="ZodOptional"&&(u=u._def.innerType),u.isNullable()||(u=u.nullable()),c=!1);let f=J(u._def,{...e,currentPath:[...e.currentPath,"properties",i],propertyPath:[...e.currentPath,"properties",i]});f!==void 0&&(s.properties[i]=f,c||r.push(i))}r.length&&(s.required=r);let o=Cm(a,e);return o!==void 0&&(s.additionalProperties=o),s}function Cm(a,e){if(a.catchall._def.typeName!=="ZodNever")return J(a.catchall._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]});switch(a.unknownKeys){case"passthrough":return e.allowedAdditionalProperties;case"strict":return e.rejectedAdditionalProperties;case"strip":return e.removeAdditionalStrategy==="strict"?e.allowedAdditionalProperties:e.rejectedAdditionalProperties}}function km(a){try{return a.isOptional()}catch{return!0}}var ou=(a,e)=>{var s;if(e.currentPath.toString()===((s=e.propertyPath)==null?void 0:s.toString()))return J(a.innerType._def,e);let t=J(a.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","1"]});return t?{anyOf:[{not:fe(e)},t]}:fe(e)};var iu=(a,e)=>{if(e.pipeStrategy==="input")return J(a.in._def,e);if(e.pipeStrategy==="output")return J(a.out._def,e);let t=J(a.in._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),s=J(a.out._def,{...e,currentPath:[...e.currentPath,"allOf",t?"1":"0"]});return{allOf:[t,s].filter(r=>r!==void 0)}};function lu(a,e){return J(a.type._def,e)}function cu(a,e){let s={type:"array",uniqueItems:!0,items:J(a.valueType._def,{...e,currentPath:[...e.currentPath,"items"]})};return a.minSize&&ee(s,"minItems",a.minSize.value,a.minSize.message,e),a.maxSize&&ee(s,"maxItems",a.maxSize.value,a.maxSize.message,e),s}function uu(a,e){return a.rest?{type:"array",minItems:a.items.length,items:a.items.map((t,s)=>J(t._def,{...e,currentPath:[...e.currentPath,"items",`${s}`]})).reduce((t,s)=>s===void 0?t:[...t,s],[]),additionalItems:J(a.rest._def,{...e,currentPath:[...e.currentPath,"additionalItems"]})}:{type:"array",minItems:a.items.length,maxItems:a.items.length,items:a.items.map((t,s)=>J(t._def,{...e,currentPath:[...e.currentPath,"items",`${s}`]})).reduce((t,s)=>s===void 0?t:[...t,s],[])}}function du(a){return{not:fe(a)}}function fu(a){return fe(a)}var hu=(a,e)=>J(a.innerType._def,e);var pu=(a,e,t)=>{switch(e){case T.ZodString:return ns(a,t);case T.ZodNumber:return su(a,t);case T.ZodObject:return nu(a,t);case T.ZodBigInt:return zc(a,t);case T.ZodBoolean:return Vc();case T.ZodDate:return Rn(a,t);case T.ZodUndefined:return du(t);case T.ZodNull:return eu(t);case T.ZodArray:return Uc(a,t);case T.ZodUnion:case T.ZodDiscriminatedUnion:return tu(a,t);case T.ZodIntersection:return Qc(a,t);case T.ZodTuple:return uu(a,t);case T.ZodRecord:return os(a,t);case T.ZodLiteral:return Kc(a,t);case T.ZodEnum:return Jc(a);case T.ZodNativeEnum:return Yc(a);case T.ZodNullable:return au(a,t);case T.ZodOptional:return ou(a,t);case T.ZodMap:return Wc(a,t);case T.ZodSet:return cu(a,t);case T.ZodLazy:return()=>a.getter()._def;case T.ZodPromise:return lu(a,t);case T.ZodNaN:case T.ZodNever:return Xc(t);case T.ZodEffects:return Bc(a,t);case T.ZodAny:return fe(t);case T.ZodUnknown:return fu(t);case T.ZodDefault:return Zc(a,t);case T.ZodBranded:return ss(a,t);case T.ZodReadonly:return hu(a,t);case T.ZodCatch:return Hc(a,t);case T.ZodPipeline:return iu(a,t);case T.ZodFunction:case T.ZodVoid:case T.ZodSymbol:return;default:return(s=>{})(e)}};function J(a,e,t=!1){var i;let s=e.seen.get(a);if(e.override){let u=(i=e.override)==null?void 0:i.call(e,a,e,s,t);if(u!==Fc)return u}if(s&&!t){let u=Dm(s,e);if(u!==void 0)return u}let r={def:a,path:e.currentPath,jsonSchema:void 0};e.seen.set(a,r);let n=pu(a,a.typeName,e),o=typeof n=="function"?J(n(),e):n;if(o&&jm(a,e,o),e.postProcess){let u=e.postProcess(o,a,e);return r.jsonSchema=o,u}return r.jsonSchema=o,o}var Dm=(a,e)=>{switch(e.$refStrategy){case"root":return{$ref:a.path.join("/")};case"relative":return{$ref:as(e.currentPath,a.path)};case"none":case"seen":return a.path.length<e.currentPath.length&&a.path.every((t,s)=>e.currentPath[s]===t)?(console.warn(`Recursive reference detected at ${e.currentPath.join("/")}! Defaulting to any`),fe(e)):e.$refStrategy==="seen"?fe(e):void 0}},jm=(a,e,t)=>(a.description&&(t.description=a.description,e.markdownDescription&&(t.markdownDescription=a.description)),t);var $n=(a,e)=>{var u;let t=qc(e),s=typeof e=="object"&&e.definitions?Object.entries(e.definitions).reduce((c,[f,p])=>{var g;return{...c,[f]:(g=J(p._def,{...t,currentPath:[...t.basePath,t.definitionPath,f]},!0))!=null?g:fe(t)}},{}):void 0,r=typeof e=="string"?e:(e==null?void 0:e.nameStrategy)==="title"||e==null?void 0:e.name,n=(u=J(a._def,r===void 0?t:{...t,currentPath:[...t.basePath,t.definitionPath,r]},!1))!=null?u:fe(t),o=typeof e=="object"&&e.name!==void 0&&e.nameStrategy==="title"?e.name:void 0;o!==void 0&&(n.title=o),t.flags.hasReferencedOpenAiAnyType&&(s||(s={}),s[t.openAiAnyTypeName]||(s[t.openAiAnyTypeName]={type:["string","number","integer","boolean","array","null"],items:{$ref:t.$refStrategy==="relative"?"1":[...t.basePath,t.definitionPath,t.openAiAnyTypeName].join("/")}}));let i=r===void 0?s?{...n,[t.definitionPath]:s}:n:{$ref:[...t.$refStrategy==="relative"?[]:t.basePath,t.definitionPath,r].join("/"),[t.definitionPath]:{...s,[r]:n}};return t.target==="jsonSchema7"?i.$schema="http://json-schema.org/draft-07/schema#":(t.target==="jsonSchema2019-09"||t.target==="openAi")&&(i.$schema="https://json-schema.org/draft/2019-09/schema#"),t.target==="openAi"&&("anyOf"in i||"oneOf"in i||"allOf"in i||"type"in i&&Array.isArray(i.type))&&console.warn("Warning: OpenAI may not support schemas with unions as roots! Try wrapping it in an object property."),i};0&&(module.exports={CallToolRequestSchema,Client,ListRootsRequestSchema,ListToolsRequestSchema,PingRequestSchema,SSEServerTransport,Server,StdioClientTransport,StdioServerTransport,StreamableHTTPClientTransport,StreamableHTTPServerTransport,z,zodToJsonSchema});
|
|
22
22
|
/*! Bundled license information:
|
|
23
23
|
|
|
24
24
|
uri-js/dist/es5/uri.all.js:
|