Files
claude-mem/plugin/scripts/mcp-server.cjs
Alex Newman c4af31f48d Optimize MCP tool token usage with schema reference pattern
Reduces MCP tool token consumption by ~90% through progressive disclosure. Tools now show minimal schemas with get_schema() for details on demand.
2025-12-17 22:47:30 -05:00

17 lines
217 KiB
JavaScript
Executable File

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