Files
claude-mem/plugin/scripts/mcp-server.cjs

17 lines
234 KiB
JavaScript
Executable File

#!/usr/bin/env bun
"use strict";var $l=Object.create;var Aa=Object.defineProperty;var Cl=Object.getOwnPropertyDescriptor;var Nl=Object.getOwnPropertyNames;var jl=Object.getPrototypeOf,Ll=Object.prototype.hasOwnProperty;var W=(a,e)=>()=>(e||a((e={exports:{}}).exports,e),e.exports),Ml=(a,e)=>{for(var t in e)Aa(a,t,{get:e[t],enumerable:!0})},Fl=(a,e,t,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of Nl(e))!Ll.call(a,r)&&r!==t&&Aa(a,r,{get:()=>e[r],enumerable:!(s=Cl(e,r))||s.enumerable});return a};var Da=(a,e,t)=>(t=a!=null?$l(jl(a)):{},Fl(e||!a||!a.__esModule?Aa(t,"default",{value:a,enumerable:!0}):t,a));var Sn=W((Yt,En)=>{(function(a,e){typeof Yt=="object"&&typeof En<"u"?e(Yt):typeof define=="function"&&define.amd?define(["exports"],e):e(a.URI=a.URI||{})})(Yt,(function(a){"use strict";function e(){for(var h=arguments.length,u=Array(h),g=0;g<h;g++)u[g]=arguments[g];if(u.length>1){u[0]=u[0].slice(0,-1);for(var S=u.length-1,b=1;b<S;++b)u[b]=u[b].slice(1,-1);return u[S]=u[S].slice(1),u.join("")}else return u[0]}function t(h){return"(?:"+h+")"}function s(h){return h===void 0?"undefined":h===null?"null":Object.prototype.toString.call(h).split(" ").pop().split("]").shift().toLowerCase()}function r(h){return h.toUpperCase()}function n(h){return h!=null?h instanceof Array?h:typeof h.length!="number"||h.split||h.setInterval||h.call?[h]:Array.prototype.slice.call(h):[]}function l(h,u){var g=h;if(u)for(var S in u)g[S]=u[S];return g}function i(h){var u="[A-Za-z]",g="[\\x0D]",S="[0-9]",b="[\\x22]",j=e(S,"[A-Fa-f]"),Q="[\\x0A]",ae="[\\x20]",ie=t(t("%[EFef]"+j+"%"+j+j+"%"+j+j)+"|"+t("%[89A-Fa-f]"+j+"%"+j+j)+"|"+t("%"+j+j)),Se="[\\:\\/\\?\\#\\[\\]\\@]",te="[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=]",pe=e(Se,te),be=h?"[\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]":"[]",de=h?"[\\uE000-\\uF8FF]":"[]",ne=e(u,S,"[\\-\\.\\_\\~]",be),he=t(u+e(u,S,"[\\+\\-\\.]")+"*"),ce=t(t(ie+"|"+e(ne,te,"[\\:]"))+"*"),Ir=t(t("25[0-5]")+"|"+t("2[0-4]"+S)+"|"+t("1"+S+S)+"|"+t("[1-9]"+S)+"|"+S),Fe=t(t("25[0-5]")+"|"+t("2[0-4]"+S)+"|"+t("1"+S+S)+"|"+t("0?[1-9]"+S)+"|0?0?"+S),Ve=t(Fe+"\\."+Fe+"\\."+Fe+"\\."+Fe),ue=t(j+"{1,4}"),Ue=t(t(ue+"\\:"+ue)+"|"+Ve),ze=t(t(ue+"\\:")+"{6}"+Ue),sr=t("\\:\\:"+t(ue+"\\:")+"{5}"+Ue),kr=t(t(ue)+"?\\:\\:"+t(ue+"\\:")+"{4}"+Ue),fr=t(t(t(ue+"\\:")+"{0,1}"+ue)+"?\\:\\:"+t(ue+"\\:")+"{3}"+Ue),yt=t(t(t(ue+"\\:")+"{0,2}"+ue)+"?\\:\\:"+t(ue+"\\:")+"{2}"+Ue),Nt=t(t(t(ue+"\\:")+"{0,3}"+ue)+"?\\:\\:"+ue+"\\:"+Ue),jt=t(t(t(ue+"\\:")+"{0,4}"+ue)+"?\\:\\:"+Ue),Xr=t(t(t(ue+"\\:")+"{0,5}"+ue)+"?\\:\\:"+ue),et=t(t(t(ue+"\\:")+"{0,6}"+ue)+"?\\:\\:"),pr=t([ze,sr,kr,fr,yt,Nt,jt,Xr,et].join("|")),rt=t(t(ne+"|"+ie)+"+"),Ra=t(pr+"\\%25"+rt),$r=t(pr+t("\\%25|\\%(?!"+j+"{2})")+rt),Tl=t("[vV]"+j+"+\\."+e(ne,te,"[\\:]")+"+"),Rl=t("\\["+t($r+"|"+pr+"|"+Tl)+"\\]"),Fs=t(t(ie+"|"+e(ne,te))+"*"),_t=t(Rl+"|"+Ve+"(?!"+Fs+")|"+Fs),Et=t(S+"*"),Us=t(t(ce+"@")+"?"+_t+t("\\:"+Et)+"?"),St=t(ie+"|"+e(ne,te,"[\\:\\@]")),Ol=t(St+"*"),qs=t(St+"+"),Al=t(t(ie+"|"+e(ne,te,"[\\@]"))+"+"),hr=t(t("\\/"+Ol)+"*"),tt=t("\\/"+t(qs+hr)+"?"),Oa=t(Al+hr),Lt=t(qs+hr),at="(?!"+St+")",zf=t(hr+"|"+tt+"|"+Oa+"|"+Lt+"|"+at),st=t(t(St+"|"+e("[\\/\\?]",de))+"*"),bt=t(t(St+"|[\\/\\?]")+"*"),Vs=t(t("\\/\\/"+Us+hr)+"|"+tt+"|"+Lt+"|"+at),Dl=t(he+"\\:"+Vs+t("\\?"+st)+"?"+t("\\#"+bt)+"?"),Il=t(t("\\/\\/"+Us+hr)+"|"+tt+"|"+Oa+"|"+at),kl=t(Il+t("\\?"+st)+"?"+t("\\#"+bt)+"?"),Hf=t(Dl+"|"+kl),Zf=t(he+"\\:"+Vs+t("\\?"+st)+"?"),Bf="^("+he+")\\:"+t(t("\\/\\/("+t("("+ce+")@")+"?("+_t+")"+t("\\:("+Et+")")+"?)")+"?("+hr+"|"+tt+"|"+Lt+"|"+at+")")+t("\\?("+st+")")+"?"+t("\\#("+bt+")")+"?$",Wf="^(){0}"+t(t("\\/\\/("+t("("+ce+")@")+"?("+_t+")"+t("\\:("+Et+")")+"?)")+"?("+hr+"|"+tt+"|"+Oa+"|"+at+")")+t("\\?("+st+")")+"?"+t("\\#("+bt+")")+"?$",Kf="^("+he+")\\:"+t(t("\\/\\/("+t("("+ce+")@")+"?("+_t+")"+t("\\:("+Et+")")+"?)")+"?("+hr+"|"+tt+"|"+Lt+"|"+at+")")+t("\\?("+st+")")+"?$",Qf="^"+t("\\#("+bt+")")+"?$",Jf="^"+t("("+ce+")@")+"?("+_t+")"+t("\\:("+Et+")")+"?$";return{NOT_SCHEME:new RegExp(e("[^]",u,S,"[\\+\\-\\.]"),"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,pe),"g"),PCT_ENCODED:new RegExp(ie,"g"),IPV4ADDRESS:new RegExp("^("+Ve+")$"),IPV6ADDRESS:new RegExp("^\\[?("+pr+")"+t(t("\\%25|\\%(?!"+j+"{2})")+"("+rt+")")+"?\\]?$")}}var d=i(!1),f=i(!0),p=(function(){function h(u,g){var S=[],b=!0,j=!1,Q=void 0;try{for(var ae=u[Symbol.iterator](),ie;!(b=(ie=ae.next()).done)&&(S.push(ie.value),!(g&&S.length===g));b=!0);}catch(Se){j=!0,Q=Se}finally{try{!b&&ae.return&&ae.return()}finally{if(j)throw Q}}return S}return function(u,g){if(Array.isArray(u))return u;if(Symbol.iterator in Object(u))return h(u,g);throw new TypeError("Invalid attempt to destructure non-iterable instance")}})(),m=function(h){if(Array.isArray(h)){for(var u=0,g=Array(h.length);u<h.length;u++)g[u]=h[u];return g}else return Array.from(h)},E=2147483647,c=36,y=1,_=26,v=38,P=700,O=72,x=128,T="-",D=/^xn--/,I=/[^\0-\x7E]/,z=/[\x2E\u3002\uFF0E\uFF61]/g,U={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},k=c-y,q=Math.floor,F=String.fromCharCode;function L(h){throw new RangeError(U[h])}function A(h,u){for(var g=[],S=h.length;S--;)g[S]=u(h[S]);return g}function $(h,u){var g=h.split("@"),S="";g.length>1&&(S=g[0]+"@",h=g[1]),h=h.replace(z,".");var b=h.split("."),j=A(b,u).join(".");return S+j}function M(h){for(var u=[],g=0,S=h.length;g<S;){var b=h.charCodeAt(g++);if(b>=55296&&b<=56319&&g<S){var j=h.charCodeAt(g++);(j&64512)==56320?u.push(((b&1023)<<10)+(j&1023)+65536):(u.push(b),g--)}else u.push(b)}return u}var le=function(u){return String.fromCodePoint.apply(String,m(u))},Y=function(u){return u-48<10?u-22:u-65<26?u-65:u-97<26?u-97:c},re=function(u,g){return u+22+75*(u<26)-((g!=0)<<5)},G=function(u,g,S){var b=0;for(u=S?q(u/P):u>>1,u+=q(u/g);u>k*_>>1;b+=c)u=q(u/k);return q(b+(k+1)*u/(u+v))},H=function(u){var g=[],S=u.length,b=0,j=x,Q=O,ae=u.lastIndexOf(T);ae<0&&(ae=0);for(var ie=0;ie<ae;++ie)u.charCodeAt(ie)>=128&&L("not-basic"),g.push(u.charCodeAt(ie));for(var Se=ae>0?ae+1:0;Se<S;){for(var te=b,pe=1,be=c;;be+=c){Se>=S&&L("invalid-input");var de=Y(u.charCodeAt(Se++));(de>=c||de>q((E-b)/pe))&&L("overflow"),b+=de*pe;var ne=be<=Q?y:be>=Q+_?_:be-Q;if(de<ne)break;var he=c-ne;pe>q(E/he)&&L("overflow"),pe*=he}var ce=g.length+1;Q=G(b-te,ce,te==0),q(b/ce)>E-j&&L("overflow"),j+=q(b/ce),b%=ce,g.splice(b++,0,j)}return String.fromCodePoint.apply(String,g)},me=function(u){var g=[];u=M(u);var S=u.length,b=x,j=0,Q=O,ae=!0,ie=!1,Se=void 0;try{for(var te=u[Symbol.iterator](),pe;!(ae=(pe=te.next()).done);ae=!0){var be=pe.value;be<128&&g.push(F(be))}}catch($r){ie=!0,Se=$r}finally{try{!ae&&te.return&&te.return()}finally{if(ie)throw Se}}var de=g.length,ne=de;for(de&&g.push(T);ne<S;){var he=E,ce=!0,Ir=!1,Fe=void 0;try{for(var Ve=u[Symbol.iterator](),ue;!(ce=(ue=Ve.next()).done);ce=!0){var Ue=ue.value;Ue>=b&&Ue<he&&(he=Ue)}}catch($r){Ir=!0,Fe=$r}finally{try{!ce&&Ve.return&&Ve.return()}finally{if(Ir)throw Fe}}var ze=ne+1;he-b>q((E-j)/ze)&&L("overflow"),j+=(he-b)*ze,b=he;var sr=!0,kr=!1,fr=void 0;try{for(var yt=u[Symbol.iterator](),Nt;!(sr=(Nt=yt.next()).done);sr=!0){var jt=Nt.value;if(jt<b&&++j>E&&L("overflow"),jt==b){for(var Xr=j,et=c;;et+=c){var pr=et<=Q?y:et>=Q+_?_:et-Q;if(Xr<pr)break;var rt=Xr-pr,Ra=c-pr;g.push(F(re(pr+rt%Ra,0))),Xr=q(rt/Ra)}g.push(F(re(Xr,0))),Q=G(j,ze,ne==de),j=0,++ne}}}catch($r){kr=!0,fr=$r}finally{try{!sr&&yt.return&&yt.return()}finally{if(kr)throw fr}}++j,++b}return g.join("")},Te=function(u){return $(u,function(g){return D.test(g)?H(g.slice(4).toLowerCase()):g})},Ae=function(u){return $(u,function(g){return I.test(g)?"xn--"+me(g):g})},se={version:"2.1.0",ucs2:{decode:M,encode:le},decode:H,encode:me,toASCII:Ae,toUnicode:Te},_e={};function Pe(h){var u=h.charCodeAt(0),g=void 0;return u<16?g="%0"+u.toString(16).toUpperCase():u<128?g="%"+u.toString(16).toUpperCase():u<2048?g="%"+(u>>6|192).toString(16).toUpperCase()+"%"+(u&63|128).toString(16).toUpperCase():g="%"+(u>>12|224).toString(16).toUpperCase()+"%"+(u>>6&63|128).toString(16).toUpperCase()+"%"+(u&63|128).toString(16).toUpperCase(),g}function De(h){for(var u="",g=0,S=h.length;g<S;){var b=parseInt(h.substr(g+1,2),16);if(b<128)u+=String.fromCharCode(b),g+=3;else if(b>=194&&b<224){if(S-g>=6){var j=parseInt(h.substr(g+4,2),16);u+=String.fromCharCode((b&31)<<6|j&63)}else u+=h.substr(g,6);g+=6}else if(b>=224){if(S-g>=9){var Q=parseInt(h.substr(g+4,2),16),ae=parseInt(h.substr(g+7,2),16);u+=String.fromCharCode((b&15)<<12|(Q&63)<<6|ae&63)}else u+=h.substr(g,9);g+=9}else u+=h.substr(g,3),g+=3}return u}function _r(h,u){function g(S){var b=De(S);return b.match(u.UNRESERVED)?b:S}return h.scheme&&(h.scheme=String(h.scheme).replace(u.PCT_ENCODED,g).toLowerCase().replace(u.NOT_SCHEME,"")),h.userinfo!==void 0&&(h.userinfo=String(h.userinfo).replace(u.PCT_ENCODED,g).replace(u.NOT_USERINFO,Pe).replace(u.PCT_ENCODED,r)),h.host!==void 0&&(h.host=String(h.host).replace(u.PCT_ENCODED,g).toLowerCase().replace(u.NOT_HOST,Pe).replace(u.PCT_ENCODED,r)),h.path!==void 0&&(h.path=String(h.path).replace(u.PCT_ENCODED,g).replace(h.scheme?u.NOT_PATH:u.NOT_PATH_NOSCHEME,Pe).replace(u.PCT_ENCODED,r)),h.query!==void 0&&(h.query=String(h.query).replace(u.PCT_ENCODED,g).replace(u.NOT_QUERY,Pe).replace(u.PCT_ENCODED,r)),h.fragment!==void 0&&(h.fragment=String(h.fragment).replace(u.PCT_ENCODED,g).replace(u.NOT_FRAGMENT,Pe).replace(u.PCT_ENCODED,r)),h}function ur(h){return h.replace(/^0*(.*)/,"$1")||"0"}function Ee(h,u){var g=h.match(u.IPV4ADDRESS)||[],S=p(g,2),b=S[1];return b?b.split(".").map(ur).join("."):h}function ve(h,u){var g=h.match(u.IPV6ADDRESS)||[],S=p(g,3),b=S[1],j=S[2];if(b){for(var Q=b.toLowerCase().split("::").reverse(),ae=p(Q,2),ie=ae[0],Se=ae[1],te=Se?Se.split(":").map(ur):[],pe=ie.split(":").map(ur),be=u.IPV4ADDRESS.test(pe[pe.length-1]),de=be?7:8,ne=pe.length-de,he=Array(de),ce=0;ce<de;++ce)he[ce]=te[ce]||pe[ne+ce]||"";be&&(he[de-1]=Ee(he[de-1],u));var Ir=he.reduce(function(ze,sr,kr){if(!sr||sr==="0"){var fr=ze[ze.length-1];fr&&fr.index+fr.length===kr?fr.length++:ze.push({index:kr,length:1})}return ze},[]),Fe=Ir.sort(function(ze,sr){return sr.length-ze.length})[0],Ve=void 0;if(Fe&&Fe.length>1){var ue=he.slice(0,Fe.index),Ue=he.slice(Fe.index+Fe.length);Ve=ue.join(":")+"::"+Ue.join(":")}else Ve=he.join(":");return j&&(Ve+="%"+j),Ve}else return h}var Or=/^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i,Re="".match(/(){0}/)[1]===void 0;function oe(h){var u=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},g={},S=u.iri!==!1?f:d;u.reference==="suffix"&&(h=(u.scheme?u.scheme+":":"")+"//"+h);var b=h.match(Or);if(b){Re?(g.scheme=b[1],g.userinfo=b[3],g.host=b[4],g.port=parseInt(b[5],10),g.path=b[6]||"",g.query=b[7],g.fragment=b[8],isNaN(g.port)&&(g.port=b[5])):(g.scheme=b[1]||void 0,g.userinfo=h.indexOf("@")!==-1?b[3]:void 0,g.host=h.indexOf("//")!==-1?b[4]:void 0,g.port=parseInt(b[5],10),g.path=b[6]||"",g.query=h.indexOf("?")!==-1?b[7]:void 0,g.fragment=h.indexOf("#")!==-1?b[8]:void 0,isNaN(g.port)&&(g.port=h.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/)?b[4]:void 0)),g.host&&(g.host=ve(Ee(g.host,S),S)),g.scheme===void 0&&g.userinfo===void 0&&g.host===void 0&&g.port===void 0&&!g.path&&g.query===void 0?g.reference="same-document":g.scheme===void 0?g.reference="relative":g.fragment===void 0?g.reference="absolute":g.reference="uri",u.reference&&u.reference!=="suffix"&&u.reference!==g.reference&&(g.error=g.error||"URI is not a "+u.reference+" reference.");var j=_e[(u.scheme||g.scheme||"").toLowerCase()];if(!u.unicodeSupport&&(!j||!j.unicodeSupport)){if(g.host&&(u.domainHost||j&&j.domainHost))try{g.host=se.toASCII(g.host.replace(S.PCT_ENCODED,De).toLowerCase())}catch(Q){g.error=g.error||"Host's domain name can not be converted to ASCII via punycode: "+Q}_r(g,d)}else _r(g,S);j&&j.parse&&j.parse(g,u)}else g.error=g.error||"URI can not be parsed.";return g}function Er(h,u){var g=u.iri!==!1?f:d,S=[];return h.userinfo!==void 0&&(S.push(h.userinfo),S.push("@")),h.host!==void 0&&S.push(ve(Ee(String(h.host),g),g).replace(g.IPV6ADDRESS,function(b,j,Q){return"["+j+(Q?"%25"+Q:"")+"]"})),(typeof h.port=="number"||typeof h.port=="string")&&(S.push(":"),S.push(String(h.port))),S.length?S.join(""):void 0}var dr=/^\.\.?\//,Ar=/^\/\.(\/|$)/,Dr=/^\/\.\.(\/|$)/,xe=/^\/?(?:.|\n)*?(?=\/|$)/;function qe(h){for(var u=[];h.length;)if(h.match(dr))h=h.replace(dr,"");else if(h.match(Ar))h=h.replace(Ar,"/");else if(h.match(Dr))h=h.replace(Dr,"/"),u.pop();else if(h==="."||h==="..")h="";else{var g=h.match(xe);if(g){var S=g[0];h=h.slice(S.length),u.push(S)}else throw new Error("Unexpected dot segment condition")}return u.join("")}function Ce(h){var u=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},g=u.iri?f:d,S=[],b=_e[(u.scheme||h.scheme||"").toLowerCase()];if(b&&b.serialize&&b.serialize(h,u),h.host&&!g.IPV6ADDRESS.test(h.host)){if(u.domainHost||b&&b.domainHost)try{h.host=u.iri?se.toUnicode(h.host):se.toASCII(h.host.replace(g.PCT_ENCODED,De).toLowerCase())}catch(ae){h.error=h.error||"Host's domain name can not be converted to "+(u.iri?"Unicode":"ASCII")+" via punycode: "+ae}}_r(h,g),u.reference!=="suffix"&&h.scheme&&(S.push(h.scheme),S.push(":"));var j=Er(h,u);if(j!==void 0&&(u.reference!=="suffix"&&S.push("//"),S.push(j),h.path&&h.path.charAt(0)!=="/"&&S.push("/")),h.path!==void 0){var Q=h.path;!u.absolutePath&&(!b||!b.absolutePath)&&(Q=qe(Q)),j===void 0&&(Q=Q.replace(/^\/\//,"/%2F")),S.push(Q)}return h.query!==void 0&&(S.push("?"),S.push(h.query)),h.fragment!==void 0&&(S.push("#"),S.push(h.fragment)),S.join("")}function Ie(h,u){var g=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},S=arguments[3],b={};return S||(h=oe(Ce(h,g),g),u=oe(Ce(u,g),g)),g=g||{},!g.tolerant&&u.scheme?(b.scheme=u.scheme,b.userinfo=u.userinfo,b.host=u.host,b.port=u.port,b.path=qe(u.path||""),b.query=u.query):(u.userinfo!==void 0||u.host!==void 0||u.port!==void 0?(b.userinfo=u.userinfo,b.host=u.host,b.port=u.port,b.path=qe(u.path||""),b.query=u.query):(u.path?(u.path.charAt(0)==="/"?b.path=qe(u.path):((h.userinfo!==void 0||h.host!==void 0||h.port!==void 0)&&!h.path?b.path="/"+u.path:h.path?b.path=h.path.slice(0,h.path.lastIndexOf("/")+1)+u.path:b.path=u.path,b.path=qe(b.path)),b.query=u.query):(b.path=h.path,u.query!==void 0?b.query=u.query:b.query=h.query),b.userinfo=h.userinfo,b.host=h.host,b.port=h.port),b.scheme=h.scheme),b.fragment=u.fragment,b}function tr(h,u,g){var S=l({scheme:"null"},g);return Ce(Ie(oe(h,S),oe(u,S),S,!0),S)}function Me(h,u){return typeof h=="string"?h=Ce(oe(h,u),u):s(h)==="object"&&(h=oe(Ce(h,u),u)),h}function Ct(h,u,g){return typeof h=="string"?h=Ce(oe(h,g),g):s(h)==="object"&&(h=Ce(h,g)),typeof u=="string"?u=Ce(oe(u,g),g):s(u)==="object"&&(u=Ce(u,g)),h===u}function wa(h,u){return h&&h.toString().replace(!u||!u.iri?d.ESCAPE:f.ESCAPE,Pe)}function Qe(h,u){return h&&h.toString().replace(!u||!u.iri?d.PCT_ENCODED:f.PCT_ENCODED,De)}var vt={scheme:"http",domainHost:!0,parse:function(u,g){return u.host||(u.error=u.error||"HTTP URIs must have a host."),u},serialize:function(u,g){var S=String(u.scheme).toLowerCase()==="https";return(u.port===(S?443:80)||u.port==="")&&(u.port=void 0),u.path||(u.path="/"),u}},Is={scheme:"https",domainHost:vt.domainHost,parse:vt.parse,serialize:vt.serialize};function ks(h){return typeof h.secure=="boolean"?h.secure:String(h.scheme).toLowerCase()==="wss"}var gt={scheme:"ws",domainHost:!0,parse:function(u,g){var S=u;return S.secure=ks(S),S.resourceName=(S.path||"/")+(S.query?"?"+S.query:""),S.path=void 0,S.query=void 0,S},serialize:function(u,g){if((u.port===(ks(u)?443:80)||u.port==="")&&(u.port=void 0),typeof u.secure=="boolean"&&(u.scheme=u.secure?"wss":"ws",u.secure=void 0),u.resourceName){var S=u.resourceName.split("?"),b=p(S,2),j=b[0],Q=b[1];u.path=j&&j!=="/"?j:void 0,u.query=Q,u.resourceName=void 0}return u.fragment=void 0,u}},$s={scheme:"wss",domainHost:gt.domainHost,parse:gt.parse,serialize:gt.serialize},hl={},ml=!0,Cs="[A-Za-z0-9\\-\\.\\_\\~"+(ml?"\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF":"")+"]",ar="[0-9A-Fa-f]",vl=t(t("%[EFef]"+ar+"%"+ar+ar+"%"+ar+ar)+"|"+t("%[89A-Fa-f]"+ar+"%"+ar+ar)+"|"+t("%"+ar+ar)),gl="[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]",yl="[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]",_l=e(yl,'[\\"\\\\]'),El="[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]",Sl=new RegExp(Cs,"g"),Yr=new RegExp(vl,"g"),bl=new RegExp(e("[^]",gl,"[\\.]",'[\\"]',_l),"g"),Ns=new RegExp(e("[^]",Cs,El),"g"),Pl=Ns;function Ta(h){var u=De(h);return u.match(Sl)?u:h}var js={scheme:"mailto",parse:function(u,g){var S=u,b=S.to=S.path?S.path.split(","):[];if(S.path=void 0,S.query){for(var j=!1,Q={},ae=S.query.split("&"),ie=0,Se=ae.length;ie<Se;++ie){var te=ae[ie].split("=");switch(te[0]){case"to":for(var pe=te[1].split(","),be=0,de=pe.length;be<de;++be)b.push(pe[be]);break;case"subject":S.subject=Qe(te[1],g);break;case"body":S.body=Qe(te[1],g);break;default:j=!0,Q[Qe(te[0],g)]=Qe(te[1],g);break}}j&&(S.headers=Q)}S.query=void 0;for(var ne=0,he=b.length;ne<he;++ne){var ce=b[ne].split("@");if(ce[0]=Qe(ce[0]),g.unicodeSupport)ce[1]=Qe(ce[1],g).toLowerCase();else try{ce[1]=se.toASCII(Qe(ce[1],g).toLowerCase())}catch(Ir){S.error=S.error||"Email address's domain name can not be converted to ASCII via punycode: "+Ir}b[ne]=ce.join("@")}return S},serialize:function(u,g){var S=u,b=n(u.to);if(b){for(var j=0,Q=b.length;j<Q;++j){var ae=String(b[j]),ie=ae.lastIndexOf("@"),Se=ae.slice(0,ie).replace(Yr,Ta).replace(Yr,r).replace(bl,Pe),te=ae.slice(ie+1);try{te=g.iri?se.toUnicode(te):se.toASCII(Qe(te,g).toLowerCase())}catch(ne){S.error=S.error||"Email address's domain name can not be converted to "+(g.iri?"Unicode":"ASCII")+" via punycode: "+ne}b[j]=Se+"@"+te}S.path=b.join(",")}var pe=u.headers=u.headers||{};u.subject&&(pe.subject=u.subject),u.body&&(pe.body=u.body);var be=[];for(var de in pe)pe[de]!==hl[de]&&be.push(de.replace(Yr,Ta).replace(Yr,r).replace(Ns,Pe)+"="+pe[de].replace(Yr,Ta).replace(Yr,r).replace(Pl,Pe));return be.length&&(S.query=be.join("&")),S}},xl=/^([^\:]+)\:(.*)/,Ls={scheme:"urn",parse:function(u,g){var S=u.path&&u.path.match(xl),b=u;if(S){var j=g.scheme||b.scheme||"urn",Q=S[1].toLowerCase(),ae=S[2],ie=j+":"+(g.nid||Q),Se=_e[ie];b.nid=Q,b.nss=ae,b.path=void 0,Se&&(b=Se.parse(b,g))}else b.error=b.error||"URN can not be parsed.";return b},serialize:function(u,g){var S=g.scheme||u.scheme||"urn",b=u.nid,j=S+":"+(g.nid||b),Q=_e[j];Q&&(u=Q.serialize(u,g));var ae=u,ie=u.nss;return ae.path=(b||g.nid)+":"+ie,ae}},wl=/^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/,Ms={scheme:"urn:uuid",parse:function(u,g){var S=u;return S.uuid=S.nss,S.nss=void 0,!g.tolerant&&(!S.uuid||!S.uuid.match(wl))&&(S.error=S.error||"UUID is not valid."),S},serialize:function(u,g){var S=u;return S.nss=(u.uuid||"").toLowerCase(),S}};_e[vt.scheme]=vt,_e[Is.scheme]=Is,_e[gt.scheme]=gt,_e[$s.scheme]=$s,_e[js.scheme]=js,_e[Ls.scheme]=Ls,_e[Ms.scheme]=Ms,a.SCHEMES=_e,a.pctEncChar=Pe,a.pctDecChars=De,a.parse=oe,a.removeDotSegments=qe,a.serialize=Ce,a.resolveComponents=Ie,a.resolve=tr,a.normalize=Me,a.equal=Ct,a.escapeComponent=wa,a.unescapeComponent=Qe,Object.defineProperty(a,"__esModule",{value:!0})}))});var Xt=W((Np,bn)=>{"use strict";bn.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 l=n[r];if(!a(e[l],t[l]))return!1}return!0}return e!==e&&t!==t}});var xn=W((jp,Pn)=>{"use strict";Pn.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 Jr=W((Lp,Rn)=>{"use strict";Rn.exports={copy:Bu,checkDataType:Ka,checkDataTypes:Wu,coerceToTypes:Ku,toHash:Ja,getProperty:Ga,escapeQuotes:Ya,equal:Xt(),ucs2length:xn(),varOccurences:Gu,varReplace:Yu,schemaHasRules:Xu,schemaHasRulesExcept:ed,schemaUnknownRules:rd,toQuotedString:Qa,getPathExpr:td,getPath:ad,getData:od,unescapeFragment:id,unescapeJsonPointer:es,escapeFragment:ld,escapeJsonPointer:Xa};function Bu(a,e){e=e||{};for(var t in a)e[t]=a[t];return e}function Ka(a,e,t,s){var r=s?" !== ":" === ",n=s?" || ":" && ",l=s?"!":"",i=s?"":"!";switch(a){case"null":return e+r+"null";case"array":return l+"Array.isArray("+e+")";case"object":return"("+l+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+l+"isFinite("+e+")":"")+")";case"number":return"(typeof "+e+r+'"'+a+'"'+(t?n+l+"isFinite("+e+")":"")+")";default:return"typeof "+e+r+'"'+a+'"'}}function Wu(a,e,t){switch(a.length){case 1:return Ka(a[0],e,t,!0);default:var s="",r=Ja(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?" && ":"")+Ka(n,e,t,!0);return s}}var wn=Ja(["string","number","integer","boolean","null"]);function Ku(a,e){if(Array.isArray(e)){for(var t=[],s=0;s<e.length;s++){var r=e[s];(wn[r]||a==="array"&&r==="array")&&(t[t.length]=r)}if(t.length)return t}else{if(wn[e])return[e];if(a==="array"&&e==="array")return["array"]}}function Ja(a){for(var e={},t=0;t<a.length;t++)e[a[t]]=!0;return e}var Qu=/^[a-z$_][a-z$_0-9]*$/i,Ju=/'|\\/g;function Ga(a){return typeof a=="number"?"["+a+"]":Qu.test(a)?"."+a:"['"+Ya(a)+"']"}function Ya(a){return a.replace(Ju,"\\$&").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\f/g,"\\f").replace(/\t/g,"\\t")}function Gu(a,e){e+="[^0-9]";var t=a.match(new RegExp(e,"g"));return t?t.length:0}function Yu(a,e,t){return e+="([^0-9])",t=t.replace(/\$/g,"$$$$"),a.replace(new RegExp(e,"g"),t+"$1")}function Xu(a,e){if(typeof a=="boolean")return!a;for(var t in a)if(e[t])return!0}function ed(a,e,t){if(typeof a=="boolean")return!a&&t!="not";for(var s in a)if(s!=t&&e[s])return!0}function rd(a,e){if(typeof a!="boolean"){for(var t in a)if(!e[t])return t}}function Qa(a){return"'"+Ya(a)+"'"}function td(a,e,t,s){var r=t?"'/' + "+e+(s?"":".replace(/~/g, '~0').replace(/\\//g, '~1')"):s?"'[' + "+e+" + ']'":"'[\\'' + "+e+" + '\\']'";return Tn(a,r)}function ad(a,e,t){var s=Qa(t?"/"+Xa(e):Ga(e));return Tn(a,s)}var sd=/^\/(?:[^~]|~0|~1)*$/,nd=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function od(a,e,t){var s,r,n,l;if(a==="")return"rootData";if(a[0]=="/"){if(!sd.test(a))throw new Error("Invalid JSON-pointer: "+a);r=a,n="rootData"}else{if(l=a.match(nd),!l)throw new Error("Invalid JSON-pointer: "+a);if(s=+l[1],r=l[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,d=r.split("/"),f=0;f<d.length;f++){var p=d[f];p&&(n+=Ga(es(p)),i+=" && "+n)}return i}function Tn(a,e){return a=='""'?e:(a+" + "+e).replace(/([^\\])' \+ '/g,"$1")}function id(a){return es(decodeURIComponent(a))}function ld(a){return encodeURIComponent(Xa(a))}function Xa(a){return a.replace(/~/g,"~0").replace(/\//g,"~1")}function es(a){return a.replace(/~1/g,"/").replace(/~0/g,"~")}});var rs=W((Mp,On)=>{"use strict";var cd=Jr();On.exports=ud;function ud(a){cd.copy(a,this)}});var Dn=W((Fp,An)=>{"use strict";var wr=An.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(){};ea(e,s,r,a,"",a)};wr.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0};wr.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};wr.propsKeywords={definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};wr.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 ea(a,e,t,s,r,n,l,i,d,f){if(s&&typeof s=="object"&&!Array.isArray(s)){e(s,r,n,l,i,d,f);for(var p in s){var m=s[p];if(Array.isArray(m)){if(p in wr.arrayKeywords)for(var E=0;E<m.length;E++)ea(a,e,t,m[E],r+"/"+p+"/"+E,n,r,p,s,E)}else if(p in wr.propsKeywords){if(m&&typeof m=="object")for(var c in m)ea(a,e,t,m[c],r+"/"+p+"/"+dd(c),n,r,p,s,c)}else(p in wr.keywords||a.allKeys&&!(p in wr.skipKeywords))&&ea(a,e,t,m,r+"/"+p,n,r,p,s)}t(s,r,n,l,i,d,f)}}function dd(a){return a.replace(/~/g,"~0").replace(/\//g,"~1")}});var oa=W((Up,Cn)=>{"use strict";var Dt=Sn(),In=Xt(),sa=Jr(),ra=rs(),fd=Dn();Cn.exports=Rr;Rr.normalizeId=Tr;Rr.fullPath=ta;Rr.url=aa;Rr.ids=gd;Rr.inlineRef=ts;Rr.schema=na;function Rr(a,e,t){var s=this._refs[t];if(typeof s=="string")if(this._refs[s])s=this._refs[s];else return Rr.call(this,a,e,s);if(s=s||this._schemas[t],s instanceof ra)return ts(s.schema,this._opts.inlineRefs)?s.schema:s.validate||this._compile(s);var r=na.call(this,e,t),n,l,i;return r&&(n=r.schema,e=r.root,i=r.baseId),n instanceof ra?l=n.validate||a.call(this,n.schema,e,void 0,i):n!==void 0&&(l=ts(n,this._opts.inlineRefs)?n:a.call(this,n,e,void 0,i)),l}function na(a,e){var t=Dt.parse(e),s=$n(t),r=ta(this._getId(a.schema));if(Object.keys(a.schema).length===0||s!==r){var n=Tr(s),l=this._refs[n];if(typeof l=="string")return pd.call(this,a,l,t);if(l instanceof ra)l.validate||this._compile(l),a=l;else if(l=this._schemas[n],l instanceof ra){if(l.validate||this._compile(l),n==Tr(e))return{schema:l,root:a,baseId:r};a=l}else return;if(!a.schema)return;r=ta(this._getId(a.schema))}return kn.call(this,t,r,a.schema,a)}function pd(a,e,t){var s=na.call(this,a,e);if(s){var r=s.schema,n=s.baseId;a=s.root;var l=this._getId(r);return l&&(n=aa(n,l)),kn.call(this,t,n,r,a)}}var hd=sa.toHash(["properties","patternProperties","enum","dependencies","definitions"]);function kn(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 l=r[n];if(l){if(l=sa.unescapeFragment(l),t=t[l],t===void 0)break;var i;if(!hd[l]&&(i=this._getId(t),i&&(e=aa(e,i)),t.$ref)){var d=aa(e,t.$ref),f=na.call(this,s,d);f&&(t=f.schema,s=f.root,e=f.baseId)}}}if(t!==void 0&&t!==s.schema)return{schema:t,root:s,baseId:e}}}var md=sa.toHash(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum"]);function ts(a,e){if(e===!1)return!1;if(e===void 0||e===!0)return as(a);if(e)return ss(a)<=e}function as(a){var e;if(Array.isArray(a)){for(var t=0;t<a.length;t++)if(e=a[t],typeof e=="object"&&!as(e))return!1}else for(var s in a)if(s=="$ref"||(e=a[s],typeof e=="object"&&!as(e)))return!1;return!0}function ss(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+=ss(t)),e==1/0)return 1/0}else for(var r in a){if(r=="$ref")return 1/0;if(md[r])e++;else if(t=a[r],typeof t=="object"&&(e+=ss(t)+1),e==1/0)return 1/0}return e}function ta(a,e){e!==!1&&(a=Tr(a));var t=Dt.parse(a);return $n(t)}function $n(a){return Dt.serialize(a).split("#")[0]+"#"}var vd=/#\/?$/;function Tr(a){return a?a.replace(vd,""):""}function aa(a,e){return e=Tr(e),Dt.resolve(a,e)}function gd(a){var e=Tr(this._getId(a)),t={"":e},s={"":ta(e,!1)},r={},n=this;return fd(a,{allKeys:!0},function(l,i,d,f,p,m,E){if(i!==""){var c=n._getId(l),y=t[f],_=s[f]+"/"+p;if(E!==void 0&&(_+="/"+(typeof E=="number"?E:sa.escapeFragment(E))),typeof c=="string"){c=y=Tr(y?Dt.resolve(y,c):c);var v=n._refs[c];if(typeof v=="string"&&(v=n._refs[v]),v&&v.schema){if(!In(l,v.schema))throw new Error('id "'+c+'" resolves to more than one schema')}else if(c!=Tr(_))if(c[0]=="#"){if(r[c]&&!In(l,r[c]))throw new Error('id "'+c+'" resolves to more than one schema');r[c]=l}else n._refs[c]=_}t[i]=y,s[i]=_}}),r}});var ia=W((qp,jn)=>{"use strict";var ns=oa();jn.exports={Validation:Nn(yd),MissingRef:Nn(os)};function yd(a){this.message="validation failed",this.errors=a,this.ajv=this.validation=!0}os.message=function(a,e){return"can't resolve reference "+e+" from id "+a};function os(a,e,t){this.message=t||os.message(a,e),this.missingRef=ns.url(a,e),this.missingSchema=ns.normalizeId(ns.fullPath(this.missingRef))}function Nn(a){return a.prototype=Object.create(Error.prototype),a.prototype.constructor=a,a}});var is=W((Vp,Ln)=>{"use strict";Ln.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(l){return function(i,d){var f={key:i,value:l[i]},p={key:d,value:l[d]};return n(f,p)}}})(e.cmp),r=[];return(function n(l){if(l&&l.toJSON&&typeof l.toJSON=="function"&&(l=l.toJSON()),l!==void 0){if(typeof l=="number")return isFinite(l)?""+l:"null";if(typeof l!="object")return JSON.stringify(l);var i,d;if(Array.isArray(l)){for(d="[",i=0;i<l.length;i++)i&&(d+=","),d+=n(l[i])||"null";return d+"]"}if(l===null)return"null";if(r.indexOf(l)!==-1){if(t)return JSON.stringify("__cycle__");throw new TypeError("Converting circular structure to JSON")}var f=r.push(l)-1,p=Object.keys(l).sort(s&&s(l));for(d="",i=0;i<p.length;i++){var m=p[i],E=n(l[m]);E&&(d&&(d+=","),d+=JSON.stringify(m)+":"+E)}return r.splice(f,1),"{"+d+"}"}})(a)}});var ls=W((zp,Mn)=>{"use strict";Mn.exports=function(e,t,s){var r="",n=e.schema.$async===!0,l=e.util.schemaHasRulesExcept(e.schema,e.RULES.all,"$ref"),i=e.self._getId(e.schema);if(e.opts.strictKeywords){var d=e.util.schemaUnknownRules(e.schema,e.RULES.keywords);if(d){var f="unknown keyword: "+d;if(e.opts.strictKeywords==="log")e.logger.warn(f);else throw new Error(f)}}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"||!(l||e.schema.$ref)){var t="false schema",p=e.level,m=e.dataLevel,E=e.schema[t],c=e.schemaPath+e.util.getProperty(t),y=e.errSchemaPath+"/"+t,D=!e.opts.allErrors,U,_="data"+(m||""),T="valid"+p;if(e.schema===!1){e.isTop?D=!0:r+=" var "+T+" = false; ";var v=v||[];v.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(U||"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: "+_+" "),r+=" } "):r+=" {} ";var P=r;r=v.pop(),!e.compositeRule&&D?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++; "}else e.isTop?n?r+=" return data; ":r+=" validate.errors = null; return true; ":r+=" var "+T+" = true; ";return e.isTop&&(r+=" }; return validate; "),r}if(e.isTop){var O=e.isTop,p=e.level=0,m=e.dataLevel=0,_="data";if(e.rootId=e.resolve.fullPath(e.self._getId(e.root.schema)),e.baseId=e.baseId||e.rootId,delete e.isTop,e.dataPathArr=[""],e.schema.default!==void 0&&e.opts.useDefaults&&e.opts.strictDefaults){var x="default is ignored in the schema root";if(e.opts.strictDefaults==="log")e.logger.warn(x);else throw new Error(x)}r+=" var vErrors = null; ",r+=" var errors = 0; ",r+=" if (rootData === undefined) rootData = data; "}else{var p=e.level,m=e.dataLevel,_="data"+(m||"");if(i&&(e.baseId=e.resolve.url(e.baseId,i)),n&&!e.async)throw new Error("async schema in sync schema");r+=" var errs_"+p+" = errors;"}var T="valid"+p,D=!e.opts.allErrors,I="",z="",U,k=e.schema.type,q=Array.isArray(k);if(k&&e.opts.nullable&&e.schema.nullable===!0&&(q?k.indexOf("null")==-1&&(k=k.concat("null")):k!="null"&&(k=[k,"null"],q=!0)),q&&k.length==1&&(k=k[0],q=!1),e.schema.$ref&&l){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&&(l=!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")),k){if(e.opts.coerceTypes)var F=e.util.coerceToTypes(e.opts.coerceTypes,k);var L=e.RULES.types[k];if(F||q||L===!0||L&&!xe(L)){var c=e.schemaPath+".type",y=e.errSchemaPath+"/type",c=e.schemaPath+".type",y=e.errSchemaPath+"/type",A=q?"checkDataTypes":"checkDataType";if(r+=" if ("+e.util[A](k,_,e.opts.strictNumbers,!0)+") { ",F){var $="dataType"+p,M="coerced"+p;r+=" var "+$+" = typeof "+_+"; var "+M+" = undefined; ",e.opts.coerceTypes=="array"&&(r+=" if ("+$+" == 'object' && Array.isArray("+_+") && "+_+".length == 1) { "+_+" = "+_+"[0]; "+$+" = typeof "+_+"; if ("+e.util.checkDataType(e.schema.type,_,e.opts.strictNumbers)+") "+M+" = "+_+"; } "),r+=" if ("+M+" !== undefined) ; ";var le=F;if(le)for(var Y,re=-1,G=le.length-1;re<G;)Y=le[re+=1],Y=="string"?r+=" else if ("+$+" == 'number' || "+$+" == 'boolean') "+M+" = '' + "+_+"; else if ("+_+" === null) "+M+" = ''; ":Y=="number"||Y=="integer"?(r+=" else if ("+$+" == 'boolean' || "+_+" === null || ("+$+" == 'string' && "+_+" && "+_+" == +"+_+" ",Y=="integer"&&(r+=" && !("+_+" % 1)"),r+=")) "+M+" = +"+_+"; "):Y=="boolean"?r+=" else if ("+_+" === 'false' || "+_+" === 0 || "+_+" === null) "+M+" = false; else if ("+_+" === 'true' || "+_+" === 1) "+M+" = true; ":Y=="null"?r+=" else if ("+_+" === '' || "+_+" === 0 || "+_+" === false) "+M+" = null; ":e.opts.coerceTypes=="array"&&Y=="array"&&(r+=" else if ("+$+" == 'string' || "+$+" == 'number' || "+$+" == 'boolean' || "+_+" == null) "+M+" = ["+_+"]; ");r+=" else { ";var v=v||[];v.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(U||"type")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(y)+" , params: { type: '",q?r+=""+k.join(","):r+=""+k,r+="' } ",e.opts.messages!==!1&&(r+=" , message: 'should be ",q?r+=""+k.join(","):r+=""+k,r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+_+" "),r+=" } "):r+=" {} ";var P=r;r=v.pop(),!e.compositeRule&&D?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+=" } if ("+M+" !== undefined) { ";var H=m?"data"+(m-1||""):"parentData",me=m?e.dataPathArr[m]:"parentDataProperty";r+=" "+_+" = "+M+"; ",m||(r+="if ("+H+" !== undefined)"),r+=" "+H+"["+me+"] = "+M+"; } "}else{var v=v||[];v.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(U||"type")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(y)+" , params: { type: '",q?r+=""+k.join(","):r+=""+k,r+="' } ",e.opts.messages!==!1&&(r+=" , message: 'should be ",q?r+=""+k.join(","):r+=""+k,r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+_+" "),r+=" } "):r+=" {} ";var P=r;r=v.pop(),!e.compositeRule&&D?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+=" } "}}if(e.schema.$ref&&!l)r+=" "+e.RULES.all.$ref.code(e,"$ref")+" ",D&&(r+=" } if (errors === ",O?r+="0":r+="errs_"+p,r+=") { ",z+="}");else{var Te=e.RULES;if(Te){for(var L,Ae=-1,se=Te.length-1;Ae<se;)if(L=Te[Ae+=1],xe(L)){if(L.type&&(r+=" if ("+e.util.checkDataType(L.type,_,e.opts.strictNumbers)+") { "),e.opts.useDefaults){if(L.type=="object"&&e.schema.properties){var E=e.schema.properties,_e=Object.keys(E),Pe=_e;if(Pe)for(var De,_r=-1,ur=Pe.length-1;_r<ur;){De=Pe[_r+=1];var Ee=E[De];if(Ee.default!==void 0){var ve=_+e.util.getProperty(De);if(e.compositeRule){if(e.opts.strictDefaults){var x="default is ignored for: "+ve;if(e.opts.strictDefaults==="log")e.logger.warn(x);else throw new Error(x)}}else r+=" if ("+ve+" === undefined ",e.opts.useDefaults=="empty"&&(r+=" || "+ve+" === null || "+ve+" === '' "),r+=" ) "+ve+" = ",e.opts.useDefaults=="shared"?r+=" "+e.useDefault(Ee.default)+" ":r+=" "+JSON.stringify(Ee.default)+" ",r+="; "}}}else if(L.type=="array"&&Array.isArray(e.schema.items)){var Or=e.schema.items;if(Or){for(var Ee,re=-1,Re=Or.length-1;re<Re;)if(Ee=Or[re+=1],Ee.default!==void 0){var ve=_+"["+re+"]";if(e.compositeRule){if(e.opts.strictDefaults){var x="default is ignored for: "+ve;if(e.opts.strictDefaults==="log")e.logger.warn(x);else throw new Error(x)}}else r+=" if ("+ve+" === undefined ",e.opts.useDefaults=="empty"&&(r+=" || "+ve+" === null || "+ve+" === '' "),r+=" ) "+ve+" = ",e.opts.useDefaults=="shared"?r+=" "+e.useDefault(Ee.default)+" ":r+=" "+JSON.stringify(Ee.default)+" ",r+="; "}}}}var oe=L.rules;if(oe){for(var Er,dr=-1,Ar=oe.length-1;dr<Ar;)if(Er=oe[dr+=1],qe(Er)){var Dr=Er.code(e,Er.keyword,L.type);Dr&&(r+=" "+Dr+" ",D&&(I+="}"))}}if(D&&(r+=" "+I+" ",I=""),L.type&&(r+=" } ",k&&k===L.type&&!F)){r+=" else { ";var c=e.schemaPath+".type",y=e.errSchemaPath+"/type",v=v||[];v.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(U||"type")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(y)+" , params: { type: '",q?r+=""+k.join(","):r+=""+k,r+="' } ",e.opts.messages!==!1&&(r+=" , message: 'should be ",q?r+=""+k.join(","):r+=""+k,r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+_+" "),r+=" } "):r+=" {} ";var P=r;r=v.pop(),!e.compositeRule&&D?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+=" } "}D&&(r+=" if (errors === ",O?r+="0":r+="errs_"+p,r+=") { ",z+="}")}}}D&&(r+=" "+z+" "),O?(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 "+T+" = errors === errs_"+p+";";function xe(Ie){for(var tr=Ie.rules,Me=0;Me<tr.length;Me++)if(qe(tr[Me]))return!0}function qe(Ie){return e.schema[Ie.keyword]!==void 0||Ie.implements&&Ce(Ie)}function Ce(Ie){for(var tr=Ie.implements,Me=0;Me<tr.length;Me++)if(e.schema[tr[Me]]!==void 0)return!0}return r}});var zn=W((Hp,Vn)=>{"use strict";var la=oa(),ua=Jr(),Un=ia(),_d=is(),Fn=ls(),Ed=ua.ucs2length,Sd=Xt(),bd=Un.Validation;Vn.exports=cs;function cs(a,e,t,s){var r=this,n=this._opts,l=[void 0],i={},d=[],f={},p=[],m={},E=[];e=e||{schema:a,refVal:l,refs:i};var c=Pd.call(this,a,e,s),y=this._compilations[c.index];if(c.compiling)return y.callValidate=x;var _=this._formats,v=this.RULES;try{var P=T(a,e,t,s);y.validate=P;var O=y.callValidate;return O&&(O.schema=P.schema,O.errors=null,O.refs=P.refs,O.refVal=P.refVal,O.root=P.root,O.$async=P.$async,n.sourceCode&&(O.source=P.source)),P}finally{xd.call(this,a,e,s)}function x(){var A=y.validate,$=A.apply(this,arguments);return x.errors=A.errors,$}function T(A,$,M,le){var Y=!$||$&&$.schema==A;if($.schema!=e.schema)return cs.call(r,A,$,M,le);var re=A.$async===!0,G=Fn({isTop:!0,schema:A,isRoot:Y,baseId:le,root:$,schemaPath:"",errSchemaPath:"#",errorPath:'""',MissingRefError:Un.MissingRef,RULES:v,validate:Fn,util:ua,resolve:la,resolveRef:D,usePattern:q,useDefault:F,useCustomRule:L,opts:n,formats:_,logger:r.logger,self:r});G=ca(l,Rd)+ca(d,wd)+ca(p,Td)+ca(E,Od)+G,n.processCode&&(G=n.processCode(G,A));var H;try{var me=new Function("self","RULES","formats","root","refVal","defaults","customRules","equal","ucs2length","ValidationError",G);H=me(r,v,_,e,l,p,E,Sd,Ed,bd),l[0]=H}catch(Te){throw r.logger.error("Error compiling schema, function code:",G),Te}return H.schema=A,H.errors=null,H.refs=i,H.refVal=l,H.root=Y?H:$,re&&(H.$async=!0),n.sourceCode===!0&&(H.source={code:G,patterns:d,defaults:p}),H}function D(A,$,M){$=la.url(A,$);var le=i[$],Y,re;if(le!==void 0)return Y=l[le],re="refVal["+le+"]",k(Y,re);if(!M&&e.refs){var G=e.refs[$];if(G!==void 0)return Y=e.refVal[G],re=I($,Y),k(Y,re)}re=I($);var H=la.call(r,T,e,$);if(H===void 0){var me=t&&t[$];me&&(H=la.inlineRef(me,n.inlineRefs)?me:cs.call(r,me,e,t,A))}if(H===void 0)z($);else return U($,H),k(H,re)}function I(A,$){var M=l.length;return l[M]=$,i[A]=M,"refVal"+M}function z(A){delete i[A]}function U(A,$){var M=i[A];l[M]=$}function k(A,$){return typeof A=="object"||typeof A=="boolean"?{code:$,schema:A,inline:!0}:{code:$,$async:A&&!!A.$async}}function q(A){var $=f[A];return $===void 0&&($=f[A]=d.length,d[$]=A),"pattern"+$}function F(A){switch(typeof A){case"boolean":case"number":return""+A;case"string":return ua.toQuotedString(A);case"object":if(A===null)return"null";var $=_d(A),M=m[$];return M===void 0&&(M=m[$]=p.length,p[M]=A),"default"+M}}function L(A,$,M,le){if(r._opts.validateSchema!==!1){var Y=A.definition.dependencies;if(Y&&!Y.every(function(Pe){return Object.prototype.hasOwnProperty.call(M,Pe)}))throw new Error("parent schema must have all required keywords: "+Y.join(","));var re=A.definition.validateSchema;if(re){var G=re($);if(!G){var H="keyword schema is invalid: "+r.errorsText(re.errors);if(r._opts.validateSchema=="log")r.logger.error(H);else throw new Error(H)}}}var me=A.definition.compile,Te=A.definition.inline,Ae=A.definition.macro,se;if(me)se=me.call(r,$,M,le);else if(Ae)se=Ae.call(r,$,M,le),n.validateSchema!==!1&&r.validateSchema(se,!0);else if(Te)se=Te.call(r,le,A.keyword,$,M);else if(se=A.definition.validate,!se)return;if(se===void 0)throw new Error('custom keyword "'+A.keyword+'"failed to compile');var _e=E.length;return E[_e]=se,{code:"customRule"+_e,validate:se}}}function Pd(a,e,t){var s=qn.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 xd(a,e,t){var s=qn.call(this,a,e,t);s>=0&&this._compilations.splice(s,1)}function qn(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 wd(a,e){return"var pattern"+a+" = new RegExp("+ua.toQuotedString(e[a])+");"}function Td(a){return"var default"+a+" = defaults["+a+"];"}function Rd(a,e){return e[a]===void 0?"":"var refVal"+a+" = refVal["+a+"];"}function Od(a){return"var customRule"+a+" = customRules["+a+"];"}function ca(a,e){if(!a.length)return"";for(var t="",s=0;s<a.length;s++)t+=e(s,a);return t}});var Zn=W((Zp,Hn)=>{"use strict";var da=Hn.exports=function(){this._cache={}};da.prototype.put=function(e,t){this._cache[e]=t};da.prototype.get=function(e){return this._cache[e]};da.prototype.del=function(e){delete this._cache[e]};da.prototype.clear=function(){this._cache={}}});var ao=W((Bp,to)=>{"use strict";var Ad=Jr(),Dd=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,Id=[0,31,28,31,30,31,30,31,31,30,31,30,31],kd=/^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i,Bn=/^(?=.{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,$d=/^(?:[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,Cd=/^(?:[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,Wn=/^(?:(?:[^\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,Kn=/^(?:(?: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,Qn=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,Jn=/^(?:\/(?:[^~/]|~0|~1)*)*$/,Gn=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,Yn=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/;to.exports=fa;function fa(a){return a=a=="full"?"full":"fast",Ad.copy(fa[a])}fa.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":Wn,url:Kn,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:Bn,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:ro,uuid:Qn,"json-pointer":Jn,"json-pointer-uri-fragment":Gn,"relative-json-pointer":Yn};fa.full={date:Xn,time:eo,"date-time":Ld,uri:Fd,"uri-reference":Cd,"uri-template":Wn,url:Kn,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:Bn,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:ro,uuid:Qn,"json-pointer":Jn,"json-pointer-uri-fragment":Gn,"relative-json-pointer":Yn};function Nd(a){return a%4===0&&(a%100!==0||a%400===0)}function Xn(a){var e=a.match(Dd);if(!e)return!1;var t=+e[1],s=+e[2],r=+e[3];return s>=1&&s<=12&&r>=1&&r<=(s==2&&Nd(t)?29:Id[s])}function eo(a,e){var t=a.match(kd);if(!t)return!1;var s=t[1],r=t[2],n=t[3],l=t[5];return(s<=23&&r<=59&&n<=59||s==23&&r==59&&n==60)&&(!e||l)}var jd=/t|\s/i;function Ld(a){var e=a.split(jd);return e.length==2&&Xn(e[0])&&eo(e[1],!0)}var Md=/\/|:/;function Fd(a){return Md.test(a)&&$d.test(a)}var Ud=/[^\\]\\Z/;function ro(a){if(Ud.test(a))return!1;try{return new RegExp(a),!0}catch{return!1}}});var no=W((Wp,so)=>{"use strict";so.exports=function(e,t,s){var r=" ",n=e.level,l=e.dataLevel,i=e.schema[t],d=e.errSchemaPath+"/"+t,f=!e.opts.allErrors,p="data"+(l||""),m="valid"+n,E,c;if(i=="#"||i=="#/")e.isRoot?(E=e.async,c="validate"):(E=e.root.schema.$async===!0,c="root.refVal[0]");else{var y=e.resolveRef(e.baseId,i,e.isRoot);if(y===void 0){var _=e.MissingRefError.message(e.baseId,i);if(e.opts.missingRefs=="fail"){e.logger.error(_);var v=v||[];v.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '$ref' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(d)+" , 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: "+p+" "),r+=" } "):r+=" {} ";var P=r;r=v.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++; ",f&&(r+=" if (false) { ")}else if(e.opts.missingRefs=="ignore")e.logger.warn(_),f&&(r+=" if (true) { ");else throw new e.MissingRefError(e.baseId,i,_)}else if(y.inline){var O=e.util.copy(e);O.level++;var x="valid"+O.level;O.schema=y.schema,O.schemaPath="",O.errSchemaPath=i;var T=e.validate(O).replace(/validate\.schema/g,y.code);r+=" "+T+" ",f&&(r+=" if ("+x+") { ")}else E=y.$async===!0||e.async&&y.$async!==!1,c=y.code}if(c){var v=v||[];v.push(r),r="",e.opts.passContext?r+=" "+c+".call(this, ":r+=" "+c+"( ",r+=" "+p+", (dataPath || '')",e.errorPath!='""'&&(r+=" + "+e.errorPath);var D=l?"data"+(l-1||""):"parentData",I=l?e.dataPathArr[l]:"parentDataProperty";r+=" , "+D+" , "+I+", rootData) ";var z=r;if(r=v.pop(),E){if(!e.async)throw new Error("async schema referenced by sync schema");f&&(r+=" var "+m+"; "),r+=" try { await "+z+"; ",f&&(r+=" "+m+" = 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; ",f&&(r+=" "+m+" = false; "),r+=" } ",f&&(r+=" if ("+m+") { ")}else r+=" if (!"+z+") { if (vErrors === null) vErrors = "+c+".errors; else vErrors = vErrors.concat("+c+".errors); errors = vErrors.length; } ",f&&(r+=" else { ")}return r}});var io=W((Kp,oo)=>{"use strict";oo.exports=function(e,t,s){var r=" ",n=e.schema[t],l=e.schemaPath+e.util.getProperty(t),i=e.errSchemaPath+"/"+t,d=!e.opts.allErrors,f=e.util.copy(e),p="";f.level++;var m="valid"+f.level,E=f.baseId,c=!0,y=n;if(y)for(var _,v=-1,P=y.length-1;v<P;)_=y[v+=1],(e.opts.strictKeywords?typeof _=="object"&&Object.keys(_).length>0||_===!1:e.util.schemaHasRules(_,e.RULES.all))&&(c=!1,f.schema=_,f.schemaPath=l+"["+v+"]",f.errSchemaPath=i+"/"+v,r+=" "+e.validate(f)+" ",f.baseId=E,d&&(r+=" if ("+m+") { ",p+="}"));return d&&(c?r+=" if (true) { ":r+=" "+p.slice(0,-1)+" "),r}});var co=W((Qp,lo)=>{"use strict";lo.exports=function(e,t,s){var r=" ",n=e.level,l=e.dataLevel,i=e.schema[t],d=e.schemaPath+e.util.getProperty(t),f=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,m="data"+(l||""),E="valid"+n,c="errs__"+n,y=e.util.copy(e),_="";y.level++;var v="valid"+y.level,P=i.every(function(U){return e.opts.strictKeywords?typeof U=="object"&&Object.keys(U).length>0||U===!1:e.util.schemaHasRules(U,e.RULES.all)});if(P){var O=y.baseId;r+=" var "+c+" = errors; var "+E+" = false; ";var x=e.compositeRule;e.compositeRule=y.compositeRule=!0;var T=i;if(T)for(var D,I=-1,z=T.length-1;I<z;)D=T[I+=1],y.schema=D,y.schemaPath=d+"["+I+"]",y.errSchemaPath=f+"/"+I,r+=" "+e.validate(y)+" ",y.baseId=O,r+=" "+E+" = "+E+" || "+v+"; if (!"+E+") { ",_+="}";e.compositeRule=y.compositeRule=x,r+=" "+_+" if (!"+E+") { var err = ",e.createErrors!==!1?(r+=" { keyword: 'anyOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: {} ",e.opts.messages!==!1&&(r+=" , message: 'should match some schema in anyOf' "),e.opts.verbose&&(r+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&p&&(e.async?r+=" throw new ValidationError(vErrors); ":r+=" validate.errors = vErrors; return false; "),r+=" } else { errors = "+c+"; if (vErrors !== null) { if ("+c+") vErrors.length = "+c+"; else vErrors = null; } ",e.opts.allErrors&&(r+=" } ")}else p&&(r+=" if (true) { ");return r}});var fo=W((Jp,uo)=>{"use strict";uo.exports=function(e,t,s){var r=" ",n=e.schema[t],l=e.errSchemaPath+"/"+t,i=!e.opts.allErrors,d=e.util.toQuotedString(n);return e.opts.$comment===!0?r+=" console.log("+d+");":typeof e.opts.$comment=="function"&&(r+=" self._opts.$comment("+d+", "+e.util.toQuotedString(l)+", validate.root.schema);"),r}});var ho=W((Gp,po)=>{"use strict";po.exports=function(e,t,s){var r=" ",n=e.level,l=e.dataLevel,i=e.schema[t],d=e.schemaPath+e.util.getProperty(t),f=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,m="data"+(l||""),E="valid"+n,c=e.opts.$data&&i&&i.$data,y;c?(r+=" var schema"+n+" = "+e.util.getData(i.$data,l,e.dataPathArr)+"; ",y="schema"+n):y=i,c||(r+=" var schema"+n+" = validate.schema"+d+";"),r+="var "+E+" = equal("+m+", schema"+n+"); if (!"+E+") { ";var _=_||[];_.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'const' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { allowedValue: schema"+n+" } ",e.opts.messages!==!1&&(r+=" , message: 'should be equal to constant' "),e.opts.verbose&&(r+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var v=r;return r=_.pop(),!e.compositeRule&&p?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+=" }",p&&(r+=" else { "),r}});var vo=W((Yp,mo)=>{"use strict";mo.exports=function(e,t,s){var r=" ",n=e.level,l=e.dataLevel,i=e.schema[t],d=e.schemaPath+e.util.getProperty(t),f=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,m="data"+(l||""),E="valid"+n,c="errs__"+n,y=e.util.copy(e),_="";y.level++;var v="valid"+y.level,P="i"+n,O=y.dataLevel=e.dataLevel+1,x="data"+O,T=e.baseId,D=e.opts.strictKeywords?typeof i=="object"&&Object.keys(i).length>0||i===!1:e.util.schemaHasRules(i,e.RULES.all);if(r+="var "+c+" = errors;var "+E+";",D){var I=e.compositeRule;e.compositeRule=y.compositeRule=!0,y.schema=i,y.schemaPath=d,y.errSchemaPath=f,r+=" var "+v+" = false; for (var "+P+" = 0; "+P+" < "+m+".length; "+P+"++) { ",y.errorPath=e.util.getPathExpr(e.errorPath,P,e.opts.jsonPointers,!0);var z=m+"["+P+"]";y.dataPathArr[O]=P;var U=e.validate(y);y.baseId=T,e.util.varOccurences(U,x)<2?r+=" "+e.util.varReplace(U,x,z)+" ":r+=" var "+x+" = "+z+"; "+U+" ",r+=" if ("+v+") break; } ",e.compositeRule=y.compositeRule=I,r+=" "+_+" if (!"+v+") {"}else r+=" if ("+m+".length == 0) {";var k=k||[];k.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'contains' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: {} ",e.opts.messages!==!1&&(r+=" , message: 'should contain a valid item' "),e.opts.verbose&&(r+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var q=r;return r=k.pop(),!e.compositeRule&&p?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+=" } else { ",D&&(r+=" errors = "+c+"; if (vErrors !== null) { if ("+c+") vErrors.length = "+c+"; else vErrors = null; } "),e.opts.allErrors&&(r+=" } "),r}});var yo=W((Xp,go)=>{"use strict";go.exports=function(e,t,s){var r=" ",n=e.level,l=e.dataLevel,i=e.schema[t],d=e.schemaPath+e.util.getProperty(t),f=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,m="data"+(l||""),E="errs__"+n,c=e.util.copy(e),y="";c.level++;var _="valid"+c.level,v={},P={},O=e.opts.ownProperties;for(I in i)if(I!="__proto__"){var x=i[I],T=Array.isArray(x)?P:v;T[I]=x}r+="var "+E+" = errors;";var D=e.errorPath;r+="var missing"+n+";";for(var I in P)if(T=P[I],T.length){if(r+=" if ( "+m+e.util.getProperty(I)+" !== undefined ",O&&(r+=" && Object.prototype.hasOwnProperty.call("+m+", '"+e.util.escapeQuotes(I)+"') "),p){r+=" && ( ";var z=T;if(z)for(var U,k=-1,q=z.length-1;k<q;){U=z[k+=1],k&&(r+=" || ");var F=e.util.getProperty(U),L=m+F;r+=" ( ( "+L+" === undefined ",O&&(r+=" || ! Object.prototype.hasOwnProperty.call("+m+", '"+e.util.escapeQuotes(U)+"') "),r+=") && (missing"+n+" = "+e.util.toQuotedString(e.opts.jsonPointers?U:F)+") ) "}r+=")) { ";var A="missing"+n,$="' + "+A+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.opts.jsonPointers?e.util.getPathExpr(D,A,!0):D+" + "+A);var M=M||[];M.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'dependencies' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { property: '"+e.util.escapeQuotes(I)+"', missingProperty: '"+$+"', depsCount: "+T.length+", deps: '"+e.util.escapeQuotes(T.length==1?T[0]:T.join(", "))+"' } ",e.opts.messages!==!1&&(r+=" , message: 'should have ",T.length==1?r+="property "+e.util.escapeQuotes(T[0]):r+="properties "+e.util.escapeQuotes(T.join(", ")),r+=" when property "+e.util.escapeQuotes(I)+" is present' "),e.opts.verbose&&(r+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var le=r;r=M.pop(),!e.compositeRule&&p?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=T;if(Y)for(var U,re=-1,G=Y.length-1;re<G;){U=Y[re+=1];var F=e.util.getProperty(U),$=e.util.escapeQuotes(U),L=m+F;e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPath(D,U,e.opts.jsonPointers)),r+=" if ( "+L+" === undefined ",O&&(r+=" || ! Object.prototype.hasOwnProperty.call("+m+", '"+e.util.escapeQuotes(U)+"') "),r+=") { var err = ",e.createErrors!==!1?(r+=" { keyword: 'dependencies' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { property: '"+e.util.escapeQuotes(I)+"', missingProperty: '"+$+"', depsCount: "+T.length+", deps: '"+e.util.escapeQuotes(T.length==1?T[0]:T.join(", "))+"' } ",e.opts.messages!==!1&&(r+=" , message: 'should have ",T.length==1?r+="property "+e.util.escapeQuotes(T[0]):r+="properties "+e.util.escapeQuotes(T.join(", ")),r+=" when property "+e.util.escapeQuotes(I)+" is present' "),e.opts.verbose&&(r+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } "}}r+=" } ",p&&(y+="}",r+=" else { ")}e.errorPath=D;var H=c.baseId;for(var I in v){var x=v[I];(e.opts.strictKeywords?typeof x=="object"&&Object.keys(x).length>0||x===!1:e.util.schemaHasRules(x,e.RULES.all))&&(r+=" "+_+" = true; if ( "+m+e.util.getProperty(I)+" !== undefined ",O&&(r+=" && Object.prototype.hasOwnProperty.call("+m+", '"+e.util.escapeQuotes(I)+"') "),r+=") { ",c.schema=x,c.schemaPath=d+e.util.getProperty(I),c.errSchemaPath=f+"/"+e.util.escapeFragment(I),r+=" "+e.validate(c)+" ",c.baseId=H,r+=" } ",p&&(r+=" if ("+_+") { ",y+="}"))}return p&&(r+=" "+y+" if ("+E+" == errors) {"),r}});var Eo=W((eh,_o)=>{"use strict";_o.exports=function(e,t,s){var r=" ",n=e.level,l=e.dataLevel,i=e.schema[t],d=e.schemaPath+e.util.getProperty(t),f=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,m="data"+(l||""),E="valid"+n,c=e.opts.$data&&i&&i.$data,y;c?(r+=" var schema"+n+" = "+e.util.getData(i.$data,l,e.dataPathArr)+"; ",y="schema"+n):y=i;var _="i"+n,v="schema"+n;c||(r+=" var "+v+" = validate.schema"+d+";"),r+="var "+E+";",c&&(r+=" if (schema"+n+" === undefined) "+E+" = true; else if (!Array.isArray(schema"+n+")) "+E+" = false; else {"),r+=""+E+" = false;for (var "+_+"=0; "+_+"<"+v+".length; "+_+"++) if (equal("+m+", "+v+"["+_+"])) { "+E+" = true; break; }",c&&(r+=" } "),r+=" if (!"+E+") { ";var P=P||[];P.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'enum' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , 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"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var O=r;return r=P.pop(),!e.compositeRule&&p?e.async?r+=" throw new ValidationError(["+O+"]); ":r+=" validate.errors = ["+O+"]; return false; ":r+=" var err = "+O+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" }",p&&(r+=" else { "),r}});var bo=W((rh,So)=>{"use strict";So.exports=function(e,t,s){var r=" ",n=e.level,l=e.dataLevel,i=e.schema[t],d=e.schemaPath+e.util.getProperty(t),f=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,m="data"+(l||"");if(e.opts.format===!1)return p&&(r+=" if (true) { "),r;var E=e.opts.$data&&i&&i.$data,c;E?(r+=" var schema"+n+" = "+e.util.getData(i.$data,l,e.dataPathArr)+"; ",c="schema"+n):c=i;var y=e.opts.unknownFormats,_=Array.isArray(y);if(E){var v="format"+n,P="isObject"+n,O="formatType"+n;r+=" var "+v+" = formats["+c+"]; var "+P+" = typeof "+v+" == 'object' && !("+v+" instanceof RegExp) && "+v+".validate; var "+O+" = "+P+" && "+v+".type || 'string'; if ("+P+") { ",e.async&&(r+=" var async"+n+" = "+v+".async; "),r+=" "+v+" = "+v+".validate; } if ( ",E&&(r+=" ("+c+" !== undefined && typeof "+c+" != 'string') || "),r+=" (",y!="ignore"&&(r+=" ("+c+" && !"+v+" ",_&&(r+=" && self._opts.unknownFormats.indexOf("+c+") == -1 "),r+=") || "),r+=" ("+v+" && "+O+" == '"+s+"' && !(typeof "+v+" == 'function' ? ",e.async?r+=" (async"+n+" ? await "+v+"("+m+") : "+v+"("+m+")) ":r+=" "+v+"("+m+") ",r+=" : "+v+".test("+m+"))))) {"}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+'"'),p&&(r+=" if (true) { "),r;if(_&&y.indexOf(i)>=0)return p&&(r+=" if (true) { "),r;throw new Error('unknown format "'+i+'" is used in schema at path "'+e.errSchemaPath+'"')}var P=typeof v=="object"&&!(v instanceof RegExp)&&v.validate,O=P&&v.type||"string";if(P){var x=v.async===!0;v=v.validate}if(O!=s)return p&&(r+=" if (true) { "),r;if(x){if(!e.async)throw new Error("async format in sync schema");var T="formats"+e.util.getProperty(i)+".validate";r+=" if (!(await "+T+"("+m+"))) { "}else{r+=" if (! ";var T="formats"+e.util.getProperty(i);P&&(T+=".validate"),typeof v=="function"?r+=" "+T+"("+m+") ":r+=" "+T+".test("+m+") ",r+=") { "}}var D=D||[];D.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'format' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { format: ",E?r+=""+c:r+=""+e.util.toQuotedString(i),r+=" } ",e.opts.messages!==!1&&(r+=` , message: 'should match format "`,E?r+="' + "+c+" + '":r+=""+e.util.escapeQuotes(i),r+=`"' `),e.opts.verbose&&(r+=" , schema: ",E?r+="validate.schema"+d:r+=""+e.util.toQuotedString(i),r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var I=r;return r=D.pop(),!e.compositeRule&&p?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+=" } ",p&&(r+=" else { "),r}});var xo=W((th,Po)=>{"use strict";Po.exports=function(e,t,s){var r=" ",n=e.level,l=e.dataLevel,i=e.schema[t],d=e.schemaPath+e.util.getProperty(t),f=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,m="data"+(l||""),E="valid"+n,c="errs__"+n,y=e.util.copy(e);y.level++;var _="valid"+y.level,v=e.schema.then,P=e.schema.else,O=v!==void 0&&(e.opts.strictKeywords?typeof v=="object"&&Object.keys(v).length>0||v===!1:e.util.schemaHasRules(v,e.RULES.all)),x=P!==void 0&&(e.opts.strictKeywords?typeof P=="object"&&Object.keys(P).length>0||P===!1:e.util.schemaHasRules(P,e.RULES.all)),T=y.baseId;if(O||x){var D;y.createErrors=!1,y.schema=i,y.schemaPath=d,y.errSchemaPath=f,r+=" var "+c+" = errors; var "+E+" = true; ";var I=e.compositeRule;e.compositeRule=y.compositeRule=!0,r+=" "+e.validate(y)+" ",y.baseId=T,y.createErrors=!0,r+=" errors = "+c+"; if (vErrors !== null) { if ("+c+") vErrors.length = "+c+"; else vErrors = null; } ",e.compositeRule=y.compositeRule=I,O?(r+=" if ("+_+") { ",y.schema=e.schema.then,y.schemaPath=e.schemaPath+".then",y.errSchemaPath=e.errSchemaPath+"/then",r+=" "+e.validate(y)+" ",y.baseId=T,r+=" "+E+" = "+_+"; ",O&&x?(D="ifClause"+n,r+=" var "+D+" = 'then'; "):D="'then'",r+=" } ",x&&(r+=" else { ")):r+=" if (!"+_+") { ",x&&(y.schema=e.schema.else,y.schemaPath=e.schemaPath+".else",y.errSchemaPath=e.errSchemaPath+"/else",r+=" "+e.validate(y)+" ",y.baseId=T,r+=" "+E+" = "+_+"; ",O&&x?(D="ifClause"+n,r+=" var "+D+" = 'else'; "):D="'else'",r+=" } "),r+=" if (!"+E+") { var err = ",e.createErrors!==!1?(r+=" { keyword: 'if' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { failingKeyword: "+D+" } ",e.opts.messages!==!1&&(r+=` , message: 'should match "' + `+D+` + '" schema' `),e.opts.verbose&&(r+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&p&&(e.async?r+=" throw new ValidationError(vErrors); ":r+=" validate.errors = vErrors; return false; "),r+=" } ",p&&(r+=" else { ")}else p&&(r+=" if (true) { ");return r}});var To=W((ah,wo)=>{"use strict";wo.exports=function(e,t,s){var r=" ",n=e.level,l=e.dataLevel,i=e.schema[t],d=e.schemaPath+e.util.getProperty(t),f=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,m="data"+(l||""),E="valid"+n,c="errs__"+n,y=e.util.copy(e),_="";y.level++;var v="valid"+y.level,P="i"+n,O=y.dataLevel=e.dataLevel+1,x="data"+O,T=e.baseId;if(r+="var "+c+" = errors;var "+E+";",Array.isArray(i)){var D=e.schema.additionalItems;if(D===!1){r+=" "+E+" = "+m+".length <= "+i.length+"; ";var I=f;f=e.errSchemaPath+"/additionalItems",r+=" if (!"+E+") { ";var z=z||[];z.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'additionalItems' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , 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: "+m+" "),r+=" } "):r+=" {} ";var U=r;r=z.pop(),!e.compositeRule&&p?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+=" } ",f=I,p&&(_+="}",r+=" else { ")}var k=i;if(k){for(var q,F=-1,L=k.length-1;F<L;)if(q=k[F+=1],e.opts.strictKeywords?typeof q=="object"&&Object.keys(q).length>0||q===!1:e.util.schemaHasRules(q,e.RULES.all)){r+=" "+v+" = true; if ("+m+".length > "+F+") { ";var A=m+"["+F+"]";y.schema=q,y.schemaPath=d+"["+F+"]",y.errSchemaPath=f+"/"+F,y.errorPath=e.util.getPathExpr(e.errorPath,F,e.opts.jsonPointers,!0),y.dataPathArr[O]=F;var $=e.validate(y);y.baseId=T,e.util.varOccurences($,x)<2?r+=" "+e.util.varReplace($,x,A)+" ":r+=" var "+x+" = "+A+"; "+$+" ",r+=" } ",p&&(r+=" if ("+v+") { ",_+="}")}}if(typeof D=="object"&&(e.opts.strictKeywords?typeof D=="object"&&Object.keys(D).length>0||D===!1:e.util.schemaHasRules(D,e.RULES.all))){y.schema=D,y.schemaPath=e.schemaPath+".additionalItems",y.errSchemaPath=e.errSchemaPath+"/additionalItems",r+=" "+v+" = true; if ("+m+".length > "+i.length+") { for (var "+P+" = "+i.length+"; "+P+" < "+m+".length; "+P+"++) { ",y.errorPath=e.util.getPathExpr(e.errorPath,P,e.opts.jsonPointers,!0);var A=m+"["+P+"]";y.dataPathArr[O]=P;var $=e.validate(y);y.baseId=T,e.util.varOccurences($,x)<2?r+=" "+e.util.varReplace($,x,A)+" ":r+=" var "+x+" = "+A+"; "+$+" ",p&&(r+=" if (!"+v+") break; "),r+=" } } ",p&&(r+=" if ("+v+") { ",_+="}")}}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=d,y.errSchemaPath=f,r+=" for (var "+P+" = 0; "+P+" < "+m+".length; "+P+"++) { ",y.errorPath=e.util.getPathExpr(e.errorPath,P,e.opts.jsonPointers,!0);var A=m+"["+P+"]";y.dataPathArr[O]=P;var $=e.validate(y);y.baseId=T,e.util.varOccurences($,x)<2?r+=" "+e.util.varReplace($,x,A)+" ":r+=" var "+x+" = "+A+"; "+$+" ",p&&(r+=" if (!"+v+") break; "),r+=" }"}return p&&(r+=" "+_+" if ("+c+" == errors) {"),r}});var us=W((sh,Ro)=>{"use strict";Ro.exports=function(e,t,s){var r=" ",n=e.level,l=e.dataLevel,i=e.schema[t],d=e.schemaPath+e.util.getProperty(t),f=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,T,m="data"+(l||""),E=e.opts.$data&&i&&i.$data,c;E?(r+=" var schema"+n+" = "+e.util.getData(i.$data,l,e.dataPathArr)+"; ",c="schema"+n):c=i;var y=t=="maximum",_=y?"exclusiveMaximum":"exclusiveMinimum",v=e.schema[_],P=e.opts.$data&&v&&v.$data,O=y?"<":">",x=y?">":"<",T=void 0;if(!(E||typeof i=="number"||i===void 0))throw new Error(t+" must be number");if(!(P||v===void 0||typeof v=="number"||typeof v=="boolean"))throw new Error(_+" must be number or boolean");if(P){var D=e.util.getData(v.$data,l,e.dataPathArr),I="exclusive"+n,z="exclType"+n,U="exclIsNumber"+n,k="op"+n,q="' + "+k+" + '";r+=" var schemaExcl"+n+" = "+D+"; ",D="schemaExcl"+n,r+=" var "+I+"; var "+z+" = typeof "+D+"; if ("+z+" != 'boolean' && "+z+" != 'undefined' && "+z+" != 'number') { ";var T=_,F=F||[];F.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(T||"_exclusiveLimit")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: {} ",e.opts.messages!==!1&&(r+=" , message: '"+_+" should be boolean' "),e.opts.verbose&&(r+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var L=r;r=F.pop(),!e.compositeRule&&p?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 ( ",E&&(r+=" ("+c+" !== undefined && typeof "+c+" != 'number') || "),r+=" "+z+" == 'number' ? ( ("+I+" = "+c+" === undefined || "+D+" "+O+"= "+c+") ? "+m+" "+x+"= "+D+" : "+m+" "+x+" "+c+" ) : ( ("+I+" = "+D+" === true) ? "+m+" "+x+"= "+c+" : "+m+" "+x+" "+c+" ) || "+m+" !== "+m+") { var op"+n+" = "+I+" ? '"+O+"' : '"+O+"='; ",i===void 0&&(T=_,f=e.errSchemaPath+"/"+_,c=D,E=P)}else{var U=typeof v=="number",q=O;if(U&&E){var k="'"+q+"'";r+=" if ( ",E&&(r+=" ("+c+" !== undefined && typeof "+c+" != 'number') || "),r+=" ( "+c+" === undefined || "+v+" "+O+"= "+c+" ? "+m+" "+x+"= "+v+" : "+m+" "+x+" "+c+" ) || "+m+" !== "+m+") { "}else{U&&i===void 0?(I=!0,T=_,f=e.errSchemaPath+"/"+_,c=v,x+="="):(U&&(c=Math[y?"min":"max"](v,i)),v===(U?c:!0)?(I=!0,T=_,f=e.errSchemaPath+"/"+_,x+="="):(I=!1,q+="="));var k="'"+q+"'";r+=" if ( ",E&&(r+=" ("+c+" !== undefined && typeof "+c+" != 'number') || "),r+=" "+m+" "+x+" "+c+" || "+m+" !== "+m+") { "}}T=T||t;var F=F||[];F.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(T||"_limit")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { comparison: "+k+", limit: "+c+", exclusive: "+I+" } ",e.opts.messages!==!1&&(r+=" , message: 'should be "+q+" ",E?r+="' + "+c:r+=""+c+"'"),e.opts.verbose&&(r+=" , schema: ",E?r+="validate.schema"+d:r+=""+i,r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var L=r;return r=F.pop(),!e.compositeRule&&p?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+=" } ",p&&(r+=" else { "),r}});var ds=W((nh,Oo)=>{"use strict";Oo.exports=function(e,t,s){var r=" ",n=e.level,l=e.dataLevel,i=e.schema[t],d=e.schemaPath+e.util.getProperty(t),f=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,_,m="data"+(l||""),E=e.opts.$data&&i&&i.$data,c;if(E?(r+=" var schema"+n+" = "+e.util.getData(i.$data,l,e.dataPathArr)+"; ",c="schema"+n):c=i,!(E||typeof i=="number"))throw new Error(t+" must be number");var y=t=="maxItems"?">":"<";r+="if ( ",E&&(r+=" ("+c+" !== undefined && typeof "+c+" != 'number') || "),r+=" "+m+".length "+y+" "+c+") { ";var _=t,v=v||[];v.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(_||"_limitItems")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { limit: "+c+" } ",e.opts.messages!==!1&&(r+=" , message: 'should NOT have ",t=="maxItems"?r+="more":r+="fewer",r+=" than ",E?r+="' + "+c+" + '":r+=""+i,r+=" items' "),e.opts.verbose&&(r+=" , schema: ",E?r+="validate.schema"+d:r+=""+i,r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var P=r;return r=v.pop(),!e.compositeRule&&p?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+="} ",p&&(r+=" else { "),r}});var fs=W((oh,Ao)=>{"use strict";Ao.exports=function(e,t,s){var r=" ",n=e.level,l=e.dataLevel,i=e.schema[t],d=e.schemaPath+e.util.getProperty(t),f=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,_,m="data"+(l||""),E=e.opts.$data&&i&&i.$data,c;if(E?(r+=" var schema"+n+" = "+e.util.getData(i.$data,l,e.dataPathArr)+"; ",c="schema"+n):c=i,!(E||typeof i=="number"))throw new Error(t+" must be number");var y=t=="maxLength"?">":"<";r+="if ( ",E&&(r+=" ("+c+" !== undefined && typeof "+c+" != 'number') || "),e.opts.unicode===!1?r+=" "+m+".length ":r+=" ucs2length("+m+") ",r+=" "+y+" "+c+") { ";var _=t,v=v||[];v.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(_||"_limitLength")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { limit: "+c+" } ",e.opts.messages!==!1&&(r+=" , message: 'should NOT be ",t=="maxLength"?r+="longer":r+="shorter",r+=" than ",E?r+="' + "+c+" + '":r+=""+i,r+=" characters' "),e.opts.verbose&&(r+=" , schema: ",E?r+="validate.schema"+d:r+=""+i,r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var P=r;return r=v.pop(),!e.compositeRule&&p?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+="} ",p&&(r+=" else { "),r}});var ps=W((ih,Do)=>{"use strict";Do.exports=function(e,t,s){var r=" ",n=e.level,l=e.dataLevel,i=e.schema[t],d=e.schemaPath+e.util.getProperty(t),f=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,_,m="data"+(l||""),E=e.opts.$data&&i&&i.$data,c;if(E?(r+=" var schema"+n+" = "+e.util.getData(i.$data,l,e.dataPathArr)+"; ",c="schema"+n):c=i,!(E||typeof i=="number"))throw new Error(t+" must be number");var y=t=="maxProperties"?">":"<";r+="if ( ",E&&(r+=" ("+c+" !== undefined && typeof "+c+" != 'number') || "),r+=" Object.keys("+m+").length "+y+" "+c+") { ";var _=t,v=v||[];v.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(_||"_limitProperties")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { limit: "+c+" } ",e.opts.messages!==!1&&(r+=" , message: 'should NOT have ",t=="maxProperties"?r+="more":r+="fewer",r+=" than ",E?r+="' + "+c+" + '":r+=""+i,r+=" properties' "),e.opts.verbose&&(r+=" , schema: ",E?r+="validate.schema"+d:r+=""+i,r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var P=r;return r=v.pop(),!e.compositeRule&&p?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+="} ",p&&(r+=" else { "),r}});var ko=W((lh,Io)=>{"use strict";Io.exports=function(e,t,s){var r=" ",n=e.level,l=e.dataLevel,i=e.schema[t],d=e.schemaPath+e.util.getProperty(t),f=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,m="data"+(l||""),E=e.opts.$data&&i&&i.$data,c;if(E?(r+=" var schema"+n+" = "+e.util.getData(i.$data,l,e.dataPathArr)+"; ",c="schema"+n):c=i,!(E||typeof i=="number"))throw new Error(t+" must be number");r+="var division"+n+";if (",E&&(r+=" "+c+" !== undefined && ( typeof "+c+" != 'number' || "),r+=" (division"+n+" = "+m+" / "+c+", ",e.opts.multipleOfPrecision?r+=" Math.abs(Math.round(division"+n+") - division"+n+") > 1e-"+e.opts.multipleOfPrecision+" ":r+=" division"+n+" !== parseInt(division"+n+") ",r+=" ) ",E&&(r+=" ) "),r+=" ) { ";var y=y||[];y.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'multipleOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { multipleOf: "+c+" } ",e.opts.messages!==!1&&(r+=" , message: 'should be multiple of ",E?r+="' + "+c:r+=""+c+"'"),e.opts.verbose&&(r+=" , schema: ",E?r+="validate.schema"+d:r+=""+i,r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var _=r;return r=y.pop(),!e.compositeRule&&p?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+="} ",p&&(r+=" else { "),r}});var Co=W((ch,$o)=>{"use strict";$o.exports=function(e,t,s){var r=" ",n=e.level,l=e.dataLevel,i=e.schema[t],d=e.schemaPath+e.util.getProperty(t),f=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,m="data"+(l||""),E="errs__"+n,c=e.util.copy(e);c.level++;var y="valid"+c.level;if(e.opts.strictKeywords?typeof i=="object"&&Object.keys(i).length>0||i===!1:e.util.schemaHasRules(i,e.RULES.all)){c.schema=i,c.schemaPath=d,c.errSchemaPath=f,r+=" var "+E+" = errors; ";var _=e.compositeRule;e.compositeRule=c.compositeRule=!0,c.createErrors=!1;var v;c.opts.allErrors&&(v=c.opts.allErrors,c.opts.allErrors=!1),r+=" "+e.validate(c)+" ",c.createErrors=!0,v&&(c.opts.allErrors=v),e.compositeRule=c.compositeRule=_,r+=" if ("+y+") { ";var P=P||[];P.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'not' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: {} ",e.opts.messages!==!1&&(r+=" , message: 'should NOT be valid' "),e.opts.verbose&&(r+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var O=r;r=P.pop(),!e.compositeRule&&p?e.async?r+=" throw new ValidationError(["+O+"]); ":r+=" validate.errors = ["+O+"]; return false; ":r+=" var err = "+O+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } else { errors = "+E+"; if (vErrors !== null) { if ("+E+") vErrors.length = "+E+"; 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(f)+" , params: {} ",e.opts.messages!==!1&&(r+=" , message: 'should NOT be valid' "),e.opts.verbose&&(r+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",p&&(r+=" if (false) { ");return r}});var jo=W((uh,No)=>{"use strict";No.exports=function(e,t,s){var r=" ",n=e.level,l=e.dataLevel,i=e.schema[t],d=e.schemaPath+e.util.getProperty(t),f=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,m="data"+(l||""),E="valid"+n,c="errs__"+n,y=e.util.copy(e),_="";y.level++;var v="valid"+y.level,P=y.baseId,O="prevValid"+n,x="passingSchemas"+n;r+="var "+c+" = errors , "+O+" = false , "+E+" = false , "+x+" = null; ";var T=e.compositeRule;e.compositeRule=y.compositeRule=!0;var D=i;if(D)for(var I,z=-1,U=D.length-1;z<U;)I=D[z+=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=d+"["+z+"]",y.errSchemaPath=f+"/"+z,r+=" "+e.validate(y)+" ",y.baseId=P):r+=" var "+v+" = true; ",z&&(r+=" if ("+v+" && "+O+") { "+E+" = false; "+x+" = ["+x+", "+z+"]; } else { ",_+="}"),r+=" if ("+v+") { "+E+" = "+O+" = true; "+x+" = "+z+"; }";return e.compositeRule=y.compositeRule=T,r+=""+_+"if (!"+E+") { var err = ",e.createErrors!==!1?(r+=" { keyword: 'oneOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { passingSchemas: "+x+" } ",e.opts.messages!==!1&&(r+=" , message: 'should match exactly one schema in oneOf' "),e.opts.verbose&&(r+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&p&&(e.async?r+=" throw new ValidationError(vErrors); ":r+=" validate.errors = vErrors; return false; "),r+="} else { errors = "+c+"; if (vErrors !== null) { if ("+c+") vErrors.length = "+c+"; else vErrors = null; }",e.opts.allErrors&&(r+=" } "),r}});var Mo=W((dh,Lo)=>{"use strict";Lo.exports=function(e,t,s){var r=" ",n=e.level,l=e.dataLevel,i=e.schema[t],d=e.schemaPath+e.util.getProperty(t),f=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,m="data"+(l||""),E=e.opts.$data&&i&&i.$data,c;E?(r+=" var schema"+n+" = "+e.util.getData(i.$data,l,e.dataPathArr)+"; ",c="schema"+n):c=i;var y=E?"(new RegExp("+c+"))":e.usePattern(i);r+="if ( ",E&&(r+=" ("+c+" !== undefined && typeof "+c+" != 'string') || "),r+=" !"+y+".test("+m+") ) { ";var _=_||[];_.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'pattern' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { pattern: ",E?r+=""+c:r+=""+e.util.toQuotedString(i),r+=" } ",e.opts.messages!==!1&&(r+=` , message: 'should match pattern "`,E?r+="' + "+c+" + '":r+=""+e.util.escapeQuotes(i),r+=`"' `),e.opts.verbose&&(r+=" , schema: ",E?r+="validate.schema"+d:r+=""+e.util.toQuotedString(i),r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var v=r;return r=_.pop(),!e.compositeRule&&p?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+="} ",p&&(r+=" else { "),r}});var Uo=W((fh,Fo)=>{"use strict";Fo.exports=function(e,t,s){var r=" ",n=e.level,l=e.dataLevel,i=e.schema[t],d=e.schemaPath+e.util.getProperty(t),f=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,m="data"+(l||""),E="errs__"+n,c=e.util.copy(e),y="";c.level++;var _="valid"+c.level,v="key"+n,P="idx"+n,O=c.dataLevel=e.dataLevel+1,x="data"+O,T="dataProperties"+n,D=Object.keys(i||{}).filter(re),I=e.schema.patternProperties||{},z=Object.keys(I).filter(re),U=e.schema.additionalProperties,k=D.length||z.length,q=U===!1,F=typeof U=="object"&&Object.keys(U).length,L=e.opts.removeAdditional,A=q||F||L,$=e.opts.ownProperties,M=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(Qe){return Qe!=="__proto__"}if(r+="var "+E+" = errors;var "+_+" = true;",$&&(r+=" var "+T+" = undefined;"),A){if($?r+=" "+T+" = "+T+" || Object.keys("+m+"); for (var "+P+"=0; "+P+"<"+T+".length; "+P+"++) { var "+v+" = "+T+"["+P+"]; ":r+=" for (var "+v+" in "+m+") { ",k){if(r+=" var isAdditional"+n+" = !(false ",D.length)if(D.length>8)r+=" || validate.schema"+d+".hasOwnProperty("+v+") ";else{var G=D;if(G)for(var H,me=-1,Te=G.length-1;me<Te;)H=G[me+=1],r+=" || "+v+" == "+e.util.toQuotedString(H)+" "}if(z.length){var Ae=z;if(Ae)for(var se,_e=-1,Pe=Ae.length-1;_e<Pe;)se=Ae[_e+=1],r+=" || "+e.usePattern(se)+".test("+v+") "}r+=" ); if (isAdditional"+n+") { "}if(L=="all")r+=" delete "+m+"["+v+"]; ";else{var De=e.errorPath,_r="' + "+v+" + '";if(e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(e.errorPath,v,e.opts.jsonPointers)),q)if(L)r+=" delete "+m+"["+v+"]; ";else{r+=" "+_+" = false; ";var ur=f;f=e.errSchemaPath+"/additionalProperties";var Ee=Ee||[];Ee.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'additionalProperties' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { additionalProperty: '"+_r+"' } ",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: "+m+" "),r+=" } "):r+=" {} ";var ve=r;r=Ee.pop(),!e.compositeRule&&p?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++; ",f=ur,p&&(r+=" break; ")}else if(F)if(L=="failing"){r+=" var "+E+" = errors; ";var Or=e.compositeRule;e.compositeRule=c.compositeRule=!0,c.schema=U,c.schemaPath=e.schemaPath+".additionalProperties",c.errSchemaPath=e.errSchemaPath+"/additionalProperties",c.errorPath=e.opts._errorDataPathProperty?e.errorPath:e.util.getPathExpr(e.errorPath,v,e.opts.jsonPointers);var Re=m+"["+v+"]";c.dataPathArr[O]=v;var oe=e.validate(c);c.baseId=M,e.util.varOccurences(oe,x)<2?r+=" "+e.util.varReplace(oe,x,Re)+" ":r+=" var "+x+" = "+Re+"; "+oe+" ",r+=" if (!"+_+") { errors = "+E+"; if (validate.errors !== null) { if (errors) validate.errors.length = errors; else validate.errors = null; } delete "+m+"["+v+"]; } ",e.compositeRule=c.compositeRule=Or}else{c.schema=U,c.schemaPath=e.schemaPath+".additionalProperties",c.errSchemaPath=e.errSchemaPath+"/additionalProperties",c.errorPath=e.opts._errorDataPathProperty?e.errorPath:e.util.getPathExpr(e.errorPath,v,e.opts.jsonPointers);var Re=m+"["+v+"]";c.dataPathArr[O]=v;var oe=e.validate(c);c.baseId=M,e.util.varOccurences(oe,x)<2?r+=" "+e.util.varReplace(oe,x,Re)+" ":r+=" var "+x+" = "+Re+"; "+oe+" ",p&&(r+=" if (!"+_+") break; ")}e.errorPath=De}k&&(r+=" } "),r+=" } ",p&&(r+=" if ("+_+") { ",y+="}")}var Er=e.opts.useDefaults&&!e.compositeRule;if(D.length){var dr=D;if(dr)for(var H,Ar=-1,Dr=dr.length-1;Ar<Dr;){H=dr[Ar+=1];var xe=i[H];if(e.opts.strictKeywords?typeof xe=="object"&&Object.keys(xe).length>0||xe===!1:e.util.schemaHasRules(xe,e.RULES.all)){var qe=e.util.getProperty(H),Re=m+qe,Ce=Er&&xe.default!==void 0;c.schema=xe,c.schemaPath=d+qe,c.errSchemaPath=f+"/"+e.util.escapeFragment(H),c.errorPath=e.util.getPath(e.errorPath,H,e.opts.jsonPointers),c.dataPathArr[O]=e.util.toQuotedString(H);var oe=e.validate(c);if(c.baseId=M,e.util.varOccurences(oe,x)<2){oe=e.util.varReplace(oe,x,Re);var Ie=Re}else{var Ie=x;r+=" var "+x+" = "+Re+"; "}if(Ce)r+=" "+oe+" ";else{if(Y&&Y[H]){r+=" if ( "+Ie+" === undefined ",$&&(r+=" || ! Object.prototype.hasOwnProperty.call("+m+", '"+e.util.escapeQuotes(H)+"') "),r+=") { "+_+" = false; ";var De=e.errorPath,ur=f,tr=e.util.escapeQuotes(H);e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPath(De,H,e.opts.jsonPointers)),f=e.errSchemaPath+"/required";var Ee=Ee||[];Ee.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , 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"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var ve=r;r=Ee.pop(),!e.compositeRule&&p?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++; ",f=ur,e.errorPath=De,r+=" } else { "}else p?(r+=" if ( "+Ie+" === undefined ",$&&(r+=" || ! Object.prototype.hasOwnProperty.call("+m+", '"+e.util.escapeQuotes(H)+"') "),r+=") { "+_+" = true; } else { "):(r+=" if ("+Ie+" !== undefined ",$&&(r+=" && Object.prototype.hasOwnProperty.call("+m+", '"+e.util.escapeQuotes(H)+"') "),r+=" ) { ");r+=" "+oe+" } "}}p&&(r+=" if ("+_+") { ",y+="}")}}if(z.length){var Me=z;if(Me)for(var se,Ct=-1,wa=Me.length-1;Ct<wa;){se=Me[Ct+=1];var xe=I[se];if(e.opts.strictKeywords?typeof xe=="object"&&Object.keys(xe).length>0||xe===!1:e.util.schemaHasRules(xe,e.RULES.all)){c.schema=xe,c.schemaPath=e.schemaPath+".patternProperties"+e.util.getProperty(se),c.errSchemaPath=e.errSchemaPath+"/patternProperties/"+e.util.escapeFragment(se),$?r+=" "+T+" = "+T+" || Object.keys("+m+"); for (var "+P+"=0; "+P+"<"+T+".length; "+P+"++) { var "+v+" = "+T+"["+P+"]; ":r+=" for (var "+v+" in "+m+") { ",r+=" if ("+e.usePattern(se)+".test("+v+")) { ",c.errorPath=e.util.getPathExpr(e.errorPath,v,e.opts.jsonPointers);var Re=m+"["+v+"]";c.dataPathArr[O]=v;var oe=e.validate(c);c.baseId=M,e.util.varOccurences(oe,x)<2?r+=" "+e.util.varReplace(oe,x,Re)+" ":r+=" var "+x+" = "+Re+"; "+oe+" ",p&&(r+=" if (!"+_+") break; "),r+=" } ",p&&(r+=" else "+_+" = true; "),r+=" } ",p&&(r+=" if ("+_+") { ",y+="}")}}}return p&&(r+=" "+y+" if ("+E+" == errors) {"),r}});var Vo=W((ph,qo)=>{"use strict";qo.exports=function(e,t,s){var r=" ",n=e.level,l=e.dataLevel,i=e.schema[t],d=e.schemaPath+e.util.getProperty(t),f=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,m="data"+(l||""),E="errs__"+n,c=e.util.copy(e),y="";c.level++;var _="valid"+c.level;if(r+="var "+E+" = errors;",e.opts.strictKeywords?typeof i=="object"&&Object.keys(i).length>0||i===!1:e.util.schemaHasRules(i,e.RULES.all)){c.schema=i,c.schemaPath=d,c.errSchemaPath=f;var v="key"+n,P="idx"+n,O="i"+n,x="' + "+v+" + '",T=c.dataLevel=e.dataLevel+1,D="data"+T,I="dataProperties"+n,z=e.opts.ownProperties,U=e.baseId;z&&(r+=" var "+I+" = undefined; "),z?r+=" "+I+" = "+I+" || Object.keys("+m+"); for (var "+P+"=0; "+P+"<"+I+".length; "+P+"++) { var "+v+" = "+I+"["+P+"]; ":r+=" for (var "+v+" in "+m+") { ",r+=" var startErrs"+n+" = errors; ";var k=v,q=e.compositeRule;e.compositeRule=c.compositeRule=!0;var F=e.validate(c);c.baseId=U,e.util.varOccurences(F,D)<2?r+=" "+e.util.varReplace(F,D,k)+" ":r+=" var "+D+" = "+k+"; "+F+" ",e.compositeRule=c.compositeRule=q,r+=" if (!"+_+") { for (var "+O+"=startErrs"+n+"; "+O+"<errors; "+O+"++) { vErrors["+O+"].propertyName = "+v+"; } var err = ",e.createErrors!==!1?(r+=" { keyword: 'propertyNames' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { propertyName: '"+x+"' } ",e.opts.messages!==!1&&(r+=" , message: 'property name \\'"+x+"\\' is invalid' "),e.opts.verbose&&(r+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&p&&(e.async?r+=" throw new ValidationError(vErrors); ":r+=" validate.errors = vErrors; return false; "),p&&(r+=" break; "),r+=" } }"}return p&&(r+=" "+y+" if ("+E+" == errors) {"),r}});var Ho=W((hh,zo)=>{"use strict";zo.exports=function(e,t,s){var r=" ",n=e.level,l=e.dataLevel,i=e.schema[t],d=e.schemaPath+e.util.getProperty(t),f=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,m="data"+(l||""),E="valid"+n,c=e.opts.$data&&i&&i.$data,y;c?(r+=" var schema"+n+" = "+e.util.getData(i.$data,l,e.dataPathArr)+"; ",y="schema"+n):y=i;var _="schema"+n;if(!c)if(i.length<e.opts.loopRequired&&e.schema.properties&&Object.keys(e.schema.properties).length){var v=[],P=i;if(P)for(var O,x=-1,T=P.length-1;x<T;){O=P[x+=1];var D=e.schema.properties[O];D&&(e.opts.strictKeywords?typeof D=="object"&&Object.keys(D).length>0||D===!1:e.util.schemaHasRules(D,e.RULES.all))||(v[v.length]=O)}}else var v=i;if(c||v.length){var I=e.errorPath,z=c||v.length>=e.opts.loopRequired,U=e.opts.ownProperties;if(p)if(r+=" var missing"+n+"; ",z){c||(r+=" var "+_+" = validate.schema"+d+"; ");var k="i"+n,q="schema"+n+"["+k+"]",F="' + "+q+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(I,q,e.opts.jsonPointers)),r+=" var "+E+" = true; ",c&&(r+=" if (schema"+n+" === undefined) "+E+" = true; else if (!Array.isArray(schema"+n+")) "+E+" = false; else {"),r+=" for (var "+k+" = 0; "+k+" < "+_+".length; "+k+"++) { "+E+" = "+m+"["+_+"["+k+"]] !== undefined ",U&&(r+=" && Object.prototype.hasOwnProperty.call("+m+", "+_+"["+k+"]) "),r+="; if (!"+E+") break; } ",c&&(r+=" } "),r+=" if (!"+E+") { ";var L=L||[];L.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { missingProperty: '"+F+"' } ",e.opts.messages!==!1&&(r+=" , message: '",e.opts._errorDataPathProperty?r+="is a required property":r+="should have required property \\'"+F+"\\'",r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var A=r;r=L.pop(),!e.compositeRule&&p?e.async?r+=" throw new ValidationError(["+A+"]); ":r+=" validate.errors = ["+A+"]; return false; ":r+=" var err = "+A+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } else { "}else{r+=" if ( ";var $=v;if($)for(var M,k=-1,le=$.length-1;k<le;){M=$[k+=1],k&&(r+=" || ");var Y=e.util.getProperty(M),re=m+Y;r+=" ( ( "+re+" === undefined ",U&&(r+=" || ! Object.prototype.hasOwnProperty.call("+m+", '"+e.util.escapeQuotes(M)+"') "),r+=") && (missing"+n+" = "+e.util.toQuotedString(e.opts.jsonPointers?M:Y)+") ) "}r+=") { ";var q="missing"+n,F="' + "+q+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.opts.jsonPointers?e.util.getPathExpr(I,q,!0):I+" + "+q);var L=L||[];L.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { missingProperty: '"+F+"' } ",e.opts.messages!==!1&&(r+=" , message: '",e.opts._errorDataPathProperty?r+="is a required property":r+="should have required property \\'"+F+"\\'",r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var A=r;r=L.pop(),!e.compositeRule&&p?e.async?r+=" throw new ValidationError(["+A+"]); ":r+=" validate.errors = ["+A+"]; return false; ":r+=" var err = "+A+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } else { "}else if(z){c||(r+=" var "+_+" = validate.schema"+d+"; ");var k="i"+n,q="schema"+n+"["+k+"]",F="' + "+q+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(I,q,e.opts.jsonPointers)),c&&(r+=" if ("+_+" && !Array.isArray("+_+")) { var err = ",e.createErrors!==!1?(r+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { missingProperty: '"+F+"' } ",e.opts.messages!==!1&&(r+=" , message: '",e.opts._errorDataPathProperty?r+="is a required property":r+="should have required property \\'"+F+"\\'",r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } else if ("+_+" !== undefined) { "),r+=" for (var "+k+" = 0; "+k+" < "+_+".length; "+k+"++) { if ("+m+"["+_+"["+k+"]] === undefined ",U&&(r+=" || ! Object.prototype.hasOwnProperty.call("+m+", "+_+"["+k+"]) "),r+=") { var err = ",e.createErrors!==!1?(r+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { missingProperty: '"+F+"' } ",e.opts.messages!==!1&&(r+=" , message: '",e.opts._errorDataPathProperty?r+="is a required property":r+="should have required property \\'"+F+"\\'",r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } } ",c&&(r+=" } ")}else{var G=v;if(G)for(var M,H=-1,me=G.length-1;H<me;){M=G[H+=1];var Y=e.util.getProperty(M),F=e.util.escapeQuotes(M),re=m+Y;e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPath(I,M,e.opts.jsonPointers)),r+=" if ( "+re+" === undefined ",U&&(r+=" || ! Object.prototype.hasOwnProperty.call("+m+", '"+e.util.escapeQuotes(M)+"') "),r+=") { var err = ",e.createErrors!==!1?(r+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { missingProperty: '"+F+"' } ",e.opts.messages!==!1&&(r+=" , message: '",e.opts._errorDataPathProperty?r+="is a required property":r+="should have required property \\'"+F+"\\'",r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } "}}e.errorPath=I}else p&&(r+=" if (true) {");return r}});var Bo=W((mh,Zo)=>{"use strict";Zo.exports=function(e,t,s){var r=" ",n=e.level,l=e.dataLevel,i=e.schema[t],d=e.schemaPath+e.util.getProperty(t),f=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,m="data"+(l||""),E="valid"+n,c=e.opts.$data&&i&&i.$data,y;if(c?(r+=" var schema"+n+" = "+e.util.getData(i.$data,l,e.dataPathArr)+"; ",y="schema"+n):y=i,(i||c)&&e.opts.uniqueItems!==!1){c&&(r+=" var "+E+"; if ("+y+" === false || "+y+" === undefined) "+E+" = true; else if (typeof "+y+" != 'boolean') "+E+" = false; else { "),r+=" var i = "+m+".length , "+E+" = true , j; if (i > 1) { ";var _=e.schema.items&&e.schema.items.type,v=Array.isArray(_);if(!_||_=="object"||_=="array"||v&&(_.indexOf("object")>=0||_.indexOf("array")>=0))r+=" outer: for (;i--;) { for (j = i; j--;) { if (equal("+m+"[i], "+m+"[j])) { "+E+" = false; break outer; } } } ";else{r+=" var itemIndices = {}, item; for (;i--;) { var item = "+m+"[i]; ";var P="checkDataType"+(v?"s":"");r+=" if ("+e.util[P](_,"item",e.opts.strictNumbers,!0)+") continue; ",v&&(r+=` if (typeof item == 'string') item = '"' + item; `),r+=" if (typeof itemIndices[item] == 'number') { "+E+" = false; j = itemIndices[item]; break; } itemIndices[item] = i; } "}r+=" } ",c&&(r+=" } "),r+=" if (!"+E+") { ";var O=O||[];O.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'uniqueItems' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , 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: ",c?r+="validate.schema"+d:r+=""+i,r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var x=r;r=O.pop(),!e.compositeRule&&p?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+=" } ",p&&(r+=" else { ")}else p&&(r+=" if (true) { ");return r}});var Ko=W((vh,Wo)=>{"use strict";Wo.exports={$ref:no(),allOf:io(),anyOf:co(),$comment:fo(),const:ho(),contains:vo(),dependencies:yo(),enum:Eo(),format:bo(),if:xo(),items:To(),maximum:us(),minimum:us(),maxItems:ds(),minItems:ds(),maxLength:fs(),minLength:fs(),maxProperties:ps(),minProperties:ps(),multipleOf:ko(),not:Co(),oneOf:jo(),pattern:Mo(),properties:Uo(),propertyNames:Vo(),required:Ho(),uniqueItems:Bo(),validate:ls()}});var Go=W((gh,Jo)=>{"use strict";var Qo=Ko(),hs=Jr().toHash;Jo.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=hs(t),e.types=hs(r),e.forEach(function(n){n.rules=n.rules.map(function(l){var i;if(typeof l=="object"){var d=Object.keys(l)[0];i=l[d],l=d,i.forEach(function(p){t.push(p),e.all[p]=!0})}t.push(l);var f=e.all[l]={keyword:l,code:Qo[l],implements:i};return f}),e.all.$comment={keyword:"$comment",code:Qo.$comment},n.type&&(e.types[n.type]=n)}),e.keywords=hs(t.concat(s)),e.custom={},e}});var ei=W((yh,Xo)=>{"use strict";var Yo=["multipleOf","maximum","exclusiveMaximum","minimum","exclusiveMinimum","maxLength","minLength","pattern","additionalItems","maxItems","minItems","uniqueItems","maxProperties","minProperties","required","additionalProperties","enum","format","const"];Xo.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<Yo.length;n++){var l=Yo[n],i=r[l];i&&(r[l]={anyOf:[i,{$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"}]})}}return a}});var ai=W((_h,ti)=>{"use strict";var qd=ia().MissingRef;ti.exports=ri;function ri(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||l(i)});return t&&r.then(function(i){t(null,i)},t),r;function n(i){var d=i.$schema;return d&&!s.getSchema(d)?ri.call(s,{$ref:d},!0):Promise.resolve()}function l(i){try{return s._compile(i)}catch(f){if(f instanceof qd)return d(f);throw f}function d(f){var p=f.missingSchema;if(c(p))throw new Error("Schema "+p+" is loaded but "+f.missingRef+" cannot be resolved");var m=s._loadingSchemas[p];return m||(m=s._loadingSchemas[p]=s._opts.loadSchema(p),m.then(E,E)),m.then(function(y){if(!c(p))return n(y).then(function(){c(p)||s.addSchema(y,p,void 0,e)})}).then(function(){return l(i)});function E(){delete s._loadingSchemas[p]}function c(y){return s._refs[y]||s._schemas[y]}}}}});var ni=W((Eh,si)=>{"use strict";si.exports=function(e,t,s){var r=" ",n=e.level,l=e.dataLevel,i=e.schema[t],d=e.schemaPath+e.util.getProperty(t),f=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,m,E="data"+(l||""),c="valid"+n,y="errs__"+n,_=e.opts.$data&&i&&i.$data,v;_?(r+=" var schema"+n+" = "+e.util.getData(i.$data,l,e.dataPathArr)+"; ",v="schema"+n):v=i;var P=this,O="definition"+n,x=P.definition,T="",D,I,z,U,k;if(_&&x.$data){k="keywordValidate"+n;var q=x.validateSchema;r+=" var "+O+" = RULES.custom['"+t+"'].definition; var "+k+" = "+O+".validate;"}else{if(U=e.useCustomRule(P,i,e.schema,e),!U)return;v="validate.schema"+d,k=U.code,D=x.compile,I=x.inline,z=x.macro}var F=k+".errors",L="i"+n,A="ruleErr"+n,$=x.async;if($&&!e.async)throw new Error("async keyword in sync schema");if(I||z||(r+=""+F+" = null;"),r+="var "+y+" = errors;var "+c+";",_&&x.$data&&(T+="}",r+=" if ("+v+" === undefined) { "+c+" = true; } else { ",q&&(T+="}",r+=" "+c+" = "+O+".validateSchema("+v+"); if ("+c+") { ")),I)x.statements?r+=" "+U.validate+" ":r+=" "+c+" = "+U.validate+"; ";else if(z){var M=e.util.copy(e),T="";M.level++;var le="valid"+M.level;M.schema=U.validate,M.schemaPath="";var Y=e.compositeRule;e.compositeRule=M.compositeRule=!0;var re=e.validate(M).replace(/validate\.schema/g,k);e.compositeRule=M.compositeRule=Y,r+=" "+re}else{var G=G||[];G.push(r),r="",r+=" "+k+".call( ",e.opts.passContext?r+="this":r+="self",D||x.schema===!1?r+=" , "+E+" ":r+=" , "+v+" , "+E+" , validate.schema"+e.schemaPath+" ",r+=" , (dataPath || '')",e.errorPath!='""'&&(r+=" + "+e.errorPath);var H=l?"data"+(l-1||""):"parentData",me=l?e.dataPathArr[l]:"parentDataProperty";r+=" , "+H+" , "+me+" , rootData ) ";var Te=r;r=G.pop(),x.errors===!1?(r+=" "+c+" = ",$&&(r+="await "),r+=""+Te+"; "):$?(F="customErrors"+n,r+=" var "+F+" = null; try { "+c+" = await "+Te+"; } catch (e) { "+c+" = false; if (e instanceof ValidationError) "+F+" = e.errors; else throw e; } "):r+=" "+F+" = null; "+c+" = "+Te+"; "}if(x.modifying&&(r+=" if ("+H+") "+E+" = "+H+"["+me+"];"),r+=""+T,x.valid)p&&(r+=" if (true) { ");else{r+=" if ( ",x.valid===void 0?(r+=" !",z?r+=""+le:r+=""+c):r+=" "+!x.valid+" ",r+=") { ",m=P.keyword;var G=G||[];G.push(r),r="";var G=G||[];G.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(m||"custom")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { keyword: '"+P.keyword+"' } ",e.opts.messages!==!1&&(r+=` , message: 'should pass "`+P.keyword+`" keyword validation' `),e.opts.verbose&&(r+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+E+" "),r+=" } "):r+=" {} ";var Ae=r;r=G.pop(),!e.compositeRule&&p?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=G.pop(),I?x.errors?x.errors!="full"&&(r+=" for (var "+L+"="+y+"; "+L+"<errors; "+L+"++) { var "+A+" = vErrors["+L+"]; if ("+A+".dataPath === undefined) "+A+".dataPath = (dataPath || '') + "+e.errorPath+"; if ("+A+".schemaPath === undefined) { "+A+'.schemaPath = "'+f+'"; } ',e.opts.verbose&&(r+=" "+A+".schema = "+v+"; "+A+".data = "+E+"; "),r+=" } "):x.errors===!1?r+=" "+se+" ":(r+=" if ("+y+" == errors) { "+se+" } else { for (var "+L+"="+y+"; "+L+"<errors; "+L+"++) { var "+A+" = vErrors["+L+"]; if ("+A+".dataPath === undefined) "+A+".dataPath = (dataPath || '') + "+e.errorPath+"; if ("+A+".schemaPath === undefined) { "+A+'.schemaPath = "'+f+'"; } ',e.opts.verbose&&(r+=" "+A+".schema = "+v+"; "+A+".data = "+E+"; "),r+=" } } "):z?(r+=" var err = ",e.createErrors!==!1?(r+=" { keyword: '"+(m||"custom")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { keyword: '"+P.keyword+"' } ",e.opts.messages!==!1&&(r+=` , message: 'should pass "`+P.keyword+`" keyword validation' `),e.opts.verbose&&(r+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+E+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&p&&(e.async?r+=" throw new ValidationError(vErrors); ":r+=" validate.errors = vErrors; return false; ")):x.errors===!1?r+=" "+se+" ":(r+=" if (Array.isArray("+F+")) { if (vErrors === null) vErrors = "+F+"; else vErrors = vErrors.concat("+F+"); errors = vErrors.length; for (var "+L+"="+y+"; "+L+"<errors; "+L+"++) { var "+A+" = vErrors["+L+"]; if ("+A+".dataPath === undefined) "+A+".dataPath = (dataPath || '') + "+e.errorPath+"; "+A+'.schemaPath = "'+f+'"; ',e.opts.verbose&&(r+=" "+A+".schema = "+v+"; "+A+".data = "+E+"; "),r+=" } } else { "+se+" } "),r+=" } ",p&&(r+=" else { ")}return r}});var ms=W((Sh,Vd)=>{Vd.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 li=W((bh,ii)=>{"use strict";var oi=ms();ii.exports={$id:"https://github.com/ajv-validator/ajv/blob/master/lib/definition_schema.js",definitions:{simpleTypes:oi.definitions.simpleTypes},type:"object",dependencies:{schema:["validate"],$data:["validate"],statements:["inline"],valid:{not:{required:["macro"]}}},properties:{type:oi.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 ui=W((Ph,ci)=>{"use strict";var zd=/^[a-z_$][a-z0-9_$-]*$/i,Hd=ni(),Zd=li();ci.exports={add:Bd,get:Wd,remove:Kd,validate:vs};function Bd(a,e){var t=this.RULES;if(t.keywords[a])throw new Error("Keyword "+a+" is already defined");if(!zd.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++)l(a,s[r],e);else l(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 l(i,d,f){for(var p,m=0;m<t.length;m++){var E=t[m];if(E.type==d){p=E;break}}p||(p={type:d,rules:[]},t.push(p));var c={keyword:i,definition:f,custom:!0,code:Hd,implements:f.implements};p.rules.push(c),t.custom[i]=c}return this}function Wd(a){var e=this.RULES.custom[a];return e?e.definition:this.RULES.keywords[a]||!1}function Kd(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 vs(a,e){vs.errors=null;var t=this._validateKeyword=this._validateKeyword||this.compile(Zd,!0);if(t(a))return!0;if(vs.errors=t.errors,e)throw new Error("custom keyword definition is invalid: "+this.errorsText(t.errors));return!1}});var di=W((xh,Qd)=>{Qd.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 Si=W((wh,Ei)=>{"use strict";var pi=zn(),Gr=oa(),Jd=Zn(),hi=rs(),Gd=is(),Yd=ao(),Xd=Go(),mi=ei(),vi=Jr();Ei.exports=ge;ge.prototype.validate=rf;ge.prototype.compile=tf;ge.prototype.addSchema=af;ge.prototype.addMetaSchema=sf;ge.prototype.validateSchema=nf;ge.prototype.getSchema=lf;ge.prototype.removeSchema=uf;ge.prototype.addFormat=yf;ge.prototype.errorsText=gf;ge.prototype._addSchema=df;ge.prototype._compile=ff;ge.prototype.compileAsync=ai();var ma=ui();ge.prototype.addKeyword=ma.add;ge.prototype.getKeyword=ma.get;ge.prototype.removeKeyword=ma.remove;ge.prototype.validateKeyword=ma.validate;var gi=ia();ge.ValidationError=gi.Validation;ge.MissingRefError=gi.MissingRef;ge.$dataMetaSchema=mi;var ha="http://json-schema.org/draft-07/schema",fi=["removeAdditional","useDefaults","coerceTypes","strictDefaults"],ef=["/properties"];function ge(a){if(!(this instanceof ge))return new ge(a);a=this._opts=vi.copy(a)||{},xf(this),this._schemas={},this._refs={},this._fragments={},this._formats=Yd(a.format),this._cache=a.cache||new Jd,this._loadingSchemas={},this._compilations=[],this.RULES=Xd(),this._getId=pf(a),a.loopRequired=a.loopRequired||1/0,a.errorDataPath=="property"&&(a._errorDataPathProperty=!0),a.serialize===void 0&&(a.serialize=Gd),this._metaOpts=Pf(this),a.formats&&Sf(this),a.keywords&&bf(this),_f(this),typeof a.meta=="object"&&this.addMetaSchema(a.meta),a.nullable&&this.addKeyword("nullable",{metaSchema:{type:"boolean"}}),Ef(this)}function rf(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 tf(a,e){var t=this._addSchema(a,void 0,e);return t.validate||this._compile(t)}function af(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=Gr.normalizeId(e||n),_i(this,e),this._schemas[e]=this._addSchema(a,t,s,!0),this}function sf(a,e,t){return this.addSchema(a,e,t,!0),this}function nf(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||of(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 of(a){var e=a._opts.meta;return a._opts.defaultMeta=typeof e=="object"?a._getId(e)||e:a.getSchema(ha)?ha:void 0,a._opts.defaultMeta}function lf(a){var e=yi(this,a);switch(typeof e){case"object":return e.validate||this._compile(e);case"string":return this.getSchema(e);case"undefined":return cf(this,a)}}function cf(a,e){var t=Gr.schema.call(a,{schema:{}},e);if(t){var s=t.schema,r=t.root,n=t.baseId,l=pi.call(a,s,r,void 0,n);return a._fragments[e]=new hi({ref:e,fragment:!0,schema:s,root:r,baseId:n,validate:l}),l}}function yi(a,e){return e=Gr.normalizeId(e),a._schemas[e]||a._refs[e]||a._fragments[e]}function uf(a){if(a instanceof RegExp)return pa(this,this._schemas,a),pa(this,this._refs,a),this;switch(typeof a){case"undefined":return pa(this,this._schemas),pa(this,this._refs),this._cache.clear(),this;case"string":var e=yi(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=Gr.normalizeId(r),delete this._schemas[r],delete this._refs[r])}return this}function pa(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 df(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,l=this._cache.get(n);if(l)return l;s=s||this._opts.addUsedSchema!==!1;var i=Gr.normalizeId(this._getId(a));i&&s&&_i(this,i);var d=this._opts.validateSchema!==!1&&!e,f;d&&!(f=i&&i==Gr.normalizeId(a.$schema))&&this.validateSchema(a,!0);var p=Gr.ids.call(this,a),m=new hi({id:i,schema:a,localRefs:p,cacheKey:n,meta:t});return i[0]!="#"&&s&&(this._refs[i]=m),this._cache.put(n,m),d&&f&&this.validateSchema(a,!0),m}function ff(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=pi.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,l=n.apply(this,arguments);return r.errors=n.errors,l}}function pf(a){switch(a.schemaId){case"auto":return vf;case"id":return hf;default:return mf}}function hf(a){return a.$id&&this.logger.warn("schema $id ignored",a.$id),a.id}function mf(a){return a.id&&this.logger.warn("schema id ignored",a.id),a.$id}function vf(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 gf(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 l=a[n];l&&(r+=s+l.dataPath+" "+l.message+t)}return r.slice(0,-t.length)}function yf(a,e){return typeof e=="string"&&(e=new RegExp(e)),this._formats[a]=e,this}function _f(a){var e;if(a._opts.$data&&(e=di(),a.addMetaSchema(e,e.$id,!0)),a._opts.meta!==!1){var t=ms();a._opts.$data&&(t=mi(t,ef)),a.addMetaSchema(t,ha,!0),a._refs["http://json-schema.org/schema"]=ha}}function Ef(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 Sf(a){for(var e in a._opts.formats){var t=a._opts.formats[e];a.addFormat(e,t)}}function bf(a){for(var e in a._opts.keywords){var t=a._opts.keywords[e];a.addKeyword(e,t)}}function _i(a,e){if(a._schemas[e]||a._refs[e])throw new Error('schema with key or id "'+e+'" already exists')}function Pf(a){for(var e=vi.copy(a._opts),t=0;t<fi.length;t++)delete e[fi[t]];return e}function xf(a){var e=a._opts.logger;if(e===!1)a.logger={log:gs,warn:gs,error:gs};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 gs(){}});var o={};Ml(o,{BRAND:()=>dc,DIRTY:()=>Cr,EMPTY_PATH:()=>zl,INVALID:()=>Z,NEVER:()=>Qc,OK:()=>Oe,ParseStatus:()=>we,Schema:()=>J,ZodAny:()=>Pr,ZodArray:()=>yr,ZodBigInt:()=>jr,ZodBoolean:()=>Lr,ZodBranded:()=>xt,ZodCatch:()=>Kr,ZodDate:()=>Mr,ZodDefault:()=>Wr,ZodDiscriminatedUnion:()=>Ut,ZodEffects:()=>Be,ZodEnum:()=>Zr,ZodError:()=>Ne,ZodFirstPartyTypeKind:()=>R,ZodFunction:()=>Vt,ZodIntersection:()=>Vr,ZodIssueCode:()=>w,ZodLazy:()=>zr,ZodLiteral:()=>Hr,ZodMap:()=>ut,ZodNaN:()=>ft,ZodNativeEnum:()=>Br,ZodNever:()=>Je,ZodNull:()=>Ur,ZodNullable:()=>ir,ZodNumber:()=>Nr,ZodObject:()=>je,ZodOptional:()=>He,ZodParsedType:()=>N,ZodPipeline:()=>wt,ZodPromise:()=>xr,ZodReadonly:()=>Qr,ZodRecord:()=>qt,ZodSchema:()=>J,ZodSet:()=>dt,ZodString:()=>br,ZodSymbol:()=>lt,ZodTransformer:()=>Be,ZodTuple:()=>or,ZodType:()=>J,ZodUndefined:()=>Fr,ZodUnion:()=>qr,ZodUnknown:()=>gr,ZodVoid:()=>ct,addIssueToContext:()=>C,any:()=>Ec,array:()=>xc,bigint:()=>mc,boolean:()=>Xs,coerce:()=>Kc,custom:()=>Js,date:()=>vc,datetimeRegex:()=>Ks,defaultErrorMap:()=>mr,discriminatedUnion:()=>Oc,effect:()=>Uc,enum:()=>Lc,function:()=>Cc,getErrorMap:()=>nt,getParsedType:()=>nr,instanceof:()=>pc,intersection:()=>Ac,isAborted:()=>Mt,isAsync:()=>ot,isDirty:()=>Ft,isValid:()=>Sr,late:()=>fc,lazy:()=>Nc,literal:()=>jc,makeIssue:()=>Pt,map:()=>kc,nan:()=>hc,nativeEnum:()=>Mc,never:()=>bc,null:()=>_c,nullable:()=>Vc,number:()=>Ys,object:()=>wc,objectUtil:()=>Ia,oboolean:()=>Wc,onumber:()=>Bc,optional:()=>qc,ostring:()=>Zc,pipeline:()=>Hc,preprocess:()=>zc,promise:()=>Fc,quotelessJson:()=>Ul,record:()=>Ic,set:()=>$c,setErrorMap:()=>Vl,strictObject:()=>Tc,string:()=>Gs,symbol:()=>gc,transformer:()=>Uc,tuple:()=>Dc,undefined:()=>yc,union:()=>Rc,unknown:()=>Sc,util:()=>X,void:()=>Pc});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 l of r)n[l]=l;return n},a.getValidEnumValues=r=>{let n=a.objectKeys(r).filter(i=>typeof r[r[i]]!="number"),l={};for(let i of n)l[i]=r[i];return a.objectValues(l)},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 l in r)Object.prototype.hasOwnProperty.call(r,l)&&n.push(l);return n},a.find=(r,n)=>{for(let l of r)if(n(l))return l},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(l=>typeof l=="string"?`'${l}'`:l).join(n)}a.joinValues=s,a.jsonStringifyReplacer=(r,n)=>typeof n=="bigint"?n.toString():n})(X||(X={}));var Ia;(function(a){a.mergeShapes=(e,t)=>({...e,...t})})(Ia||(Ia={}));var N=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 N.undefined;case"string":return N.string;case"number":return Number.isNaN(a)?N.nan:N.number;case"boolean":return N.boolean;case"function":return N.function;case"bigint":return N.bigint;case"symbol":return N.symbol;case"object":return Array.isArray(a)?N.array:a===null?N.null:a.then&&typeof a.then=="function"&&a.catch&&typeof a.catch=="function"?N.promise:typeof Map<"u"&&a instanceof Map?N.map:typeof Set<"u"&&a instanceof Set?N.set:typeof Date<"u"&&a instanceof Date?N.date:N.object;default:return N.unknown}};var w=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"]),Ul=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 l of n.issues)if(l.code==="invalid_union")l.unionErrors.map(r);else if(l.code==="invalid_return_type")r(l.returnTypeError);else if(l.code==="invalid_arguments")r(l.argumentsError);else if(l.path.length===0)s._errors.push(t(l));else{let i=s,d=0;for(;d<l.path.length;){let f=l.path[d];d===l.path.length-1?(i[f]=i[f]||{_errors:[]},i[f]._errors.push(t(l))):i[f]=i[f]||{_errors:[]},i=i[f],d++}}};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 ql=(a,e)=>{let t;switch(a.code){case w.invalid_type:a.received===N.undefined?t="Required":t=`Expected ${a.expected}, received ${a.received}`;break;case w.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(a.expected,X.jsonStringifyReplacer)}`;break;case w.unrecognized_keys:t=`Unrecognized key(s) in object: ${X.joinValues(a.keys,", ")}`;break;case w.invalid_union:t="Invalid input";break;case w.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${X.joinValues(a.options)}`;break;case w.invalid_enum_value:t=`Invalid enum value. Expected ${X.joinValues(a.options)}, received '${a.received}'`;break;case w.invalid_arguments:t="Invalid function arguments";break;case w.invalid_return_type:t="Invalid function return type";break;case w.invalid_date:t="Invalid date";break;case w.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 w.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 w.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 w.custom:t="Invalid input";break;case w.invalid_intersection_types:t="Intersection results could not be merged";break;case w.not_multiple_of:t=`Number must be a multiple of ${a.multipleOf}`;break;case w.not_finite:t="Number must be finite";break;default:t=e.defaultError,X.assertNever(a)}return{message:t}},mr=ql;var zs=mr;function Vl(a){zs=a}function nt(){return zs}var Pt=a=>{let{data:e,path:t,errorMaps:s,issueData:r}=a,n=[...t,...r.path||[]],l={...r,path:n};if(r.message!==void 0)return{...r,path:n,message:r.message};let i="",d=s.filter(f=>!!f).slice().reverse();for(let f of d)i=f(l,{data:e,defaultError:i}).message;return{...r,path:n,message:i}},zl=[];function C(a,e){let t=nt(),s=Pt({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 we=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 Z;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,l=await r.value;s.push({key:n,value:l})}return a.mergeObjectSync(e,s)}static mergeObjectSync(e,t){let s={};for(let r of t){let{key:n,value:l}=r;if(n.status==="aborted"||l.status==="aborted")return Z;n.status==="dirty"&&e.dirty(),l.status==="dirty"&&e.dirty(),n.value!=="__proto__"&&(typeof l.value<"u"||r.alwaysSet)&&(s[n.value]=l.value)}return{status:e.value,value:s}}},Z=Object.freeze({status:"aborted"}),Cr=a=>({status:"dirty",value:a}),Oe=a=>({status:"valid",value:a}),Mt=a=>a.status==="aborted",Ft=a=>a.status==="dirty",Sr=a=>a.status==="valid",ot=a=>typeof Promise<"u"&&a instanceof Promise;var V;(function(a){a.errToObj=e=>typeof e=="string"?{message:e}:e||{},a.toString=e=>typeof e=="string"?e:e?.message})(V||(V={}));var Ze=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}},Hs=(a,e)=>{if(Sr(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 K(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:(l,i)=>{let{message:d}=a;return l.code==="invalid_enum_value"?{message:d??i.defaultError}:typeof i.data>"u"?{message:d??s??i.defaultError}:l.code!=="invalid_type"?{message:i.defaultError}:{message:d??t??i.defaultError}},description:r}}var J=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 we,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(ot(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){let s={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:nr(e)},r=this._parseSync({data:e,path:s.path,parent:s});return Hs(s,r)}"~validate"(e){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 s=this._parseSync({data:e,path:[],parent:t});return Sr(s)?{value:s.value}:{issues:t.common.issues}}catch(s){s?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(s=>Sr(s)?{value:s.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?.errorMap,async:!0},path: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(ot(r)?r:Promise.resolve(r));return Hs(s,n)}refine(e,t){let s=r=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(r):t;return this._refinement((r,n)=>{let l=e(r),i=()=>n.addIssue({code:w.custom,...s(r)});return typeof Promise<"u"&&l instanceof Promise?l.then(d=>d?!0:(i(),!1)):l?!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 Be({schema:this,typeName:R.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 He.create(this,this._def)}nullable(){return ir.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return yr.create(this)}promise(){return xr.create(this,this._def)}or(e){return qr.create([this,e],this._def)}and(e){return Vr.create(this,e,this._def)}transform(e){return new Be({...K(this._def),schema:this,typeName:R.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let t=typeof e=="function"?e:()=>e;return new Wr({...K(this._def),innerType:this,defaultValue:t,typeName:R.ZodDefault})}brand(){return new xt({typeName:R.ZodBranded,type:this,...K(this._def)})}catch(e){let t=typeof e=="function"?e:()=>e;return new Kr({...K(this._def),innerType:this,catchValue:t,typeName:R.ZodCatch})}describe(e){let t=this.constructor;return new t({...this._def,description:e})}pipe(e){return wt.create(this,e)}readonly(){return Qr.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},Hl=/^c[^\s-]{8,}$/i,Zl=/^[0-9a-z]+$/,Bl=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Wl=/^[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,Kl=/^[a-z0-9_-]{21}$/i,Ql=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Jl=/^[-+]?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)?)??$/,Gl=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Yl="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",ka,Xl=/^(?:(?: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])$/,ec=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,rc=/^(([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]))$/,tc=/^(([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])$/,ac=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,sc=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Bs="((\\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])))",nc=new RegExp(`^${Bs}$`);function Ws(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 oc(a){return new RegExp(`^${Ws(a)}$`)}function Ks(a){let e=`${Bs}T${Ws(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 ic(a,e){return!!((e==="v4"||!e)&&Xl.test(a)||(e==="v6"||!e)&&rc.test(a))}function lc(a,e){if(!Ql.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?.typ!=="JWT"||!r.alg||e&&r.alg!==e)}catch{return!1}}function cc(a,e){return!!((e==="v4"||!e)&&ec.test(a)||(e==="v6"||!e)&&tc.test(a))}var br=class a extends J{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==N.string){let n=this._getOrReturnCtx(e);return C(n,{code:w.invalid_type,expected:N.string,received:n.parsedType}),Z}let s=new we,r;for(let n of this._def.checks)if(n.kind==="min")e.data.length<n.value&&(r=this._getOrReturnCtx(e,r),C(r,{code:w.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),C(r,{code:w.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!1,message:n.message}),s.dirty());else if(n.kind==="length"){let l=e.data.length>n.value,i=e.data.length<n.value;(l||i)&&(r=this._getOrReturnCtx(e,r),l?C(r,{code:w.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message}):i&&C(r,{code:w.too_small,minimum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message}),s.dirty())}else if(n.kind==="email")Gl.test(e.data)||(r=this._getOrReturnCtx(e,r),C(r,{validation:"email",code:w.invalid_string,message:n.message}),s.dirty());else if(n.kind==="emoji")ka||(ka=new RegExp(Yl,"u")),ka.test(e.data)||(r=this._getOrReturnCtx(e,r),C(r,{validation:"emoji",code:w.invalid_string,message:n.message}),s.dirty());else if(n.kind==="uuid")Wl.test(e.data)||(r=this._getOrReturnCtx(e,r),C(r,{validation:"uuid",code:w.invalid_string,message:n.message}),s.dirty());else if(n.kind==="nanoid")Kl.test(e.data)||(r=this._getOrReturnCtx(e,r),C(r,{validation:"nanoid",code:w.invalid_string,message:n.message}),s.dirty());else if(n.kind==="cuid")Hl.test(e.data)||(r=this._getOrReturnCtx(e,r),C(r,{validation:"cuid",code:w.invalid_string,message:n.message}),s.dirty());else if(n.kind==="cuid2")Zl.test(e.data)||(r=this._getOrReturnCtx(e,r),C(r,{validation:"cuid2",code:w.invalid_string,message:n.message}),s.dirty());else if(n.kind==="ulid")Bl.test(e.data)||(r=this._getOrReturnCtx(e,r),C(r,{validation:"ulid",code:w.invalid_string,message:n.message}),s.dirty());else if(n.kind==="url")try{new URL(e.data)}catch{r=this._getOrReturnCtx(e,r),C(r,{validation:"url",code:w.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),C(r,{validation:"regex",code:w.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),C(r,{code:w.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),C(r,{code:w.invalid_string,validation:{startsWith:n.value},message:n.message}),s.dirty()):n.kind==="endsWith"?e.data.endsWith(n.value)||(r=this._getOrReturnCtx(e,r),C(r,{code:w.invalid_string,validation:{endsWith:n.value},message:n.message}),s.dirty()):n.kind==="datetime"?Ks(n).test(e.data)||(r=this._getOrReturnCtx(e,r),C(r,{code:w.invalid_string,validation:"datetime",message:n.message}),s.dirty()):n.kind==="date"?nc.test(e.data)||(r=this._getOrReturnCtx(e,r),C(r,{code:w.invalid_string,validation:"date",message:n.message}),s.dirty()):n.kind==="time"?oc(n).test(e.data)||(r=this._getOrReturnCtx(e,r),C(r,{code:w.invalid_string,validation:"time",message:n.message}),s.dirty()):n.kind==="duration"?Jl.test(e.data)||(r=this._getOrReturnCtx(e,r),C(r,{validation:"duration",code:w.invalid_string,message:n.message}),s.dirty()):n.kind==="ip"?ic(e.data,n.version)||(r=this._getOrReturnCtx(e,r),C(r,{validation:"ip",code:w.invalid_string,message:n.message}),s.dirty()):n.kind==="jwt"?lc(e.data,n.alg)||(r=this._getOrReturnCtx(e,r),C(r,{validation:"jwt",code:w.invalid_string,message:n.message}),s.dirty()):n.kind==="cidr"?cc(e.data,n.version)||(r=this._getOrReturnCtx(e,r),C(r,{validation:"cidr",code:w.invalid_string,message:n.message}),s.dirty()):n.kind==="base64"?ac.test(e.data)||(r=this._getOrReturnCtx(e,r),C(r,{validation:"base64",code:w.invalid_string,message:n.message}),s.dirty()):n.kind==="base64url"?sc.test(e.data)||(r=this._getOrReturnCtx(e,r),C(r,{validation:"base64url",code:w.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:w.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){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...V.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...V.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...V.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...V.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...V.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...V.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...V.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...V.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...V.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...V.errToObj(t)})}nonempty(e){return this.min(1,V.errToObj(e))}trim(){return new 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}};br.create=a=>new br({checks:[],typeName:R.ZodString,coerce:a?.coerce??!1,...K(a)});function uc(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(".","")),l=Number.parseInt(e.toFixed(r).replace(".",""));return n%l/10**r}var Nr=class a extends J{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==N.number){let n=this._getOrReturnCtx(e);return C(n,{code:w.invalid_type,expected:N.number,received:n.parsedType}),Z}let s,r=new we;for(let n of this._def.checks)n.kind==="int"?X.isInteger(e.data)||(s=this._getOrReturnCtx(e,s),C(s,{code:w.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),C(s,{code:w.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),C(s,{code:w.too_big,maximum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),r.dirty()):n.kind==="multipleOf"?uc(e.data,n.value)!==0&&(s=this._getOrReturnCtx(e,s),C(s,{code:w.not_multiple_of,multipleOf:n.value,message:n.message}),r.dirty()):n.kind==="finite"?Number.isFinite(e.data)||(s=this._getOrReturnCtx(e,s),C(s,{code:w.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)}};Nr.create=a=>new Nr({checks:[],typeName:R.ZodNumber,coerce:a?.coerce||!1,...K(a)});var jr=class a extends J{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==N.bigint)return this._getInvalidInput(e);let s,r=new we;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),C(s,{code:w.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),C(s,{code:w.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),C(s,{code:w.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 C(t,{code:w.invalid_type,expected:N.bigint,received:t.parsedType}),Z}gte(e,t){return this.setLimit("min",e,!0,V.toString(t))}gt(e,t){return this.setLimit("min",e,!1,V.toString(t))}lte(e,t){return this.setLimit("max",e,!0,V.toString(t))}lt(e,t){return this.setLimit("max",e,!1,V.toString(t))}setLimit(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}};jr.create=a=>new jr({checks:[],typeName:R.ZodBigInt,coerce:a?.coerce??!1,...K(a)});var Lr=class extends J{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==N.boolean){let s=this._getOrReturnCtx(e);return C(s,{code:w.invalid_type,expected:N.boolean,received:s.parsedType}),Z}return Oe(e.data)}};Lr.create=a=>new Lr({typeName:R.ZodBoolean,coerce:a?.coerce||!1,...K(a)});var Mr=class a extends J{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==N.date){let n=this._getOrReturnCtx(e);return C(n,{code:w.invalid_type,expected:N.date,received:n.parsedType}),Z}if(Number.isNaN(e.data.getTime())){let n=this._getOrReturnCtx(e);return C(n,{code:w.invalid_date}),Z}let s=new we,r;for(let n of this._def.checks)n.kind==="min"?e.data.getTime()<n.value&&(r=this._getOrReturnCtx(e,r),C(r,{code:w.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),C(r,{code:w.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}};Mr.create=a=>new Mr({checks:[],coerce:a?.coerce||!1,typeName:R.ZodDate,...K(a)});var lt=class extends J{_parse(e){if(this._getType(e)!==N.symbol){let s=this._getOrReturnCtx(e);return C(s,{code:w.invalid_type,expected:N.symbol,received:s.parsedType}),Z}return Oe(e.data)}};lt.create=a=>new lt({typeName:R.ZodSymbol,...K(a)});var Fr=class extends J{_parse(e){if(this._getType(e)!==N.undefined){let s=this._getOrReturnCtx(e);return C(s,{code:w.invalid_type,expected:N.undefined,received:s.parsedType}),Z}return Oe(e.data)}};Fr.create=a=>new Fr({typeName:R.ZodUndefined,...K(a)});var Ur=class extends J{_parse(e){if(this._getType(e)!==N.null){let s=this._getOrReturnCtx(e);return C(s,{code:w.invalid_type,expected:N.null,received:s.parsedType}),Z}return Oe(e.data)}};Ur.create=a=>new Ur({typeName:R.ZodNull,...K(a)});var Pr=class extends J{constructor(){super(...arguments),this._any=!0}_parse(e){return Oe(e.data)}};Pr.create=a=>new Pr({typeName:R.ZodAny,...K(a)});var gr=class extends J{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Oe(e.data)}};gr.create=a=>new gr({typeName:R.ZodUnknown,...K(a)});var Je=class extends J{_parse(e){let t=this._getOrReturnCtx(e);return C(t,{code:w.invalid_type,expected:N.never,received:t.parsedType}),Z}};Je.create=a=>new Je({typeName:R.ZodNever,...K(a)});var ct=class extends J{_parse(e){if(this._getType(e)!==N.undefined){let s=this._getOrReturnCtx(e);return C(s,{code:w.invalid_type,expected:N.void,received:s.parsedType}),Z}return Oe(e.data)}};ct.create=a=>new ct({typeName:R.ZodVoid,...K(a)});var yr=class a extends J{_parse(e){let{ctx:t,status:s}=this._processInputParams(e),r=this._def;if(t.parsedType!==N.array)return C(t,{code:w.invalid_type,expected:N.array,received:t.parsedType}),Z;if(r.exactLength!==null){let l=t.data.length>r.exactLength.value,i=t.data.length<r.exactLength.value;(l||i)&&(C(t,{code:l?w.too_big:w.too_small,minimum:i?r.exactLength.value:void 0,maximum:l?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&&(C(t,{code:w.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&&(C(t,{code:w.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((l,i)=>r.type._parseAsync(new Ze(t,l,t.path,i)))).then(l=>we.mergeArray(s,l));let n=[...t.data].map((l,i)=>r.type._parseSync(new Ze(t,l,t.path,i)));return we.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:R.ZodArray,...K(e)});function it(a){if(a instanceof je){let e={};for(let t in a.shape){let s=a.shape[t];e[t]=He.create(it(s))}return new je({...a._def,shape:()=>e})}else return a instanceof yr?new yr({...a._def,type:it(a.element)}):a instanceof He?He.create(it(a.unwrap())):a instanceof ir?ir.create(it(a.unwrap())):a instanceof or?or.create(a.items.map(e=>it(e))):a}var je=class a extends J{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),t=X.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==N.object){let f=this._getOrReturnCtx(e);return C(f,{code:w.invalid_type,expected:N.object,received:f.parsedType}),Z}let{status:s,ctx:r}=this._processInputParams(e),{shape:n,keys:l}=this._getCached(),i=[];if(!(this._def.catchall instanceof Je&&this._def.unknownKeys==="strip"))for(let f in r.data)l.includes(f)||i.push(f);let d=[];for(let f of l){let p=n[f],m=r.data[f];d.push({key:{status:"valid",value:f},value:p._parse(new Ze(r,m,r.path,f)),alwaysSet:f in r.data})}if(this._def.catchall instanceof Je){let f=this._def.unknownKeys;if(f==="passthrough")for(let p of i)d.push({key:{status:"valid",value:p},value:{status:"valid",value:r.data[p]}});else if(f==="strict")i.length>0&&(C(r,{code:w.unrecognized_keys,keys:i}),s.dirty());else if(f!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let f=this._def.catchall;for(let p of i){let m=r.data[p];d.push({key:{status:"valid",value:p},value:f._parse(new Ze(r,m,r.path,p)),alwaysSet:p in r.data})}}return r.common.async?Promise.resolve().then(async()=>{let f=[];for(let p of d){let m=await p.key,E=await p.value;f.push({key:m,value:E,alwaysSet:p.alwaysSet})}return f}).then(f=>we.mergeObjectSync(s,f)):we.mergeObjectSync(s,d)}get shape(){return this._def.shape()}strict(e){return V.errToObj,new a({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,s)=>{let r=this._def.errorMap?.(t,s).message??s.defaultError;return t.code==="unrecognized_keys"?{message:V.errToObj(e).message??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:R.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 it(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 He;)n=n._def.innerType;t[s]=n}return new a({...this._def,shape:()=>t})}keyof(){return Qs(X.objectKeys(this.shape))}};je.create=(a,e)=>new je({shape:()=>a,unknownKeys:"strip",catchall:Je.create(),typeName:R.ZodObject,...K(e)});je.strictCreate=(a,e)=>new je({shape:()=>a,unknownKeys:"strict",catchall:Je.create(),typeName:R.ZodObject,...K(e)});je.lazycreate=(a,e)=>new je({shape:a,unknownKeys:"strip",catchall:Je.create(),typeName:R.ZodObject,...K(e)});var qr=class extends J{_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 l=n.map(i=>new Ne(i.ctx.common.issues));return C(t,{code:w.invalid_union,unionErrors:l}),Z}if(t.common.async)return Promise.all(s.map(async n=>{let l={...t,common:{...t.common,issues:[]},parent:null};return{result:await n._parseAsync({data:t.data,path:t.path,parent:l}),ctx:l}})).then(r);{let n,l=[];for(let d of s){let f={...t,common:{...t.common,issues:[]},parent:null},p=d._parseSync({data:t.data,path:t.path,parent:f});if(p.status==="valid")return p;p.status==="dirty"&&!n&&(n={result:p,ctx:f}),f.common.issues.length&&l.push(f.common.issues)}if(n)return t.common.issues.push(...n.ctx.common.issues),n.result;let i=l.map(d=>new Ne(d));return C(t,{code:w.invalid_union,unionErrors:i}),Z}}get options(){return this._def.options}};qr.create=(a,e)=>new qr({options:a,typeName:R.ZodUnion,...K(e)});var vr=a=>a instanceof zr?vr(a.schema):a instanceof Be?vr(a.innerType()):a instanceof Hr?[a.value]:a instanceof Zr?a.options:a instanceof Br?X.objectValues(a.enum):a instanceof Wr?vr(a._def.innerType):a instanceof Fr?[void 0]:a instanceof Ur?[null]:a instanceof He?[void 0,...vr(a.unwrap())]:a instanceof ir?[null,...vr(a.unwrap())]:a instanceof xt||a instanceof Qr?vr(a.unwrap()):a instanceof Kr?vr(a._def.innerType):[],Ut=class a extends J{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==N.object)return C(t,{code:w.invalid_type,expected:N.object,received:t.parsedType}),Z;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}):(C(t,{code:w.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[s]}),Z)}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 l=vr(n.shape[e]);if(!l.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let i of l){if(r.has(i))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(i)}`);r.set(i,n)}}return new a({typeName:R.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:r,...K(s)})}};function $a(a,e){let t=nr(a),s=nr(e);if(a===e)return{valid:!0,data:a};if(t===N.object&&s===N.object){let r=X.objectKeys(e),n=X.objectKeys(a).filter(i=>r.indexOf(i)!==-1),l={...a,...e};for(let i of n){let d=$a(a[i],e[i]);if(!d.valid)return{valid:!1};l[i]=d.data}return{valid:!0,data:l}}else if(t===N.array&&s===N.array){if(a.length!==e.length)return{valid:!1};let r=[];for(let n=0;n<a.length;n++){let l=a[n],i=e[n],d=$a(l,i);if(!d.valid)return{valid:!1};r.push(d.data)}return{valid:!0,data:r}}else return t===N.date&&s===N.date&&+a==+e?{valid:!0,data:a}:{valid:!1}}var Vr=class extends J{_parse(e){let{status:t,ctx:s}=this._processInputParams(e),r=(n,l)=>{if(Mt(n)||Mt(l))return Z;let i=$a(n.value,l.value);return i.valid?((Ft(n)||Ft(l))&&t.dirty(),{status:t.value,value:i.data}):(C(s,{code:w.invalid_intersection_types}),Z)};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,l])=>r(n,l)):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}))}};Vr.create=(a,e,t)=>new Vr({left:a,right:e,typeName:R.ZodIntersection,...K(t)});var or=class a extends J{_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==N.array)return C(s,{code:w.invalid_type,expected:N.array,received:s.parsedType}),Z;if(s.data.length<this._def.items.length)return C(s,{code:w.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Z;!this._def.rest&&s.data.length>this._def.items.length&&(C(s,{code:w.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());let n=[...s.data].map((l,i)=>{let d=this._def.items[i]||this._def.rest;return d?d._parse(new Ze(s,l,s.path,i)):null}).filter(l=>!!l);return s.common.async?Promise.all(n).then(l=>we.mergeArray(t,l)):we.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:R.ZodTuple,rest:null,...K(e)})};var qt=class a extends J{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!==N.object)return C(s,{code:w.invalid_type,expected:N.object,received:s.parsedType}),Z;let r=[],n=this._def.keyType,l=this._def.valueType;for(let i in s.data)r.push({key:n._parse(new Ze(s,i,s.path,i)),value:l._parse(new Ze(s,s.data[i],s.path,i)),alwaysSet:i in s.data});return s.common.async?we.mergeObjectAsync(t,r):we.mergeObjectSync(t,r)}get element(){return this._def.valueType}static create(e,t,s){return t instanceof J?new a({keyType:e,valueType:t,typeName:R.ZodRecord,...K(s)}):new a({keyType:br.create(),valueType:e,typeName:R.ZodRecord,...K(t)})}},ut=class extends J{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!==N.map)return C(s,{code:w.invalid_type,expected:N.map,received:s.parsedType}),Z;let r=this._def.keyType,n=this._def.valueType,l=[...s.data.entries()].map(([i,d],f)=>({key:r._parse(new Ze(s,i,s.path,[f,"key"])),value:n._parse(new Ze(s,d,s.path,[f,"value"]))}));if(s.common.async){let i=new Map;return Promise.resolve().then(async()=>{for(let d of l){let f=await d.key,p=await d.value;if(f.status==="aborted"||p.status==="aborted")return Z;(f.status==="dirty"||p.status==="dirty")&&t.dirty(),i.set(f.value,p.value)}return{status:t.value,value:i}})}else{let i=new Map;for(let d of l){let f=d.key,p=d.value;if(f.status==="aborted"||p.status==="aborted")return Z;(f.status==="dirty"||p.status==="dirty")&&t.dirty(),i.set(f.value,p.value)}return{status:t.value,value:i}}}};ut.create=(a,e,t)=>new ut({valueType:e,keyType:a,typeName:R.ZodMap,...K(t)});var dt=class a extends J{_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==N.set)return C(s,{code:w.invalid_type,expected:N.set,received:s.parsedType}),Z;let r=this._def;r.minSize!==null&&s.data.size<r.minSize.value&&(C(s,{code:w.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&&(C(s,{code:w.too_big,maximum:r.maxSize.value,type:"set",inclusive:!0,exact:!1,message:r.maxSize.message}),t.dirty());let n=this._def.valueType;function l(d){let f=new Set;for(let p of d){if(p.status==="aborted")return Z;p.status==="dirty"&&t.dirty(),f.add(p.value)}return{status:t.value,value:f}}let i=[...s.data.values()].map((d,f)=>n._parse(new Ze(s,d,s.path,f)));return s.common.async?Promise.all(i).then(d=>l(d)):l(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)}};dt.create=(a,e)=>new dt({valueType:a,minSize:null,maxSize:null,typeName:R.ZodSet,...K(e)});var Vt=class a extends J{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==N.function)return C(t,{code:w.invalid_type,expected:N.function,received:t.parsedType}),Z;function s(i,d){return Pt({data:i,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,nt(),mr].filter(f=>!!f),issueData:{code:w.invalid_arguments,argumentsError:d}})}function r(i,d){return Pt({data:i,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,nt(),mr].filter(f=>!!f),issueData:{code:w.invalid_return_type,returnTypeError:d}})}let n={errorMap:t.common.contextualErrorMap},l=t.data;if(this._def.returns instanceof xr){let i=this;return Oe(async function(...d){let f=new Ne([]),p=await i._def.args.parseAsync(d,n).catch(c=>{throw f.addIssue(s(d,c)),f}),m=await Reflect.apply(l,this,p);return await i._def.returns._def.type.parseAsync(m,n).catch(c=>{throw f.addIssue(r(m,c)),f})})}else{let i=this;return Oe(function(...d){let f=i._def.args.safeParse(d,n);if(!f.success)throw new Ne([s(d,f.error)]);let p=Reflect.apply(l,this,f.data),m=i._def.returns.safeParse(p,n);if(!m.success)throw new Ne([r(p,m.error)]);return m.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:R.ZodFunction,...K(s)})}},zr=class extends J{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}};zr.create=(a,e)=>new zr({getter:a,typeName:R.ZodLazy,...K(e)});var Hr=class extends J{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return C(t,{received:t.data,code:w.invalid_literal,expected:this._def.value}),Z}return{status:"valid",value:e.data}}get value(){return this._def.value}};Hr.create=(a,e)=>new Hr({value:a,typeName:R.ZodLiteral,...K(e)});function Qs(a,e){return new Zr({values:a,typeName:R.ZodEnum,...K(e)})}var Zr=class a extends J{_parse(e){if(typeof e.data!="string"){let t=this._getOrReturnCtx(e),s=this._def.values;return C(t,{expected:X.joinValues(s),received:t.parsedType,code:w.invalid_type}),Z}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 C(t,{received:t.data,code:w.invalid_enum_value,options:s}),Z}return Oe(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})}};Zr.create=Qs;var Br=class extends J{_parse(e){let t=X.getValidEnumValues(this._def.values),s=this._getOrReturnCtx(e);if(s.parsedType!==N.string&&s.parsedType!==N.number){let r=X.objectValues(t);return C(s,{expected:X.joinValues(r),received:s.parsedType,code:w.invalid_type}),Z}if(this._cache||(this._cache=new Set(X.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let r=X.objectValues(t);return C(s,{received:s.data,code:w.invalid_enum_value,options:r}),Z}return Oe(e.data)}get enum(){return this._def.values}};Br.create=(a,e)=>new Br({values:a,typeName:R.ZodNativeEnum,...K(e)});var xr=class extends J{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==N.promise&&t.common.async===!1)return C(t,{code:w.invalid_type,expected:N.promise,received:t.parsedType}),Z;let s=t.parsedType===N.promise?t.data:Promise.resolve(t.data);return Oe(s.then(r=>this._def.type.parseAsync(r,{path:t.path,errorMap:t.common.contextualErrorMap})))}};xr.create=(a,e)=>new xr({type:a,typeName:R.ZodPromise,...K(e)});var Be=class extends J{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===R.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:l=>{C(s,l),l.fatal?t.abort():t.dirty()},get path(){return s.path}};if(n.addIssue=n.addIssue.bind(n),r.type==="preprocess"){let l=r.transform(s.data,n);if(s.common.async)return Promise.resolve(l).then(async i=>{if(t.value==="aborted")return Z;let d=await this._def.schema._parseAsync({data:i,path:s.path,parent:s});return d.status==="aborted"?Z:d.status==="dirty"?Cr(d.value):t.value==="dirty"?Cr(d.value):d});{if(t.value==="aborted")return Z;let i=this._def.schema._parseSync({data:l,path:s.path,parent:s});return i.status==="aborted"?Z:i.status==="dirty"?Cr(i.value):t.value==="dirty"?Cr(i.value):i}}if(r.type==="refinement"){let l=i=>{let d=r.refinement(i,n);if(s.common.async)return Promise.resolve(d);if(d 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"?Z:(i.status==="dirty"&&t.dirty(),l(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"?Z:(i.status==="dirty"&&t.dirty(),l(i.value).then(()=>({status:t.value,value:i.value}))))}if(r.type==="transform")if(s.common.async===!1){let l=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});if(!Sr(l))return Z;let i=r.transform(l.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(l=>Sr(l)?Promise.resolve(r.transform(l.value,n)).then(i=>({status:t.value,value:i})):Z);X.assertNever(r)}};Be.create=(a,e,t)=>new Be({schema:a,typeName:R.ZodEffects,effect:e,...K(t)});Be.createWithPreprocess=(a,e,t)=>new Be({schema:e,effect:{type:"preprocess",transform:a},typeName:R.ZodEffects,...K(t)});var He=class extends J{_parse(e){return this._getType(e)===N.undefined?Oe(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};He.create=(a,e)=>new He({innerType:a,typeName:R.ZodOptional,...K(e)});var ir=class extends J{_parse(e){return this._getType(e)===N.null?Oe(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};ir.create=(a,e)=>new ir({innerType:a,typeName:R.ZodNullable,...K(e)});var Wr=class extends J{_parse(e){let{ctx:t}=this._processInputParams(e),s=t.data;return t.parsedType===N.undefined&&(s=this._def.defaultValue()),this._def.innerType._parse({data:s,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};Wr.create=(a,e)=>new Wr({innerType:a,typeName:R.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...K(e)});var Kr=class extends J{_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 ot(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}};Kr.create=(a,e)=>new Kr({innerType:a,typeName:R.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...K(e)});var ft=class extends J{_parse(e){if(this._getType(e)!==N.nan){let s=this._getOrReturnCtx(e);return C(s,{code:w.invalid_type,expected:N.nan,received:s.parsedType}),Z}return{status:"valid",value:e.data}}};ft.create=a=>new ft({typeName:R.ZodNaN,...K(a)});var dc=Symbol("zod_brand"),xt=class extends J{_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}},wt=class a extends J{_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"?Z:n.status==="dirty"?(t.dirty(),Cr(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"?Z: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:R.ZodPipeline})}},Qr=class extends J{_parse(e){let t=this._def.innerType._parse(e),s=r=>(Sr(r)&&(r.value=Object.freeze(r.value)),r);return ot(t)?t.then(r=>s(r)):s(t)}unwrap(){return this._def.innerType}};Qr.create=(a,e)=>new Qr({innerType:a,typeName:R.ZodReadonly,...K(e)});function Zs(a,e){let t=typeof a=="function"?a(e):typeof a=="string"?{message:a}:a;return typeof t=="string"?{message:t}:t}function Js(a,e={},t){return a?Pr.create().superRefine((s,r)=>{let n=a(s);if(n instanceof Promise)return n.then(l=>{if(!l){let i=Zs(e,s),d=i.fatal??t??!0;r.addIssue({code:"custom",...i,fatal:d})}});if(!n){let l=Zs(e,s),i=l.fatal??t??!0;r.addIssue({code:"custom",...l,fatal:i})}}):Pr.create()}var fc={object:je.lazycreate},R;(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"})(R||(R={}));var pc=(a,e={message:`Input not instance of ${a.name}`})=>Js(t=>t instanceof a,e),Gs=br.create,Ys=Nr.create,hc=ft.create,mc=jr.create,Xs=Lr.create,vc=Mr.create,gc=lt.create,yc=Fr.create,_c=Ur.create,Ec=Pr.create,Sc=gr.create,bc=Je.create,Pc=ct.create,xc=yr.create,wc=je.create,Tc=je.strictCreate,Rc=qr.create,Oc=Ut.create,Ac=Vr.create,Dc=or.create,Ic=qt.create,kc=ut.create,$c=dt.create,Cc=Vt.create,Nc=zr.create,jc=Hr.create,Lc=Zr.create,Mc=Br.create,Fc=xr.create,Uc=Be.create,qc=He.create,Vc=ir.create,zc=Be.createWithPreprocess,Hc=wt.create,Zc=()=>Gs().optional(),Bc=()=>Ys().optional(),Wc=()=>Xs().optional(),Kc={string:(a=>br.create({...a,coerce:!0})),number:(a=>Nr.create({...a,coerce:!0})),boolean:(a=>Lr.create({...a,coerce:!0})),bigint:(a=>jr.create({...a,coerce:!0})),date:(a=>Mr.create({...a,coerce:!0}))};var Qc=Z;var Ca="2025-06-18";var en=[Ca,"2025-03-26","2024-11-05","2024-10-07"],zt="2.0",rn=o.union([o.string(),o.number().int()]),tn=o.string(),Jc=o.object({progressToken:o.optional(rn)}).passthrough(),We=o.object({_meta:o.optional(Jc)}).passthrough(),Le=o.object({method:o.string(),params:o.optional(We)}),Tt=o.object({_meta:o.optional(o.object({}).passthrough())}).passthrough(),lr=o.object({method:o.string(),params:o.optional(Tt)}),Ke=o.object({_meta:o.optional(o.object({}).passthrough())}).passthrough(),Ht=o.union([o.string(),o.number().int()]),an=o.object({jsonrpc:o.literal(zt),id:Ht}).merge(Le).strict(),sn=a=>an.safeParse(a).success,nn=o.object({jsonrpc:o.literal(zt)}).merge(lr).strict(),on=a=>nn.safeParse(a).success,ln=o.object({jsonrpc:o.literal(zt),id:Ht,result:Ke}).strict(),Na=a=>ln.safeParse(a).success,Ge;(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"})(Ge||(Ge={}));var cn=o.object({jsonrpc:o.literal(zt),id:Ht,error:o.object({code:o.number().int(),message:o.string(),data:o.optional(o.unknown())})}).strict(),un=a=>cn.safeParse(a).success,dn=o.union([an,nn,ln,cn]),Zt=Ke.strict(),Bt=lr.extend({method:o.literal("notifications/cancelled"),params:Tt.extend({requestId:Ht,reason:o.string().optional()})}),Gc=o.object({src:o.string(),mimeType:o.optional(o.string()),sizes:o.optional(o.array(o.string()))}).passthrough(),Rt=o.object({icons:o.array(Gc).optional()}).passthrough(),Ot=o.object({name:o.string(),title:o.optional(o.string())}).passthrough(),fn=Ot.extend({version:o.string(),websiteUrl:o.optional(o.string())}).merge(Rt),Yc=o.object({experimental:o.optional(o.object({}).passthrough()),sampling:o.optional(o.object({}).passthrough()),elicitation:o.optional(o.object({}).passthrough()),roots:o.optional(o.object({listChanged:o.optional(o.boolean())}).passthrough())}).passthrough(),ja=Le.extend({method:o.literal("initialize"),params:We.extend({protocolVersion:o.string(),capabilities:Yc,clientInfo:fn})});var Xc=o.object({experimental:o.optional(o.object({}).passthrough()),logging:o.optional(o.object({}).passthrough()),completions:o.optional(o.object({}).passthrough()),prompts:o.optional(o.object({listChanged:o.optional(o.boolean())}).passthrough()),resources:o.optional(o.object({subscribe:o.optional(o.boolean()),listChanged:o.optional(o.boolean())}).passthrough()),tools:o.optional(o.object({listChanged:o.optional(o.boolean())}).passthrough())}).passthrough(),eu=Ke.extend({protocolVersion:o.string(),capabilities:Xc,serverInfo:fn,instructions:o.optional(o.string())}),La=lr.extend({method:o.literal("notifications/initialized")});var Wt=Le.extend({method:o.literal("ping")}),ru=o.object({progress:o.number(),total:o.optional(o.number()),message:o.optional(o.string())}).passthrough(),Kt=lr.extend({method:o.literal("notifications/progress"),params:Tt.merge(ru).extend({progressToken:rn})}),Qt=Le.extend({params:We.extend({cursor:o.optional(tn)}).optional()}),Jt=Ke.extend({nextCursor:o.optional(tn)}),pn=o.object({uri:o.string(),mimeType:o.optional(o.string()),_meta:o.optional(o.object({}).passthrough())}).passthrough(),hn=pn.extend({text:o.string()}),Ma=o.string().refine(a=>{try{return atob(a),!0}catch{return!1}},{message:"Invalid Base64 string"}),mn=pn.extend({blob:Ma}),vn=Ot.extend({uri:o.string(),description:o.optional(o.string()),mimeType:o.optional(o.string()),_meta:o.optional(o.object({}).passthrough())}).merge(Rt),tu=Ot.extend({uriTemplate:o.string(),description:o.optional(o.string()),mimeType:o.optional(o.string()),_meta:o.optional(o.object({}).passthrough())}).merge(Rt),au=Qt.extend({method:o.literal("resources/list")}),su=Jt.extend({resources:o.array(vn)}),nu=Qt.extend({method:o.literal("resources/templates/list")}),ou=Jt.extend({resourceTemplates:o.array(tu)}),iu=Le.extend({method:o.literal("resources/read"),params:We.extend({uri:o.string()})}),lu=Ke.extend({contents:o.array(o.union([hn,mn]))}),cu=lr.extend({method:o.literal("notifications/resources/list_changed")}),uu=Le.extend({method:o.literal("resources/subscribe"),params:We.extend({uri:o.string()})}),du=Le.extend({method:o.literal("resources/unsubscribe"),params:We.extend({uri:o.string()})}),fu=lr.extend({method:o.literal("notifications/resources/updated"),params:Tt.extend({uri:o.string()})}),pu=o.object({name:o.string(),description:o.optional(o.string()),required:o.optional(o.boolean())}).passthrough(),hu=Ot.extend({description:o.optional(o.string()),arguments:o.optional(o.array(pu)),_meta:o.optional(o.object({}).passthrough())}).merge(Rt),mu=Qt.extend({method:o.literal("prompts/list")}),vu=Jt.extend({prompts:o.array(hu)}),gu=Le.extend({method:o.literal("prompts/get"),params:We.extend({name:o.string(),arguments:o.optional(o.record(o.string()))})}),Fa=o.object({type:o.literal("text"),text:o.string(),_meta:o.optional(o.object({}).passthrough())}).passthrough(),Ua=o.object({type:o.literal("image"),data:Ma,mimeType:o.string(),_meta:o.optional(o.object({}).passthrough())}).passthrough(),qa=o.object({type:o.literal("audio"),data:Ma,mimeType:o.string(),_meta:o.optional(o.object({}).passthrough())}).passthrough(),yu=o.object({type:o.literal("resource"),resource:o.union([hn,mn]),_meta:o.optional(o.object({}).passthrough())}).passthrough(),_u=vn.extend({type:o.literal("resource_link")}),gn=o.union([Fa,Ua,qa,_u,yu]),Eu=o.object({role:o.enum(["user","assistant"]),content:gn}).passthrough(),Su=Ke.extend({description:o.optional(o.string()),messages:o.array(Eu)}),bu=lr.extend({method:o.literal("notifications/prompts/list_changed")}),Pu=o.object({title:o.optional(o.string()),readOnlyHint:o.optional(o.boolean()),destructiveHint:o.optional(o.boolean()),idempotentHint:o.optional(o.boolean()),openWorldHint:o.optional(o.boolean())}).passthrough(),xu=Ot.extend({description:o.optional(o.string()),inputSchema:o.object({type:o.literal("object"),properties:o.optional(o.object({}).passthrough()),required:o.optional(o.array(o.string()))}).passthrough(),outputSchema:o.optional(o.object({type:o.literal("object"),properties:o.optional(o.object({}).passthrough()),required:o.optional(o.array(o.string()))}).passthrough()),annotations:o.optional(Pu),_meta:o.optional(o.object({}).passthrough())}).merge(Rt),Va=Qt.extend({method:o.literal("tools/list")}),wu=Jt.extend({tools:o.array(xu)}),yn=Ke.extend({content:o.array(gn).default([]),structuredContent:o.object({}).passthrough().optional(),isError:o.optional(o.boolean())}),wp=yn.or(Ke.extend({toolResult:o.unknown()})),za=Le.extend({method:o.literal("tools/call"),params:We.extend({name:o.string(),arguments:o.optional(o.record(o.unknown()))})}),Tu=lr.extend({method:o.literal("notifications/tools/list_changed")}),At=o.enum(["debug","info","notice","warning","error","critical","alert","emergency"]),Ha=Le.extend({method:o.literal("logging/setLevel"),params:We.extend({level:At})}),Ru=lr.extend({method:o.literal("notifications/message"),params:Tt.extend({level:At,logger:o.optional(o.string()),data:o.unknown()})}),Ou=o.object({name:o.string().optional()}).passthrough(),Au=o.object({hints:o.optional(o.array(Ou)),costPriority:o.optional(o.number().min(0).max(1)),speedPriority:o.optional(o.number().min(0).max(1)),intelligencePriority:o.optional(o.number().min(0).max(1))}).passthrough(),Du=o.object({role:o.enum(["user","assistant"]),content:o.union([Fa,Ua,qa])}).passthrough(),Iu=Le.extend({method:o.literal("sampling/createMessage"),params:We.extend({messages:o.array(Du),systemPrompt:o.optional(o.string()),includeContext:o.optional(o.enum(["none","thisServer","allServers"])),temperature:o.optional(o.number()),maxTokens:o.number().int(),stopSequences:o.optional(o.array(o.string())),metadata:o.optional(o.object({}).passthrough()),modelPreferences:o.optional(Au)})}),Za=Ke.extend({model:o.string(),stopReason:o.optional(o.enum(["endTurn","stopSequence","maxTokens"]).or(o.string())),role:o.enum(["user","assistant"]),content:o.discriminatedUnion("type",[Fa,Ua,qa])}),ku=o.object({type:o.literal("boolean"),title:o.optional(o.string()),description:o.optional(o.string()),default:o.optional(o.boolean())}).passthrough(),$u=o.object({type:o.literal("string"),title:o.optional(o.string()),description:o.optional(o.string()),minLength:o.optional(o.number()),maxLength:o.optional(o.number()),format:o.optional(o.enum(["email","uri","date","date-time"]))}).passthrough(),Cu=o.object({type:o.enum(["number","integer"]),title:o.optional(o.string()),description:o.optional(o.string()),minimum:o.optional(o.number()),maximum:o.optional(o.number())}).passthrough(),Nu=o.object({type:o.literal("string"),title:o.optional(o.string()),description:o.optional(o.string()),enum:o.array(o.string()),enumNames:o.optional(o.array(o.string()))}).passthrough(),ju=o.union([ku,$u,Cu,Nu]),Lu=Le.extend({method:o.literal("elicitation/create"),params:We.extend({message:o.string(),requestedSchema:o.object({type:o.literal("object"),properties:o.record(o.string(),ju),required:o.optional(o.array(o.string()))}).passthrough()})}),Ba=Ke.extend({action:o.enum(["accept","decline","cancel"]),content:o.optional(o.record(o.string(),o.unknown()))}),Mu=o.object({type:o.literal("ref/resource"),uri:o.string()}).passthrough();var Fu=o.object({type:o.literal("ref/prompt"),name:o.string()}).passthrough(),Uu=Le.extend({method:o.literal("completion/complete"),params:We.extend({ref:o.union([Fu,Mu]),argument:o.object({name:o.string(),value:o.string()}).passthrough(),context:o.optional(o.object({arguments:o.optional(o.record(o.string(),o.string()))}))})}),qu=Ke.extend({completion:o.object({values:o.array(o.string()).max(100),total:o.optional(o.number().int()),hasMore:o.optional(o.boolean())}).passthrough()}),Vu=o.object({uri:o.string().startsWith("file://"),name:o.optional(o.string()),_meta:o.optional(o.object({}).passthrough())}).passthrough(),zu=Le.extend({method:o.literal("roots/list")}),Wa=Ke.extend({roots:o.array(Vu)}),Hu=lr.extend({method:o.literal("notifications/roots/list_changed")}),Tp=o.union([Wt,ja,Uu,Ha,gu,mu,au,nu,iu,uu,du,za,Va]),Rp=o.union([Bt,Kt,La,Hu]),Op=o.union([Zt,Za,Ba,Wa]),Ap=o.union([Wt,Iu,Lu,zu]),Dp=o.union([Bt,Kt,Ru,fu,cu,Tu,bu]),Ip=o.union([Zt,eu,qu,Su,vu,su,ou,lu,yn,wu]),Ye=class extends Error{constructor(e,t,s){super(`MCP error ${e}: ${t}`),this.code=e,this.data=s,this.name="McpError"}};var Zu=6e4,Gt=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(Bt,t=>{let s=this._requestHandlerAbortControllers.get(t.params.requestId);s?.abort(t.params.reason)}),this.setNotificationHandler(Kt,t=>{this._onprogress(t)}),this.setRequestHandler(Wt,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 Ye(Ge.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?.(),this._onclose()};let l=(s=this.transport)===null||s===void 0?void 0:s.onerror;this._transport.onerror=d=>{l?.(d),this._onerror(d)};let i=(r=this._transport)===null||r===void 0?void 0:r.onmessage;this._transport.onmessage=(d,f)=>{i?.(d,f),Na(d)||un(d)?this._onresponse(d):sn(d)?this._onrequest(d,f):on(d)?this._onnotification(d):this._onerror(new Error(`Unknown message type: ${JSON.stringify(d)}`))},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 Ye(Ge.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,l=this._transport;if(n===void 0){l?.send({jsonrpc:"2.0",id:e.id,error:{code:Ge.MethodNotFound,message:"Method not found"}}).catch(f=>this._onerror(new Error(`Failed to send an error response: ${f}`)));return}let i=new AbortController;this._requestHandlerAbortControllers.set(e.id,i);let d={signal:i.signal,sessionId:l?.sessionId,_meta:(r=e.params)===null||r===void 0?void 0:r._meta,sendNotification:f=>this.notification(f,{relatedRequestId:e.id}),sendRequest:(f,p,m)=>this.request(f,p,{...m,relatedRequestId:e.id}),authInfo:t?.authInfo,requestId:e.id,requestInfo:t?.requestInfo};Promise.resolve().then(()=>n(e,d)).then(f=>{if(!i.signal.aborted)return l?.send({result:f,jsonrpc:"2.0",id:e.id})},f=>{var p;if(!i.signal.aborted)return l?.send({jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(f.code)?f.code:Ge.InternalError,message:(p=f.message)!==null&&p!==void 0?p:"Internal error"}})}).catch(f=>this._onerror(new Error(`Failed to send response: ${f}`))).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 l=this._responseHandlers.get(r),i=this._timeoutInfo.get(r);if(i&&l&&i.resetTimeoutOnProgress)try{this._resetTimeout(r)}catch(d){l(d);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),Na(e))s(e);else{let r=new Ye(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:l}=s??{};return new Promise((i,d)=>{var f,p,m,E,c,y;if(!this._transport){d(new Error("Not connected"));return}((f=this._options)===null||f===void 0?void 0:f.enforceStrictCapabilities)===!0&&this.assertCapabilityForMethod(e.method),(p=s?.signal)===null||p===void 0||p.throwIfAborted();let _=this._requestMessageId++,v={...e,jsonrpc:"2.0",id:_};s?.onprogress&&(this._progressHandlers.set(_,s.onprogress),v.params={...e.params,_meta:{...((m=e.params)===null||m===void 0?void 0:m._meta)||{},progressToken:_}});let P=T=>{var D;this._responseHandlers.delete(_),this._progressHandlers.delete(_),this._cleanupTimeout(_),(D=this._transport)===null||D===void 0||D.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:_,reason:String(T)}},{relatedRequestId:r,resumptionToken:n,onresumptiontoken:l}).catch(I=>this._onerror(new Error(`Failed to send cancellation: ${I}`))),d(T)};this._responseHandlers.set(_,T=>{var D;if(!(!((D=s?.signal)===null||D===void 0)&&D.aborted)){if(T instanceof Error)return d(T);try{let I=t.parse(T.result);i(I)}catch(I){d(I)}}}),(E=s?.signal)===null||E===void 0||E.addEventListener("abort",()=>{var T;P((T=s?.signal)===null||T===void 0?void 0:T.reason)});let O=(c=s?.timeout)!==null&&c!==void 0?c:Zu,x=()=>P(new Ye(Ge.RequestTimeout,"Request timed out",{timeout:O}));this._setupTimeout(_,O,s?.maxTotalTimeout,x,(y=s?.resetTimeoutOnProgress)!==null&&y!==void 0?y:!1),this._transport.send(v,{relatedRequestId:r,resumptionToken:n,onresumptiontoken:l}).catch(T=>{this._cleanupTimeout(_),d(T)})})}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?.relatedRequestId){if(this._pendingDebouncedNotifications.has(e.method))return;this._pendingDebouncedNotifications.add(e.method),Promise.resolve().then(()=>{var d;if(this._pendingDebouncedNotifications.delete(e.method),!this._transport)return;let f={...e,jsonrpc:"2.0"};(d=this._transport)===null||d===void 0||d.send(f,t).catch(p=>this._onerror(p))});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 _n(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 bi=Da(Si(),1),va=class extends Gt{constructor(e,t){var s;super(t),this._serverInfo=e,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(At.options.map((r,n)=>[r,n])),this.isMessageIgnored=(r,n)=>{let l=this._loggingLevels.get(n);return l?this.LOG_LEVEL_SEVERITY.get(r)<this.LOG_LEVEL_SEVERITY.get(l):!1},this._capabilities=(s=t?.capabilities)!==null&&s!==void 0?s:{},this._instructions=t?.instructions,this.setRequestHandler(ja,r=>this._oninitialize(r)),this.setNotificationHandler(La,()=>{var r;return(r=this.oninitialized)===null||r===void 0?void 0:r.call(this)}),this._capabilities.logging&&this.setRequestHandler(Ha,async(r,n)=>{var l;let i=n.sessionId||((l=n.requestInfo)===null||l===void 0?void 0:l.headers["mcp-session-id"])||void 0,{level:d}=r.params,f=At.safeParse(d);return f.success&&this._loggingLevels.set(i,f.data),{}})}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=_n(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:en.includes(t)?t:Ca,capabilities:this.getCapabilities(),serverInfo:this._serverInfo,...this._instructions&&{instructions:this._instructions}}}getClientCapabilities(){return this._clientCapabilities}getClientVersion(){return this._clientVersion}getCapabilities(){return this._capabilities}async ping(){return this.request({method:"ping"},Zt)}async createMessage(e,t){return this.request({method:"sampling/createMessage",params:e},Za,t)}async elicitInput(e,t){let s=await this.request({method:"elicitation/create",params:e},Ba,t);if(s.action==="accept"&&s.content)try{let r=new bi.default,n=r.compile(e.requestedSchema);if(!n(s.content))throw new Ye(Ge.InvalidParams,`Elicitation response content does not match requested schema: ${r.errorsText(n.errors)}`)}catch(r){throw r instanceof Ye?r:new Ye(Ge.InternalError,`Error validating elicitation response: ${r}`)}return s}async listRoots(e,t){return this.request({method:"roots/list",params:e},Wa,t)}async sendLoggingMessage(e,t){if(this._capabilities.logging&&!this.isMessageIgnored(e.level,t))return this.notification({method:"notifications/message",params:e})}async sendResourceUpdated(e){return this.notification({method:"notifications/resources/updated",params:e})}async sendResourceListChanged(){return this.notification({method:"notifications/resources/list_changed"})}async sendToolListChanged(){return this.notification({method:"notifications/tools/list_changed"})}async sendPromptListChanged(){return this.notification({method:"notifications/prompts/list_changed"})}};var ys=Da(require("node:process"),1);var ga=class{append(e){this._buffer=this._buffer?Buffer.concat([this._buffer,e]):e}readMessage(){if(!this._buffer)return null;let e=this._buffer.indexOf(`
`);if(e===-1)return null;let t=this._buffer.toString("utf8",0,e).replace(/\r$/,"");return this._buffer=this._buffer.subarray(e+1),wf(t)}clear(){this._buffer=void 0}};function wf(a){return dn.parse(JSON.parse(a))}function Pi(a){return JSON.stringify(a)+`
`}var ya=class{constructor(e=ys.default.stdin,t=ys.default.stdout){this._stdin=e,this._stdout=t,this._readBuffer=new ga,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=Pi(e);this._stdout.write(s)?t():this._stdout.once("drain",t)})}};var wi=Symbol("Let zodToJsonSchema decide on which parser to use");var xi={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"},Ti=a=>typeof a=="string"?{...xi,name:a}:{...xi,...a};var Ri=a=>{let e=Ti(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 _s(a,e,t,s){s?.errorMessages&&t&&(a.errorMessage={...a.errorMessage,[e]:t})}function ee(a,e,t,s,r){a[e]=t,_s(a,e,s,r)}var _a=(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"?_a(e,a.currentPath):e.join("/")}}function Oi(a,e){let t={type:"array"};return a.type?._def&&a.type?._def?.typeName!==R.ZodAny&&(t.items=B(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 Ai(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 Di(){return{type:"boolean"}}function Ea(a,e){return B(a.type._def,e)}var Ii=(a,e)=>B(a.innerType._def,e);function Es(a,e,t){let s=t??e.dateStrategy;if(Array.isArray(s))return{anyOf:s.map((r,n)=>Es(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 Tf(a,e)}}var Tf=(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 ki(a,e){return{...B(a.innerType._def,e),default:a.defaultValue()}}function $i(a,e){return e.effectStrategy==="input"?B(a.schema._def,e):fe(e)}function Ci(a){return{type:"string",enum:Array.from(a.values)}}var Rf=a=>"type"in a&&a.type==="string"?!1:"allOf"in a;function Ni(a,e){let t=[B(a.left._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),B(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(Rf(n))r.push(...n.allOf),n.unevaluatedProperties===void 0&&(s=void 0);else{let l=n;if("additionalProperties"in n&&n.additionalProperties===!1){let{additionalProperties:i,...d}=n;l=d}else s=void 0;r.push(l)}}),r.length?{allOf:r,...s}:void 0}function ji(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 Ss,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:()=>(Ss===void 0&&(Ss=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),Ss),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 Sa(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":ke(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":ke(t,s.regex,s.message,e);break;case"cuid":ke(t,Xe.cuid,s.message,e);break;case"cuid2":ke(t,Xe.cuid2,s.message,e);break;case"startsWith":ke(t,RegExp(`^${bs(s.value,e)}`),s.message,e);break;case"endsWith":ke(t,RegExp(`${bs(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":{ke(t,RegExp(bs(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":ke(t,Xe.base64url,s.message,e);break;case"jwt":ke(t,Xe.jwt,s.message,e);break;case"cidr":{s.version!=="v6"&&ke(t,Xe.ipv4Cidr,s.message,e),s.version!=="v4"&&ke(t,Xe.ipv6Cidr,s.message,e);break}case"emoji":ke(t,Xe.emoji(),s.message,e);break;case"ulid":{ke(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":{ke(t,Xe.base64,s.message,e);break}}break}case"nanoid":ke(t,Xe.nanoid,s.message,e);case"toLowerCase":case"toUpperCase":case"trim":break;default:}return t}function bs(a,e){return e.patternStrategy==="escape"?Af(a):a}var Of=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function Af(a){let e="";for(let t=0;t<a.length;t++)Of.has(a[t])||(e+="\\"),e+=a[t];return e}function er(a,e,t,s){a.format||a.anyOf?.some(r=>r.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 ke(a,e,t,s){a.pattern||a.allOf?.some(r=>r.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:Li(e,s),...t&&s.errorMessages&&{errorMessage:{pattern:t}}})):ee(a,"pattern",Li(e,s),t,s)}function Li(a,e){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,l=!1,i=!1;for(let d=0;d<s.length;d++){if(n){r+=s[d],n=!1;continue}if(t.i){if(l){if(s[d].match(/[a-z]/)){i?(r+=s[d],r+=`${s[d-2]}-${s[d]}`.toUpperCase(),i=!1):s[d+1]==="-"&&s[d+2]?.match(/[a-z]/)?(r+=s[d],i=!0):r+=`${s[d]}${s[d].toUpperCase()}`;continue}}else if(s[d].match(/[a-z]/)){r+=`[${s[d]}${s[d].toUpperCase()}]`;continue}}if(t.m){if(s[d]==="^"){r+=`(^|(?<=[\r
]))`;continue}else if(s[d]==="$"){r+=`($|(?=[\r
]))`;continue}}if(t.s&&s[d]==="."){r+=l?`${s[d]}\r
`:`[${s[d]}\r
]`;continue}r+=s[d],s[d]==="\\"?n=!0:l&&s[d]==="]"?l=!1:!l&&s[d]==="["&&(l=!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 ba(a,e){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"&&a.keyType?._def.typeName===R.ZodEnum)return{type:"object",required:a.keyType._def.values,properties:a.keyType._def.values.reduce((s,r)=>({...s,[r]:B(a.valueType._def,{...e,currentPath:[...e.currentPath,"properties",r]})??fe(e)}),{}),additionalProperties:e.rejectedAdditionalProperties};let t={type:"object",additionalProperties:B(a.valueType._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??e.allowedAdditionalProperties};if(e.target==="openApi3")return t;if(a.keyType?._def.typeName===R.ZodString&&a.keyType._def.checks?.length){let{type:s,...r}=Sa(a.keyType._def,e);return{...t,propertyNames:r}}else{if(a.keyType?._def.typeName===R.ZodEnum)return{...t,propertyNames:{enum:a.keyType._def.values}};if(a.keyType?._def.typeName===R.ZodBranded&&a.keyType._def.type._def.typeName===R.ZodString&&a.keyType._def.type._def.checks?.length){let{type:s,...r}=Ea(a.keyType._def,e);return{...t,propertyNames:r}}}return t}function Mi(a,e){if(e.mapStrategy==="record")return ba(a,e);let t=B(a.keyType._def,{...e,currentPath:[...e.currentPath,"items","items","0"]})||fe(e),s=B(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 Fi(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 Ui(a){return a.target==="openAi"?void 0:{not:fe({...a,currentPath:[...a.currentPath,"not"]})}}function qi(a){return a.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}var It={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function zi(a,e){if(e.target==="openApi3")return Vi(a,e);let t=a.options instanceof Map?Array.from(a.options.values()):a.options;if(t.every(s=>s._def.typeName in It&&(!s._def.checks||!s._def.checks.length))){let s=t.reduce((r,n)=>{let l=It[n._def.typeName];return l&&!r.includes(l)?[...r,l]: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 l=typeof n._def.value;switch(l){case"string":case"number":case"boolean":return[...r,l];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,l,i)=>i.indexOf(n)===l);return{type:r.length>1?r:r[0],enum:t.reduce((n,l)=>n.includes(l._def.value)?n:[...n,l._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 Vi(a,e)}var Vi=(a,e)=>{let t=(a.options instanceof Map?Array.from(a.options.values()):a.options).map((s,r)=>B(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 Hi(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:It[a.innerType._def.typeName],nullable:!0}:{type:[It[a.innerType._def.typeName],"null"]};if(e.target==="openApi3"){let s=B(a.innerType._def,{...e,currentPath:[...e.currentPath]});return s&&"$ref"in s?{allOf:[s],nullable:!0}:s&&{...s,nullable:!0}}let t=B(a.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","0"]});return t&&{anyOf:[t,{type:"null"}]}}function Zi(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",_s(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 Bi(a,e){let t=e.target==="openAi",s={type:"object",properties:{}},r=[],n=a.shape();for(let i in n){let d=n[i];if(d===void 0||d._def===void 0)continue;let f=If(d);f&&t&&(d._def.typeName==="ZodOptional"&&(d=d._def.innerType),d.isNullable()||(d=d.nullable()),f=!1);let p=B(d._def,{...e,currentPath:[...e.currentPath,"properties",i],propertyPath:[...e.currentPath,"properties",i]});p!==void 0&&(s.properties[i]=p,f||r.push(i))}r.length&&(s.required=r);let l=Df(a,e);return l!==void 0&&(s.additionalProperties=l),s}function Df(a,e){if(a.catchall._def.typeName!=="ZodNever")return B(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 If(a){try{return a.isOptional()}catch{return!0}}var Wi=(a,e)=>{if(e.currentPath.toString()===e.propertyPath?.toString())return B(a.innerType._def,e);let t=B(a.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","1"]});return t?{anyOf:[{not:fe(e)},t]}:fe(e)};var Ki=(a,e)=>{if(e.pipeStrategy==="input")return B(a.in._def,e);if(e.pipeStrategy==="output")return B(a.out._def,e);let t=B(a.in._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),s=B(a.out._def,{...e,currentPath:[...e.currentPath,"allOf",t?"1":"0"]});return{allOf:[t,s].filter(r=>r!==void 0)}};function Qi(a,e){return B(a.type._def,e)}function Ji(a,e){let s={type:"array",uniqueItems:!0,items:B(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 Gi(a,e){return a.rest?{type:"array",minItems:a.items.length,items:a.items.map((t,s)=>B(t._def,{...e,currentPath:[...e.currentPath,"items",`${s}`]})).reduce((t,s)=>s===void 0?t:[...t,s],[]),additionalItems:B(a.rest._def,{...e,currentPath:[...e.currentPath,"additionalItems"]})}:{type:"array",minItems:a.items.length,maxItems:a.items.length,items:a.items.map((t,s)=>B(t._def,{...e,currentPath:[...e.currentPath,"items",`${s}`]})).reduce((t,s)=>s===void 0?t:[...t,s],[])}}function Yi(a){return{not:fe(a)}}function Xi(a){return fe(a)}var el=(a,e)=>B(a.innerType._def,e);var rl=(a,e,t)=>{switch(e){case R.ZodString:return Sa(a,t);case R.ZodNumber:return Zi(a,t);case R.ZodObject:return Bi(a,t);case R.ZodBigInt:return Ai(a,t);case R.ZodBoolean:return Di();case R.ZodDate:return Es(a,t);case R.ZodUndefined:return Yi(t);case R.ZodNull:return qi(t);case R.ZodArray:return Oi(a,t);case R.ZodUnion:case R.ZodDiscriminatedUnion:return zi(a,t);case R.ZodIntersection:return Ni(a,t);case R.ZodTuple:return Gi(a,t);case R.ZodRecord:return ba(a,t);case R.ZodLiteral:return ji(a,t);case R.ZodEnum:return Ci(a);case R.ZodNativeEnum:return Fi(a);case R.ZodNullable:return Hi(a,t);case R.ZodOptional:return Wi(a,t);case R.ZodMap:return Mi(a,t);case R.ZodSet:return Ji(a,t);case R.ZodLazy:return()=>a.getter()._def;case R.ZodPromise:return Qi(a,t);case R.ZodNaN:case R.ZodNever:return Ui(t);case R.ZodEffects:return $i(a,t);case R.ZodAny:return fe(t);case R.ZodUnknown:return Xi(t);case R.ZodDefault:return ki(a,t);case R.ZodBranded:return Ea(a,t);case R.ZodReadonly:return el(a,t);case R.ZodCatch:return Ii(a,t);case R.ZodPipeline:return Ki(a,t);case R.ZodFunction:case R.ZodVoid:case R.ZodSymbol:return;default:return(s=>{})(e)}};function B(a,e,t=!1){let s=e.seen.get(a);if(e.override){let i=e.override?.(a,e,s,t);if(i!==wi)return i}if(s&&!t){let i=kf(s,e);if(i!==void 0)return i}let r={def:a,path:e.currentPath,jsonSchema:void 0};e.seen.set(a,r);let n=rl(a,a.typeName,e),l=typeof n=="function"?B(n(),e):n;if(l&&$f(a,e,l),e.postProcess){let i=e.postProcess(l,a,e);return r.jsonSchema=l,i}return r.jsonSchema=l,l}var kf=(a,e)=>{switch(e.$refStrategy){case"root":return{$ref:a.path.join("/")};case"relative":return{$ref:_a(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}},$f=(a,e,t)=>(a.description&&(t.description=a.description,e.markdownDescription&&(t.markdownDescription=a.description)),t);var Ps=(a,e)=>{let t=Ri(e),s=typeof e=="object"&&e.definitions?Object.entries(e.definitions).reduce((d,[f,p])=>({...d,[f]:B(p._def,{...t,currentPath:[...t.basePath,t.definitionPath,f]},!0)??fe(t)}),{}):void 0,r=typeof e=="string"?e:e?.nameStrategy==="title"?void 0:e?.name,n=B(a._def,r===void 0?t:{...t,currentPath:[...t.basePath,t.definitionPath,r]},!1)??fe(t),l=typeof e=="object"&&e.name!==void 0&&e.nameStrategy==="title"?e.name:void 0;l!==void 0&&(n.title=l),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};var pt=require("fs"),sl=require("path"),nl=require("os");var Cf=["bugfix","feature","refactor","discovery","decision","change"],Nf=["how-it-works","why-it-exists","what-changed","problem-solution","gotcha","pattern","trade-off"];var tl=Cf.join(","),al=Nf.join(",");var rr=class{static DEFAULTS={CLAUDE_MEM_MODEL:"claude-sonnet-4-5",CLAUDE_MEM_CONTEXT_OBSERVATIONS:"50",CLAUDE_MEM_WORKER_PORT:"37777",CLAUDE_MEM_WORKER_HOST:"127.0.0.1",CLAUDE_MEM_SKIP_TOOLS:"ListMcpResourcesTool,SlashCommand,Skill,TodoWrite,AskUserQuestion",CLAUDE_MEM_DATA_DIR:(0,sl.join)((0,nl.homedir)(),".claude-mem"),CLAUDE_MEM_LOG_LEVEL:"INFO",CLAUDE_MEM_PYTHON_VERSION:"3.13",CLAUDE_CODE_PATH:"",CLAUDE_MEM_CONTEXT_SHOW_READ_TOKENS:"true",CLAUDE_MEM_CONTEXT_SHOW_WORK_TOKENS:"true",CLAUDE_MEM_CONTEXT_SHOW_SAVINGS_AMOUNT:"true",CLAUDE_MEM_CONTEXT_SHOW_SAVINGS_PERCENT:"true",CLAUDE_MEM_CONTEXT_OBSERVATION_TYPES:tl,CLAUDE_MEM_CONTEXT_OBSERVATION_CONCEPTS:al,CLAUDE_MEM_CONTEXT_FULL_COUNT:"5",CLAUDE_MEM_CONTEXT_FULL_FIELD:"narrative",CLAUDE_MEM_CONTEXT_SESSION_COUNT:"10",CLAUDE_MEM_CONTEXT_SHOW_LAST_SUMMARY:"true",CLAUDE_MEM_CONTEXT_SHOW_LAST_MESSAGE:"false"};static getAllDefaults(){return{...this.DEFAULTS}}static get(e){return this.DEFAULTS[e]}static getInt(e){let t=this.get(e);return parseInt(t,10)}static getBool(e){return this.get(e)==="true"}static loadFromFile(e){if(!(0,pt.existsSync)(e))return this.getAllDefaults();let t=(0,pt.readFileSync)(e,"utf-8"),s=JSON.parse(t),r=s;if(s.env&&typeof s.env=="object"){r=s.env;try{(0,pt.writeFileSync)(e,JSON.stringify(r,null,2),"utf-8"),ye.info("SETTINGS","Migrated settings file from nested to flat schema",{settingsPath:e})}catch(l){ye.warn("SETTINGS","Failed to auto-migrate settings file",{settingsPath:e},l)}}let n={...this.DEFAULTS};for(let l of Object.keys(this.DEFAULTS))r[l]!==void 0&&(n[l]=r[l]);return n}};var xs=(n=>(n[n.DEBUG=0]="DEBUG",n[n.INFO=1]="INFO",n[n.WARN=2]="WARN",n[n.ERROR=3]="ERROR",n[n.SILENT=4]="SILENT",n))(xs||{}),ws=class{level=null;useColor;constructor(){this.useColor=process.stdout.isTTY??!1}getLevel(){if(this.level===null){let e=rr.get("CLAUDE_MEM_LOG_LEVEL").toUpperCase();this.level=xs[e]??1}return this.level}correlationId(e,t){return`obs-${e}-${t}`}sessionId(e){return`session-${e}`}formatData(e){if(e==null)return"";if(typeof e=="string")return e;if(typeof e=="number"||typeof e=="boolean")return e.toString();if(typeof e=="object"){if(e instanceof Error)return this.getLevel()===0?`${e.message}
${e.stack}`:e.message;if(Array.isArray(e))return`[${e.length} items]`;let t=Object.keys(e);return t.length===0?"{}":t.length<=3?JSON.stringify(e):`{${t.length} keys: ${t.slice(0,3).join(", ")}...}`}return String(e)}formatTool(e,t){if(!t)return e;try{let s=typeof t=="string"?JSON.parse(t):t;if(e==="Bash"&&s.command){let r=s.command.length>50?s.command.substring(0,50)+"...":s.command;return`${e}(${r})`}if(e==="Read"&&s.file_path){let r=s.file_path.split("/").pop()||s.file_path;return`${e}(${r})`}if(e==="Edit"&&s.file_path){let r=s.file_path.split("/").pop()||s.file_path;return`${e}(${r})`}if(e==="Write"&&s.file_path){let r=s.file_path.split("/").pop()||s.file_path;return`${e}(${r})`}return e}catch{return e}}formatTimestamp(e){let t=e.getFullYear(),s=String(e.getMonth()+1).padStart(2,"0"),r=String(e.getDate()).padStart(2,"0"),n=String(e.getHours()).padStart(2,"0"),l=String(e.getMinutes()).padStart(2,"0"),i=String(e.getSeconds()).padStart(2,"0"),d=String(e.getMilliseconds()).padStart(3,"0");return`${t}-${s}-${r} ${n}:${l}:${i}.${d}`}log(e,t,s,r,n){if(e<this.getLevel())return;let l=this.formatTimestamp(new Date),i=xs[e].padEnd(5),d=t.padEnd(6),f="";r?.correlationId?f=`[${r.correlationId}] `:r?.sessionId&&(f=`[session-${r.sessionId}] `);let p="";n!=null&&(this.getLevel()===0&&typeof n=="object"?p=`
`+JSON.stringify(n,null,2):p=" "+this.formatData(n));let m="";if(r){let{sessionId:c,sdkSessionId:y,correlationId:_,...v}=r;Object.keys(v).length>0&&(m=` {${Object.entries(v).map(([O,x])=>`${O}=${x}`).join(", ")}}`)}let E=`[${l}] [${i}] [${d}] ${f}${s}${m}${p}`;e===3?console.error(E):console.log(E)}debug(e,t,s,r){this.log(0,e,t,s,r)}info(e,t,s,r){this.log(1,e,t,s,r)}warn(e,t,s,r){this.log(2,e,t,s,r)}error(e,t,s,r){this.log(3,e,t,s,r)}dataIn(e,t,s,r){this.info(e,`\u2192 ${t}`,s,r)}dataOut(e,t,s,r){this.info(e,`\u2190 ${t}`,s,r)}success(e,t,s,r){this.info(e,`\u2713 ${t}`,s,r)}failure(e,t,s,r){this.error(e,`\u2717 ${t}`,s,r)}timing(e,t,s,r){this.info(e,`\u23F1 ${t}`,r,{duration:`${s}ms`})}happyPathError(e,t,s,r,n=""){let f=((new Error().stack||"").split(`
`)[2]||"").match(/at\s+(?:.*\s+)?\(?([^:]+):(\d+):(\d+)\)?/),p=f?`${f[1].split("/").pop()}:${f[2]}`:"unknown",m={...s,location:p};return this.warn(e,`[HAPPY-PATH] ${t}`,m,r),n}},ye=new ws;var xa=Da(require("path"),1),Os=require("os");var Ts={DEFAULT:5e3,HEALTH_CHECK:1e3,WORKER_STARTUP_WAIT:1e3,WORKER_STARTUP_RETRIES:15,PRE_RESTART_SETTLE_DELAY:2e3,WINDOWS_MULTIPLIER:1.5};function ol(a){return process.platform==="win32"?Math.round(a*Ts.WINDOWS_MULTIPLIER):a}var Pa=require("path");var cl=require("os");var $e=require("path"),il=require("os");var ll=require("url");var Lf={};function jf(){return typeof __dirname<"u"?__dirname:(0,$e.dirname)((0,ll.fileURLToPath)(Lf.url))}var $g=jf(),cr=rr.get("CLAUDE_MEM_DATA_DIR"),Rs=process.env.CLAUDE_CONFIG_DIR||(0,$e.join)((0,il.homedir)(),".claude"),Cg=(0,$e.join)(cr,"archives"),Ng=(0,$e.join)(cr,"logs"),jg=(0,$e.join)(cr,"trash"),Lg=(0,$e.join)(cr,"backups"),Mg=(0,$e.join)(cr,"settings.json"),Fg=(0,$e.join)(cr,"claude-mem.db"),Ug=(0,$e.join)(cr,"vector-db"),qg=(0,$e.join)(Rs,"settings.json"),Vg=(0,$e.join)(Rs,"commands"),zg=(0,$e.join)(Rs,"CLAUDE.md");var Jg=(0,Pa.join)(cr,"worker.pid"),Gg=(0,Pa.join)(cr,"logs"),Yg=(0,Pa.join)((0,cl.homedir)(),".claude","plugins","marketplaces","thedotmack");var ly=xa.default.join((0,Os.homedir)(),".claude","plugins","marketplaces","thedotmack"),cy=ol(Ts.HEALTH_CHECK),ht=null;function ul(){if(ht!==null)return ht;try{let a=xa.default.join(rr.get("CLAUDE_MEM_DATA_DIR"),"settings.json"),e=rr.loadFromFile(a);return ht=parseInt(e.CLAUDE_MEM_WORKER_PORT,10),ht}catch(a){return ye.debug("SYSTEM","Failed to load port from settings, using default",{error:a}),ht=parseInt(rr.get("CLAUDE_MEM_WORKER_PORT"),10),ht}}function dl(){let a=xa.default.join((0,Os.homedir)(),".claude-mem","settings.json");return rr.loadFromFile(a).CLAUDE_MEM_WORKER_HOST}var Mf=ul(),Ff=dl(),mt=`http://${Ff}:${Mf}`,kt={search:"/api/search",timeline:"/api/timeline",get_recent_context:"/api/context/recent",get_context_timeline:"/api/context/timeline",help:"/api/instructions"};async function $t(a,e){ye.debug("SYSTEM","\u2192 Worker API",void 0,{endpoint:a,params:e});try{let t=new URLSearchParams;for(let[l,i]of Object.entries(e))i!=null&&t.append(l,String(i));let s=`${mt}${a}?${t}`,r=await fetch(s);if(!r.ok){let l=await r.text();throw new Error(`Worker API error (${r.status}): ${l}`)}let n=await r.json();return ye.debug("SYSTEM","\u2190 Worker API success",void 0,{endpoint:a}),n}catch(t){return ye.error("SYSTEM","\u2190 Worker API error",void 0,{endpoint:a,error:t.message}),{content:[{type:"text",text:`Error calling Worker API: ${t.message}`}],isError:!0}}}async function As(a,e){ye.debug("HTTP","Worker API request (path)",void 0,{endpoint:a,id:e});try{let t=`${mt}${a}/${e}`,s=await fetch(t);if(!s.ok){let n=await s.text();throw new Error(`Worker API error (${s.status}): ${n}`)}let r=await s.json();return ye.debug("HTTP","Worker API success (path)",void 0,{endpoint:a,id:e}),{content:[{type:"text",text:JSON.stringify(r,null,2)}]}}catch(t){return ye.error("HTTP","Worker API error (path)",void 0,{endpoint:a,id:e,error:t.message}),{content:[{type:"text",text:`Error calling Worker API: ${t.message}`}],isError:!0}}}async function Uf(a,e){ye.debug("HTTP","Worker API request (POST)",void 0,{endpoint:a});try{let t=`${mt}${a}`,s=await fetch(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!s.ok){let n=await s.text();throw new Error(`Worker API error (${s.status}): ${n}`)}let r=await s.json();return ye.debug("HTTP","Worker API success (POST)",void 0,{endpoint:a}),{content:[{type:"text",text:JSON.stringify(r,null,2)}]}}catch(t){return ye.error("HTTP","Worker API error (POST)",void 0,{endpoint:a,error:t.message}),{content:[{type:"text",text:`Error calling Worker API: ${t.message}`}],isError:!0}}}async function qf(){try{return(await fetch(`${mt}/api/health`)).ok}catch{return!1}}var fl=[{name:"search",description:"Search memory",inputSchema:o.object({query:o.string().optional(),type:o.enum(["observations","sessions","prompts"]).optional(),obs_type:o.string().optional(),concepts:o.string().optional(),files:o.string().optional(),project:o.string().optional(),dateStart:o.union([o.string(),o.number()]).optional(),dateEnd:o.union([o.string(),o.number()]).optional(),limit:o.number().min(1).max(100).default(20),offset:o.number().min(0).default(0),orderBy:o.enum(["relevance","date_desc","date_asc"]).default("date_desc")}),handler:async a=>{let e=kt.search;return await $t(e,a)}},{name:"timeline",description:"Timeline context",inputSchema:o.object({query:o.string().optional(),anchor:o.number().optional(),depth_before:o.number().min(0).max(100).default(10),depth_after:o.number().min(0).max(100).default(10),type:o.string().optional(),concepts:o.string().optional(),files:o.string().optional(),project:o.string().optional()}),handler:async a=>{let e=kt.timeline;return await $t(e,a)}},{name:"get_recent_context",description:"Recent context",inputSchema:o.object({limit:o.number().min(1).max(100).default(30),type:o.string().optional(),concepts:o.string().optional(),files:o.string().optional(),project:o.string().optional(),dateStart:o.union([o.string(),o.number()]).optional(),dateEnd:o.union([o.string(),o.number()]).optional()}),handler:async a=>{let e=kt.get_recent_context;return await $t(e,a)}},{name:"get_context_timeline",description:"Timeline around ID",inputSchema:o.object({anchor:o.number(),depth_before:o.number().min(0).max(100).default(10),depth_after:o.number().min(0).max(100).default(10),type:o.string().optional(),concepts:o.string().optional(),files:o.string().optional(),project:o.string().optional()}),handler:async a=>{let e=kt.get_context_timeline;return await $t(e,a)}},{name:"help",description:"Usage help",inputSchema:o.object({topic:o.enum(["workflow","search_params","examples","all"]).default("all")}),handler:async a=>{let e=kt.help;return await $t(e,a)}},{name:"get_observation",description:"Fetch by ID",inputSchema:o.object({id:o.number()}),handler:async a=>await As("/api/observation",a.id)},{name:"get_observations",description:"Batch fetch",inputSchema:o.object({ids:o.array(o.number()),orderBy:o.enum(["date_desc","date_asc"]).optional(),limit:o.number().optional(),project:o.string().optional()}),handler:async a=>await Uf("/api/observations/batch",a)},{name:"get_session",description:"Session by ID",inputSchema:o.object({id:o.number()}),handler:async a=>await As("/api/session",a.id)},{name:"get_prompt",description:"Prompt by ID",inputSchema:o.object({id:o.number()}),handler:async a=>await As("/api/prompt",a.id)}],Ds=new va({name:"mem-search-server",version:"1.0.0"},{capabilities:{tools:{}}});Ds.setRequestHandler(Va,async()=>({tools:fl.map(a=>({name:a.name,description:a.description,inputSchema:Ps(a.inputSchema)}))}));Ds.setRequestHandler(za,async a=>{let e=fl.find(t=>t.name===a.params.name);if(!e)throw new Error(`Unknown tool: ${a.params.name}`);try{return await e.handler(a.params.arguments||{})}catch(t){return{content:[{type:"text",text:`Tool execution failed: ${t.message}`}],isError:!0}}});async function pl(){ye.info("SYSTEM","MCP server shutting down"),process.exit(0)}process.on("SIGTERM",pl);process.on("SIGINT",pl);async function Vf(){let a=new ya;await Ds.connect(a),ye.info("SYSTEM","Claude-mem search server started"),setTimeout(async()=>{await qf()?ye.info("SYSTEM","Worker available",void 0,{workerUrl:mt}):(ye.warn("SYSTEM","Worker not available",void 0,{workerUrl:mt}),ye.warn("SYSTEM","Tools will fail until Worker is started"),ye.warn("SYSTEM","Start Worker with: npm run worker:restart"))},0)}Vf().catch(a=>{ye.error("SYSTEM","Fatal error",void 0,a),process.exit(1)});
/*! Bundled license information:
uri-js/dist/es5/uri.all.js:
(** @license URI.js v4.4.1 (c) 2011 Gary Court. License: http://github.com/garycourt/uri-js *)
*/