mirror of
https://github.com/thedotmack/claude-mem
synced 2026-04-25 17:15:04 +02:00
- Implemented a method to check if Bun is available in the system PATH. - Updated the startWithBun method to return an error if Bun is not found. - Enhanced PID file parsing to validate required fields and their types. - Cleaned up stale PID files if the process is no longer alive. fix(SettingsRoutes): clear port cache after updating settings - Added a call to clearPortCache after writing updated settings to ensure the application uses the latest configuration.
18 lines
248 KiB
JavaScript
Executable File
18 lines
248 KiB
JavaScript
Executable File
#!/usr/bin/env bun
|
|
"use strict";var Nl=Object.create;var Aa=Object.defineProperty;var jl=Object.getOwnPropertyDescriptor;var Fl=Object.getOwnPropertyNames;var Ll=Object.getPrototypeOf,Ml=Object.prototype.hasOwnProperty;var K=(a,e)=>()=>(e||a((e={exports:{}}).exports,e),e.exports),ql=(a,e)=>{for(var t in e)Aa(a,t,{get:e[t],enumerable:!0})},Ul=(a,e,t,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of Fl(e))!Ml.call(a,r)&&r!==t&&Aa(a,r,{get:()=>e[r],enumerable:!(s=jl(e,r))||s.enumerable});return a};var Da=(a,e,t)=>(t=a!=null?Nl(Ll(a)):{},Ul(e||!a||!a.__esModule?Aa(t,"default",{value:a,enumerable:!0}):t,a));var bn=K((Yt,_n)=>{(function(a,e){typeof Yt=="object"&&typeof _n<"u"?e(Yt):typeof define=="function"&&define.amd?define(["exports"],e):e(a.URI=a.URI||{})})(Yt,(function(a){"use strict";function e(){for(var h=arguments.length,u=Array(h),g=0;g<h;g++)u[g]=arguments[g];if(u.length>1){u[0]=u[0].slice(0,-1);for(var E=u.length-1,S=1;S<E;++S)u[S]=u[S].slice(1,-1);return u[E]=u[E].slice(1),u.join("")}else return u[0]}function t(h){return"(?:"+h+")"}function s(h){return h===void 0?"undefined":h===null?"null":Object.prototype.toString.call(h).split(" ").pop().split("]").shift().toLowerCase()}function r(h){return h.toUpperCase()}function n(h){return h!=null?h instanceof Array?h:typeof h.length!="number"||h.split||h.setInterval||h.call?[h]:Array.prototype.slice.call(h):[]}function l(h,u){var g=h;if(u)for(var E in u)g[E]=u[E];return g}function o(h){var u="[A-Za-z]",g="[\\x0D]",E="[0-9]",S="[\\x22]",j=e(E,"[A-Fa-f]"),W="[\\x0A]",ae="[\\x20]",oe=t(t("%[EFef]"+j+"%"+j+j+"%"+j+j)+"|"+t("%[89A-Fa-f]"+j+"%"+j+j)+"|"+t("%"+j+j)),be="[\\:\\/\\?\\#\\[\\]\\@]",te="[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=]",pe=e(be,te),Ee=h?"[\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]":"[]",de=h?"[\\uE000-\\uF8FF]":"[]",ne=e(u,E,"[\\-\\.\\_\\~]",Ee),he=t(u+e(u,E,"[\\+\\-\\.]")+"*"),ce=t(t(oe+"|"+e(ne,te,"[\\:]"))+"*"),$r=t(t("25[0-5]")+"|"+t("2[0-4]"+E)+"|"+t("1"+E+E)+"|"+t("[1-9]"+E)+"|"+E),qe=t(t("25[0-5]")+"|"+t("2[0-4]"+E)+"|"+t("1"+E+E)+"|"+t("0?[1-9]"+E)+"|0?0?"+E),ze=t(qe+"\\."+qe+"\\."+qe+"\\."+qe),ue=t(j+"{1,4}"),Ue=t(t(ue+"\\:"+ue)+"|"+ze),He=t(t(ue+"\\:")+"{6}"+Ue),nr=t("\\:\\:"+t(ue+"\\:")+"{5}"+Ue),kr=t(t(ue)+"?\\:\\:"+t(ue+"\\:")+"{4}"+Ue),hr=t(t(t(ue+"\\:")+"{0,1}"+ue)+"?\\:\\:"+t(ue+"\\:")+"{3}"+Ue),_t=t(t(t(ue+"\\:")+"{0,2}"+ue)+"?\\:\\:"+t(ue+"\\:")+"{2}"+Ue),Nt=t(t(t(ue+"\\:")+"{0,3}"+ue)+"?\\:\\:"+ue+"\\:"+Ue),jt=t(t(t(ue+"\\:")+"{0,4}"+ue)+"?\\:\\:"+Ue),rt=t(t(t(ue+"\\:")+"{0,5}"+ue)+"?\\:\\:"+ue),tt=t(t(t(ue+"\\:")+"{0,6}"+ue)+"?\\:\\:"),mr=t([He,nr,kr,hr,_t,Nt,jt,rt,tt].join("|")),at=t(t(ne+"|"+oe)+"+"),Ra=t(mr+"\\%25"+at),Nr=t(mr+t("\\%25|\\%(?!"+j+"{2})")+at),Tl=t("[vV]"+j+"+\\."+e(ne,te,"[\\:]")+"+"),Al=t("\\["+t(Nr+"|"+mr+"|"+Tl)+"\\]"),Ls=t(t(oe+"|"+e(ne,te))+"*"),bt=t(Al+"|"+ze+"(?!"+Ls+")|"+Ls),Et=t(E+"*"),Ms=t(t(ce+"@")+"?"+bt+t("\\:"+Et)+"?"),St=t(oe+"|"+e(ne,te,"[\\:\\@]")),Dl=t(St+"*"),qs=t(St+"+"),Il=t(t(oe+"|"+e(ne,te,"[\\@]"))+"+"),vr=t(t("\\/"+Dl)+"*"),st=t("\\/"+t(qs+vr)+"?"),Ta=t(Il+vr),Ft=t(qs+vr),nt="(?!"+St+")",Hf=t(vr+"|"+st+"|"+Ta+"|"+Ft+"|"+nt),it=t(t(St+"|"+e("[\\/\\?]",de))+"*"),xt=t(t(St+"|[\\/\\?]")+"*"),Us=t(t("\\/\\/"+Ms+vr)+"|"+st+"|"+Ft+"|"+nt),Cl=t(he+"\\:"+Us+t("\\?"+it)+"?"+t("\\#"+xt)+"?"),$l=t(t("\\/\\/"+Ms+vr)+"|"+st+"|"+Ta+"|"+nt),kl=t($l+t("\\?"+it)+"?"+t("\\#"+xt)+"?"),Zf=t(Cl+"|"+kl),Bf=t(he+"\\:"+Us+t("\\?"+it)+"?"),Kf="^("+he+")\\:"+t(t("\\/\\/("+t("("+ce+")@")+"?("+bt+")"+t("\\:("+Et+")")+"?)")+"?("+vr+"|"+st+"|"+Ft+"|"+nt+")")+t("\\?("+it+")")+"?"+t("\\#("+xt+")")+"?$",Qf="^(){0}"+t(t("\\/\\/("+t("("+ce+")@")+"?("+bt+")"+t("\\:("+Et+")")+"?)")+"?("+vr+"|"+st+"|"+Ta+"|"+nt+")")+t("\\?("+it+")")+"?"+t("\\#("+xt+")")+"?$",Wf="^("+he+")\\:"+t(t("\\/\\/("+t("("+ce+")@")+"?("+bt+")"+t("\\:("+Et+")")+"?)")+"?("+vr+"|"+st+"|"+Ft+"|"+nt+")")+t("\\?("+it+")")+"?$",Jf="^"+t("\\#("+xt+")")+"?$",Gf="^"+t("("+ce+")@")+"?("+bt+")"+t("\\:("+Et+")")+"?$";return{NOT_SCHEME:new RegExp(e("[^]",u,E,"[\\+\\-\\.]"),"g"),NOT_USERINFO:new RegExp(e("[^\\%\\:]",ne,te),"g"),NOT_HOST:new RegExp(e("[^\\%\\[\\]\\:]",ne,te),"g"),NOT_PATH:new RegExp(e("[^\\%\\/\\:\\@]",ne,te),"g"),NOT_PATH_NOSCHEME:new RegExp(e("[^\\%\\/\\@]",ne,te),"g"),NOT_QUERY:new RegExp(e("[^\\%]",ne,te,"[\\:\\@\\/\\?]",de),"g"),NOT_FRAGMENT:new RegExp(e("[^\\%]",ne,te,"[\\:\\@\\/\\?]"),"g"),ESCAPE:new RegExp(e("[^]",ne,te),"g"),UNRESERVED:new RegExp(ne,"g"),OTHER_CHARS:new RegExp(e("[^\\%]",ne,pe),"g"),PCT_ENCODED:new RegExp(oe,"g"),IPV4ADDRESS:new RegExp("^("+ze+")$"),IPV6ADDRESS:new RegExp("^\\[?("+mr+")"+t(t("\\%25|\\%(?!"+j+"{2})")+"("+at+")")+"?\\]?$")}}var d=o(!1),f=o(!0),p=(function(){function h(u,g){var E=[],S=!0,j=!1,W=void 0;try{for(var ae=u[Symbol.iterator](),oe;!(S=(oe=ae.next()).done)&&(E.push(oe.value),!(g&&E.length===g));S=!0);}catch(be){j=!0,W=be}finally{try{!S&&ae.return&&ae.return()}finally{if(j)throw W}}return E}return function(u,g){if(Array.isArray(u))return u;if(Symbol.iterator in Object(u))return h(u,g);throw new TypeError("Invalid attempt to destructure non-iterable instance")}})(),m=function(h){if(Array.isArray(h)){for(var u=0,g=Array(h.length);u<h.length;u++)g[u]=h[u];return g}else return Array.from(h)},b=2147483647,c=36,y=1,_=26,v=38,x=700,T=72,P=128,O="-",D=/^xn--/,I=/[^\0-\x7E]/,z=/[\x2E\u3002\uFF0E\uFF61]/g,q={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},C=c-y,U=Math.floor,M=String.fromCharCode;function F(h){throw new RangeError(q[h])}function A(h,u){for(var g=[],E=h.length;E--;)g[E]=u(h[E]);return g}function $(h,u){var g=h.split("@"),E="";g.length>1&&(E=g[0]+"@",h=g[1]),h=h.replace(z,".");var S=h.split("."),j=A(S,u).join(".");return E+j}function L(h){for(var u=[],g=0,E=h.length;g<E;){var S=h.charCodeAt(g++);if(S>=55296&&S<=56319&&g<E){var j=h.charCodeAt(g++);(j&64512)==56320?u.push(((S&1023)<<10)+(j&1023)+65536):(u.push(S),g--)}else u.push(S)}return u}var le=function(u){return String.fromCodePoint.apply(String,m(u))},Y=function(u){return u-48<10?u-22:u-65<26?u-65:u-97<26?u-97:c},re=function(u,g){return u+22+75*(u<26)-((g!=0)<<5)},G=function(u,g,E){var S=0;for(u=E?U(u/x):u>>1,u+=U(u/g);u>C*_>>1;S+=c)u=U(u/C);return U(S+(C+1)*u/(u+v))},H=function(u){var g=[],E=u.length,S=0,j=P,W=T,ae=u.lastIndexOf(O);ae<0&&(ae=0);for(var oe=0;oe<ae;++oe)u.charCodeAt(oe)>=128&&F("not-basic"),g.push(u.charCodeAt(oe));for(var be=ae>0?ae+1:0;be<E;){for(var te=S,pe=1,Ee=c;;Ee+=c){be>=E&&F("invalid-input");var de=Y(u.charCodeAt(be++));(de>=c||de>U((b-S)/pe))&&F("overflow"),S+=de*pe;var ne=Ee<=W?y:Ee>=W+_?_:Ee-W;if(de<ne)break;var he=c-ne;pe>U(b/he)&&F("overflow"),pe*=he}var ce=g.length+1;W=G(S-te,ce,te==0),U(S/ce)>b-j&&F("overflow"),j+=U(S/ce),S%=ce,g.splice(S++,0,j)}return String.fromCodePoint.apply(String,g)},me=function(u){var g=[];u=L(u);var E=u.length,S=P,j=0,W=T,ae=!0,oe=!1,be=void 0;try{for(var te=u[Symbol.iterator](),pe;!(ae=(pe=te.next()).done);ae=!0){var Ee=pe.value;Ee<128&&g.push(M(Ee))}}catch(Nr){oe=!0,be=Nr}finally{try{!ae&&te.return&&te.return()}finally{if(oe)throw be}}var de=g.length,ne=de;for(de&&g.push(O);ne<E;){var he=b,ce=!0,$r=!1,qe=void 0;try{for(var ze=u[Symbol.iterator](),ue;!(ce=(ue=ze.next()).done);ce=!0){var Ue=ue.value;Ue>=S&&Ue<he&&(he=Ue)}}catch(Nr){$r=!0,qe=Nr}finally{try{!ce&&ze.return&&ze.return()}finally{if($r)throw qe}}var He=ne+1;he-S>U((b-j)/He)&&F("overflow"),j+=(he-S)*He,S=he;var nr=!0,kr=!1,hr=void 0;try{for(var _t=u[Symbol.iterator](),Nt;!(nr=(Nt=_t.next()).done);nr=!0){var jt=Nt.value;if(jt<S&&++j>b&&F("overflow"),jt==S){for(var rt=j,tt=c;;tt+=c){var mr=tt<=W?y:tt>=W+_?_:tt-W;if(rt<mr)break;var at=rt-mr,Ra=c-mr;g.push(M(re(mr+at%Ra,0))),rt=U(at/Ra)}g.push(M(re(rt,0))),W=G(j,He,ne==de),j=0,++ne}}}catch(Nr){kr=!0,hr=Nr}finally{try{!nr&&_t.return&&_t.return()}finally{if(kr)throw hr}}++j,++S}return g.join("")},we=function(u){return $(u,function(g){return D.test(g)?H(g.slice(4).toLowerCase()):g})},Te=function(u){return $(u,function(g){return I.test(g)?"xn--"+me(g):g})},se={version:"2.1.0",ucs2:{decode:L,encode:le},decode:H,encode:me,toASCII:Te,toUnicode:we},ye={};function Se(h){var u=h.charCodeAt(0),g=void 0;return u<16?g="%0"+u.toString(16).toUpperCase():u<128?g="%"+u.toString(16).toUpperCase():u<2048?g="%"+(u>>6|192).toString(16).toUpperCase()+"%"+(u&63|128).toString(16).toUpperCase():g="%"+(u>>12|224).toString(16).toUpperCase()+"%"+(u>>6&63|128).toString(16).toUpperCase()+"%"+(u&63|128).toString(16).toUpperCase(),g}function Ae(h){for(var u="",g=0,E=h.length;g<E;){var S=parseInt(h.substr(g+1,2),16);if(S<128)u+=String.fromCharCode(S),g+=3;else if(S>=194&&S<224){if(E-g>=6){var j=parseInt(h.substr(g+4,2),16);u+=String.fromCharCode((S&31)<<6|j&63)}else u+=h.substr(g,6);g+=6}else if(S>=224){if(E-g>=9){var W=parseInt(h.substr(g+4,2),16),ae=parseInt(h.substr(g+7,2),16);u+=String.fromCharCode((S&15)<<12|(W&63)<<6|ae&63)}else u+=h.substr(g,9);g+=9}else u+=h.substr(g,3),g+=3}return u}function Er(h,u){function g(E){var S=Ae(E);return S.match(u.UNRESERVED)?S:E}return h.scheme&&(h.scheme=String(h.scheme).replace(u.PCT_ENCODED,g).toLowerCase().replace(u.NOT_SCHEME,"")),h.userinfo!==void 0&&(h.userinfo=String(h.userinfo).replace(u.PCT_ENCODED,g).replace(u.NOT_USERINFO,Se).replace(u.PCT_ENCODED,r)),h.host!==void 0&&(h.host=String(h.host).replace(u.PCT_ENCODED,g).toLowerCase().replace(u.NOT_HOST,Se).replace(u.PCT_ENCODED,r)),h.path!==void 0&&(h.path=String(h.path).replace(u.PCT_ENCODED,g).replace(h.scheme?u.NOT_PATH:u.NOT_PATH_NOSCHEME,Se).replace(u.PCT_ENCODED,r)),h.query!==void 0&&(h.query=String(h.query).replace(u.PCT_ENCODED,g).replace(u.NOT_QUERY,Se).replace(u.PCT_ENCODED,r)),h.fragment!==void 0&&(h.fragment=String(h.fragment).replace(u.PCT_ENCODED,g).replace(u.NOT_FRAGMENT,Se).replace(u.PCT_ENCODED,r)),h}function fr(h){return h.replace(/^0*(.*)/,"$1")||"0"}function _e(h,u){var g=h.match(u.IPV4ADDRESS)||[],E=p(g,2),S=E[1];return S?S.split(".").map(fr).join("."):h}function ve(h,u){var g=h.match(u.IPV6ADDRESS)||[],E=p(g,3),S=E[1],j=E[2];if(S){for(var W=S.toLowerCase().split("::").reverse(),ae=p(W,2),oe=ae[0],be=ae[1],te=be?be.split(":").map(fr):[],pe=oe.split(":").map(fr),Ee=u.IPV4ADDRESS.test(pe[pe.length-1]),de=Ee?7:8,ne=pe.length-de,he=Array(de),ce=0;ce<de;++ce)he[ce]=te[ce]||pe[ne+ce]||"";Ee&&(he[de-1]=_e(he[de-1],u));var $r=he.reduce(function(He,nr,kr){if(!nr||nr==="0"){var hr=He[He.length-1];hr&&hr.index+hr.length===kr?hr.length++:He.push({index:kr,length:1})}return He},[]),qe=$r.sort(function(He,nr){return nr.length-He.length})[0],ze=void 0;if(qe&&qe.length>1){var ue=he.slice(0,qe.index),Ue=he.slice(qe.index+qe.length);ze=ue.join(":")+"::"+Ue.join(":")}else ze=he.join(":");return j&&(ze+="%"+j),ze}else return h}var Dr=/^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i,Oe="".match(/(){0}/)[1]===void 0;function ie(h){var u=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},g={},E=u.iri!==!1?f:d;u.reference==="suffix"&&(h=(u.scheme?u.scheme+":":"")+"//"+h);var S=h.match(Dr);if(S){Oe?(g.scheme=S[1],g.userinfo=S[3],g.host=S[4],g.port=parseInt(S[5],10),g.path=S[6]||"",g.query=S[7],g.fragment=S[8],isNaN(g.port)&&(g.port=S[5])):(g.scheme=S[1]||void 0,g.userinfo=h.indexOf("@")!==-1?S[3]:void 0,g.host=h.indexOf("//")!==-1?S[4]:void 0,g.port=parseInt(S[5],10),g.path=S[6]||"",g.query=h.indexOf("?")!==-1?S[7]:void 0,g.fragment=h.indexOf("#")!==-1?S[8]:void 0,isNaN(g.port)&&(g.port=h.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/)?S[4]:void 0)),g.host&&(g.host=ve(_e(g.host,E),E)),g.scheme===void 0&&g.userinfo===void 0&&g.host===void 0&&g.port===void 0&&!g.path&&g.query===void 0?g.reference="same-document":g.scheme===void 0?g.reference="relative":g.fragment===void 0?g.reference="absolute":g.reference="uri",u.reference&&u.reference!=="suffix"&&u.reference!==g.reference&&(g.error=g.error||"URI is not a "+u.reference+" reference.");var j=ye[(u.scheme||g.scheme||"").toLowerCase()];if(!u.unicodeSupport&&(!j||!j.unicodeSupport)){if(g.host&&(u.domainHost||j&&j.domainHost))try{g.host=se.toASCII(g.host.replace(E.PCT_ENCODED,Ae).toLowerCase())}catch(W){g.error=g.error||"Host's domain name can not be converted to ASCII via punycode: "+W}Er(g,d)}else Er(g,E);j&&j.parse&&j.parse(g,u)}else g.error=g.error||"URI can not be parsed.";return g}function Sr(h,u){var g=u.iri!==!1?f:d,E=[];return h.userinfo!==void 0&&(E.push(h.userinfo),E.push("@")),h.host!==void 0&&E.push(ve(_e(String(h.host),g),g).replace(g.IPV6ADDRESS,function(S,j,W){return"["+j+(W?"%25"+W:"")+"]"})),(typeof h.port=="number"||typeof h.port=="string")&&(E.push(":"),E.push(String(h.port))),E.length?E.join(""):void 0}var pr=/^\.\.?\//,Ir=/^\/\.(\/|$)/,Cr=/^\/\.\.(\/|$)/,xe=/^\/?(?:.|\n)*?(?=\/|$)/;function Ve(h){for(var u=[];h.length;)if(h.match(pr))h=h.replace(pr,"");else if(h.match(Ir))h=h.replace(Ir,"/");else if(h.match(Cr))h=h.replace(Cr,"/"),u.pop();else if(h==="."||h==="..")h="";else{var g=h.match(xe);if(g){var E=g[0];h=h.slice(E.length),u.push(E)}else throw new Error("Unexpected dot segment condition")}return u.join("")}function $e(h){var u=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},g=u.iri?f:d,E=[],S=ye[(u.scheme||h.scheme||"").toLowerCase()];if(S&&S.serialize&&S.serialize(h,u),h.host&&!g.IPV6ADDRESS.test(h.host)){if(u.domainHost||S&&S.domainHost)try{h.host=u.iri?se.toUnicode(h.host):se.toASCII(h.host.replace(g.PCT_ENCODED,Ae).toLowerCase())}catch(ae){h.error=h.error||"Host's domain name can not be converted to "+(u.iri?"Unicode":"ASCII")+" via punycode: "+ae}}Er(h,g),u.reference!=="suffix"&&h.scheme&&(E.push(h.scheme),E.push(":"));var j=Sr(h,u);if(j!==void 0&&(u.reference!=="suffix"&&E.push("//"),E.push(j),h.path&&h.path.charAt(0)!=="/"&&E.push("/")),h.path!==void 0){var W=h.path;!u.absolutePath&&(!S||!S.absolutePath)&&(W=Ve(W)),j===void 0&&(W=W.replace(/^\/\//,"/%2F")),E.push(W)}return h.query!==void 0&&(E.push("?"),E.push(h.query)),h.fragment!==void 0&&(E.push("#"),E.push(h.fragment)),E.join("")}function De(h,u){var g=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},E=arguments[3],S={};return E||(h=ie($e(h,g),g),u=ie($e(u,g),g)),g=g||{},!g.tolerant&&u.scheme?(S.scheme=u.scheme,S.userinfo=u.userinfo,S.host=u.host,S.port=u.port,S.path=Ve(u.path||""),S.query=u.query):(u.userinfo!==void 0||u.host!==void 0||u.port!==void 0?(S.userinfo=u.userinfo,S.host=u.host,S.port=u.port,S.path=Ve(u.path||""),S.query=u.query):(u.path?(u.path.charAt(0)==="/"?S.path=Ve(u.path):((h.userinfo!==void 0||h.host!==void 0||h.port!==void 0)&&!h.path?S.path="/"+u.path:h.path?S.path=h.path.slice(0,h.path.lastIndexOf("/")+1)+u.path:S.path=u.path,S.path=Ve(S.path)),S.query=u.query):(S.path=h.path,u.query!==void 0?S.query=u.query:S.query=h.query),S.userinfo=h.userinfo,S.host=h.host,S.port=h.port),S.scheme=h.scheme),S.fragment=u.fragment,S}function ar(h,u,g){var E=l({scheme:"null"},g);return $e(De(ie(h,E),ie(u,E),E,!0),E)}function Me(h,u){return typeof h=="string"?h=$e(ie(h,u),u):s(h)==="object"&&(h=ie($e(h,u),u)),h}function kt(h,u,g){return typeof h=="string"?h=$e(ie(h,g),g):s(h)==="object"&&(h=$e(h,g)),typeof u=="string"?u=$e(ie(u,g),g):s(u)==="object"&&(u=$e(u,g)),h===u}function wa(h,u){return h&&h.toString().replace(!u||!u.iri?d.ESCAPE:f.ESCAPE,Se)}function Je(h,u){return h&&h.toString().replace(!u||!u.iri?d.PCT_ENCODED:f.PCT_ENCODED,Ae)}var gt={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 E=String(u.scheme).toLowerCase()==="https";return(u.port===(E?443:80)||u.port==="")&&(u.port=void 0),u.path||(u.path="/"),u}},Ds={scheme:"https",domainHost:gt.domainHost,parse:gt.parse,serialize:gt.serialize};function Is(h){return typeof h.secure=="boolean"?h.secure:String(h.scheme).toLowerCase()==="wss"}var yt={scheme:"ws",domainHost:!0,parse:function(u,g){var E=u;return E.secure=Is(E),E.resourceName=(E.path||"/")+(E.query?"?"+E.query:""),E.path=void 0,E.query=void 0,E},serialize:function(u,g){if((u.port===(Is(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 E=u.resourceName.split("?"),S=p(E,2),j=S[0],W=S[1];u.path=j&&j!=="/"?j:void 0,u.query=W,u.resourceName=void 0}return u.fragment=void 0,u}},Cs={scheme:"wss",domainHost:yt.domainHost,parse:yt.parse,serialize:yt.serialize},vl={},gl=!0,$s="[A-Za-z0-9\\-\\.\\_\\~"+(gl?"\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF":"")+"]",sr="[0-9A-Fa-f]",yl=t(t("%[EFef]"+sr+"%"+sr+sr+"%"+sr+sr)+"|"+t("%[89A-Fa-f]"+sr+"%"+sr+sr)+"|"+t("%"+sr+sr)),_l="[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]",bl="[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]",El=e(bl,'[\\"\\\\]'),Sl="[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]",xl=new RegExp($s,"g"),et=new RegExp(yl,"g"),Pl=new RegExp(e("[^]",_l,"[\\.]",'[\\"]',El),"g"),ks=new RegExp(e("[^]",$s,Sl),"g"),wl=ks;function Oa(h){var u=Ae(h);return u.match(xl)?u:h}var Ns={scheme:"mailto",parse:function(u,g){var E=u,S=E.to=E.path?E.path.split(","):[];if(E.path=void 0,E.query){for(var j=!1,W={},ae=E.query.split("&"),oe=0,be=ae.length;oe<be;++oe){var te=ae[oe].split("=");switch(te[0]){case"to":for(var pe=te[1].split(","),Ee=0,de=pe.length;Ee<de;++Ee)S.push(pe[Ee]);break;case"subject":E.subject=Je(te[1],g);break;case"body":E.body=Je(te[1],g);break;default:j=!0,W[Je(te[0],g)]=Je(te[1],g);break}}j&&(E.headers=W)}E.query=void 0;for(var ne=0,he=S.length;ne<he;++ne){var ce=S[ne].split("@");if(ce[0]=Je(ce[0]),g.unicodeSupport)ce[1]=Je(ce[1],g).toLowerCase();else try{ce[1]=se.toASCII(Je(ce[1],g).toLowerCase())}catch($r){E.error=E.error||"Email address's domain name can not be converted to ASCII via punycode: "+$r}S[ne]=ce.join("@")}return E},serialize:function(u,g){var E=u,S=n(u.to);if(S){for(var j=0,W=S.length;j<W;++j){var ae=String(S[j]),oe=ae.lastIndexOf("@"),be=ae.slice(0,oe).replace(et,Oa).replace(et,r).replace(Pl,Se),te=ae.slice(oe+1);try{te=g.iri?se.toUnicode(te):se.toASCII(Je(te,g).toLowerCase())}catch(ne){E.error=E.error||"Email address's domain name can not be converted to "+(g.iri?"Unicode":"ASCII")+" via punycode: "+ne}S[j]=be+"@"+te}E.path=S.join(",")}var pe=u.headers=u.headers||{};u.subject&&(pe.subject=u.subject),u.body&&(pe.body=u.body);var Ee=[];for(var de in pe)pe[de]!==vl[de]&&Ee.push(de.replace(et,Oa).replace(et,r).replace(ks,Se)+"="+pe[de].replace(et,Oa).replace(et,r).replace(wl,Se));return Ee.length&&(E.query=Ee.join("&")),E}},Ol=/^([^\:]+)\:(.*)/,js={scheme:"urn",parse:function(u,g){var E=u.path&&u.path.match(Ol),S=u;if(E){var j=g.scheme||S.scheme||"urn",W=E[1].toLowerCase(),ae=E[2],oe=j+":"+(g.nid||W),be=ye[oe];S.nid=W,S.nss=ae,S.path=void 0,be&&(S=be.parse(S,g))}else S.error=S.error||"URN can not be parsed.";return S},serialize:function(u,g){var E=g.scheme||u.scheme||"urn",S=u.nid,j=E+":"+(g.nid||S),W=ye[j];W&&(u=W.serialize(u,g));var ae=u,oe=u.nss;return ae.path=(S||g.nid)+":"+oe,ae}},Rl=/^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/,Fs={scheme:"urn:uuid",parse:function(u,g){var E=u;return E.uuid=E.nss,E.nss=void 0,!g.tolerant&&(!E.uuid||!E.uuid.match(Rl))&&(E.error=E.error||"UUID is not valid."),E},serialize:function(u,g){var E=u;return E.nss=(u.uuid||"").toLowerCase(),E}};ye[gt.scheme]=gt,ye[Ds.scheme]=Ds,ye[yt.scheme]=yt,ye[Cs.scheme]=Cs,ye[Ns.scheme]=Ns,ye[js.scheme]=js,ye[Fs.scheme]=Fs,a.SCHEMES=ye,a.pctEncChar=Se,a.pctDecChars=Ae,a.parse=ie,a.removeDotSegments=Ve,a.serialize=$e,a.resolveComponents=De,a.resolve=ar,a.normalize=Me,a.equal=kt,a.escapeComponent=wa,a.unescapeComponent=Je,Object.defineProperty(a,"__esModule",{value:!0})}))});var Xt=K((jp,En)=>{"use strict";En.exports=function a(e,t){if(e===t)return!0;if(e&&t&&typeof e=="object"&&typeof t=="object"){if(e.constructor!==t.constructor)return!1;var s,r,n;if(Array.isArray(e)){if(s=e.length,s!=t.length)return!1;for(r=s;r--!==0;)if(!a(e[r],t[r]))return!1;return!0}if(e.constructor===RegExp)return e.source===t.source&&e.flags===t.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===t.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===t.toString();if(n=Object.keys(e),s=n.length,s!==Object.keys(t).length)return!1;for(r=s;r--!==0;)if(!Object.prototype.hasOwnProperty.call(t,n[r]))return!1;for(r=s;r--!==0;){var l=n[r];if(!a(e[l],t[l]))return!1}return!0}return e!==e&&t!==t}});var xn=K((Fp,Sn)=>{"use strict";Sn.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 Yr=K((Lp,On)=>{"use strict";On.exports={copy:Qu,checkDataType:Qa,checkDataTypes:Wu,coerceToTypes:Ju,toHash:Ja,getProperty:Ga,escapeQuotes:Ya,equal:Xt(),ucs2length:xn(),varOccurences:Xu,varReplace:ed,schemaHasRules:rd,schemaHasRulesExcept:td,schemaUnknownRules:ad,toQuotedString:Wa,getPathExpr:sd,getPath:nd,getData:ld,unescapeFragment:cd,unescapeJsonPointer:es,escapeFragment:ud,escapeJsonPointer:Xa};function Qu(a,e){e=e||{};for(var t in a)e[t]=a[t];return e}function Qa(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 Wu(a,e,t){switch(a.length){case 1:return Qa(a[0],e,t,!0);default:var s="",r=Ja(a);r.array&&r.object&&(s=r.null?"(":"(!"+e+" || ",s+="typeof "+e+' !== "object")',delete r.null,delete r.array,delete r.object),r.number&&delete r.integer;for(var n in r)s+=(s?" && ":"")+Qa(n,e,t,!0);return s}}var Pn=Ja(["string","number","integer","boolean","null"]);function Ju(a,e){if(Array.isArray(e)){for(var t=[],s=0;s<e.length;s++){var r=e[s];(Pn[r]||a==="array"&&r==="array")&&(t[t.length]=r)}if(t.length)return t}else{if(Pn[e])return[e];if(a==="array"&&e==="array")return["array"]}}function Ja(a){for(var e={},t=0;t<a.length;t++)e[a[t]]=!0;return e}var Gu=/^[a-z$_][a-z$_0-9]*$/i,Yu=/'|\\/g;function Ga(a){return typeof a=="number"?"["+a+"]":Gu.test(a)?"."+a:"['"+Ya(a)+"']"}function Ya(a){return a.replace(Yu,"\\$&").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\f/g,"\\f").replace(/\t/g,"\\t")}function Xu(a,e){e+="[^0-9]";var t=a.match(new RegExp(e,"g"));return t?t.length:0}function ed(a,e,t){return e+="([^0-9])",t=t.replace(/\$/g,"$$$$"),a.replace(new RegExp(e,"g"),t+"$1")}function rd(a,e){if(typeof a=="boolean")return!a;for(var t in a)if(e[t])return!0}function td(a,e,t){if(typeof a=="boolean")return!a&&t!="not";for(var s in a)if(s!=t&&e[s])return!0}function ad(a,e){if(typeof a!="boolean"){for(var t in a)if(!e[t])return t}}function Wa(a){return"'"+Ya(a)+"'"}function sd(a,e,t,s){var r=t?"'/' + "+e+(s?"":".replace(/~/g, '~0').replace(/\\//g, '~1')"):s?"'[' + "+e+" + ']'":"'[\\'' + "+e+" + '\\']'";return wn(a,r)}function nd(a,e,t){var s=Wa(t?"/"+Xa(e):Ga(e));return wn(a,s)}var id=/^\/(?:[^~]|~0|~1)*$/,od=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function ld(a,e,t){var s,r,n,l;if(a==="")return"rootData";if(a[0]=="/"){if(!id.test(a))throw new Error("Invalid JSON-pointer: "+a);r=a,n="rootData"}else{if(l=a.match(od),!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,d=r.split("/"),f=0;f<d.length;f++){var p=d[f];p&&(n+=Ga(es(p)),o+=" && "+n)}return o}function wn(a,e){return a=='""'?e:(a+" + "+e).replace(/([^\\])' \+ '/g,"$1")}function cd(a){return es(decodeURIComponent(a))}function ud(a){return encodeURIComponent(Xa(a))}function Xa(a){return a.replace(/~/g,"~0").replace(/\//g,"~1")}function es(a){return a.replace(/~1/g,"/").replace(/~0/g,"~")}});var rs=K((Mp,Rn)=>{"use strict";var dd=Yr();Rn.exports=fd;function fd(a){dd.copy(a,this)}});var An=K((qp,Tn)=>{"use strict";var Rr=Tn.exports=function(a,e,t){typeof e=="function"&&(t=e,e={}),t=e.cb||t;var s=typeof t=="function"?t:t.pre||function(){},r=t.post||function(){};ea(e,s,r,a,"",a)};Rr.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0};Rr.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};Rr.propsKeywords={definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};Rr.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0};function ea(a,e,t,s,r,n,l,o,d,f){if(s&&typeof s=="object"&&!Array.isArray(s)){e(s,r,n,l,o,d,f);for(var p in s){var m=s[p];if(Array.isArray(m)){if(p in Rr.arrayKeywords)for(var b=0;b<m.length;b++)ea(a,e,t,m[b],r+"/"+p+"/"+b,n,r,p,s,b)}else if(p in Rr.propsKeywords){if(m&&typeof m=="object")for(var c in m)ea(a,e,t,m[c],r+"/"+p+"/"+pd(c),n,r,p,s,c)}else(p in Rr.keywords||a.allKeys&&!(p in Rr.skipKeywords))&&ea(a,e,t,m,r+"/"+p,n,r,p,s)}t(s,r,n,l,o,d,f)}}function pd(a){return a.replace(/~/g,"~0").replace(/\//g,"~1")}});var ia=K((Up,$n)=>{"use strict";var It=bn(),Dn=Xt(),sa=Yr(),ra=rs(),hd=An();$n.exports=Ar;Ar.normalizeId=Tr;Ar.fullPath=ta;Ar.url=aa;Ar.ids=_d;Ar.inlineRef=ts;Ar.schema=na;function Ar(a,e,t){var s=this._refs[t];if(typeof s=="string")if(this._refs[s])s=this._refs[s];else return Ar.call(this,a,e,s);if(s=s||this._schemas[t],s instanceof ra)return ts(s.schema,this._opts.inlineRefs)?s.schema:s.validate||this._compile(s);var r=na.call(this,e,t),n,l,o;return r&&(n=r.schema,e=r.root,o=r.baseId),n instanceof ra?l=n.validate||a.call(this,n.schema,e,void 0,o):n!==void 0&&(l=ts(n,this._opts.inlineRefs)?n:a.call(this,n,e,void 0,o)),l}function na(a,e){var t=It.parse(e),s=Cn(t),r=ta(this._getId(a.schema));if(Object.keys(a.schema).length===0||s!==r){var n=Tr(s),l=this._refs[n];if(typeof l=="string")return md.call(this,a,l,t);if(l instanceof ra)l.validate||this._compile(l),a=l;else if(l=this._schemas[n],l instanceof ra){if(l.validate||this._compile(l),n==Tr(e))return{schema:l,root:a,baseId:r};a=l}else return;if(!a.schema)return;r=ta(this._getId(a.schema))}return In.call(this,t,r,a.schema,a)}function md(a,e,t){var s=na.call(this,a,e);if(s){var r=s.schema,n=s.baseId;a=s.root;var l=this._getId(r);return l&&(n=aa(n,l)),In.call(this,t,n,r,a)}}var vd=sa.toHash(["properties","patternProperties","enum","dependencies","definitions"]);function In(a,e,t,s){if(a.fragment=a.fragment||"",a.fragment.slice(0,1)=="/"){for(var r=a.fragment.split("/"),n=1;n<r.length;n++){var l=r[n];if(l){if(l=sa.unescapeFragment(l),t=t[l],t===void 0)break;var o;if(!vd[l]&&(o=this._getId(t),o&&(e=aa(e,o)),t.$ref)){var d=aa(e,t.$ref),f=na.call(this,s,d);f&&(t=f.schema,s=f.root,e=f.baseId)}}}if(t!==void 0&&t!==s.schema)return{schema:t,root:s,baseId:e}}}var gd=sa.toHash(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum"]);function ts(a,e){if(e===!1)return!1;if(e===void 0||e===!0)return as(a);if(e)return ss(a)<=e}function as(a){var e;if(Array.isArray(a)){for(var t=0;t<a.length;t++)if(e=a[t],typeof e=="object"&&!as(e))return!1}else for(var s in a)if(s=="$ref"||(e=a[s],typeof e=="object"&&!as(e)))return!1;return!0}function ss(a){var e=0,t;if(Array.isArray(a)){for(var s=0;s<a.length;s++)if(t=a[s],typeof t=="object"&&(e+=ss(t)),e==1/0)return 1/0}else for(var r in a){if(r=="$ref")return 1/0;if(gd[r])e++;else if(t=a[r],typeof t=="object"&&(e+=ss(t)+1),e==1/0)return 1/0}return e}function ta(a,e){e!==!1&&(a=Tr(a));var t=It.parse(a);return Cn(t)}function Cn(a){return It.serialize(a).split("#")[0]+"#"}var yd=/#\/?$/;function Tr(a){return a?a.replace(yd,""):""}function aa(a,e){return e=Tr(e),It.resolve(a,e)}function _d(a){var e=Tr(this._getId(a)),t={"":e},s={"":ta(e,!1)},r={},n=this;return hd(a,{allKeys:!0},function(l,o,d,f,p,m,b){if(o!==""){var c=n._getId(l),y=t[f],_=s[f]+"/"+p;if(b!==void 0&&(_+="/"+(typeof b=="number"?b:sa.escapeFragment(b))),typeof c=="string"){c=y=Tr(y?It.resolve(y,c):c);var v=n._refs[c];if(typeof v=="string"&&(v=n._refs[v]),v&&v.schema){if(!Dn(l,v.schema))throw new Error('id "'+c+'" resolves to more than one schema')}else if(c!=Tr(_))if(c[0]=="#"){if(r[c]&&!Dn(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 oa=K((Vp,Nn)=>{"use strict";var ns=ia();Nn.exports={Validation:kn(bd),MissingRef:kn(is)};function bd(a){this.message="validation failed",this.errors=a,this.ajv=this.validation=!0}is.message=function(a,e){return"can't resolve reference "+e+" from id "+a};function is(a,e,t){this.message=t||is.message(a,e),this.missingRef=ns.url(a,e),this.missingSchema=ns.normalizeId(ns.fullPath(this.missingRef))}function kn(a){return a.prototype=Object.create(Error.prototype),a.prototype.constructor=a,a}});var os=K((zp,jn)=>{"use strict";jn.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,d){var f={key:o,value:l[o]},p={key:d,value:l[d]};return n(f,p)}}})(e.cmp),r=[];return(function n(l){if(l&&l.toJSON&&typeof l.toJSON=="function"&&(l=l.toJSON()),l!==void 0){if(typeof l=="number")return isFinite(l)?""+l:"null";if(typeof l!="object")return JSON.stringify(l);var o,d;if(Array.isArray(l)){for(d="[",o=0;o<l.length;o++)o&&(d+=","),d+=n(l[o])||"null";return d+"]"}if(l===null)return"null";if(r.indexOf(l)!==-1){if(t)return JSON.stringify("__cycle__");throw new TypeError("Converting circular structure to JSON")}var f=r.push(l)-1,p=Object.keys(l).sort(s&&s(l));for(d="",o=0;o<p.length;o++){var m=p[o],b=n(l[m]);b&&(d&&(d+=","),d+=JSON.stringify(m)+":"+b)}return r.splice(f,1),"{"+d+"}"}})(a)}});var ls=K((Hp,Fn)=>{"use strict";Fn.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 d=e.util.schemaUnknownRules(e.schema,e.RULES.keywords);if(d){var f="unknown keyword: "+d;if(e.opts.strictKeywords==="log")e.logger.warn(f);else throw new Error(f)}}if(e.isTop&&(r+=" var validate = ",n&&(e.async=!0,r+="async "),r+="function(data, dataPath, parentData, parentDataProperty, rootData) { 'use strict'; ",o&&(e.opts.sourceCode||e.opts.processCode)&&(r+=" "+("/*# sourceURL="+o+" */")+" ")),typeof e.schema=="boolean"||!(l||e.schema.$ref)){var t="false schema",p=e.level,m=e.dataLevel,b=e.schema[t],c=e.schemaPath+e.util.getProperty(t),y=e.errSchemaPath+"/"+t,D=!e.opts.allErrors,q,_="data"+(m||""),O="valid"+p;if(e.schema===!1){e.isTop?D=!0:r+=" var "+O+" = false; ";var v=v||[];v.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(q||"false schema")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(y)+" , params: {} ",e.opts.messages!==!1&&(r+=" , message: 'boolean schema is false' "),e.opts.verbose&&(r+=" , schema: false , parentSchema: validate.schema"+e.schemaPath+" , data: "+_+" "),r+=" } "):r+=" {} ";var x=r;r=v.pop(),!e.compositeRule&&D?e.async?r+=" throw new ValidationError(["+x+"]); ":r+=" validate.errors = ["+x+"]; return false; ":r+=" var err = "+x+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}else e.isTop?n?r+=" return data; ":r+=" validate.errors = null; return true; ":r+=" var "+O+" = true; ";return e.isTop&&(r+=" }; return validate; "),r}if(e.isTop){var T=e.isTop,p=e.level=0,m=e.dataLevel=0,_="data";if(e.rootId=e.resolve.fullPath(e.self._getId(e.root.schema)),e.baseId=e.baseId||e.rootId,delete e.isTop,e.dataPathArr=[""],e.schema.default!==void 0&&e.opts.useDefaults&&e.opts.strictDefaults){var P="default is ignored in the schema root";if(e.opts.strictDefaults==="log")e.logger.warn(P);else throw new Error(P)}r+=" var vErrors = null; ",r+=" var errors = 0; ",r+=" if (rootData === undefined) rootData = data; "}else{var p=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_"+p+" = errors;"}var O="valid"+p,D=!e.opts.allErrors,I="",z="",q,C=e.schema.type,U=Array.isArray(C);if(C&&e.opts.nullable&&e.schema.nullable===!0&&(U?C.indexOf("null")==-1&&(C=C.concat("null")):C!="null"&&(C=[C,"null"],U=!0)),U&&C.length==1&&(C=C[0],U=!1),e.schema.$ref&&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 F=e.RULES.types[C];if(M||U||F===!0||F&&!xe(F)){var c=e.schemaPath+".type",y=e.errSchemaPath+"/type",c=e.schemaPath+".type",y=e.errSchemaPath+"/type",A=U?"checkDataTypes":"checkDataType";if(r+=" if ("+e.util[A](C,_,e.opts.strictNumbers,!0)+") { ",M){var $="dataType"+p,L="coerced"+p;r+=" var "+$+" = typeof "+_+"; var "+L+" = undefined; ",e.opts.coerceTypes=="array"&&(r+=" if ("+$+" == 'object' && Array.isArray("+_+") && "+_+".length == 1) { "+_+" = "+_+"[0]; "+$+" = typeof "+_+"; if ("+e.util.checkDataType(e.schema.type,_,e.opts.strictNumbers)+") "+L+" = "+_+"; } "),r+=" if ("+L+" !== undefined) ; ";var le=M;if(le)for(var Y,re=-1,G=le.length-1;re<G;)Y=le[re+=1],Y=="string"?r+=" else if ("+$+" == 'number' || "+$+" == 'boolean') "+L+" = '' + "+_+"; else if ("+_+" === null) "+L+" = ''; ":Y=="number"||Y=="integer"?(r+=" else if ("+$+" == 'boolean' || "+_+" === null || ("+$+" == 'string' && "+_+" && "+_+" == +"+_+" ",Y=="integer"&&(r+=" && !("+_+" % 1)"),r+=")) "+L+" = +"+_+"; "):Y=="boolean"?r+=" else if ("+_+" === 'false' || "+_+" === 0 || "+_+" === null) "+L+" = false; else if ("+_+" === 'true' || "+_+" === 1) "+L+" = true; ":Y=="null"?r+=" else if ("+_+" === '' || "+_+" === 0 || "+_+" === false) "+L+" = null; ":e.opts.coerceTypes=="array"&&Y=="array"&&(r+=" else if ("+$+" == 'string' || "+$+" == 'number' || "+$+" == 'boolean' || "+_+" == null) "+L+" = ["+_+"]; ");r+=" else { ";var v=v||[];v.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(q||"type")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(y)+" , params: { type: '",U?r+=""+C.join(","):r+=""+C,r+="' } ",e.opts.messages!==!1&&(r+=" , message: 'should be ",U?r+=""+C.join(","):r+=""+C,r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+_+" "),r+=" } "):r+=" {} ";var x=r;r=v.pop(),!e.compositeRule&&D?e.async?r+=" throw new ValidationError(["+x+"]); ":r+=" validate.errors = ["+x+"]; return false; ":r+=" var err = "+x+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } if ("+L+" !== undefined) { ";var H=m?"data"+(m-1||""):"parentData",me=m?e.dataPathArr[m]:"parentDataProperty";r+=" "+_+" = "+L+"; ",m||(r+="if ("+H+" !== undefined)"),r+=" "+H+"["+me+"] = "+L+"; } "}else{var v=v||[];v.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(q||"type")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(y)+" , params: { type: '",U?r+=""+C.join(","):r+=""+C,r+="' } ",e.opts.messages!==!1&&(r+=" , message: 'should be ",U?r+=""+C.join(","):r+=""+C,r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+_+" "),r+=" } "):r+=" {} ";var x=r;r=v.pop(),!e.compositeRule&&D?e.async?r+=" throw new ValidationError(["+x+"]); ":r+=" validate.errors = ["+x+"]; return false; ":r+=" var err = "+x+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}r+=" } "}}if(e.schema.$ref&&!l)r+=" "+e.RULES.all.$ref.code(e,"$ref")+" ",D&&(r+=" } if (errors === ",T?r+="0":r+="errs_"+p,r+=") { ",z+="}");else{var we=e.RULES;if(we){for(var F,Te=-1,se=we.length-1;Te<se;)if(F=we[Te+=1],xe(F)){if(F.type&&(r+=" if ("+e.util.checkDataType(F.type,_,e.opts.strictNumbers)+") { "),e.opts.useDefaults){if(F.type=="object"&&e.schema.properties){var b=e.schema.properties,ye=Object.keys(b),Se=ye;if(Se)for(var Ae,Er=-1,fr=Se.length-1;Er<fr;){Ae=Se[Er+=1];var _e=b[Ae];if(_e.default!==void 0){var ve=_+e.util.getProperty(Ae);if(e.compositeRule){if(e.opts.strictDefaults){var P="default is ignored for: "+ve;if(e.opts.strictDefaults==="log")e.logger.warn(P);else throw new Error(P)}}else r+=" if ("+ve+" === undefined ",e.opts.useDefaults=="empty"&&(r+=" || "+ve+" === null || "+ve+" === '' "),r+=" ) "+ve+" = ",e.opts.useDefaults=="shared"?r+=" "+e.useDefault(_e.default)+" ":r+=" "+JSON.stringify(_e.default)+" ",r+="; "}}}else if(F.type=="array"&&Array.isArray(e.schema.items)){var Dr=e.schema.items;if(Dr){for(var _e,re=-1,Oe=Dr.length-1;re<Oe;)if(_e=Dr[re+=1],_e.default!==void 0){var ve=_+"["+re+"]";if(e.compositeRule){if(e.opts.strictDefaults){var P="default is ignored for: "+ve;if(e.opts.strictDefaults==="log")e.logger.warn(P);else throw new Error(P)}}else r+=" if ("+ve+" === undefined ",e.opts.useDefaults=="empty"&&(r+=" || "+ve+" === null || "+ve+" === '' "),r+=" ) "+ve+" = ",e.opts.useDefaults=="shared"?r+=" "+e.useDefault(_e.default)+" ":r+=" "+JSON.stringify(_e.default)+" ",r+="; "}}}}var ie=F.rules;if(ie){for(var Sr,pr=-1,Ir=ie.length-1;pr<Ir;)if(Sr=ie[pr+=1],Ve(Sr)){var Cr=Sr.code(e,Sr.keyword,F.type);Cr&&(r+=" "+Cr+" ",D&&(I+="}"))}}if(D&&(r+=" "+I+" ",I=""),F.type&&(r+=" } ",C&&C===F.type&&!M)){r+=" else { ";var c=e.schemaPath+".type",y=e.errSchemaPath+"/type",v=v||[];v.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(q||"type")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(y)+" , params: { type: '",U?r+=""+C.join(","):r+=""+C,r+="' } ",e.opts.messages!==!1&&(r+=" , message: 'should be ",U?r+=""+C.join(","):r+=""+C,r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+c+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+_+" "),r+=" } "):r+=" {} ";var x=r;r=v.pop(),!e.compositeRule&&D?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+=" } "}D&&(r+=" if (errors === ",T?r+="0":r+="errs_"+p,r+=") { ",z+="}")}}}D&&(r+=" "+z+" "),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 "+O+" = errors === errs_"+p+";";function xe(De){for(var ar=De.rules,Me=0;Me<ar.length;Me++)if(Ve(ar[Me]))return!0}function Ve(De){return e.schema[De.keyword]!==void 0||De.implements&&$e(De)}function $e(De){for(var ar=De.implements,Me=0;Me<ar.length;Me++)if(e.schema[ar[Me]]!==void 0)return!0}return r}});var Vn=K((Zp,Un)=>{"use strict";var la=ia(),ua=Yr(),Mn=oa(),Ed=os(),Ln=ls(),Sd=ua.ucs2length,xd=Xt(),Pd=Mn.Validation;Un.exports=cs;function cs(a,e,t,s){var r=this,n=this._opts,l=[void 0],o={},d=[],f={},p=[],m={},b=[];e=e||{schema:a,refVal:l,refs:o};var c=wd.call(this,a,e,s),y=this._compilations[c.index];if(c.compiling)return y.callValidate=P;var _=this._formats,v=this.RULES;try{var x=O(a,e,t,s);y.validate=x;var T=y.callValidate;return T&&(T.schema=x.schema,T.errors=null,T.refs=x.refs,T.refVal=x.refVal,T.root=x.root,T.$async=x.$async,n.sourceCode&&(T.source=x.source)),x}finally{Od.call(this,a,e,s)}function P(){var A=y.validate,$=A.apply(this,arguments);return P.errors=A.errors,$}function O(A,$,L,le){var Y=!$||$&&$.schema==A;if($.schema!=e.schema)return cs.call(r,A,$,L,le);var re=A.$async===!0,G=Ln({isTop:!0,schema:A,isRoot:Y,baseId:le,root:$,schemaPath:"",errSchemaPath:"#",errorPath:'""',MissingRefError:Mn.MissingRef,RULES:v,validate:Ln,util:ua,resolve:la,resolveRef:D,usePattern:U,useDefault:M,useCustomRule:F,opts:n,formats:_,logger:r.logger,self:r});G=ca(l,Ad)+ca(d,Rd)+ca(p,Td)+ca(b,Dd)+G,n.processCode&&(G=n.processCode(G,A));var H;try{var me=new Function("self","RULES","formats","root","refVal","defaults","customRules","equal","ucs2length","ValidationError",G);H=me(r,v,_,e,l,p,b,xd,Sd,Pd),l[0]=H}catch(we){throw r.logger.error("Error compiling schema, function code:",G),we}return H.schema=A,H.errors=null,H.refs=o,H.refVal=l,H.root=Y?H:$,re&&(H.$async=!0),n.sourceCode===!0&&(H.source={code:G,patterns:d,defaults:p}),H}function D(A,$,L){$=la.url(A,$);var le=o[$],Y,re;if(le!==void 0)return Y=l[le],re="refVal["+le+"]",C(Y,re);if(!L&&e.refs){var G=e.refs[$];if(G!==void 0)return Y=e.refVal[G],re=I($,Y),C(Y,re)}re=I($);var H=la.call(r,O,e,$);if(H===void 0){var me=t&&t[$];me&&(H=la.inlineRef(me,n.inlineRefs)?me:cs.call(r,me,e,t,A))}if(H===void 0)z($);else return q($,H),C(H,re)}function I(A,$){var L=l.length;return l[L]=$,o[A]=L,"refVal"+L}function z(A){delete o[A]}function q(A,$){var L=o[A];l[L]=$}function C(A,$){return typeof A=="object"||typeof A=="boolean"?{code:$,schema:A,inline:!0}:{code:$,$async:A&&!!A.$async}}function U(A){var $=f[A];return $===void 0&&($=f[A]=d.length,d[$]=A),"pattern"+$}function M(A){switch(typeof A){case"boolean":case"number":return""+A;case"string":return ua.toQuotedString(A);case"object":if(A===null)return"null";var $=Ed(A),L=m[$];return L===void 0&&(L=m[$]=p.length,p[L]=A),"default"+L}}function F(A,$,L,le){if(r._opts.validateSchema!==!1){var Y=A.definition.dependencies;if(Y&&!Y.every(function(Se){return Object.prototype.hasOwnProperty.call(L,Se)}))throw new Error("parent schema must have all required keywords: "+Y.join(","));var re=A.definition.validateSchema;if(re){var G=re($);if(!G){var H="keyword schema is invalid: "+r.errorsText(re.errors);if(r._opts.validateSchema=="log")r.logger.error(H);else throw new Error(H)}}}var me=A.definition.compile,we=A.definition.inline,Te=A.definition.macro,se;if(me)se=me.call(r,$,L,le);else if(Te)se=Te.call(r,$,L,le),n.validateSchema!==!1&&r.validateSchema(se,!0);else if(we)se=we.call(r,le,A.keyword,$,L);else if(se=A.definition.validate,!se)return;if(se===void 0)throw new Error('custom keyword "'+A.keyword+'"failed to compile');var ye=b.length;return b[ye]=se,{code:"customRule"+ye,validate:se}}}function wd(a,e,t){var s=qn.call(this,a,e,t);return s>=0?{index:s,compiling:!0}:(s=this._compilations.length,this._compilations[s]={schema:a,root:e,baseId:t},{index:s,compiling:!1})}function Od(a,e,t){var s=qn.call(this,a,e,t);s>=0&&this._compilations.splice(s,1)}function qn(a,e,t){for(var s=0;s<this._compilations.length;s++){var r=this._compilations[s];if(r.schema==a&&r.root==e&&r.baseId==t)return s}return-1}function Rd(a,e){return"var pattern"+a+" = new RegExp("+ua.toQuotedString(e[a])+");"}function Td(a){return"var default"+a+" = defaults["+a+"];"}function Ad(a,e){return e[a]===void 0?"":"var refVal"+a+" = refVal["+a+"];"}function Dd(a){return"var customRule"+a+" = customRules["+a+"];"}function ca(a,e){if(!a.length)return"";for(var t="",s=0;s<a.length;s++)t+=e(s,a);return t}});var Hn=K((Bp,zn)=>{"use strict";var da=zn.exports=function(){this._cache={}};da.prototype.put=function(e,t){this._cache[e]=t};da.prototype.get=function(e){return this._cache[e]};da.prototype.del=function(e){delete this._cache[e]};da.prototype.clear=function(){this._cache={}}});var ti=K((Kp,ri)=>{"use strict";var Id=Yr(),Cd=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,$d=[0,31,28,31,30,31,30,31,31,30,31,30,31],kd=/^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i,Zn=/^(?=.{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,Nd=/^(?:[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,jd=/^(?:[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,Bn=/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,Kn=/^(?:(?:http[s\u017F]?|ftp):\/\/)(?:(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+(?::(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?@)?(?:(?!10(?:\.[0-9]{1,3}){3})(?!127(?:\.[0-9]{1,3}){3})(?!169\.254(?:\.[0-9]{1,3}){2})(?!192\.168(?:\.[0-9]{1,3}){2})(?!172\.(?:1[6-9]|2[0-9]|3[01])(?:\.[0-9]{1,3}){2})(?:[1-9][0-9]?|1[0-9][0-9]|2[01][0-9]|22[0-3])(?:\.(?:1?[0-9]{1,2}|2[0-4][0-9]|25[0-5])){2}(?:\.(?:[1-9][0-9]?|1[0-9][0-9]|2[0-4][0-9]|25[0-4]))|(?:(?:(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-)*(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)(?:\.(?:(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-)*(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)*(?:\.(?:(?:[a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]){2,})))(?::[0-9]{2,5})?(?:\/(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?$/i,Qn=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,Wn=/^(?:\/(?:[^~/]|~0|~1)*)*$/,Jn=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,Gn=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/;ri.exports=fa;function fa(a){return a=a=="full"?"full":"fast",Id.copy(fa[a])}fa.fast={date:/^\d\d\d\d-[0-1]\d-[0-3]\d$/,time:/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,"date-time":/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,"uri-template":Bn,url:Kn,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i,hostname:Zn,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:ei,uuid:Qn,"json-pointer":Wn,"json-pointer-uri-fragment":Jn,"relative-json-pointer":Gn};fa.full={date:Yn,time:Xn,"date-time":Md,uri:Ud,"uri-reference":jd,"uri-template":Bn,url:Kn,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:Zn,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:ei,uuid:Qn,"json-pointer":Wn,"json-pointer-uri-fragment":Jn,"relative-json-pointer":Gn};function Fd(a){return a%4===0&&(a%100!==0||a%400===0)}function Yn(a){var e=a.match(Cd);if(!e)return!1;var t=+e[1],s=+e[2],r=+e[3];return s>=1&&s<=12&&r>=1&&r<=(s==2&&Fd(t)?29:$d[s])}function Xn(a,e){var t=a.match(kd);if(!t)return!1;var s=t[1],r=t[2],n=t[3],l=t[5];return(s<=23&&r<=59&&n<=59||s==23&&r==59&&n==60)&&(!e||l)}var Ld=/t|\s/i;function Md(a){var e=a.split(Ld);return e.length==2&&Yn(e[0])&&Xn(e[1],!0)}var qd=/\/|:/;function Ud(a){return qd.test(a)&&Nd.test(a)}var Vd=/[^\\]\\Z/;function ei(a){if(Vd.test(a))return!1;try{return new RegExp(a),!0}catch{return!1}}});var si=K((Qp,ai)=>{"use strict";ai.exports=function(e,t,s){var r=" ",n=e.level,l=e.dataLevel,o=e.schema[t],d=e.errSchemaPath+"/"+t,f=!e.opts.allErrors,p="data"+(l||""),m="valid"+n,b,c;if(o=="#"||o=="#/")e.isRoot?(b=e.async,c="validate"):(b=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(d)+" , 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: "+p+" "),r+=" } "):r+=" {} ";var x=r;r=v.pop(),!e.compositeRule&&f?e.async?r+=" throw new ValidationError(["+x+"]); ":r+=" validate.errors = ["+x+"]; return false; ":r+=" var err = "+x+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",f&&(r+=" if (false) { ")}else if(e.opts.missingRefs=="ignore")e.logger.warn(_),f&&(r+=" if (true) { ");else throw new e.MissingRefError(e.baseId,o,_)}else if(y.inline){var T=e.util.copy(e);T.level++;var P="valid"+T.level;T.schema=y.schema,T.schemaPath="",T.errSchemaPath=o;var O=e.validate(T).replace(/validate\.schema/g,y.code);r+=" "+O+" ",f&&(r+=" if ("+P+") { ")}else b=y.$async===!0||e.async&&y.$async!==!1,c=y.code}if(c){var v=v||[];v.push(r),r="",e.opts.passContext?r+=" "+c+".call(this, ":r+=" "+c+"( ",r+=" "+p+", (dataPath || '')",e.errorPath!='""'&&(r+=" + "+e.errorPath);var D=l?"data"+(l-1||""):"parentData",I=l?e.dataPathArr[l]:"parentDataProperty";r+=" , "+D+" , "+I+", rootData) ";var z=r;if(r=v.pop(),b){if(!e.async)throw new Error("async schema referenced by sync schema");f&&(r+=" var "+m+"; "),r+=" try { await "+z+"; ",f&&(r+=" "+m+" = true; "),r+=" } catch (e) { if (!(e instanceof ValidationError)) throw e; if (vErrors === null) vErrors = e.errors; else vErrors = vErrors.concat(e.errors); errors = vErrors.length; ",f&&(r+=" "+m+" = false; "),r+=" } ",f&&(r+=" if ("+m+") { ")}else r+=" if (!"+z+") { if (vErrors === null) vErrors = "+c+".errors; else vErrors = vErrors.concat("+c+".errors); errors = vErrors.length; } ",f&&(r+=" else { ")}return r}});var ii=K((Wp,ni)=>{"use strict";ni.exports=function(e,t,s){var r=" ",n=e.schema[t],l=e.schemaPath+e.util.getProperty(t),o=e.errSchemaPath+"/"+t,d=!e.opts.allErrors,f=e.util.copy(e),p="";f.level++;var m="valid"+f.level,b=f.baseId,c=!0,y=n;if(y)for(var _,v=-1,x=y.length-1;v<x;)_=y[v+=1],(e.opts.strictKeywords?typeof _=="object"&&Object.keys(_).length>0||_===!1:e.util.schemaHasRules(_,e.RULES.all))&&(c=!1,f.schema=_,f.schemaPath=l+"["+v+"]",f.errSchemaPath=o+"/"+v,r+=" "+e.validate(f)+" ",f.baseId=b,d&&(r+=" if ("+m+") { ",p+="}"));return d&&(c?r+=" if (true) { ":r+=" "+p.slice(0,-1)+" "),r}});var li=K((Jp,oi)=>{"use strict";oi.exports=function(e,t,s){var r=" ",n=e.level,l=e.dataLevel,o=e.schema[t],d=e.schemaPath+e.util.getProperty(t),f=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,m="data"+(l||""),b="valid"+n,c="errs__"+n,y=e.util.copy(e),_="";y.level++;var v="valid"+y.level,x=o.every(function(q){return e.opts.strictKeywords?typeof q=="object"&&Object.keys(q).length>0||q===!1:e.util.schemaHasRules(q,e.RULES.all)});if(x){var T=y.baseId;r+=" var "+c+" = errors; var "+b+" = false; ";var P=e.compositeRule;e.compositeRule=y.compositeRule=!0;var O=o;if(O)for(var D,I=-1,z=O.length-1;I<z;)D=O[I+=1],y.schema=D,y.schemaPath=d+"["+I+"]",y.errSchemaPath=f+"/"+I,r+=" "+e.validate(y)+" ",y.baseId=T,r+=" "+b+" = "+b+" || "+v+"; if (!"+b+") { ",_+="}";e.compositeRule=y.compositeRule=P,r+=" "+_+" if (!"+b+") { var err = ",e.createErrors!==!1?(r+=" { keyword: 'anyOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: {} ",e.opts.messages!==!1&&(r+=" , message: 'should match some schema in anyOf' "),e.opts.verbose&&(r+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&p&&(e.async?r+=" throw new ValidationError(vErrors); ":r+=" validate.errors = vErrors; return false; "),r+=" } else { errors = "+c+"; if (vErrors !== null) { if ("+c+") vErrors.length = "+c+"; else vErrors = null; } ",e.opts.allErrors&&(r+=" } ")}else p&&(r+=" if (true) { ");return r}});var ui=K((Gp,ci)=>{"use strict";ci.exports=function(e,t,s){var r=" ",n=e.schema[t],l=e.errSchemaPath+"/"+t,o=!e.opts.allErrors,d=e.util.toQuotedString(n);return e.opts.$comment===!0?r+=" console.log("+d+");":typeof e.opts.$comment=="function"&&(r+=" self._opts.$comment("+d+", "+e.util.toQuotedString(l)+", validate.root.schema);"),r}});var fi=K((Yp,di)=>{"use strict";di.exports=function(e,t,s){var r=" ",n=e.level,l=e.dataLevel,o=e.schema[t],d=e.schemaPath+e.util.getProperty(t),f=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,m="data"+(l||""),b="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"+d+";"),r+="var "+b+" = equal("+m+", schema"+n+"); if (!"+b+") { ";var _=_||[];_.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'const' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { allowedValue: schema"+n+" } ",e.opts.messages!==!1&&(r+=" , message: 'should be equal to constant' "),e.opts.verbose&&(r+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var v=r;return r=_.pop(),!e.compositeRule&&p?e.async?r+=" throw new ValidationError(["+v+"]); ":r+=" validate.errors = ["+v+"]; return false; ":r+=" var err = "+v+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" }",p&&(r+=" else { "),r}});var hi=K((Xp,pi)=>{"use strict";pi.exports=function(e,t,s){var r=" ",n=e.level,l=e.dataLevel,o=e.schema[t],d=e.schemaPath+e.util.getProperty(t),f=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,m="data"+(l||""),b="valid"+n,c="errs__"+n,y=e.util.copy(e),_="";y.level++;var v="valid"+y.level,x="i"+n,T=y.dataLevel=e.dataLevel+1,P="data"+T,O=e.baseId,D=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 "+b+";",D){var I=e.compositeRule;e.compositeRule=y.compositeRule=!0,y.schema=o,y.schemaPath=d,y.errSchemaPath=f,r+=" var "+v+" = false; for (var "+x+" = 0; "+x+" < "+m+".length; "+x+"++) { ",y.errorPath=e.util.getPathExpr(e.errorPath,x,e.opts.jsonPointers,!0);var z=m+"["+x+"]";y.dataPathArr[T]=x;var q=e.validate(y);y.baseId=O,e.util.varOccurences(q,P)<2?r+=" "+e.util.varReplace(q,P,z)+" ":r+=" var "+P+" = "+z+"; "+q+" ",r+=" if ("+v+") break; } ",e.compositeRule=y.compositeRule=I,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(f)+" , params: {} ",e.opts.messages!==!1&&(r+=" , message: 'should contain a valid item' "),e.opts.verbose&&(r+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var U=r;return r=C.pop(),!e.compositeRule&&p?e.async?r+=" throw new ValidationError(["+U+"]); ":r+=" validate.errors = ["+U+"]; return false; ":r+=" var err = "+U+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } else { ",D&&(r+=" errors = "+c+"; if (vErrors !== null) { if ("+c+") vErrors.length = "+c+"; else vErrors = null; } "),e.opts.allErrors&&(r+=" } "),r}});var vi=K((eh,mi)=>{"use strict";mi.exports=function(e,t,s){var r=" ",n=e.level,l=e.dataLevel,o=e.schema[t],d=e.schemaPath+e.util.getProperty(t),f=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,m="data"+(l||""),b="errs__"+n,c=e.util.copy(e),y="";c.level++;var _="valid"+c.level,v={},x={},T=e.opts.ownProperties;for(I in o)if(I!="__proto__"){var P=o[I],O=Array.isArray(P)?x:v;O[I]=P}r+="var "+b+" = errors;";var D=e.errorPath;r+="var missing"+n+";";for(var I in x)if(O=x[I],O.length){if(r+=" if ( "+m+e.util.getProperty(I)+" !== undefined ",T&&(r+=" && Object.prototype.hasOwnProperty.call("+m+", '"+e.util.escapeQuotes(I)+"') "),p){r+=" && ( ";var z=O;if(z)for(var q,C=-1,U=z.length-1;C<U;){q=z[C+=1],C&&(r+=" || ");var M=e.util.getProperty(q),F=m+M;r+=" ( ( "+F+" === undefined ",T&&(r+=" || ! Object.prototype.hasOwnProperty.call("+m+", '"+e.util.escapeQuotes(q)+"') "),r+=") && (missing"+n+" = "+e.util.toQuotedString(e.opts.jsonPointers?q:M)+") ) "}r+=")) { ";var A="missing"+n,$="' + "+A+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.opts.jsonPointers?e.util.getPathExpr(D,A,!0):D+" + "+A);var L=L||[];L.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'dependencies' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { property: '"+e.util.escapeQuotes(I)+"', missingProperty: '"+$+"', depsCount: "+O.length+", deps: '"+e.util.escapeQuotes(O.length==1?O[0]:O.join(", "))+"' } ",e.opts.messages!==!1&&(r+=" , message: 'should have ",O.length==1?r+="property "+e.util.escapeQuotes(O[0]):r+="properties "+e.util.escapeQuotes(O.join(", ")),r+=" when property "+e.util.escapeQuotes(I)+" is present' "),e.opts.verbose&&(r+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var le=r;r=L.pop(),!e.compositeRule&&p?e.async?r+=" throw new ValidationError(["+le+"]); ":r+=" validate.errors = ["+le+"]; return false; ":r+=" var err = "+le+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}else{r+=" ) { ";var Y=O;if(Y)for(var q,re=-1,G=Y.length-1;re<G;){q=Y[re+=1];var M=e.util.getProperty(q),$=e.util.escapeQuotes(q),F=m+M;e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPath(D,q,e.opts.jsonPointers)),r+=" if ( "+F+" === undefined ",T&&(r+=" || ! Object.prototype.hasOwnProperty.call("+m+", '"+e.util.escapeQuotes(q)+"') "),r+=") { var err = ",e.createErrors!==!1?(r+=" { keyword: 'dependencies' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { property: '"+e.util.escapeQuotes(I)+"', missingProperty: '"+$+"', depsCount: "+O.length+", deps: '"+e.util.escapeQuotes(O.length==1?O[0]:O.join(", "))+"' } ",e.opts.messages!==!1&&(r+=" , message: 'should have ",O.length==1?r+="property "+e.util.escapeQuotes(O[0]):r+="properties "+e.util.escapeQuotes(O.join(", ")),r+=" when property "+e.util.escapeQuotes(I)+" is present' "),e.opts.verbose&&(r+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } "}}r+=" } ",p&&(y+="}",r+=" else { ")}e.errorPath=D;var H=c.baseId;for(var I in v){var P=v[I];(e.opts.strictKeywords?typeof P=="object"&&Object.keys(P).length>0||P===!1:e.util.schemaHasRules(P,e.RULES.all))&&(r+=" "+_+" = true; if ( "+m+e.util.getProperty(I)+" !== undefined ",T&&(r+=" && Object.prototype.hasOwnProperty.call("+m+", '"+e.util.escapeQuotes(I)+"') "),r+=") { ",c.schema=P,c.schemaPath=d+e.util.getProperty(I),c.errSchemaPath=f+"/"+e.util.escapeFragment(I),r+=" "+e.validate(c)+" ",c.baseId=H,r+=" } ",p&&(r+=" if ("+_+") { ",y+="}"))}return p&&(r+=" "+y+" if ("+b+" == errors) {"),r}});var yi=K((rh,gi)=>{"use strict";gi.exports=function(e,t,s){var r=" ",n=e.level,l=e.dataLevel,o=e.schema[t],d=e.schemaPath+e.util.getProperty(t),f=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,m="data"+(l||""),b="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"+d+";"),r+="var "+b+";",c&&(r+=" if (schema"+n+" === undefined) "+b+" = true; else if (!Array.isArray(schema"+n+")) "+b+" = false; else {"),r+=""+b+" = false;for (var "+_+"=0; "+_+"<"+v+".length; "+_+"++) if (equal("+m+", "+v+"["+_+"])) { "+b+" = true; break; }",c&&(r+=" } "),r+=" if (!"+b+") { ";var x=x||[];x.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'enum' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { allowedValues: schema"+n+" } ",e.opts.messages!==!1&&(r+=" , message: 'should be equal to one of the allowed values' "),e.opts.verbose&&(r+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var T=r;return r=x.pop(),!e.compositeRule&&p?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+=" }",p&&(r+=" else { "),r}});var bi=K((th,_i)=>{"use strict";_i.exports=function(e,t,s){var r=" ",n=e.level,l=e.dataLevel,o=e.schema[t],d=e.schemaPath+e.util.getProperty(t),f=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,m="data"+(l||"");if(e.opts.format===!1)return p&&(r+=" if (true) { "),r;var b=e.opts.$data&&o&&o.$data,c;b?(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(b){var v="format"+n,x="isObject"+n,T="formatType"+n;r+=" var "+v+" = formats["+c+"]; var "+x+" = typeof "+v+" == 'object' && !("+v+" instanceof RegExp) && "+v+".validate; var "+T+" = "+x+" && "+v+".type || 'string'; if ("+x+") { ",e.async&&(r+=" var async"+n+" = "+v+".async; "),r+=" "+v+" = "+v+".validate; } if ( ",b&&(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+'"'),p&&(r+=" if (true) { "),r;if(_&&y.indexOf(o)>=0)return p&&(r+=" if (true) { "),r;throw new Error('unknown format "'+o+'" is used in schema at path "'+e.errSchemaPath+'"')}var x=typeof v=="object"&&!(v instanceof RegExp)&&v.validate,T=x&&v.type||"string";if(x){var P=v.async===!0;v=v.validate}if(T!=s)return p&&(r+=" if (true) { "),r;if(P){if(!e.async)throw new Error("async format in sync schema");var O="formats"+e.util.getProperty(o)+".validate";r+=" if (!(await "+O+"("+m+"))) { "}else{r+=" if (! ";var O="formats"+e.util.getProperty(o);x&&(O+=".validate"),typeof v=="function"?r+=" "+O+"("+m+") ":r+=" "+O+".test("+m+") ",r+=") { "}}var D=D||[];D.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'format' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { format: ",b?r+=""+c:r+=""+e.util.toQuotedString(o),r+=" } ",e.opts.messages!==!1&&(r+=` , message: 'should match format "`,b?r+="' + "+c+" + '":r+=""+e.util.escapeQuotes(o),r+=`"' `),e.opts.verbose&&(r+=" , schema: ",b?r+="validate.schema"+d:r+=""+e.util.toQuotedString(o),r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var I=r;return r=D.pop(),!e.compositeRule&&p?e.async?r+=" throw new ValidationError(["+I+"]); ":r+=" validate.errors = ["+I+"]; return false; ":r+=" var err = "+I+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } ",p&&(r+=" else { "),r}});var Si=K((ah,Ei)=>{"use strict";Ei.exports=function(e,t,s){var r=" ",n=e.level,l=e.dataLevel,o=e.schema[t],d=e.schemaPath+e.util.getProperty(t),f=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,m="data"+(l||""),b="valid"+n,c="errs__"+n,y=e.util.copy(e);y.level++;var _="valid"+y.level,v=e.schema.then,x=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)),P=x!==void 0&&(e.opts.strictKeywords?typeof x=="object"&&Object.keys(x).length>0||x===!1:e.util.schemaHasRules(x,e.RULES.all)),O=y.baseId;if(T||P){var D;y.createErrors=!1,y.schema=o,y.schemaPath=d,y.errSchemaPath=f,r+=" var "+c+" = errors; var "+b+" = true; ";var I=e.compositeRule;e.compositeRule=y.compositeRule=!0,r+=" "+e.validate(y)+" ",y.baseId=O,y.createErrors=!0,r+=" errors = "+c+"; if (vErrors !== null) { if ("+c+") vErrors.length = "+c+"; else vErrors = null; } ",e.compositeRule=y.compositeRule=I,T?(r+=" if ("+_+") { ",y.schema=e.schema.then,y.schemaPath=e.schemaPath+".then",y.errSchemaPath=e.errSchemaPath+"/then",r+=" "+e.validate(y)+" ",y.baseId=O,r+=" "+b+" = "+_+"; ",T&&P?(D="ifClause"+n,r+=" var "+D+" = 'then'; "):D="'then'",r+=" } ",P&&(r+=" else { ")):r+=" if (!"+_+") { ",P&&(y.schema=e.schema.else,y.schemaPath=e.schemaPath+".else",y.errSchemaPath=e.errSchemaPath+"/else",r+=" "+e.validate(y)+" ",y.baseId=O,r+=" "+b+" = "+_+"; ",T&&P?(D="ifClause"+n,r+=" var "+D+" = 'else'; "):D="'else'",r+=" } "),r+=" if (!"+b+") { var err = ",e.createErrors!==!1?(r+=" { keyword: 'if' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { failingKeyword: "+D+" } ",e.opts.messages!==!1&&(r+=` , message: 'should match "' + `+D+` + '" schema' `),e.opts.verbose&&(r+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&p&&(e.async?r+=" throw new ValidationError(vErrors); ":r+=" validate.errors = vErrors; return false; "),r+=" } ",p&&(r+=" else { ")}else p&&(r+=" if (true) { ");return r}});var Pi=K((sh,xi)=>{"use strict";xi.exports=function(e,t,s){var r=" ",n=e.level,l=e.dataLevel,o=e.schema[t],d=e.schemaPath+e.util.getProperty(t),f=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,m="data"+(l||""),b="valid"+n,c="errs__"+n,y=e.util.copy(e),_="";y.level++;var v="valid"+y.level,x="i"+n,T=y.dataLevel=e.dataLevel+1,P="data"+T,O=e.baseId;if(r+="var "+c+" = errors;var "+b+";",Array.isArray(o)){var D=e.schema.additionalItems;if(D===!1){r+=" "+b+" = "+m+".length <= "+o.length+"; ";var I=f;f=e.errSchemaPath+"/additionalItems",r+=" if (!"+b+") { ";var z=z||[];z.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'additionalItems' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , 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 q=r;r=z.pop(),!e.compositeRule&&p?e.async?r+=" throw new ValidationError(["+q+"]); ":r+=" validate.errors = ["+q+"]; return false; ":r+=" var err = "+q+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } ",f=I,p&&(_+="}",r+=" else { ")}var C=o;if(C){for(var U,M=-1,F=C.length-1;M<F;)if(U=C[M+=1],e.opts.strictKeywords?typeof U=="object"&&Object.keys(U).length>0||U===!1:e.util.schemaHasRules(U,e.RULES.all)){r+=" "+v+" = true; if ("+m+".length > "+M+") { ";var A=m+"["+M+"]";y.schema=U,y.schemaPath=d+"["+M+"]",y.errSchemaPath=f+"/"+M,y.errorPath=e.util.getPathExpr(e.errorPath,M,e.opts.jsonPointers,!0),y.dataPathArr[T]=M;var $=e.validate(y);y.baseId=O,e.util.varOccurences($,P)<2?r+=" "+e.util.varReplace($,P,A)+" ":r+=" var "+P+" = "+A+"; "+$+" ",r+=" } ",p&&(r+=" if ("+v+") { ",_+="}")}}if(typeof D=="object"&&(e.opts.strictKeywords?typeof D=="object"&&Object.keys(D).length>0||D===!1:e.util.schemaHasRules(D,e.RULES.all))){y.schema=D,y.schemaPath=e.schemaPath+".additionalItems",y.errSchemaPath=e.errSchemaPath+"/additionalItems",r+=" "+v+" = true; if ("+m+".length > "+o.length+") { for (var "+x+" = "+o.length+"; "+x+" < "+m+".length; "+x+"++) { ",y.errorPath=e.util.getPathExpr(e.errorPath,x,e.opts.jsonPointers,!0);var A=m+"["+x+"]";y.dataPathArr[T]=x;var $=e.validate(y);y.baseId=O,e.util.varOccurences($,P)<2?r+=" "+e.util.varReplace($,P,A)+" ":r+=" var "+P+" = "+A+"; "+$+" ",p&&(r+=" if (!"+v+") break; "),r+=" } } ",p&&(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=d,y.errSchemaPath=f,r+=" for (var "+x+" = 0; "+x+" < "+m+".length; "+x+"++) { ",y.errorPath=e.util.getPathExpr(e.errorPath,x,e.opts.jsonPointers,!0);var A=m+"["+x+"]";y.dataPathArr[T]=x;var $=e.validate(y);y.baseId=O,e.util.varOccurences($,P)<2?r+=" "+e.util.varReplace($,P,A)+" ":r+=" var "+P+" = "+A+"; "+$+" ",p&&(r+=" if (!"+v+") break; "),r+=" }"}return p&&(r+=" "+_+" if ("+c+" == errors) {"),r}});var us=K((nh,wi)=>{"use strict";wi.exports=function(e,t,s){var r=" ",n=e.level,l=e.dataLevel,o=e.schema[t],d=e.schemaPath+e.util.getProperty(t),f=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,O,m="data"+(l||""),b=e.opts.$data&&o&&o.$data,c;b?(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[_],x=e.opts.$data&&v&&v.$data,T=y?"<":">",P=y?">":"<",O=void 0;if(!(b||typeof o=="number"||o===void 0))throw new Error(t+" must be number");if(!(x||v===void 0||typeof v=="number"||typeof v=="boolean"))throw new Error(_+" must be number or boolean");if(x){var D=e.util.getData(v.$data,l,e.dataPathArr),I="exclusive"+n,z="exclType"+n,q="exclIsNumber"+n,C="op"+n,U="' + "+C+" + '";r+=" var schemaExcl"+n+" = "+D+"; ",D="schemaExcl"+n,r+=" var "+I+"; var "+z+" = typeof "+D+"; if ("+z+" != 'boolean' && "+z+" != 'undefined' && "+z+" != 'number') { ";var O=_,M=M||[];M.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(O||"_exclusiveLimit")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: {} ",e.opts.messages!==!1&&(r+=" , message: '"+_+" should be boolean' "),e.opts.verbose&&(r+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var F=r;r=M.pop(),!e.compositeRule&&p?e.async?r+=" throw new ValidationError(["+F+"]); ":r+=" validate.errors = ["+F+"]; return false; ":r+=" var err = "+F+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } else if ( ",b&&(r+=" ("+c+" !== undefined && typeof "+c+" != 'number') || "),r+=" "+z+" == 'number' ? ( ("+I+" = "+c+" === undefined || "+D+" "+T+"= "+c+") ? "+m+" "+P+"= "+D+" : "+m+" "+P+" "+c+" ) : ( ("+I+" = "+D+" === true) ? "+m+" "+P+"= "+c+" : "+m+" "+P+" "+c+" ) || "+m+" !== "+m+") { var op"+n+" = "+I+" ? '"+T+"' : '"+T+"='; ",o===void 0&&(O=_,f=e.errSchemaPath+"/"+_,c=D,b=x)}else{var q=typeof v=="number",U=T;if(q&&b){var C="'"+U+"'";r+=" if ( ",b&&(r+=" ("+c+" !== undefined && typeof "+c+" != 'number') || "),r+=" ( "+c+" === undefined || "+v+" "+T+"= "+c+" ? "+m+" "+P+"= "+v+" : "+m+" "+P+" "+c+" ) || "+m+" !== "+m+") { "}else{q&&o===void 0?(I=!0,O=_,f=e.errSchemaPath+"/"+_,c=v,P+="="):(q&&(c=Math[y?"min":"max"](v,o)),v===(q?c:!0)?(I=!0,O=_,f=e.errSchemaPath+"/"+_,P+="="):(I=!1,U+="="));var C="'"+U+"'";r+=" if ( ",b&&(r+=" ("+c+" !== undefined && typeof "+c+" != 'number') || "),r+=" "+m+" "+P+" "+c+" || "+m+" !== "+m+") { "}}O=O||t;var M=M||[];M.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(O||"_limit")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { comparison: "+C+", limit: "+c+", exclusive: "+I+" } ",e.opts.messages!==!1&&(r+=" , message: 'should be "+U+" ",b?r+="' + "+c:r+=""+c+"'"),e.opts.verbose&&(r+=" , schema: ",b?r+="validate.schema"+d:r+=""+o,r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var F=r;return r=M.pop(),!e.compositeRule&&p?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+=" } ",p&&(r+=" else { "),r}});var ds=K((ih,Oi)=>{"use strict";Oi.exports=function(e,t,s){var r=" ",n=e.level,l=e.dataLevel,o=e.schema[t],d=e.schemaPath+e.util.getProperty(t),f=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,_,m="data"+(l||""),b=e.opts.$data&&o&&o.$data,c;if(b?(r+=" var schema"+n+" = "+e.util.getData(o.$data,l,e.dataPathArr)+"; ",c="schema"+n):c=o,!(b||typeof o=="number"))throw new Error(t+" must be number");var y=t=="maxItems"?">":"<";r+="if ( ",b&&(r+=" ("+c+" !== undefined && typeof "+c+" != 'number') || "),r+=" "+m+".length "+y+" "+c+") { ";var _=t,v=v||[];v.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(_||"_limitItems")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { limit: "+c+" } ",e.opts.messages!==!1&&(r+=" , message: 'should NOT have ",t=="maxItems"?r+="more":r+="fewer",r+=" than ",b?r+="' + "+c+" + '":r+=""+o,r+=" items' "),e.opts.verbose&&(r+=" , schema: ",b?r+="validate.schema"+d:r+=""+o,r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var x=r;return r=v.pop(),!e.compositeRule&&p?e.async?r+=" throw new ValidationError(["+x+"]); ":r+=" validate.errors = ["+x+"]; return false; ":r+=" var err = "+x+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+="} ",p&&(r+=" else { "),r}});var fs=K((oh,Ri)=>{"use strict";Ri.exports=function(e,t,s){var r=" ",n=e.level,l=e.dataLevel,o=e.schema[t],d=e.schemaPath+e.util.getProperty(t),f=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,_,m="data"+(l||""),b=e.opts.$data&&o&&o.$data,c;if(b?(r+=" var schema"+n+" = "+e.util.getData(o.$data,l,e.dataPathArr)+"; ",c="schema"+n):c=o,!(b||typeof o=="number"))throw new Error(t+" must be number");var y=t=="maxLength"?">":"<";r+="if ( ",b&&(r+=" ("+c+" !== undefined && typeof "+c+" != 'number') || "),e.opts.unicode===!1?r+=" "+m+".length ":r+=" ucs2length("+m+") ",r+=" "+y+" "+c+") { ";var _=t,v=v||[];v.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(_||"_limitLength")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { limit: "+c+" } ",e.opts.messages!==!1&&(r+=" , message: 'should NOT be ",t=="maxLength"?r+="longer":r+="shorter",r+=" than ",b?r+="' + "+c+" + '":r+=""+o,r+=" characters' "),e.opts.verbose&&(r+=" , schema: ",b?r+="validate.schema"+d:r+=""+o,r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var x=r;return r=v.pop(),!e.compositeRule&&p?e.async?r+=" throw new ValidationError(["+x+"]); ":r+=" validate.errors = ["+x+"]; return false; ":r+=" var err = "+x+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+="} ",p&&(r+=" else { "),r}});var ps=K((lh,Ti)=>{"use strict";Ti.exports=function(e,t,s){var r=" ",n=e.level,l=e.dataLevel,o=e.schema[t],d=e.schemaPath+e.util.getProperty(t),f=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,_,m="data"+(l||""),b=e.opts.$data&&o&&o.$data,c;if(b?(r+=" var schema"+n+" = "+e.util.getData(o.$data,l,e.dataPathArr)+"; ",c="schema"+n):c=o,!(b||typeof o=="number"))throw new Error(t+" must be number");var y=t=="maxProperties"?">":"<";r+="if ( ",b&&(r+=" ("+c+" !== undefined && typeof "+c+" != 'number') || "),r+=" Object.keys("+m+").length "+y+" "+c+") { ";var _=t,v=v||[];v.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(_||"_limitProperties")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { limit: "+c+" } ",e.opts.messages!==!1&&(r+=" , message: 'should NOT have ",t=="maxProperties"?r+="more":r+="fewer",r+=" than ",b?r+="' + "+c+" + '":r+=""+o,r+=" properties' "),e.opts.verbose&&(r+=" , schema: ",b?r+="validate.schema"+d:r+=""+o,r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var x=r;return r=v.pop(),!e.compositeRule&&p?e.async?r+=" throw new ValidationError(["+x+"]); ":r+=" validate.errors = ["+x+"]; return false; ":r+=" var err = "+x+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+="} ",p&&(r+=" else { "),r}});var Di=K((ch,Ai)=>{"use strict";Ai.exports=function(e,t,s){var r=" ",n=e.level,l=e.dataLevel,o=e.schema[t],d=e.schemaPath+e.util.getProperty(t),f=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,m="data"+(l||""),b=e.opts.$data&&o&&o.$data,c;if(b?(r+=" var schema"+n+" = "+e.util.getData(o.$data,l,e.dataPathArr)+"; ",c="schema"+n):c=o,!(b||typeof o=="number"))throw new Error(t+" must be number");r+="var division"+n+";if (",b&&(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+=" ) ",b&&(r+=" ) "),r+=" ) { ";var y=y||[];y.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'multipleOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { multipleOf: "+c+" } ",e.opts.messages!==!1&&(r+=" , message: 'should be multiple of ",b?r+="' + "+c:r+=""+c+"'"),e.opts.verbose&&(r+=" , schema: ",b?r+="validate.schema"+d:r+=""+o,r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var _=r;return r=y.pop(),!e.compositeRule&&p?e.async?r+=" throw new ValidationError(["+_+"]); ":r+=" validate.errors = ["+_+"]; return false; ":r+=" var err = "+_+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+="} ",p&&(r+=" else { "),r}});var Ci=K((uh,Ii)=>{"use strict";Ii.exports=function(e,t,s){var r=" ",n=e.level,l=e.dataLevel,o=e.schema[t],d=e.schemaPath+e.util.getProperty(t),f=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,m="data"+(l||""),b="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=d,c.errSchemaPath=f,r+=" var "+b+" = 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 x=x||[];x.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'not' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: {} ",e.opts.messages!==!1&&(r+=" , message: 'should NOT be valid' "),e.opts.verbose&&(r+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var T=r;r=x.pop(),!e.compositeRule&&p?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 = "+b+"; if (vErrors !== null) { if ("+b+") vErrors.length = "+b+"; else vErrors = null; } ",e.opts.allErrors&&(r+=" } ")}else r+=" var err = ",e.createErrors!==!1?(r+=" { keyword: 'not' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: {} ",e.opts.messages!==!1&&(r+=" , message: 'should NOT be valid' "),e.opts.verbose&&(r+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",p&&(r+=" if (false) { ");return r}});var ki=K((dh,$i)=>{"use strict";$i.exports=function(e,t,s){var r=" ",n=e.level,l=e.dataLevel,o=e.schema[t],d=e.schemaPath+e.util.getProperty(t),f=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,m="data"+(l||""),b="valid"+n,c="errs__"+n,y=e.util.copy(e),_="";y.level++;var v="valid"+y.level,x=y.baseId,T="prevValid"+n,P="passingSchemas"+n;r+="var "+c+" = errors , "+T+" = false , "+b+" = false , "+P+" = null; ";var O=e.compositeRule;e.compositeRule=y.compositeRule=!0;var D=o;if(D)for(var I,z=-1,q=D.length-1;z<q;)I=D[z+=1],(e.opts.strictKeywords?typeof I=="object"&&Object.keys(I).length>0||I===!1:e.util.schemaHasRules(I,e.RULES.all))?(y.schema=I,y.schemaPath=d+"["+z+"]",y.errSchemaPath=f+"/"+z,r+=" "+e.validate(y)+" ",y.baseId=x):r+=" var "+v+" = true; ",z&&(r+=" if ("+v+" && "+T+") { "+b+" = false; "+P+" = ["+P+", "+z+"]; } else { ",_+="}"),r+=" if ("+v+") { "+b+" = "+T+" = true; "+P+" = "+z+"; }";return e.compositeRule=y.compositeRule=O,r+=""+_+"if (!"+b+") { var err = ",e.createErrors!==!1?(r+=" { keyword: 'oneOf' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { passingSchemas: "+P+" } ",e.opts.messages!==!1&&(r+=" , message: 'should match exactly one schema in oneOf' "),e.opts.verbose&&(r+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&p&&(e.async?r+=" throw new ValidationError(vErrors); ":r+=" validate.errors = vErrors; return false; "),r+="} else { errors = "+c+"; if (vErrors !== null) { if ("+c+") vErrors.length = "+c+"; else vErrors = null; }",e.opts.allErrors&&(r+=" } "),r}});var ji=K((fh,Ni)=>{"use strict";Ni.exports=function(e,t,s){var r=" ",n=e.level,l=e.dataLevel,o=e.schema[t],d=e.schemaPath+e.util.getProperty(t),f=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,m="data"+(l||""),b=e.opts.$data&&o&&o.$data,c;b?(r+=" var schema"+n+" = "+e.util.getData(o.$data,l,e.dataPathArr)+"; ",c="schema"+n):c=o;var y=b?"(new RegExp("+c+"))":e.usePattern(o);r+="if ( ",b&&(r+=" ("+c+" !== undefined && typeof "+c+" != 'string') || "),r+=" !"+y+".test("+m+") ) { ";var _=_||[];_.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'pattern' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { pattern: ",b?r+=""+c:r+=""+e.util.toQuotedString(o),r+=" } ",e.opts.messages!==!1&&(r+=` , message: 'should match pattern "`,b?r+="' + "+c+" + '":r+=""+e.util.escapeQuotes(o),r+=`"' `),e.opts.verbose&&(r+=" , schema: ",b?r+="validate.schema"+d:r+=""+e.util.toQuotedString(o),r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var v=r;return r=_.pop(),!e.compositeRule&&p?e.async?r+=" throw new ValidationError(["+v+"]); ":r+=" validate.errors = ["+v+"]; return false; ":r+=" var err = "+v+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+="} ",p&&(r+=" else { "),r}});var Li=K((ph,Fi)=>{"use strict";Fi.exports=function(e,t,s){var r=" ",n=e.level,l=e.dataLevel,o=e.schema[t],d=e.schemaPath+e.util.getProperty(t),f=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,m="data"+(l||""),b="errs__"+n,c=e.util.copy(e),y="";c.level++;var _="valid"+c.level,v="key"+n,x="idx"+n,T=c.dataLevel=e.dataLevel+1,P="data"+T,O="dataProperties"+n,D=Object.keys(o||{}).filter(re),I=e.schema.patternProperties||{},z=Object.keys(I).filter(re),q=e.schema.additionalProperties,C=D.length||z.length,U=q===!1,M=typeof q=="object"&&Object.keys(q).length,F=e.opts.removeAdditional,A=U||M||F,$=e.opts.ownProperties,L=e.baseId,le=e.schema.required;if(le&&!(e.opts.$data&&le.$data)&&le.length<e.opts.loopRequired)var Y=e.util.toHash(le);function re(Je){return Je!=="__proto__"}if(r+="var "+b+" = errors;var "+_+" = true;",$&&(r+=" var "+O+" = undefined;"),A){if($?r+=" "+O+" = "+O+" || Object.keys("+m+"); for (var "+x+"=0; "+x+"<"+O+".length; "+x+"++) { var "+v+" = "+O+"["+x+"]; ":r+=" for (var "+v+" in "+m+") { ",C){if(r+=" var isAdditional"+n+" = !(false ",D.length)if(D.length>8)r+=" || validate.schema"+d+".hasOwnProperty("+v+") ";else{var G=D;if(G)for(var H,me=-1,we=G.length-1;me<we;)H=G[me+=1],r+=" || "+v+" == "+e.util.toQuotedString(H)+" "}if(z.length){var Te=z;if(Te)for(var se,ye=-1,Se=Te.length-1;ye<Se;)se=Te[ye+=1],r+=" || "+e.usePattern(se)+".test("+v+") "}r+=" ); if (isAdditional"+n+") { "}if(F=="all")r+=" delete "+m+"["+v+"]; ";else{var Ae=e.errorPath,Er="' + "+v+" + '";if(e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(e.errorPath,v,e.opts.jsonPointers)),U)if(F)r+=" delete "+m+"["+v+"]; ";else{r+=" "+_+" = false; ";var fr=f;f=e.errSchemaPath+"/additionalProperties";var _e=_e||[];_e.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'additionalProperties' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { additionalProperty: '"+Er+"' } ",e.opts.messages!==!1&&(r+=" , message: '",e.opts._errorDataPathProperty?r+="is an invalid additional property":r+="should NOT have additional properties",r+="' "),e.opts.verbose&&(r+=" , schema: false , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var ve=r;r=_e.pop(),!e.compositeRule&&p?e.async?r+=" throw new ValidationError(["+ve+"]); ":r+=" validate.errors = ["+ve+"]; return false; ":r+=" var err = "+ve+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",f=fr,p&&(r+=" break; ")}else if(M)if(F=="failing"){r+=" var "+b+" = errors; ";var Dr=e.compositeRule;e.compositeRule=c.compositeRule=!0,c.schema=q,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 Oe=m+"["+v+"]";c.dataPathArr[T]=v;var ie=e.validate(c);c.baseId=L,e.util.varOccurences(ie,P)<2?r+=" "+e.util.varReplace(ie,P,Oe)+" ":r+=" var "+P+" = "+Oe+"; "+ie+" ",r+=" if (!"+_+") { errors = "+b+"; if (validate.errors !== null) { if (errors) validate.errors.length = errors; else validate.errors = null; } delete "+m+"["+v+"]; } ",e.compositeRule=c.compositeRule=Dr}else{c.schema=q,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 Oe=m+"["+v+"]";c.dataPathArr[T]=v;var ie=e.validate(c);c.baseId=L,e.util.varOccurences(ie,P)<2?r+=" "+e.util.varReplace(ie,P,Oe)+" ":r+=" var "+P+" = "+Oe+"; "+ie+" ",p&&(r+=" if (!"+_+") break; ")}e.errorPath=Ae}C&&(r+=" } "),r+=" } ",p&&(r+=" if ("+_+") { ",y+="}")}var Sr=e.opts.useDefaults&&!e.compositeRule;if(D.length){var pr=D;if(pr)for(var H,Ir=-1,Cr=pr.length-1;Ir<Cr;){H=pr[Ir+=1];var xe=o[H];if(e.opts.strictKeywords?typeof xe=="object"&&Object.keys(xe).length>0||xe===!1:e.util.schemaHasRules(xe,e.RULES.all)){var Ve=e.util.getProperty(H),Oe=m+Ve,$e=Sr&&xe.default!==void 0;c.schema=xe,c.schemaPath=d+Ve,c.errSchemaPath=f+"/"+e.util.escapeFragment(H),c.errorPath=e.util.getPath(e.errorPath,H,e.opts.jsonPointers),c.dataPathArr[T]=e.util.toQuotedString(H);var ie=e.validate(c);if(c.baseId=L,e.util.varOccurences(ie,P)<2){ie=e.util.varReplace(ie,P,Oe);var De=Oe}else{var De=P;r+=" var "+P+" = "+Oe+"; "}if($e)r+=" "+ie+" ";else{if(Y&&Y[H]){r+=" if ( "+De+" === undefined ",$&&(r+=" || ! Object.prototype.hasOwnProperty.call("+m+", '"+e.util.escapeQuotes(H)+"') "),r+=") { "+_+" = false; ";var Ae=e.errorPath,fr=f,ar=e.util.escapeQuotes(H);e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPath(Ae,H,e.opts.jsonPointers)),f=e.errSchemaPath+"/required";var _e=_e||[];_e.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { missingProperty: '"+ar+"' } ",e.opts.messages!==!1&&(r+=" , message: '",e.opts._errorDataPathProperty?r+="is a required property":r+="should have required property \\'"+ar+"\\'",r+="' "),e.opts.verbose&&(r+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var ve=r;r=_e.pop(),!e.compositeRule&&p?e.async?r+=" throw new ValidationError(["+ve+"]); ":r+=" validate.errors = ["+ve+"]; return false; ":r+=" var err = "+ve+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",f=fr,e.errorPath=Ae,r+=" } else { "}else p?(r+=" if ( "+De+" === undefined ",$&&(r+=" || ! Object.prototype.hasOwnProperty.call("+m+", '"+e.util.escapeQuotes(H)+"') "),r+=") { "+_+" = true; } else { "):(r+=" if ("+De+" !== undefined ",$&&(r+=" && Object.prototype.hasOwnProperty.call("+m+", '"+e.util.escapeQuotes(H)+"') "),r+=" ) { ");r+=" "+ie+" } "}}p&&(r+=" if ("+_+") { ",y+="}")}}if(z.length){var Me=z;if(Me)for(var se,kt=-1,wa=Me.length-1;kt<wa;){se=Me[kt+=1];var xe=I[se];if(e.opts.strictKeywords?typeof xe=="object"&&Object.keys(xe).length>0||xe===!1:e.util.schemaHasRules(xe,e.RULES.all)){c.schema=xe,c.schemaPath=e.schemaPath+".patternProperties"+e.util.getProperty(se),c.errSchemaPath=e.errSchemaPath+"/patternProperties/"+e.util.escapeFragment(se),$?r+=" "+O+" = "+O+" || Object.keys("+m+"); for (var "+x+"=0; "+x+"<"+O+".length; "+x+"++) { var "+v+" = "+O+"["+x+"]; ":r+=" for (var "+v+" in "+m+") { ",r+=" if ("+e.usePattern(se)+".test("+v+")) { ",c.errorPath=e.util.getPathExpr(e.errorPath,v,e.opts.jsonPointers);var Oe=m+"["+v+"]";c.dataPathArr[T]=v;var ie=e.validate(c);c.baseId=L,e.util.varOccurences(ie,P)<2?r+=" "+e.util.varReplace(ie,P,Oe)+" ":r+=" var "+P+" = "+Oe+"; "+ie+" ",p&&(r+=" if (!"+_+") break; "),r+=" } ",p&&(r+=" else "+_+" = true; "),r+=" } ",p&&(r+=" if ("+_+") { ",y+="}")}}}return p&&(r+=" "+y+" if ("+b+" == errors) {"),r}});var qi=K((hh,Mi)=>{"use strict";Mi.exports=function(e,t,s){var r=" ",n=e.level,l=e.dataLevel,o=e.schema[t],d=e.schemaPath+e.util.getProperty(t),f=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,m="data"+(l||""),b="errs__"+n,c=e.util.copy(e),y="";c.level++;var _="valid"+c.level;if(r+="var "+b+" = 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=d,c.errSchemaPath=f;var v="key"+n,x="idx"+n,T="i"+n,P="' + "+v+" + '",O=c.dataLevel=e.dataLevel+1,D="data"+O,I="dataProperties"+n,z=e.opts.ownProperties,q=e.baseId;z&&(r+=" var "+I+" = undefined; "),z?r+=" "+I+" = "+I+" || Object.keys("+m+"); for (var "+x+"=0; "+x+"<"+I+".length; "+x+"++) { var "+v+" = "+I+"["+x+"]; ":r+=" for (var "+v+" in "+m+") { ",r+=" var startErrs"+n+" = errors; ";var C=v,U=e.compositeRule;e.compositeRule=c.compositeRule=!0;var M=e.validate(c);c.baseId=q,e.util.varOccurences(M,D)<2?r+=" "+e.util.varReplace(M,D,C)+" ":r+=" var "+D+" = "+C+"; "+M+" ",e.compositeRule=c.compositeRule=U,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(f)+" , params: { propertyName: '"+P+"' } ",e.opts.messages!==!1&&(r+=" , message: 'property name \\'"+P+"\\' is invalid' "),e.opts.verbose&&(r+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&p&&(e.async?r+=" throw new ValidationError(vErrors); ":r+=" validate.errors = vErrors; return false; "),p&&(r+=" break; "),r+=" } }"}return p&&(r+=" "+y+" if ("+b+" == errors) {"),r}});var Vi=K((mh,Ui)=>{"use strict";Ui.exports=function(e,t,s){var r=" ",n=e.level,l=e.dataLevel,o=e.schema[t],d=e.schemaPath+e.util.getProperty(t),f=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,m="data"+(l||""),b="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=[],x=o;if(x)for(var T,P=-1,O=x.length-1;P<O;){T=x[P+=1];var D=e.schema.properties[T];D&&(e.opts.strictKeywords?typeof D=="object"&&Object.keys(D).length>0||D===!1:e.util.schemaHasRules(D,e.RULES.all))||(v[v.length]=T)}}else var v=o;if(c||v.length){var I=e.errorPath,z=c||v.length>=e.opts.loopRequired,q=e.opts.ownProperties;if(p)if(r+=" var missing"+n+"; ",z){c||(r+=" var "+_+" = validate.schema"+d+"; ");var C="i"+n,U="schema"+n+"["+C+"]",M="' + "+U+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(I,U,e.opts.jsonPointers)),r+=" var "+b+" = true; ",c&&(r+=" if (schema"+n+" === undefined) "+b+" = true; else if (!Array.isArray(schema"+n+")) "+b+" = false; else {"),r+=" for (var "+C+" = 0; "+C+" < "+_+".length; "+C+"++) { "+b+" = "+m+"["+_+"["+C+"]] !== undefined ",q&&(r+=" && Object.prototype.hasOwnProperty.call("+m+", "+_+"["+C+"]) "),r+="; if (!"+b+") break; } ",c&&(r+=" } "),r+=" if (!"+b+") { ";var F=F||[];F.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , 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"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var A=r;r=F.pop(),!e.compositeRule&&p?e.async?r+=" throw new ValidationError(["+A+"]); ":r+=" validate.errors = ["+A+"]; return false; ":r+=" var err = "+A+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } else { "}else{r+=" if ( ";var $=v;if($)for(var L,C=-1,le=$.length-1;C<le;){L=$[C+=1],C&&(r+=" || ");var Y=e.util.getProperty(L),re=m+Y;r+=" ( ( "+re+" === undefined ",q&&(r+=" || ! Object.prototype.hasOwnProperty.call("+m+", '"+e.util.escapeQuotes(L)+"') "),r+=") && (missing"+n+" = "+e.util.toQuotedString(e.opts.jsonPointers?L:Y)+") ) "}r+=") { ";var U="missing"+n,M="' + "+U+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.opts.jsonPointers?e.util.getPathExpr(I,U,!0):I+" + "+U);var F=F||[];F.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , 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"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var A=r;r=F.pop(),!e.compositeRule&&p?e.async?r+=" throw new ValidationError(["+A+"]); ":r+=" validate.errors = ["+A+"]; return false; ":r+=" var err = "+A+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } else { "}else if(z){c||(r+=" var "+_+" = validate.schema"+d+"; ");var C="i"+n,U="schema"+n+"["+C+"]",M="' + "+U+" + '";e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPathExpr(I,U,e.opts.jsonPointers)),c&&(r+=" if ("+_+" && !Array.isArray("+_+")) { var err = ",e.createErrors!==!1?(r+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { missingProperty: '"+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"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } else if ("+_+" !== undefined) { "),r+=" for (var "+C+" = 0; "+C+" < "+_+".length; "+C+"++) { if ("+m+"["+_+"["+C+"]] === undefined ",q&&(r+=" || ! Object.prototype.hasOwnProperty.call("+m+", "+_+"["+C+"]) "),r+=") { var err = ",e.createErrors!==!1?(r+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , 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"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } } ",c&&(r+=" } ")}else{var G=v;if(G)for(var L,H=-1,me=G.length-1;H<me;){L=G[H+=1];var Y=e.util.getProperty(L),M=e.util.escapeQuotes(L),re=m+Y;e.opts._errorDataPathProperty&&(e.errorPath=e.util.getPath(I,L,e.opts.jsonPointers)),r+=" if ( "+re+" === undefined ",q&&(r+=" || ! Object.prototype.hasOwnProperty.call("+m+", '"+e.util.escapeQuotes(L)+"') "),r+=") { var err = ",e.createErrors!==!1?(r+=" { keyword: 'required' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , 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"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } "}}e.errorPath=I}else p&&(r+=" if (true) {");return r}});var Hi=K((vh,zi)=>{"use strict";zi.exports=function(e,t,s){var r=" ",n=e.level,l=e.dataLevel,o=e.schema[t],d=e.schemaPath+e.util.getProperty(t),f=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,m="data"+(l||""),b="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 "+b+"; if ("+y+" === false || "+y+" === undefined) "+b+" = true; else if (typeof "+y+" != 'boolean') "+b+" = false; else { "),r+=" var i = "+m+".length , "+b+" = 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])) { "+b+" = false; break outer; } } } ";else{r+=" var itemIndices = {}, item; for (;i--;) { var item = "+m+"[i]; ";var x="checkDataType"+(v?"s":"");r+=" if ("+e.util[x](_,"item",e.opts.strictNumbers,!0)+") continue; ",v&&(r+=` if (typeof item == 'string') item = '"' + item; `),r+=" if (typeof itemIndices[item] == 'number') { "+b+" = false; j = itemIndices[item]; break; } itemIndices[item] = i; } "}r+=" } ",c&&(r+=" } "),r+=" if (!"+b+") { ";var T=T||[];T.push(r),r="",e.createErrors!==!1?(r+=" { keyword: 'uniqueItems' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { i: i, j: j } ",e.opts.messages!==!1&&(r+=" , message: 'should NOT have duplicate items (items ## ' + j + ' and ' + i + ' are identical)' "),e.opts.verbose&&(r+=" , schema: ",c?r+="validate.schema"+d:r+=""+o,r+=" , parentSchema: validate.schema"+e.schemaPath+" , data: "+m+" "),r+=" } "):r+=" {} ";var P=r;r=T.pop(),!e.compositeRule&&p?e.async?r+=" throw new ValidationError(["+P+"]); ":r+=" validate.errors = ["+P+"]; return false; ":r+=" var err = "+P+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",r+=" } ",p&&(r+=" else { ")}else p&&(r+=" if (true) { ");return r}});var Bi=K((gh,Zi)=>{"use strict";Zi.exports={$ref:si(),allOf:ii(),anyOf:li(),$comment:ui(),const:fi(),contains:hi(),dependencies:vi(),enum:yi(),format:bi(),if:Si(),items:Pi(),maximum:us(),minimum:us(),maxItems:ds(),minItems:ds(),maxLength:fs(),minLength:fs(),maxProperties:ps(),minProperties:ps(),multipleOf:Di(),not:Ci(),oneOf:ki(),pattern:ji(),properties:Li(),propertyNames:qi(),required:Vi(),uniqueItems:Hi(),validate:ls()}});var Wi=K((yh,Qi)=>{"use strict";var Ki=Bi(),hs=Yr().toHash;Qi.exports=function(){var e=[{type:"number",rules:[{maximum:["exclusiveMaximum"]},{minimum:["exclusiveMinimum"]},"multipleOf","format"]},{type:"string",rules:["maxLength","minLength","pattern","format"]},{type:"array",rules:["maxItems","minItems","items","contains","uniqueItems"]},{type:"object",rules:["maxProperties","minProperties","required","dependencies","propertyNames",{properties:["additionalProperties","patternProperties"]}]},{rules:["$ref","const","enum","not","anyOf","oneOf","allOf","if"]}],t=["type","$comment"],s=["$schema","$id","id","$data","$async","title","description","default","definitions","examples","readOnly","writeOnly","contentMediaType","contentEncoding","additionalItems","then","else"],r=["number","integer","string","array","object","boolean","null"];return e.all=hs(t),e.types=hs(r),e.forEach(function(n){n.rules=n.rules.map(function(l){var o;if(typeof l=="object"){var d=Object.keys(l)[0];o=l[d],l=d,o.forEach(function(p){t.push(p),e.all[p]=!0})}t.push(l);var f=e.all[l]={keyword:l,code:Ki[l],implements:o};return f}),e.all.$comment={keyword:"$comment",code:Ki.$comment},n.type&&(e.types[n.type]=n)}),e.keywords=hs(t.concat(s)),e.custom={},e}});var Yi=K((_h,Gi)=>{"use strict";var Ji=["multipleOf","maximum","exclusiveMaximum","minimum","exclusiveMinimum","maxLength","minLength","pattern","additionalItems","maxItems","minItems","uniqueItems","maxProperties","minProperties","required","additionalProperties","enum","format","const"];Gi.exports=function(a,e){for(var t=0;t<e.length;t++){a=JSON.parse(JSON.stringify(a));var s=e[t].split("/"),r=a,n;for(n=1;n<s.length;n++)r=r[s[n]];for(n=0;n<Ji.length;n++){var l=Ji[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 ro=K((bh,eo)=>{"use strict";var zd=oa().MissingRef;eo.exports=Xi;function Xi(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 d=o.$schema;return d&&!s.getSchema(d)?Xi.call(s,{$ref:d},!0):Promise.resolve()}function l(o){try{return s._compile(o)}catch(f){if(f instanceof zd)return d(f);throw f}function d(f){var p=f.missingSchema;if(c(p))throw new Error("Schema "+p+" is loaded but "+f.missingRef+" cannot be resolved");var m=s._loadingSchemas[p];return m||(m=s._loadingSchemas[p]=s._opts.loadSchema(p),m.then(b,b)),m.then(function(y){if(!c(p))return n(y).then(function(){c(p)||s.addSchema(y,p,void 0,e)})}).then(function(){return l(o)});function b(){delete s._loadingSchemas[p]}function c(y){return s._refs[y]||s._schemas[y]}}}}});var ao=K((Eh,to)=>{"use strict";to.exports=function(e,t,s){var r=" ",n=e.level,l=e.dataLevel,o=e.schema[t],d=e.schemaPath+e.util.getProperty(t),f=e.errSchemaPath+"/"+t,p=!e.opts.allErrors,m,b="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 x=this,T="definition"+n,P=x.definition,O="",D,I,z,q,C;if(_&&P.$data){C="keywordValidate"+n;var U=P.validateSchema;r+=" var "+T+" = RULES.custom['"+t+"'].definition; var "+C+" = "+T+".validate;"}else{if(q=e.useCustomRule(x,o,e.schema,e),!q)return;v="validate.schema"+d,C=q.code,D=P.compile,I=P.inline,z=P.macro}var M=C+".errors",F="i"+n,A="ruleErr"+n,$=P.async;if($&&!e.async)throw new Error("async keyword in sync schema");if(I||z||(r+=""+M+" = null;"),r+="var "+y+" = errors;var "+c+";",_&&P.$data&&(O+="}",r+=" if ("+v+" === undefined) { "+c+" = true; } else { ",U&&(O+="}",r+=" "+c+" = "+T+".validateSchema("+v+"); if ("+c+") { ")),I)P.statements?r+=" "+q.validate+" ":r+=" "+c+" = "+q.validate+"; ";else if(z){var L=e.util.copy(e),O="";L.level++;var le="valid"+L.level;L.schema=q.validate,L.schemaPath="";var Y=e.compositeRule;e.compositeRule=L.compositeRule=!0;var re=e.validate(L).replace(/validate\.schema/g,C);e.compositeRule=L.compositeRule=Y,r+=" "+re}else{var G=G||[];G.push(r),r="",r+=" "+C+".call( ",e.opts.passContext?r+="this":r+="self",D||P.schema===!1?r+=" , "+b+" ":r+=" , "+v+" , "+b+" , validate.schema"+e.schemaPath+" ",r+=" , (dataPath || '')",e.errorPath!='""'&&(r+=" + "+e.errorPath);var H=l?"data"+(l-1||""):"parentData",me=l?e.dataPathArr[l]:"parentDataProperty";r+=" , "+H+" , "+me+" , rootData ) ";var we=r;r=G.pop(),P.errors===!1?(r+=" "+c+" = ",$&&(r+="await "),r+=""+we+"; "):$?(M="customErrors"+n,r+=" var "+M+" = null; try { "+c+" = await "+we+"; } catch (e) { "+c+" = false; if (e instanceof ValidationError) "+M+" = e.errors; else throw e; } "):r+=" "+M+" = null; "+c+" = "+we+"; "}if(P.modifying&&(r+=" if ("+H+") "+b+" = "+H+"["+me+"];"),r+=""+O,P.valid)p&&(r+=" if (true) { ");else{r+=" if ( ",P.valid===void 0?(r+=" !",z?r+=""+le:r+=""+c):r+=" "+!P.valid+" ",r+=") { ",m=x.keyword;var G=G||[];G.push(r),r="";var G=G||[];G.push(r),r="",e.createErrors!==!1?(r+=" { keyword: '"+(m||"custom")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { keyword: '"+x.keyword+"' } ",e.opts.messages!==!1&&(r+=` , message: 'should pass "`+x.keyword+`" keyword validation' `),e.opts.verbose&&(r+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+b+" "),r+=" } "):r+=" {} ";var Te=r;r=G.pop(),!e.compositeRule&&p?e.async?r+=" throw new ValidationError(["+Te+"]); ":r+=" validate.errors = ["+Te+"]; return false; ":r+=" var err = "+Te+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";var se=r;r=G.pop(),I?P.errors?P.errors!="full"&&(r+=" for (var "+F+"="+y+"; "+F+"<errors; "+F+"++) { var "+A+" = vErrors["+F+"]; if ("+A+".dataPath === undefined) "+A+".dataPath = (dataPath || '') + "+e.errorPath+"; if ("+A+".schemaPath === undefined) { "+A+'.schemaPath = "'+f+'"; } ',e.opts.verbose&&(r+=" "+A+".schema = "+v+"; "+A+".data = "+b+"; "),r+=" } "):P.errors===!1?r+=" "+se+" ":(r+=" if ("+y+" == errors) { "+se+" } else { for (var "+F+"="+y+"; "+F+"<errors; "+F+"++) { var "+A+" = vErrors["+F+"]; if ("+A+".dataPath === undefined) "+A+".dataPath = (dataPath || '') + "+e.errorPath+"; if ("+A+".schemaPath === undefined) { "+A+'.schemaPath = "'+f+'"; } ',e.opts.verbose&&(r+=" "+A+".schema = "+v+"; "+A+".data = "+b+"; "),r+=" } } "):z?(r+=" var err = ",e.createErrors!==!1?(r+=" { keyword: '"+(m||"custom")+"' , dataPath: (dataPath || '') + "+e.errorPath+" , schemaPath: "+e.util.toQuotedString(f)+" , params: { keyword: '"+x.keyword+"' } ",e.opts.messages!==!1&&(r+=` , message: 'should pass "`+x.keyword+`" keyword validation' `),e.opts.verbose&&(r+=" , schema: validate.schema"+d+" , parentSchema: validate.schema"+e.schemaPath+" , data: "+b+" "),r+=" } "):r+=" {} ",r+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!e.compositeRule&&p&&(e.async?r+=" throw new ValidationError(vErrors); ":r+=" validate.errors = vErrors; return false; ")):P.errors===!1?r+=" "+se+" ":(r+=" if (Array.isArray("+M+")) { if (vErrors === null) vErrors = "+M+"; else vErrors = vErrors.concat("+M+"); errors = vErrors.length; for (var "+F+"="+y+"; "+F+"<errors; "+F+"++) { var "+A+" = vErrors["+F+"]; if ("+A+".dataPath === undefined) "+A+".dataPath = (dataPath || '') + "+e.errorPath+"; "+A+'.schemaPath = "'+f+'"; ',e.opts.verbose&&(r+=" "+A+".schema = "+v+"; "+A+".data = "+b+"; "),r+=" } } else { "+se+" } "),r+=" } ",p&&(r+=" else { ")}return r}});var ms=K((Sh,Hd)=>{Hd.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 io=K((xh,no)=>{"use strict";var so=ms();no.exports={$id:"https://github.com/ajv-validator/ajv/blob/master/lib/definition_schema.js",definitions:{simpleTypes:so.definitions.simpleTypes},type:"object",dependencies:{schema:["validate"],$data:["validate"],statements:["inline"],valid:{not:{required:["macro"]}}},properties:{type:so.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 lo=K((Ph,oo)=>{"use strict";var Zd=/^[a-z_$][a-z0-9_$-]*$/i,Bd=ao(),Kd=io();oo.exports={add:Qd,get:Wd,remove:Jd,validate:vs};function Qd(a,e){var t=this.RULES;if(t.keywords[a])throw new Error("Keyword "+a+" is already defined");if(!Zd.test(a))throw new Error("Keyword "+a+" is not a valid identifier");if(e){this.validateKeyword(e,!0);var s=e.type;if(Array.isArray(s))for(var r=0;r<s.length;r++)l(a,s[r],e);else l(a,s,e);var n=e.metaSchema;n&&(e.$data&&this._opts.$data&&(n={anyOf:[n,{$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"}]}),e.validateSchema=this.compile(n,!0))}t.keywords[a]=t.all[a]=!0;function l(o,d,f){for(var p,m=0;m<t.length;m++){var b=t[m];if(b.type==d){p=b;break}}p||(p={type:d,rules:[]},t.push(p));var c={keyword:o,definition:f,custom:!0,code:Bd,implements:f.implements};p.rules.push(c),t.custom[o]=c}return this}function Wd(a){var e=this.RULES.custom[a];return e?e.definition:this.RULES.keywords[a]||!1}function Jd(a){var e=this.RULES;delete e.keywords[a],delete e.all[a],delete e.custom[a];for(var t=0;t<e.length;t++)for(var s=e[t].rules,r=0;r<s.length;r++)if(s[r].keyword==a){s.splice(r,1);break}return this}function vs(a,e){vs.errors=null;var t=this._validateKeyword=this._validateKeyword||this.compile(Kd,!0);if(t(a))return!0;if(vs.errors=t.errors,e)throw new Error("custom keyword definition is invalid: "+this.errorsText(t.errors));return!1}});var co=K((wh,Gd)=>{Gd.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 bo=K((Oh,_o)=>{"use strict";var fo=Vn(),Xr=ia(),Yd=Hn(),po=rs(),Xd=os(),ef=ti(),rf=Wi(),ho=Yi(),mo=Yr();_o.exports=ge;ge.prototype.validate=af;ge.prototype.compile=sf;ge.prototype.addSchema=nf;ge.prototype.addMetaSchema=of;ge.prototype.validateSchema=lf;ge.prototype.getSchema=uf;ge.prototype.removeSchema=ff;ge.prototype.addFormat=bf;ge.prototype.errorsText=_f;ge.prototype._addSchema=pf;ge.prototype._compile=hf;ge.prototype.compileAsync=ro();var ma=lo();ge.prototype.addKeyword=ma.add;ge.prototype.getKeyword=ma.get;ge.prototype.removeKeyword=ma.remove;ge.prototype.validateKeyword=ma.validate;var vo=oa();ge.ValidationError=vo.Validation;ge.MissingRefError=vo.MissingRef;ge.$dataMetaSchema=ho;var ha="http://json-schema.org/draft-07/schema",uo=["removeAdditional","useDefaults","coerceTypes","strictDefaults"],tf=["/properties"];function ge(a){if(!(this instanceof ge))return new ge(a);a=this._opts=mo.copy(a)||{},Of(this),this._schemas={},this._refs={},this._fragments={},this._formats=ef(a.format),this._cache=a.cache||new Yd,this._loadingSchemas={},this._compilations=[],this.RULES=rf(),this._getId=mf(a),a.loopRequired=a.loopRequired||1/0,a.errorDataPath=="property"&&(a._errorDataPathProperty=!0),a.serialize===void 0&&(a.serialize=Xd),this._metaOpts=wf(this),a.formats&&xf(this),a.keywords&&Pf(this),Ef(this),typeof a.meta=="object"&&this.addMetaSchema(a.meta),a.nullable&&this.addKeyword("nullable",{metaSchema:{type:"boolean"}}),Sf(this)}function af(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 sf(a,e){var t=this._addSchema(a,void 0,e);return t.validate||this._compile(t)}function nf(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=Xr.normalizeId(e||n),yo(this,e),this._schemas[e]=this._addSchema(a,t,s,!0),this}function of(a,e,t){return this.addSchema(a,e,t,!0),this}function lf(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||cf(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 cf(a){var e=a._opts.meta;return a._opts.defaultMeta=typeof e=="object"?a._getId(e)||e:a.getSchema(ha)?ha:void 0,a._opts.defaultMeta}function uf(a){var e=go(this,a);switch(typeof e){case"object":return e.validate||this._compile(e);case"string":return this.getSchema(e);case"undefined":return df(this,a)}}function df(a,e){var t=Xr.schema.call(a,{schema:{}},e);if(t){var s=t.schema,r=t.root,n=t.baseId,l=fo.call(a,s,r,void 0,n);return a._fragments[e]=new po({ref:e,fragment:!0,schema:s,root:r,baseId:n,validate:l}),l}}function go(a,e){return e=Xr.normalizeId(e),a._schemas[e]||a._refs[e]||a._fragments[e]}function ff(a){if(a instanceof RegExp)return pa(this,this._schemas,a),pa(this,this._refs,a),this;switch(typeof a){case"undefined":return pa(this,this._schemas),pa(this,this._refs),this._cache.clear(),this;case"string":var e=go(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=Xr.normalizeId(r),delete this._schemas[r],delete this._refs[r])}return this}function pa(a,e,t){for(var s in e){var r=e[s];!r.meta&&(!t||t.test(s))&&(a._cache.del(r.cacheKey),delete e[s])}}function pf(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=Xr.normalizeId(this._getId(a));o&&s&&yo(this,o);var d=this._opts.validateSchema!==!1&&!e,f;d&&!(f=o&&o==Xr.normalizeId(a.$schema))&&this.validateSchema(a,!0);var p=Xr.ids.call(this,a),m=new po({id:o,schema:a,localRefs:p,cacheKey:n,meta:t});return o[0]!="#"&&s&&(this._refs[o]=m),this._cache.put(n,m),d&&f&&this.validateSchema(a,!0),m}function hf(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=fo.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 mf(a){switch(a.schemaId){case"auto":return yf;case"id":return vf;default:return gf}}function vf(a){return a.$id&&this.logger.warn("schema $id ignored",a.$id),a.id}function gf(a){return a.id&&this.logger.warn("schema id ignored",a.id),a.$id}function yf(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 _f(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 bf(a,e){return typeof e=="string"&&(e=new RegExp(e)),this._formats[a]=e,this}function Ef(a){var e;if(a._opts.$data&&(e=co(),a.addMetaSchema(e,e.$id,!0)),a._opts.meta!==!1){var t=ms();a._opts.$data&&(t=ho(t,tf)),a.addMetaSchema(t,ha,!0),a._refs["http://json-schema.org/schema"]=ha}}function Sf(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 xf(a){for(var e in a._opts.formats){var t=a._opts.formats[e];a.addFormat(e,t)}}function Pf(a){for(var e in a._opts.keywords){var t=a._opts.keywords[e];a.addKeyword(e,t)}}function yo(a,e){if(a._schemas[e]||a._refs[e])throw new Error('schema with key or id "'+e+'" already exists')}function wf(a){for(var e=mo.copy(a._opts),t=0;t<uo.length;t++)delete e[uo[t]];return e}function Of(a){var e=a._opts.logger;if(e===!1)a.logger={log:gs,warn:gs,error:gs};else{if(e===void 0&&(e=console),!(typeof e=="object"&&e.log&&e.warn&&e.error))throw new Error("logger must implement log, warn and error methods");a.logger=e}}function gs(){}});var i={};ql(i,{BRAND:()=>pc,DIRTY:()=>jr,EMPTY_PATH:()=>Zl,INVALID:()=>Z,NEVER:()=>Gc,OK:()=>Re,ParseStatus:()=>Pe,Schema:()=>J,ZodAny:()=>wr,ZodArray:()=>br,ZodBigInt:()=>Lr,ZodBoolean:()=>Mr,ZodBranded:()=>wt,ZodCatch:()=>Jr,ZodDate:()=>qr,ZodDefault:()=>Wr,ZodDiscriminatedUnion:()=>qt,ZodEffects:()=>Ke,ZodEnum:()=>Kr,ZodError:()=>ke,ZodFirstPartyTypeKind:()=>R,ZodFunction:()=>Vt,ZodIntersection:()=>Hr,ZodIssueCode:()=>w,ZodLazy:()=>Zr,ZodLiteral:()=>Br,ZodMap:()=>ft,ZodNaN:()=>ht,ZodNativeEnum:()=>Qr,ZodNever:()=>Ge,ZodNull:()=>Vr,ZodNullable:()=>lr,ZodNumber:()=>Fr,ZodObject:()=>Ne,ZodOptional:()=>Ze,ZodParsedType:()=>N,ZodPipeline:()=>Ot,ZodPromise:()=>Or,ZodReadonly:()=>Gr,ZodRecord:()=>Ut,ZodSchema:()=>J,ZodSet:()=>pt,ZodString:()=>Pr,ZodSymbol:()=>ut,ZodTransformer:()=>Ke,ZodTuple:()=>or,ZodType:()=>J,ZodUndefined:()=>Ur,ZodUnion:()=>zr,ZodUnknown:()=>_r,ZodVoid:()=>dt,addIssueToContext:()=>k,any:()=>Sc,array:()=>Oc,bigint:()=>gc,boolean:()=>Ys,coerce:()=>Jc,custom:()=>Ws,date:()=>yc,datetimeRegex:()=>Ks,defaultErrorMap:()=>gr,discriminatedUnion:()=>Dc,effect:()=>Vc,enum:()=>Mc,function:()=>jc,getErrorMap:()=>ot,getParsedType:()=>ir,instanceof:()=>mc,intersection:()=>Ic,isAborted:()=>Lt,isAsync:()=>lt,isDirty:()=>Mt,isValid:()=>xr,late:()=>hc,lazy:()=>Fc,literal:()=>Lc,makeIssue:()=>Pt,map:()=>kc,nan:()=>vc,nativeEnum:()=>qc,never:()=>Pc,null:()=>Ec,nullable:()=>Hc,number:()=>Gs,object:()=>Rc,objectUtil:()=>Ia,oboolean:()=>Wc,onumber:()=>Qc,optional:()=>zc,ostring:()=>Kc,pipeline:()=>Bc,preprocess:()=>Zc,promise:()=>Uc,quotelessJson:()=>Vl,record:()=>$c,set:()=>Nc,setErrorMap:()=>Hl,strictObject:()=>Tc,string:()=>Js,symbol:()=>_c,transformer:()=>Vc,tuple:()=>Cc,undefined:()=>bc,union:()=>Ac,unknown:()=>xc,util:()=>X,void:()=>wc});var X;(function(a){a.assertEqual=r=>{};function e(r){}a.assertIs=e;function t(r){throw new Error}a.assertNever=t,a.arrayToEnum=r=>{let n={};for(let l of r)n[l]=l;return n},a.getValidEnumValues=r=>{let n=a.objectKeys(r).filter(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})(X||(X={}));var Ia;(function(a){a.mergeShapes=(e,t)=>({...e,...t})})(Ia||(Ia={}));var N=X.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),ir=a=>{switch(typeof a){case"undefined":return N.undefined;case"string":return N.string;case"number":return Number.isNaN(a)?N.nan:N.number;case"boolean":return N.boolean;case"function":return N.function;case"bigint":return N.bigint;case"symbol":return N.symbol;case"object":return Array.isArray(a)?N.array:a===null?N.null:a.then&&typeof a.then=="function"&&a.catch&&typeof a.catch=="function"?N.promise:typeof Map<"u"&&a instanceof Map?N.map:typeof Set<"u"&&a instanceof Set?N.set:typeof Date<"u"&&a instanceof Date?N.date:N.object;default:return N.unknown}};var w=X.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),Vl=a=>JSON.stringify(a,null,2).replace(/"([^"]+)":/g,"$1:"),ke=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,d=0;for(;d<l.path.length;){let f=l.path[d];d===l.path.length-1?(o[f]=o[f]||{_errors:[]},o[f]._errors.push(t(l))):o[f]=o[f]||{_errors:[]},o=o[f],d++}}};return r(this),s}static assert(e){if(!(e instanceof a))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,X.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){let t={},s=[];for(let r of this.issues)if(r.path.length>0){let n=r.path[0];t[n]=t[n]||[],t[n].push(e(r))}else s.push(e(r));return{formErrors:s,fieldErrors:t}}get formErrors(){return this.flatten()}};ke.create=a=>new ke(a);var zl=(a,e)=>{let t;switch(a.code){case w.invalid_type:a.received===N.undefined?t="Required":t=`Expected ${a.expected}, received ${a.received}`;break;case w.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(a.expected,X.jsonStringifyReplacer)}`;break;case w.unrecognized_keys:t=`Unrecognized key(s) in object: ${X.joinValues(a.keys,", ")}`;break;case w.invalid_union:t="Invalid input";break;case w.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${X.joinValues(a.options)}`;break;case w.invalid_enum_value:t=`Invalid enum value. Expected ${X.joinValues(a.options)}, received '${a.received}'`;break;case w.invalid_arguments:t="Invalid function arguments";break;case w.invalid_return_type:t="Invalid function return type";break;case w.invalid_date:t="Invalid date";break;case w.invalid_string:typeof a.validation=="object"?"includes"in a.validation?(t=`Invalid input: must include "${a.validation.includes}"`,typeof a.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${a.validation.position}`)):"startsWith"in a.validation?t=`Invalid input: must start with "${a.validation.startsWith}"`:"endsWith"in a.validation?t=`Invalid input: must end with "${a.validation.endsWith}"`:X.assertNever(a.validation):a.validation!=="regex"?t=`Invalid ${a.validation}`:t="Invalid";break;case w.too_small:a.type==="array"?t=`Array must contain ${a.exact?"exactly":a.inclusive?"at least":"more than"} ${a.minimum} element(s)`:a.type==="string"?t=`String must contain ${a.exact?"exactly":a.inclusive?"at least":"over"} ${a.minimum} character(s)`:a.type==="number"?t=`Number must be ${a.exact?"exactly equal to ":a.inclusive?"greater than or equal to ":"greater than "}${a.minimum}`:a.type==="bigint"?t=`Number must be ${a.exact?"exactly equal to ":a.inclusive?"greater than or equal to ":"greater than "}${a.minimum}`:a.type==="date"?t=`Date must be ${a.exact?"exactly equal to ":a.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(a.minimum))}`:t="Invalid input";break;case w.too_big:a.type==="array"?t=`Array must contain ${a.exact?"exactly":a.inclusive?"at most":"less than"} ${a.maximum} element(s)`:a.type==="string"?t=`String must contain ${a.exact?"exactly":a.inclusive?"at most":"under"} ${a.maximum} character(s)`:a.type==="number"?t=`Number must be ${a.exact?"exactly":a.inclusive?"less than or equal to":"less than"} ${a.maximum}`:a.type==="bigint"?t=`BigInt must be ${a.exact?"exactly":a.inclusive?"less than or equal to":"less than"} ${a.maximum}`:a.type==="date"?t=`Date must be ${a.exact?"exactly":a.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(a.maximum))}`:t="Invalid input";break;case w.custom:t="Invalid input";break;case w.invalid_intersection_types:t="Intersection results could not be merged";break;case w.not_multiple_of:t=`Number must be a multiple of ${a.multipleOf}`;break;case w.not_finite:t="Number must be finite";break;default:t=e.defaultError,X.assertNever(a)}return{message:t}},gr=zl;var Vs=gr;function Hl(a){Vs=a}function ot(){return Vs}var Pt=a=>{let{data:e,path:t,errorMaps:s,issueData:r}=a,n=[...t,...r.path||[]],l={...r,path:n};if(r.message!==void 0)return{...r,path:n,message:r.message};let o="",d=s.filter(f=>!!f).slice().reverse();for(let f of d)o=f(l,{data:e,defaultError:o}).message;return{...r,path:n,message:o}},Zl=[];function k(a,e){let t=ot(),s=Pt({issueData:e,data:a.data,path:a.path,errorMaps:[a.common.contextualErrorMap,a.schemaErrorMap,t,t===gr?void 0:gr].filter(r=>!!r)});a.common.issues.push(s)}var Pe=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"}),jr=a=>({status:"dirty",value:a}),Re=a=>({status:"valid",value:a}),Lt=a=>a.status==="aborted",Mt=a=>a.status==="dirty",xr=a=>a.status==="valid",lt=a=>typeof Promise<"u"&&a instanceof Promise;var V;(function(a){a.errToObj=e=>typeof e=="string"?{message:e}:e||{},a.toString=e=>typeof e=="string"?e:e?.message})(V||(V={}));var Be=class{constructor(e,t,s,r){this._cachedPath=[],this.parent=e,this.data=t,this._path=s,this._key=r}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},zs=(a,e)=>{if(xr(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 ke(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:d}=a;return l.code==="invalid_enum_value"?{message:d??o.defaultError}:typeof o.data>"u"?{message:d??s??o.defaultError}:l.code!=="invalid_type"?{message:o.defaultError}:{message:d??t??o.defaultError}},description:r}}var J=class{get description(){return this._def.description}_getType(e){return ir(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:ir(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Pe,ctx:{common:e.parent.common,data:e.data,parsedType:ir(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(lt(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:ir(e)},r=this._parseSync({data:e,path:s.path,parent:s});return zs(s,r)}"~validate"(e){let t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ir(e)};if(!this["~standard"].async)try{let s=this._parseSync({data:e,path:[],parent:t});return xr(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=>xr(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:ir(e)},r=this._parse({data:e,path:s.path,parent:s}),n=await(lt(r)?r:Promise.resolve(r));return zs(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(d=>d?!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 Ke({schema:this,typeName:R.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:t=>this["~validate"](t)}}optional(){return Ze.create(this,this._def)}nullable(){return lr.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return br.create(this)}promise(){return Or.create(this,this._def)}or(e){return zr.create([this,e],this._def)}and(e){return Hr.create(this,e,this._def)}transform(e){return new Ke({...Q(this._def),schema:this,typeName:R.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let t=typeof e=="function"?e:()=>e;return new Wr({...Q(this._def),innerType:this,defaultValue:t,typeName:R.ZodDefault})}brand(){return new wt({typeName:R.ZodBranded,type:this,...Q(this._def)})}catch(e){let t=typeof e=="function"?e:()=>e;return new Jr({...Q(this._def),innerType:this,catchValue:t,typeName:R.ZodCatch})}describe(e){let t=this.constructor;return new t({...this._def,description:e})}pipe(e){return Ot.create(this,e)}readonly(){return Gr.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},Bl=/^c[^\s-]{8,}$/i,Kl=/^[0-9a-z]+$/,Ql=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Wl=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,Jl=/^[a-z0-9_-]{21}$/i,Gl=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Yl=/^[-+]?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)?)??$/,Xl=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,ec="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Ca,rc=/^(?:(?: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])$/,tc=/^(?:(?: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])$/,ac=/^(([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]))$/,sc=/^(([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])$/,nc=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,ic=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Zs="((\\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])))",oc=new RegExp(`^${Zs}$`);function Bs(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 lc(a){return new RegExp(`^${Bs(a)}$`)}function Ks(a){let e=`${Zs}T${Bs(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 cc(a,e){return!!((e==="v4"||!e)&&rc.test(a)||(e==="v6"||!e)&&ac.test(a))}function uc(a,e){if(!Gl.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 dc(a,e){return!!((e==="v4"||!e)&&tc.test(a)||(e==="v6"||!e)&&sc.test(a))}var Pr=class a extends J{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==N.string){let n=this._getOrReturnCtx(e);return k(n,{code:w.invalid_type,expected:N.string,received:n.parsedType}),Z}let s=new Pe,r;for(let n of this._def.checks)if(n.kind==="min")e.data.length<n.value&&(r=this._getOrReturnCtx(e,r),k(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),k(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?k(r,{code:w.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message}):o&&k(r,{code:w.too_small,minimum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message}),s.dirty())}else if(n.kind==="email")Xl.test(e.data)||(r=this._getOrReturnCtx(e,r),k(r,{validation:"email",code:w.invalid_string,message:n.message}),s.dirty());else if(n.kind==="emoji")Ca||(Ca=new RegExp(ec,"u")),Ca.test(e.data)||(r=this._getOrReturnCtx(e,r),k(r,{validation:"emoji",code:w.invalid_string,message:n.message}),s.dirty());else if(n.kind==="uuid")Wl.test(e.data)||(r=this._getOrReturnCtx(e,r),k(r,{validation:"uuid",code:w.invalid_string,message:n.message}),s.dirty());else if(n.kind==="nanoid")Jl.test(e.data)||(r=this._getOrReturnCtx(e,r),k(r,{validation:"nanoid",code:w.invalid_string,message:n.message}),s.dirty());else if(n.kind==="cuid")Bl.test(e.data)||(r=this._getOrReturnCtx(e,r),k(r,{validation:"cuid",code:w.invalid_string,message:n.message}),s.dirty());else if(n.kind==="cuid2")Kl.test(e.data)||(r=this._getOrReturnCtx(e,r),k(r,{validation:"cuid2",code:w.invalid_string,message:n.message}),s.dirty());else if(n.kind==="ulid")Ql.test(e.data)||(r=this._getOrReturnCtx(e,r),k(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),k(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),k(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),k(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),k(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),k(r,{code:w.invalid_string,validation:{endsWith:n.value},message:n.message}),s.dirty()):n.kind==="datetime"?Ks(n).test(e.data)||(r=this._getOrReturnCtx(e,r),k(r,{code:w.invalid_string,validation:"datetime",message:n.message}),s.dirty()):n.kind==="date"?oc.test(e.data)||(r=this._getOrReturnCtx(e,r),k(r,{code:w.invalid_string,validation:"date",message:n.message}),s.dirty()):n.kind==="time"?lc(n).test(e.data)||(r=this._getOrReturnCtx(e,r),k(r,{code:w.invalid_string,validation:"time",message:n.message}),s.dirty()):n.kind==="duration"?Yl.test(e.data)||(r=this._getOrReturnCtx(e,r),k(r,{validation:"duration",code:w.invalid_string,message:n.message}),s.dirty()):n.kind==="ip"?cc(e.data,n.version)||(r=this._getOrReturnCtx(e,r),k(r,{validation:"ip",code:w.invalid_string,message:n.message}),s.dirty()):n.kind==="jwt"?uc(e.data,n.alg)||(r=this._getOrReturnCtx(e,r),k(r,{validation:"jwt",code:w.invalid_string,message:n.message}),s.dirty()):n.kind==="cidr"?dc(e.data,n.version)||(r=this._getOrReturnCtx(e,r),k(r,{validation:"cidr",code:w.invalid_string,message:n.message}),s.dirty()):n.kind==="base64"?nc.test(e.data)||(r=this._getOrReturnCtx(e,r),k(r,{validation:"base64",code:w.invalid_string,message:n.message}),s.dirty()):n.kind==="base64url"?ic.test(e.data)||(r=this._getOrReturnCtx(e,r),k(r,{validation:"base64url",code:w.invalid_string,message:n.message}),s.dirty()):X.assertNever(n);return{status:s.value,value:e.data}}_regex(e,t,s){return this.refinement(r=>e.test(r),{validation:t,code:w.invalid_string,...V.errToObj(s)})}_addCheck(e){return new a({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...V.errToObj(e)})}url(e){return this._addCheck({kind:"url",...V.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...V.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...V.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...V.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...V.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...V.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...V.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...V.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...V.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...V.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...V.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...V.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...V.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...V.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...V.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...V.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...V.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...V.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...V.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...V.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...V.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...V.errToObj(t)})}nonempty(e){return this.min(1,V.errToObj(e))}trim(){return new a({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new a({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new a({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}};Pr.create=a=>new Pr({checks:[],typeName:R.ZodString,coerce:a?.coerce??!1,...Q(a)});function fc(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 Fr=class a extends J{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==N.number){let n=this._getOrReturnCtx(e);return k(n,{code:w.invalid_type,expected:N.number,received:n.parsedType}),Z}let s,r=new Pe;for(let n of this._def.checks)n.kind==="int"?X.isInteger(e.data)||(s=this._getOrReturnCtx(e,s),k(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),k(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),k(s,{code:w.too_big,maximum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),r.dirty()):n.kind==="multipleOf"?fc(e.data,n.value)!==0&&(s=this._getOrReturnCtx(e,s),k(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),k(s,{code:w.not_finite,message:n.message}),r.dirty()):X.assertNever(n);return{status:r.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,V.toString(t))}gt(e,t){return this.setLimit("min",e,!1,V.toString(t))}lte(e,t){return this.setLimit("max",e,!0,V.toString(t))}lt(e,t){return this.setLimit("max",e,!1,V.toString(t))}setLimit(e,t,s,r){return new a({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:V.toString(r)}]})}_addCheck(e){return new a({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:V.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:V.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:V.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:V.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:V.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:V.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:V.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:V.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:V.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&X.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let s of this._def.checks){if(s.kind==="finite"||s.kind==="int"||s.kind==="multipleOf")return!0;s.kind==="min"?(t===null||s.value>t)&&(t=s.value):s.kind==="max"&&(e===null||s.value<e)&&(e=s.value)}return Number.isFinite(t)&&Number.isFinite(e)}};Fr.create=a=>new Fr({checks:[],typeName:R.ZodNumber,coerce:a?.coerce||!1,...Q(a)});var Lr=class a extends J{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==N.bigint)return this._getInvalidInput(e);let s,r=new Pe;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),k(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),k(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),k(s,{code:w.not_multiple_of,multipleOf:n.value,message:n.message}),r.dirty()):X.assertNever(n);return{status:r.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return k(t,{code:w.invalid_type,expected:N.bigint,received:t.parsedType}),Z}gte(e,t){return this.setLimit("min",e,!0,V.toString(t))}gt(e,t){return this.setLimit("min",e,!1,V.toString(t))}lte(e,t){return this.setLimit("max",e,!0,V.toString(t))}lt(e,t){return this.setLimit("max",e,!1,V.toString(t))}setLimit(e,t,s,r){return new a({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:V.toString(r)}]})}_addCheck(e){return new a({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:V.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:V.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:V.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:V.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:V.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}};Lr.create=a=>new Lr({checks:[],typeName:R.ZodBigInt,coerce:a?.coerce??!1,...Q(a)});var Mr=class extends J{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==N.boolean){let s=this._getOrReturnCtx(e);return k(s,{code:w.invalid_type,expected:N.boolean,received:s.parsedType}),Z}return Re(e.data)}};Mr.create=a=>new Mr({typeName:R.ZodBoolean,coerce:a?.coerce||!1,...Q(a)});var qr=class a extends J{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==N.date){let n=this._getOrReturnCtx(e);return k(n,{code:w.invalid_type,expected:N.date,received:n.parsedType}),Z}if(Number.isNaN(e.data.getTime())){let n=this._getOrReturnCtx(e);return k(n,{code:w.invalid_date}),Z}let s=new Pe,r;for(let n of this._def.checks)n.kind==="min"?e.data.getTime()<n.value&&(r=this._getOrReturnCtx(e,r),k(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),k(r,{code:w.too_big,message:n.message,inclusive:!0,exact:!1,maximum:n.value,type:"date"}),s.dirty()):X.assertNever(n);return{status:s.value,value:new Date(e.data.getTime())}}_addCheck(e){return new a({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:V.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:V.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e!=null?new Date(e):null}};qr.create=a=>new qr({checks:[],coerce:a?.coerce||!1,typeName:R.ZodDate,...Q(a)});var ut=class extends J{_parse(e){if(this._getType(e)!==N.symbol){let s=this._getOrReturnCtx(e);return k(s,{code:w.invalid_type,expected:N.symbol,received:s.parsedType}),Z}return Re(e.data)}};ut.create=a=>new ut({typeName:R.ZodSymbol,...Q(a)});var Ur=class extends J{_parse(e){if(this._getType(e)!==N.undefined){let s=this._getOrReturnCtx(e);return k(s,{code:w.invalid_type,expected:N.undefined,received:s.parsedType}),Z}return Re(e.data)}};Ur.create=a=>new Ur({typeName:R.ZodUndefined,...Q(a)});var Vr=class extends J{_parse(e){if(this._getType(e)!==N.null){let s=this._getOrReturnCtx(e);return k(s,{code:w.invalid_type,expected:N.null,received:s.parsedType}),Z}return Re(e.data)}};Vr.create=a=>new Vr({typeName:R.ZodNull,...Q(a)});var wr=class extends J{constructor(){super(...arguments),this._any=!0}_parse(e){return Re(e.data)}};wr.create=a=>new wr({typeName:R.ZodAny,...Q(a)});var _r=class extends J{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Re(e.data)}};_r.create=a=>new _r({typeName:R.ZodUnknown,...Q(a)});var Ge=class extends J{_parse(e){let t=this._getOrReturnCtx(e);return k(t,{code:w.invalid_type,expected:N.never,received:t.parsedType}),Z}};Ge.create=a=>new Ge({typeName:R.ZodNever,...Q(a)});var dt=class extends J{_parse(e){if(this._getType(e)!==N.undefined){let s=this._getOrReturnCtx(e);return k(s,{code:w.invalid_type,expected:N.void,received:s.parsedType}),Z}return Re(e.data)}};dt.create=a=>new dt({typeName:R.ZodVoid,...Q(a)});var br=class a extends J{_parse(e){let{ctx:t,status:s}=this._processInputParams(e),r=this._def;if(t.parsedType!==N.array)return k(t,{code:w.invalid_type,expected:N.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)&&(k(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&&(k(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&&(k(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 Be(t,l,t.path,o)))).then(l=>Pe.mergeArray(s,l));let n=[...t.data].map((l,o)=>r.type._parseSync(new Be(t,l,t.path,o)));return Pe.mergeArray(s,n)}get element(){return this._def.type}min(e,t){return new a({...this._def,minLength:{value:e,message:V.toString(t)}})}max(e,t){return new a({...this._def,maxLength:{value:e,message:V.toString(t)}})}length(e,t){return new a({...this._def,exactLength:{value:e,message:V.toString(t)}})}nonempty(e){return this.min(1,e)}};br.create=(a,e)=>new br({type:a,minLength:null,maxLength:null,exactLength:null,typeName:R.ZodArray,...Q(e)});function ct(a){if(a instanceof Ne){let e={};for(let t in a.shape){let s=a.shape[t];e[t]=Ze.create(ct(s))}return new Ne({...a._def,shape:()=>e})}else return a instanceof br?new br({...a._def,type:ct(a.element)}):a instanceof Ze?Ze.create(ct(a.unwrap())):a instanceof lr?lr.create(ct(a.unwrap())):a instanceof or?or.create(a.items.map(e=>ct(e))):a}var Ne=class a extends J{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),t=X.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==N.object){let f=this._getOrReturnCtx(e);return k(f,{code:w.invalid_type,expected:N.object,received:f.parsedType}),Z}let{status:s,ctx:r}=this._processInputParams(e),{shape:n,keys:l}=this._getCached(),o=[];if(!(this._def.catchall instanceof Ge&&this._def.unknownKeys==="strip"))for(let f in r.data)l.includes(f)||o.push(f);let d=[];for(let f of l){let p=n[f],m=r.data[f];d.push({key:{status:"valid",value:f},value:p._parse(new Be(r,m,r.path,f)),alwaysSet:f in r.data})}if(this._def.catchall instanceof Ge){let f=this._def.unknownKeys;if(f==="passthrough")for(let p of o)d.push({key:{status:"valid",value:p},value:{status:"valid",value:r.data[p]}});else if(f==="strict")o.length>0&&(k(r,{code:w.unrecognized_keys,keys:o}),s.dirty());else if(f!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let f=this._def.catchall;for(let p of o){let m=r.data[p];d.push({key:{status:"valid",value:p},value:f._parse(new Be(r,m,r.path,p)),alwaysSet:p in r.data})}}return r.common.async?Promise.resolve().then(async()=>{let f=[];for(let p of d){let m=await p.key,b=await p.value;f.push({key:m,value:b,alwaysSet:p.alwaysSet})}return f}).then(f=>Pe.mergeObjectSync(s,f)):Pe.mergeObjectSync(s,d)}get shape(){return this._def.shape()}strict(e){return V.errToObj,new a({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,s)=>{let r=this._def.errorMap?.(t,s).message??s.defaultError;return t.code==="unrecognized_keys"?{message:V.errToObj(e).message??r}:{message:r}}}:{}})}strip(){return new a({...this._def,unknownKeys:"strip"})}passthrough(){return new a({...this._def,unknownKeys:"passthrough"})}extend(e){return new a({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new a({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:R.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new a({...this._def,catchall:e})}pick(e){let t={};for(let s of X.objectKeys(e))e[s]&&this.shape[s]&&(t[s]=this.shape[s]);return new a({...this._def,shape:()=>t})}omit(e){let t={};for(let s of X.objectKeys(this.shape))e[s]||(t[s]=this.shape[s]);return new a({...this._def,shape:()=>t})}deepPartial(){return ct(this)}partial(e){let t={};for(let s of X.objectKeys(this.shape)){let r=this.shape[s];e&&!e[s]?t[s]=r:t[s]=r.optional()}return new a({...this._def,shape:()=>t})}required(e){let t={};for(let s of X.objectKeys(this.shape))if(e&&!e[s])t[s]=this.shape[s];else{let n=this.shape[s];for(;n instanceof Ze;)n=n._def.innerType;t[s]=n}return new a({...this._def,shape:()=>t})}keyof(){return Qs(X.objectKeys(this.shape))}};Ne.create=(a,e)=>new Ne({shape:()=>a,unknownKeys:"strip",catchall:Ge.create(),typeName:R.ZodObject,...Q(e)});Ne.strictCreate=(a,e)=>new Ne({shape:()=>a,unknownKeys:"strict",catchall:Ge.create(),typeName:R.ZodObject,...Q(e)});Ne.lazycreate=(a,e)=>new Ne({shape:a,unknownKeys:"strip",catchall:Ge.create(),typeName:R.ZodObject,...Q(e)});var zr=class extends J{_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 ke(o.ctx.common.issues));return k(t,{code:w.invalid_union,unionErrors:l}),Z}if(t.common.async)return Promise.all(s.map(async n=>{let l={...t,common:{...t.common,issues:[]},parent:null};return{result:await n._parseAsync({data:t.data,path:t.path,parent:l}),ctx:l}})).then(r);{let n,l=[];for(let d of s){let f={...t,common:{...t.common,issues:[]},parent:null},p=d._parseSync({data:t.data,path:t.path,parent:f});if(p.status==="valid")return p;p.status==="dirty"&&!n&&(n={result:p,ctx:f}),f.common.issues.length&&l.push(f.common.issues)}if(n)return t.common.issues.push(...n.ctx.common.issues),n.result;let o=l.map(d=>new ke(d));return k(t,{code:w.invalid_union,unionErrors:o}),Z}}get options(){return this._def.options}};zr.create=(a,e)=>new zr({options:a,typeName:R.ZodUnion,...Q(e)});var yr=a=>a instanceof Zr?yr(a.schema):a instanceof Ke?yr(a.innerType()):a instanceof Br?[a.value]:a instanceof Kr?a.options:a instanceof Qr?X.objectValues(a.enum):a instanceof Wr?yr(a._def.innerType):a instanceof Ur?[void 0]:a instanceof Vr?[null]:a instanceof Ze?[void 0,...yr(a.unwrap())]:a instanceof lr?[null,...yr(a.unwrap())]:a instanceof wt||a instanceof Gr?yr(a.unwrap()):a instanceof Jr?yr(a._def.innerType):[],qt=class a extends J{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==N.object)return k(t,{code:w.invalid_type,expected:N.object,received:t.parsedType}),Z;let s=this.discriminator,r=t.data[s],n=this.optionsMap.get(r);return n?t.common.async?n._parseAsync({data:t.data,path:t.path,parent:t}):n._parseSync({data:t.data,path:t.path,parent:t}):(k(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=yr(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:R.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:r,...Q(s)})}};function $a(a,e){let t=ir(a),s=ir(e);if(a===e)return{valid:!0,data:a};if(t===N.object&&s===N.object){let r=X.objectKeys(e),n=X.objectKeys(a).filter(o=>r.indexOf(o)!==-1),l={...a,...e};for(let o of n){let d=$a(a[o],e[o]);if(!d.valid)return{valid:!1};l[o]=d.data}return{valid:!0,data:l}}else if(t===N.array&&s===N.array){if(a.length!==e.length)return{valid:!1};let r=[];for(let n=0;n<a.length;n++){let l=a[n],o=e[n],d=$a(l,o);if(!d.valid)return{valid:!1};r.push(d.data)}return{valid:!0,data:r}}else return t===N.date&&s===N.date&&+a==+e?{valid:!0,data:a}:{valid:!1}}var Hr=class extends J{_parse(e){let{status:t,ctx:s}=this._processInputParams(e),r=(n,l)=>{if(Lt(n)||Lt(l))return Z;let o=$a(n.value,l.value);return o.valid?((Mt(n)||Mt(l))&&t.dirty(),{status:t.value,value:o.data}):(k(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}))}};Hr.create=(a,e,t)=>new Hr({left:a,right:e,typeName:R.ZodIntersection,...Q(t)});var or=class a extends J{_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==N.array)return k(s,{code:w.invalid_type,expected:N.array,received:s.parsedType}),Z;if(s.data.length<this._def.items.length)return k(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&&(k(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 d=this._def.items[o]||this._def.rest;return d?d._parse(new Be(s,l,s.path,o)):null}).filter(l=>!!l);return s.common.async?Promise.all(n).then(l=>Pe.mergeArray(t,l)):Pe.mergeArray(t,n)}get items(){return this._def.items}rest(e){return new a({...this._def,rest:e})}};or.create=(a,e)=>{if(!Array.isArray(a))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new or({items:a,typeName:R.ZodTuple,rest:null,...Q(e)})};var Ut=class a extends J{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==N.object)return k(s,{code:w.invalid_type,expected:N.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 Be(s,o,s.path,o)),value:l._parse(new Be(s,s.data[o],s.path,o)),alwaysSet:o in s.data});return s.common.async?Pe.mergeObjectAsync(t,r):Pe.mergeObjectSync(t,r)}get element(){return this._def.valueType}static create(e,t,s){return t instanceof J?new a({keyType:e,valueType:t,typeName:R.ZodRecord,...Q(s)}):new a({keyType:Pr.create(),valueType:e,typeName:R.ZodRecord,...Q(t)})}},ft=class extends J{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==N.map)return k(s,{code:w.invalid_type,expected:N.map,received:s.parsedType}),Z;let r=this._def.keyType,n=this._def.valueType,l=[...s.data.entries()].map(([o,d],f)=>({key:r._parse(new Be(s,o,s.path,[f,"key"])),value:n._parse(new Be(s,d,s.path,[f,"value"]))}));if(s.common.async){let o=new Map;return Promise.resolve().then(async()=>{for(let d of l){let f=await d.key,p=await d.value;if(f.status==="aborted"||p.status==="aborted")return Z;(f.status==="dirty"||p.status==="dirty")&&t.dirty(),o.set(f.value,p.value)}return{status:t.value,value:o}})}else{let o=new Map;for(let d of l){let f=d.key,p=d.value;if(f.status==="aborted"||p.status==="aborted")return Z;(f.status==="dirty"||p.status==="dirty")&&t.dirty(),o.set(f.value,p.value)}return{status:t.value,value:o}}}};ft.create=(a,e,t)=>new ft({valueType:e,keyType:a,typeName:R.ZodMap,...Q(t)});var pt=class a extends J{_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==N.set)return k(s,{code:w.invalid_type,expected:N.set,received:s.parsedType}),Z;let r=this._def;r.minSize!==null&&s.data.size<r.minSize.value&&(k(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&&(k(s,{code:w.too_big,maximum:r.maxSize.value,type:"set",inclusive:!0,exact:!1,message:r.maxSize.message}),t.dirty());let n=this._def.valueType;function l(d){let f=new Set;for(let p of d){if(p.status==="aborted")return Z;p.status==="dirty"&&t.dirty(),f.add(p.value)}return{status:t.value,value:f}}let o=[...s.data.values()].map((d,f)=>n._parse(new Be(s,d,s.path,f)));return s.common.async?Promise.all(o).then(d=>l(d)):l(o)}min(e,t){return new a({...this._def,minSize:{value:e,message:V.toString(t)}})}max(e,t){return new a({...this._def,maxSize:{value:e,message:V.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};pt.create=(a,e)=>new pt({valueType:a,minSize:null,maxSize:null,typeName:R.ZodSet,...Q(e)});var Vt=class a extends J{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==N.function)return k(t,{code:w.invalid_type,expected:N.function,received:t.parsedType}),Z;function s(o,d){return Pt({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,ot(),gr].filter(f=>!!f),issueData:{code:w.invalid_arguments,argumentsError:d}})}function r(o,d){return Pt({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,ot(),gr].filter(f=>!!f),issueData:{code:w.invalid_return_type,returnTypeError:d}})}let n={errorMap:t.common.contextualErrorMap},l=t.data;if(this._def.returns instanceof Or){let o=this;return Re(async function(...d){let f=new ke([]),p=await o._def.args.parseAsync(d,n).catch(c=>{throw f.addIssue(s(d,c)),f}),m=await Reflect.apply(l,this,p);return await o._def.returns._def.type.parseAsync(m,n).catch(c=>{throw f.addIssue(r(m,c)),f})})}else{let o=this;return Re(function(...d){let f=o._def.args.safeParse(d,n);if(!f.success)throw new ke([s(d,f.error)]);let p=Reflect.apply(l,this,f.data),m=o._def.returns.safeParse(p,n);if(!m.success)throw new ke([r(p,m.error)]);return m.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new a({...this._def,args:or.create(e).rest(_r.create())})}returns(e){return new a({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,s){return new a({args:e||or.create([]).rest(_r.create()),returns:t||_r.create(),typeName:R.ZodFunction,...Q(s)})}},Zr=class extends J{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}};Zr.create=(a,e)=>new Zr({getter:a,typeName:R.ZodLazy,...Q(e)});var Br=class extends J{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return k(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}};Br.create=(a,e)=>new Br({value:a,typeName:R.ZodLiteral,...Q(e)});function Qs(a,e){return new Kr({values:a,typeName:R.ZodEnum,...Q(e)})}var Kr=class a extends J{_parse(e){if(typeof e.data!="string"){let t=this._getOrReturnCtx(e),s=this._def.values;return k(t,{expected:X.joinValues(s),received:t.parsedType,code:w.invalid_type}),Z}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let t=this._getOrReturnCtx(e),s=this._def.values;return k(t,{received:t.data,code:w.invalid_enum_value,options:s}),Z}return Re(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})}};Kr.create=Qs;var Qr=class extends J{_parse(e){let t=X.getValidEnumValues(this._def.values),s=this._getOrReturnCtx(e);if(s.parsedType!==N.string&&s.parsedType!==N.number){let r=X.objectValues(t);return k(s,{expected:X.joinValues(r),received:s.parsedType,code:w.invalid_type}),Z}if(this._cache||(this._cache=new Set(X.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let r=X.objectValues(t);return k(s,{received:s.data,code:w.invalid_enum_value,options:r}),Z}return Re(e.data)}get enum(){return this._def.values}};Qr.create=(a,e)=>new Qr({values:a,typeName:R.ZodNativeEnum,...Q(e)});var Or=class extends J{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==N.promise&&t.common.async===!1)return k(t,{code:w.invalid_type,expected:N.promise,received:t.parsedType}),Z;let s=t.parsedType===N.promise?t.data:Promise.resolve(t.data);return Re(s.then(r=>this._def.type.parseAsync(r,{path:t.path,errorMap:t.common.contextualErrorMap})))}};Or.create=(a,e)=>new Or({type:a,typeName:R.ZodPromise,...Q(e)});var Ke=class extends J{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===R.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:s}=this._processInputParams(e),r=this._def.effect||null,n={addIssue:l=>{k(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 d=await this._def.schema._parseAsync({data:o,path:s.path,parent:s});return d.status==="aborted"?Z:d.status==="dirty"?jr(d.value):t.value==="dirty"?jr(d.value):d});{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"?jr(o.value):t.value==="dirty"?jr(o.value):o}}if(r.type==="refinement"){let l=o=>{let d=r.refinement(o,n);if(s.common.async)return Promise.resolve(d);if(d instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return 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(!xr(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=>xr(l)?Promise.resolve(r.transform(l.value,n)).then(o=>({status:t.value,value:o})):Z);X.assertNever(r)}};Ke.create=(a,e,t)=>new Ke({schema:a,typeName:R.ZodEffects,effect:e,...Q(t)});Ke.createWithPreprocess=(a,e,t)=>new Ke({schema:e,effect:{type:"preprocess",transform:a},typeName:R.ZodEffects,...Q(t)});var Ze=class extends J{_parse(e){return this._getType(e)===N.undefined?Re(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Ze.create=(a,e)=>new Ze({innerType:a,typeName:R.ZodOptional,...Q(e)});var lr=class extends J{_parse(e){return this._getType(e)===N.null?Re(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};lr.create=(a,e)=>new lr({innerType:a,typeName:R.ZodNullable,...Q(e)});var Wr=class extends J{_parse(e){let{ctx:t}=this._processInputParams(e),s=t.data;return t.parsedType===N.undefined&&(s=this._def.defaultValue()),this._def.innerType._parse({data:s,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};Wr.create=(a,e)=>new Wr({innerType:a,typeName:R.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...Q(e)});var Jr=class extends J{_parse(e){let{ctx:t}=this._processInputParams(e),s={...t,common:{...t.common,issues:[]}},r=this._def.innerType._parse({data:s.data,path:s.path,parent:{...s}});return lt(r)?r.then(n=>({status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new ke(s.common.issues)},input:s.data})})):{status:"valid",value:r.status==="valid"?r.value:this._def.catchValue({get error(){return new ke(s.common.issues)},input:s.data})}}removeCatch(){return this._def.innerType}};Jr.create=(a,e)=>new Jr({innerType:a,typeName:R.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...Q(e)});var ht=class extends J{_parse(e){if(this._getType(e)!==N.nan){let s=this._getOrReturnCtx(e);return k(s,{code:w.invalid_type,expected:N.nan,received:s.parsedType}),Z}return{status:"valid",value:e.data}}};ht.create=a=>new ht({typeName:R.ZodNaN,...Q(a)});var pc=Symbol("zod_brand"),wt=class extends J{_parse(e){let{ctx:t}=this._processInputParams(e),s=t.data;return this._def.type._parse({data:s,path:t.path,parent:t})}unwrap(){return this._def.type}},Ot=class a extends J{_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.common.async)return(async()=>{let n=await this._def.in._parseAsync({data:s.data,path:s.path,parent:s});return n.status==="aborted"?Z:n.status==="dirty"?(t.dirty(),jr(n.value)):this._def.out._parseAsync({data:n.value,path:s.path,parent:s})})();{let r=this._def.in._parseSync({data:s.data,path:s.path,parent:s});return r.status==="aborted"?Z:r.status==="dirty"?(t.dirty(),{status:"dirty",value:r.value}):this._def.out._parseSync({data:r.value,path:s.path,parent:s})}}static create(e,t){return new a({in:e,out:t,typeName:R.ZodPipeline})}},Gr=class extends J{_parse(e){let t=this._def.innerType._parse(e),s=r=>(xr(r)&&(r.value=Object.freeze(r.value)),r);return lt(t)?t.then(r=>s(r)):s(t)}unwrap(){return this._def.innerType}};Gr.create=(a,e)=>new Gr({innerType:a,typeName:R.ZodReadonly,...Q(e)});function Hs(a,e){let t=typeof a=="function"?a(e):typeof a=="string"?{message:a}:a;return typeof t=="string"?{message:t}:t}function Ws(a,e={},t){return a?wr.create().superRefine((s,r)=>{let n=a(s);if(n instanceof Promise)return n.then(l=>{if(!l){let o=Hs(e,s),d=o.fatal??t??!0;r.addIssue({code:"custom",...o,fatal:d})}});if(!n){let l=Hs(e,s),o=l.fatal??t??!0;r.addIssue({code:"custom",...l,fatal:o})}}):wr.create()}var hc={object:Ne.lazycreate},R;(function(a){a.ZodString="ZodString",a.ZodNumber="ZodNumber",a.ZodNaN="ZodNaN",a.ZodBigInt="ZodBigInt",a.ZodBoolean="ZodBoolean",a.ZodDate="ZodDate",a.ZodSymbol="ZodSymbol",a.ZodUndefined="ZodUndefined",a.ZodNull="ZodNull",a.ZodAny="ZodAny",a.ZodUnknown="ZodUnknown",a.ZodNever="ZodNever",a.ZodVoid="ZodVoid",a.ZodArray="ZodArray",a.ZodObject="ZodObject",a.ZodUnion="ZodUnion",a.ZodDiscriminatedUnion="ZodDiscriminatedUnion",a.ZodIntersection="ZodIntersection",a.ZodTuple="ZodTuple",a.ZodRecord="ZodRecord",a.ZodMap="ZodMap",a.ZodSet="ZodSet",a.ZodFunction="ZodFunction",a.ZodLazy="ZodLazy",a.ZodLiteral="ZodLiteral",a.ZodEnum="ZodEnum",a.ZodEffects="ZodEffects",a.ZodNativeEnum="ZodNativeEnum",a.ZodOptional="ZodOptional",a.ZodNullable="ZodNullable",a.ZodDefault="ZodDefault",a.ZodCatch="ZodCatch",a.ZodPromise="ZodPromise",a.ZodBranded="ZodBranded",a.ZodPipeline="ZodPipeline",a.ZodReadonly="ZodReadonly"})(R||(R={}));var mc=(a,e={message:`Input not instance of ${a.name}`})=>Ws(t=>t instanceof a,e),Js=Pr.create,Gs=Fr.create,vc=ht.create,gc=Lr.create,Ys=Mr.create,yc=qr.create,_c=ut.create,bc=Ur.create,Ec=Vr.create,Sc=wr.create,xc=_r.create,Pc=Ge.create,wc=dt.create,Oc=br.create,Rc=Ne.create,Tc=Ne.strictCreate,Ac=zr.create,Dc=qt.create,Ic=Hr.create,Cc=or.create,$c=Ut.create,kc=ft.create,Nc=pt.create,jc=Vt.create,Fc=Zr.create,Lc=Br.create,Mc=Kr.create,qc=Qr.create,Uc=Or.create,Vc=Ke.create,zc=Ze.create,Hc=lr.create,Zc=Ke.createWithPreprocess,Bc=Ot.create,Kc=()=>Js().optional(),Qc=()=>Gs().optional(),Wc=()=>Ys().optional(),Jc={string:(a=>Pr.create({...a,coerce:!0})),number:(a=>Fr.create({...a,coerce:!0})),boolean:(a=>Mr.create({...a,coerce:!0})),bigint:(a=>Lr.create({...a,coerce:!0})),date:(a=>qr.create({...a,coerce:!0}))};var Gc=Z;var ka="2025-06-18";var Xs=[ka,"2025-03-26","2024-11-05","2024-10-07"],zt="2.0",en=i.union([i.string(),i.number().int()]),rn=i.string(),Yc=i.object({progressToken:i.optional(en)}).passthrough(),Qe=i.object({_meta:i.optional(Yc)}).passthrough(),je=i.object({method:i.string(),params:i.optional(Qe)}),Rt=i.object({_meta:i.optional(i.object({}).passthrough())}).passthrough(),cr=i.object({method:i.string(),params:i.optional(Rt)}),We=i.object({_meta:i.optional(i.object({}).passthrough())}).passthrough(),Ht=i.union([i.string(),i.number().int()]),tn=i.object({jsonrpc:i.literal(zt),id:Ht}).merge(je).strict(),an=a=>tn.safeParse(a).success,sn=i.object({jsonrpc:i.literal(zt)}).merge(cr).strict(),nn=a=>sn.safeParse(a).success,on=i.object({jsonrpc:i.literal(zt),id:Ht,result:We}).strict(),Na=a=>on.safeParse(a).success,Ye;(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"})(Ye||(Ye={}));var ln=i.object({jsonrpc:i.literal(zt),id:Ht,error:i.object({code:i.number().int(),message:i.string(),data:i.optional(i.unknown())})}).strict(),cn=a=>ln.safeParse(a).success,un=i.union([tn,sn,on,ln]),Zt=We.strict(),Bt=cr.extend({method:i.literal("notifications/cancelled"),params:Rt.extend({requestId:Ht,reason:i.string().optional()})}),Xc=i.object({src:i.string(),mimeType:i.optional(i.string()),sizes:i.optional(i.array(i.string()))}).passthrough(),Tt=i.object({icons:i.array(Xc).optional()}).passthrough(),At=i.object({name:i.string(),title:i.optional(i.string())}).passthrough(),dn=At.extend({version:i.string(),websiteUrl:i.optional(i.string())}).merge(Tt),eu=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(),ja=je.extend({method:i.literal("initialize"),params:Qe.extend({protocolVersion:i.string(),capabilities:eu,clientInfo:dn})});var ru=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(),tu=We.extend({protocolVersion:i.string(),capabilities:ru,serverInfo:dn,instructions:i.optional(i.string())}),Fa=cr.extend({method:i.literal("notifications/initialized")});var Kt=je.extend({method:i.literal("ping")}),au=i.object({progress:i.number(),total:i.optional(i.number()),message:i.optional(i.string())}).passthrough(),Qt=cr.extend({method:i.literal("notifications/progress"),params:Rt.merge(au).extend({progressToken:en})}),Wt=je.extend({params:Qe.extend({cursor:i.optional(rn)}).optional()}),Jt=We.extend({nextCursor:i.optional(rn)}),fn=i.object({uri:i.string(),mimeType:i.optional(i.string()),_meta:i.optional(i.object({}).passthrough())}).passthrough(),pn=fn.extend({text:i.string()}),La=i.string().refine(a=>{try{return atob(a),!0}catch{return!1}},{message:"Invalid Base64 string"}),hn=fn.extend({blob:La}),mn=At.extend({uri:i.string(),description:i.optional(i.string()),mimeType:i.optional(i.string()),_meta:i.optional(i.object({}).passthrough())}).merge(Tt),su=At.extend({uriTemplate:i.string(),description:i.optional(i.string()),mimeType:i.optional(i.string()),_meta:i.optional(i.object({}).passthrough())}).merge(Tt),nu=Wt.extend({method:i.literal("resources/list")}),iu=Jt.extend({resources:i.array(mn)}),ou=Wt.extend({method:i.literal("resources/templates/list")}),lu=Jt.extend({resourceTemplates:i.array(su)}),cu=je.extend({method:i.literal("resources/read"),params:Qe.extend({uri:i.string()})}),uu=We.extend({contents:i.array(i.union([pn,hn]))}),du=cr.extend({method:i.literal("notifications/resources/list_changed")}),fu=je.extend({method:i.literal("resources/subscribe"),params:Qe.extend({uri:i.string()})}),pu=je.extend({method:i.literal("resources/unsubscribe"),params:Qe.extend({uri:i.string()})}),hu=cr.extend({method:i.literal("notifications/resources/updated"),params:Rt.extend({uri:i.string()})}),mu=i.object({name:i.string(),description:i.optional(i.string()),required:i.optional(i.boolean())}).passthrough(),vu=At.extend({description:i.optional(i.string()),arguments:i.optional(i.array(mu)),_meta:i.optional(i.object({}).passthrough())}).merge(Tt),gu=Wt.extend({method:i.literal("prompts/list")}),yu=Jt.extend({prompts:i.array(vu)}),_u=je.extend({method:i.literal("prompts/get"),params:Qe.extend({name:i.string(),arguments:i.optional(i.record(i.string()))})}),Ma=i.object({type:i.literal("text"),text:i.string(),_meta:i.optional(i.object({}).passthrough())}).passthrough(),qa=i.object({type:i.literal("image"),data:La,mimeType:i.string(),_meta:i.optional(i.object({}).passthrough())}).passthrough(),Ua=i.object({type:i.literal("audio"),data:La,mimeType:i.string(),_meta:i.optional(i.object({}).passthrough())}).passthrough(),bu=i.object({type:i.literal("resource"),resource:i.union([pn,hn]),_meta:i.optional(i.object({}).passthrough())}).passthrough(),Eu=mn.extend({type:i.literal("resource_link")}),vn=i.union([Ma,qa,Ua,Eu,bu]),Su=i.object({role:i.enum(["user","assistant"]),content:vn}).passthrough(),xu=We.extend({description:i.optional(i.string()),messages:i.array(Su)}),Pu=cr.extend({method:i.literal("notifications/prompts/list_changed")}),wu=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(),Ou=At.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(wu),_meta:i.optional(i.object({}).passthrough())}).merge(Tt),Va=Wt.extend({method:i.literal("tools/list")}),Ru=Jt.extend({tools:i.array(Ou)}),gn=We.extend({content:i.array(vn).default([]),structuredContent:i.object({}).passthrough().optional(),isError:i.optional(i.boolean())}),Op=gn.or(We.extend({toolResult:i.unknown()})),za=je.extend({method:i.literal("tools/call"),params:Qe.extend({name:i.string(),arguments:i.optional(i.record(i.unknown()))})}),Tu=cr.extend({method:i.literal("notifications/tools/list_changed")}),Dt=i.enum(["debug","info","notice","warning","error","critical","alert","emergency"]),Ha=je.extend({method:i.literal("logging/setLevel"),params:Qe.extend({level:Dt})}),Au=cr.extend({method:i.literal("notifications/message"),params:Rt.extend({level:Dt,logger:i.optional(i.string()),data:i.unknown()})}),Du=i.object({name:i.string().optional()}).passthrough(),Iu=i.object({hints:i.optional(i.array(Du)),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(),Cu=i.object({role:i.enum(["user","assistant"]),content:i.union([Ma,qa,Ua])}).passthrough(),$u=je.extend({method:i.literal("sampling/createMessage"),params:Qe.extend({messages:i.array(Cu),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(Iu)})}),Za=We.extend({model:i.string(),stopReason:i.optional(i.enum(["endTurn","stopSequence","maxTokens"]).or(i.string())),role:i.enum(["user","assistant"]),content:i.discriminatedUnion("type",[Ma,qa,Ua])}),ku=i.object({type:i.literal("boolean"),title:i.optional(i.string()),description:i.optional(i.string()),default:i.optional(i.boolean())}).passthrough(),Nu=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(),ju=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(),Fu=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(),Lu=i.union([ku,Nu,ju,Fu]),Mu=je.extend({method:i.literal("elicitation/create"),params:Qe.extend({message:i.string(),requestedSchema:i.object({type:i.literal("object"),properties:i.record(i.string(),Lu),required:i.optional(i.array(i.string()))}).passthrough()})}),Ba=We.extend({action:i.enum(["accept","decline","cancel"]),content:i.optional(i.record(i.string(),i.unknown()))}),qu=i.object({type:i.literal("ref/resource"),uri:i.string()}).passthrough();var Uu=i.object({type:i.literal("ref/prompt"),name:i.string()}).passthrough(),Vu=je.extend({method:i.literal("completion/complete"),params:Qe.extend({ref:i.union([Uu,qu]),argument:i.object({name:i.string(),value:i.string()}).passthrough(),context:i.optional(i.object({arguments:i.optional(i.record(i.string(),i.string()))}))})}),zu=We.extend({completion:i.object({values:i.array(i.string()).max(100),total:i.optional(i.number().int()),hasMore:i.optional(i.boolean())}).passthrough()}),Hu=i.object({uri:i.string().startsWith("file://"),name:i.optional(i.string()),_meta:i.optional(i.object({}).passthrough())}).passthrough(),Zu=je.extend({method:i.literal("roots/list")}),Ka=We.extend({roots:i.array(Hu)}),Bu=cr.extend({method:i.literal("notifications/roots/list_changed")}),Rp=i.union([Kt,ja,Vu,Ha,_u,gu,nu,ou,cu,fu,pu,za,Va]),Tp=i.union([Bt,Qt,Fa,Bu]),Ap=i.union([Zt,Za,Ba,Ka]),Dp=i.union([Kt,$u,Mu,Zu]),Ip=i.union([Bt,Qt,Au,hu,du,Tu,Pu]),Cp=i.union([Zt,tu,zu,xu,yu,iu,lu,uu,gn,Ru]),Xe=class extends Error{constructor(e,t,s){super(`MCP error ${e}: ${t}`),this.code=e,this.data=s,this.name="McpError"}};var Ku=6e4,Gt=class{constructor(e){this._options=e,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this._pendingDebouncedNotifications=new Set,this.setNotificationHandler(Bt,t=>{let s=this._requestHandlerAbortControllers.get(t.params.requestId);s?.abort(t.params.reason)}),this.setNotificationHandler(Qt,t=>{this._onprogress(t)}),this.setRequestHandler(Kt,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 Xe(Ye.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:t.maxTotalTimeout,totalElapsed:s});return clearTimeout(t.timeoutId),t.timeoutId=setTimeout(t.onTimeout,t.timeout),!0}_cleanupTimeout(e){let t=this._timeoutInfo.get(e);t&&(clearTimeout(t.timeoutId),this._timeoutInfo.delete(e))}async connect(e){var t,s,r;this._transport=e;let n=(t=this.transport)===null||t===void 0?void 0:t.onclose;this._transport.onclose=()=>{n?.(),this._onclose()};let l=(s=this.transport)===null||s===void 0?void 0:s.onerror;this._transport.onerror=d=>{l?.(d),this._onerror(d)};let o=(r=this._transport)===null||r===void 0?void 0:r.onmessage;this._transport.onmessage=(d,f)=>{o?.(d,f),Na(d)||cn(d)?this._onresponse(d):an(d)?this._onrequest(d,f):nn(d)?this._onnotification(d):this._onerror(new Error(`Unknown message type: ${JSON.stringify(d)}`))},await this._transport.start()}_onclose(){var e;let t=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._pendingDebouncedNotifications.clear(),this._transport=void 0,(e=this.onclose)===null||e===void 0||e.call(this);let s=new Xe(Ye.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:Ye.MethodNotFound,message:"Method not found"}}).catch(f=>this._onerror(new Error(`Failed to send an error response: ${f}`)));return}let o=new AbortController;this._requestHandlerAbortControllers.set(e.id,o);let d={signal:o.signal,sessionId:l?.sessionId,_meta:(r=e.params)===null||r===void 0?void 0:r._meta,sendNotification:f=>this.notification(f,{relatedRequestId:e.id}),sendRequest:(f,p,m)=>this.request(f,p,{...m,relatedRequestId:e.id}),authInfo:t?.authInfo,requestId:e.id,requestInfo:t?.requestInfo};Promise.resolve().then(()=>n(e,d)).then(f=>{if(!o.signal.aborted)return l?.send({result:f,jsonrpc:"2.0",id:e.id})},f=>{var p;if(!o.signal.aborted)return l?.send({jsonrpc:"2.0",id:e.id,error:{code:Number.isSafeInteger(f.code)?f.code:Ye.InternalError,message:(p=f.message)!==null&&p!==void 0?p:"Internal error"}})}).catch(f=>this._onerror(new Error(`Failed to send response: ${f}`))).finally(()=>{this._requestHandlerAbortControllers.delete(e.id)})}_onprogress(e){let{progressToken:t,...s}=e.params,r=Number(t),n=this._progressHandlers.get(r);if(!n){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}let l=this._responseHandlers.get(r),o=this._timeoutInfo.get(r);if(o&&l&&o.resetTimeoutOnProgress)try{this._resetTimeout(r)}catch(d){l(d);return}n(s)}_onresponse(e){let t=Number(e.id),s=this._responseHandlers.get(t);if(s===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}if(this._responseHandlers.delete(t),this._progressHandlers.delete(t),this._cleanupTimeout(t),Na(e))s(e);else{let r=new Xe(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,d)=>{var f,p,m,b,c,y;if(!this._transport){d(new Error("Not connected"));return}((f=this._options)===null||f===void 0?void 0:f.enforceStrictCapabilities)===!0&&this.assertCapabilityForMethod(e.method),(p=s?.signal)===null||p===void 0||p.throwIfAborted();let _=this._requestMessageId++,v={...e,jsonrpc:"2.0",id:_};s?.onprogress&&(this._progressHandlers.set(_,s.onprogress),v.params={...e.params,_meta:{...((m=e.params)===null||m===void 0?void 0:m._meta)||{},progressToken:_}});let x=O=>{var D;this._responseHandlers.delete(_),this._progressHandlers.delete(_),this._cleanupTimeout(_),(D=this._transport)===null||D===void 0||D.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:_,reason:String(O)}},{relatedRequestId:r,resumptionToken:n,onresumptiontoken:l}).catch(I=>this._onerror(new Error(`Failed to send cancellation: ${I}`))),d(O)};this._responseHandlers.set(_,O=>{var D;if(!(!((D=s?.signal)===null||D===void 0)&&D.aborted)){if(O instanceof Error)return d(O);try{let I=t.parse(O.result);o(I)}catch(I){d(I)}}}),(b=s?.signal)===null||b===void 0||b.addEventListener("abort",()=>{var O;x((O=s?.signal)===null||O===void 0?void 0:O.reason)});let T=(c=s?.timeout)!==null&&c!==void 0?c:Ku,P=()=>x(new Xe(Ye.RequestTimeout,"Request timed out",{timeout:T}));this._setupTimeout(_,T,s?.maxTotalTimeout,P,(y=s?.resetTimeoutOnProgress)!==null&&y!==void 0?y:!1),this._transport.send(v,{relatedRequestId:r,resumptionToken:n,onresumptiontoken:l}).catch(O=>{this._cleanupTimeout(_),d(O)})})}async notification(e,t){var s,r;if(!this._transport)throw new Error("Not connected");if(this.assertNotificationCapability(e.method),((r=(s=this._options)===null||s===void 0?void 0:s.debouncedNotificationMethods)!==null&&r!==void 0?r:[]).includes(e.method)&&!e.params&&!t?.relatedRequestId){if(this._pendingDebouncedNotifications.has(e.method))return;this._pendingDebouncedNotifications.add(e.method),Promise.resolve().then(()=>{var d;if(this._pendingDebouncedNotifications.delete(e.method),!this._transport)return;let f={...e,jsonrpc:"2.0"};(d=this._transport)===null||d===void 0||d.send(f,t).catch(p=>this._onerror(p))});return}let 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 yn(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 Eo=Da(bo(),1),va=class extends Gt{constructor(e,t){var s;super(t),this._serverInfo=e,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(Dt.options.map((r,n)=>[r,n])),this.isMessageIgnored=(r,n)=>{let l=this._loggingLevels.get(n);return l?this.LOG_LEVEL_SEVERITY.get(r)<this.LOG_LEVEL_SEVERITY.get(l):!1},this._capabilities=(s=t?.capabilities)!==null&&s!==void 0?s:{},this._instructions=t?.instructions,this.setRequestHandler(ja,r=>this._oninitialize(r)),this.setNotificationHandler(Fa,()=>{var r;return(r=this.oninitialized)===null||r===void 0?void 0:r.call(this)}),this._capabilities.logging&&this.setRequestHandler(Ha,async(r,n)=>{var l;let o=n.sessionId||((l=n.requestInfo)===null||l===void 0?void 0:l.headers["mcp-session-id"])||void 0,{level:d}=r.params,f=Dt.safeParse(d);return f.success&&this._loggingLevels.set(o,f.data),{}})}registerCapabilities(e){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=yn(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:Xs.includes(t)?t:ka,capabilities:this.getCapabilities(),serverInfo:this._serverInfo,...this._instructions&&{instructions:this._instructions}}}getClientCapabilities(){return this._clientCapabilities}getClientVersion(){return this._clientVersion}getCapabilities(){return this._capabilities}async ping(){return this.request({method:"ping"},Zt)}async createMessage(e,t){return this.request({method:"sampling/createMessage",params:e},Za,t)}async elicitInput(e,t){let s=await this.request({method:"elicitation/create",params:e},Ba,t);if(s.action==="accept"&&s.content)try{let r=new Eo.default,n=r.compile(e.requestedSchema);if(!n(s.content))throw new Xe(Ye.InvalidParams,`Elicitation response content does not match requested schema: ${r.errorsText(n.errors)}`)}catch(r){throw r instanceof Xe?r:new Xe(Ye.InternalError,`Error validating elicitation response: ${r}`)}return s}async listRoots(e,t){return this.request({method:"roots/list",params:e},Ka,t)}async sendLoggingMessage(e,t){if(this._capabilities.logging&&!this.isMessageIgnored(e.level,t))return this.notification({method:"notifications/message",params:e})}async sendResourceUpdated(e){return this.notification({method:"notifications/resources/updated",params:e})}async sendResourceListChanged(){return this.notification({method:"notifications/resources/list_changed"})}async sendToolListChanged(){return this.notification({method:"notifications/tools/list_changed"})}async sendPromptListChanged(){return this.notification({method:"notifications/prompts/list_changed"})}};var ys=Da(require("node:process"),1);var ga=class{append(e){this._buffer=this._buffer?Buffer.concat([this._buffer,e]):e}readMessage(){if(!this._buffer)return null;let e=this._buffer.indexOf(`
|
|
`);if(e===-1)return null;let t=this._buffer.toString("utf8",0,e).replace(/\r$/,"");return this._buffer=this._buffer.subarray(e+1),Rf(t)}clear(){this._buffer=void 0}};function Rf(a){return un.parse(JSON.parse(a))}function So(a){return JSON.stringify(a)+`
|
|
`}var ya=class{constructor(e=ys.default.stdin,t=ys.default.stdout){this._stdin=e,this._stdout=t,this._readBuffer=new ga,this._started=!1,this._ondata=s=>{this._readBuffer.append(s),this.processReadBuffer()},this._onerror=s=>{var r;(r=this.onerror)===null||r===void 0||r.call(this,s)}}async start(){if(this._started)throw new Error("StdioServerTransport already started! If using Server class, note that connect() calls start() automatically.");this._started=!0,this._stdin.on("data",this._ondata),this._stdin.on("error",this._onerror)}processReadBuffer(){for(var e,t;;)try{let s=this._readBuffer.readMessage();if(s===null)break;(e=this.onmessage)===null||e===void 0||e.call(this,s)}catch(s){(t=this.onerror)===null||t===void 0||t.call(this,s)}}async close(){var e;this._stdin.off("data",this._ondata),this._stdin.off("error",this._onerror),this._stdin.listenerCount("data")===0&&this._stdin.pause(),this._readBuffer.clear(),(e=this.onclose)===null||e===void 0||e.call(this)}send(e){return new Promise(t=>{let s=So(e);this._stdout.write(s)?t():this._stdout.once("drain",t)})}};var Po=Symbol("Let zodToJsonSchema decide on which parser to use");var xo={name:void 0,$refStrategy:"root",basePath:["#"],effectStrategy:"input",pipeStrategy:"all",dateStrategy:"format:date-time",mapStrategy:"entries",removeAdditionalStrategy:"passthrough",allowedAdditionalProperties:!0,rejectedAdditionalProperties:!1,definitionPath:"definitions",target:"jsonSchema7",strictUnions:!1,definitions:{},errorMessages:!1,markdownDescription:!1,patternStrategy:"escape",applyRegexFlags:!1,emailStrategy:"format:email",base64Strategy:"contentEncoding:base64",nameStrategy:"ref",openAiAnyTypeName:"OpenAiAnyType"},wo=a=>typeof a=="string"?{...xo,name:a}:{...xo,...a};var Oo=a=>{let e=wo(a),t=e.name!==void 0?[...e.basePath,e.definitionPath,e.name]:e.basePath;return{...e,flags:{hasReferencedOpenAiAnyType:!1},currentPath:t,propertyPath:void 0,seen:new Map(Object.entries(e.definitions).map(([s,r])=>[r._def,{def:r._def,path:[...e.basePath,e.definitionPath,s],jsonSchema:void 0}]))}};function _s(a,e,t,s){s?.errorMessages&&t&&(a.errorMessage={...a.errorMessage,[e]:t})}function ee(a,e,t,s,r){a[e]=t,_s(a,e,s,r)}var _a=(a,e)=>{let t=0;for(;t<a.length&&t<e.length&&a[t]===e[t];t++);return[(a.length-t).toString(),...e.slice(t)].join("/")};function fe(a){if(a.target!=="openAi")return{};let e=[...a.basePath,a.definitionPath,a.openAiAnyTypeName];return a.flags.hasReferencedOpenAiAnyType=!0,{$ref:a.$refStrategy==="relative"?_a(e,a.currentPath):e.join("/")}}function Ro(a,e){let t={type:"array"};return a.type?._def&&a.type?._def?.typeName!==R.ZodAny&&(t.items=B(a.type._def,{...e,currentPath:[...e.currentPath,"items"]})),a.minLength&&ee(t,"minItems",a.minLength.value,a.minLength.message,e),a.maxLength&&ee(t,"maxItems",a.maxLength.value,a.maxLength.message,e),a.exactLength&&(ee(t,"minItems",a.exactLength.value,a.exactLength.message,e),ee(t,"maxItems",a.exactLength.value,a.exactLength.message,e)),t}function To(a,e){let t={type:"integer",format:"int64"};if(!a.checks)return t;for(let s of a.checks)switch(s.kind){case"min":e.target==="jsonSchema7"?s.inclusive?ee(t,"minimum",s.value,s.message,e):ee(t,"exclusiveMinimum",s.value,s.message,e):(s.inclusive||(t.exclusiveMinimum=!0),ee(t,"minimum",s.value,s.message,e));break;case"max":e.target==="jsonSchema7"?s.inclusive?ee(t,"maximum",s.value,s.message,e):ee(t,"exclusiveMaximum",s.value,s.message,e):(s.inclusive||(t.exclusiveMaximum=!0),ee(t,"maximum",s.value,s.message,e));break;case"multipleOf":ee(t,"multipleOf",s.value,s.message,e);break}return t}function Ao(){return{type:"boolean"}}function ba(a,e){return B(a.type._def,e)}var Do=(a,e)=>B(a.innerType._def,e);function bs(a,e,t){let s=t??e.dateStrategy;if(Array.isArray(s))return{anyOf:s.map((r,n)=>bs(a,e,r))};switch(s){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return Tf(a,e)}}var Tf=(a,e)=>{let t={type:"integer",format:"unix-time"};if(e.target==="openApi3")return t;for(let s of a.checks)switch(s.kind){case"min":ee(t,"minimum",s.value,s.message,e);break;case"max":ee(t,"maximum",s.value,s.message,e);break}return t};function Io(a,e){return{...B(a.innerType._def,e),default:a.defaultValue()}}function Co(a,e){return e.effectStrategy==="input"?B(a.schema._def,e):fe(e)}function $o(a){return{type:"string",enum:Array.from(a.values)}}var Af=a=>"type"in a&&a.type==="string"?!1:"allOf"in a;function ko(a,e){let t=[B(a.left._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),B(a.right._def,{...e,currentPath:[...e.currentPath,"allOf","1"]})].filter(n=>!!n),s=e.target==="jsonSchema2019-09"?{unevaluatedProperties:!1}:void 0,r=[];return t.forEach(n=>{if(Af(n))r.push(...n.allOf),n.unevaluatedProperties===void 0&&(s=void 0);else{let l=n;if("additionalProperties"in n&&n.additionalProperties===!1){let{additionalProperties:o,...d}=n;l=d}else s=void 0;r.push(l)}}),r.length?{allOf:r,...s}:void 0}function No(a,e){let t=typeof a.value;return t!=="bigint"&&t!=="number"&&t!=="boolean"&&t!=="string"?{type:Array.isArray(a.value)?"array":"object"}:e.target==="openApi3"?{type:t==="bigint"?"integer":t,enum:[a.value]}:{type:t==="bigint"?"integer":t,const:a.value}}var Es,er={cuid:/^[cC][^\s-]{8,}$/,cuid2:/^[0-9a-z]+$/,ulid:/^[0-9A-HJKMNP-TV-Z]{26}$/,email:/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,emoji:()=>(Es===void 0&&(Es=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),Es),uuid:/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/,ipv4:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,ipv4Cidr:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,ipv6:/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,ipv6Cidr:/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,base64:/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,base64url:/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,nanoid:/^[a-zA-Z0-9_-]{21}$/,jwt:/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/};function Ea(a,e){let t={type:"string"};if(a.checks)for(let s of a.checks)switch(s.kind){case"min":ee(t,"minLength",typeof t.minLength=="number"?Math.max(t.minLength,s.value):s.value,s.message,e);break;case"max":ee(t,"maxLength",typeof t.maxLength=="number"?Math.min(t.maxLength,s.value):s.value,s.message,e);break;case"email":switch(e.emailStrategy){case"format:email":rr(t,"email",s.message,e);break;case"format:idn-email":rr(t,"idn-email",s.message,e);break;case"pattern:zod":Ie(t,er.email,s.message,e);break}break;case"url":rr(t,"uri",s.message,e);break;case"uuid":rr(t,"uuid",s.message,e);break;case"regex":Ie(t,s.regex,s.message,e);break;case"cuid":Ie(t,er.cuid,s.message,e);break;case"cuid2":Ie(t,er.cuid2,s.message,e);break;case"startsWith":Ie(t,RegExp(`^${Ss(s.value,e)}`),s.message,e);break;case"endsWith":Ie(t,RegExp(`${Ss(s.value,e)}$`),s.message,e);break;case"datetime":rr(t,"date-time",s.message,e);break;case"date":rr(t,"date",s.message,e);break;case"time":rr(t,"time",s.message,e);break;case"duration":rr(t,"duration",s.message,e);break;case"length":ee(t,"minLength",typeof t.minLength=="number"?Math.max(t.minLength,s.value):s.value,s.message,e),ee(t,"maxLength",typeof t.maxLength=="number"?Math.min(t.maxLength,s.value):s.value,s.message,e);break;case"includes":{Ie(t,RegExp(Ss(s.value,e)),s.message,e);break}case"ip":{s.version!=="v6"&&rr(t,"ipv4",s.message,e),s.version!=="v4"&&rr(t,"ipv6",s.message,e);break}case"base64url":Ie(t,er.base64url,s.message,e);break;case"jwt":Ie(t,er.jwt,s.message,e);break;case"cidr":{s.version!=="v6"&&Ie(t,er.ipv4Cidr,s.message,e),s.version!=="v4"&&Ie(t,er.ipv6Cidr,s.message,e);break}case"emoji":Ie(t,er.emoji(),s.message,e);break;case"ulid":{Ie(t,er.ulid,s.message,e);break}case"base64":{switch(e.base64Strategy){case"format:binary":{rr(t,"binary",s.message,e);break}case"contentEncoding:base64":{ee(t,"contentEncoding","base64",s.message,e);break}case"pattern:zod":{Ie(t,er.base64,s.message,e);break}}break}case"nanoid":Ie(t,er.nanoid,s.message,e);case"toLowerCase":case"toUpperCase":case"trim":break;default:}return t}function Ss(a,e){return e.patternStrategy==="escape"?If(a):a}var Df=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function If(a){let e="";for(let t=0;t<a.length;t++)Df.has(a[t])||(e+="\\"),e+=a[t];return e}function rr(a,e,t,s){a.format||a.anyOf?.some(r=>r.format)?(a.anyOf||(a.anyOf=[]),a.format&&(a.anyOf.push({format:a.format,...a.errorMessage&&s.errorMessages&&{errorMessage:{format:a.errorMessage.format}}}),delete a.format,a.errorMessage&&(delete a.errorMessage.format,Object.keys(a.errorMessage).length===0&&delete a.errorMessage)),a.anyOf.push({format:e,...t&&s.errorMessages&&{errorMessage:{format:t}}})):ee(a,"format",e,t,s)}function Ie(a,e,t,s){a.pattern||a.allOf?.some(r=>r.pattern)?(a.allOf||(a.allOf=[]),a.pattern&&(a.allOf.push({pattern:a.pattern,...a.errorMessage&&s.errorMessages&&{errorMessage:{pattern:a.errorMessage.pattern}}}),delete a.pattern,a.errorMessage&&(delete a.errorMessage.pattern,Object.keys(a.errorMessage).length===0&&delete a.errorMessage)),a.allOf.push({pattern:jo(e,s),...t&&s.errorMessages&&{errorMessage:{pattern:t}}})):ee(a,"pattern",jo(e,s),t,s)}function jo(a,e){if(!e.applyRegexFlags||!a.flags)return a.source;let t={i:a.flags.includes("i"),m:a.flags.includes("m"),s:a.flags.includes("s")},s=t.i?a.source.toLowerCase():a.source,r="",n=!1,l=!1,o=!1;for(let d=0;d<s.length;d++){if(n){r+=s[d],n=!1;continue}if(t.i){if(l){if(s[d].match(/[a-z]/)){o?(r+=s[d],r+=`${s[d-2]}-${s[d]}`.toUpperCase(),o=!1):s[d+1]==="-"&&s[d+2]?.match(/[a-z]/)?(r+=s[d],o=!0):r+=`${s[d]}${s[d].toUpperCase()}`;continue}}else if(s[d].match(/[a-z]/)){r+=`[${s[d]}${s[d].toUpperCase()}]`;continue}}if(t.m){if(s[d]==="^"){r+=`(^|(?<=[\r
|
|
]))`;continue}else if(s[d]==="$"){r+=`($|(?=[\r
|
|
]))`;continue}}if(t.s&&s[d]==="."){r+=l?`${s[d]}\r
|
|
`:`[${s[d]}\r
|
|
]`;continue}r+=s[d],s[d]==="\\"?n=!0:l&&s[d]==="]"?l=!1:!l&&s[d]==="["&&(l=!0)}try{new RegExp(r)}catch{return console.warn(`Could not convert regex pattern at ${e.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`),a.source}return r}function Sa(a,e){if(e.target==="openAi"&&console.warn("Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead."),e.target==="openApi3"&&a.keyType?._def.typeName===R.ZodEnum)return{type:"object",required:a.keyType._def.values,properties:a.keyType._def.values.reduce((s,r)=>({...s,[r]:B(a.valueType._def,{...e,currentPath:[...e.currentPath,"properties",r]})??fe(e)}),{}),additionalProperties:e.rejectedAdditionalProperties};let t={type:"object",additionalProperties:B(a.valueType._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??e.allowedAdditionalProperties};if(e.target==="openApi3")return t;if(a.keyType?._def.typeName===R.ZodString&&a.keyType._def.checks?.length){let{type:s,...r}=Ea(a.keyType._def,e);return{...t,propertyNames:r}}else{if(a.keyType?._def.typeName===R.ZodEnum)return{...t,propertyNames:{enum:a.keyType._def.values}};if(a.keyType?._def.typeName===R.ZodBranded&&a.keyType._def.type._def.typeName===R.ZodString&&a.keyType._def.type._def.checks?.length){let{type:s,...r}=ba(a.keyType._def,e);return{...t,propertyNames:r}}}return t}function Fo(a,e){if(e.mapStrategy==="record")return Sa(a,e);let t=B(a.keyType._def,{...e,currentPath:[...e.currentPath,"items","items","0"]})||fe(e),s=B(a.valueType._def,{...e,currentPath:[...e.currentPath,"items","items","1"]})||fe(e);return{type:"array",maxItems:125,items:{type:"array",items:[t,s],minItems:2,maxItems:2}}}function Lo(a){let e=a.values,s=Object.keys(a.values).filter(n=>typeof e[e[n]]!="number").map(n=>e[n]),r=Array.from(new Set(s.map(n=>typeof n)));return{type:r.length===1?r[0]==="string"?"string":"number":["string","number"],enum:s}}function Mo(a){return a.target==="openAi"?void 0:{not:fe({...a,currentPath:[...a.currentPath,"not"]})}}function qo(a){return a.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}var Ct={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function Vo(a,e){if(e.target==="openApi3")return Uo(a,e);let t=a.options instanceof Map?Array.from(a.options.values()):a.options;if(t.every(s=>s._def.typeName in Ct&&(!s._def.checks||!s._def.checks.length))){let s=t.reduce((r,n)=>{let l=Ct[n._def.typeName];return l&&!r.includes(l)?[...r,l]:r},[]);return{type:s.length>1?s:s[0]}}else if(t.every(s=>s._def.typeName==="ZodLiteral"&&!s.description)){let s=t.reduce((r,n)=>{let l=typeof n._def.value;switch(l){case"string":case"number":case"boolean":return[...r,l];case"bigint":return[...r,"integer"];case"object":if(n._def.value===null)return[...r,"null"];case"symbol":case"undefined":case"function":default:return r}},[]);if(s.length===t.length){let r=s.filter((n,l,o)=>o.indexOf(n)===l);return{type:r.length>1?r:r[0],enum:t.reduce((n,l)=>n.includes(l._def.value)?n:[...n,l._def.value],[])}}}else if(t.every(s=>s._def.typeName==="ZodEnum"))return{type:"string",enum:t.reduce((s,r)=>[...s,...r._def.values.filter(n=>!s.includes(n))],[])};return Uo(a,e)}var Uo=(a,e)=>{let t=(a.options instanceof Map?Array.from(a.options.values()):a.options).map((s,r)=>B(s._def,{...e,currentPath:[...e.currentPath,"anyOf",`${r}`]})).filter(s=>!!s&&(!e.strictUnions||typeof s=="object"&&Object.keys(s).length>0));return t.length?{anyOf:t}:void 0};function zo(a,e){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(a.innerType._def.typeName)&&(!a.innerType._def.checks||!a.innerType._def.checks.length))return e.target==="openApi3"?{type:Ct[a.innerType._def.typeName],nullable:!0}:{type:[Ct[a.innerType._def.typeName],"null"]};if(e.target==="openApi3"){let s=B(a.innerType._def,{...e,currentPath:[...e.currentPath]});return s&&"$ref"in s?{allOf:[s],nullable:!0}:s&&{...s,nullable:!0}}let t=B(a.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","0"]});return t&&{anyOf:[t,{type:"null"}]}}function Ho(a,e){let t={type:"number"};if(!a.checks)return t;for(let s of a.checks)switch(s.kind){case"int":t.type="integer",_s(t,"type",s.message,e);break;case"min":e.target==="jsonSchema7"?s.inclusive?ee(t,"minimum",s.value,s.message,e):ee(t,"exclusiveMinimum",s.value,s.message,e):(s.inclusive||(t.exclusiveMinimum=!0),ee(t,"minimum",s.value,s.message,e));break;case"max":e.target==="jsonSchema7"?s.inclusive?ee(t,"maximum",s.value,s.message,e):ee(t,"exclusiveMaximum",s.value,s.message,e):(s.inclusive||(t.exclusiveMaximum=!0),ee(t,"maximum",s.value,s.message,e));break;case"multipleOf":ee(t,"multipleOf",s.value,s.message,e);break}return t}function Zo(a,e){let t=e.target==="openAi",s={type:"object",properties:{}},r=[],n=a.shape();for(let o in n){let d=n[o];if(d===void 0||d._def===void 0)continue;let f=$f(d);f&&t&&(d._def.typeName==="ZodOptional"&&(d=d._def.innerType),d.isNullable()||(d=d.nullable()),f=!1);let p=B(d._def,{...e,currentPath:[...e.currentPath,"properties",o],propertyPath:[...e.currentPath,"properties",o]});p!==void 0&&(s.properties[o]=p,f||r.push(o))}r.length&&(s.required=r);let l=Cf(a,e);return l!==void 0&&(s.additionalProperties=l),s}function Cf(a,e){if(a.catchall._def.typeName!=="ZodNever")return B(a.catchall._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]});switch(a.unknownKeys){case"passthrough":return e.allowedAdditionalProperties;case"strict":return e.rejectedAdditionalProperties;case"strip":return e.removeAdditionalStrategy==="strict"?e.allowedAdditionalProperties:e.rejectedAdditionalProperties}}function $f(a){try{return a.isOptional()}catch{return!0}}var Bo=(a,e)=>{if(e.currentPath.toString()===e.propertyPath?.toString())return B(a.innerType._def,e);let t=B(a.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","1"]});return t?{anyOf:[{not:fe(e)},t]}:fe(e)};var Ko=(a,e)=>{if(e.pipeStrategy==="input")return B(a.in._def,e);if(e.pipeStrategy==="output")return B(a.out._def,e);let t=B(a.in._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),s=B(a.out._def,{...e,currentPath:[...e.currentPath,"allOf",t?"1":"0"]});return{allOf:[t,s].filter(r=>r!==void 0)}};function Qo(a,e){return B(a.type._def,e)}function Wo(a,e){let s={type:"array",uniqueItems:!0,items:B(a.valueType._def,{...e,currentPath:[...e.currentPath,"items"]})};return a.minSize&&ee(s,"minItems",a.minSize.value,a.minSize.message,e),a.maxSize&&ee(s,"maxItems",a.maxSize.value,a.maxSize.message,e),s}function Jo(a,e){return a.rest?{type:"array",minItems:a.items.length,items:a.items.map((t,s)=>B(t._def,{...e,currentPath:[...e.currentPath,"items",`${s}`]})).reduce((t,s)=>s===void 0?t:[...t,s],[]),additionalItems:B(a.rest._def,{...e,currentPath:[...e.currentPath,"additionalItems"]})}:{type:"array",minItems:a.items.length,maxItems:a.items.length,items:a.items.map((t,s)=>B(t._def,{...e,currentPath:[...e.currentPath,"items",`${s}`]})).reduce((t,s)=>s===void 0?t:[...t,s],[])}}function Go(a){return{not:fe(a)}}function Yo(a){return fe(a)}var Xo=(a,e)=>B(a.innerType._def,e);var el=(a,e,t)=>{switch(e){case R.ZodString:return Ea(a,t);case R.ZodNumber:return Ho(a,t);case R.ZodObject:return Zo(a,t);case R.ZodBigInt:return To(a,t);case R.ZodBoolean:return Ao();case R.ZodDate:return bs(a,t);case R.ZodUndefined:return Go(t);case R.ZodNull:return qo(t);case R.ZodArray:return Ro(a,t);case R.ZodUnion:case R.ZodDiscriminatedUnion:return Vo(a,t);case R.ZodIntersection:return ko(a,t);case R.ZodTuple:return Jo(a,t);case R.ZodRecord:return Sa(a,t);case R.ZodLiteral:return No(a,t);case R.ZodEnum:return $o(a);case R.ZodNativeEnum:return Lo(a);case R.ZodNullable:return zo(a,t);case R.ZodOptional:return Bo(a,t);case R.ZodMap:return Fo(a,t);case R.ZodSet:return Wo(a,t);case R.ZodLazy:return()=>a.getter()._def;case R.ZodPromise:return Qo(a,t);case R.ZodNaN:case R.ZodNever:return Mo(t);case R.ZodEffects:return Co(a,t);case R.ZodAny:return fe(t);case R.ZodUnknown:return Yo(t);case R.ZodDefault:return Io(a,t);case R.ZodBranded:return ba(a,t);case R.ZodReadonly:return Xo(a,t);case R.ZodCatch:return Do(a,t);case R.ZodPipeline:return Ko(a,t);case R.ZodFunction:case R.ZodVoid:case R.ZodSymbol:return;default:return(s=>{})(e)}};function B(a,e,t=!1){let s=e.seen.get(a);if(e.override){let o=e.override?.(a,e,s,t);if(o!==Po)return o}if(s&&!t){let o=kf(s,e);if(o!==void 0)return o}let r={def:a,path:e.currentPath,jsonSchema:void 0};e.seen.set(a,r);let n=el(a,a.typeName,e),l=typeof n=="function"?B(n(),e):n;if(l&&Nf(a,e,l),e.postProcess){let o=e.postProcess(l,a,e);return r.jsonSchema=l,o}return r.jsonSchema=l,l}var kf=(a,e)=>{switch(e.$refStrategy){case"root":return{$ref:a.path.join("/")};case"relative":return{$ref:_a(e.currentPath,a.path)};case"none":case"seen":return a.path.length<e.currentPath.length&&a.path.every((t,s)=>e.currentPath[s]===t)?(console.warn(`Recursive reference detected at ${e.currentPath.join("/")}! Defaulting to any`),fe(e)):e.$refStrategy==="seen"?fe(e):void 0}},Nf=(a,e,t)=>(a.description&&(t.description=a.description,e.markdownDescription&&(t.markdownDescription=a.description)),t);var xs=(a,e)=>{let t=Oo(e),s=typeof e=="object"&&e.definitions?Object.entries(e.definitions).reduce((d,[f,p])=>({...d,[f]:B(p._def,{...t,currentPath:[...t.basePath,t.definitionPath,f]},!0)??fe(t)}),{}):void 0,r=typeof e=="string"?e:e?.nameStrategy==="title"?void 0:e?.name,n=B(a._def,r===void 0?t:{...t,currentPath:[...t.basePath,t.definitionPath,r]},!1)??fe(t),l=typeof e=="object"&&e.name!==void 0&&e.nameStrategy==="title"?e.name:void 0;l!==void 0&&(n.title=l),t.flags.hasReferencedOpenAiAnyType&&(s||(s={}),s[t.openAiAnyTypeName]||(s[t.openAiAnyTypeName]={type:["string","number","integer","boolean","array","null"],items:{$ref:t.$refStrategy==="relative"?"1":[...t.basePath,t.definitionPath,t.openAiAnyTypeName].join("/")}}));let o=r===void 0?s?{...n,[t.definitionPath]:s}:n:{$ref:[...t.$refStrategy==="relative"?[]:t.basePath,t.definitionPath,r].join("/"),[t.definitionPath]:{...s,[r]:n}};return t.target==="jsonSchema7"?o.$schema="http://json-schema.org/draft-07/schema#":(t.target==="jsonSchema2019-09"||t.target==="openAi")&&(o.$schema="https://json-schema.org/draft/2019-09/schema#"),t.target==="openAi"&&("anyOf"in o||"oneOf"in o||"allOf"in o||"type"in o&&Array.isArray(o.type))&&console.warn("Warning: OpenAI may not support schemas with unions as roots! Try wrapping it in an object property."),o};var rl=require("fs"),tl=require("os"),al=require("path"),jf=(0,al.join)((0,tl.homedir)(),".claude-mem","silent.log");function tr(a,e,t=""){let s=new Date().toISOString(),o=((new Error().stack||"").split(`
|
|
`)[2]||"").match(/at\s+(?:.*\s+)?\(?([^:]+):(\d+):(\d+)\)?/),d=o?`${o[1].split("/").pop()}:${o[2]}`:"unknown",f=`[${s}] [HAPPY-PATH-ERROR] [${d}] ${a}`;if(e!==void 0)try{f+=` ${JSON.stringify(e)}`}catch(p){f+=` [stringify error: ${p}]`}f+=`
|
|
`;try{(0,rl.appendFileSync)(jf,f)}catch(p){console.error("[silent-debug] Failed to write to log:",p)}return t}var Ts=Da(require("path"),1),fl=require("os");var mt=require("fs"),il=require("path"),ol=require("os");var Ff=["bugfix","feature","refactor","discovery","decision","change"],Lf=["how-it-works","why-it-exists","what-changed","problem-solution","gotcha","pattern","trade-off"];var sl=Ff.join(","),nl=Lf.join(",");var ur=class{static DEFAULTS={CLAUDE_MEM_MODEL:"claude-haiku-4-5",CLAUDE_MEM_CONTEXT_OBSERVATIONS:"50",CLAUDE_MEM_WORKER_PORT:"37777",CLAUDE_MEM_SKIP_TOOLS:"ListMcpResourcesTool,SlashCommand,Skill,TodoWrite,AskUserQuestion",CLAUDE_MEM_DATA_DIR:(0,il.join)((0,ol.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:sl,CLAUDE_MEM_CONTEXT_OBSERVATION_CONCEPTS:nl,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,mt.existsSync)(e))return this.getAllDefaults();let t=(0,mt.readFileSync)(e,"utf-8"),s=JSON.parse(t),r=s;if(s.env&&typeof s.env=="object"){r=s.env;try{(0,mt.writeFileSync)(e,JSON.stringify(r,null,2),"utf-8"),$t.info("SETTINGS","Migrated settings file from nested to flat schema",{settingsPath:e})}catch(l){$t.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 Ps=(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))(Ps||{}),ws=class{level=null;useColor;constructor(){this.useColor=process.stdout.isTTY??!1}getLevel(){if(this.level===null){let e=ur.get("CLAUDE_MEM_LOG_LEVEL").toUpperCase();this.level=Ps[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}}log(e,t,s,r,n){if(e<this.getLevel())return;let l=new Date().toISOString().replace("T"," ").substring(0,23),o=Ps[e].padEnd(5),d=t.padEnd(6),f="";r?.correlationId?f=`[${r.correlationId}] `:r?.sessionId&&(f=`[session-${r.sessionId}] `);let p="";n!=null&&(this.getLevel()===0&&typeof n=="object"?p=`
|
|
`+JSON.stringify(n,null,2):p=" "+this.formatData(n));let m="";if(r){let{sessionId:c,sdkSessionId:y,correlationId:_,...v}=r;Object.keys(v).length>0&&(m=` {${Object.entries(v).map(([T,P])=>`${T}=${P}`).join(", ")}}`)}let b=`[${l}] [${o}] [${d}] ${f}${s}${m}${p}`;e===3?console.error(b):console.log(b)}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`})}},$t=new ws;var Os={DEFAULT:5e3,HEALTH_CHECK:1e3,WORKER_STARTUP_WAIT:1e3,WORKER_STARTUP_RETRIES:15,WINDOWS_MULTIPLIER:1.5};function ll(a){return process.platform==="win32"?Math.round(a*Os.WINDOWS_MULTIPLIER):a}var xa=require("path");var dl=require("os");var Ce=require("path"),cl=require("os");var ul=require("url");var qf={};function Mf(){return typeof __dirname<"u"?__dirname:(0,Ce.dirname)((0,ul.fileURLToPath)(qf.url))}var Ng=Mf(),dr=ur.get("CLAUDE_MEM_DATA_DIR"),Rs=process.env.CLAUDE_CONFIG_DIR||(0,Ce.join)((0,cl.homedir)(),".claude"),jg=(0,Ce.join)(dr,"archives"),Fg=(0,Ce.join)(dr,"logs"),Lg=(0,Ce.join)(dr,"trash"),Mg=(0,Ce.join)(dr,"backups"),qg=(0,Ce.join)(dr,"settings.json"),Ug=(0,Ce.join)(dr,"claude-mem.db"),Vg=(0,Ce.join)(dr,"vector-db"),zg=(0,Ce.join)(Rs,"settings.json"),Hg=(0,Ce.join)(Rs,"commands"),Zg=(0,Ce.join)(Rs,"CLAUDE.md");var Qg=(0,xa.join)(dr,"worker.pid"),Wg=(0,xa.join)(dr,"logs"),Jg=(0,xa.join)((0,dl.homedir)(),".claude","plugins","marketplaces","thedotmack");var ay=Ts.default.join((0,fl.homedir)(),".claude","plugins","marketplaces","thedotmack"),sy=ll(Os.HEALTH_CHECK),vt=null;function pl(){if(vt!==null)return vt;try{let a=Ts.default.join(ur.get("CLAUDE_MEM_DATA_DIR"),"settings.json"),e=ur.loadFromFile(a);return vt=parseInt(e.CLAUDE_MEM_WORKER_PORT,10),vt}catch(a){return $t.debug("SYSTEM","Failed to load port from settings, using default",{error:a}),vt=parseInt(ur.get("CLAUDE_MEM_WORKER_PORT"),10),vt}}var Uf=pl(),Pa=`http://localhost:${Uf}`,Fe={search:"/api/search",timeline:"/api/timeline",decisions:"/api/decisions",changes:"/api/changes",how_it_works:"/api/how-it-works",search_observations:"/api/search/observations",search_sessions:"/api/search/sessions",search_user_prompts:"/api/search/prompts",find_by_concept:"/api/search/by-concept",find_by_file:"/api/search/by-file",find_by_type:"/api/search/by-type",get_recent_context:"/api/context/recent",get_context_timeline:"/api/context/timeline",get_timeline_by_query:"/api/timeline/by-query"};async function Le(a,e){tr("[mcp-server] \u2192 Worker API",{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=`${Pa}${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 tr("[mcp-server] \u2190 Worker API success",{endpoint:a}),n}catch(t){return tr("[mcp-server] \u2190 Worker API error",{endpoint:a,error:t.message}),{content:[{type:"text",text:`Error calling Worker API: ${t.message}`}],isError:!0}}}async function Vf(){try{return(await fetch(`${Pa}/api/health`)).ok}catch{return!1}}var hl=[{name:"search",description:'Unified search across all memory types (observations, sessions, and user prompts) using vector-first semantic search (ChromaDB). Returns combined results from all document types. IMPORTANT: Always use index format first (default) to get an overview with minimal token usage, then use format: "full" only for specific items of interest.',inputSchema:i.object({query:i.string().optional().describe("Natural language search query for semantic ranking via ChromaDB vector search. Optional - omit for date-filtered queries only (Chroma cannot filter by date, requires direct SQLite)."),format:i.enum(["index","full"]).default("index").describe('Output format: "index" for titles/dates only (default, RECOMMENDED for initial search), "full" for complete details (use only after reviewing index results)'),type:i.enum(["observations","sessions","prompts"]).optional().describe("Filter by document type (observations, sessions, or prompts). Omit to search all types."),obs_type:i.string().optional().describe('Filter observations by type (single value or comma-separated list: decision,bugfix,feature,refactor,discovery,change). Only applies when type="observations"'),concepts:i.string().optional().describe('Filter by concept tags (single value or comma-separated list). Only applies when type="observations"'),files:i.string().optional().describe('Filter by file paths (single value or comma-separated list for partial match). Only applies when type="observations"'),project:i.string().optional().describe("Filter by project name"),dateStart:i.union([i.string(),i.number()]).optional().describe("Start date for filtering (ISO string or epoch timestamp)"),dateEnd:i.union([i.string(),i.number()]).optional().describe("End date for filtering (ISO string or epoch timestamp)"),limit:i.number().min(1).max(100).default(20).describe("Maximum number of results"),offset:i.number().min(0).default(0).describe("Number of results to skip"),orderBy:i.enum(["relevance","date_desc","date_asc"]).default("date_desc").describe("Sort order")}),handler:async a=>{let e=Fe.search;return await Le(e,a)}},{name:"timeline",description:"Fetch timeline of observations around a specific point in time. Supports two modes: anchor-based (fetch observations before/after a specific observation ID) and query-based (semantic search for anchor point). IMPORTANT: Use anchor_id when you know the specific observation, or query to find an anchor point first.",inputSchema:i.object({query:i.string().optional().describe("Natural language query to find anchor observation (query-based mode). Mutually exclusive with anchor_id."),anchor_id:i.number().optional().describe("Observation ID to use as anchor (anchor-based mode). Mutually exclusive with query."),before:i.number().min(0).max(100).default(10).describe("Number of observations to fetch before anchor"),after:i.number().min(0).max(100).default(10).describe("Number of observations to fetch after anchor"),format:i.enum(["index","full"]).default("index").describe('Output format: "index" for titles/dates only (default, RECOMMENDED), "full" for complete details'),obs_type:i.string().optional().describe("Filter observations by type (single value or comma-separated list: decision,bugfix,feature,refactor,discovery,change)"),concepts:i.string().optional().describe("Filter by concept tags (single value or comma-separated list)"),files:i.string().optional().describe("Filter by file paths (single value or comma-separated list for partial match)"),project:i.string().optional().describe("Filter by project name")}),handler:async a=>{let e=Fe.timeline;return await Le(e,a)}},{name:"decisions",description:"Semantic shortcut for finding architectural, design, and implementation decisions. Optimized for decision-type observations with relevant keyword boosting.",inputSchema:i.object({query:i.string().describe("Natural language query for finding decisions"),format:i.enum(["index","full"]).default("index").describe('Output format: "index" for titles/dates only (default, RECOMMENDED), "full" for complete details'),limit:i.number().min(1).max(100).default(20).describe("Maximum number of results"),dateStart:i.union([i.string(),i.number()]).optional().describe("Start date for filtering (ISO string or epoch timestamp)"),dateEnd:i.union([i.string(),i.number()]).optional().describe("End date for filtering (ISO string or epoch timestamp)")}),handler:async a=>{let e=Fe.decisions;return await Le(e,a)}},{name:"changes",description:"Semantic shortcut for finding code changes, refactorings, and modifications. Optimized for change-type observations with relevant keyword boosting.",inputSchema:i.object({query:i.string().describe("Natural language query for finding changes"),format:i.enum(["index","full"]).default("index").describe('Output format: "index" for titles/dates only (default, RECOMMENDED), "full" for complete details'),limit:i.number().min(1).max(100).default(20).describe("Maximum number of results"),dateStart:i.union([i.string(),i.number()]).optional().describe("Start date for filtering (ISO string or epoch timestamp)"),dateEnd:i.union([i.string(),i.number()]).optional().describe("End date for filtering (ISO string or epoch timestamp)")}),handler:async a=>{let e=Fe.changes;return await Le(e,a)}},{name:"how_it_works",description:"Semantic shortcut for understanding system architecture, design patterns, and implementation details. Optimized for discovery-type observations with architecture/design keyword boosting.",inputSchema:i.object({query:i.string().describe("Natural language query for understanding how something works"),format:i.enum(["index","full"]).default("index").describe('Output format: "index" for titles/dates only (default, RECOMMENDED), "full" for complete details'),limit:i.number().min(1).max(100).default(20).describe("Maximum number of results"),dateStart:i.union([i.string(),i.number()]).optional().describe("Start date for filtering (ISO string or epoch timestamp)"),dateEnd:i.union([i.string(),i.number()]).optional().describe("End date for filtering (ISO string or epoch timestamp)")}),handler:async a=>{let e=Fe.how_it_works;return await Le(e,a)}},{name:"search_observations",description:'[DEPRECATED - Use "search" with type="observations" instead] Search observations (facts/narratives) using FTS5 full-text search. Supports filtering by type, concepts, files, and date range.',inputSchema:i.object({query:i.string().optional().describe("Full-text search query (FTS5)"),format:i.enum(["index","full"]).default("index").describe('Output format: "index" for titles/dates only (default, RECOMMENDED), "full" for complete details'),type:i.string().optional().describe("Filter by observation type (single value or comma-separated list: decision,bugfix,feature,refactor,discovery,change)"),concepts:i.string().optional().describe("Filter by concept tags (single value or comma-separated list)"),files:i.string().optional().describe("Filter by file paths (single value or comma-separated list for partial match)"),project:i.string().optional().describe("Filter by project name"),dateStart:i.union([i.string(),i.number()]).optional().describe("Start date for filtering (ISO string or epoch timestamp)"),dateEnd:i.union([i.string(),i.number()]).optional().describe("End date for filtering (ISO string or epoch timestamp)"),limit:i.number().min(1).max(100).default(20).describe("Maximum number of results"),offset:i.number().min(0).default(0).describe("Number of results to skip"),orderBy:i.enum(["relevance","date_desc","date_asc"]).default("relevance").describe("Sort order (relevance only when query provided)")}),handler:async a=>{let e=Fe.search_observations;return await Le(e,a)}},{name:"search_sessions",description:'[DEPRECATED - Use "search" with type="sessions" instead] Search session summaries using FTS5 full-text search. Returns both request_summary and learned_summary fields.',inputSchema:i.object({query:i.string().optional().describe("Full-text search query (FTS5)"),format:i.enum(["index","full"]).default("index").describe('Output format: "index" for titles/dates only (default, RECOMMENDED), "full" for complete details'),project:i.string().optional().describe("Filter by project name"),dateStart:i.union([i.string(),i.number()]).optional().describe("Start date for filtering (ISO string or epoch timestamp)"),dateEnd:i.union([i.string(),i.number()]).optional().describe("End date for filtering (ISO string or epoch timestamp)"),limit:i.number().min(1).max(100).default(20).describe("Maximum number of results"),offset:i.number().min(0).default(0).describe("Number of results to skip"),orderBy:i.enum(["relevance","date_desc","date_asc"]).default("relevance").describe("Sort order (relevance only when query provided)")}),handler:async a=>{let e=Fe.search_sessions;return await Le(e,a)}},{name:"search_user_prompts",description:'[DEPRECATED - Use "search" with type="prompts" instead] Search user prompts using FTS5 full-text search. Searches prompt text only.',inputSchema:i.object({query:i.string().optional().describe("Full-text search query (FTS5)"),format:i.enum(["index","full"]).default("index").describe('Output format: "index" for titles/dates only (default, RECOMMENDED), "full" for complete details'),project:i.string().optional().describe("Filter by project name"),dateStart:i.union([i.string(),i.number()]).optional().describe("Start date for filtering (ISO string or epoch timestamp)"),dateEnd:i.union([i.string(),i.number()]).optional().describe("End date for filtering (ISO string or epoch timestamp)"),limit:i.number().min(1).max(100).default(20).describe("Maximum number of results"),offset:i.number().min(0).default(0).describe("Number of results to skip"),orderBy:i.enum(["relevance","date_desc","date_asc"]).default("relevance").describe("Sort order (relevance only when query provided)")}),handler:async a=>{let e=Fe.search_user_prompts;return await Le(e,a)}},{name:"find_by_concept",description:"Find observations tagged with specific concepts. Returns observations that match any of the provided concept tags.",inputSchema:i.object({concepts:i.string().describe("Concept tag(s) to filter by (single value or comma-separated list)"),format:i.enum(["index","full"]).default("index").describe('Output format: "index" for titles/dates only (default, RECOMMENDED), "full" for complete details'),type:i.string().optional().describe("Filter by observation type (single value or comma-separated list: decision,bugfix,feature,refactor,discovery,change)"),files:i.string().optional().describe("Filter by file paths (single value or comma-separated list for partial match)"),project:i.string().optional().describe("Filter by project name"),dateStart:i.union([i.string(),i.number()]).optional().describe("Start date for filtering (ISO string or epoch timestamp)"),dateEnd:i.union([i.string(),i.number()]).optional().describe("End date for filtering (ISO string or epoch timestamp)"),limit:i.number().min(1).max(100).default(20).describe("Maximum number of results"),offset:i.number().min(0).default(0).describe("Number of results to skip"),orderBy:i.enum(["date_desc","date_asc"]).default("date_desc").describe("Sort order")}),handler:async a=>{let e=Fe.find_by_concept;return await Le(e,a)}},{name:"find_by_file",description:"Find observations related to specific file paths. Uses partial matching - searches for file paths containing the provided string.",inputSchema:i.object({files:i.string().describe("File path(s) to filter by (single value or comma-separated list for partial match)"),format:i.enum(["index","full"]).default("index").describe('Output format: "index" for titles/dates only (default, RECOMMENDED), "full" for complete details'),type:i.string().optional().describe("Filter by observation type (single value or comma-separated list: decision,bugfix,feature,refactor,discovery,change)"),concepts:i.string().optional().describe("Filter by concept tags (single value or comma-separated list)"),project:i.string().optional().describe("Filter by project name"),dateStart:i.union([i.string(),i.number()]).optional().describe("Start date for filtering (ISO string or epoch timestamp)"),dateEnd:i.union([i.string(),i.number()]).optional().describe("End date for filtering (ISO string or epoch timestamp)"),limit:i.number().min(1).max(100).default(20).describe("Maximum number of results"),offset:i.number().min(0).default(0).describe("Number of results to skip"),orderBy:i.enum(["date_desc","date_asc"]).default("date_desc").describe("Sort order")}),handler:async a=>{let e=Fe.find_by_file;return await Le(e,a)}},{name:"find_by_type",description:"Find observations of specific types. Returns observations matching any of the provided observation types.",inputSchema:i.object({type:i.string().describe("Observation type(s) to filter by (single value or comma-separated list: decision,bugfix,feature,refactor,discovery,change)"),format:i.enum(["index","full"]).default("index").describe('Output format: "index" for titles/dates only (default, RECOMMENDED), "full" for complete details'),concepts:i.string().optional().describe("Filter by concept tags (single value or comma-separated list)"),files:i.string().optional().describe("Filter by file paths (single value or comma-separated list for partial match)"),project:i.string().optional().describe("Filter by project name"),dateStart:i.union([i.string(),i.number()]).optional().describe("Start date for filtering (ISO string or epoch timestamp)"),dateEnd:i.union([i.string(),i.number()]).optional().describe("End date for filtering (ISO string or epoch timestamp)"),limit:i.number().min(1).max(100).default(20).describe("Maximum number of results"),offset:i.number().min(0).default(0).describe("Number of results to skip"),orderBy:i.enum(["date_desc","date_asc"]).default("date_desc").describe("Sort order")}),handler:async a=>{let e=Fe.find_by_type;return await Le(e,a)}},{name:"get_recent_context",description:"Get recent session context for timeline display. Returns recent observations, sessions, and user prompts with metadata for building timeline UI.",inputSchema:i.object({limit:i.number().min(1).max(100).default(30).describe("Maximum number of timeline items to return"),format:i.enum(["index","full"]).default("index").describe('Output format: "index" for titles/dates only (default, RECOMMENDED), "full" for complete details'),type:i.string().optional().describe("Filter by observation type (single value or comma-separated list: decision,bugfix,feature,refactor,discovery,change)"),concepts:i.string().optional().describe("Filter by concept tags (single value or comma-separated list)"),files:i.string().optional().describe("Filter by file paths (single value or comma-separated list for partial match)"),project:i.string().optional().describe("Filter by project name"),dateStart:i.union([i.string(),i.number()]).optional().describe("Start date for filtering (ISO string or epoch timestamp)"),dateEnd:i.union([i.string(),i.number()]).optional().describe("End date for filtering (ISO string or epoch timestamp)")}),handler:async a=>{let e=Fe.get_recent_context;return await Le(e,a)}},{name:"get_context_timeline",description:"Get timeline of observations around a specific observation ID. Returns observations before and after the anchor point with metadata for timeline display.",inputSchema:i.object({anchor_id:i.number().describe("Observation ID to use as anchor point"),before:i.number().min(0).max(100).default(10).describe("Number of observations to fetch before anchor"),after:i.number().min(0).max(100).default(10).describe("Number of observations to fetch after anchor"),format:i.enum(["index","full"]).default("index").describe('Output format: "index" for titles/dates only (default, RECOMMENDED), "full" for complete details'),type:i.string().optional().describe("Filter by observation type (single value or comma-separated list: decision,bugfix,feature,refactor,discovery,change)"),concepts:i.string().optional().describe("Filter by concept tags (single value or comma-separated list)"),files:i.string().optional().describe("Filter by file paths (single value or comma-separated list for partial match)"),project:i.string().optional().describe("Filter by project name")}),handler:async a=>{let e=Fe.get_context_timeline;return await Le(e,a)}},{name:"get_timeline_by_query",description:"Combined search + timeline tool. First searches for observations matching the query, then returns timeline around the best match. Useful for finding specific observations and viewing their context.",inputSchema:i.object({query:i.string().describe("Natural language query to find anchor observation"),before:i.number().min(0).max(100).default(10).describe("Number of observations to fetch before anchor"),after:i.number().min(0).max(100).default(10).describe("Number of observations to fetch after anchor"),format:i.enum(["index","full"]).default("index").describe('Output format: "index" for titles/dates only (default, RECOMMENDED), "full" for complete details'),type:i.string().optional().describe("Filter by observation type (single value or comma-separated list: decision,bugfix,feature,refactor,discovery,change)"),concepts:i.string().optional().describe("Filter by concept tags (single value or comma-separated list)"),files:i.string().optional().describe("Filter by file paths (single value or comma-separated list for partial match)"),project:i.string().optional().describe("Filter by project name"),dateStart:i.union([i.string(),i.number()]).optional().describe("Start date for filtering (ISO string or epoch timestamp)"),dateEnd:i.union([i.string(),i.number()]).optional().describe("End date for filtering (ISO string or epoch timestamp)")}),handler:async a=>{let e=Fe.get_timeline_by_query;return await Le(e,a)}}],As=new va({name:"claude-mem-search-server",version:"1.0.0"},{capabilities:{tools:{}}});As.setRequestHandler(Va,async()=>({tools:hl.map(a=>({name:a.name,description:a.description,inputSchema:xs(a.inputSchema)}))}));As.setRequestHandler(za,async a=>{let e=hl.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 ml(){tr("[mcp-server] Shutting down..."),process.exit(0)}process.on("SIGTERM",ml);process.on("SIGINT",ml);async function zf(){let a=new ya;await As.connect(a),tr("[mcp-server] Claude-mem search server started"),setTimeout(async()=>{await Vf()?tr("[mcp-server] Worker available at",Pa):(tr("[mcp-server] WARNING: Worker not available at",Pa),tr("[mcp-server] Tools will fail until Worker is started"),tr("[mcp-server] Start Worker with: npm run worker:restart"))},0)}zf().catch(a=>{tr("[mcp-server] Fatal error:",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 *)
|
|
*/
|